feat: add experimental tree command with agent index - #3005
Draft
kanoru3101 wants to merge 233 commits into
Draft
Conversation
Dynamic imports inside the test body made vitest transform the whole untransformed dependency subtree within the test, exceeding the 5000ms per-test budget when istanbul coverage is enabled. Static top-level imports move that cost to the file-load phase, which has no timeout.
Add the `treeview` language to the example code fences in tree.md (matching eject.md / translate.md house style) to satisfy markdownlint MD040. Stop tracking the internal agentic planning/spec docs under docs/superpowers/: they were accidentally committed into the published documentation and caused all vale and linkcheck failures plus most markdownlint errors. Nothing references them; they remain available locally but are no longer published.
The absolute-ref to node-id rule, the codepoint sort comparator, and the operation-method set each had duplicate copies across build-graph.ts and build-structure.ts. Move them to node-id.ts as the single source so the two graph builders cannot drift. Also fix build-graph's edge-refs sort to use the codepoint comparator (was the default .sort()), matching the determinism the module documents, and drop a redundant narrating comment in build-structure. No behavior change: 58 tree unit tests and 11 e2e snapshots pass unchanged.
…iants, duplicate e2e snapshot)
Measured across 180 benchmark runs on three descriptions and three models, no agent ever combined --tag with --with-deps: 0 of 1,813 tree calls, and only 3 of 90 runs opened a tag listing at all. The saving the feature was built for does not occur in practice.
…e AI instructions
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What/Why/How?
Adds the experimental
treecommand: it turns an API description into a navigable index, so a human can see its structure and an agent can work with a description far larger than a context window.Selection is typed —
--tag,--path,--webhook,--operation,--component+--name,--file, plus the standalone--findand--pointer— so there is no id syntax to learn. Every result carries its defining file and line range, so any answer can be checked against the source.Three formats:
stylishfor a terminal,jsonfor tooling, andai— plain text for agents, where every view ends with anext:line naming the flags that continue from it, so an agent runs the whole chain from the output alone without reading any documentation.The engine is a new
api-graphmodule in@redocly/openapi-core: one walk of the resolved files (the lint pattern, no bundling) builds the dependency graph and index metadata, and the CLI renders views over it. It lives in core because the CLI is one of several planned surfaces. Everything is deterministic — no AI calls, no keys.Scope: OpenAPI 2.0–3.2. AsyncAPI and Arazzo render their
$refgraph; the typed selectors are OpenAPI-only for now.Measured: 360 agent runs, six tasks over six descriptions from 41 KB to 2,909 files, three models, with and without the index — Where the index pays.
Docs
Reference
treedraft (feat(cli): addtreecommand #2869)Testing
api-graphunit tests — graph building, selection lookups, views, used-by reports withviachains, deps closure, pointer resolution, webhook classification, path normalization, split-alias canonical ids.Screenshots (optional)
Check yourself
Security