Skip to content

feat(analyze): context-emit fallback + source-only file scope#2

Merged
henryavila merged 2 commits into
mainfrom
feat/analyze-emit-fallback-and-source-scope
Jun 4, 2026
Merged

feat(analyze): context-emit fallback + source-only file scope#2
henryavila merged 2 commits into
mainfrom
feat/analyze-emit-fallback-and-source-scope

Conversation

@henryavila
Copy link
Copy Markdown
Owner

Why

Two fixes surfaced while wiring codeguard:analyze against a real Laravel app (Arch):

  1. No-driver dead-end. With only NullLlmClient bound (the default — the real adjudication transport is context-emit via /codeguard-review, using the Claude Code subscription, no metered API), codeguard:analyze just 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 synchronous LlmClient path runs only when a real driver replaces NullLlmClient.

  2. Broad scope scanned vendor/. --all / path(<dir>) walked every .php under the working dir — on Arch that meant 55k+ units and a 1.5GB work order, dominated by dependency code. FileScopeResolver now excludes vendor, node_modules, storage, bootstrap/cache from broad scans (relative to each scanned root, so an explicit --path=vendor/foo still 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 --ingest file-not-found error test.

Verification

501 tests pass · PHPStan no errors · Pint clean · coverage 80.1%.

--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.
@henryavila henryavila merged commit 50d8d0c into main Jun 4, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant