Skip to content

feat(architecture): architecture command + MCP tool (Phase 2/4)#13

Merged
denfry merged 1 commit into
mainfrom
feat/architecture-command
Jun 23, 2026
Merged

feat(architecture): architecture command + MCP tool (Phase 2/4)#13
denfry merged 1 commit into
mainfrom
feat/architecture-command

Conversation

@denfry

@denfry denfry commented Jun 23, 2026

Copy link
Copy Markdown
Owner

Phase 2 of 4 — porting safishamsi/graphify into codebase-index

Stacked on #12 (Phase 1). Base is feat/graph-confidence-analysis; GitHub will retarget to main once Phase 1 merges. Review #12 first.

Surfaces the analytics engine from Phase 1 as a user- and agent-facing codebase map.

Added

  • codebase-index architecture (--json for structured output) — a high-level map read from the analytics cached at index time (no recompute):

    • Modules — detected communities with auto-derived labels (dominant non-test directory)
    • God nodes — the most-connected symbols/files
    • Surprising connections — edges bridging weakly-linked modules
    • Suggested questions — starting points seeded from the structure

    On a pre-analytics index it reports available: false with a reindex hint instead of crashing.

  • architecture_overview MCP tool — the same payload over the stable MCP envelope, so an agent can orient before diving in. Added to the server instructions.

  • service.architecture_payload (shared by CLI + MCP, no drift) and render_architecture.

Example (this repo)

Architecture overview | 952 nodes · 2133 edges · 212 modules · modularity 0.66
Modules: src/codebase_index/storage (Database, build_index), .../indexer, .../graph, .../mcp …
God nodes: Database, build_index, Config, upsert_file …

Tests / CI

  • payload available + unavailable paths; CLI + MCP goldens regenerated
  • pytest: 381 passed, 14 skipped · ruff: clean · mypy: clean

🤖 Generated with Claude Code

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 5b2fe8e551

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/codebase_index/cli.py
typer.echo(json_renderer.render(payload) if want_json else md_renderer.render(payload))


@app.command("architecture")

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Add architecture to the cbx allowlist

When skill/plugin users invoke the supported cbx wrapper instead of the raw codebase-index binary, this new subcommand is still blocked: skill/scripts/cbx, skill/scripts/cbx.ps1, the packaged template copies, and bin/cbx only allow search explain symbol refs impact graph stats doctor update index, so cbx architecture exits 2 before reaching this command. Please add architecture to those synced allowlists so the advertised command works through the bundled wrappers.

Useful? React with 👍 / 👎.

…MCP tool

Phase 2 of porting graphify into codebase-index. Surfaces the analytics cached
in Phase 1 as a high-level codebase map.

- `codebase-index architecture` (+ --json): modules with auto-labels, god nodes,
  surprising cross-module bridges, suggested questions; reads the cached summary
  (no recompute). Reports "unavailable" + reindex hint on a pre-analytics index.
- MCP tool `architecture_overview` exposes the same payload via the stable
  envelope; added to server instructions.
- service.architecture_payload (shared by CLI + MCP) + render_architecture.
- Tests: payload available/unavailable paths; CLI + MCP goldens regenerated.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@denfry denfry force-pushed the feat/architecture-command branch from 5b2fe8e to 966e6cd Compare June 23, 2026 20:51
@denfry denfry changed the base branch from feat/graph-confidence-analysis to main June 23, 2026 21:01
@denfry denfry merged commit f592a65 into main Jun 23, 2026
10 checks passed
@denfry denfry deleted the feat/architecture-command branch June 23, 2026 21:12
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