@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,69 @@
|
|
|
1
|
+
import type { AgentDiagnostic, AgentProfile, AgentTarget, Artifact } from "../types.js";
|
|
2
|
+
/** The `sbom.json` format `agent package` writes. */
|
|
3
|
+
export declare const BASELINE_FORMAT = "cairn-inventory";
|
|
4
|
+
/** The pre-rename discriminator, still accepted on committed inventories. */
|
|
5
|
+
export declare const LEGACY_BASELINE_FORMAT = "claude-cli-inventory";
|
|
6
|
+
export interface BaselineComponent {
|
|
7
|
+
path: string;
|
|
8
|
+
type: string;
|
|
9
|
+
sha256: string;
|
|
10
|
+
bytes: number;
|
|
11
|
+
mode: string;
|
|
12
|
+
origin: string;
|
|
13
|
+
}
|
|
14
|
+
export interface BaselineDocument {
|
|
15
|
+
bomFormat?: string;
|
|
16
|
+
generator?: {
|
|
17
|
+
name: string;
|
|
18
|
+
version: string;
|
|
19
|
+
};
|
|
20
|
+
subject?: {
|
|
21
|
+
name: string;
|
|
22
|
+
version: string;
|
|
23
|
+
};
|
|
24
|
+
components?: BaselineComponent[];
|
|
25
|
+
}
|
|
26
|
+
export interface AuditBaseline {
|
|
27
|
+
path: string;
|
|
28
|
+
subject: {
|
|
29
|
+
name: string;
|
|
30
|
+
version: string;
|
|
31
|
+
} | null;
|
|
32
|
+
generator: {
|
|
33
|
+
name: string;
|
|
34
|
+
version: string;
|
|
35
|
+
} | null;
|
|
36
|
+
/** Paths compared, after narrowing to the executable set. */
|
|
37
|
+
compared: number;
|
|
38
|
+
added: string[];
|
|
39
|
+
removed: string[];
|
|
40
|
+
changed: string[];
|
|
41
|
+
modeChanged: Array<{
|
|
42
|
+
path: string;
|
|
43
|
+
from: string;
|
|
44
|
+
to: string;
|
|
45
|
+
}>;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Reads a previous package inventory.
|
|
49
|
+
*
|
|
50
|
+
* A missing or unparseable file throws, matching how `agent package
|
|
51
|
+
* --from-dist` and `agent doctor --output` treat a path that is not there. A
|
|
52
|
+
* *foreign* document is a finding instead (AB654), because guessing at another
|
|
53
|
+
* tool's schema would produce drift reports nobody can trust.
|
|
54
|
+
*/
|
|
55
|
+
export declare function readBaseline(file: string): BaselineDocument;
|
|
56
|
+
/**
|
|
57
|
+
* Compares the executable surface of a package against a previous inventory.
|
|
58
|
+
*
|
|
59
|
+
* Scope is deliberately the executable set — baseline components typed `script`
|
|
60
|
+
* or `executable`, plus anything currently carrying an execute bit. That is
|
|
61
|
+
* exactly the question ("what can run, and did it change?"), and it drops
|
|
62
|
+
* `checksums.sha256`, `sbom.json`, `package-report.json`, and the marketplace
|
|
63
|
+
* catalogs for free, so a differently-packaged run never reports them as
|
|
64
|
+
* removed.
|
|
65
|
+
*/
|
|
66
|
+
export declare function diffBaseline(document: BaselineDocument, file: string, artifacts: Artifact[], targets: AgentTarget[], profiles: AgentProfile[]): {
|
|
67
|
+
diagnostics: AgentDiagnostic[];
|
|
68
|
+
report: AuditBaseline;
|
|
69
|
+
};
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import crypto from "node:crypto";
|
|
2
|
+
import fs from "node:fs";
|
|
3
|
+
import { diagnostic } from "../types.js";
|
|
4
|
+
import { classify } from "../package/index.js";
|
|
5
|
+
/** The `sbom.json` format `agent package` writes. */
|
|
6
|
+
export const BASELINE_FORMAT = "cairn-inventory";
|
|
7
|
+
/** The pre-rename discriminator, still accepted on committed inventories. */
|
|
8
|
+
export const LEGACY_BASELINE_FORMAT = "claude-cli-inventory";
|
|
9
|
+
/**
|
|
10
|
+
* Reads a previous package inventory.
|
|
11
|
+
*
|
|
12
|
+
* A missing or unparseable file throws, matching how `agent package
|
|
13
|
+
* --from-dist` and `agent doctor --output` treat a path that is not there. A
|
|
14
|
+
* *foreign* document is a finding instead (AB654), because guessing at another
|
|
15
|
+
* tool's schema would produce drift reports nobody can trust.
|
|
16
|
+
*/
|
|
17
|
+
export function readBaseline(file) {
|
|
18
|
+
if (!fs.existsSync(file))
|
|
19
|
+
throw new Error(`--baseline file does not exist: ${file}`);
|
|
20
|
+
const raw = fs.readFileSync(file, "utf8");
|
|
21
|
+
let parsed;
|
|
22
|
+
try {
|
|
23
|
+
parsed = JSON.parse(raw);
|
|
24
|
+
}
|
|
25
|
+
catch (cause) {
|
|
26
|
+
throw new Error(`--baseline is not valid JSON: ${file}`, { cause });
|
|
27
|
+
}
|
|
28
|
+
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed))
|
|
29
|
+
throw new Error(`--baseline is not an inventory document: ${file}`);
|
|
30
|
+
return parsed;
|
|
31
|
+
}
|
|
32
|
+
function mode(value) {
|
|
33
|
+
return `0${value.toString(8)}`;
|
|
34
|
+
}
|
|
35
|
+
function sha256(content) {
|
|
36
|
+
return crypto.createHash("sha256").update(content).digest("hex");
|
|
37
|
+
}
|
|
38
|
+
function sorted(values) {
|
|
39
|
+
return [...values].sort((a, b) => (a < b ? -1 : a > b ? 1 : 0));
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Compares the executable surface of a package against a previous inventory.
|
|
43
|
+
*
|
|
44
|
+
* Scope is deliberately the executable set — baseline components typed `script`
|
|
45
|
+
* or `executable`, plus anything currently carrying an execute bit. That is
|
|
46
|
+
* exactly the question ("what can run, and did it change?"), and it drops
|
|
47
|
+
* `checksums.sha256`, `sbom.json`, `package-report.json`, and the marketplace
|
|
48
|
+
* catalogs for free, so a differently-packaged run never reports them as
|
|
49
|
+
* removed.
|
|
50
|
+
*/
|
|
51
|
+
export function diffBaseline(document, file, artifacts, targets, profiles) {
|
|
52
|
+
const report = {
|
|
53
|
+
path: file,
|
|
54
|
+
subject: document.subject ?? null,
|
|
55
|
+
generator: document.generator ?? null,
|
|
56
|
+
compared: 0,
|
|
57
|
+
added: [],
|
|
58
|
+
removed: [],
|
|
59
|
+
changed: [],
|
|
60
|
+
modeChanged: [],
|
|
61
|
+
};
|
|
62
|
+
if (document.bomFormat !== BASELINE_FORMAT && document.bomFormat !== LEGACY_BASELINE_FORMAT)
|
|
63
|
+
return {
|
|
64
|
+
report,
|
|
65
|
+
diagnostics: [
|
|
66
|
+
diagnostic("AB654", `--baseline is not a ${BASELINE_FORMAT} document; drift checks were skipped`, "approximate", {
|
|
67
|
+
path: file,
|
|
68
|
+
remediation: "Pass the sbom.json that agent package wrote.",
|
|
69
|
+
}),
|
|
70
|
+
],
|
|
71
|
+
};
|
|
72
|
+
// The selected scope, so a plugin-only audit does not report every project
|
|
73
|
+
// path in the baseline as removed.
|
|
74
|
+
const prefixes = targets.flatMap((target) => profiles.map((profile) => `${target}/${profile}/`));
|
|
75
|
+
const inScope = (candidate) => prefixes.some((prefix) => candidate.startsWith(prefix));
|
|
76
|
+
const before = new Map();
|
|
77
|
+
for (const component of document.components ?? [])
|
|
78
|
+
if (inScope(component.path) && (component.type === "script" || component.type === "executable"))
|
|
79
|
+
before.set(component.path, component);
|
|
80
|
+
// Anything the baseline tracked stays in scope even if it is no longer
|
|
81
|
+
// executable, so losing the execute bit is reported as the mode change it is
|
|
82
|
+
// rather than as a removal.
|
|
83
|
+
const after = new Map();
|
|
84
|
+
for (const artifact of artifacts)
|
|
85
|
+
if (inScope(artifact.path) &&
|
|
86
|
+
(before.has(artifact.path) || ["script", "executable"].includes(classify(artifact))))
|
|
87
|
+
after.set(artifact.path, artifact);
|
|
88
|
+
const diagnostics = [];
|
|
89
|
+
for (const [candidate, artifact] of after) {
|
|
90
|
+
const previous = before.get(candidate);
|
|
91
|
+
if (!previous) {
|
|
92
|
+
report.added.push(candidate);
|
|
93
|
+
diagnostics.push(diagnostic("AB652", `New executable since the baseline: ${candidate}`, "approximate", {
|
|
94
|
+
path: candidate,
|
|
95
|
+
remediation: "Confirm the addition is intended before publishing.",
|
|
96
|
+
}));
|
|
97
|
+
continue;
|
|
98
|
+
}
|
|
99
|
+
report.compared += 1;
|
|
100
|
+
const current = sha256(artifact.content);
|
|
101
|
+
if (previous.sha256 !== current) {
|
|
102
|
+
report.changed.push(candidate);
|
|
103
|
+
diagnostics.push(diagnostic("AB650", `Executable content changed: ${candidate}`, "approximate", {
|
|
104
|
+
path: candidate,
|
|
105
|
+
remediation: "Review the diff against the released version.",
|
|
106
|
+
}));
|
|
107
|
+
}
|
|
108
|
+
const now = mode(artifact.mode);
|
|
109
|
+
if (previous.mode !== now) {
|
|
110
|
+
report.modeChanged.push({ path: candidate, from: previous.mode, to: now });
|
|
111
|
+
const gained = (artifact.mode & 0o111) !== 0 && (Number.parseInt(previous.mode, 8) & 0o111) === 0;
|
|
112
|
+
diagnostics.push(diagnostic("AB651", `Mode changed ${previous.mode} → ${now}${gained ? " (gained the execute bit)" : ""}: ${candidate}`, "approximate", { path: candidate }));
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
for (const candidate of before.keys())
|
|
116
|
+
if (!after.has(candidate)) {
|
|
117
|
+
report.removed.push(candidate);
|
|
118
|
+
diagnostics.push(diagnostic("AB653", `Executable removed since the baseline: ${candidate}`, "exact", {
|
|
119
|
+
path: candidate,
|
|
120
|
+
}));
|
|
121
|
+
}
|
|
122
|
+
report.added = sorted(report.added);
|
|
123
|
+
report.removed = sorted(report.removed);
|
|
124
|
+
report.changed = sorted(report.changed);
|
|
125
|
+
report.modeChanged.sort((a, b) => (a.path < b.path ? -1 : a.path > b.path ? 1 : 0));
|
|
126
|
+
return { diagnostics, report };
|
|
127
|
+
}
|
|
128
|
+
//# sourceMappingURL=baseline.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"baseline.js","sourceRoot":"","sources":["../../../src/agent/audit/baseline.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,aAAa,CAAC;AACjC,OAAO,EAAE,MAAM,SAAS,CAAC;AAEzB,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO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,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;YAC/B,WAAW,CAAC,IAAI,CACd,UAAU,CAAC,OAAO,EAAE,0CAA0C,SAAS,EAAE,EAAE,OAAO,EAAE;gBAClF,IAAI,EAAE,SAAS;aAChB,CAAC,CACH,CAAC;QACJ,CAAC;IAEH,MAAM,CAAC,KAAK,GAAG,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IACpC,MAAM,CAAC,OAAO,GAAG,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;IACxC,MAAM,CAAC,OAAO,GAAG,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;IACxC,MAAM,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IACpF,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,CAAC;AACjC,CAAC"}
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import type { AgentBundle, AgentDiagnostic, AgentProfile, AgentTarget, Artifact, SourceFile } from "../types.js";
|
|
2
|
+
import type { AuditBaseline } from "./baseline.js";
|
|
3
|
+
/** A single file larger than this is worth a reviewer's attention. */
|
|
4
|
+
export declare const MAX_FILE_BYTES: number;
|
|
5
|
+
/** A bundle larger than this is worth a reviewer's attention. */
|
|
6
|
+
export declare const MAX_TOTAL_BYTES: number;
|
|
7
|
+
/**
|
|
8
|
+
* Directories excluded from the source inventory.
|
|
9
|
+
*
|
|
10
|
+
* These are version-control and dependency infrastructure, not bundle content:
|
|
11
|
+
* the renderer never emits them, so counting them would drown the size and
|
|
12
|
+
* binary checks in noise that can never reach a generated plugin.
|
|
13
|
+
*/
|
|
14
|
+
export declare const INVENTORY_EXCLUDED: string[];
|
|
15
|
+
export interface AuditCounts {
|
|
16
|
+
error: number;
|
|
17
|
+
warning: number;
|
|
18
|
+
notice: number;
|
|
19
|
+
}
|
|
20
|
+
export interface AuditSurface {
|
|
21
|
+
/** Hook handlers with a command, across the base events and every override. */
|
|
22
|
+
hooks: number;
|
|
23
|
+
mcpServers: number;
|
|
24
|
+
policies: number;
|
|
25
|
+
/** Files in the bundle-root-relative source inventory. */
|
|
26
|
+
files: number;
|
|
27
|
+
executables: number;
|
|
28
|
+
symlinks: number;
|
|
29
|
+
binaries: number;
|
|
30
|
+
bytes: number;
|
|
31
|
+
}
|
|
32
|
+
/** One command line this bundle can cause a host to run. */
|
|
33
|
+
export interface AuditCommand {
|
|
34
|
+
origin: "hook" | "mcp";
|
|
35
|
+
/** Hook event, or MCP server name. */
|
|
36
|
+
name: string;
|
|
37
|
+
command: string;
|
|
38
|
+
args?: string[];
|
|
39
|
+
/** Set when the command came from a `targets.<target>` override. */
|
|
40
|
+
target?: AgentTarget;
|
|
41
|
+
/** Source file the command was read from. */
|
|
42
|
+
path?: string;
|
|
43
|
+
}
|
|
44
|
+
export interface AuditReport {
|
|
45
|
+
/**
|
|
46
|
+
* Diagnostic codes this run evaluated. Without it a consumer cannot tell
|
|
47
|
+
* "clean" from "not checked": the rendered checks need `--target` and the
|
|
48
|
+
* drift checks need `--baseline`.
|
|
49
|
+
*/
|
|
50
|
+
checks: string[];
|
|
51
|
+
counts: AuditCounts;
|
|
52
|
+
surface: AuditSurface;
|
|
53
|
+
/** Executable and script inventory, using `sbom.json`'s `type` vocabulary. */
|
|
54
|
+
executables: Array<{
|
|
55
|
+
path: string;
|
|
56
|
+
mode: string;
|
|
57
|
+
sha256: string;
|
|
58
|
+
kind: string;
|
|
59
|
+
}>;
|
|
60
|
+
commands: AuditCommand[];
|
|
61
|
+
baseline?: AuditBaseline;
|
|
62
|
+
/**
|
|
63
|
+
* What this command does not do. Carried as data rather than as a permanent
|
|
64
|
+
* notice, which would pollute every consumer's diagnostics and every
|
|
65
|
+
* `--strict` run.
|
|
66
|
+
*/
|
|
67
|
+
limitations: string[];
|
|
68
|
+
}
|
|
69
|
+
export declare const AUDIT_LIMITATIONS: string[];
|
|
70
|
+
/** Every code the source-only checks can emit. */
|
|
71
|
+
export declare const SOURCE_CHECKS: string[];
|
|
72
|
+
/** Codes that additionally require `--target`, because they read rendered output. */
|
|
73
|
+
export declare const RENDERED_CHECKS: string[];
|
|
74
|
+
/** Codes that additionally require `--baseline`. */
|
|
75
|
+
export declare const BASELINE_CHECKS: string[];
|
|
76
|
+
/**
|
|
77
|
+
* Every code audit itself produces, as opposed to the parse and render
|
|
78
|
+
* diagnostics it forwards. This distinction is what lets a warning about the
|
|
79
|
+
* bundle's review surface fail the command while an approximate mapping — which
|
|
80
|
+
* every codex bundle carries and which says nothing about trust — does not.
|
|
81
|
+
*/
|
|
82
|
+
export declare const AUDIT_CODES: ReadonlySet<string>;
|
|
83
|
+
/** Splits a command line into tokens, honoring single and double quotes. */
|
|
84
|
+
export declare function tokenize(command: string): string[];
|
|
85
|
+
/**
|
|
86
|
+
* Executable-format magic number.
|
|
87
|
+
*
|
|
88
|
+
* Header parsing only, mirroring `imageKind` in the packager: pulling in a
|
|
89
|
+
* binary-format library to answer "is this an executable" would be a dependency
|
|
90
|
+
* for a review nicety.
|
|
91
|
+
*/
|
|
92
|
+
export declare function binaryKind(content: Buffer): "elf" | "pe" | "macho" | null;
|
|
93
|
+
/** Shannon entropy per character, used only to grade a candidate secret. */
|
|
94
|
+
export declare function entropy(value: string): number;
|
|
95
|
+
/**
|
|
96
|
+
* Every file in the bundle, with bundle-root-relative POSIX paths.
|
|
97
|
+
*
|
|
98
|
+
* The normalization is not cosmetic: `bundle.hookFiles` paths are relative to
|
|
99
|
+
* the hook directory, so passing them to the packager's `checkExecutables`
|
|
100
|
+
* would miss the `hooks/` prefix its regex looks for and flag every scaffolded
|
|
101
|
+
* hook script.
|
|
102
|
+
*/
|
|
103
|
+
export declare function buildSourceInventory(bundle: AgentBundle): SourceFile[];
|
|
104
|
+
/**
|
|
105
|
+
* Every command a hook or MCP server would run, from the base document and from
|
|
106
|
+
* each `targets.<target>` override.
|
|
107
|
+
*
|
|
108
|
+
* Deliberately read from the source rather than from rendered artifacts: the
|
|
109
|
+
* renderer substitutes placeholders but does not change a command's structure,
|
|
110
|
+
* so auditing both would report the same command up to six times.
|
|
111
|
+
*/
|
|
112
|
+
export declare function collectCommands(bundle: AgentBundle): AuditCommand[];
|
|
113
|
+
/** AB600–AB606: what the commands a host would run actually do. */
|
|
114
|
+
export declare function checkCommands(commands: AuditCommand[], bundle: AgentBundle): AgentDiagnostic[];
|
|
115
|
+
/** AB610–AB614: what an MCP server connects to and what it is handed. */
|
|
116
|
+
export declare function checkMcp(bundle: AgentBundle): AgentDiagnostic[];
|
|
117
|
+
/** AB620–AB622: how broad a command policy's grants are. */
|
|
118
|
+
export declare function checkPolicies(bundle: AgentBundle): AgentDiagnostic[];
|
|
119
|
+
/** AB607, AB623, AB641: the capabilities components declare for themselves. */
|
|
120
|
+
export declare function checkCapabilities(bundle: AgentBundle): AgentDiagnostic[];
|
|
121
|
+
/** AB630–AB634: the shape of the files the bundle carries. */
|
|
122
|
+
export declare function checkInventory(bundle: AgentBundle, files: SourceFile[]): AgentDiagnostic[];
|
|
123
|
+
/** AB640: manifest component roots that name nothing. */
|
|
124
|
+
export declare function checkManifestClaims(bundle: AgentBundle): AgentDiagnostic[];
|
|
125
|
+
/** AB624, AB642: what the rendered output grants and claims. */
|
|
126
|
+
export declare function checkRendered(bundle: AgentBundle, artifacts: Artifact[], targets: AgentTarget[], profiles: AgentProfile[]): AgentDiagnostic[];
|