Skip to content

[codex] Make the CodeGraphy CLI self-explanatory for agents#313

Merged
joesobo merged 57 commits into
mainfrom
codex/cli-agent-interface
Jul 22, 2026
Merged

[codex] Make the CodeGraphy CLI self-explanatory for agents#313
joesobo merged 57 commits into
mainfrom
codex/cli-agent-interface

Conversation

@joesobo

@joesobo joesobo commented Jul 17, 2026

Copy link
Copy Markdown
Owner

Why

The CLI and extension share one model: configure graph contributors, index the complete workspace graph into SQLite, shape results through Filters and Graph Scope, then query the cache. The agent-facing CLI needs the same model with a compact database and a self-sufficient command contract.

What changed

  • Replaces the old cache layout with five small relational tables:
    • File(id, path, mtime, size, contentHash)
    • Node(id, key, type, label, fileId, parentId, pluginId, language)
    • NodeView(nodeKey, color, x, y, favorite, shape, imageUrl, isCollapsed)
    • Symbol(nodeId, name, kind, pluginId, language)
    • Edge(id, key, sourceNodeId, targetNodeId, type)
  • Uses generated integer row IDs and real foreign keys. Stable graph keys remain separate from database identity.
  • Removes generic JSON columns plus duplicate paths, analysis IDs, source/provenance fields, renderer physics, Unity metadata, ranges, signatures, relation variants, and edge owner fields.
  • Keeps symbol-only data in Symbol; non-symbol nodes do not carry symbol fields.
  • Uses mtime to skip unchanged file reads and hashes. Uses contentHash when timestamps are ambiguous.
  • Indexes complete Nodes, Symbols, and Edges once. Filters and Graph Scope only change the returned or displayed projection.
  • Makes the extension persist the complete unscoped graph while still returning the scoped graph to the UI.
  • Adds transient --filter, --node-type, and --edge-type options to every query command. Values may be repeated or comma-separated and never modify settings.json.
  • Makes Node Type projections follow Graph Scope hierarchy and symbol meaning. Parent, descendant, and overlapping types match semantically while returned Nodes keep their specific stored nodeType.
  • Makes root and command help self-sufficient. Successful data commands return { ok: true, command, data }; failures return the exclusive { ok: false, command, error } shape.
  • Extends read-only doctor output with separate schema compatibility, SQLite integrity, foreign-key health, cache state, and File, Node, Symbol, and Edge counts. Unhealthy checks are returned in error.details.
  • Splits the large cache, indexing, scope, and workspace command test files into focused files under 300 lines.
  • Reduces the CodeGraphy Agent Skill to a short Plugin -> index -> filter/scope -> query guide and syncs the global skill.

Deliberate deferrals

  • No CLI watcher, stale notification daemon, or background reindexing.
  • No --dry-run or resolve command without a concrete shared contract.
  • No embedded query language, prompts, pagers, or formatting DSL.

Validation

  • Two independent code reviews found no remaining P1 or P2 issues after corrections.
  • git diff --check, stale-import search, test-file size check, and protected-worktree checks passed.
  • Local heavy test, mutation, CRAP, and Playwright runs were intentionally stopped for this review-fix commit. PR CI is the test authority.

@changeset-bot

changeset-bot Bot commented Jul 17, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 4f2a081

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 3 packages
Name Type
@codegraphy-dev/core Minor
@codegraphy-dev/extension Patch
@codegraphy-dev/plugin-markdown Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

joesobo added 28 commits July 17, 2026 09:13
…face

# Conflicts:
#	README.md
#	docs/DIAGNOSTICS.md
#	docs/PLUGINS.md
#	docs/plans/2026-07-16-sqlite-cli-agent-skill.md
joesobo and others added 25 commits July 21, 2026 09:24
…face

# Conflicts:
#	docs/adr/0002-sqlite-replaces-ladybug-without-moving-graph-query.md
#	docs/adr/0003-cli-and-agent-skill-replace-mcp.md
#	skills/codegraphy/SKILL.md
Plugin-contributed graph scope (node types, symbols, and edge kinds)
now always defaults to hidden, even when the contributing plugin is
enabled and even when the plugin declares defaultVisible: true. Scope
stays hidden until the user manually toggles it on, matching how the
built-in plugin scope rows already behave. Absent visibility keys for
plugin-namespaced types no longer fall back to visible in the webview
render filters or the core scope resolution.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The webview glob matcher escaped [ and ], so plugin default filters
using character classes (Unity's **/[Pp]roject[Ss]ettings/** and
friends) never matched. Discovery previously hid this by filtering
with minimatch before files reached the webview; with the complete
graph now filtered at projection time, those files leaked into the
rendered graph. globToRegex now supports [abc] and [!abc] classes,
bracket patterns skip the literal fast path, and small classes expand
into fast-path variants to keep combined matching within budget.

Also reverts the discovery-level NUL-byte skip: binary assets such as
images are legitimate graph nodes, and the Markdown plugin's own
binary guard already prevents garbage wikilink relations.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The webview bundle only uses type-level imports from @codegraphy-dev/core,
so the runtime import of graph-scope helpers broke the standalone Vite
build. Move the plugin-scope helpers into extension shared code.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@joesobo
joesobo marked this pull request as ready for review July 21, 2026 23:11
@joesobo
joesobo merged commit 93a6f0c into main Jul 22, 2026
36 checks passed
@joesobo
joesobo deleted the codex/cli-agent-interface branch July 22, 2026 00:19
joesobo added a commit that referenced this pull request Jul 22, 2026
[codex] Make the CodeGraphy CLI self-explanatory for agents
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