feat: structured AI responses, review file exclusions, and commit status checks#18
Open
feat: structured AI responses, review file exclusions, and commit status checks#18
Conversation
Replace the plain string return from AIProvider.complete() with a structured AIResponse containing text and usage (inputTokens, outputTokens). Update all three providers (Claude, OpenAI, Ollama), all callers, and all test mocks to use the new shape.
Add ignore glob patterns to CodeReviewConfig so specific files (e.g. lock files, generated code, dist/) can be excluded from AI code review. Filtered files are also excluded from the diff sent to the AI provider and from context building.
Add optional commitStatus flag to CodeReviewConfig. When enabled, the reviewer posts a GitHub commit status after each review: failure if any BLOCKING findings exist, success otherwise. This allows branch protection rules to require passing reviews.
…ct buildCommitStatus
- matchesIgnorePattern now escapes [](){}+^$|\ before converting glob to regex
- Extract buildCommitStatus() as testable function instead of inline logic
- Tests call the real function instead of duplicating implementation
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.
Summary
Phase 4 foundation features that improve AI provider observability, review configurability, and CI enforcement:
AIProvider.complete()now returnsAIResponsewith token usage (inputTokens/outputTokens) and supports per-callmaxTokensoption. All three providers (Claude, OpenAI, Ollama) updated. Foundation for cost tracking and budget controls.codeReview.ignoreconfig. Supports*,**,?patterns with proper regex metacharacter escaping. Skips review entirely when all changed files are excluded.codeReview.commitStatusconfig flag. Transforms RepoKeeper from advisory to enforceable merge gate.Changes
src/ai/provider.ts— NewAIResponse,AIUsage,AIRequestOptionsinterfacessrc/ai/claude.ts,openai.ts,ollama.ts— Return structured responses with token usagesrc/review/reviewer.ts—matchesIgnorePattern(),filterIgnoredFiles(),filterDiffByFiles(),buildCommitStatus()src/github/client.ts—createCommitStatus()methodsrc/config.ts— AddedignoreandcommitStatusdefaultsTest plan
pnpm build— zero TypeScript errorspnpm test— 112/112 tests passing{ text }fromAIResponse?wildcard, dots, regex metacharacters ([],(),+)buildCommitStatus()function