@vibe-agent-toolkit/cli 0.1.42 → 0.2.0-rc.10
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/README.md +4 -5
- package/dist/bin/vat +95 -28
- package/dist/bin/vat.js +95 -28
- package/dist/bin/vat.js.map +1 -1
- package/dist/bin.js +137 -76
- package/dist/bin.js.map +1 -1
- package/dist/command-loaders.d.ts +44 -0
- package/dist/command-loaders.d.ts.map +1 -0
- package/dist/command-loaders.js +60 -0
- package/dist/command-loaders.js.map +1 -0
- package/dist/commands/agent/build.d.ts.map +1 -1
- package/dist/commands/agent/build.js +2 -1
- package/dist/commands/agent/build.js.map +1 -1
- package/dist/commands/agent/import.d.ts.map +1 -1
- package/dist/commands/agent/import.js +3 -2
- package/dist/commands/agent/import.js.map +1 -1
- package/dist/commands/agent/index.js +1 -1
- package/dist/commands/agent/install-path.d.ts +36 -0
- package/dist/commands/agent/install-path.d.ts.map +1 -0
- package/dist/commands/agent/install-path.js +44 -0
- package/dist/commands/agent/install-path.js.map +1 -0
- package/dist/commands/agent/install.d.ts.map +1 -1
- package/dist/commands/agent/install.js +66 -13
- package/dist/commands/agent/install.js.map +1 -1
- package/dist/commands/agent/installed.d.ts.map +1 -1
- package/dist/commands/agent/installed.js +22 -12
- package/dist/commands/agent/installed.js.map +1 -1
- package/dist/commands/agent/list.d.ts.map +1 -1
- package/dist/commands/agent/list.js +2 -1
- package/dist/commands/agent/list.js.map +1 -1
- package/dist/commands/agent/run.d.ts.map +1 -1
- package/dist/commands/agent/run.js +2 -1
- package/dist/commands/agent/run.js.map +1 -1
- package/dist/commands/agent/uninstall.d.ts.map +1 -1
- package/dist/commands/agent/uninstall.js +13 -6
- package/dist/commands/agent/uninstall.js.map +1 -1
- package/dist/commands/agent/validate.d.ts.map +1 -1
- package/dist/commands/agent/validate.js +3 -2
- package/dist/commands/agent/validate.js.map +1 -1
- package/dist/commands/ard/emit.d.ts +153 -0
- package/dist/commands/ard/emit.d.ts.map +1 -0
- package/dist/commands/ard/emit.js +276 -0
- package/dist/commands/ard/emit.js.map +1 -0
- package/dist/commands/ard/index.d.ts +12 -0
- package/dist/commands/ard/index.d.ts.map +1 -0
- package/dist/commands/ard/index.js +80 -0
- package/dist/commands/ard/index.js.map +1 -0
- package/dist/commands/ard/surfaces.d.ts +56 -0
- package/dist/commands/ard/surfaces.d.ts.map +1 -0
- package/dist/commands/ard/surfaces.js +150 -0
- package/dist/commands/ard/surfaces.js.map +1 -0
- package/dist/commands/audit/distributed-tree.d.ts +60 -2
- package/dist/commands/audit/distributed-tree.d.ts.map +1 -1
- package/dist/commands/audit/distributed-tree.js +73 -1
- package/dist/commands/audit/distributed-tree.js.map +1 -1
- package/dist/commands/audit/git-url-clone.d.ts +1 -1
- package/dist/commands/audit/git-url-clone.d.ts.map +1 -1
- package/dist/commands/audit/git-url-clone.js.map +1 -1
- package/dist/commands/audit/hierarchical-output.d.ts +1 -1
- package/dist/commands/audit/hierarchical-output.d.ts.map +1 -1
- package/dist/commands/audit/hierarchical-output.js +1 -1
- package/dist/commands/audit/hierarchical-output.js.map +1 -1
- package/dist/commands/audit/provenance.d.ts.map +1 -1
- package/dist/commands/audit/provenance.js +4 -3
- package/dist/commands/audit/provenance.js.map +1 -1
- package/dist/commands/audit/scan-population.d.ts +158 -0
- package/dist/commands/audit/scan-population.d.ts.map +1 -0
- package/dist/commands/audit/scan-population.js +292 -0
- package/dist/commands/audit/scan-population.js.map +1 -0
- package/dist/commands/audit-settings.d.ts.map +1 -1
- package/dist/commands/audit-settings.js +6 -5
- package/dist/commands/audit-settings.js.map +1 -1
- package/dist/commands/audit.d.ts +98 -8
- package/dist/commands/audit.d.ts.map +1 -1
- package/dist/commands/audit.js +1133 -395
- package/dist/commands/audit.js.map +1 -1
- package/dist/commands/build.d.ts +1 -1
- package/dist/commands/build.d.ts.map +1 -1
- package/dist/commands/build.js +40 -36
- package/dist/commands/build.js.map +1 -1
- package/dist/commands/cache/cache-control.d.ts +82 -0
- package/dist/commands/cache/cache-control.d.ts.map +1 -0
- package/dist/commands/cache/cache-control.js +86 -0
- package/dist/commands/cache/cache-control.js.map +1 -0
- package/dist/commands/cache/clear.d.ts +105 -0
- package/dist/commands/cache/clear.d.ts.map +1 -0
- package/dist/commands/cache/clear.js +248 -0
- package/dist/commands/cache/clear.js.map +1 -0
- package/dist/commands/cache/index.d.ts +18 -0
- package/dist/commands/cache/index.d.ts.map +1 -0
- package/dist/commands/cache/index.js +94 -0
- package/dist/commands/cache/index.js.map +1 -0
- package/dist/commands/claude/claude-config.d.ts.map +1 -1
- package/dist/commands/claude/claude-config.js +6 -0
- package/dist/commands/claude/claude-config.js.map +1 -1
- package/dist/commands/claude/context.d.ts +340 -0
- package/dist/commands/claude/context.d.ts.map +1 -0
- package/dist/commands/claude/context.js +1080 -0
- package/dist/commands/claude/context.js.map +1 -0
- package/dist/commands/claude/index.d.ts +14 -0
- package/dist/commands/claude/index.d.ts.map +1 -1
- package/dist/commands/claude/index.js +22 -2
- package/dist/commands/claude/index.js.map +1 -1
- package/dist/commands/claude/marketplace/changelog-utils.d.ts +1 -1
- package/dist/commands/claude/marketplace/changelog-utils.d.ts.map +1 -1
- package/dist/commands/claude/marketplace/changelog-utils.js +1 -2
- package/dist/commands/claude/marketplace/changelog-utils.js.map +1 -1
- package/dist/commands/claude/marketplace/git-publish.d.ts.map +1 -1
- package/dist/commands/claude/marketplace/git-publish.js +40 -31
- package/dist/commands/claude/marketplace/git-publish.js.map +1 -1
- package/dist/commands/claude/marketplace/license-utils.d.ts.map +1 -1
- package/dist/commands/claude/marketplace/license-utils.js +0 -1
- package/dist/commands/claude/marketplace/license-utils.js.map +1 -1
- package/dist/commands/claude/marketplace/publish-tree.d.ts.map +1 -1
- package/dist/commands/claude/marketplace/publish-tree.js +0 -6
- package/dist/commands/claude/marketplace/publish-tree.js.map +1 -1
- package/dist/commands/claude/marketplace/publish.d.ts.map +1 -1
- package/dist/commands/claude/marketplace/publish.js +2 -1
- package/dist/commands/claude/marketplace/publish.js.map +1 -1
- package/dist/commands/claude/marketplace/validate.d.ts +73 -22
- package/dist/commands/claude/marketplace/validate.d.ts.map +1 -1
- package/dist/commands/claude/marketplace/validate.js +407 -72
- package/dist/commands/claude/marketplace/validate.js.map +1 -1
- package/dist/commands/claude/org/api-keys.d.ts +0 -3
- package/dist/commands/claude/org/api-keys.d.ts.map +1 -1
- package/dist/commands/claude/org/api-keys.js +2 -1
- package/dist/commands/claude/org/api-keys.js.map +1 -1
- package/dist/commands/claude/org/helpers.d.ts +54 -1
- package/dist/commands/claude/org/helpers.d.ts.map +1 -1
- package/dist/commands/claude/org/helpers.js +42 -7
- package/dist/commands/claude/org/helpers.js.map +1 -1
- package/dist/commands/claude/org/index.d.ts.map +1 -1
- package/dist/commands/claude/org/index.js +24 -16
- package/dist/commands/claude/org/index.js.map +1 -1
- package/dist/commands/claude/org/invites.d.ts +0 -3
- package/dist/commands/claude/org/invites.d.ts.map +1 -1
- package/dist/commands/claude/org/invites.js +3 -2
- package/dist/commands/claude/org/invites.js.map +1 -1
- package/dist/commands/claude/org/skills.d.ts +527 -0
- package/dist/commands/claude/org/skills.d.ts.map +1 -1
- package/dist/commands/claude/org/skills.js +1414 -108
- package/dist/commands/claude/org/skills.js.map +1 -1
- package/dist/commands/claude/org/users.d.ts +0 -3
- package/dist/commands/claude/org/users.d.ts.map +1 -1
- package/dist/commands/claude/org/users.js +6 -3
- package/dist/commands/claude/org/users.js.map +1 -1
- package/dist/commands/claude/org/workspaces.d.ts +0 -3
- package/dist/commands/claude/org/workspaces.d.ts.map +1 -1
- package/dist/commands/claude/org/workspaces.js +11 -7
- package/dist/commands/claude/org/workspaces.js.map +1 -1
- package/dist/commands/claude/plugin/build.d.ts +41 -3
- package/dist/commands/claude/plugin/build.d.ts.map +1 -1
- package/dist/commands/claude/plugin/build.js +147 -80
- package/dist/commands/claude/plugin/build.js.map +1 -1
- package/dist/commands/claude/plugin/helpers.d.ts.map +1 -1
- package/dist/commands/claude/plugin/helpers.js +2 -7
- package/dist/commands/claude/plugin/helpers.js.map +1 -1
- package/dist/commands/claude/plugin/install.d.ts +12 -0
- package/dist/commands/claude/plugin/install.d.ts.map +1 -1
- package/dist/commands/claude/plugin/install.js +93 -62
- package/dist/commands/claude/plugin/install.js.map +1 -1
- package/dist/commands/claude/plugin/list.d.ts.map +1 -1
- package/dist/commands/claude/plugin/list.js +3 -2
- package/dist/commands/claude/plugin/list.js.map +1 -1
- package/dist/commands/claude/plugin/marketplace-json.d.ts +24 -9
- package/dist/commands/claude/plugin/marketplace-json.d.ts.map +1 -1
- package/dist/commands/claude/plugin/marketplace-json.js +10 -9
- package/dist/commands/claude/plugin/marketplace-json.js.map +1 -1
- package/dist/commands/claude/plugin/plugin-changelog.d.ts.map +1 -1
- package/dist/commands/claude/plugin/plugin-changelog.js +0 -2
- package/dist/commands/claude/plugin/plugin-changelog.js.map +1 -1
- package/dist/commands/claude/plugin/plugin-files.d.ts.map +1 -1
- package/dist/commands/claude/plugin/plugin-files.js +3 -6
- package/dist/commands/claude/plugin/plugin-files.js.map +1 -1
- package/dist/commands/claude/plugin/plugin-validators.d.ts.map +1 -1
- package/dist/commands/claude/plugin/plugin-validators.js +3 -6
- package/dist/commands/claude/plugin/plugin-validators.js.map +1 -1
- package/dist/commands/claude/plugin/tree-copy.d.ts +73 -0
- package/dist/commands/claude/plugin/tree-copy.d.ts.map +1 -1
- package/dist/commands/claude/plugin/tree-copy.js +221 -14
- package/dist/commands/claude/plugin/tree-copy.js.map +1 -1
- package/dist/commands/claude/plugin/uninstall.d.ts.map +1 -1
- package/dist/commands/claude/plugin/uninstall.js +4 -4
- package/dist/commands/claude/plugin/uninstall.js.map +1 -1
- package/dist/commands/consistency-check.d.ts +17 -15
- package/dist/commands/consistency-check.d.ts.map +1 -1
- package/dist/commands/consistency-check.js +152 -106
- package/dist/commands/consistency-check.js.map +1 -1
- package/dist/commands/corpus/index.d.ts.map +1 -1
- package/dist/commands/corpus/index.js +3 -0
- package/dist/commands/corpus/index.js.map +1 -1
- package/dist/commands/corpus/report.d.ts +1 -2
- package/dist/commands/corpus/report.d.ts.map +1 -1
- package/dist/commands/corpus/report.js +1 -3
- package/dist/commands/corpus/report.js.map +1 -1
- package/dist/commands/corpus/runner.d.ts +58 -1
- package/dist/commands/corpus/runner.d.ts.map +1 -1
- package/dist/commands/corpus/runner.js +95 -41
- package/dist/commands/corpus/runner.js.map +1 -1
- package/dist/commands/corpus/scan.d.ts.map +1 -1
- package/dist/commands/corpus/scan.js +20 -12
- package/dist/commands/corpus/scan.js.map +1 -1
- package/dist/commands/corpus/seed.d.ts +4 -4
- package/dist/commands/corpus/seed.d.ts.map +1 -1
- package/dist/commands/corpus/seed.js +1 -3
- package/dist/commands/corpus/seed.js.map +1 -1
- package/dist/commands/doctor.d.ts +50 -0
- package/dist/commands/doctor.d.ts.map +1 -1
- package/dist/commands/doctor.js +245 -52
- package/dist/commands/doctor.js.map +1 -1
- package/dist/commands/inventory.d.ts +13 -1
- package/dist/commands/inventory.d.ts.map +1 -1
- package/dist/commands/inventory.js +128 -17
- package/dist/commands/inventory.js.map +1 -1
- package/dist/commands/mcp/collections.d.ts +1 -1
- package/dist/commands/mcp/collections.d.ts.map +1 -1
- package/dist/commands/mcp/list-collections.d.ts.map +1 -1
- package/dist/commands/mcp/list-collections.js +2 -1
- package/dist/commands/mcp/list-collections.js.map +1 -1
- package/dist/commands/mcp/serve.d.ts.map +1 -1
- package/dist/commands/mcp/serve.js +3 -2
- package/dist/commands/mcp/serve.js.map +1 -1
- package/dist/commands/okf/index.d.ts +11 -0
- package/dist/commands/okf/index.d.ts.map +1 -0
- package/dist/commands/okf/index.js +114 -0
- package/dist/commands/okf/index.js.map +1 -0
- package/dist/commands/okf/validate.d.ts +191 -0
- package/dist/commands/okf/validate.d.ts.map +1 -0
- package/dist/commands/okf/validate.js +190 -0
- package/dist/commands/okf/validate.js.map +1 -0
- package/dist/commands/phase-utils.d.ts +182 -114
- package/dist/commands/phase-utils.d.ts.map +1 -1
- package/dist/commands/phase-utils.js +154 -163
- package/dist/commands/phase-utils.js.map +1 -1
- package/dist/commands/positional-args.d.ts.map +1 -1
- package/dist/commands/positional-args.js +3 -2
- package/dist/commands/positional-args.js.map +1 -1
- package/dist/commands/rag/clear-command.d.ts.map +1 -1
- package/dist/commands/rag/clear-command.js +2 -1
- package/dist/commands/rag/clear-command.js.map +1 -1
- package/dist/commands/rag/index-command.d.ts +64 -0
- package/dist/commands/rag/index-command.d.ts.map +1 -1
- package/dist/commands/rag/index-command.js +72 -6
- package/dist/commands/rag/index-command.js.map +1 -1
- package/dist/commands/rag/index.d.ts.map +1 -1
- package/dist/commands/rag/index.js +23 -10
- package/dist/commands/rag/index.js.map +1 -1
- package/dist/commands/rag/query-command.d.ts.map +1 -1
- package/dist/commands/rag/query-command.js +2 -1
- package/dist/commands/rag/query-command.js.map +1 -1
- package/dist/commands/rag/stats-command.d.ts.map +1 -1
- package/dist/commands/rag/stats-command.js +2 -1
- package/dist/commands/rag/stats-command.js.map +1 -1
- package/dist/commands/resources/builtin-help.d.ts +27 -0
- package/dist/commands/resources/builtin-help.d.ts.map +1 -0
- package/dist/commands/resources/builtin-help.js +46 -0
- package/dist/commands/resources/builtin-help.js.map +1 -0
- package/dist/commands/resources/check-progress.d.ts +154 -0
- package/dist/commands/resources/check-progress.d.ts.map +1 -0
- package/dist/commands/resources/check-progress.js +222 -0
- package/dist/commands/resources/check-progress.js.map +1 -0
- package/dist/commands/resources/check-supervisor.d.ts +465 -0
- package/dist/commands/resources/check-supervisor.d.ts.map +1 -0
- package/dist/commands/resources/check-supervisor.js +573 -0
- package/dist/commands/resources/check-supervisor.js.map +1 -0
- package/dist/commands/resources/check.d.ts +593 -0
- package/dist/commands/resources/check.d.ts.map +1 -0
- package/dist/commands/resources/check.js +1365 -0
- package/dist/commands/resources/check.js.map +1 -0
- package/dist/commands/resources/index.d.ts.map +1 -1
- package/dist/commands/resources/index.js +425 -6
- package/dist/commands/resources/index.js.map +1 -1
- package/dist/commands/resources/query.d.ts +106 -0
- package/dist/commands/resources/query.d.ts.map +1 -0
- package/dist/commands/resources/query.js +177 -0
- package/dist/commands/resources/query.js.map +1 -0
- package/dist/commands/resources/scan.d.ts +24 -0
- package/dist/commands/resources/scan.d.ts.map +1 -1
- package/dist/commands/resources/scan.js +17 -8
- package/dist/commands/resources/scan.js.map +1 -1
- package/dist/commands/resources/validate.d.ts +57 -4
- package/dist/commands/resources/validate.d.ts.map +1 -1
- package/dist/commands/resources/validate.js +224 -56
- package/dist/commands/resources/validate.js.map +1 -1
- package/dist/commands/skill/review-checklist.d.ts +3 -2
- package/dist/commands/skill/review-checklist.d.ts.map +1 -1
- package/dist/commands/skill/review-checklist.js +40 -2
- package/dist/commands/skill/review-checklist.js.map +1 -1
- package/dist/commands/skill/review.d.ts +247 -0
- package/dist/commands/skill/review.d.ts.map +1 -1
- package/dist/commands/skill/review.js +99 -62
- package/dist/commands/skill/review.js.map +1 -1
- package/dist/commands/skill/test/configure.d.ts +56 -0
- package/dist/commands/skill/test/configure.d.ts.map +1 -1
- package/dist/commands/skill/test/configure.js +75 -16
- package/dist/commands/skill/test/configure.js.map +1 -1
- package/dist/commands/skill/test/run.d.ts +63 -10
- package/dist/commands/skill/test/run.d.ts.map +1 -1
- package/dist/commands/skill/test/run.js +258 -77
- package/dist/commands/skill/test/run.js.map +1 -1
- package/dist/commands/skills/build.d.ts +94 -4
- package/dist/commands/skills/build.d.ts.map +1 -1
- package/dist/commands/skills/build.js +325 -97
- package/dist/commands/skills/build.js.map +1 -1
- package/dist/commands/skills/install.d.ts +2 -1
- package/dist/commands/skills/install.d.ts.map +1 -1
- package/dist/commands/skills/install.js +20 -31
- package/dist/commands/skills/install.js.map +1 -1
- package/dist/commands/skills/list.d.ts +2 -1
- package/dist/commands/skills/list.d.ts.map +1 -1
- package/dist/commands/skills/list.js +44 -26
- package/dist/commands/skills/list.js.map +1 -1
- package/dist/commands/skills/package.d.ts +24 -3
- package/dist/commands/skills/package.d.ts.map +1 -1
- package/dist/commands/skills/package.js +42 -17
- package/dist/commands/skills/package.js.map +1 -1
- package/dist/commands/skills/scope-guard.d.ts.map +1 -1
- package/dist/commands/skills/scope-guard.js +3 -5
- package/dist/commands/skills/scope-guard.js.map +1 -1
- package/dist/commands/skills/shared.d.ts.map +1 -1
- package/dist/commands/skills/shared.js +2 -4
- package/dist/commands/skills/shared.js.map +1 -1
- package/dist/commands/skills/skill-discovery.d.ts +47 -6
- package/dist/commands/skills/skill-discovery.d.ts.map +1 -1
- package/dist/commands/skills/skill-discovery.js +66 -16
- package/dist/commands/skills/skill-discovery.js.map +1 -1
- package/dist/commands/skills/source-resolvers.d.ts +15 -0
- package/dist/commands/skills/source-resolvers.d.ts.map +1 -1
- package/dist/commands/skills/source-resolvers.js +25 -4
- package/dist/commands/skills/source-resolvers.js.map +1 -1
- package/dist/commands/skills/validate-command.d.ts.map +1 -1
- package/dist/commands/skills/validate-command.js +11 -3
- package/dist/commands/skills/validate-command.js.map +1 -1
- package/dist/commands/skills/validate.d.ts +140 -4
- package/dist/commands/skills/validate.d.ts.map +1 -1
- package/dist/commands/skills/validate.js +224 -67
- package/dist/commands/skills/validate.js.map +1 -1
- package/dist/commands/validate.d.ts +1 -1
- package/dist/commands/validate.d.ts.map +1 -1
- package/dist/commands/validate.js +63 -27
- package/dist/commands/validate.js.map +1 -1
- package/dist/commands/verify.d.ts +119 -15
- package/dist/commands/verify.d.ts.map +1 -1
- package/dist/commands/verify.js +357 -142
- package/dist/commands/verify.js.map +1 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -1
- package/dist/index.js.map +1 -1
- package/dist/report-schemas.d.ts +45 -0
- package/dist/report-schemas.d.ts.map +1 -0
- package/dist/report-schemas.js +100 -0
- package/dist/report-schemas.js.map +1 -0
- package/dist/skill-resolution/classify.js +2 -2
- package/dist/skill-resolution/classify.js.map +1 -1
- package/dist/skill-resolution/packaging-config.d.ts +49 -5
- package/dist/skill-resolution/packaging-config.d.ts.map +1 -1
- package/dist/skill-resolution/packaging-config.js +59 -19
- package/dist/skill-resolution/packaging-config.js.map +1 -1
- package/dist/skill-resolution/resolve-skill-reference.d.ts.map +1 -1
- package/dist/skill-resolution/resolve-skill-reference.js +55 -57
- package/dist/skill-resolution/resolve-skill-reference.js.map +1 -1
- package/dist/utils/agent-discovery.d.ts.map +1 -1
- package/dist/utils/agent-discovery.js +22 -11
- package/dist/utils/agent-discovery.js.map +1 -1
- package/dist/utils/agent-runner.d.ts.map +1 -1
- package/dist/utils/agent-runner.js +7 -4
- package/dist/utils/agent-runner.js.map +1 -1
- package/dist/utils/claude-context-lens.d.ts +34 -0
- package/dist/utils/claude-context-lens.d.ts.map +1 -0
- package/dist/utils/claude-context-lens.js +39 -0
- package/dist/utils/claude-context-lens.js.map +1 -0
- package/dist/utils/command-error.d.ts +144 -7
- package/dist/utils/command-error.d.ts.map +1 -1
- package/dist/utils/command-error.js +179 -16
- package/dist/utils/command-error.js.map +1 -1
- package/dist/utils/config-loader.d.ts +2 -1
- package/dist/utils/config-loader.d.ts.map +1 -1
- package/dist/utils/config-loader.js +40 -14
- package/dist/utils/config-loader.js.map +1 -1
- package/dist/utils/corpus-target.d.ts +26 -0
- package/dist/utils/corpus-target.d.ts.map +1 -0
- package/dist/utils/corpus-target.js +35 -0
- package/dist/utils/corpus-target.js.map +1 -0
- package/dist/utils/edge-lens-evaluation.d.ts +83 -0
- package/dist/utils/edge-lens-evaluation.d.ts.map +1 -0
- package/dist/utils/edge-lens-evaluation.js +110 -0
- package/dist/utils/edge-lens-evaluation.js.map +1 -0
- package/dist/utils/help-loader.d.ts.map +1 -1
- package/dist/utils/help-loader.js +0 -1
- package/dist/utils/help-loader.js.map +1 -1
- package/dist/utils/issue-anchor.d.ts +2 -2
- package/dist/utils/issue-anchor.d.ts.map +1 -1
- package/dist/utils/issue-anchor.js +1 -1
- package/dist/utils/issue-rendering.d.ts +3 -3
- package/dist/utils/issue-rendering.d.ts.map +1 -1
- package/dist/utils/issue-rendering.js +3 -3
- package/dist/utils/issue-rendering.js.map +1 -1
- package/dist/utils/issue-severity.d.ts +12 -5
- package/dist/utils/issue-severity.d.ts.map +1 -1
- package/dist/utils/issue-severity.js +1 -1
- package/dist/utils/issue-severity.js.map +1 -1
- package/dist/utils/optional-backend.d.ts +78 -0
- package/dist/utils/optional-backend.d.ts.map +1 -0
- package/dist/utils/optional-backend.js +117 -0
- package/dist/utils/optional-backend.js.map +1 -0
- package/dist/utils/output.d.ts +26 -0
- package/dist/utils/output.d.ts.map +1 -1
- package/dist/utils/output.js +35 -0
- package/dist/utils/output.js.map +1 -1
- package/dist/utils/package-json.d.ts +24 -0
- package/dist/utils/package-json.d.ts.map +1 -0
- package/dist/utils/package-json.js +49 -0
- package/dist/utils/package-json.js.map +1 -0
- package/dist/utils/population-wiring.d.ts +100 -0
- package/dist/utils/population-wiring.d.ts.map +1 -0
- package/dist/utils/population-wiring.js +98 -0
- package/dist/utils/population-wiring.js.map +1 -0
- package/dist/utils/project-root-policy.d.ts +20 -0
- package/dist/utils/project-root-policy.d.ts.map +1 -1
- package/dist/utils/project-root-policy.js +30 -0
- package/dist/utils/project-root-policy.js.map +1 -1
- package/dist/utils/projection-lenses.d.ts +98 -0
- package/dist/utils/projection-lenses.d.ts.map +1 -0
- package/dist/utils/projection-lenses.js +203 -0
- package/dist/utils/projection-lenses.js.map +1 -0
- package/dist/utils/projection-query.d.ts +324 -0
- package/dist/utils/projection-query.d.ts.map +1 -0
- package/dist/utils/projection-query.js +357 -0
- package/dist/utils/projection-query.js.map +1 -0
- package/dist/utils/projection-store.d.ts +335 -0
- package/dist/utils/projection-store.d.ts.map +1 -0
- package/dist/utils/projection-store.js +522 -0
- package/dist/utils/projection-store.js.map +1 -0
- package/dist/utils/relation-limits.d.ts +50 -0
- package/dist/utils/relation-limits.d.ts.map +1 -0
- package/dist/utils/relation-limits.js +50 -0
- package/dist/utils/relation-limits.js.map +1 -0
- package/dist/utils/repeatable-option.d.ts +37 -0
- package/dist/utils/repeatable-option.d.ts.map +1 -0
- package/dist/utils/repeatable-option.js +39 -0
- package/dist/utils/repeatable-option.js.map +1 -0
- package/dist/utils/resource-loader.d.ts +132 -2
- package/dist/utils/resource-loader.d.ts.map +1 -1
- package/dist/utils/resource-loader.js +288 -27
- package/dist/utils/resource-loader.js.map +1 -1
- package/dist/utils/root-argv.d.ts +53 -0
- package/dist/utils/root-argv.d.ts.map +1 -0
- package/dist/utils/root-argv.js +215 -0
- package/dist/utils/root-argv.js.map +1 -0
- package/dist/utils/run-integrity.d.ts +95 -0
- package/dist/utils/run-integrity.d.ts.map +1 -0
- package/dist/utils/run-integrity.js +102 -0
- package/dist/utils/run-integrity.js.map +1 -0
- package/dist/utils/skill-discovery.d.ts.map +1 -1
- package/dist/utils/skill-discovery.js +2 -1
- package/dist/utils/skill-discovery.js.map +1 -1
- package/dist/utils/skill-packaging-config.d.ts +63 -1
- package/dist/utils/skill-packaging-config.d.ts.map +1 -1
- package/dist/utils/skill-packaging-config.js +56 -1
- package/dist/utils/skill-packaging-config.js.map +1 -1
- package/dist/utils/sqlite-experimental-warning.d.ts +69 -0
- package/dist/utils/sqlite-experimental-warning.d.ts.map +1 -0
- package/dist/utils/sqlite-experimental-warning.js +144 -0
- package/dist/utils/sqlite-experimental-warning.js.map +1 -0
- package/dist/utils/url-redact.d.ts.map +1 -1
- package/dist/utils/url-redact.js +4 -6
- package/dist/utils/url-redact.js.map +1 -1
- package/dist/utils/user-context-scanner.d.ts +8 -0
- package/dist/utils/user-context-scanner.d.ts.map +1 -1
- package/dist/utils/user-context-scanner.js +4 -2
- package/dist/utils/user-context-scanner.js.map +1 -1
- package/dist/utils/validate-help-files.d.ts.map +1 -1
- package/dist/utils/validate-help-files.js +12 -6
- package/dist/utils/validate-help-files.js.map +1 -1
- package/dist/utils/vat-bin-path.d.ts +36 -0
- package/dist/utils/vat-bin-path.d.ts.map +1 -0
- package/dist/utils/vat-bin-path.js +48 -0
- package/dist/utils/vat-bin-path.js.map +1 -0
- package/dist/utils/verdict-helpers.d.ts +1 -1
- package/dist/utils/verdict-helpers.d.ts.map +1 -1
- package/dist/utils/verdict-helpers.js +1 -1
- package/dist/utils/verdict-helpers.js.map +1 -1
- package/dist/version.d.ts.map +1 -1
- package/dist/version.js +1 -3
- package/dist/version.js.map +1 -1
- package/docs/agent.md +2 -2
- package/docs/audit.md +141 -37
- package/docs/doctor.md +7 -6
- package/docs/index.md +40 -12
- package/docs/mcp.md +2 -2
- package/docs/rag.md +3 -2
- package/docs/resources.md +13 -3
- package/docs/skill-test.md +10 -9
- package/docs/skills.md +53 -69
- package/package.json +38 -27
- package/schemas/ard-emit.json +149 -0
- package/schemas/okf-validate.json +170 -0
- package/schemas/resources-check.json +229 -0
- package/schemas/skill-review.json +230 -0
- package/dist/commands/resources/command-helpers.d.ts +0 -5
- package/dist/commands/resources/command-helpers.d.ts.map +0 -1
- package/dist/commands/resources/command-helpers.js +0 -6
- package/dist/commands/resources/command-helpers.js.map +0 -1
|
@@ -0,0 +1,1080 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `vat claude context [path]` — what loads into an agent's context here, and
|
|
3
|
+
* what it costs.
|
|
4
|
+
*
|
|
5
|
+
* The first ANALYSIS verb under `vat claude`, which until now held only
|
|
6
|
+
* management verbs (plugins, marketplaces, org administration). It answers a
|
|
7
|
+
* question, changes nothing, and never gates: there is no threshold anywhere in
|
|
8
|
+
* this file, and the only non-zero exit is {@link handleCommandError}'s 2 for a
|
|
9
|
+
* system failure. A number that fails a build teaches people to stop reading it.
|
|
10
|
+
*
|
|
11
|
+
* ## Everything below is orchestration and formatting — deliberately
|
|
12
|
+
*
|
|
13
|
+
* Which files load, why, and what they cost are all decided in
|
|
14
|
+
* `@vibe-agent-toolkit/resources` (`whatLoadsAt` and `account`). This module
|
|
15
|
+
* populates, calls them, and renders. It computes nothing about context loading
|
|
16
|
+
* of its own, which is the CLI-stays-dumb rule applied to a lane where the
|
|
17
|
+
* temptation is strong: the totals are right there and a "just one more derived
|
|
18
|
+
* field" would put a second, unowned model of the vendor's behaviour in the
|
|
19
|
+
* package no other package can depend on.
|
|
20
|
+
*
|
|
21
|
+
* ## The limits ride WITH the run — ONCE — in every format
|
|
22
|
+
*
|
|
23
|
+
* Spec §11 puts the stated limits in the command's own output rather than in a
|
|
24
|
+
* doc, because a limit a reader has to go and find is a limit that never reaches
|
|
25
|
+
* the person acting on the number. So {@link CLAUDE_CONTEXT_LIMITS} and
|
|
26
|
+
* {@link CLAUDE_CONTEXT_MODELLED_BEHAVIOURS} are fields of the yaml/json
|
|
27
|
+
* ENVELOPE and a printed section of the text rendering, and
|
|
28
|
+
* {@link CLAUDE_CONTEXT_BOUNDS_STATEMENT} — *neither a floor nor a ceiling* —
|
|
29
|
+
* appears in all three. All three are imported, never restated: the sentence is
|
|
30
|
+
* domain content owned beside the list it frames, so every other consumer of the
|
|
31
|
+
* list reaches it too.
|
|
32
|
+
*
|
|
33
|
+
* ⛔ They belong to the ENVELOPE, never to an answer or a region, and every
|
|
34
|
+
* rendering obeys that identically — see {@link ContextEnvelope} for why.
|
|
35
|
+
* Attaching them per answer was not a formatting preference: on the whole-tree
|
|
36
|
+
* sweep `--all` used to be (6,224 answers on this repository) `--format json`
|
|
37
|
+
* measured 76,877,016 bytes and measures 6,581,468 with the block hoisted — 70.3
|
|
38
|
+
* MB of ONE byte-identical paragraph, repeated. That is the JSON spelling of the
|
|
39
|
+
* very burial {@link renderEnvelopeText} refuses to do in text, and it is why
|
|
40
|
+
* {@link ContextCostMapEnvelope} hoists the same block rather than growing one
|
|
41
|
+
* per region.
|
|
42
|
+
*
|
|
43
|
+
* ## `--all` is a MAP, not a sweep
|
|
44
|
+
*
|
|
45
|
+
* ⛔ `--all` emits no per-path documents in any format. It used to answer for
|
|
46
|
+
* every realized path — 10,438 documents and 205,918 lines on a large adopter
|
|
47
|
+
* monorepo, ~491 s — which is not a report anyone reads. It now emits the
|
|
48
|
+
* whole-tree cost map {@link buildContextCostMap} builds, which answers the
|
|
49
|
+
* question the flag exists for: where in this tree is it expensive to work.
|
|
50
|
+
* Naming paths is the drill-down, and is the only way to get a per-path answer.
|
|
51
|
+
*
|
|
52
|
+
* ⛔ Nothing here may read as "complete". Many of the stated limits are signed
|
|
53
|
+
* `over-report`/`under-report` and apply whether or not `unknownTokenRows`,
|
|
54
|
+
* `skippedOversizeRows` and `prunedRows` are all zero, so zeroed counters are not
|
|
55
|
+
* a licence for the words "total cost", "full" or "all context".
|
|
56
|
+
*
|
|
57
|
+
* ⛔ A `null` token or byte count is an UNKNOWN SIZE and is never rendered as 0 —
|
|
58
|
+
* see {@link chargeText}. A confident zero is indistinguishable from a measured
|
|
59
|
+
* one, and the same reasoning is why an unrealized path answers `unknown` rather
|
|
60
|
+
* than an empty table.
|
|
61
|
+
*/
|
|
62
|
+
import { account, buildClaudeContextPopulation, buildContextCostMap, CLAUDE_CONTEXT_BOUNDS_STATEMENT, CLAUDE_CONTEXT_LIMITS, CLAUDE_CONTEXT_MODELLED_BEHAVIOURS, CLAUDE_MD_TAG, discoverableFrom, whatLoadsAt, } from '@vibe-agent-toolkit/resources';
|
|
63
|
+
import { ExitCode } from '@vibe-agent-toolkit/schema';
|
|
64
|
+
import { findProjectRoot } from '@vibe-agent-toolkit/utils';
|
|
65
|
+
import { Command, Option } from 'commander';
|
|
66
|
+
import { handleCommandError } from '../../utils/command-error.js';
|
|
67
|
+
import { targetPathWithin } from '../../utils/corpus-target.js';
|
|
68
|
+
import { createLogger } from '../../utils/logger.js';
|
|
69
|
+
import { writeJsonOutput, writeStdoutSync, writeYamlOutput } from '../../utils/output.js';
|
|
70
|
+
import { populationWiring } from '../../utils/population-wiring.js';
|
|
71
|
+
import { withPopulationCache } from '../../utils/projection-store.js';
|
|
72
|
+
import { gitTrackerForProjectRoot } from '../audit/distributed-tree.js';
|
|
73
|
+
/** Soft wrap width for the printed limit statements. */
|
|
74
|
+
const WRAP_COLUMNS = 96;
|
|
75
|
+
/** How this command names itself in a refusal. */
|
|
76
|
+
const COMMAND_NAME = 'vat claude context';
|
|
77
|
+
/**
|
|
78
|
+
* How many rows each RANKED section of the `--all` cost map prints.
|
|
79
|
+
*
|
|
80
|
+
* ⛔ A cap exists because the previous shape of `--all` had none: it answered for
|
|
81
|
+
* every realized path, which on a large adopter monorepo was 10,438 documents and
|
|
82
|
+
* 205,918 lines — an output nobody, human or agent, can act on. The map collapses
|
|
83
|
+
* that to two ranked lists, and a ranked list is only useful if its head is
|
|
84
|
+
* readable in one screen. 20 is that head: enough that a real hot spot is
|
|
85
|
+
* somewhere in it, few enough that the whole report stays scannable.
|
|
86
|
+
*
|
|
87
|
+
* ⛔ It bounds the TEXT rendering ONLY. `--format json` carries the map whole —
|
|
88
|
+
* see {@link ContextCostMapEnvelope} — because a program asked for the map, not
|
|
89
|
+
* for a summary of it, and a silently-truncated array is a defect a consumer
|
|
90
|
+
* cannot see.
|
|
91
|
+
*
|
|
92
|
+
* ⛔ Whenever it fires, {@link omittedNotice} says how many rows were left out. A
|
|
93
|
+
* silent cap reads as "this is everything", which is the one thing this report
|
|
94
|
+
* must never say. Exported so a test pins the notice's arithmetic against the
|
|
95
|
+
* same number the renderer slices at, rather than against a literal that is free
|
|
96
|
+
* to disagree with it.
|
|
97
|
+
*/
|
|
98
|
+
export const COST_MAP_ROW_LIMIT = 20;
|
|
99
|
+
/**
|
|
100
|
+
* What the two halves of the cost map mean, and which one is exact.
|
|
101
|
+
*
|
|
102
|
+
* Printed under the heading because the numbers are unreadable without it: a
|
|
103
|
+
* reader who takes the per-region figure for an average, or borrows a
|
|
104
|
+
* region-mate's on-demand figure, has read the report backwards. This paraphrases
|
|
105
|
+
* the contracts `RegionCost.alwaysTokens` and `DirectoryCost.onDemandTokens`
|
|
106
|
+
* state in `@vibe-agent-toolkit/resources` — it asserts nothing this module
|
|
107
|
+
* decided, and computes nothing.
|
|
108
|
+
*/
|
|
109
|
+
const COST_MAP_METHOD_STATEMENT = 'Directories are ranked by what it costs to work in them: the at-launch floor PLUS what fires'
|
|
110
|
+
+ ' on demand there, because a cheap rule under a heavy instruction chain is still an expensive'
|
|
111
|
+
+ ' place to work.'
|
|
112
|
+
+ ' Every working location in a region loads the same files at launch, so the at-launch figure is'
|
|
113
|
+
+ ' EXACT for the whole region rather than an average over it. On-demand cost is reported per'
|
|
114
|
+
+ ' DIRECTORY instead, because a path-scoped rule is admitted where some file under that'
|
|
115
|
+
+ " directory matches its globs and nowhere else — a region-mate's on-demand figure is never a"
|
|
116
|
+
+ " substitute for a directory's own. Only a FILE query is exact for path-scoped rules: name a"
|
|
117
|
+
+ ' path (vat claude context src/index.ts) to get one.';
|
|
118
|
+
/**
|
|
119
|
+
* Create the `vat claude context [path]` command.
|
|
120
|
+
*
|
|
121
|
+
* @returns The configured Commander command
|
|
122
|
+
*/
|
|
123
|
+
export function createContextCommand() {
|
|
124
|
+
const command = new Command('context');
|
|
125
|
+
command
|
|
126
|
+
.description('Report what Claude Code loads into context at a path, why, and what it costs')
|
|
127
|
+
.argument('[paths...]', 'Files or directories to answer for (default: the current directory)')
|
|
128
|
+
.addOption(new Option('--format <format>', 'Output format: text (default), yaml, or json').choices([
|
|
129
|
+
'text',
|
|
130
|
+
'yaml',
|
|
131
|
+
'json',
|
|
132
|
+
]).default('text'))
|
|
133
|
+
.option('--all', 'Report the whole-tree cost map — launch cost per region, total cost per directory —'
|
|
134
|
+
+ ' instead of answering for named paths')
|
|
135
|
+
.option('--discoverable', 'Also report what the loaded files LINK TO in one hop and the harness does not load')
|
|
136
|
+
.option('--debug', 'Verbose logging to stderr')
|
|
137
|
+
.action(claudeContextCommand)
|
|
138
|
+
.addHelpText('after', `
|
|
139
|
+
Description:
|
|
140
|
+
Report which CLAUDE.md files, .claude/rules files and @-imported files load
|
|
141
|
+
into an agent's context at a path, why each one is there, and what it costs.
|
|
142
|
+
A FILE argument is exact. A directory argument classifies each path-scoped
|
|
143
|
+
rule as ∀ (its glob covers every file there, so it is a second CLAUDE.md for
|
|
144
|
+
that directory) or ∃ (some file there matches, and the answer names it); a
|
|
145
|
+
rule no file there can match is left out rather than charged.
|
|
146
|
+
|
|
147
|
+
Several paths may be named at once. The tree is enumerated ONCE and every
|
|
148
|
+
path answered from that one population, so asking about ten paths together
|
|
149
|
+
costs what asking about one costs — not ten times it. No paths means the
|
|
150
|
+
current directory.
|
|
151
|
+
|
|
152
|
+
--all answers a different question: where in this tree is it expensive to
|
|
153
|
+
work. It reports launch cost once per REGION (every directory inheriting one
|
|
154
|
+
CLAUDE.md chain — exact for all of them, not an average) and, per DIRECTORY,
|
|
155
|
+
the TOTAL of that launch floor and what fires on demand there (a path-scoped
|
|
156
|
+
rule fires for some directories and not others, so the on-demand half is
|
|
157
|
+
never borrowed from a region-mate). Directories are ranked by that total. It
|
|
158
|
+
emits no per-path documents; name paths for those. --discoverable applies to
|
|
159
|
+
named paths only.
|
|
160
|
+
|
|
161
|
+
Output:
|
|
162
|
+
- kind: context-answers for named paths, context-cost-map for --all —
|
|
163
|
+
the two are different documents, so never guess which you hold
|
|
164
|
+
- root: the corpus root that was enumerated
|
|
165
|
+
- answers: (context-answers) one document per requested path, in the order
|
|
166
|
+
requested — always a list, even for one path, so consumers never
|
|
167
|
+
branch on count; with totals, rows, and every admitting predicate
|
|
168
|
+
- costMap: (context-cost-map) regions worst-first by launch cost, directories
|
|
169
|
+
worst-first by total cost (launch + on demand), the tree-level
|
|
170
|
+
roll-up of rows nothing could be measured for, plus the counts of
|
|
171
|
+
locations evaluated, queried, and left out for want of an answer
|
|
172
|
+
- limits: what this run deliberately does not settle, in both directions.
|
|
173
|
+
On the ENVELOPE beside root, never on an answer or a region — they
|
|
174
|
+
bound the method rather than any one path, so they are stated
|
|
175
|
+
exactly once however much was measured
|
|
176
|
+
|
|
177
|
+
Counts of rows whose size is unknown, skipped by the 4 MiB cliff, or pruned
|
|
178
|
+
behind one are reported beside every estimate and NEVER summed into it. The
|
|
179
|
+
text rendering prints the top ${COST_MAP_ROW_LIMIT} of each ranked list and says how many it
|
|
180
|
+
left out; --format json carries the map whole.
|
|
181
|
+
|
|
182
|
+
A path the projection never realized answers kind: unknown — never zero.
|
|
183
|
+
Diagnostics and blob-stage refusals go to stderr; stdout is the document.
|
|
184
|
+
|
|
185
|
+
Exit Codes:
|
|
186
|
+
0 - An answer was produced (there is no threshold and no gate)
|
|
187
|
+
1 - Invalid usage (unknown option, or an unsupported --format value)
|
|
188
|
+
2 - System error (a path outside the corpus root, unreadable tree)
|
|
189
|
+
|
|
190
|
+
Example:
|
|
191
|
+
$ vat claude context src/index.ts docs/ README.md # one scan, three answers
|
|
192
|
+
`);
|
|
193
|
+
return command;
|
|
194
|
+
}
|
|
195
|
+
/**
|
|
196
|
+
* Action handler for `vat claude context [path]`.
|
|
197
|
+
*
|
|
198
|
+
* ⛔ The two branches produce DIFFERENT documents and there is no third mode: a
|
|
199
|
+
* `--per-path` escape hatch back to the old sweep is exactly the backward
|
|
200
|
+
* compatibility shim this project forbids pre-1.0, and naming paths explicitly
|
|
201
|
+
* already gives the per-path answer — now from a population the caller pays for
|
|
202
|
+
* once instead of ten thousand times.
|
|
203
|
+
*
|
|
204
|
+
* @param pathArgs - The paths to answer for; empty means the current directory
|
|
205
|
+
* @param options - The command's flags
|
|
206
|
+
*/
|
|
207
|
+
export async function claudeContextCommand(pathArgs, options) {
|
|
208
|
+
const logger = createLogger(options.debug === true ? { debug: true } : {});
|
|
209
|
+
const startTime = Date.now();
|
|
210
|
+
const sweep = options.all === true;
|
|
211
|
+
try {
|
|
212
|
+
const root = findProjectRoot(process.cwd()) ?? process.cwd();
|
|
213
|
+
// 🔑 Every argument is resolved BEFORE the population, not inside the map.
|
|
214
|
+
// A path outside the corpus is a usage error, and finding it afterwards
|
|
215
|
+
// would charge the caller a full population — minutes on a cold cache — to
|
|
216
|
+
// be told they mistyped. `--all` has no arguments to check.
|
|
217
|
+
const requested = sweep ? [] : targetsWithin(root, pathArgs);
|
|
218
|
+
const projection = await populateContext(root, logger);
|
|
219
|
+
const format = options.format ?? 'text';
|
|
220
|
+
if (sweep) {
|
|
221
|
+
// Every number in the map is decided in `@vibe-agent-toolkit/resources`.
|
|
222
|
+
// This branch calls one function and formats what it returns.
|
|
223
|
+
const map = buildContextCostMap(projection);
|
|
224
|
+
emit(costMapEnvelope(root, map), renderCostMapText(map), format);
|
|
225
|
+
}
|
|
226
|
+
else {
|
|
227
|
+
// ONE population, N queries. `whatLoadsAt` is a pure read of materialised
|
|
228
|
+
// tables, so the marginal cost of another path is a map lookup — which is
|
|
229
|
+
// the whole reason this command takes a list rather than being run twice.
|
|
230
|
+
const answers = requested.map((target) => documentFor(target, projection, root, options.discoverable === true));
|
|
231
|
+
emit(contextEnvelope(root, answers), renderEnvelopeText(answers), format);
|
|
232
|
+
}
|
|
233
|
+
// ⛔ Always 0. There is no threshold in this command and there is not going
|
|
234
|
+
// to be one — a number that fails a build is a number people learn to stop
|
|
235
|
+
// reading. The explicit exit matches every other leaf here and guarantees the
|
|
236
|
+
// process ends rather than waiting on whatever the population left behind.
|
|
237
|
+
process.exit(ExitCode.OK);
|
|
238
|
+
}
|
|
239
|
+
catch (error) {
|
|
240
|
+
handleCommandError(error, logger, startTime, 'claude context', options.format);
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
/**
|
|
244
|
+
* The answer document for one query.
|
|
245
|
+
*
|
|
246
|
+
* Split from the handler so the handler stays a straight line: the accounting
|
|
247
|
+
* call needs the `claude-md` identity set, and threading that through the
|
|
248
|
+
* handler body put three statements between the query and its document.
|
|
249
|
+
*
|
|
250
|
+
* Returns the document alone — rendering moved to {@link renderEnvelopeText},
|
|
251
|
+
* which needs every document at once to print the limits exactly once, and the
|
|
252
|
+
* limits themselves are attached by {@link contextEnvelope}, never here.
|
|
253
|
+
*
|
|
254
|
+
* ⛔ Exported so it can be TESTED. What has to be pinned is an ABSENCE — that no
|
|
255
|
+
* limit field is on the returned document — and an absence is only observable by
|
|
256
|
+
* calling the function that would have added it.
|
|
257
|
+
*
|
|
258
|
+
* @param answer - The query's answer
|
|
259
|
+
* @param projection - The populated projection, for the `claude-md` tag rows
|
|
260
|
+
* @param discoverable - Whether to compute the one-hop reachable set
|
|
261
|
+
* @returns The answer document
|
|
262
|
+
*/
|
|
263
|
+
export function answerDocument(answer, projection, discoverable) {
|
|
264
|
+
// The cliff and root discovery read ONE vocabulary: these are the ids the
|
|
265
|
+
// shipped `classifyPath` tagged, not a second basename rule invented here.
|
|
266
|
+
const claudeMdIds = new Set(projection.resourceTags
|
|
267
|
+
.filter((tag) => tag.tag === CLAUDE_MD_TAG)
|
|
268
|
+
.map((tag) => tag.resourceId));
|
|
269
|
+
const accounted = account(answer, claudeMdIds);
|
|
270
|
+
// 🔑 `conditions`, `overBudgetRules` and `unattributedImports` live on the
|
|
271
|
+
// ORIGINAL answer — `AccountedContext` is `{rows, totals}` and nothing else.
|
|
272
|
+
// Reading them off the accounting result silently drops every warning.
|
|
273
|
+
const document = {
|
|
274
|
+
kind: 'answer',
|
|
275
|
+
input: answer.input,
|
|
276
|
+
directory: answer.directory,
|
|
277
|
+
file: answer.file,
|
|
278
|
+
totals: accounted.totals,
|
|
279
|
+
rows: accounted.rows,
|
|
280
|
+
conditions: answer.conditions,
|
|
281
|
+
overBudgetRules: answer.overBudgetRules,
|
|
282
|
+
unattributedImports: answer.unattributedImports,
|
|
283
|
+
// The ANSWER is passed, not recomputed: it is the authority for what is
|
|
284
|
+
// already loaded, and the two lenses partitioning depends on both reading
|
|
285
|
+
// one loaded set.
|
|
286
|
+
discoverable: discoverable ? discoverableFrom(projection, answer) : null,
|
|
287
|
+
};
|
|
288
|
+
return document;
|
|
289
|
+
}
|
|
290
|
+
/**
|
|
291
|
+
* Wrap the run's documents in the envelope, with the limits attached ONCE.
|
|
292
|
+
*
|
|
293
|
+
* The one place {@link CLAUDE_CONTEXT_LIMITS} and its two companions enter the
|
|
294
|
+
* machine-readable output. Keeping that a single assignment is what makes the
|
|
295
|
+
* "stated once" property structural rather than a habit: there is no per-answer
|
|
296
|
+
* site left where a copy could be reintroduced.
|
|
297
|
+
*
|
|
298
|
+
* ⛔ Exported so it can be TESTED alongside {@link answerDocument} — the
|
|
299
|
+
* regression this guards (an answer growing its own copy of the block) is a
|
|
300
|
+
* property of the two functions TOGETHER, and a test that can reach only one of
|
|
301
|
+
* them cannot see it.
|
|
302
|
+
*
|
|
303
|
+
* @param root - The corpus root that was enumerated
|
|
304
|
+
* @param answers - One document per requested path, in the order requested
|
|
305
|
+
* @returns The envelope, ready to serialize
|
|
306
|
+
*/
|
|
307
|
+
export function contextEnvelope(root, answers) {
|
|
308
|
+
return {
|
|
309
|
+
kind: 'context-answers',
|
|
310
|
+
root,
|
|
311
|
+
answers,
|
|
312
|
+
boundsStatement: CLAUDE_CONTEXT_BOUNDS_STATEMENT,
|
|
313
|
+
limits: CLAUDE_CONTEXT_LIMITS,
|
|
314
|
+
modelledBehaviours: CLAUDE_CONTEXT_MODELLED_BEHAVIOURS,
|
|
315
|
+
};
|
|
316
|
+
}
|
|
317
|
+
/**
|
|
318
|
+
* Wrap the `--all` cost map in its envelope, with the limits attached ONCE.
|
|
319
|
+
*
|
|
320
|
+
* The mirror of {@link contextEnvelope}, and deliberately its own function rather
|
|
321
|
+
* than a generic over both: the two envelopes differ in more than one field, and
|
|
322
|
+
* a shared builder taking a payload would make `kind` a parameter — which is how
|
|
323
|
+
* a discriminator stops discriminating.
|
|
324
|
+
*
|
|
325
|
+
* ⛔ Exported so a test can pin, over a many-region map, that the limit block
|
|
326
|
+
* appears exactly ONCE in the serialized document. Presence passes on a copy per
|
|
327
|
+
* region, which is the 70.3 MB defect this command already shipped once.
|
|
328
|
+
*
|
|
329
|
+
* @param root - The corpus root that was enumerated
|
|
330
|
+
* @param costMap - The whole-tree cost map, carried entire
|
|
331
|
+
* @returns The envelope, ready to serialize
|
|
332
|
+
*/
|
|
333
|
+
export function costMapEnvelope(root, costMap) {
|
|
334
|
+
return {
|
|
335
|
+
kind: 'context-cost-map',
|
|
336
|
+
root,
|
|
337
|
+
costMap,
|
|
338
|
+
boundsStatement: CLAUDE_CONTEXT_BOUNDS_STATEMENT,
|
|
339
|
+
limits: CLAUDE_CONTEXT_LIMITS,
|
|
340
|
+
modelledBehaviours: CLAUDE_CONTEXT_MODELLED_BEHAVIOURS,
|
|
341
|
+
};
|
|
342
|
+
}
|
|
343
|
+
/**
|
|
344
|
+
* Resolve every requested path, defaulting to the current directory.
|
|
345
|
+
*
|
|
346
|
+
* No arguments means the current directory — NOT the whole corpus. `--all` is
|
|
347
|
+
* the sweep, spelled explicitly, because a bare `vat claude context` answering
|
|
348
|
+
* for thousands of paths would turn the friendliest invocation into the most
|
|
349
|
+
* expensive one.
|
|
350
|
+
*
|
|
351
|
+
* @param root - The discovered project root
|
|
352
|
+
* @param pathArgs - The path arguments, possibly empty
|
|
353
|
+
* @returns One root-relative target per argument, in argument order
|
|
354
|
+
*/
|
|
355
|
+
function targetsWithin(root, pathArgs) {
|
|
356
|
+
if (pathArgs.length === 0)
|
|
357
|
+
return [targetPathWithin(root, undefined, COMMAND_NAME)];
|
|
358
|
+
return pathArgs.map((pathArg) => targetPathWithin(root, pathArg, COMMAND_NAME));
|
|
359
|
+
}
|
|
360
|
+
/**
|
|
361
|
+
* The document for one target, answer or non-answer.
|
|
362
|
+
*
|
|
363
|
+
* @param target - The root-relative path to answer for
|
|
364
|
+
* @param projection - The populated projection
|
|
365
|
+
* @param root - The corpus root, for the non-answer's explanation
|
|
366
|
+
* @param discoverable - Whether to compute the one-hop reachable set
|
|
367
|
+
* @returns The answer document, or the structurally-different unknown document
|
|
368
|
+
*/
|
|
369
|
+
function documentFor(target, projection, root, discoverable) {
|
|
370
|
+
const answer = whatLoadsAt(projection, target);
|
|
371
|
+
if (answer.kind === 'unknown')
|
|
372
|
+
return unknownDocumentFor(answer.input, root);
|
|
373
|
+
return answerDocument(answer, projection, discoverable);
|
|
374
|
+
}
|
|
375
|
+
/**
|
|
376
|
+
* Render every answer for a person, with the limits stated exactly once.
|
|
377
|
+
*
|
|
378
|
+
* ⛔ The limits are printed ONCE, after the last answer, rather than per answer.
|
|
379
|
+
* They are properties of the MEASUREMENT METHOD, not of any one path, so
|
|
380
|
+
* repeating them per path would read as though each answer carried its own
|
|
381
|
+
* caveats — and across a many-path run would bury the answers under identical
|
|
382
|
+
* paragraphs. A run with no answered path prints no limits at all, for the same
|
|
383
|
+
* reason {@link unknownDocumentFor} omits them: nothing was measured, so there is
|
|
384
|
+
* no measurement to bound.
|
|
385
|
+
*
|
|
386
|
+
* @param documents - The answers, in requested order
|
|
387
|
+
* @returns The text rendering, newline-terminated
|
|
388
|
+
*/
|
|
389
|
+
function renderEnvelopeText(documents) {
|
|
390
|
+
const bodies = documents.map((document) => document.kind === 'unknown' ? renderUnknownText(document) : renderAnswerText(document));
|
|
391
|
+
const measured = documents.some((document) => document.kind === 'answer');
|
|
392
|
+
if (!measured)
|
|
393
|
+
return bodies.join('\n');
|
|
394
|
+
return `${bodies.join('\n')}${limitSection().join('\n')}\n`;
|
|
395
|
+
}
|
|
396
|
+
/**
|
|
397
|
+
* Render the `--all` cost map for a person: where in this tree it is expensive
|
|
398
|
+
* to work.
|
|
399
|
+
*
|
|
400
|
+
* Four sections, in the order a reader needs them — the region table (what each
|
|
401
|
+
* part of the tree costs at launch), the regions' own files (what they are paying
|
|
402
|
+
* for), the directories that cost the most to work in overall, and what the map
|
|
403
|
+
* looked at — then the limits, ONCE.
|
|
404
|
+
*
|
|
405
|
+
* ⛔ Every ranked section is capped at {@link COST_MAP_ROW_LIMIT} and every cap
|
|
406
|
+
* that fires announces itself. ⛔ Nothing here sums an unknown into a total or
|
|
407
|
+
* calls any figure complete: the counted-not-summed rows are printed beside each
|
|
408
|
+
* estimate, and the stated limits apply whether or not those counters are zero.
|
|
409
|
+
*
|
|
410
|
+
* ⛔ Exported so the properties above can be TESTED with inputs a real tree never
|
|
411
|
+
* produces — a null token count, more directories than the cap. On this repository
|
|
412
|
+
* every file has a measured blob, so an assertion driven by a real run compares
|
|
413
|
+
* `false === false` and would keep passing against a `?? 0`.
|
|
414
|
+
*
|
|
415
|
+
* @param map - The whole-tree cost map from `buildContextCostMap`
|
|
416
|
+
* @returns The text rendering, newline-terminated
|
|
417
|
+
*/
|
|
418
|
+
export function renderCostMapText(map) {
|
|
419
|
+
const lines = [
|
|
420
|
+
'Context cost by region — what it costs to work in each part of this tree',
|
|
421
|
+
'',
|
|
422
|
+
...wrapStatement(COST_MAP_METHOD_STATEMENT, ' '),
|
|
423
|
+
'',
|
|
424
|
+
...regionTable(map.regions),
|
|
425
|
+
...map.regions.slice(0, COST_MAP_ROW_LIMIT).flatMap(regionDetail),
|
|
426
|
+
...directoryTable(map.directories),
|
|
427
|
+
...coverageLines(map),
|
|
428
|
+
];
|
|
429
|
+
return `${lines.join('\n')}\n${limitSection().join('\n')}\n`;
|
|
430
|
+
}
|
|
431
|
+
/**
|
|
432
|
+
* The ranked region table: what a session pays at launch in each part of the tree.
|
|
433
|
+
*
|
|
434
|
+
* @param regions - The regions, already worst-first by launch cost
|
|
435
|
+
* @returns The section's lines, blank-terminated
|
|
436
|
+
*/
|
|
437
|
+
function regionTable(regions) {
|
|
438
|
+
const shown = regions.slice(0, COST_MAP_ROW_LIMIT);
|
|
439
|
+
const lines = [' at launch locations region'];
|
|
440
|
+
for (const region of shown) {
|
|
441
|
+
lines.push(` ${padCount(region.alwaysTokens, 9)} ${padCount(region.locationCount, 9)}`
|
|
442
|
+
+ ` ${displayPath(region.representative)}`);
|
|
443
|
+
}
|
|
444
|
+
lines.push(...omittedNotice(shown.length, regions.length, 'region', 'regions'), '');
|
|
445
|
+
return lines;
|
|
446
|
+
}
|
|
447
|
+
/**
|
|
448
|
+
* One region's launch-time bill, itemised.
|
|
449
|
+
*
|
|
450
|
+
* 🔑 The rows are rendered by {@link rowSection}, the same function the per-path
|
|
451
|
+
* answer uses, so a file reads identically in both reports and there is exactly
|
|
452
|
+
* one admission-describer. Its `loadClass` filter is a no-op here — `alwaysRows`
|
|
453
|
+
* is already that class — and passing it anyway keeps the call honest rather than
|
|
454
|
+
* relying on the caller's guarantee.
|
|
455
|
+
*
|
|
456
|
+
* @param region - The region to itemise
|
|
457
|
+
* @returns The section's lines, blank-terminated
|
|
458
|
+
*/
|
|
459
|
+
function regionDetail(region) {
|
|
460
|
+
return [
|
|
461
|
+
`Region ${displayPath(region.representative)} — ${groupDigits(region.alwaysTokens)} tokens`
|
|
462
|
+
+ ` at launch, ${countOf(region.locationCount, 'location', 'locations')}`,
|
|
463
|
+
...quietCounterLines(region),
|
|
464
|
+
...nestBlock(rowSection('Loaded at launch', region.alwaysRows, 'always')),
|
|
465
|
+
'',
|
|
466
|
+
];
|
|
467
|
+
}
|
|
468
|
+
/**
|
|
469
|
+
* A region's three counters, printed only when one of them has something to say.
|
|
470
|
+
*
|
|
471
|
+
* ⛔ **This suppression is safe ONLY because the tree-level roll-up in
|
|
472
|
+
* {@link coverageLines} prints UNCONDITIONALLY, zeros included.** The honesty
|
|
473
|
+
* rule in this lane is that a reader must never be able to mistake "nothing here
|
|
474
|
+
* was unmeasurable" for "nobody counted", and after this suppression the roll-up
|
|
475
|
+
* is the single thing in the report carrying that. Silence a region's zeros only
|
|
476
|
+
* while a tree-level zero is still printed somewhere; drop the roll-up and this
|
|
477
|
+
* function has to go back to unconditional.
|
|
478
|
+
*
|
|
479
|
+
* ⛔ Deliberately NOT applied to {@link estimateLines}. A single-path answer has
|
|
480
|
+
* no roll-up to fall back on, so its counters are the only statement that the
|
|
481
|
+
* rows were counted at all and must keep printing whatever their values.
|
|
482
|
+
*
|
|
483
|
+
* The measured motivation: nine regions on this repository printed 27 lines of
|
|
484
|
+
* pure zeros, burying the launch bills the section exists to show.
|
|
485
|
+
*
|
|
486
|
+
* @param region - The region whose counters to print
|
|
487
|
+
* @returns The three lines, or none when all three are zero
|
|
488
|
+
*/
|
|
489
|
+
function quietCounterLines(region) {
|
|
490
|
+
const anything = region.unknownTokenRows + region.skippedOversizeRows + region.prunedRows;
|
|
491
|
+
if (anything === 0)
|
|
492
|
+
return [];
|
|
493
|
+
// Whole block or nothing: a reader comparing two regions must be comparing the
|
|
494
|
+
// same three lines, not one region's selected non-zeros.
|
|
495
|
+
return counterLines(region);
|
|
496
|
+
}
|
|
497
|
+
/**
|
|
498
|
+
* Indent a borrowed section one level, and drop the blank line it terminates with.
|
|
499
|
+
*
|
|
500
|
+
* {@link rowSection} is written for the per-path answer, where it sits at the top
|
|
501
|
+
* level and separates itself from what follows. Nested under a region heading it
|
|
502
|
+
* needs a level of indent, and its terminator would double the region's own — so
|
|
503
|
+
* this drops every blank rather than the last one specifically, which is exact
|
|
504
|
+
* because that section emits no interior blanks.
|
|
505
|
+
*
|
|
506
|
+
* @param lines - The borrowed section's lines
|
|
507
|
+
* @returns The same lines, indented, with blanks removed
|
|
508
|
+
*/
|
|
509
|
+
function nestBlock(lines) {
|
|
510
|
+
return lines.filter((line) => line !== '').map((line) => ` ${line}`);
|
|
511
|
+
}
|
|
512
|
+
/**
|
|
513
|
+
* The ranked directory table: where in this tree it is most expensive to work.
|
|
514
|
+
*
|
|
515
|
+
* ⛔ Ordered and headed by TOTAL cost — the launch floor plus the on-demand
|
|
516
|
+
* burden — which is the key `buildContextCostMap` sorts by. Ranking on a key the
|
|
517
|
+
* producer did not sort on would make the column descend non-monotonically and
|
|
518
|
+
* read as a bug; ranking on the on-demand half alone would answer "where does a
|
|
519
|
+
* rule fire", which is not the question the map is for.
|
|
520
|
+
*
|
|
521
|
+
* ⛔ Every one of the three figures is READ. The CLI does not add
|
|
522
|
+
* `alwaysTokens` to `onDemandTokens` here — that sum is `DirectoryCost.
|
|
523
|
+
* totalTokens`, computed where both halves are known to be charged-only totals.
|
|
524
|
+
* A second sum in this module would be a second, unowned model of what "cost"
|
|
525
|
+
* means, free to disagree with the ranking beside it. Both halves stay in the
|
|
526
|
+
* table because they are acted on differently: the floor by moving instructions,
|
|
527
|
+
* the burden by scoping rules.
|
|
528
|
+
*
|
|
529
|
+
* @param directories - The directories, already worst-first by total cost
|
|
530
|
+
* @returns The section's lines, blank-terminated, or none when there are none
|
|
531
|
+
*/
|
|
532
|
+
function directoryTable(directories) {
|
|
533
|
+
if (directories.length === 0)
|
|
534
|
+
return [];
|
|
535
|
+
const shown = directories.slice(0, COST_MAP_ROW_LIMIT);
|
|
536
|
+
const lines = [
|
|
537
|
+
'Most expensive directories to work in — at launch PLUS what fires on demand there',
|
|
538
|
+
' total at launch on demand directory',
|
|
539
|
+
];
|
|
540
|
+
for (const directory of shown) {
|
|
541
|
+
lines.push(` ${padCount(directory.totalTokens, 9)} ${padCount(directory.alwaysTokens, 9)}`
|
|
542
|
+
+ ` ${padCount(directory.onDemandTokens, 9)} ${displayPath(directory.directory)}`
|
|
543
|
+
// ⛔ The unknown-row suffix appears only when there is one, for the same
|
|
544
|
+
// reason and under the same condition as {@link quietCounterLines}: the
|
|
545
|
+
// tree-level roll-up in {@link coverageLines} states unconditionally that
|
|
546
|
+
// these rows were counted, so twenty repetitions of "0 rows of unknown
|
|
547
|
+
// size" buy nothing and crowd out the paths the table is ranking. Remove
|
|
548
|
+
// the roll-up and this suffix has to become unconditional again.
|
|
549
|
+
+ unknownRowSuffix(directory.unknownTokenRows));
|
|
550
|
+
}
|
|
551
|
+
lines.push(...omittedNotice(shown.length, directories.length, 'directory', 'directories'), '');
|
|
552
|
+
return lines;
|
|
553
|
+
}
|
|
554
|
+
/**
|
|
555
|
+
* The note that a directory's on-demand cost is an under-report, when it is.
|
|
556
|
+
*
|
|
557
|
+
* @param unknownTokenRows - On-demand rows at that directory whose size is unknown
|
|
558
|
+
* @returns The suffix, or nothing at all when every row was measured
|
|
559
|
+
*/
|
|
560
|
+
function unknownRowSuffix(unknownTokenRows) {
|
|
561
|
+
if (unknownTokenRows === 0)
|
|
562
|
+
return '';
|
|
563
|
+
return ` · ${countOf(unknownTokenRows, 'row', 'rows')} of unknown size, counted not summed`;
|
|
564
|
+
}
|
|
565
|
+
/**
|
|
566
|
+
* What the map looked at, including the locations it could not answer for.
|
|
567
|
+
*
|
|
568
|
+
* ⛔ `skippedUnknownLocations` is PRINTED, not folded away. A location left out
|
|
569
|
+
* because a query it needed answered `unknown` is a hole in the map, and a report
|
|
570
|
+
* that quietly dropped it would be indistinguishable from one where every
|
|
571
|
+
* location answered.
|
|
572
|
+
*
|
|
573
|
+
* ⛔ The tree-level roll-up prints UNCONDITIONALLY, all-zero included, and that
|
|
574
|
+
* is load-bearing: {@link quietCounterLines} suppresses the per-region zeros, so
|
|
575
|
+
* this is the only place left saying the rows were counted at all. A zero here is
|
|
576
|
+
* a measurement; an absent line would be indistinguishable from nobody looking.
|
|
577
|
+
*
|
|
578
|
+
* @param map - The cost map
|
|
579
|
+
* @returns The section's lines, blank-terminated
|
|
580
|
+
*/
|
|
581
|
+
function coverageLines(map) {
|
|
582
|
+
return [
|
|
583
|
+
'What this map looked at',
|
|
584
|
+
` working locations evaluated ${groupDigits(map.evaluatedDirectories)}`,
|
|
585
|
+
` queries issued ${groupDigits(map.queriedDirectories)}`,
|
|
586
|
+
` no answer of their own ${countOf(map.skippedUnknownLocations, 'location', 'locations')}`
|
|
587
|
+
+ ' (left out of the table above, never counted as zero)',
|
|
588
|
+
' rows this map could not measure, over every region and directory above:',
|
|
589
|
+
...counterLines(map.unmeasuredRows),
|
|
590
|
+
'',
|
|
591
|
+
];
|
|
592
|
+
}
|
|
593
|
+
/**
|
|
594
|
+
* Say how many ranked rows were left unprinted, or say nothing when none were.
|
|
595
|
+
*
|
|
596
|
+
* ⛔ The COUNT is the point. "Some rows were omitted" leaves a reader unable to
|
|
597
|
+
* tell a table that dropped three rows from one that dropped three thousand, and
|
|
598
|
+
* a cap with no notice at all reads as "this is everything" — which is the claim
|
|
599
|
+
* this whole report is built not to make.
|
|
600
|
+
*
|
|
601
|
+
* @param shown - How many rows were printed
|
|
602
|
+
* @param total - How many there were
|
|
603
|
+
* @param singular - What one omitted row is, for the `total - shown === 1` case
|
|
604
|
+
* @param plural - What several of them are
|
|
605
|
+
* @returns The notice line, or none when nothing was truncated
|
|
606
|
+
*/
|
|
607
|
+
function omittedNotice(shown, total, singular, plural) {
|
|
608
|
+
if (total <= shown)
|
|
609
|
+
return [];
|
|
610
|
+
const omitted = total - shown;
|
|
611
|
+
const noun = omitted === 1 ? singular : plural;
|
|
612
|
+
return [
|
|
613
|
+
` ... and ${groupDigits(omitted)} more ${noun} not shown —`
|
|
614
|
+
+ ` this is the ${groupDigits(shown)} most expensive, not the whole tree`,
|
|
615
|
+
];
|
|
616
|
+
}
|
|
617
|
+
/**
|
|
618
|
+
* The three row counters that keep an estimate from reading as settled.
|
|
619
|
+
*
|
|
620
|
+
* Shared by the per-path answer and by every region of the cost map, because it
|
|
621
|
+
* is one rule stated in one place: a row whose size is unknown, whose file the
|
|
622
|
+
* 4 MiB cliff skipped, or which sits behind such a file is COUNTED here and
|
|
623
|
+
* summed into nothing. Two copies of these three lines would be two places for a
|
|
624
|
+
* `?? 0` to appear in.
|
|
625
|
+
*
|
|
626
|
+
* @param counters - Anything carrying the three counts — `ContextTotals`, or a
|
|
627
|
+
* region's own always-row counts
|
|
628
|
+
* @returns The three lines, unterminated
|
|
629
|
+
*/
|
|
630
|
+
function counterLines(counters) {
|
|
631
|
+
return [
|
|
632
|
+
` size unknown ${countOf(counters.unknownTokenRows, 'row', 'rows')}`
|
|
633
|
+
+ ' (counted, never summed as zero)',
|
|
634
|
+
` skipped over 4 MiB ${countOf(counters.skippedOversizeRows, 'row', 'rows')}`,
|
|
635
|
+
` pruned behind a skip ${countOf(counters.prunedRows, 'row', 'rows')}`,
|
|
636
|
+
];
|
|
637
|
+
}
|
|
638
|
+
/**
|
|
639
|
+
* A count with its noun, digit-grouped and agreeing in number.
|
|
640
|
+
*
|
|
641
|
+
* The alternative — a bare `${n} ${plural}` — prints "1 locations" whenever a
|
|
642
|
+
* region has exactly one, which is the common case on a tree with many small
|
|
643
|
+
* packages and reads as a rendering bug the moment anyone sees it. Both forms are
|
|
644
|
+
* PARAMETERS rather than a suffixed `s`, because the nouns this report uses are
|
|
645
|
+
* not all regular ("directory" is the counter-example living two functions away).
|
|
646
|
+
*
|
|
647
|
+
* @param value - The count
|
|
648
|
+
* @param singular - The noun for exactly one
|
|
649
|
+
* @param plural - The noun for any other count, zero included
|
|
650
|
+
* @returns The count and its noun
|
|
651
|
+
*/
|
|
652
|
+
function countOf(value, singular, plural) {
|
|
653
|
+
return `${groupDigits(value)} ${value === 1 ? singular : plural}`;
|
|
654
|
+
}
|
|
655
|
+
/**
|
|
656
|
+
* A count, digit-grouped and right-aligned to a column width.
|
|
657
|
+
*
|
|
658
|
+
* @param value - The count
|
|
659
|
+
* @param width - The column width; a longer number overflows rather than truncates
|
|
660
|
+
* @returns The padded text
|
|
661
|
+
*/
|
|
662
|
+
function padCount(value, width) {
|
|
663
|
+
return groupDigits(value).padStart(width);
|
|
664
|
+
}
|
|
665
|
+
/**
|
|
666
|
+
* A non-negative integer with thousands separators.
|
|
667
|
+
*
|
|
668
|
+
* ⚠️ Written out by hand rather than through `toLocaleString` or `Intl`: those
|
|
669
|
+
* are ICU- and locale-dependent, so the same tree would render `38,412` on one
|
|
670
|
+
* machine and `38 412` on another, and this report is exactly the kind of output
|
|
671
|
+
* people diff between machines. Every number reaching it is a token estimate or a
|
|
672
|
+
* row count, so the negative case cannot arise and is not invented for.
|
|
673
|
+
*
|
|
674
|
+
* @param value - The count
|
|
675
|
+
* @returns The grouped digits
|
|
676
|
+
*/
|
|
677
|
+
function groupDigits(value) {
|
|
678
|
+
const digits = String(value);
|
|
679
|
+
let grouped = '';
|
|
680
|
+
for (const [index, digit] of [...digits].entries()) {
|
|
681
|
+
if (index > 0 && (digits.length - index) % 3 === 0)
|
|
682
|
+
grouped += ',';
|
|
683
|
+
grouped += digit;
|
|
684
|
+
}
|
|
685
|
+
return grouped;
|
|
686
|
+
}
|
|
687
|
+
/**
|
|
688
|
+
* Populate the Claude-context lane for one tree.
|
|
689
|
+
*
|
|
690
|
+
* @param root - The absolute corpus root
|
|
691
|
+
* @param logger - Where blob-stage refusals go. **stderr**, never stdout: this
|
|
692
|
+
* command's stdout is the document a caller parses, and a diagnostic in the
|
|
693
|
+
* middle of it breaks every consumer
|
|
694
|
+
* @returns The populated projection
|
|
695
|
+
*/
|
|
696
|
+
async function populateContext(root, logger) {
|
|
697
|
+
return withPopulationCache({ root }, async (cache) => {
|
|
698
|
+
const gitTracker = await gitTrackerForProjectRoot(root);
|
|
699
|
+
return buildClaudeContextPopulation({ root, ...populationWiring(logger, gitTracker, cache, root) });
|
|
700
|
+
});
|
|
701
|
+
}
|
|
702
|
+
/**
|
|
703
|
+
* Write the document in the requested format.
|
|
704
|
+
*
|
|
705
|
+
* @param document - The yaml/json payload
|
|
706
|
+
* @param text - The text rendering of the same answer
|
|
707
|
+
* @param format - The selected format
|
|
708
|
+
*/
|
|
709
|
+
function emit(document, text, format) {
|
|
710
|
+
if (format === 'json') {
|
|
711
|
+
writeJsonOutput(document);
|
|
712
|
+
return;
|
|
713
|
+
}
|
|
714
|
+
if (format === 'yaml') {
|
|
715
|
+
writeYamlOutput(document);
|
|
716
|
+
return;
|
|
717
|
+
}
|
|
718
|
+
writeStdoutSync(text);
|
|
719
|
+
}
|
|
720
|
+
/**
|
|
721
|
+
* The non-answer, spelled so it cannot be mistaken for an empty answer.
|
|
722
|
+
*
|
|
723
|
+
* ⛔ **A non-answer publishes no measurement, in every format.** No `totals`, no
|
|
724
|
+
* `rows`: nothing was measured here, so anything readable as a figure would
|
|
725
|
+
* assert that a measurement happened, which is the exact confusion `kind:
|
|
726
|
+
* 'unknown'` exists to prevent. The limits are one level up on the ENVELOPE and
|
|
727
|
+
* bound the run's method, not this path — a sweep whose every path was
|
|
728
|
+
* unrealized still measured nothing, and the `explanation` carries the only
|
|
729
|
+
* caveat that applies to a non-answer, which is that there is no answer.
|
|
730
|
+
*
|
|
731
|
+
* @param input - The path that was asked about
|
|
732
|
+
* @param root - The corpus root that was enumerated
|
|
733
|
+
* @returns The unknown document
|
|
734
|
+
*/
|
|
735
|
+
function unknownDocumentFor(input, root) {
|
|
736
|
+
return {
|
|
737
|
+
kind: 'unknown',
|
|
738
|
+
input,
|
|
739
|
+
reason: 'path-not-realized',
|
|
740
|
+
explanation: `${displayPath(input)} is not a path this projection realized under ${root}, so VAT did not`
|
|
741
|
+
+ ' look at it. This is NOT an answer of "nothing loads here" — no context was measured at'
|
|
742
|
+
+ ' all. Check the path exists and is not excluded from enumeration.',
|
|
743
|
+
};
|
|
744
|
+
}
|
|
745
|
+
/**
|
|
746
|
+
* Render the non-answer for a person.
|
|
747
|
+
*
|
|
748
|
+
* @param document - The unknown document
|
|
749
|
+
* @returns The text rendering, newline-terminated
|
|
750
|
+
*/
|
|
751
|
+
function renderUnknownText(document) {
|
|
752
|
+
return [
|
|
753
|
+
`NO ANSWER for ${displayPath(document.input)} — reason: ${document.reason}`,
|
|
754
|
+
'',
|
|
755
|
+
...wrapStatement(document.explanation, ' '),
|
|
756
|
+
'',
|
|
757
|
+
].join('\n');
|
|
758
|
+
}
|
|
759
|
+
/**
|
|
760
|
+
* Render the answer for a person.
|
|
761
|
+
*
|
|
762
|
+
* @param document - The answer document
|
|
763
|
+
* @returns The text rendering, newline-terminated
|
|
764
|
+
*/
|
|
765
|
+
function renderAnswerText(document) {
|
|
766
|
+
const lines = [
|
|
767
|
+
...headingLines(document),
|
|
768
|
+
...estimateLines(document.totals),
|
|
769
|
+
...rowSection('Loaded at launch (always)', document.rows, 'always'),
|
|
770
|
+
...rowSection('Loaded on demand', document.rows, 'on-demand'),
|
|
771
|
+
...listSection('Conditions', document.conditions.map(conditionLine)),
|
|
772
|
+
...listSection('Rules whose paths: list exceeded the vendor pattern budget', document.overBudgetRules),
|
|
773
|
+
...listSection('Imported files no importer could be attributed to', document.unattributedImports),
|
|
774
|
+
...discoverySection(document.discoverable),
|
|
775
|
+
];
|
|
776
|
+
return `${lines.join('\n')}\n`;
|
|
777
|
+
}
|
|
778
|
+
/**
|
|
779
|
+
* What the loaded files point at and the harness does not load.
|
|
780
|
+
*
|
|
781
|
+
* ⛔ Printed under its own heading with its own total, never merged into the
|
|
782
|
+
* token estimate. Nothing loads a markdown link, so this is an upper bound on a
|
|
783
|
+
* VOLUNTARY cost — what following every link once would add — and adding it to a
|
|
784
|
+
* context-budget figure would charge a session for documents it may never open.
|
|
785
|
+
* The heading says "not loaded" for a reader who sees only this section.
|
|
786
|
+
*
|
|
787
|
+
* A `null` argument means the lens was not asked for and prints NOTHING. An
|
|
788
|
+
* empty `rows` prints the heading with a zero, because "this file links nowhere"
|
|
789
|
+
* is a real and useful answer that must not be confused with "nobody looked".
|
|
790
|
+
*
|
|
791
|
+
* @param discoverable - The lens's answer, or null when `--discoverable` was off
|
|
792
|
+
* @returns The section's lines, or none when the lens did not run
|
|
793
|
+
*/
|
|
794
|
+
function discoverySection(discoverable) {
|
|
795
|
+
if (discoverable === null)
|
|
796
|
+
return [];
|
|
797
|
+
const { rows, totals } = discoverable;
|
|
798
|
+
const lines = [
|
|
799
|
+
'Discoverable in one hop — LINKED from the loaded files, NOT loaded',
|
|
800
|
+
` ${groupDigits(totals.discoverableTokens)} tokens if every link were followed once`
|
|
801
|
+
+ ' (a ceiling, never a charge)',
|
|
802
|
+
` ${groupDigits(totals.unknownTokenRows)} size unknown`
|
|
803
|
+
+ ` · ${groupDigits(totals.unrealizedRows)} not in this tree`
|
|
804
|
+
+ ` · ${groupDigits(totals.outsideRootRows)} outside the root`,
|
|
805
|
+
];
|
|
806
|
+
for (const row of rows) {
|
|
807
|
+
lines.push(` ${displayPath(row.path)} — ${discoverableCost(row)}`);
|
|
808
|
+
for (const citation of row.citedBy) {
|
|
809
|
+
const text = citation.text === null ? '' : ` as "${citation.text}"`;
|
|
810
|
+
lines.push(` linked from ${displayPath(citation.fromPath)}:${citation.line}${text}`);
|
|
811
|
+
}
|
|
812
|
+
}
|
|
813
|
+
lines.push('');
|
|
814
|
+
return lines;
|
|
815
|
+
}
|
|
816
|
+
/**
|
|
817
|
+
* What one discoverable row would cost, or why VAT cannot say.
|
|
818
|
+
*
|
|
819
|
+
* ⛔ Never `0` for an unmeasured row, the same rule {@link chargeText} enforces
|
|
820
|
+
* one section up. `unrealized` says what it is — an absence in THIS projection —
|
|
821
|
+
* rather than "broken": adjudicating a link is `vat resources validate`'s lane.
|
|
822
|
+
*
|
|
823
|
+
* @param row - The discoverable row
|
|
824
|
+
* @returns The cost phrase
|
|
825
|
+
*/
|
|
826
|
+
function discoverableCost(row) {
|
|
827
|
+
if (row.reach === 'outside-root')
|
|
828
|
+
return 'outside the corpus root, so its size is unknowable here';
|
|
829
|
+
if (row.reach === 'unrealized')
|
|
830
|
+
return 'not realized in this projection, so nothing is known of it';
|
|
831
|
+
if (row.tokens === null)
|
|
832
|
+
return 'size unknown: no measured blob, so it is counted, not summed';
|
|
833
|
+
return `${groupDigits(row.tokens)} tokens if opened`;
|
|
834
|
+
}
|
|
835
|
+
/**
|
|
836
|
+
* The heading, which states up front whether the query was exact.
|
|
837
|
+
*
|
|
838
|
+
* @param document - The answer document
|
|
839
|
+
* @returns The heading lines, blank-terminated
|
|
840
|
+
*/
|
|
841
|
+
function headingLines(document) {
|
|
842
|
+
const exactness = document.file === null
|
|
843
|
+
? 'DIRECTORY query — a path-scoped rule is reported as ∀ (covers every file here)'
|
|
844
|
+
+ ' or ∃ (some file here matches); only a FILE query is exact'
|
|
845
|
+
: 'FILE query — path-scoped rules are matched exactly';
|
|
846
|
+
return [`Claude Code context at ${displayPath(document.input)}`, ` ${exactness}`, ''];
|
|
847
|
+
}
|
|
848
|
+
/**
|
|
849
|
+
* The token estimate and the three counters that keep it from reading as settled.
|
|
850
|
+
*
|
|
851
|
+
* @param totals - The accounting totals
|
|
852
|
+
* @returns The section's lines, blank-terminated
|
|
853
|
+
*/
|
|
854
|
+
function estimateLines(totals) {
|
|
855
|
+
return [
|
|
856
|
+
'Token estimate',
|
|
857
|
+
` always-loaded ${groupDigits(totals.alwaysTokens)} tokens`,
|
|
858
|
+
` on-demand ${groupDigits(totals.onDemandTokens)} tokens`,
|
|
859
|
+
// ⛔ UNCONDITIONAL here, unlike a region's — see {@link quietCounterLines}.
|
|
860
|
+
// A single-path answer has no tree-level roll-up to fall back on, so these
|
|
861
|
+
// three lines are its only statement that the rows were counted at all.
|
|
862
|
+
...counterLines(totals),
|
|
863
|
+
'',
|
|
864
|
+
];
|
|
865
|
+
}
|
|
866
|
+
/**
|
|
867
|
+
* One load class's rows, each with every predicate that admitted it.
|
|
868
|
+
*
|
|
869
|
+
* @param title - The section heading
|
|
870
|
+
* @param rows - Every accounted row
|
|
871
|
+
* @param loadClass - The class this section reports
|
|
872
|
+
* @returns The section's lines, or none when the class is empty
|
|
873
|
+
*/
|
|
874
|
+
function rowSection(title, rows, loadClass) {
|
|
875
|
+
const selected = rows.filter((row) => row.loadClass === loadClass);
|
|
876
|
+
if (selected.length === 0)
|
|
877
|
+
return [];
|
|
878
|
+
const lines = [title];
|
|
879
|
+
for (const row of selected) {
|
|
880
|
+
lines.push(` ${row.path} — ${chargeText(row)}`);
|
|
881
|
+
for (const admission of row.admissions) {
|
|
882
|
+
lines.push(` ${describeAdmission(admission)}`);
|
|
883
|
+
}
|
|
884
|
+
}
|
|
885
|
+
lines.push('');
|
|
886
|
+
return lines;
|
|
887
|
+
}
|
|
888
|
+
/**
|
|
889
|
+
* What one row costs, or why it costs nothing.
|
|
890
|
+
*
|
|
891
|
+
* ⛔ A null token count renders as "size unknown", never as `0`. The `charged`
|
|
892
|
+
* branch cannot be reached with a null — `sizeCliffOf` classifies those
|
|
893
|
+
* `unmeasured` first — but the check is written as a value test rather than a
|
|
894
|
+
* `?? 0`, so if that ever changed the output would say what it knows instead of
|
|
895
|
+
* asserting a measurement it does not have.
|
|
896
|
+
*
|
|
897
|
+
* **Exported solely so that rule can be pinned by a test that would FAIL if a
|
|
898
|
+
* `?? 0` were introduced.** The property lives in the RENDERER and nowhere else:
|
|
899
|
+
* an assertion over the json rows only re-states what `account` already
|
|
900
|
+
* guarantees, and on any real tree every row carries a blob, so such an
|
|
901
|
+
* assertion compares `false === false` and passes without ever reaching the code
|
|
902
|
+
* that could print a zero. It is not part of this module's command surface and
|
|
903
|
+
* nothing outside its own test may call it.
|
|
904
|
+
*
|
|
905
|
+
* @param row - The accounted row
|
|
906
|
+
* @returns The cost phrase
|
|
907
|
+
*/
|
|
908
|
+
export function chargeText(row) {
|
|
909
|
+
if (row.sizeCliff === 'oversize-skipped') {
|
|
910
|
+
return 'skipped: past the 4 MiB CLAUDE.md cliff, so none of it loads';
|
|
911
|
+
}
|
|
912
|
+
if (row.sizeCliff === 'pruned-by-oversize') {
|
|
913
|
+
return 'not reached: every import route into it passes through a skipped file';
|
|
914
|
+
}
|
|
915
|
+
if (row.tokens === null)
|
|
916
|
+
return 'size unknown: no measured blob, so it is counted, not summed';
|
|
917
|
+
// ⚠️ Grouped through the SAME helper the tables use. Two spellings of one
|
|
918
|
+
// quantity — `14,396` in a column and `8385` on the row ten lines below it —
|
|
919
|
+
// read as a bug in the measurement rather than as a formatting choice. This
|
|
920
|
+
// changes only how the number is written, never whether one is written: the
|
|
921
|
+
// null branch above is what keeps an unknown size out of the digits entirely.
|
|
922
|
+
return `${groupDigits(row.tokens)} tokens`;
|
|
923
|
+
}
|
|
924
|
+
/**
|
|
925
|
+
* One admission, in prose.
|
|
926
|
+
*
|
|
927
|
+
* @param admission - Why the row is in the answer
|
|
928
|
+
* @returns The prose form
|
|
929
|
+
*/
|
|
930
|
+
function describeAdmission(admission) {
|
|
931
|
+
switch (admission.kind) {
|
|
932
|
+
case 'ancestry':
|
|
933
|
+
return `CLAUDE.md chain, from ${displayPath(admission.dir)}`;
|
|
934
|
+
case 'root-rule':
|
|
935
|
+
return 'root-scope rules file';
|
|
936
|
+
case 'nested-rule':
|
|
937
|
+
return `nested rules file, under ${displayPath(admission.under)}`;
|
|
938
|
+
case 'glob-rule':
|
|
939
|
+
return `rule matched ${admission.pattern}`;
|
|
940
|
+
case 'glob-rule-covers-dir':
|
|
941
|
+
return `∀ rule covers EVERY file here via ${admission.pattern}`
|
|
942
|
+
+ ' — a second CLAUDE.md for this directory in all but name';
|
|
943
|
+
case 'glob-rule-may-fire':
|
|
944
|
+
return `∃ rule may fire here — ${admission.pattern} matches ${displayPath(admission.examplePath)}`
|
|
945
|
+
+ ', among possibly others; ask about a FILE for an exact answer';
|
|
946
|
+
// Spelled out rather than left to a `default`, so that adding a seventh
|
|
947
|
+
// admission kind upstream is a lint error here instead of an import
|
|
948
|
+
// description silently applied to something that is not an import.
|
|
949
|
+
case 'import':
|
|
950
|
+
return describeImport(admission);
|
|
951
|
+
}
|
|
952
|
+
}
|
|
953
|
+
/**
|
|
954
|
+
* One import admission, in prose.
|
|
955
|
+
*
|
|
956
|
+
* An unattributed member says so rather than naming a plausible importer: the
|
|
957
|
+
* query reports `viaPath: null` precisely when it could not attribute a parent,
|
|
958
|
+
* and inventing one here would launder that into a fact.
|
|
959
|
+
*
|
|
960
|
+
* @param admission - The import admission
|
|
961
|
+
* @returns The prose form
|
|
962
|
+
*/
|
|
963
|
+
function describeImport(admission) {
|
|
964
|
+
if (admission.viaPath === null || admission.depth === null) {
|
|
965
|
+
return `@-imported into the closure rooted at ${admission.rootPath}, importer unattributed`;
|
|
966
|
+
}
|
|
967
|
+
return `imported by ${admission.viaPath} at depth ${admission.depth}`
|
|
968
|
+
+ ` (closure rooted at ${admission.rootPath})`;
|
|
969
|
+
}
|
|
970
|
+
/**
|
|
971
|
+
* One condition, in the compact `severity code at location: message` shape.
|
|
972
|
+
*
|
|
973
|
+
* @param condition - The graded condition
|
|
974
|
+
* @returns The line
|
|
975
|
+
*/
|
|
976
|
+
function conditionLine(condition) {
|
|
977
|
+
const reference = condition.sourceRef === null ? '' : ` [${condition.sourceRef}]`;
|
|
978
|
+
return ` ${condition.severity.padEnd(7)} ${condition.code}`
|
|
979
|
+
+ ` at ${conditionLocation(condition)}${reference}: ${condition.message}`;
|
|
980
|
+
}
|
|
981
|
+
/**
|
|
982
|
+
* Where a condition points, using the most specific provenance it carries.
|
|
983
|
+
*
|
|
984
|
+
* @param condition - The graded condition
|
|
985
|
+
* @returns A path, or a `path:line`
|
|
986
|
+
*/
|
|
987
|
+
function conditionLocation(condition) {
|
|
988
|
+
if (condition.sourcePath === null)
|
|
989
|
+
return condition.path;
|
|
990
|
+
if (condition.sourceLine === null)
|
|
991
|
+
return condition.sourcePath;
|
|
992
|
+
return `${condition.sourcePath}:${condition.sourceLine}`;
|
|
993
|
+
}
|
|
994
|
+
/**
|
|
995
|
+
* A heading plus its lines, or nothing at all when there are none.
|
|
996
|
+
*
|
|
997
|
+
* @param title - The section heading
|
|
998
|
+
* @param entries - The already-formatted lines, or bare strings to indent
|
|
999
|
+
* @returns The section's lines, blank-terminated, or none
|
|
1000
|
+
*/
|
|
1001
|
+
function listSection(title, entries) {
|
|
1002
|
+
if (entries.length === 0)
|
|
1003
|
+
return [];
|
|
1004
|
+
return [title, ...entries.map((entry) => (entry.startsWith(' ') ? entry : ` ${entry}`)), ''];
|
|
1005
|
+
}
|
|
1006
|
+
/**
|
|
1007
|
+
* The limits section — the one part of this rendering that is never omitted.
|
|
1008
|
+
*
|
|
1009
|
+
* Printed even when there is nothing else to say, because the limits are a
|
|
1010
|
+
* property of the METHOD rather than of this particular tree: an answer with no
|
|
1011
|
+
* conditions and no unknown rows is subject to exactly the same signed
|
|
1012
|
+
* over/under-report bounds as a messy one.
|
|
1013
|
+
*
|
|
1014
|
+
* ⛔ Reads the imported constants, NOT an answer document — the same source
|
|
1015
|
+
* {@link contextEnvelope} reads. It took no argument's worth of per-answer data
|
|
1016
|
+
* even when the fields were on the answer, and threading one through was what
|
|
1017
|
+
* made "the limits belong to an answer" look true.
|
|
1018
|
+
*
|
|
1019
|
+
* @returns The section's lines
|
|
1020
|
+
*/
|
|
1021
|
+
function limitSection() {
|
|
1022
|
+
const lines = [
|
|
1023
|
+
'What this answer does not settle',
|
|
1024
|
+
...wrapStatement(CLAUDE_CONTEXT_BOUNDS_STATEMENT, ' '),
|
|
1025
|
+
'',
|
|
1026
|
+
];
|
|
1027
|
+
for (const limit of CLAUDE_CONTEXT_LIMITS) {
|
|
1028
|
+
lines.push(` ${limit.direction}: ${limit.id}`);
|
|
1029
|
+
lines.push(...wrapStatement(limit.statement, ' '));
|
|
1030
|
+
}
|
|
1031
|
+
lines.push('', 'Modelled Claude Code behaviours (vendor versions, each cited)');
|
|
1032
|
+
for (const behaviour of CLAUDE_CONTEXT_MODELLED_BEHAVIOURS) {
|
|
1033
|
+
lines.push(` ${behaviour.behaviour}`);
|
|
1034
|
+
lines.push(` ${behaviour.introducedIn} — ${behaviour.citedFrom}`);
|
|
1035
|
+
}
|
|
1036
|
+
return lines;
|
|
1037
|
+
}
|
|
1038
|
+
/**
|
|
1039
|
+
* Soft-wrap a statement to {@link WRAP_COLUMNS}, under a fixed indent.
|
|
1040
|
+
*
|
|
1041
|
+
* The limit statements are two and three sentences long and are the part of this
|
|
1042
|
+
* output people actually have to read; unwrapped they arrive as one 400-column
|
|
1043
|
+
* line that a terminal breaks mid-word.
|
|
1044
|
+
*
|
|
1045
|
+
* @param text - The statement
|
|
1046
|
+
* @param indent - Leading whitespace for every produced line
|
|
1047
|
+
* @returns One or more indented lines
|
|
1048
|
+
*/
|
|
1049
|
+
function wrapStatement(text, indent) {
|
|
1050
|
+
const width = Math.max(WRAP_COLUMNS - indent.length, 20);
|
|
1051
|
+
const lines = [];
|
|
1052
|
+
let pending = [];
|
|
1053
|
+
let used = 0;
|
|
1054
|
+
for (const word of text.split(' ')) {
|
|
1055
|
+
if (pending.length > 0 && used + pending.length + word.length > width) {
|
|
1056
|
+
lines.push(indent + pending.join(' '));
|
|
1057
|
+
pending = [];
|
|
1058
|
+
used = 0;
|
|
1059
|
+
}
|
|
1060
|
+
pending.push(word);
|
|
1061
|
+
used += word.length;
|
|
1062
|
+
}
|
|
1063
|
+
if (pending.length > 0)
|
|
1064
|
+
lines.push(indent + pending.join(' '));
|
|
1065
|
+
return lines;
|
|
1066
|
+
}
|
|
1067
|
+
/**
|
|
1068
|
+
* A root-relative path as a reader should see it.
|
|
1069
|
+
*
|
|
1070
|
+
* The corpus root itself is `''`, which renders as nothing at all and reads like
|
|
1071
|
+
* a bug. Only the empty case is special-cased — every other path is printed
|
|
1072
|
+
* exactly as the projection holds it, so a reader can paste it straight back in.
|
|
1073
|
+
*
|
|
1074
|
+
* @param path - The root-relative path
|
|
1075
|
+
* @returns The display form
|
|
1076
|
+
*/
|
|
1077
|
+
function displayPath(path) {
|
|
1078
|
+
return path === '' ? '<corpus root>' : path;
|
|
1079
|
+
}
|
|
1080
|
+
//# sourceMappingURL=context.js.map
|