feat(analyze): context-emit fallback + source-only file scope#2
Merged
Merged
Conversation
--all and path() on a directory scanned EVERY .php under the working dir, including vendor/ — on a real Laravel app (Arch) --emit produced 55k+ units and a 1.5GB work order, dominated by dependency code. FileScopeResolver now excludes vendor, node_modules, storage and bootstrap/cache from broad scans (relative to each scanned root, so an explicit --path=vendor/foo still works).
…ured context-emit (--emit → /codeguard-review → --ingest) is the supported, subscription-based transport; an API driver is an optional seam that ships empty (NullLlmClient). So when no driver is bound, codeguard:analyze now informs and emits a work order instead of printing a dead-end 'not configured' notice and adjudicating nothing. The synchronous LlmClient path runs only when a real driver replaces NullLlmClient. Also adds a --ingest file-not-found error test.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
Two fixes surfaced while wiring
codeguard:analyzeagainst a real Laravel app (Arch):No-driver dead-end. With only
NullLlmClientbound (the default — the real adjudication transport is context-emit via/codeguard-review, using the Claude Code subscription, no metered API),codeguard:analyzejust printed "LLM driver not configured" and adjudicated nothing. Now it informs and falls back to emitting a work order for the context-emit review path. The synchronousLlmClientpath runs only when a real driver replacesNullLlmClient.Broad scope scanned
vendor/.--all/path(<dir>)walked every.phpunder the working dir — on Arch that meant 55k+ units and a 1.5GB work order, dominated by dependency code.FileScopeResolvernow excludesvendor,node_modules,storage,bootstrap/cachefrom broad scans (relative to each scanned root, so an explicit--path=vendor/foostill works).Tests (TDD, RED→GREEN)
FileScopeResolver: excludes generated/dependency dirs from--all; explicit vendor subtree still scanned.codeguard:analyze: falls back to context-emit (emits a work order, informs, no synchronous review) when no driver is configured — replaces the old "skip/dead-end" test. Plus a--ingestfile-not-found error test.Verification
501 tests pass · PHPStan no errors · Pint clean · coverage 80.1%.