feat(cli): add tree command#2869
Conversation
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…ck steps) Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
🦋 Changeset detectedLatest commit: 7efffd9 The changes in this PR will be included in the next version bump. This PR includes changesets to release 3 packages
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 |
Coverage Report
File Coverage
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Performance Benchmark (Lower is Faster)
|
RomanHotsiy
left a comment
There was a problem hiding this comment.
This seems to only show details about split spec.
I think we need it not about the file strcuture but about the OpenAPI iteslef.
E.g. if there is one spec in one file I would expect affected to still work listing me the path names.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…llback Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
📦 A new experimental 🧪 version v0.0.0-snapshot.1781680214 of Redocly CLI has been published for testing. Install with NPM: npm install @redocly/cli@0.0.0-snapshot.1781680214 |
|
📦 A new experimental 🧪 version v0.0.0-snapshot.1781680815 of Redocly CLI has been published for testing. Install with NPM: npm install @redocly/cli@0.0.0-snapshot.1781680815 |
|
📦 A new experimental 🧪 version v0.0.0-snapshot.1781681068 of Redocly CLI has been published for testing. Install with NPM: npm install @redocly/cli@0.0.0-snapshot.1781681068 |
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…iants, duplicate e2e snapshot) Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
… merge Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
… trim comments to project style
What/Why/How?
Adds a
redocly treecommand that prints the structure of an API description — itspaths, operations, and the component
$refchains between them — for quick orientationin any API (single- or multi-file) and
$refimpact analysis in CI and code review.The default mode renders the document structure (root → paths → operations → component
chains);
--affected-by <component|path|file>shows only the impacted part plus anaffected-operations summary;
--filesswitches to the file-level$refgraph; and--formatoutputsstylish(default),json, ormermaid. Works fully with OpenAPI2.0/3.x; AsyncAPI and Arazzo render as a flat list of top-level
$ref'd components.Reference
Testing
tree-demo.yaml
Run
treeRun
tree --format=mermaidflowchart LR n0["/owners/{ownerId}"] n1["/pets"] n2["/pets/{petId}"] n3["GET /owners/{ownerId}"] n4["GET /pets"] n5["GET /pets/{petId}"] n6["POST /pets"] n7["parameters/PetId"] n8["schemas/Address"] n9["schemas/NewPet"] n10["schemas/Owner"] n11["schemas/Pet"] n12["tree-demo.yaml"]:::root n0 --> n3 n1 --> n4 n1 --> n6 n2 --> n5 n2 --> n7 n3 --> n10 n4 --> n11 n5 --> n11 n6 --> n9 n6 --> n11 n9 --> n11 n10 --> n8 n10 --> n10 n11 --> n8 n12 --> n0 n12 --> n1 n12 --> n2 classDef root font-weight:boldRun
tree --format=jsonJSON file
{ "roots": [ "tree-demo.yaml" ], "nodes": [ { "id": "/owners/{ownerId}", "resolved": true, "kind": "path", "file": "tree-demo.yaml" }, { "id": "/pets", "resolved": true, "kind": "path", "file": "tree-demo.yaml" }, { "id": "/pets/{petId}", "resolved": true, "kind": "path", "file": "tree-demo.yaml" }, { "id": "GET /owners/{ownerId}", "resolved": true, "kind": "operation", "file": "tree-demo.yaml" }, { "id": "GET /pets", "resolved": true, "kind": "operation", "file": "tree-demo.yaml" }, { "id": "GET /pets/{petId}", "resolved": true, "kind": "operation", "file": "tree-demo.yaml" }, { "id": "POST /pets", "resolved": true, "kind": "operation", "file": "tree-demo.yaml" }, { "id": "parameters/PetId", "resolved": true, "kind": "component", "file": "tree-demo.yaml" }, { "id": "schemas/Address", "resolved": true, "kind": "component", "file": "tree-demo.yaml" }, { "id": "schemas/NewPet", "resolved": true, "kind": "component", "file": "tree-demo.yaml" }, { "id": "schemas/Owner", "resolved": true, "kind": "component", "file": "tree-demo.yaml" }, { "id": "schemas/Pet", "resolved": true, "kind": "component", "file": "tree-demo.yaml" }, { "id": "tree-demo.yaml", "resolved": true, "kind": "root", "file": "tree-demo.yaml", "root": true } ], "edges": [ { "from": "/owners/{ownerId}", "to": "GET /owners/{ownerId}", "refs": [] }, { "from": "/pets", "to": "GET /pets", "refs": [] }, { "from": "/pets", "to": "POST /pets", "refs": [] }, { "from": "/pets/{petId}", "to": "GET /pets/{petId}", "refs": [] }, { "from": "/pets/{petId}", "to": "parameters/PetId", "refs": [ "#/components/parameters/PetId" ] }, { "from": "GET /owners/{ownerId}", "to": "schemas/Owner", "refs": [ "#/components/schemas/Owner" ] }, { "from": "GET /pets", "to": "schemas/Pet", "refs": [ "#/components/schemas/Pet" ] }, { "from": "GET /pets/{petId}", "to": "schemas/Pet", "refs": [ "#/components/schemas/Pet" ] }, { "from": "POST /pets", "to": "schemas/NewPet", "refs": [ "#/components/schemas/NewPet" ] }, { "from": "POST /pets", "to": "schemas/Pet", "refs": [ "#/components/schemas/Pet" ] }, { "from": "schemas/NewPet", "to": "schemas/Pet", "refs": [ "#/components/schemas/Pet" ] }, { "from": "schemas/Owner", "to": "schemas/Address", "refs": [ "#/components/schemas/Address" ] }, { "from": "schemas/Owner", "to": "schemas/Owner", "refs": [ "#/components/schemas/Owner" ] }, { "from": "schemas/Pet", "to": "schemas/Address", "refs": [ "#/components/schemas/Address" ] }, { "from": "tree-demo.yaml", "to": "/owners/{ownerId}", "refs": [] }, { "from": "tree-demo.yaml", "to": "/pets", "refs": [] }, { "from": "tree-demo.yaml", "to": "/pets/{petId}", "refs": [] } ] }Run
tree --affected-by <component|path|file>Run
--affected-by PetRun
--affected-by Pet --affected-by AddressRun
tree --filesScreenshots (optional)
Check yourself
Security