feat(cli): add daemonless gortex analyze command#84
Draft
avfirsov wants to merge 2 commits into
Draft
Conversation
Expose graph analyzers on the CLI without a running daemon. `gortex analyze --kind <k> --path <dir> [--format json|text]` indexes the path entirely in-process (no daemon, no socket) and runs the analyzer against the fresh graph — handy for CI pipelines and one-shot scripts. Supported kinds: `synthesizers`, `resolution_outcomes`. To avoid duplicating logic between the MCP tool and the CLI, the analyzer cores are extracted into a new `internal/analyzer` package as pure calculations (graph in, struct out): - `AnalyzeSynthesizers` - `AnalyzeResolutionOutcomes` / `ClassifyUnresolved` The existing MCP handlers (`handleAnalyzeSynthesizers`, `handleAnalyzeResolutionOutcomes`) are refactored to call these cores; their JSON/compact output shapes are unchanged and the existing MCP-layer tests pass as-is. The resolution-outcome taxonomy constants now live in `internal/analyzer` with thin aliases kept in the mcp package. Tests: unit tests for both cores + an end-to-end index→analyze CLI test. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
golangci-lint errcheck flagged the text-format print paths in cmd/gortex/analyze.go. Ignore the return explicitly, matching the codebase idiom. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.
What
Adds a daemonless
gortex analyzeCLI command:It indexes
--pathentirely in-process — no daemon, no socket — and runs the analyzer against the fresh graph. Useful for CI pipelines and one-shot scripts that want graph analytics without standing up the daemon.Why this shape
To avoid duplicating logic between the MCP tool and the new CLI, the analyzer cores are extracted into a new
internal/analyzerpackage as pure calculations (graph in, struct out):AnalyzeSynthesizersAnalyzeResolutionOutcomes/ClassifyUnresolvedThe existing MCP handlers (
handleAnalyzeSynthesizers,handleAnalyzeResolutionOutcomes) are refactored to call these cores. Output shapes are unchanged — the existing MCP-layer tests pass as-is, which is the safety net for the refactor. The resolution-outcome taxonomy constants now live ininternal/analyzer, with thin aliases retained in themcppackage so existing call sites/tests keep compiling.Tests
internal/analyzer: unit/shape tests for both cores (synthesizer grouping + name filter; the full unresolved-edge taxonomy + reason filter).cmd/gortex: end-to-end index→analyze tests asserting valid JSON for both kinds, plus unsupported-kind validation.internal/mcpanalyze handler tests unchanged and green.go build ./...andgo test ./internal/analyzer/... ./cmd/gortex/... ./internal/mcp/...pass.Notes / scope
synthesizers,resolution_outcomes) — the ones whose cores are extracted here. Easy to extend the dispatcher to more kinds in follow-ups.🤖 Generated with Claude Code