Skip to content

Phases 142-148: HTTP/MCP parity sweep (workflow, analysis flags, narrate/explain, guide, watch, graph, insights)#124

Merged
jsilvanus merged 15 commits into
mainfrom
claude/subagents-deploy-142-148-dhe3mq
Jul 2, 2026
Merged

Phases 142-148: HTTP/MCP parity sweep (workflow, analysis flags, narrate/explain, guide, watch, graph, insights)#124
jsilvanus merged 15 commits into
mainfrom
claude/subagents-deploy-142-148-dhe3mq

Conversation

@jsilvanus

Copy link
Copy Markdown
Owner

Summary

Implements PLAN.md Phases 142-148, closing the remaining CLI/HTTP/MCP interface-parity gaps found in the audit that started with Phase 138:

  • 142POST /analysis/workflow now supports all 8 CLI workflow templates (was 3), plus role/ref body fields.
  • 143 — Analysis-route flag-parity bundle: merge-audit base, merge-preview/clusters cluster-tuning flags, security-scan highConfidenceOnly, impact chunks/level/lens, semantic-diff hybrid/bm25Weight (fixing a pre-existing dead-flag bug in the CLI's own diff command along the way), semantic-blame level.
  • 144narrate/explain HTTP routes gain an evidenceOnly toggle (safe-by-default parity with the CLI), explain gains log/files, both gain lens.
  • 145guide HTTP route gains lens; remote multi-turn/session support is deliberately deferred (open design question, documented in docs/feature-ideas.md).
  • 146 — New GET /watch / DELETE /watch/:name HTTP routes (previously only add/run existed).
  • 147 — Graph command family: 8 new MCP tools and 11 new HTTP routes (callers, callees, neighbors, path, relate, similar, unused, cycles, deps, co-change, blast-radius); graph build stays CLI-only by design (mutating index-maintenance op).
  • 148 — Triaged the remaining 13 zero-HTTP/MCP-exposure CLI commands: 10 gained MCP tools + HTTP routes (bisect, refactor-candidates, lifecycle, cherry-pick-suggest, file-diff, pr-report, regression-gate, code-review, map, heatmap); 3 correctly excluded as CLI-shaped or redundant (cross-repo-similarity, project, ci-diff/diff).

MCP tool count is now 56 (up from 38 at the start of this track). Each phase was built independently in an isolated worktree and merged sequentially; conflicts (mostly in docs/PLAN.md, docs/parity.md, docs/features.md, CLAUDE.md, and tests/serverRoutes.test.ts) were reconciled by hand, including correcting cumulative MCP tool-count arithmetic across phases.

Docs updated: docs/PLAN.md (all 7 phases marked complete with deviations noted), docs/features.md, README.md, docs/parity.md, CLAUDE.md. 7 changesets added (all minor).

Test plan

  • pnpm build — clean
  • pnpm test — full suite green (1572 passed, 22 skipped, 0 failed)
  • Each phase's new HTTP routes/MCP tools covered by new integration tests (tests/serverRoutes.test.ts, tests/insightsRoutes.test.ts, tests/insightsTools.test.ts, tests/serverGuideRoute.test.ts)

Generated by Claude Code

claude added 14 commits July 2, 2026 05:10
CLI's `gitsema watch` has add/run/list/remove; HTTP previously only
exposed POST /watch/add and POST /watch/run. Add GET /watch (list, newest
first) and DELETE /watch/:name (remove by name, 404 if not found),
mirroring the CLI's watch list/watch remove exactly — name is used as the
identifier since that's the saved_queries table's unique key and what the
CLI's own `watch remove <name>` deletes by.

Updates docs/parity.md (new watch row in the Tool Matrix, which had none
before), docs/features.md, README.md, docs/PLAN.md (Phase 146 marked
complete with the :name-vs-:id deviation noted), adds integration tests
to tests/serverRoutes.test.ts, and adds a changeset.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WyC4ii9yHPz7bsXcJLbedN
POST /api/v1/guide/chat now accepts lens: 'semantic'|'structural'|'hybrid',
mirroring CLI `guide --lens` byte-for-byte by appending the same tool-bias
hint suffix to the question before calling runGuide(). The remote
multi-turn/session half of Phase 145's original scope (HTTP equivalent of
CLI guide --interactive) is a genuine open design question rather than a
flag gap, and is explicitly deferred to a follow-up phase rather than
bolted on speculatively — documented in docs/PLAN.md's Phase 145 entry and
written up as a full design-gaps entry in docs/feature-ideas.md.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WyC4ii9yHPz7bsXcJLbedN
POST /analysis/workflow's WorkflowBodySchema previously only accepted 3 of
the 8 productized workflow templates the CLI's `workflow run` supports.
Extends the template enum to all 8 (pr-review, incident, release-audit,
onboarding, ownership-intel, arch-drift, knowledge-portal,
regression-forecast), wiring each new template to the same core functions
the CLI calls (all already imported/used elsewhere in analysis.ts, so no
follow-up gaps). Adds role/ref body fields generally (mirroring CLI
--role/--ref); base was already present and un-gated, and is intentionally
left as a no-op matching the CLI's own dead --base flag.

Updates docs/PLAN.md (Phase 142 marked complete with deviations),
docs/parity.md, docs/features.md, and README.md; adds a changeset.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WyC4ii9yHPz7bsXcJLbedN
…HTTP routes

Phase 144: POST /narrate and POST /explain gain an `evidenceOnly` body field
mirroring the CLI's safe-by-default `--narrate`/`--evidence-only` toggle
(HTTP callers previously had no way to request it explicitly), plus a
structured `evidence` array in both responses. POST /explain additionally
gains `log` (error/stack-trace context) and `files` (search-scope glob,
mirrored as-is including the CLI's pre-existing files-doesn't-filter-commits
gap), and both routes gain `lens`, which drives a `structuralContext`
response field on /explain when combined with `files` under a
structural/hybrid lens (no-op on /narrate, which has no per-file enrichment
target).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WyC4ii9yHPz7bsXcJLbedN
Close a grab-bag of small, independent HTTP-vs-CLI flag gaps across
src/server/routes/analysis.ts found by the Interface Parity Track audit:

- merge-audit: add `base` (merge-base override, mirrors CLI --base)
- merge-preview: add top/iterations/edgeThreshold/enhancedKeywordsN, plus
  useEnhancedLabels (deviation — enhancedKeywordsN is a no-op without it)
- branch-summary: add enhancedLabels/enhancedKeywordsN, which now slice
  nearestConcepts[].topKeywords in the JSON response (this route's only
  "view"), since computeBranchSummary() has no enhanced-labels concept of
  its own — the CLI only uses these flags for text-mode display
- clusters: add iterations/edgeThreshold/enhancedKeywordsN
- security-scan: add highConfidenceOnly (filters to confidence === 'high')
- impact: add chunks/level/lens — lens=structural|hybrid makes this route a
  thin blast-radius alias, closing a real divergence where HTTP previously
  only ever did semantic-lens impact analysis
- semantic-diff: add hybrid/bm25Weight, which required fixing a pre-existing
  CLI bug where `diff`'s --hybrid/--bm25-weight flags were declared but
  never wired to anything; computeSemanticDiff() gained an optional
  candidateBlobs parameter (mirrors computeAuthorContributions's Phase-141
  pattern) so both interfaces now genuinely blend BM25 via hybridSearch()
- semantic-blame: add level (file/symbol) as an alternate spelling of the
  pre-existing searchSymbols boolean

Updates docs/PLAN.md (Phase 143 marked complete with deviations noted),
docs/parity.md (§1/§2.2/§6), and docs/features.md. Adds unit tests for
computeSemanticDiff's new candidateBlobs param and HTTP integration tests
for every new flag across all 8 routes.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WyC4ii9yHPz7bsXcJLbedN
Adds POST /api/v1/graph/{callers,callees,neighbors,path,relate,similar,
unused,cycles,deps,co-change,blast-radius} HTTP routes and MCP tools
graph_path/graph_relate/graph_similar/graph_unused/cycles/deps/co_change/
blast_radius, closing the pre-existing HTTP/MCP gap for most of the CLI's
graph command family (previously only `hotspots` had a route, and only
call_graph/graph_neighbors/hotspots had MCP tools). All are thin
schema-validated wrappers over the already-tested src/core/graph/* query
helpers. graph build stays CLI-only: it truncates and rebuilds
graph_nodes/edges (mutating index-maintenance, not a query), matching the
existing precedent for index vacuum/gc/rebuild-fts/etc.

Updates docs/parity.md (matrix + roadmap + flag notes), docs/features.md,
README.md, CLAUDE.md's MCP tool inventory, and docs/PLAN.md's Phase 147
entry with the graph-build design rationale. Adds HTTP route tests to
tests/serverRoutes.test.ts and a minor changeset.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WyC4ii9yHPz7bsXcJLbedN
…e rest

Adds MCP tools (src/mcp/tools/insights.ts) and POST /api/v1/insights/*
HTTP routes (src/server/routes/insights.ts) for the 10 CLI commands that
genuinely had zero HTTP/MCP exposure: bisect, refactor-candidates,
lifecycle, cherry-pick-suggest, file-diff, pr-report, regression-gate,
code-review, map, and heatmap. regression-gate and code-review had their
core logic extracted out of the CLI layer into
src/core/search/regressionGate.ts and src/core/search/codeReview.ts so
CLI/MCP/HTTP share one implementation.

cross-repo-similarity, project, and ci-diff were judged CLI-shaped by
nature (raw local filesystem paths, local precompute step, and
CI-runner/GitHub-comment side effects respectively) and intentionally left
CLI-only; diff was found to be the exact same implementation as the
already-exposed semantic-diff, not a separate feature. Full triage
rationale is in docs/parity.md's Phase 148 footnotes.

Also fixes a pre-existing bug in computeRefactorCandidates' default
level: 'symbol' query, which referenced a nonexistent
symbol_embeddings.blob_hash column and threw on any index with symbol
embeddings present.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WyC4ii9yHPz7bsXcJLbedN
…-deploy-142-148-dhe3mq

Phase 142 — workflow HTTP route parity
…-deploy-142-148-dhe3mq

Phase 143 — Analysis-route small-fixes bundle

# Conflicts:
#	docs/PLAN.md
#	docs/parity.md
…-deploy-142-148-dhe3mq

Phase 144 — narrate/explain HTTP routes evidence-only toggle and missing context flags

# Conflicts:
#	docs/parity.md
…-deploy-142-148-dhe3mq

Phase 145 — guide HTTP route lens support (multi-turn session deferred)

# Conflicts:
#	docs/parity.md
…-deploy-142-148-dhe3mq

Phase 146 — watch list/remove HTTP routes

# Conflicts:
#	tests/serverRoutes.test.ts
…-deploy-142-148-dhe3mq

Phase 147 — Graph command family HTTP/MCP exposure

# Conflicts:
#	docs/features.md
#	docs/parity.md
…-deploy-142-148-dhe3mq

Phase 148 — Triage remaining zero-HTTP/MCP-exposure CLI commands

# Conflicts:
#	CLAUDE.md
#	docs/features.md
#	docs/parity.md
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

resolveRefToTimestamp() shells out to `git log <ref>` when a ref isn't a
parseable date, but CI checkouts are shallow/detached-HEAD with no local
`main` branch — only HEAD resolves. Switch the two new bisect tests to a
date string for goodRef (resolveRefToTimestamp tries Date-parsing first).

Also closes session.rawDb before rmSync() in evolutionBranch.test.ts's
afterEach, per CLAUDE.md's Windows-CI testing convention (unrelated
pre-existing gap, but blocking this PR's Windows CI job).
@jsilvanus jsilvanus merged commit 3fd799d into main Jul 2, 2026
4 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.

2 participants