Refactor CLI analyze to use pkg/prism (Phase 2)#5
Merged
Conversation
The CLI analyze command now calls pkg/prism.Analyze() internally and delegates output formatting to internal/formatter, which has been rewritten to take prism.Result as input. CLI JSON output is now byte-identical to pkg/prism.Result, verified by golden tests. Breaking changes to CLI JSON output (v0.2 → v0.3): - provider moved from top-level to pull_request.provider - pull_request.description removed (use prism fetch for raw description) - pull_request.url added (canonical PR URL) - changed_files[].patch excluded by default (library has IncludePatches opt-in) - Empty/zero fields now omitted (omitempty semantics) Implementation: - Delete internal/usecase/analyze.go (replaced by pkg/prism.Analyze + formatter) - Rewrite internal/formatter to take prism.Result instead of domain types - Update golden test fixture to new shape - Add test seam: provider.NewRegistryWithGitHubBaseURL for redirecting the github provider to a local httptest server - Add pkg/prism/integration_test.go with happy-path tests using mock GitHub server (Analyze, Prompt, IncludePatches, upstream failure) - CLI version bumped to 0.3.0-dev prompt and fetch commands still go through internal/usecase pending extension of pkg/prism.Prompt to cover --format and --template options. Documentation updates: - README.md: JSON/Markdown examples updated, Roadmap reorganized (v0.3.0 = library API, v0.4.0 = policy files) - docs/adr/0002: Phase 2 completion noted - docs/json-schema.md: new shape, breaking changes section - docs/architecture.md: cmd/prism, formatter, usecase descriptions updated
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
CLI
analyzenow callspkg/prism.Analyze()internally. The CLI JSON output is byte-identical topkg/prism.Result, verified by golden tests. This completes Phase 2 of ADR-0002 and ensures CLI/library symmetry.Breaking changes (CLI JSON output, v0.2 → v0.3)
These changes match the spec defined in ADR-0002 and are documented in `docs/json-schema.md`.
What's in
Code
Docs
Deferred to a future PR
Test plan