Skip to content

feat(cli): add tree export-graph for mindmap data export (M1) - #425

Open
serenakeyitan wants to merge 1 commit into
devfrom
engineer/tree-export-graph
Open

feat(cli): add tree export-graph for mindmap data export (M1)#425
serenakeyitan wants to merge 1 commit into
devfrom
engineer/tree-export-graph

Conversation

@serenakeyitan

Copy link
Copy Markdown
Contributor

Summary

Implements milestone M1 of the first-tree live mindmap (ST-6 / parent ST-4).

Adds a new first-tree tree export-graph subcommand that walks a Context Tree repo and emits a JSON graph (nodes + edges) consumable by the upcoming TreeMindmap React component. Schema matches §2.1 of the ST-4 spec.

What's in the schema

  • version: 1, repo, generated_at
  • Nodes: id (path-relative, no .md), title, kind (member | node | decision | constraint | domain), owner, tags, summary (first 240 chars of body), size (bytes), updated_at (mtime), depth
  • Edges: parent (folder hierarchy) and link (explicit cross-edges declared via frontmatter links:)

CLI surface

first-tree tree export-graph [--out graph.json] [--repo <slug>] [--cwd <path>]
  • Defaults to scanning process.cwd() and writing JSON to stdout.
  • --out writes to a file; --repo overrides the embedded repo identifier (otherwise inferred from package.json#name / repository.url).

Notes

  • Hidden dirs, node_modules, __pycache__, dist, build, and .git are skipped.
  • Frontmatter parser handles both inline (owners: [a, b]) and block (owners:\n - a) list forms; tolerant of missing fields (validation is owned by validate-nodes).
  • Link targets fall back to <id>/NODE when the conceptual node lives at a folder root — matches how the tree repo actually nests domain nodes.

Test plan

  • 130 unit tests in apps/cli pass (10 new in export-graph.test.ts)
  • 498 tests in @first-tree/github-scan still pass
  • oxlint . clean
  • tsc -b clean
  • Smoke-tested against this repo: node apps/cli/dist/index.js tree export-graph --repo agent-team-foundation/first-tree emits valid JSON for the live tree

Refs ST-6 · Refs ST-4


🤖 Generated with Claude Code by the engineer agent for the ST-6 mindmap rollout. Subsequent milestones (M3 live transport, M4 explorer/a11y, M5 perf/polish) will land as separate PRs.

Implements milestone M1 of the first-tree live mindmap (ST-6). Adds a new
`first-tree tree export-graph` subcommand that walks a Context Tree repo,
parses markdown frontmatter (title, owners, tags, kind, links), and emits a
graph JSON consumable by the upcoming `TreeMindmap` component.

The schema matches §2.1 of the ST-4 spec: versioned object with `nodes`
(id, title, kind, owner, tags, summary, size, updated_at, depth) and
`edges` (`parent` for folder hierarchy, `link` for explicit cross-edges
declared via frontmatter `links:`). Hidden dirs, `node_modules`, and
`__pycache__` are skipped. Output goes to stdout by default, or to a file
with `--out <path>`.

Refs ST-6

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@vercel

vercel Bot commented May 12, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
first-tree-doc-website Ready Ready Preview, Comment May 12, 2026 10:47pm

Request Review

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

github-scan:done github-scan: handled

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant