Skip to content

feat(cli): add daemonless gortex analyze command#84

Open
avfirsov wants to merge 2 commits into
zzet:mainfrom
avfirsov:feat/cli-analyze
Open

feat(cli): add daemonless gortex analyze command#84
avfirsov wants to merge 2 commits into
zzet:mainfrom
avfirsov:feat/cli-analyze

Conversation

@avfirsov

Copy link
Copy Markdown
Contributor

What

Adds a daemonless gortex analyze CLI command:

gortex analyze --kind <synthesizers|resolution_outcomes> --path <dir> [--format json|text]

It indexes --path entirely 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/analyzer package as pure calculations (graph in, struct out):

  • AnalyzeSynthesizers
  • AnalyzeResolutionOutcomes / ClassifyUnresolved

The 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 in internal/analyzer, with thin aliases retained in the mcp package 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.
  • Existing internal/mcp analyze handler tests unchanged and green.

go build ./... and go test ./internal/analyzer/... ./cmd/gortex/... ./internal/mcp/... pass.

Notes / scope

  • Two kinds to start (synthesizers, resolution_outcomes) — the ones whose cores are extracted here. Easy to extend the dispatcher to more kinds in follow-ups.
  • Purely additive on the CLI surface; the only change to existing code is the DRY refactor of the two MCP handlers onto the shared cores.

🤖 Generated with Claude Code

avfirsov and others added 2 commits June 13, 2026 10:21
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>
@avfirsov avfirsov marked this pull request as ready for review June 14, 2026 08:44
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