@cairn-tool/cairn 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.markdownlintrc +7 -0
- package/LICENSE +21 -0
- package/README.md +1431 -0
- package/dist/agent/audit/baseline.d.ts +69 -0
- package/dist/agent/audit/baseline.js +128 -0
- package/dist/agent/audit/baseline.js.map +1 -0
- package/dist/agent/audit/index.d.ts +126 -0
- package/dist/agent/audit/index.js +625 -0
- package/dist/agent/audit/index.js.map +1 -0
- package/dist/agent/import/detect.d.ts +49 -0
- package/dist/agent/import/detect.js +159 -0
- package/dist/agent/import/detect.js.map +1 -0
- package/dist/agent/import/normalize.d.ts +72 -0
- package/dist/agent/import/normalize.js +475 -0
- package/dist/agent/import/normalize.js.map +1 -0
- package/dist/agent/install/index.d.ts +211 -0
- package/dist/agent/install/index.js +907 -0
- package/dist/agent/install/index.js.map +1 -0
- package/dist/agent/manifest.d.ts +75 -0
- package/dist/agent/manifest.js +210 -0
- package/dist/agent/manifest.js.map +1 -0
- package/dist/agent/marketplace/index.d.ts +69 -0
- package/dist/agent/marketplace/index.js +212 -0
- package/dist/agent/marketplace/index.js.map +1 -0
- package/dist/agent/marketplace/spec.d.ts +48 -0
- package/dist/agent/marketplace/spec.js +237 -0
- package/dist/agent/marketplace/spec.js.map +1 -0
- package/dist/agent/output.d.ts +36 -0
- package/dist/agent/output.js +56 -0
- package/dist/agent/output.js.map +1 -0
- package/dist/agent/overlays.d.ts +38 -0
- package/dist/agent/overlays.js +223 -0
- package/dist/agent/overlays.js.map +1 -0
- package/dist/agent/package/index.d.ts +105 -0
- package/dist/agent/package/index.js +339 -0
- package/dist/agent/package/index.js.map +1 -0
- package/dist/agent/package/tar.d.ts +36 -0
- package/dist/agent/package/tar.js +137 -0
- package/dist/agent/package/tar.js.map +1 -0
- package/dist/agent/parser.d.ts +13 -0
- package/dist/agent/parser.js +559 -0
- package/dist/agent/parser.js.map +1 -0
- package/dist/agent/render.d.ts +16 -0
- package/dist/agent/render.js +721 -0
- package/dist/agent/render.js.map +1 -0
- package/dist/agent/sarif.d.ts +18 -0
- package/dist/agent/sarif.js +56 -0
- package/dist/agent/sarif.js.map +1 -0
- package/dist/agent/scaffold.d.ts +86 -0
- package/dist/agent/scaffold.js +250 -0
- package/dist/agent/scaffold.js.map +1 -0
- package/dist/agent/targets/antigravity.d.ts +17 -0
- package/dist/agent/targets/antigravity.js +218 -0
- package/dist/agent/targets/antigravity.js.map +1 -0
- package/dist/agent/targets/claude-code.d.ts +2 -0
- package/dist/agent/targets/claude-code.js +220 -0
- package/dist/agent/targets/claude-code.js.map +1 -0
- package/dist/agent/targets/codex.d.ts +2 -0
- package/dist/agent/targets/codex.js +212 -0
- package/dist/agent/targets/codex.js.map +1 -0
- package/dist/agent/targets/cursor.d.ts +2 -0
- package/dist/agent/targets/cursor.js +210 -0
- package/dist/agent/targets/cursor.js.map +1 -0
- package/dist/agent/targets/index.d.ts +31 -0
- package/dist/agent/targets/index.js +64 -0
- package/dist/agent/targets/index.js.map +1 -0
- package/dist/agent/targets/opencode.d.ts +15 -0
- package/dist/agent/targets/opencode.js +215 -0
- package/dist/agent/targets/opencode.js.map +1 -0
- package/dist/agent/targets/schema.d.ts +315 -0
- package/dist/agent/targets/schema.js +179 -0
- package/dist/agent/targets/schema.js.map +1 -0
- package/dist/agent/test/assert.d.ts +46 -0
- package/dist/agent/test/assert.js +288 -0
- package/dist/agent/test/assert.js.map +1 -0
- package/dist/agent/test/index.d.ts +73 -0
- package/dist/agent/test/index.js +181 -0
- package/dist/agent/test/index.js.map +1 -0
- package/dist/agent/test/schema.d.ts +81 -0
- package/dist/agent/test/schema.js +235 -0
- package/dist/agent/test/schema.js.map +1 -0
- package/dist/agent/types.d.ts +204 -0
- package/dist/agent/types.js +11 -0
- package/dist/agent/types.js.map +1 -0
- package/dist/agent/upgrade.d.ts +29 -0
- package/dist/agent/upgrade.js +72 -0
- package/dist/agent/upgrade.js.map +1 -0
- package/dist/agent/writer.d.ts +30 -0
- package/dist/agent/writer.js +73 -0
- package/dist/agent/writer.js.map +1 -0
- package/dist/archive/db.d.ts +20 -0
- package/dist/archive/db.js +98 -0
- package/dist/archive/db.js.map +1 -0
- package/dist/archive/progress.d.ts +62 -0
- package/dist/archive/progress.js +151 -0
- package/dist/archive/progress.js.map +1 -0
- package/dist/archive/query.d.ts +86 -0
- package/dist/archive/query.js +241 -0
- package/dist/archive/query.js.map +1 -0
- package/dist/archive/run.d.ts +91 -0
- package/dist/archive/run.js +331 -0
- package/dist/archive/run.js.map +1 -0
- package/dist/archive/segments.d.ts +89 -0
- package/dist/archive/segments.js +144 -0
- package/dist/archive/segments.js.map +1 -0
- package/dist/archive/sets.d.ts +58 -0
- package/dist/archive/sets.js +344 -0
- package/dist/archive/sets.js.map +1 -0
- package/dist/archive/tar-read.d.ts +35 -0
- package/dist/archive/tar-read.js +90 -0
- package/dist/archive/tar-read.js.map +1 -0
- package/dist/audit-baseline.d.ts +66 -0
- package/dist/audit-baseline.js +124 -0
- package/dist/audit-baseline.js.map +1 -0
- package/dist/automation.d.ts +16 -0
- package/dist/automation.js +38 -0
- package/dist/automation.js.map +1 -0
- package/dist/backlinks.d.ts +15 -0
- package/dist/backlinks.js +30 -0
- package/dist/backlinks.js.map +1 -0
- package/dist/checkers/katex.d.ts +3 -0
- package/dist/checkers/katex.js +71 -0
- package/dist/checkers/katex.js.map +1 -0
- package/dist/checkers/markdown-lint.d.ts +28 -0
- package/dist/checkers/markdown-lint.js +53 -0
- package/dist/checkers/markdown-lint.js.map +1 -0
- package/dist/checkers/mermaid.d.ts +6 -0
- package/dist/checkers/mermaid.js +53 -0
- package/dist/checkers/mermaid.js.map +1 -0
- package/dist/checkers/references.d.ts +3 -0
- package/dist/checkers/references.js +55 -0
- package/dist/checkers/references.js.map +1 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +1117 -0
- package/dist/cli.js.map +1 -0
- package/dist/command-result.d.ts +6 -0
- package/dist/command-result.js +13 -0
- package/dist/command-result.js.map +1 -0
- package/dist/commands/agent-audit.d.ts +21 -0
- package/dist/commands/agent-audit.js +119 -0
- package/dist/commands/agent-audit.js.map +1 -0
- package/dist/commands/agent-doctor.d.ts +25 -0
- package/dist/commands/agent-doctor.js +217 -0
- package/dist/commands/agent-doctor.js.map +1 -0
- package/dist/commands/agent-import.d.ts +21 -0
- package/dist/commands/agent-import.js +212 -0
- package/dist/commands/agent-import.js.map +1 -0
- package/dist/commands/agent-install.d.ts +18 -0
- package/dist/commands/agent-install.js +59 -0
- package/dist/commands/agent-install.js.map +1 -0
- package/dist/commands/agent-installed.d.ts +6 -0
- package/dist/commands/agent-installed.js +17 -0
- package/dist/commands/agent-installed.js.map +1 -0
- package/dist/commands/agent-marketplace.d.ts +11 -0
- package/dist/commands/agent-marketplace.js +178 -0
- package/dist/commands/agent-marketplace.js.map +1 -0
- package/dist/commands/agent-package.d.ts +16 -0
- package/dist/commands/agent-package.js +159 -0
- package/dist/commands/agent-package.js.map +1 -0
- package/dist/commands/agent-scaffold.d.ts +17 -0
- package/dist/commands/agent-scaffold.js +181 -0
- package/dist/commands/agent-scaffold.js.map +1 -0
- package/dist/commands/agent-specs.d.ts +7 -0
- package/dist/commands/agent-specs.js +20 -0
- package/dist/commands/agent-specs.js.map +1 -0
- package/dist/commands/agent-test.d.ts +21 -0
- package/dist/commands/agent-test.js +50 -0
- package/dist/commands/agent-test.js.map +1 -0
- package/dist/commands/agent-uninstall.d.ts +6 -0
- package/dist/commands/agent-uninstall.js +45 -0
- package/dist/commands/agent-uninstall.js.map +1 -0
- package/dist/commands/agent-upgrade.d.ts +5 -0
- package/dist/commands/agent-upgrade.js +105 -0
- package/dist/commands/agent-upgrade.js.map +1 -0
- package/dist/commands/agent.d.ts +27 -0
- package/dist/commands/agent.js +549 -0
- package/dist/commands/agent.js.map +1 -0
- package/dist/commands/archive.d.ts +47 -0
- package/dist/commands/archive.js +311 -0
- package/dist/commands/archive.js.map +1 -0
- package/dist/commands/audit.d.ts +25 -0
- package/dist/commands/audit.js +325 -0
- package/dist/commands/audit.js.map +1 -0
- package/dist/commands/check-snippets.d.ts +58 -0
- package/dist/commands/check-snippets.js +247 -0
- package/dist/commands/check-snippets.js.map +1 -0
- package/dist/commands/check-urls.d.ts +52 -0
- package/dist/commands/check-urls.js +205 -0
- package/dist/commands/check-urls.js.map +1 -0
- package/dist/commands/code-blocks.d.ts +8 -0
- package/dist/commands/code-blocks.js +66 -0
- package/dist/commands/code-blocks.js.map +1 -0
- package/dist/commands/completion.d.ts +15 -0
- package/dist/commands/completion.js +20 -0
- package/dist/commands/completion.js.map +1 -0
- package/dist/commands/context.d.ts +16 -0
- package/dist/commands/context.js +131 -0
- package/dist/commands/context.js.map +1 -0
- package/dist/commands/describe.d.ts +12 -0
- package/dist/commands/describe.js +62 -0
- package/dist/commands/describe.js.map +1 -0
- package/dist/commands/diff.d.ts +11 -0
- package/dist/commands/diff.js +185 -0
- package/dist/commands/diff.js.map +1 -0
- package/dist/commands/fix.d.ts +59 -0
- package/dist/commands/fix.js +173 -0
- package/dist/commands/fix.js.map +1 -0
- package/dist/commands/frontmatter.d.ts +7 -0
- package/dist/commands/frontmatter.js +84 -0
- package/dist/commands/frontmatter.js.map +1 -0
- package/dist/commands/graph.d.ts +12 -0
- package/dist/commands/graph.js +122 -0
- package/dist/commands/graph.js.map +1 -0
- package/dist/commands/headers.d.ts +7 -0
- package/dist/commands/headers.js +48 -0
- package/dist/commands/headers.js.map +1 -0
- package/dist/commands/index.d.ts +8 -0
- package/dist/commands/index.js +32 -0
- package/dist/commands/index.js.map +1 -0
- package/dist/commands/links.d.ts +9 -0
- package/dist/commands/links.js +123 -0
- package/dist/commands/links.js.map +1 -0
- package/dist/commands/lint-dir.d.ts +15 -0
- package/dist/commands/lint-dir.js +156 -0
- package/dist/commands/lint-dir.js.map +1 -0
- package/dist/commands/lint.d.ts +14 -0
- package/dist/commands/lint.js +45 -0
- package/dist/commands/lint.js.map +1 -0
- package/dist/commands/orphans.d.ts +10 -0
- package/dist/commands/orphans.js +74 -0
- package/dist/commands/orphans.js.map +1 -0
- package/dist/commands/outline.d.ts +7 -0
- package/dist/commands/outline.js +54 -0
- package/dist/commands/outline.js.map +1 -0
- package/dist/commands/query.d.ts +18 -0
- package/dist/commands/query.js +341 -0
- package/dist/commands/query.js.map +1 -0
- package/dist/commands/refs-to.d.ts +8 -0
- package/dist/commands/refs-to.js +65 -0
- package/dist/commands/refs-to.js.map +1 -0
- package/dist/commands/refs.d.ts +10 -0
- package/dist/commands/refs.js +103 -0
- package/dist/commands/refs.js.map +1 -0
- package/dist/commands/rename-file.d.ts +16 -0
- package/dist/commands/rename-file.js +215 -0
- package/dist/commands/rename-file.js.map +1 -0
- package/dist/commands/rename-heading.d.ts +10 -0
- package/dist/commands/rename-heading.js +182 -0
- package/dist/commands/rename-heading.js.map +1 -0
- package/dist/commands/schema.d.ts +10 -0
- package/dist/commands/schema.js +34 -0
- package/dist/commands/schema.js.map +1 -0
- package/dist/commands/scripts.d.ts +59 -0
- package/dist/commands/scripts.js +222 -0
- package/dist/commands/scripts.js.map +1 -0
- package/dist/commands/section.d.ts +9 -0
- package/dist/commands/section.js +49 -0
- package/dist/commands/section.js.map +1 -0
- package/dist/commands/serve.d.ts +6 -0
- package/dist/commands/serve.js +48 -0
- package/dist/commands/serve.js.map +1 -0
- package/dist/commands/stats.d.ts +6 -0
- package/dist/commands/stats.js +109 -0
- package/dist/commands/stats.js.map +1 -0
- package/dist/commands/structure.d.ts +6 -0
- package/dist/commands/structure.js +130 -0
- package/dist/commands/structure.js.map +1 -0
- package/dist/commands/tables.d.ts +8 -0
- package/dist/commands/tables.js +77 -0
- package/dist/commands/tables.js.map +1 -0
- package/dist/commands/tasks.d.ts +8 -0
- package/dist/commands/tasks.js +59 -0
- package/dist/commands/tasks.js.map +1 -0
- package/dist/commands/toc.d.ts +18 -0
- package/dist/commands/toc.js +105 -0
- package/dist/commands/toc.js.map +1 -0
- package/dist/commands/update-check.d.ts +36 -0
- package/dist/commands/update-check.js +119 -0
- package/dist/commands/update-check.js.map +1 -0
- package/dist/commands/usage.d.ts +56 -0
- package/dist/commands/usage.js +883 -0
- package/dist/commands/usage.js.map +1 -0
- package/dist/commands/validate-frontmatter.d.ts +13 -0
- package/dist/commands/validate-frontmatter.js +34 -0
- package/dist/commands/validate-frontmatter.js.map +1 -0
- package/dist/completion/model.d.ts +49 -0
- package/dist/completion/model.js +194 -0
- package/dist/completion/model.js.map +1 -0
- package/dist/completion/shells.d.ts +2 -0
- package/dist/completion/shells.js +280 -0
- package/dist/completion/shells.js.map +1 -0
- package/dist/config-schema.d.ts +15 -0
- package/dist/config-schema.js +44 -0
- package/dist/config-schema.js.map +1 -0
- package/dist/config.d.ts +102 -0
- package/dist/config.js +614 -0
- package/dist/config.js.map +1 -0
- package/dist/context.d.ts +106 -0
- package/dist/context.js +202 -0
- package/dist/context.js.map +1 -0
- package/dist/contract/describe.d.ts +84 -0
- package/dist/contract/describe.js +104 -0
- package/dist/contract/describe.js.map +1 -0
- package/dist/contract/registry.d.ts +2 -0
- package/dist/contract/registry.js +622 -0
- package/dist/contract/registry.js.map +1 -0
- package/dist/contract/schemas/agent.d.ts +2 -0
- package/dist/contract/schemas/agent.js +572 -0
- package/dist/contract/schemas/agent.js.map +1 -0
- package/dist/contract/schemas/archive.d.ts +3 -0
- package/dist/contract/schemas/archive.js +227 -0
- package/dist/contract/schemas/archive.js.map +1 -0
- package/dist/contract/schemas/index.d.ts +11 -0
- package/dist/contract/schemas/index.js +49 -0
- package/dist/contract/schemas/index.js.map +1 -0
- package/dist/contract/schemas/markdown.d.ts +15 -0
- package/dist/contract/schemas/markdown.js +1035 -0
- package/dist/contract/schemas/markdown.js.map +1 -0
- package/dist/contract/schemas/meta.d.ts +5 -0
- package/dist/contract/schemas/meta.js +233 -0
- package/dist/contract/schemas/meta.js.map +1 -0
- package/dist/contract/schemas/scripts.d.ts +4 -0
- package/dist/contract/schemas/scripts.js +183 -0
- package/dist/contract/schemas/scripts.js.map +1 -0
- package/dist/contract/schemas/shared.d.ts +11 -0
- package/dist/contract/schemas/shared.js +26 -0
- package/dist/contract/schemas/shared.js.map +1 -0
- package/dist/contract/schemas/usage.d.ts +6 -0
- package/dist/contract/schemas/usage.js +489 -0
- package/dist/contract/schemas/usage.js.map +1 -0
- package/dist/contract/types.d.ts +63 -0
- package/dist/contract/types.js +2 -0
- package/dist/contract/types.js.map +1 -0
- package/dist/contract/version.d.ts +20 -0
- package/dist/contract/version.js +21 -0
- package/dist/contract/version.js.map +1 -0
- package/dist/diff.d.ts +156 -0
- package/dist/diff.js +500 -0
- package/dist/diff.js.map +1 -0
- package/dist/edit-plan.d.ts +133 -0
- package/dist/edit-plan.js +245 -0
- package/dist/edit-plan.js.map +1 -0
- package/dist/fix/markdownlint-fixer.d.ts +34 -0
- package/dist/fix/markdownlint-fixer.js +125 -0
- package/dist/fix/markdownlint-fixer.js.map +1 -0
- package/dist/fix/registry.d.ts +48 -0
- package/dist/fix/registry.js +28 -0
- package/dist/fix/registry.js.map +1 -0
- package/dist/fix/relative-links-fixer.d.ts +21 -0
- package/dist/fix/relative-links-fixer.js +96 -0
- package/dist/fix/relative-links-fixer.js.map +1 -0
- package/dist/fix/snippets-fixer.d.ts +2 -0
- package/dist/fix/snippets-fixer.js +64 -0
- package/dist/fix/snippets-fixer.js.map +1 -0
- package/dist/fix/toc-fixer.d.ts +2 -0
- package/dist/fix/toc-fixer.js +94 -0
- package/dist/fix/toc-fixer.js.map +1 -0
- package/dist/formats.d.ts +22 -0
- package/dist/formats.js +34 -0
- package/dist/formats.js.map +1 -0
- package/dist/formatters.d.ts +11 -0
- package/dist/formatters.js +48 -0
- package/dist/formatters.js.map +1 -0
- package/dist/frontmatter-validation.d.ts +11 -0
- package/dist/frontmatter-validation.js +188 -0
- package/dist/frontmatter-validation.js.map +1 -0
- package/dist/git.d.ts +40 -0
- package/dist/git.js +124 -0
- package/dist/git.js.map +1 -0
- package/dist/graph.d.ts +50 -0
- package/dist/graph.js +200 -0
- package/dist/graph.js.map +1 -0
- package/dist/input-selection.d.ts +9 -0
- package/dist/input-selection.js +122 -0
- package/dist/input-selection.js.map +1 -0
- package/dist/input.d.ts +2 -0
- package/dist/input.js +32 -0
- package/dist/input.js.map +1 -0
- package/dist/link-target.d.ts +39 -0
- package/dist/link-target.js +68 -0
- package/dist/link-target.js.map +1 -0
- package/dist/lint.d.ts +13 -0
- package/dist/lint.js +27 -0
- package/dist/lint.js.map +1 -0
- package/dist/markdown-ast.d.ts +73 -0
- package/dist/markdown-ast.js +187 -0
- package/dist/markdown-ast.js.map +1 -0
- package/dist/object-path.d.ts +14 -0
- package/dist/object-path.js +14 -0
- package/dist/object-path.js.map +1 -0
- package/dist/option-utils.d.ts +13 -0
- package/dist/option-utils.js +25 -0
- package/dist/option-utils.js.map +1 -0
- package/dist/outline.d.ts +16 -0
- package/dist/outline.js +32 -0
- package/dist/outline.js.map +1 -0
- package/dist/query/entities.d.ts +60 -0
- package/dist/query/entities.js +219 -0
- package/dist/query/entities.js.map +1 -0
- package/dist/query/execute.d.ts +22 -0
- package/dist/query/execute.js +0 -0
- package/dist/query/execute.js.map +1 -0
- package/dist/query/plan.d.ts +76 -0
- package/dist/query/plan.js +183 -0
- package/dist/query/plan.js.map +1 -0
- package/dist/query/render.d.ts +3 -0
- package/dist/query/render.js +39 -0
- package/dist/query/render.js.map +1 -0
- package/dist/refs.d.ts +19 -0
- package/dist/refs.js +10 -0
- package/dist/refs.js.map +1 -0
- package/dist/result.d.ts +49 -0
- package/dist/result.js +47 -0
- package/dist/result.js.map +1 -0
- package/dist/runtime.d.ts +35 -0
- package/dist/runtime.js +77 -0
- package/dist/runtime.js.map +1 -0
- package/dist/sarif.d.ts +36 -0
- package/dist/sarif.js +30 -0
- package/dist/sarif.js.map +1 -0
- package/dist/scripts/execute.d.ts +65 -0
- package/dist/scripts/execute.js +235 -0
- package/dist/scripts/execute.js.map +1 -0
- package/dist/scripts/registry.d.ts +55 -0
- package/dist/scripts/registry.js +103 -0
- package/dist/scripts/registry.js.map +1 -0
- package/dist/scripts/resolve.d.ts +90 -0
- package/dist/scripts/resolve.js +288 -0
- package/dist/scripts/resolve.js.map +1 -0
- package/dist/sections.d.ts +53 -0
- package/dist/sections.js +100 -0
- package/dist/sections.js.map +1 -0
- package/dist/serve/errors.d.ts +25 -0
- package/dist/serve/errors.js +45 -0
- package/dist/serve/errors.js.map +1 -0
- package/dist/serve/paths.d.ts +32 -0
- package/dist/serve/paths.js +71 -0
- package/dist/serve/paths.js.map +1 -0
- package/dist/serve/server.d.ts +31 -0
- package/dist/serve/server.js +123 -0
- package/dist/serve/server.js.map +1 -0
- package/dist/serve/tools.d.ts +19 -0
- package/dist/serve/tools.js +597 -0
- package/dist/serve/tools.js.map +1 -0
- package/dist/snippets.d.ts +184 -0
- package/dist/snippets.js +454 -0
- package/dist/snippets.js.map +1 -0
- package/dist/sqlite-store.d.ts +62 -0
- package/dist/sqlite-store.js +104 -0
- package/dist/sqlite-store.js.map +1 -0
- package/dist/sqlite.d.ts +59 -0
- package/dist/sqlite.js +51 -0
- package/dist/sqlite.js.map +1 -0
- package/dist/toc.d.ts +58 -0
- package/dist/toc.js +83 -0
- package/dist/toc.js.map +1 -0
- package/dist/types.d.ts +7 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/dist/update-notifier.d.ts +95 -0
- package/dist/update-notifier.js +301 -0
- package/dist/update-notifier.js.map +1 -0
- package/dist/url-cache.d.ts +14 -0
- package/dist/url-cache.js +70 -0
- package/dist/url-cache.js.map +1 -0
- package/dist/usage/aggregate.d.ts +107 -0
- package/dist/usage/aggregate.js +435 -0
- package/dist/usage/aggregate.js.map +1 -0
- package/dist/usage/db/index.d.ts +49 -0
- package/dist/usage/db/index.js +118 -0
- package/dist/usage/db/index.js.map +1 -0
- package/dist/usage/db/migrations.d.ts +29 -0
- package/dist/usage/db/migrations.js +38 -0
- package/dist/usage/db/migrations.js.map +1 -0
- package/dist/usage/db/open.d.ts +33 -0
- package/dist/usage/db/open.js +37 -0
- package/dist/usage/db/open.js.map +1 -0
- package/dist/usage/db/schema.d.ts +18 -0
- package/dist/usage/db/schema.js +147 -0
- package/dist/usage/db/schema.js.map +1 -0
- package/dist/usage/db/store.d.ts +74 -0
- package/dist/usage/db/store.js +280 -0
- package/dist/usage/db/store.js.map +1 -0
- package/dist/usage/events.d.ts +202 -0
- package/dist/usage/events.js +243 -0
- package/dist/usage/events.js.map +1 -0
- package/dist/usage/filter.d.ts +43 -0
- package/dist/usage/filter.js +97 -0
- package/dist/usage/filter.js.map +1 -0
- package/dist/usage/providers/antigravity.d.ts +2 -0
- package/dist/usage/providers/antigravity.js +431 -0
- package/dist/usage/providers/antigravity.js.map +1 -0
- package/dist/usage/providers/claude-code.d.ts +2 -0
- package/dist/usage/providers/claude-code.js +400 -0
- package/dist/usage/providers/claude-code.js.map +1 -0
- package/dist/usage/providers/codex.d.ts +2 -0
- package/dist/usage/providers/codex.js +387 -0
- package/dist/usage/providers/codex.js.map +1 -0
- package/dist/usage/providers/gemini-cli.d.ts +2 -0
- package/dist/usage/providers/gemini-cli.js +466 -0
- package/dist/usage/providers/gemini-cli.js.map +1 -0
- package/dist/usage/providers/index.d.ts +23 -0
- package/dist/usage/providers/index.js +46 -0
- package/dist/usage/providers/index.js.map +1 -0
- package/dist/usage/providers/opencode.d.ts +2 -0
- package/dist/usage/providers/opencode.js +422 -0
- package/dist/usage/providers/opencode.js.map +1 -0
- package/dist/usage/providers/protobuf.d.ts +35 -0
- package/dist/usage/providers/protobuf.js +125 -0
- package/dist/usage/providers/protobuf.js.map +1 -0
- package/dist/usage/providers/types.d.ts +74 -0
- package/dist/usage/providers/types.js +2 -0
- package/dist/usage/providers/types.js.map +1 -0
- package/dist/usage/scan.d.ts +54 -0
- package/dist/usage/scan.js +216 -0
- package/dist/usage/scan.js.map +1 -0
- package/dist/version.d.ts +2 -0
- package/dist/version.js +8 -0
- package/dist/version.js.map +1 -0
- package/dist/workspace-index.d.ts +39 -0
- package/dist/workspace-index.js +265 -0
- package/dist/workspace-index.js.map +1 -0
- package/dist/workspace.d.ts +89 -0
- package/dist/workspace.js +219 -0
- package/dist/workspace.js.map +1 -0
- package/package.json +92 -0
|
@@ -0,0 +1,622 @@
|
|
|
1
|
+
import { BASE_FORMATS, agentFormatsFor, formatsFor } from "../formats.js";
|
|
2
|
+
import { SARIF_SCHEMA_URI } from "./version.js";
|
|
3
|
+
const STRICT_NOTE = "A scan over thousands of transcripts routinely meets a file removed mid-walk or a truncated final line in a session still being appended to. Those are counted under `scan` and reported, never fatal, because failing by default would make the command useless in the automated context it is most wanted in. `--strict` is how a caller opts into exit 2.";
|
|
4
|
+
const OK = (meaning) => ({ code: 0, meaning });
|
|
5
|
+
const USAGE = { code: 1, meaning: "Invocation, I/O, or configuration error" };
|
|
6
|
+
const FINDINGS = (meaning) => ({ code: 2, meaning });
|
|
7
|
+
/** A read-only `md` command whose payload always goes to stdout. */
|
|
8
|
+
function inspection(name, extra = {}) {
|
|
9
|
+
return {
|
|
10
|
+
id: `md ${name}`,
|
|
11
|
+
formats: formatsFor(name),
|
|
12
|
+
defaultFormat: "llm",
|
|
13
|
+
formatConfigurable: true,
|
|
14
|
+
outputSchema: null,
|
|
15
|
+
exitCodes: [OK("Output written to stdout"), USAGE],
|
|
16
|
+
stream: { success: "stdout" },
|
|
17
|
+
writes: false,
|
|
18
|
+
stability: "stable",
|
|
19
|
+
...extra,
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
/** A `md` command that reports findings on stderr and exits 2. */
|
|
23
|
+
function diagnostic(name, findings, extra = {}) {
|
|
24
|
+
return {
|
|
25
|
+
id: `md ${name}`,
|
|
26
|
+
formats: formatsFor(name),
|
|
27
|
+
defaultFormat: "llm",
|
|
28
|
+
formatConfigurable: true,
|
|
29
|
+
outputSchema: null,
|
|
30
|
+
exitCodes: [OK("No findings"), USAGE, FINDINGS(findings)],
|
|
31
|
+
stream: { success: "stdout", findings: "stderr" },
|
|
32
|
+
writes: false,
|
|
33
|
+
stability: "stable",
|
|
34
|
+
...extra,
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
function agentCommand(name, extra = {}) {
|
|
38
|
+
return {
|
|
39
|
+
id: `agent ${name}`,
|
|
40
|
+
formats: agentFormatsFor(name),
|
|
41
|
+
defaultFormat: "llm",
|
|
42
|
+
formatConfigurable: false,
|
|
43
|
+
outputSchema: "agent-result",
|
|
44
|
+
exitCodes: [OK("No blocking findings"), USAGE, FINDINGS("Blocking findings")],
|
|
45
|
+
stream: { success: "stdout", findings: "stdout" },
|
|
46
|
+
writes: false,
|
|
47
|
+
stability: "stable",
|
|
48
|
+
notes: "All output goes to stdout, including the failure result for an invocation error.",
|
|
49
|
+
...extra,
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
const AUTOMATION = { jsonlSchema: "diagnostic-record", sarifSchema: SARIF_SCHEMA_URI };
|
|
53
|
+
/**
|
|
54
|
+
* A `usage` subcommand.
|
|
55
|
+
*
|
|
56
|
+
* Every one of them is read-only over logs outside the workspace, so `writes`
|
|
57
|
+
* is false even for `usage index`, whose only effect is on its own private scan
|
|
58
|
+
* cache. Exit `2` exists solely for `--strict`: see the note on the individual
|
|
59
|
+
* entries.
|
|
60
|
+
*/
|
|
61
|
+
function usageCommand(name, extra = {}) {
|
|
62
|
+
return {
|
|
63
|
+
id: `usage ${name}`,
|
|
64
|
+
formats: BASE_FORMATS,
|
|
65
|
+
defaultFormat: "llm",
|
|
66
|
+
formatConfigurable: false,
|
|
67
|
+
outputSchema: "usage-rollup",
|
|
68
|
+
exitCodes: [
|
|
69
|
+
OK("Report written"),
|
|
70
|
+
USAGE,
|
|
71
|
+
FINDINGS("--strict was given and a transcript could not be fully read"),
|
|
72
|
+
],
|
|
73
|
+
stream: { success: "stdout", findings: "stderr" },
|
|
74
|
+
writes: false,
|
|
75
|
+
stability: "experimental",
|
|
76
|
+
...extra,
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
const CONTRACTS = [
|
|
80
|
+
// Top level
|
|
81
|
+
{
|
|
82
|
+
id: "check-update",
|
|
83
|
+
formats: BASE_FORMATS,
|
|
84
|
+
defaultFormat: "llm",
|
|
85
|
+
formatConfigurable: false,
|
|
86
|
+
outputSchema: "check-update",
|
|
87
|
+
exitCodes: [
|
|
88
|
+
OK("Already on the latest version"),
|
|
89
|
+
{ code: 1, meaning: "Could not reach the registry" },
|
|
90
|
+
FINDINGS("A newer version is available"),
|
|
91
|
+
],
|
|
92
|
+
stream: { success: "stdout", findings: "stderr" },
|
|
93
|
+
writes: false,
|
|
94
|
+
stability: "stable",
|
|
95
|
+
notes: "Queries the registry directly rather than using the cache. An unreachable registry writes the error form to stderr; an available update writes the success form to stdout and exits 2.",
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
id: "describe",
|
|
99
|
+
formats: BASE_FORMATS,
|
|
100
|
+
defaultFormat: "llm",
|
|
101
|
+
formatConfigurable: false,
|
|
102
|
+
outputSchema: "describe",
|
|
103
|
+
exitCodes: [
|
|
104
|
+
OK("Description written to stdout"),
|
|
105
|
+
{ code: 1, meaning: "Unknown command path or invalid format" },
|
|
106
|
+
],
|
|
107
|
+
stream: { success: "stdout" },
|
|
108
|
+
writes: false,
|
|
109
|
+
stability: "stable",
|
|
110
|
+
notes: "Reports the static contract; project configuration is not applied.",
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
id: "schema",
|
|
114
|
+
formats: BASE_FORMATS,
|
|
115
|
+
defaultFormat: "llm",
|
|
116
|
+
formatConfigurable: false,
|
|
117
|
+
outputSchema: "schema-list",
|
|
118
|
+
exitCodes: [
|
|
119
|
+
OK("Schema or index written to stdout"),
|
|
120
|
+
{ code: 1, meaning: "Unknown schema id or invalid format" },
|
|
121
|
+
],
|
|
122
|
+
stream: { success: "stdout" },
|
|
123
|
+
writes: false,
|
|
124
|
+
stability: "stable",
|
|
125
|
+
notes: "With an id, the schema document is written regardless of --format; --format only affects the index listing.",
|
|
126
|
+
},
|
|
127
|
+
{
|
|
128
|
+
id: "completion",
|
|
129
|
+
formats: BASE_FORMATS,
|
|
130
|
+
defaultFormat: "llm",
|
|
131
|
+
formatConfigurable: false,
|
|
132
|
+
outputSchema: null,
|
|
133
|
+
exitCodes: [
|
|
134
|
+
OK("Script written to stdout"),
|
|
135
|
+
{ code: 1, meaning: "Unknown shell or invalid format" },
|
|
136
|
+
],
|
|
137
|
+
stream: { success: "stdout" },
|
|
138
|
+
writes: false,
|
|
139
|
+
stability: "stable",
|
|
140
|
+
notes: "The shell script is written verbatim regardless of --format; the script is the payload, so there is no JSON form. It is generated from the same command walk describe uses, so it cannot drift from the real command tree, and it embeds that tree rather than calling back into the CLI, so completing costs no process spawn. Never writes to a shell profile. The update notice is suppressed, because the eval install idiom runs from an interactive rc file where stderr is a TTY.",
|
|
141
|
+
},
|
|
142
|
+
{
|
|
143
|
+
id: "serve",
|
|
144
|
+
// A protocol server has no output format: stdout is the JSON-RPC channel,
|
|
145
|
+
// not a payload stream, so there is nothing for --format to select.
|
|
146
|
+
formats: null,
|
|
147
|
+
defaultFormat: null,
|
|
148
|
+
formatConfigurable: false,
|
|
149
|
+
outputSchema: null,
|
|
150
|
+
exitCodes: [
|
|
151
|
+
OK("The client closed the connection"),
|
|
152
|
+
{ code: 1, meaning: "Unknown protocol, unreadable root, or invalid configuration" },
|
|
153
|
+
],
|
|
154
|
+
stream: { success: "stdout" },
|
|
155
|
+
writes: false,
|
|
156
|
+
stability: "experimental",
|
|
157
|
+
notes: "Speaks the Model Context Protocol over stdio. stdout carries JSON-RPC frames rather than a payload, so --format is not accepted and no output schema applies; every diagnostic goes to stderr, which MCP treats as the server log. Tool arguments and results are described by each tool's own JSON Schema, retrieved through tools/list rather than through `schema`. Every tool is read-only and every path argument is confined to --root, resolved through symlinks; refactor tools are deliberately absent rather than gated. Configuration is discovered from --root, so a tool answers the same as the equivalent md command in that workspace. Unlike md index this never writes the workspace cache: the server keeps a bounded in-memory cache and leaves the on-disk index alone.",
|
|
158
|
+
},
|
|
159
|
+
// Scripts
|
|
160
|
+
{
|
|
161
|
+
id: "scripts run",
|
|
162
|
+
formats: BASE_FORMATS,
|
|
163
|
+
defaultFormat: "llm",
|
|
164
|
+
formatConfigurable: false,
|
|
165
|
+
outputSchema: "script-run",
|
|
166
|
+
exitCodes: [
|
|
167
|
+
OK("--format json: the script exited 0"),
|
|
168
|
+
{ code: 1, meaning: "Unresolvable name, refused boundary, or the script never started" },
|
|
169
|
+
FINDINGS("--format json: the script exited non-zero or was killed by a signal"),
|
|
170
|
+
],
|
|
171
|
+
exitCodePassthrough: {
|
|
172
|
+
min: 0,
|
|
173
|
+
max: 255,
|
|
174
|
+
description: "In llm and human formats the script's own exit status is this process's exit status, verbatim; a script killed by a signal reports 128 + the signal number.",
|
|
175
|
+
},
|
|
176
|
+
stream: { success: "stdout", findings: "stdout" },
|
|
177
|
+
writes: false,
|
|
178
|
+
stability: "experimental",
|
|
179
|
+
notes: "The only command that executes anything. In llm and human formats the child inherits all three streams and its exit status passes through unchanged, so a hook reads the real code and this command writes nothing of its own to stdout; `exitCodes` describes --format json, which captures the streams into the payload instead. A script that never started exits 1 rather than 2, so a typo in exec[0] stays distinguishable from a script that ran and failed. The payload goes to stdout in every outcome, including a failed script, so a consumer never has to switch streams. Resolution walks every .cairn.yml from the working directory to the repository root and the nearest definition of the name wins; files under node_modules are skipped, and running outside a Git repository is refused unless --root sets the boundary. Configuration cannot change what executes: scripts commands accept no `commands:` defaults. The update notice is suppressed, because the child owns the real stderr.",
|
|
180
|
+
},
|
|
181
|
+
{
|
|
182
|
+
id: "scripts which",
|
|
183
|
+
formats: BASE_FORMATS,
|
|
184
|
+
defaultFormat: "llm",
|
|
185
|
+
formatConfigurable: false,
|
|
186
|
+
outputSchema: "script-which",
|
|
187
|
+
exitCodes: [OK("The name resolved"), USAGE, FINDINGS("No script by that name")],
|
|
188
|
+
stream: { success: "stdout", findings: "stderr" },
|
|
189
|
+
writes: false,
|
|
190
|
+
stability: "experimental",
|
|
191
|
+
notes: "Resolves without executing. Reports the winning registry, the working directory the script would run in, the same-named definitions it shadows, and every file the walk opened. An unreadable file nearer than the winner is an error rather than a skip, because it might have defined the name.",
|
|
192
|
+
},
|
|
193
|
+
{
|
|
194
|
+
id: "scripts list",
|
|
195
|
+
formats: BASE_FORMATS,
|
|
196
|
+
defaultFormat: "llm",
|
|
197
|
+
formatConfigurable: false,
|
|
198
|
+
outputSchema: "script-list",
|
|
199
|
+
exitCodes: [
|
|
200
|
+
OK("Listing written to stdout"),
|
|
201
|
+
USAGE,
|
|
202
|
+
FINDINGS("A consulted configuration file could not be read"),
|
|
203
|
+
],
|
|
204
|
+
stream: { success: "stdout", findings: "stderr" },
|
|
205
|
+
writes: false,
|
|
206
|
+
stability: "experimental",
|
|
207
|
+
notes: "One entry per visible name after nearest-definition-wins is applied; a shadowed definition is recorded on the winner rather than listed separately. Unlike `scripts which`, an unreadable file is reported and the listing still prints, because a listing that silently omitted a file would read as complete.",
|
|
208
|
+
},
|
|
209
|
+
// Usage
|
|
210
|
+
{
|
|
211
|
+
...usageCommand("summary"),
|
|
212
|
+
outputSchema: "usage-summary",
|
|
213
|
+
notes: "Headline totals over the selection. Each provider is normalized onto one token model, which means undoing a different distortion in each: Claude Code writes one API response as several lines each carrying an identical copy of its usage; Codex reports a running total per thread rather than a per-request figure; Antigravity reports a per-request context size that is not a running total at all; Gemini CLI does all three at once, writing one turn several times under a single id while reporting a per-request context size that counts its cached prefix inside the input figure. `--provider all` merges every source that has logs on this machine. " +
|
|
214
|
+
STRICT_NOTE,
|
|
215
|
+
},
|
|
216
|
+
usageCommand("tokens", {
|
|
217
|
+
notes: "Rows are keyed by `--by`; time dimensions are ordered chronologically and everything else by token total. Cache writes report an authoritative total alongside a best-effort TTL split, which the oldest records do not carry. " +
|
|
218
|
+
STRICT_NOTE,
|
|
219
|
+
}),
|
|
220
|
+
usageCommand("tools", {
|
|
221
|
+
notes: "Counts tool-use blocks, including MCP. An MCP tool named `mcp__<server>__<tool>` is split into its server and tool halves rather than given a subcommand of its own; `--by server` and `--kind mcp` are how that surface is queried. " +
|
|
222
|
+
STRICT_NOTE,
|
|
223
|
+
}),
|
|
224
|
+
usageCommand("sessions", {
|
|
225
|
+
notes: "One row per session, with its subagent transcripts folded in. `--last n` selects the n most recently active sessions rather than the n most recent files, so a session's subagent spend is never silently dropped. " +
|
|
226
|
+
STRICT_NOTE,
|
|
227
|
+
}),
|
|
228
|
+
usageCommand("projects", {
|
|
229
|
+
notes: "Project identity is the working directory recorded inside the transcripts, not the log directory name, whose separator substitution is not reliably invertible. " +
|
|
230
|
+
STRICT_NOTE,
|
|
231
|
+
}),
|
|
232
|
+
usageCommand("skills", {
|
|
233
|
+
notes: "Skill invocations are counted from every surface that records one: the `Skill` tool, the invoked-skill attachments, and the slash-command form. " +
|
|
234
|
+
STRICT_NOTE,
|
|
235
|
+
}),
|
|
236
|
+
usageCommand("agents", {
|
|
237
|
+
notes: "Spawn counts come from the parent's subagent tool calls; token counts come from the subagent transcripts themselves. The parent's own tool result records only the subagent's final message and understates its real spend several-fold, so it is deliberately not used. `--by role` groups by the reusable agent type and `--by path` by the task-specific identifier, which only some providers record; under `--by path` the transcript count is the spawn count, because no per-path spawn record exists. " +
|
|
238
|
+
STRICT_NOTE,
|
|
239
|
+
}),
|
|
240
|
+
usageCommand("hooks", {
|
|
241
|
+
notes: "Keyed by `<Event>:<Tool>`. Stop hooks report through a session summary record rather than a per-execution one, and are counted there under `Stop`, so neither surface double-counts the other. " +
|
|
242
|
+
STRICT_NOTE,
|
|
243
|
+
}),
|
|
244
|
+
usageCommand("commands", {
|
|
245
|
+
notes: "Slash commands are not a field in the source logs; they are a marker block inside the user's message text, and are extracted from it. " +
|
|
246
|
+
STRICT_NOTE,
|
|
247
|
+
}),
|
|
248
|
+
usageCommand("providers", {
|
|
249
|
+
outputSchema: "usage-providers",
|
|
250
|
+
exitCodes: [OK("Listing written"), USAGE],
|
|
251
|
+
stream: { success: "stdout" },
|
|
252
|
+
notes: "Lists every registered log source and what it can answer. A report a provider cannot serve is decided by reading these capabilities, never by branching on the provider name, which is what keeps adding a second LLM to one new module plus one registry line. A command whose capability no scanned provider has reports that and exits 0, because a provider that does not record something has not told you the count is zero.",
|
|
253
|
+
}),
|
|
254
|
+
usageCommand("index", {
|
|
255
|
+
outputSchema: "usage-index",
|
|
256
|
+
exitCodes: [OK("Status written, or the store was rebuilt or cleared"), USAGE],
|
|
257
|
+
stream: { success: "stdout" },
|
|
258
|
+
notes: "The store keys on each transcript's path, size, and modification time; transcripts are append-only, so an unchanged file cannot hold a record the stored aggregate is missing. One SQLite store under `XDG_DATA_HOME` holds every provider, which changes three things a consumer may have relied on and which are recorded here rather than quietly fixed: `shards` is always `0`, because the per-project JSON shard files it counted no longer exist; `removed` counts transcripts dropped by `--clear` rather than shard files deleted; and `bytes` is the whole store's size, reported identically on every `caches` entry rather than partitioned between them, so it is not summed into `cache`. `writes` stays false because nothing outside the store is touched.",
|
|
259
|
+
}),
|
|
260
|
+
usageCommand("import", {
|
|
261
|
+
outputSchema: "usage-import",
|
|
262
|
+
notes: "Populates the store that every other `usage` command reads. Reports import on first use, so this is never required; it exists to do that work deliberately, and to expose the counters without a report around them. Two grains are written: the day buckets every report reads, and per-occurrence event rows that no report reads but that answer what a day bucket cannot. " +
|
|
263
|
+
STRICT_NOTE,
|
|
264
|
+
}),
|
|
265
|
+
usageCommand("migrate", {
|
|
266
|
+
outputSchema: "usage-import",
|
|
267
|
+
formats: BASE_FORMATS,
|
|
268
|
+
exitCodes: [
|
|
269
|
+
OK("Store is current, or was migrated"),
|
|
270
|
+
{ code: 1, meaning: "Invocation error, or the store is newer than this build understands" },
|
|
271
|
+
],
|
|
272
|
+
stream: { success: "stdout" },
|
|
273
|
+
notes: "The store's schema version is a fifth hand-owned version, and the first in this project that is migrated rather than discarded: after `archive run --include transcripts` has run and the source logs are pruned, the store may be the only record of that usage left, so a version bump has to carry the data forward. Every command that opens the store migrates it, so this is needed only to migrate deliberately or, with `--check`, to see what is pending first. A store written by a newer `cairn` is refused rather than opened, because writing to it could drop columns this build knows nothing about.",
|
|
274
|
+
}),
|
|
275
|
+
// Archive
|
|
276
|
+
{
|
|
277
|
+
id: "archive run",
|
|
278
|
+
formats: BASE_FORMATS,
|
|
279
|
+
defaultFormat: "llm",
|
|
280
|
+
formatConfigurable: false,
|
|
281
|
+
outputSchema: "archive-result",
|
|
282
|
+
exitCodes: [OK("Run completed"), USAGE],
|
|
283
|
+
stream: { success: "stdout" },
|
|
284
|
+
// The only writer in the toolset, and unlike `usage index` the directory it
|
|
285
|
+
// writes to is durable storage the user chose, so claiming otherwise would
|
|
286
|
+
// be misleading.
|
|
287
|
+
writes: true,
|
|
288
|
+
stability: "experimental",
|
|
289
|
+
notes: "Archives what each provider declares in `src/archive/sets.ts` — an allowlist of directories, never a sweep of a home directory, so plugin payloads and build scratch cannot be picked up by accident. `plans` and `artifacts` are taken by default; `transcripts` and `logs` are opt-in through `--include` because they are three orders of magnitude larger. Incremental twice over: a file whose size and modification time match the index is never opened, and content already stored is never written again, so a file that merely changed path costs one row. A file whose content changes gets a new row against a new blob, so every version ever seen is kept. Unreadable files are counted under `run.failures` and never fatal, because over thousands of artifacts a file removed mid-walk is routine. Progress is reported on stderr and never on the payload stream: the transient line is drawn only when stderr is a TTY, the format is not `json`, and `CI` is unset, and `--verbose` writes one durable line per artifact. Neither affects the payload, so a consumer parsing stdout sees the same bytes either way.",
|
|
290
|
+
},
|
|
291
|
+
{
|
|
292
|
+
id: "archive status",
|
|
293
|
+
formats: BASE_FORMATS,
|
|
294
|
+
defaultFormat: "llm",
|
|
295
|
+
formatConfigurable: false,
|
|
296
|
+
outputSchema: "archive-listing",
|
|
297
|
+
exitCodes: [OK("Status written"), USAGE],
|
|
298
|
+
stream: { success: "stdout" },
|
|
299
|
+
writes: false,
|
|
300
|
+
stability: "experimental",
|
|
301
|
+
notes: "Reports on an archive without opening a segment. `blobs` is distinct stored contents and `artifacts` counts every version of every path, so the two differ wherever files duplicate or change. `byClass[].bytes` sums each artifact row's content and therefore double-counts a blob shared between paths; the top-level `bytes` is the deduplicated figure.",
|
|
302
|
+
},
|
|
303
|
+
{
|
|
304
|
+
id: "archive list",
|
|
305
|
+
formats: BASE_FORMATS,
|
|
306
|
+
defaultFormat: "llm",
|
|
307
|
+
formatConfigurable: false,
|
|
308
|
+
outputSchema: "archive-listing",
|
|
309
|
+
exitCodes: [OK("Listing written"), USAGE],
|
|
310
|
+
stream: { success: "stdout" },
|
|
311
|
+
writes: false,
|
|
312
|
+
stability: "experimental",
|
|
313
|
+
notes: "One row per archived path, newest first, with `versions` counting the contents held for it rather than listing them. `--top 0` returns everything. An absent archive lists nothing and exits 0, because having archived nothing yet is not an error.",
|
|
314
|
+
},
|
|
315
|
+
{
|
|
316
|
+
id: "archive extract",
|
|
317
|
+
formats: BASE_FORMATS,
|
|
318
|
+
defaultFormat: "llm",
|
|
319
|
+
formatConfigurable: false,
|
|
320
|
+
outputSchema: "archive-result",
|
|
321
|
+
exitCodes: [OK("File written"), USAGE],
|
|
322
|
+
stream: { success: "stdout" },
|
|
323
|
+
writes: true,
|
|
324
|
+
stability: "experimental",
|
|
325
|
+
notes: "Takes an original path or a sha256 prefix. A path resolves to its newest version; a hash reaches any version. The content is re-hashed on the way out, so an archive whose index and bytes disagree reports that rather than handing back the wrong file. A prefix matching more than one blob is refused rather than resolved arbitrarily. `writes` is true: unlike the rest of the toolset this writes outside the archive, into `--out`.",
|
|
326
|
+
},
|
|
327
|
+
{
|
|
328
|
+
id: "archive verify",
|
|
329
|
+
formats: BASE_FORMATS,
|
|
330
|
+
defaultFormat: "llm",
|
|
331
|
+
formatConfigurable: false,
|
|
332
|
+
outputSchema: "archive-result",
|
|
333
|
+
exitCodes: [
|
|
334
|
+
OK("Archive matches its index"),
|
|
335
|
+
USAGE,
|
|
336
|
+
FINDINGS("The archive and its index disagree"),
|
|
337
|
+
],
|
|
338
|
+
stream: { success: "stdout", findings: "stderr" },
|
|
339
|
+
writes: false,
|
|
340
|
+
stability: "experimental",
|
|
341
|
+
notes: "Unlike every other `archive` and `usage` command, this exits 2 without `--strict`: corruption is the actionable finding it exists to report, not an incidental one. The default pass hashes each segment file; `--deep` also decompresses each and re-hashes every member, which additionally catches an index whose offsets no longer point where it claims. A segment whose own hash already fails is not opened further, since it can say nothing reliable about its members.",
|
|
342
|
+
},
|
|
343
|
+
{
|
|
344
|
+
id: "archive migrate",
|
|
345
|
+
formats: BASE_FORMATS,
|
|
346
|
+
defaultFormat: "llm",
|
|
347
|
+
formatConfigurable: false,
|
|
348
|
+
outputSchema: "archive-result",
|
|
349
|
+
exitCodes: [
|
|
350
|
+
OK("Index is current, or was migrated"),
|
|
351
|
+
{ code: 1, meaning: "Invocation error, or the index is newer than this build understands" },
|
|
352
|
+
],
|
|
353
|
+
stream: { success: "stdout" },
|
|
354
|
+
writes: true,
|
|
355
|
+
stability: "experimental",
|
|
356
|
+
notes: "The archive index carries its own hand-owned schema version, separate from the usage store's, and is likewise migrated rather than discarded: it is the only map from an original path to the segment holding that file's bytes, and the segments themselves are append-only and never rewritten. Every command that opens the index migrates it, so this is needed only to migrate deliberately or, with `--check`, to see what is pending. An index written by a newer `cairn` is refused rather than opened.",
|
|
357
|
+
},
|
|
358
|
+
// Agent
|
|
359
|
+
agentCommand("convert", {
|
|
360
|
+
writes: true,
|
|
361
|
+
exitCodes: [
|
|
362
|
+
OK("Successful and lossless"),
|
|
363
|
+
USAGE,
|
|
364
|
+
FINDINGS("Validation, compatibility, strict, or stale-output finding"),
|
|
365
|
+
],
|
|
366
|
+
notes: "All output goes to stdout, including failures. A non-strict conversion may write usable artifacts and still exit 2. --report writes the same document as conversion-report.json, provenance included, to an arbitrary path; it differs only in carrying the real dryRun and check values and in including `stale`, which the in-tree artifact is serialized too early to hold. It is written in every mode, including --dry-run, --check, and a strict failure, because an explicitly named path is a request for diagnostic output rather than a build artifact. It is never listed in `artifacts` and never compared by --check, and it is refused inside the source tree or the output directory, where it would read as drift.",
|
|
367
|
+
}),
|
|
368
|
+
agentCommand("validate"),
|
|
369
|
+
agentCommand("inspect", {
|
|
370
|
+
exitCodes: [OK("Bundle inspected"), USAGE, FINDINGS("Bundle findings")],
|
|
371
|
+
notes: "All output goes to stdout, including the failure result for an invocation error. Without --target the payload is unchanged and `targets` stays empty. --target keeps a component that reaches any selected target, using the renderer's own selection predicate so inspect and convert cannot disagree, and reports the excluded names under `bundle.filter`. --profile drops sections no selected target emits into a selected profile, read from the target profiles rather than branched on the target name, and requires --target because profile support is a property of a target. The graph is pruned to the surviving components rather than left with dangling references.",
|
|
372
|
+
}),
|
|
373
|
+
agentCommand("compat"),
|
|
374
|
+
agentCommand("doctor", {
|
|
375
|
+
exitCodes: [
|
|
376
|
+
OK("No blocking conformance findings"),
|
|
377
|
+
USAGE,
|
|
378
|
+
FINDINGS("Profile, drift, host, or strict finding"),
|
|
379
|
+
],
|
|
380
|
+
notes: "All output goes to stdout. An approximate mapping alone does not fail doctor, unlike convert and validate.",
|
|
381
|
+
}),
|
|
382
|
+
agentCommand("init", {
|
|
383
|
+
writes: true,
|
|
384
|
+
stability: "experimental",
|
|
385
|
+
exitCodes: [
|
|
386
|
+
OK("Bundle scaffolded, or dry run completed"),
|
|
387
|
+
USAGE,
|
|
388
|
+
FINDINGS("--check found a missing or differing scaffold"),
|
|
389
|
+
],
|
|
390
|
+
notes: "Never prompts. Placeholder marketplace metadata is valid here; publish readiness is checked by agent package.",
|
|
391
|
+
}),
|
|
392
|
+
agentCommand("add", {
|
|
393
|
+
writes: true,
|
|
394
|
+
stability: "experimental",
|
|
395
|
+
exitCodes: [
|
|
396
|
+
OK("Component added, or dry run completed"),
|
|
397
|
+
USAGE,
|
|
398
|
+
FINDINGS("--check found a missing or differing component"),
|
|
399
|
+
],
|
|
400
|
+
notes: "agent-bundle.yaml is edited through a comment-preserving YAML document and is left byte-untouched when no manifest change is needed.",
|
|
401
|
+
}),
|
|
402
|
+
agentCommand("import", {
|
|
403
|
+
writes: true,
|
|
404
|
+
stability: "experimental",
|
|
405
|
+
exitCodes: [
|
|
406
|
+
OK("Imported, or dry run completed"),
|
|
407
|
+
USAGE,
|
|
408
|
+
FINDINGS("Blocking finding, or --check found drift"),
|
|
409
|
+
],
|
|
410
|
+
notes: "Approximate mappings alone do not fail import, unlike convert and validate, because approximation is the expected outcome of returning from a native format. A nonempty destination is refused unless --merge names a strategy.",
|
|
411
|
+
}),
|
|
412
|
+
agentCommand("upgrade", {
|
|
413
|
+
writes: true,
|
|
414
|
+
stability: "experimental",
|
|
415
|
+
exitCodes: [
|
|
416
|
+
OK("Migrated, already current, or dry run completed"),
|
|
417
|
+
USAGE,
|
|
418
|
+
FINDINGS("--check found a bundle below the target schema, or a blocking finding"),
|
|
419
|
+
],
|
|
420
|
+
notes: "Rewrites only agent-bundle.yaml. --to-schema is required rather than defaulting to the newest, so a CI result does not depend on the installed CLI version. Human-judgment notices (AB221) do not fail the command.",
|
|
421
|
+
}),
|
|
422
|
+
agentCommand("package", {
|
|
423
|
+
writes: true,
|
|
424
|
+
stability: "experimental",
|
|
425
|
+
exitCodes: [
|
|
426
|
+
OK("Package written, or checks passed"),
|
|
427
|
+
USAGE,
|
|
428
|
+
FINDINGS("Publish-readiness, integrity, or stale finding"),
|
|
429
|
+
],
|
|
430
|
+
notes: "Renders the bundle itself rather than trusting an existing tree; --from-dist only verifies one. Never contacts the network and never publishes. The package root is not an agent convert output root, so agent doctor --output must not be pointed at it.",
|
|
431
|
+
}),
|
|
432
|
+
agentCommand("marketplace", {
|
|
433
|
+
writes: true,
|
|
434
|
+
stability: "experimental",
|
|
435
|
+
exitCodes: [
|
|
436
|
+
OK("Collection written, or checks passed"),
|
|
437
|
+
USAGE,
|
|
438
|
+
FINDINGS("Spec, publish-readiness, or stale finding"),
|
|
439
|
+
],
|
|
440
|
+
notes: "Builds one aggregated catalog per target covering every bundle a collection spec names, rather than one catalog per bundle as agent package does. Renders every bundle itself, so a catalog can never certify a stale tree. Never contacts the network and never publishes. The collection root is not an agent convert output root, so agent doctor --output must not be pointed at it.",
|
|
441
|
+
}),
|
|
442
|
+
agentCommand("audit", {
|
|
443
|
+
stability: "experimental",
|
|
444
|
+
sarifSchema: SARIF_SCHEMA_URI,
|
|
445
|
+
exitCodes: [OK("No blocking review findings"), USAGE, FINDINGS("Review findings")],
|
|
446
|
+
notes: "All output goes to stdout, including the SARIF form and the failure result for an invocation error — unlike the md diagnostic commands, which route findings to stderr. The pass/fail rule is split by origin: a warning audit itself found is blocking, because almost every review finding is a warning by design, while a forwarded parse or render warning is not unless --strict says so. Exit 2 means findings to review, not proof that a bundle is malicious. --format sarif has no agent-result payload, so an invocation error under it prints plainly and exits 1.",
|
|
447
|
+
}),
|
|
448
|
+
agentCommand("test", {
|
|
449
|
+
stability: "experimental",
|
|
450
|
+
exitCodes: [
|
|
451
|
+
OK("Every selected case passed"),
|
|
452
|
+
USAGE,
|
|
453
|
+
FINDINGS("A failing case, an invalid test file, or a warning under --strict"),
|
|
454
|
+
],
|
|
455
|
+
notes: "Experimental because the test-file format may still change; it carries its own hand-owned schemaVersion, reported back as `test.schemaVersion`. Model-free by construction: expectations are evaluated against the same in-memory render agent convert would write, so no model is called, no host tooling is executed, and no file is written. `test.native` is reserved for evidence from a host's own validator and is always empty; agent specs publishes the validator commands to run yourself. An unmet expectation is an error, so unlike agent audit no per-code split is needed; a forwarded parse or render warning blocks only under --strict, and so does AB701, which reports that a bundle carried no test cases at all. An unknown --case name is a usage error rather than a run that selects nothing, so a typo in CI cannot read as a pass. --target and --profile intersect each case's own selection rather than widening it.",
|
|
456
|
+
}),
|
|
457
|
+
agentCommand("install", {
|
|
458
|
+
writes: true,
|
|
459
|
+
stability: "experimental",
|
|
460
|
+
exitCodes: [
|
|
461
|
+
OK("Installed, or checks passed"),
|
|
462
|
+
USAGE,
|
|
463
|
+
FINDINGS("Install finding, or --check found drift"),
|
|
464
|
+
],
|
|
465
|
+
notes: "Renders and packages in memory rather than trusting a dist tree, so an install is always derived from the bundle. Destinations come from the target profiles. --register is the only flag that edits host config, and only the marketplace layout needs it. Approximate render diagnostics do not fail install, unlike convert and validate.",
|
|
466
|
+
}),
|
|
467
|
+
agentCommand("uninstall", {
|
|
468
|
+
writes: true,
|
|
469
|
+
stability: "experimental",
|
|
470
|
+
exitCodes: [
|
|
471
|
+
OK("Removed, already absent under --check, or dry run completed"),
|
|
472
|
+
USAGE,
|
|
473
|
+
FINDINGS("Manifest missing or malformed, or --check found the install still present"),
|
|
474
|
+
],
|
|
475
|
+
notes: "Removes exactly the inventory recorded in .cairn-install.json and nothing else. --scope is optional: both scopes are searched, and two matches is an error rather than a guess.",
|
|
476
|
+
}),
|
|
477
|
+
agentCommand("installed", {
|
|
478
|
+
stability: "experimental",
|
|
479
|
+
exitCodes: [OK("Listing written to stdout"), USAGE],
|
|
480
|
+
stream: { success: "stdout" },
|
|
481
|
+
notes: "Scans the install roots declared on the target profiles. All output goes to stdout. Prints observed state, so it never reports findings.",
|
|
482
|
+
}),
|
|
483
|
+
agentCommand("specs", {
|
|
484
|
+
exitCodes: [OK("Profiles written to stdout"), USAGE],
|
|
485
|
+
stream: { success: "stdout" },
|
|
486
|
+
notes: "All output goes to stdout. Prints static data, so it never reports findings.",
|
|
487
|
+
}),
|
|
488
|
+
// Markdown: validation
|
|
489
|
+
diagnostic("lint", "One or more issues found", {
|
|
490
|
+
outputSchema: "issue-list",
|
|
491
|
+
...AUTOMATION,
|
|
492
|
+
}),
|
|
493
|
+
diagnostic("lint-dir", "One or more issues found in any file", {
|
|
494
|
+
outputSchema: "issue-list",
|
|
495
|
+
...AUTOMATION,
|
|
496
|
+
notes: "--summary --format json emits the lint-dir-summary shape instead of a finding list. 'No markdown files found' is reported on stdout with exit 0.",
|
|
497
|
+
}),
|
|
498
|
+
diagnostic("validate-frontmatter", "Validation findings", {
|
|
499
|
+
outputSchema: "issue-list",
|
|
500
|
+
...AUTOMATION,
|
|
501
|
+
exitCodes: [OK("Frontmatter is valid"), USAGE, FINDINGS("Validation findings")],
|
|
502
|
+
}),
|
|
503
|
+
diagnostic("audit", "Actionable findings", {
|
|
504
|
+
outputSchema: "md-audit",
|
|
505
|
+
...AUTOMATION,
|
|
506
|
+
// Only --write-baseline writes, and only to the named baseline file.
|
|
507
|
+
writes: true,
|
|
508
|
+
exitCodes: [
|
|
509
|
+
OK("No findings, or a baseline was written"),
|
|
510
|
+
USAGE,
|
|
511
|
+
FINDINGS("Actionable findings"),
|
|
512
|
+
],
|
|
513
|
+
notes: "The jsonl and sarif forms carry only the findings; the totals and graph summary have no representation in them. --baseline suppresses findings a baseline already records and reports what it suppressed, so exit 2 means regressions only; entries are keyed on checker, workspace-relative path, and message, deliberately not line number. A stale entry means something was fixed and never changes the exit code, and a document this tool did not write is reported as a `baseline` finding rather than silently ignored. --write-baseline records the current findings and exits 0; it is the only audit mode that writes, and it is deliberately not settable from project configuration.",
|
|
514
|
+
}),
|
|
515
|
+
diagnostic("check-urls", "One or more URLs are broken", {
|
|
516
|
+
outputSchema: "md-check-urls",
|
|
517
|
+
...AUTOMATION,
|
|
518
|
+
notes: "The `file` key is present only when exactly one input file was checked.",
|
|
519
|
+
}),
|
|
520
|
+
diagnostic("check-snippets", "Snippet drift, or a link that could not be resolved", {
|
|
521
|
+
outputSchema: "md-check-snippets",
|
|
522
|
+
// Only --write writes, and only to the linked blocks it can rewrite.
|
|
523
|
+
writes: true,
|
|
524
|
+
stability: "experimental",
|
|
525
|
+
exitCodes: [
|
|
526
|
+
OK("Every linked snippet matches its source, or --write refreshed them"),
|
|
527
|
+
USAGE,
|
|
528
|
+
FINDINGS("--check or --dry-run found drift, or any mode found an unresolvable link, a malformed link, an unwritable fence, or an edit-plan conflict"),
|
|
529
|
+
],
|
|
530
|
+
notes: "Experimental because the fence authoring syntax may still change. A snippet is never executed; the source file is only read. Only fences whose info string carries cairn:snippet= are considered, and unlinked fences never appear in the payload. Unlike md fix, a finding with no available fix — a deleted source file, a deleted region, a fence the refreshed body cannot fit into — fails every mode including --write, because this command's job is checking rather than fixing; drift alone fails only --check and --dry-run. Comparison ignores line endings, trailing horizontal whitespace, and trailing blank lines, and nothing else. Source reads are confined to the workspace root and refuse non-regular files, files over 2 MiB, and files containing NUL; writes are confined to the md fix containment root. The mode is deliberately not settable from project configuration.",
|
|
531
|
+
}),
|
|
532
|
+
// Markdown: references and graph
|
|
533
|
+
diagnostic("refs", "One or more targets missing"),
|
|
534
|
+
inspection("refs-to"),
|
|
535
|
+
diagnostic("links", "One or more broken links found", {
|
|
536
|
+
outputSchema: "issue-list",
|
|
537
|
+
notes: "--format json writes to stdout and returns before the broken-link check, so it exits 0 even when broken links exist. Changing this would be a breaking change.",
|
|
538
|
+
}),
|
|
539
|
+
diagnostic("orphans", "One or more orphans found", { outputSchema: "md-orphans" }),
|
|
540
|
+
diagnostic("graph", "Broken or unreachable documents found", {
|
|
541
|
+
outputSchema: "md-graph",
|
|
542
|
+
notes: "--output mermaid|dot writes the diagram to stdout regardless of exit status and ignores --format. --focus narrows every output to the documents within --depth undirected hops, and the exit code follows the narrowing. The graph is built from the full selected set first, so inbound, outbound, and deadEnd stay whole-workspace values and a component or cycle is reported whole when any member is in focus — a link leaving the neighborhood is never reported as broken.",
|
|
543
|
+
}),
|
|
544
|
+
// Markdown: document inspection
|
|
545
|
+
inspection("headers"),
|
|
546
|
+
inspection("outline"),
|
|
547
|
+
inspection("stats"),
|
|
548
|
+
inspection("structure"),
|
|
549
|
+
inspection("code-blocks"),
|
|
550
|
+
inspection("tasks"),
|
|
551
|
+
inspection("tables"),
|
|
552
|
+
inspection("section", {
|
|
553
|
+
exitCodes: [
|
|
554
|
+
OK("Section found and extracted"),
|
|
555
|
+
{ code: 1, meaning: "File or heading not found" },
|
|
556
|
+
],
|
|
557
|
+
notes: "--raw writes markdown to stdout regardless of --format.",
|
|
558
|
+
}),
|
|
559
|
+
inspection("frontmatter", {
|
|
560
|
+
exitCodes: [
|
|
561
|
+
OK("Frontmatter found, or none present"),
|
|
562
|
+
{ code: 1, meaning: "File not found or key not found" },
|
|
563
|
+
],
|
|
564
|
+
notes: "--key --format json emits the raw extracted value, which may be a scalar or null.",
|
|
565
|
+
}),
|
|
566
|
+
inspection("toc", {
|
|
567
|
+
writes: true,
|
|
568
|
+
exitCodes: [
|
|
569
|
+
OK("Table of contents current, or written"),
|
|
570
|
+
USAGE,
|
|
571
|
+
FINDINGS("--check found a stale table of contents"),
|
|
572
|
+
],
|
|
573
|
+
stream: { success: "stdout", findings: "stderr" },
|
|
574
|
+
notes: "Emits a different shape per mode: --write, --dry-run, --check, and the default listing. Only --write modifies files.",
|
|
575
|
+
}),
|
|
576
|
+
// Markdown: workspace data
|
|
577
|
+
inspection("query", {
|
|
578
|
+
outputSchema: "md-query",
|
|
579
|
+
notes: "Two modes share one kind argument. Without --where, --select, or --group-by the shortcut kinds emit their historical shapes unchanged. With any of them the kind names an entity (documents, headings, links, tasks, code-blocks, frontmatter) and the payload carries projected rows plus a `fields` column order; --group-by replaces `results` with group objects. So code-blocks emits language groups without composable options and flat rows with them. links-to, duplicates, unused-assets, missing-h1, and frontmatter-keys reject composable options rather than changing shape, and the predicate options are deliberately not configurable. frontmatter-keys is an aggregate — one row per top-level key with a document count and coverage — which the projection model cannot express, so it is a shortcut kind rather than a seventh entity.",
|
|
580
|
+
}),
|
|
581
|
+
inspection("diff", {
|
|
582
|
+
outputSchema: "md-diff",
|
|
583
|
+
notes: "Describes two states rather than judging them, so differences never change the exit code. Heading renames matched by position carry heuristic: true and are a guess, not a fact; a heading whose text changed and which also moved is reported as a removal plus an addition instead.",
|
|
584
|
+
}),
|
|
585
|
+
inspection("context", {
|
|
586
|
+
outputSchema: "md-context",
|
|
587
|
+
notes: "Broken dependencies and budget omissions are reported inside the payload and never change the exit code; use md links or md audit to fail on them. budget.tokenEstimate is usedBytes/4, not a model tokenizer.",
|
|
588
|
+
}),
|
|
589
|
+
inspection("index", {
|
|
590
|
+
outputSchema: "md-index",
|
|
591
|
+
writes: true,
|
|
592
|
+
notes: "Writes only the workspace cache, never workspace files.",
|
|
593
|
+
}),
|
|
594
|
+
// Markdown: refactoring
|
|
595
|
+
diagnostic("fix", "Pending fixes, or a conflict that blocks writing", {
|
|
596
|
+
outputSchema: "md-fix",
|
|
597
|
+
writes: true,
|
|
598
|
+
stability: "experimental",
|
|
599
|
+
exitCodes: [
|
|
600
|
+
OK("No pending fixes, or --write and --dry-run completed"),
|
|
601
|
+
USAGE,
|
|
602
|
+
FINDINGS("--check found pending fixes, or any mode found a conflict"),
|
|
603
|
+
],
|
|
604
|
+
notes: "Defaults to --check; only --write modifies files, and the mode cannot be set from project configuration. --write applies every file's edits as one transaction and refuses to write at all if any input changed after planning, any two edits overlap, or any target resolves outside the workspace root. Per-file commits are atomic; a multi-file rollback rewrites bytes best-effort and is not crash-safe. Unfixable findings are reported but never change the exit code.",
|
|
605
|
+
}),
|
|
606
|
+
inspection("rename-heading", {
|
|
607
|
+
writes: true,
|
|
608
|
+
exitCodes: [
|
|
609
|
+
OK("Heading renamed, or dry run completed"),
|
|
610
|
+
{ code: 1, meaning: "File or heading not found, or the new slug already exists" },
|
|
611
|
+
],
|
|
612
|
+
}),
|
|
613
|
+
inspection("rename-file", {
|
|
614
|
+
writes: true,
|
|
615
|
+
exitCodes: [
|
|
616
|
+
OK("File renamed, or dry run completed"),
|
|
617
|
+
{ code: 1, meaning: "Source not found, or the destination already exists" },
|
|
618
|
+
],
|
|
619
|
+
}),
|
|
620
|
+
];
|
|
621
|
+
export const COMMAND_CONTRACTS = Object.fromEntries(CONTRACTS.map((contract) => [contract.id, contract]));
|
|
622
|
+
//# sourceMappingURL=registry.js.map
|