@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
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Shared command error handling utilities.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
4
|
+
* The failure endings a command may take, each publishing a document and
|
|
5
|
+
* ending on one member of the `ExitCode` contract. `commands/skills/` used to
|
|
5
6
|
* carry its own `handleCommandError` that logged to stderr and exited 2 having
|
|
6
7
|
* written nothing to stdout — same name, same signature, same documented
|
|
7
|
-
* contract, silently different behaviour.
|
|
8
|
+
* contract, silently different behaviour. A command that ends some other way
|
|
9
|
+
* still names its code from `ExitCode`; the lint rule
|
|
10
|
+
* `no-literal-process-exit` refuses a bare number.
|
|
8
11
|
*/
|
|
9
|
-
import { type SeverityCounts, type ValidationIssue } from '@vibe-agent-toolkit/
|
|
12
|
+
import { type ExitCodeValue, type SeverityCounts, type ValidationIssue } from '@vibe-agent-toolkit/schema';
|
|
10
13
|
import type { Logger } from './logger.js';
|
|
11
14
|
/**
|
|
12
15
|
* Format duration for human readability
|
|
@@ -14,14 +17,114 @@ import type { Logger } from './logger.js';
|
|
|
14
17
|
* @returns Formatted duration string (e.g., "500ms", "1.5s", "1.5m")
|
|
15
18
|
*/
|
|
16
19
|
export declare function formatDuration(ms: number): string;
|
|
20
|
+
/** The document a command publishes when an unexpected failure stops it. */
|
|
21
|
+
export interface CommandErrorDocument {
|
|
22
|
+
status: 'error';
|
|
23
|
+
error: string;
|
|
24
|
+
duration: string;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Report an unexpected failure on stderr and return the document that describes
|
|
28
|
+
* it, WITHOUT deciding how the caller ends.
|
|
29
|
+
*
|
|
30
|
+
* Split out of {@link handleCommandError} because the same failure now has two
|
|
31
|
+
* endings and must not grow two policies. A command run from the command line
|
|
32
|
+
* writes this document to stdout and exits 2; the same command run as a phase of
|
|
33
|
+
* `vat validate` / `vat verify` / `vat build` runs in the orchestrator's own
|
|
34
|
+
* process, where exiting would kill the whole run and skip every later phase —
|
|
35
|
+
* so it hands the document back and the orchestrator nests it under that phase's
|
|
36
|
+
* `report`, exactly as it used to nest the child's captured stdout.
|
|
37
|
+
*
|
|
38
|
+
* The stderr half is identical in both lanes: progress and diagnostics have
|
|
39
|
+
* always streamed live, and that is unchanged by there no longer being a child.
|
|
40
|
+
*
|
|
41
|
+
* @param error - The value that was thrown
|
|
42
|
+
* @param logger - Logger instance for error output
|
|
43
|
+
* @param startTime - Command start time (from Date.now())
|
|
44
|
+
* @param commandName - Name of the command (for the error message)
|
|
45
|
+
*/
|
|
46
|
+
export declare function reportCommandError(error: unknown, logger: Logger, startTime: number, commandName: string): CommandErrorDocument;
|
|
17
47
|
/**
|
|
18
|
-
* Handle command error with standard formatting and exit
|
|
48
|
+
* Handle command error with standard formatting and exit.
|
|
49
|
+
*
|
|
50
|
+
* The command-line ending for {@link reportCommandError}. `ExitCode.ERROR` is
|
|
51
|
+
* the UNEXPECTED failure, per the exit-code contract every command's help documents.
|
|
52
|
+
*
|
|
53
|
+
* 🔑 **`format` is not decoration.** Every command offering `--format json`
|
|
54
|
+
* honoured it on the success path and emitted YAML here, so the one document a
|
|
55
|
+
* CI wrapper most needs to read — the one explaining why the command failed —
|
|
56
|
+
* arrived in a format its parser rejects. A consumer running
|
|
57
|
+
* `vat resources check --format json | jq .error` got a parse error on top of
|
|
58
|
+
* whatever went wrong, and had to guess at the second failure to find the first.
|
|
59
|
+
* A caller that has a `--format` option MUST pass it.
|
|
60
|
+
*
|
|
19
61
|
* @param error - The error that occurred
|
|
20
62
|
* @param logger - Logger instance for error output
|
|
21
63
|
* @param startTime - Command start time (from Date.now())
|
|
22
64
|
* @param commandName - Name of the command (for error message)
|
|
65
|
+
* @param format - What the operator asked for: `json`, or anything else (and
|
|
66
|
+
* omitted) for YAML — matching the success path's own two-branch switch
|
|
67
|
+
*/
|
|
68
|
+
export declare function handleCommandError(error: unknown, logger: Logger, startTime: number, commandName: string, format?: string | undefined): never;
|
|
69
|
+
/**
|
|
70
|
+
* Publish an EXPECTED failure in the format the operator asked for, then exit
|
|
71
|
+
* with the code the command's own contract assigns it.
|
|
72
|
+
*
|
|
73
|
+
* The third ending of one failure, beside {@link handleCommandError} (the
|
|
74
|
+
* UNEXPECTED failure, always `ERROR`) and {@link handleValidationGateFailure}
|
|
75
|
+
* (a validation gate, always `FINDINGS`, always YAML). This one covers the
|
|
76
|
+
* failure that is neither: the command ran, understood the project, and has a
|
|
77
|
+
* documented non-zero code for what it found — `vat ard emit` ending on
|
|
78
|
+
* `FINDINGS` for "this project declares no `ard:` block" or `ERROR` for "there
|
|
79
|
+
* is no config file here".
|
|
80
|
+
*
|
|
81
|
+
* 🔑 It exists because those endings were written inline, and an inline ending
|
|
82
|
+
* publishes nothing: `ard emit` honoured `--format json` on its success path
|
|
83
|
+
* and through `handleCommandError`, then wrote **zero bytes to stdout** on the
|
|
84
|
+
* two exits a repository actually reaches — the commonest being the first run
|
|
85
|
+
* of any repository that never opted into ARD. A CI wrapper reading stdout got
|
|
86
|
+
* an empty document and a bare non-zero code, which is the exact failure the
|
|
87
|
+
* `format` note on {@link handleCommandError} exists to forbid.
|
|
88
|
+
*
|
|
89
|
+
* The message goes to stderr as it always did — humans read it there — and the
|
|
90
|
+
* document goes to stdout, matching what both neighbours already do.
|
|
91
|
+
*
|
|
92
|
+
* @param message - What went wrong, in the command's own words
|
|
93
|
+
* @param exitCode - The code this command's `--help` assigns to this outcome
|
|
94
|
+
* @param startTime - Command start time (from Date.now()), so the document
|
|
95
|
+
* reports the run's real duration rather than a fabricated zero
|
|
96
|
+
* @param format - What the operator asked for: `json`, or anything else (and
|
|
97
|
+
* omitted) for YAML — the same two-branch switch the success path uses
|
|
23
98
|
*/
|
|
24
|
-
export declare function
|
|
99
|
+
export declare function handleExpectedFailure(message: string, exitCode: ExitCodeValue, startTime: number, format?: string | undefined): never;
|
|
100
|
+
/**
|
|
101
|
+
* {@link handleCommandError} for a command whose document is the shared
|
|
102
|
+
* `Report<T>` envelope: the failure document IS the envelope
|
|
103
|
+
* (`buildErrorReport`), so the emitted `schemas/<command>.json` describes the
|
|
104
|
+
* failed run too. Every command registered as `report` in `report-schemas.ts`
|
|
105
|
+
* ends its unexpected failures here; `handleCommandError`'s
|
|
106
|
+
* `CommandErrorDocument` is the shape the legacy documents keep.
|
|
107
|
+
*
|
|
108
|
+
* @param error - The value that was thrown
|
|
109
|
+
* @param logger - Logger instance for error output
|
|
110
|
+
* @param startTime - Command start time (from Date.now())
|
|
111
|
+
* @param commandName - Name of the command (for the stderr line)
|
|
112
|
+
* @param format - What the operator asked for: `json`, or anything else (and
|
|
113
|
+
* omitted) for YAML
|
|
114
|
+
*/
|
|
115
|
+
export declare function handleReportCommandError(error: unknown, logger: Logger, startTime: number, commandName: string, format?: string | undefined): never;
|
|
116
|
+
/**
|
|
117
|
+
* {@link handleExpectedFailure} for a command whose document is the shared
|
|
118
|
+
* `Report<T>` envelope — same document as {@link handleReportCommandError},
|
|
119
|
+
* with the exit code the command's own contract assigns.
|
|
120
|
+
*
|
|
121
|
+
* @param message - What went wrong, in the command's own words
|
|
122
|
+
* @param exitCode - The code this command's `--help` assigns to this outcome
|
|
123
|
+
* @param startTime - Command start time (from Date.now())
|
|
124
|
+
* @param format - What the operator asked for: `json`, or anything else (and
|
|
125
|
+
* omitted) for YAML
|
|
126
|
+
*/
|
|
127
|
+
export declare function handleReportExpectedFailure(message: string, exitCode: ExitCodeValue, startTime: number, format?: string | undefined): never;
|
|
25
128
|
/** The payload a command publishes when its own validation gate stops it. */
|
|
26
129
|
export interface ValidationGateFailure {
|
|
27
130
|
status: 'error';
|
|
@@ -39,9 +142,9 @@ export interface ValidationGateFailure {
|
|
|
39
142
|
export declare function buildValidationGateFailure(subject: string, issues: readonly ValidationIssue[]): ValidationGateFailure;
|
|
40
143
|
/**
|
|
41
144
|
* Publish the documented failure payload for a command stopped by its OWN
|
|
42
|
-
* validation gate, then
|
|
145
|
+
* validation gate, then end on `FINDINGS`.
|
|
43
146
|
*
|
|
44
|
-
* {@link handleCommandError} above covers the UNEXPECTED failure (
|
|
147
|
+
* {@link handleCommandError} above covers the UNEXPECTED failure (`ERROR`). This
|
|
45
148
|
* covers the expected one, and `vat skills build` / `vat skills package` both
|
|
46
149
|
* exited it after writing zero bytes to stdout — while their `--help` texts
|
|
47
150
|
* document a YAML summary on stdout and reserve exit 1 for exactly this case.
|
|
@@ -49,4 +152,38 @@ export declare function buildValidationGateFailure(subject: string, issues: read
|
|
|
49
152
|
* a bare non-zero code.
|
|
50
153
|
*/
|
|
51
154
|
export declare function handleValidationGateFailure(subject: string, issues: readonly ValidationIssue[]): never;
|
|
155
|
+
/**
|
|
156
|
+
* Map a commander termination to the exit code VAT's contract promises.
|
|
157
|
+
*
|
|
158
|
+
* A USAGE mistake — a flag this program does not declare, a verb it does not
|
|
159
|
+
* know, a missing or invalid argument — ends on `ExitCode.ERROR`, and the
|
|
160
|
+
* reason is not style. Commander's default for a usage mistake is
|
|
161
|
+
* `process.exit(1)`, so `vat resources check --json` (the option is
|
|
162
|
+
* `--format json`) exited **1** — which, read against the contract the command
|
|
163
|
+
* itself prints, asserts that at least one check was violated. Nothing had
|
|
164
|
+
* run. A CI wrapper spelled `if [ $? -ne 0 ]; then report_findings` therefore
|
|
165
|
+
* reported findings that were never computed. The same hole swallowed a
|
|
166
|
+
* mistyped verb (`vat resources chekc`) and every unknown option on every
|
|
167
|
+
* command.
|
|
168
|
+
*
|
|
169
|
+
* Commander reports BOTH successful and failing terminations through the same
|
|
170
|
+
* `CommanderError`: `--help` and `--version` carry `exitCode` 0, while an
|
|
171
|
+
* unknown option, an unknown command and `help({ error: true })` carry non-zero.
|
|
172
|
+
* Anything non-zero is a usage mistake by construction — commander raises these
|
|
173
|
+
* only while parsing, before any action runs — so it maps to `ERROR`.
|
|
174
|
+
*
|
|
175
|
+
* ⚠️ **Help and `--version` are NOT usage mistakes.** They terminate through
|
|
176
|
+
* the same `_exit` path with code 0 and must stay `OK`; only a non-zero
|
|
177
|
+
* commander ending is remapped.
|
|
178
|
+
*
|
|
179
|
+
* 🪤 Do NOT switch on `error.code` (`commander.unknownOption`, `commander.help`,
|
|
180
|
+
* …). The unknown-COMMAND path arrives as `commander.help` with exitCode 1,
|
|
181
|
+
* because the `command:*` handler renders help with `{ error: true }` — so the
|
|
182
|
+
* code string says "help" for a case that is emphatically not one. The exit
|
|
183
|
+
* code commander already computed is the honest discriminator; the string is not.
|
|
184
|
+
*
|
|
185
|
+
* @param commanderExitCode - The `exitCode` commander put on its CommanderError
|
|
186
|
+
* @returns `OK` for a successful ending, `ERROR` otherwise
|
|
187
|
+
*/
|
|
188
|
+
export declare function exitCodeForCommanderEnding(commanderExitCode: number): ExitCodeValue;
|
|
52
189
|
//# sourceMappingURL=command-error.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"command-error.d.ts","sourceRoot":"","sources":["../../src/utils/command-error.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file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CAGP;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,2BAA2B,CACzC,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,aAAa,EACvB,SAAS,EAAE,MAAM,EACjB,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,GAC1B,KAAK,CAGP;AAED,6EAA6E;AAC7E,MAAM,WAAW,qBAAqB;IACpC,MAAM,EAAE,OAAO,CAAC;IAChB,WAAW,EAAE,cAAc,CAAC;IAC5B,iFAAiF;IACjF,KAAK,EAAE,MAAM,CAAC;CACf;AAED;;;;;;GAMG;AACH,wBAAgB,0BAA0B,CACxC,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,SAAS,eAAe,EAAE,GACjC,qBAAqB,CAEvB;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,2BAA2B,CACzC,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,SAAS,eAAe,EAAE,GACjC,KAAK,CAGP;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,wBAAgB,0BAA0B,CAAC,iBAAiB,EAAE,MAAM,GAAG,aAAa,CAEnF"}
|
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Shared command error handling utilities.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
4
|
+
* The failure endings a command may take, each publishing a document and
|
|
5
|
+
* ending on one member of the `ExitCode` contract. `commands/skills/` used to
|
|
5
6
|
* carry its own `handleCommandError` that logged to stderr and exited 2 having
|
|
6
7
|
* written nothing to stdout — same name, same signature, same documented
|
|
7
|
-
* contract, silently different behaviour.
|
|
8
|
+
* contract, silently different behaviour. A command that ends some other way
|
|
9
|
+
* still names its code from `ExitCode`; the lint rule
|
|
10
|
+
* `no-literal-process-exit` refuses a bare number.
|
|
8
11
|
*/
|
|
9
|
-
import { countBySeverity } from '@vibe-agent-toolkit/
|
|
10
|
-
import { writeYamlOutput } from './output.js';
|
|
12
|
+
import { ExitCode, buildErrorReport, countBySeverity, errorDiagnostics } from '@vibe-agent-toolkit/schema';
|
|
13
|
+
import { writeJsonOutput, writeYamlOutput } from './output.js';
|
|
11
14
|
/**
|
|
12
15
|
* Format duration for human readability
|
|
13
16
|
* @param ms - Duration in milliseconds
|
|
@@ -23,21 +26,145 @@ export function formatDuration(ms) {
|
|
|
23
26
|
return `${(ms / 60000).toFixed(1)}m`;
|
|
24
27
|
}
|
|
25
28
|
/**
|
|
26
|
-
*
|
|
29
|
+
* Report an unexpected failure on stderr and return the document that describes
|
|
30
|
+
* it, WITHOUT deciding how the caller ends.
|
|
31
|
+
*
|
|
32
|
+
* Split out of {@link handleCommandError} because the same failure now has two
|
|
33
|
+
* endings and must not grow two policies. A command run from the command line
|
|
34
|
+
* writes this document to stdout and exits 2; the same command run as a phase of
|
|
35
|
+
* `vat validate` / `vat verify` / `vat build` runs in the orchestrator's own
|
|
36
|
+
* process, where exiting would kill the whole run and skip every later phase —
|
|
37
|
+
* so it hands the document back and the orchestrator nests it under that phase's
|
|
38
|
+
* `report`, exactly as it used to nest the child's captured stdout.
|
|
39
|
+
*
|
|
40
|
+
* The stderr half is identical in both lanes: progress and diagnostics have
|
|
41
|
+
* always streamed live, and that is unchanged by there no longer being a child.
|
|
42
|
+
*
|
|
43
|
+
* @param error - The value that was thrown
|
|
44
|
+
* @param logger - Logger instance for error output
|
|
45
|
+
* @param startTime - Command start time (from Date.now())
|
|
46
|
+
* @param commandName - Name of the command (for the error message)
|
|
47
|
+
*/
|
|
48
|
+
export function reportCommandError(error, logger, startTime, commandName) {
|
|
49
|
+
const duration = Date.now() - startTime;
|
|
50
|
+
const message = error instanceof Error ? error.message : 'Unknown error';
|
|
51
|
+
logger.error(`${commandName} failed: ${message}`);
|
|
52
|
+
logger.debug(errorDiagnostics(error));
|
|
53
|
+
return { status: 'error', error: message, duration: formatDuration(duration) };
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Handle command error with standard formatting and exit.
|
|
57
|
+
*
|
|
58
|
+
* The command-line ending for {@link reportCommandError}. `ExitCode.ERROR` is
|
|
59
|
+
* the UNEXPECTED failure, per the exit-code contract every command's help documents.
|
|
60
|
+
*
|
|
61
|
+
* 🔑 **`format` is not decoration.** Every command offering `--format json`
|
|
62
|
+
* honoured it on the success path and emitted YAML here, so the one document a
|
|
63
|
+
* CI wrapper most needs to read — the one explaining why the command failed —
|
|
64
|
+
* arrived in a format its parser rejects. A consumer running
|
|
65
|
+
* `vat resources check --format json | jq .error` got a parse error on top of
|
|
66
|
+
* whatever went wrong, and had to guess at the second failure to find the first.
|
|
67
|
+
* A caller that has a `--format` option MUST pass it.
|
|
68
|
+
*
|
|
27
69
|
* @param error - The error that occurred
|
|
28
70
|
* @param logger - Logger instance for error output
|
|
29
71
|
* @param startTime - Command start time (from Date.now())
|
|
30
72
|
* @param commandName - Name of the command (for error message)
|
|
73
|
+
* @param format - What the operator asked for: `json`, or anything else (and
|
|
74
|
+
* omitted) for YAML — matching the success path's own two-branch switch
|
|
31
75
|
*/
|
|
32
|
-
export function handleCommandError(error, logger, startTime, commandName) {
|
|
33
|
-
const
|
|
34
|
-
|
|
35
|
-
|
|
76
|
+
export function handleCommandError(error, logger, startTime, commandName, format) {
|
|
77
|
+
const document = reportCommandError(error, logger, startTime, commandName);
|
|
78
|
+
return publishFailure(document, format, ExitCode.ERROR);
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Publish an EXPECTED failure in the format the operator asked for, then exit
|
|
82
|
+
* with the code the command's own contract assigns it.
|
|
83
|
+
*
|
|
84
|
+
* The third ending of one failure, beside {@link handleCommandError} (the
|
|
85
|
+
* UNEXPECTED failure, always `ERROR`) and {@link handleValidationGateFailure}
|
|
86
|
+
* (a validation gate, always `FINDINGS`, always YAML). This one covers the
|
|
87
|
+
* failure that is neither: the command ran, understood the project, and has a
|
|
88
|
+
* documented non-zero code for what it found — `vat ard emit` ending on
|
|
89
|
+
* `FINDINGS` for "this project declares no `ard:` block" or `ERROR` for "there
|
|
90
|
+
* is no config file here".
|
|
91
|
+
*
|
|
92
|
+
* 🔑 It exists because those endings were written inline, and an inline ending
|
|
93
|
+
* publishes nothing: `ard emit` honoured `--format json` on its success path
|
|
94
|
+
* and through `handleCommandError`, then wrote **zero bytes to stdout** on the
|
|
95
|
+
* two exits a repository actually reaches — the commonest being the first run
|
|
96
|
+
* of any repository that never opted into ARD. A CI wrapper reading stdout got
|
|
97
|
+
* an empty document and a bare non-zero code, which is the exact failure the
|
|
98
|
+
* `format` note on {@link handleCommandError} exists to forbid.
|
|
99
|
+
*
|
|
100
|
+
* The message goes to stderr as it always did — humans read it there — and the
|
|
101
|
+
* document goes to stdout, matching what both neighbours already do.
|
|
102
|
+
*
|
|
103
|
+
* @param message - What went wrong, in the command's own words
|
|
104
|
+
* @param exitCode - The code this command's `--help` assigns to this outcome
|
|
105
|
+
* @param startTime - Command start time (from Date.now()), so the document
|
|
106
|
+
* reports the run's real duration rather than a fabricated zero
|
|
107
|
+
* @param format - What the operator asked for: `json`, or anything else (and
|
|
108
|
+
* omitted) for YAML — the same two-branch switch the success path uses
|
|
109
|
+
*/
|
|
110
|
+
export function handleExpectedFailure(message, exitCode, startTime, format) {
|
|
111
|
+
process.stderr.write(`${message}\n`);
|
|
112
|
+
const document = {
|
|
36
113
|
status: 'error',
|
|
37
|
-
error:
|
|
38
|
-
duration: formatDuration(
|
|
39
|
-
}
|
|
40
|
-
|
|
114
|
+
error: message,
|
|
115
|
+
duration: formatDuration(Date.now() - startTime),
|
|
116
|
+
};
|
|
117
|
+
return publishFailure(document, format, exitCode);
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Publish a failure document in the operator's format, then end on `exitCode`.
|
|
121
|
+
*
|
|
122
|
+
* @param document - What to write to stdout
|
|
123
|
+
* @param format - `json`, or anything else (and omitted) for YAML
|
|
124
|
+
* @param exitCode - The member of the contract this ending is
|
|
125
|
+
*/
|
|
126
|
+
function publishFailure(document, format, exitCode) {
|
|
127
|
+
if (format === 'json') {
|
|
128
|
+
writeJsonOutput(document);
|
|
129
|
+
}
|
|
130
|
+
else {
|
|
131
|
+
writeYamlOutput(document);
|
|
132
|
+
}
|
|
133
|
+
process.exit(exitCode);
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* {@link handleCommandError} for a command whose document is the shared
|
|
137
|
+
* `Report<T>` envelope: the failure document IS the envelope
|
|
138
|
+
* (`buildErrorReport`), so the emitted `schemas/<command>.json` describes the
|
|
139
|
+
* failed run too. Every command registered as `report` in `report-schemas.ts`
|
|
140
|
+
* ends its unexpected failures here; `handleCommandError`'s
|
|
141
|
+
* `CommandErrorDocument` is the shape the legacy documents keep.
|
|
142
|
+
*
|
|
143
|
+
* @param error - The value that was thrown
|
|
144
|
+
* @param logger - Logger instance for error output
|
|
145
|
+
* @param startTime - Command start time (from Date.now())
|
|
146
|
+
* @param commandName - Name of the command (for the stderr line)
|
|
147
|
+
* @param format - What the operator asked for: `json`, or anything else (and
|
|
148
|
+
* omitted) for YAML
|
|
149
|
+
*/
|
|
150
|
+
export function handleReportCommandError(error, logger, startTime, commandName, format) {
|
|
151
|
+
const { error: message } = reportCommandError(error, logger, startTime, commandName);
|
|
152
|
+
return publishFailure(buildErrorReport(message, Date.now() - startTime), format, ExitCode.ERROR);
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* {@link handleExpectedFailure} for a command whose document is the shared
|
|
156
|
+
* `Report<T>` envelope — same document as {@link handleReportCommandError},
|
|
157
|
+
* with the exit code the command's own contract assigns.
|
|
158
|
+
*
|
|
159
|
+
* @param message - What went wrong, in the command's own words
|
|
160
|
+
* @param exitCode - The code this command's `--help` assigns to this outcome
|
|
161
|
+
* @param startTime - Command start time (from Date.now())
|
|
162
|
+
* @param format - What the operator asked for: `json`, or anything else (and
|
|
163
|
+
* omitted) for YAML
|
|
164
|
+
*/
|
|
165
|
+
export function handleReportExpectedFailure(message, exitCode, startTime, format) {
|
|
166
|
+
process.stderr.write(`${message}\n`);
|
|
167
|
+
return publishFailure(buildErrorReport(message, Date.now() - startTime), format, exitCode);
|
|
41
168
|
}
|
|
42
169
|
/**
|
|
43
170
|
* Pure: the document {@link handleValidationGateFailure} writes.
|
|
@@ -51,9 +178,9 @@ export function buildValidationGateFailure(subject, issues) {
|
|
|
51
178
|
}
|
|
52
179
|
/**
|
|
53
180
|
* Publish the documented failure payload for a command stopped by its OWN
|
|
54
|
-
* validation gate, then
|
|
181
|
+
* validation gate, then end on `FINDINGS`.
|
|
55
182
|
*
|
|
56
|
-
* {@link handleCommandError} above covers the UNEXPECTED failure (
|
|
183
|
+
* {@link handleCommandError} above covers the UNEXPECTED failure (`ERROR`). This
|
|
57
184
|
* covers the expected one, and `vat skills build` / `vat skills package` both
|
|
58
185
|
* exited it after writing zero bytes to stdout — while their `--help` texts
|
|
59
186
|
* document a YAML summary on stdout and reserve exit 1 for exactly this case.
|
|
@@ -62,6 +189,42 @@ export function buildValidationGateFailure(subject, issues) {
|
|
|
62
189
|
*/
|
|
63
190
|
export function handleValidationGateFailure(subject, issues) {
|
|
64
191
|
writeYamlOutput(buildValidationGateFailure(subject, issues));
|
|
65
|
-
process.exit(
|
|
192
|
+
process.exit(ExitCode.FINDINGS);
|
|
193
|
+
}
|
|
194
|
+
/**
|
|
195
|
+
* Map a commander termination to the exit code VAT's contract promises.
|
|
196
|
+
*
|
|
197
|
+
* A USAGE mistake — a flag this program does not declare, a verb it does not
|
|
198
|
+
* know, a missing or invalid argument — ends on `ExitCode.ERROR`, and the
|
|
199
|
+
* reason is not style. Commander's default for a usage mistake is
|
|
200
|
+
* `process.exit(1)`, so `vat resources check --json` (the option is
|
|
201
|
+
* `--format json`) exited **1** — which, read against the contract the command
|
|
202
|
+
* itself prints, asserts that at least one check was violated. Nothing had
|
|
203
|
+
* run. A CI wrapper spelled `if [ $? -ne 0 ]; then report_findings` therefore
|
|
204
|
+
* reported findings that were never computed. The same hole swallowed a
|
|
205
|
+
* mistyped verb (`vat resources chekc`) and every unknown option on every
|
|
206
|
+
* command.
|
|
207
|
+
*
|
|
208
|
+
* Commander reports BOTH successful and failing terminations through the same
|
|
209
|
+
* `CommanderError`: `--help` and `--version` carry `exitCode` 0, while an
|
|
210
|
+
* unknown option, an unknown command and `help({ error: true })` carry non-zero.
|
|
211
|
+
* Anything non-zero is a usage mistake by construction — commander raises these
|
|
212
|
+
* only while parsing, before any action runs — so it maps to `ERROR`.
|
|
213
|
+
*
|
|
214
|
+
* ⚠️ **Help and `--version` are NOT usage mistakes.** They terminate through
|
|
215
|
+
* the same `_exit` path with code 0 and must stay `OK`; only a non-zero
|
|
216
|
+
* commander ending is remapped.
|
|
217
|
+
*
|
|
218
|
+
* 🪤 Do NOT switch on `error.code` (`commander.unknownOption`, `commander.help`,
|
|
219
|
+
* …). The unknown-COMMAND path arrives as `commander.help` with exitCode 1,
|
|
220
|
+
* because the `command:*` handler renders help with `{ error: true }` — so the
|
|
221
|
+
* code string says "help" for a case that is emphatically not one. The exit
|
|
222
|
+
* code commander already computed is the honest discriminator; the string is not.
|
|
223
|
+
*
|
|
224
|
+
* @param commanderExitCode - The `exitCode` commander put on its CommanderError
|
|
225
|
+
* @returns `OK` for a successful ending, `ERROR` otherwise
|
|
226
|
+
*/
|
|
227
|
+
export function exitCodeForCommanderEnding(commanderExitCode) {
|
|
228
|
+
return commanderExitCode === 0 ? ExitCode.OK : ExitCode.ERROR;
|
|
66
229
|
}
|
|
67
230
|
//# sourceMappingURL=command-error.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"command-error.js","sourceRoot":"","sources":["../../src/utils/command-error.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"command-error.js","sourceRoot":"","sources":["../../src/utils/command-error.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAGH,OAAO,EAAE,QAAQ,EAAE,gBAAgB,EAAE,eAAe,EAAE,gBAAgB,EAAiE,MAAM,4BAA4B,CAAC;AAG1K,OAAO,EAAE,eAAe,EAAE,eAAe,EAA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jB,MAA2B;IAE3B,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,OAAO,IAAI,CAAC,CAAC;IACrC,OAAO,cAAc,CAAC,gBAAgB,CAAC,OAAO,EAAE,IAAI,CAAC,GAAG,EAAE,GAAG,SAAS,CAAC,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAC;AAC7F,CAAC;AAUD;;;;;;GAMG;AACH,MAAM,UAAU,0BAA0B,CACxC,OAAe,EACf,MAAkC;IAElC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,WAAW,EAAE,eAAe,CAAC,MAAM,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC;AACnF,CAAC;AAED;;;;;;;;;;GAUG;AACH,MAAM,UAAU,2BAA2B,CACzC,OAAe,EACf,MAAkC;IAElC,eAAe,CAAC,0BAA0B,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC,CAAC;IAC7D,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;AAClC,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,MAAM,UAAU,0BAA0B,CAAC,iBAAyB;IAClE,OAAO,iBAAiB,KAAK,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC;AAChE,CAAC"}
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
* - VAT_TEST_CONFIG: Override config file path for testing (absolute path)
|
|
6
6
|
*/
|
|
7
7
|
import { type ProjectConfig } from '@vibe-agent-toolkit/resources';
|
|
8
|
+
import { VatError } from '@vibe-agent-toolkit/utils';
|
|
8
9
|
/**
|
|
9
10
|
* A `vibe-agent-toolkit.config.yaml` exists but failed to parse or validate.
|
|
10
11
|
*
|
|
@@ -14,7 +15,7 @@ import { type ProjectConfig } from '@vibe-agent-toolkit/resources';
|
|
|
14
15
|
* `vat skill test`) should surface this; a bulk linter (`vat audit`) may catch
|
|
15
16
|
* it and fall back to config-free validation.
|
|
16
17
|
*/
|
|
17
|
-
export declare class ConfigLoadError extends
|
|
18
|
+
export declare class ConfigLoadError extends VatError {
|
|
18
19
|
readonly projectRoot: string;
|
|
19
20
|
constructor(projectRoot: string, cause: unknown);
|
|
20
21
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config-loader.d.ts","sourceRoot":"","sources":["../../src/utils/config-loader.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAKH,OAAO,
|
|
1
|
+
{"version":3,"file":"config-loader.d.ts","sourceRoot":"","sources":["../../src/utils/config-loader.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAKH,OAAO,EAAuD,KAAK,aAAa,EAAE,MAAM,+BAA+B,CAAC;AACxH,OAAO,EAAY,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AAY/D;;;;;;;;GAQG;AACH,qBAAa,eAAgB,SAAQ,QAAQ;IAC3C,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;gBACjB,WAAW,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO;CAKhD;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,UAAU,CAAC,WAAW,EAAE,MAAM,GAAG,aAAa,GAAG,SAAS,CAgDzE;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,CAEvD;AAqBD;;;;;GAKG;AACH,wBAAgB,sBAAsB,IAAI,IAAI,CAM7C;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,gBAAgB,CAAC,WAAW,EAAE,MAAM,GAAG,aAAa,GAAG,SAAS,CAgB/E"}
|
|
@@ -6,10 +6,16 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import { readFileSync, existsSync } from 'node:fs';
|
|
8
8
|
import { dirname } from 'node:path';
|
|
9
|
-
import { ProjectConfigSchema } from '@vibe-agent-toolkit/resources';
|
|
10
|
-
import { safePath } from '@vibe-agent-toolkit/utils';
|
|
9
|
+
import { parseConfigAllowingUnknownKeys, ProjectConfigSchema } from '@vibe-agent-toolkit/resources';
|
|
10
|
+
import { safePath, VatError } from '@vibe-agent-toolkit/utils';
|
|
11
11
|
import * as yaml from 'yaml';
|
|
12
12
|
const CONFIG_FILENAME = 'vibe-agent-toolkit.config.yaml';
|
|
13
|
+
/**
|
|
14
|
+
* Config paths already warned about for unknown keys, so one config governing
|
|
15
|
+
* many skills produces one line rather than one per skill. Cleared with the
|
|
16
|
+
* config cache, which is what a test isolating a fixture resets.
|
|
17
|
+
*/
|
|
18
|
+
const warnedConfigPaths = new Set();
|
|
13
19
|
/**
|
|
14
20
|
* A `vibe-agent-toolkit.config.yaml` exists but failed to parse or validate.
|
|
15
21
|
*
|
|
@@ -19,11 +25,10 @@ const CONFIG_FILENAME = 'vibe-agent-toolkit.config.yaml';
|
|
|
19
25
|
* `vat skill test`) should surface this; a bulk linter (`vat audit`) may catch
|
|
20
26
|
* it and fall back to config-free validation.
|
|
21
27
|
*/
|
|
22
|
-
export class ConfigLoadError extends
|
|
28
|
+
export class ConfigLoadError extends VatError {
|
|
23
29
|
projectRoot;
|
|
24
30
|
constructor(projectRoot, cause) {
|
|
25
|
-
super(cause instanceof Error ? cause.message : String(cause));
|
|
26
|
-
this.name = 'ConfigLoadError';
|
|
31
|
+
super('CONFIG_LOAD', cause instanceof Error ? cause.message : String(cause));
|
|
27
32
|
this.projectRoot = projectRoot;
|
|
28
33
|
if (cause instanceof Error)
|
|
29
34
|
this.cause = cause;
|
|
@@ -53,24 +58,42 @@ export class ConfigLoadError extends Error {
|
|
|
53
58
|
export function loadConfig(projectRoot) {
|
|
54
59
|
// Override for testing: VAT_TEST_CONFIG provides explicit config path
|
|
55
60
|
const configPath = process.env['VAT_TEST_CONFIG'] ?? safePath.join(projectRoot, CONFIG_FILENAME);
|
|
56
|
-
// eslint-disable-next-line security/detect-non-literal-fs-filename -- configPath is derived from projectRoot parameter or env override
|
|
57
61
|
if (!existsSync(configPath)) {
|
|
58
62
|
return undefined;
|
|
59
63
|
}
|
|
60
64
|
try {
|
|
61
|
-
// eslint-disable-next-line security/detect-non-literal-fs-filename -- configPath is derived from projectRoot parameter
|
|
62
65
|
const content = readFileSync(configPath, 'utf-8');
|
|
63
66
|
const parsed = yaml.parse(content);
|
|
64
|
-
// Validate with canonical schema from resources package
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
67
|
+
// Validate with canonical schema from resources package.
|
|
68
|
+
//
|
|
69
|
+
// 🔑 The message comes from the shared formatter, NOT from `error.message`.
|
|
70
|
+
// In Zod 3 that property is a **JSON dump of the issue array**, and it was
|
|
71
|
+
// what an adopter got: five verbs exiting 2 in under a second on a blob that
|
|
72
|
+
// never named this file, never said which key was refused in words, and
|
|
73
|
+
// offered no remedy. Every strict block in the schema is a refusal an
|
|
74
|
+
// adopter has to be able to act on from the terminal alone.
|
|
75
|
+
// An UNKNOWN key warns and is dropped; every other validation failure still
|
|
76
|
+
// throws. See `parseConfigAllowingUnknownKeys` for the reasoning — briefly:
|
|
77
|
+
// a key VAT has no field for is a key VAT was already discarding, and
|
|
78
|
+
// turning that into an exit 2 broke commands that never read the section it
|
|
79
|
+
// was in. Warned once per config path, because `loadConfigCached` will
|
|
80
|
+
// otherwise re-warn for every skill under one project.
|
|
81
|
+
return parseConfigAllowingUnknownKeys(ProjectConfigSchema, parsed, (message) => {
|
|
82
|
+
if (warnedConfigPaths.has(configPath))
|
|
83
|
+
return;
|
|
84
|
+
warnedConfigPaths.add(configPath);
|
|
85
|
+
process.stderr.write(`${message}\n`);
|
|
86
|
+
}, { configPath });
|
|
70
87
|
}
|
|
71
88
|
catch (error) {
|
|
72
89
|
if (error instanceof Error) {
|
|
73
|
-
|
|
90
|
+
// `cause` is load-bearing, not decoration: callers decide whether to
|
|
91
|
+
// degrade or abort by asking `isFilesystemAccessError`, which reads the
|
|
92
|
+
// errno off the error. Re-wrapping without it produced a plain Error with
|
|
93
|
+
// no `code`, so an unreadable config read as "a bug in VAT" and aborted the
|
|
94
|
+
// whole run — the exact failure `vat audit`'s guard exists to prevent,
|
|
95
|
+
// reintroduced by a message-formatting layer.
|
|
96
|
+
throw new Error(`Failed to load config: ${error.message}`, { cause: error });
|
|
74
97
|
}
|
|
75
98
|
throw error;
|
|
76
99
|
}
|
|
@@ -107,6 +130,9 @@ const loadErrorCache = new Map();
|
|
|
107
130
|
export function resetLoadedConfigCache() {
|
|
108
131
|
loadedConfigCache.clear();
|
|
109
132
|
loadErrorCache.clear();
|
|
133
|
+
// The warn-once ledger is part of this cache's state: a test that resets the
|
|
134
|
+
// caches and re-loads the same fixture expects to see the warning again.
|
|
135
|
+
warnedConfigPaths.clear();
|
|
110
136
|
}
|
|
111
137
|
/**
|
|
112
138
|
* Cached variant of {@link loadConfig} keyed by `projectRoot`.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config-loader.js","sourceRoot":"","sources":["../../src/utils/config-loader.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,OAAO,EAAE,mBAAmB,EAAsB,MAAM,+BAA+B,CAAC;
|
|
1
|
+
{"version":3,"file":"config-loader.js","sourceRoot":"","sources":["../../src/utils/config-loader.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,OAAO,EAAE,8BAA8B,EAAE,mBAAmB,EAAsB,MAAM,+BAA+B,CAAC;AACxH,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AAC/D,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAE7B,MAAM,eAAe,GAAG,gCAA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IAClD,IAAI,MAAM,KAAK,SAAS;QAAE,OAAO,MAAM,IAAI,SAAS,CAAC;IACrD,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,UAAU,CAAC,WAAW,CAAC,CAAC;QACvC,iBAAiB,CAAC,GAAG,CAAC,WAAW,EAAE,MAAM,IAAI,IAAI,CAAC,CAAC;QACnD,OAAO,MAAM,CAAC;IAChB,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,4EAA4E;QAC5E,8EAA8E;QAC9E,MAAM,SAAS,GAAG,GAAG,YAAY,eAAe,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,eAAe,CAAC,WAAW,EAAE,GAAG,CAAC,CAAC;QAC/F,cAAc,CAAC,GAAG,CAAC,WAAW,EAAE,SAAS,CAAC,CAAC;QAC3C,MAAM,SAAS,CAAC;IAClB,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Resolving a command-line path argument into a target INSIDE a corpus root.
|
|
3
|
+
*
|
|
4
|
+
* Shared by every command that populates one tree and then answers questions
|
|
5
|
+
* about positions in it — `vat claude context` and `vat claude budget` today.
|
|
6
|
+
* They ask different questions and default differently when no path is named,
|
|
7
|
+
* but "is this argument inside the tree I enumerated, and what is it called
|
|
8
|
+
* there" is one rule. The predicate itself is `relativeEscapesRoot` from
|
|
9
|
+
* `@vibe-agent-toolkit/utils` — the one lexical classifier every lane shares,
|
|
10
|
+
* so the clause that only fails on Windows (a cross-drive `relative()` comes
|
|
11
|
+
* back ABSOLUTE, not `..`-prefixed) is tested once, there, with the string
|
|
12
|
+
* Windows really produces.
|
|
13
|
+
*/
|
|
14
|
+
/**
|
|
15
|
+
* The root-relative path to query, refusing anything outside the corpus.
|
|
16
|
+
*
|
|
17
|
+
* @param root - The discovered project root
|
|
18
|
+
* @param pathArg - The path argument, or undefined for the current directory
|
|
19
|
+
* @param commandName - The command saying so, for the refusal's wording
|
|
20
|
+
* @returns The root-relative, forward-slashed target. `''` is the corpus root
|
|
21
|
+
* @throws When the argument resolves outside `root` — answering for it would
|
|
22
|
+
* mean querying a corpus this projection never enumerated, and a confident
|
|
23
|
+
* "nothing here" would be indistinguishable from a typo inside the tree
|
|
24
|
+
*/
|
|
25
|
+
export declare function targetPathWithin(root: string, pathArg: string | undefined, commandName: string): string;
|
|
26
|
+
//# sourceMappingURL=corpus-target.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"corpus-target.d.ts","sourceRoot":"","sources":["../../src/utils/corpus-target.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAIH;;;;;;;;;;GAUG;AACH,wBAAgB,gBAAgB,CAC9B,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,MAAM,GAAG,SAAS,EAC3B,WAAW,EAAE,MAAM,GAClB,MAAM,CAUR"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Resolving a command-line path argument into a target INSIDE a corpus root.
|
|
3
|
+
*
|
|
4
|
+
* Shared by every command that populates one tree and then answers questions
|
|
5
|
+
* about positions in it — `vat claude context` and `vat claude budget` today.
|
|
6
|
+
* They ask different questions and default differently when no path is named,
|
|
7
|
+
* but "is this argument inside the tree I enumerated, and what is it called
|
|
8
|
+
* there" is one rule. The predicate itself is `relativeEscapesRoot` from
|
|
9
|
+
* `@vibe-agent-toolkit/utils` — the one lexical classifier every lane shares,
|
|
10
|
+
* so the clause that only fails on Windows (a cross-drive `relative()` comes
|
|
11
|
+
* back ABSOLUTE, not `..`-prefixed) is tested once, there, with the string
|
|
12
|
+
* Windows really produces.
|
|
13
|
+
*/
|
|
14
|
+
import { relativeEscapesRoot, safePath } from '@vibe-agent-toolkit/utils';
|
|
15
|
+
/**
|
|
16
|
+
* The root-relative path to query, refusing anything outside the corpus.
|
|
17
|
+
*
|
|
18
|
+
* @param root - The discovered project root
|
|
19
|
+
* @param pathArg - The path argument, or undefined for the current directory
|
|
20
|
+
* @param commandName - The command saying so, for the refusal's wording
|
|
21
|
+
* @returns The root-relative, forward-slashed target. `''` is the corpus root
|
|
22
|
+
* @throws When the argument resolves outside `root` — answering for it would
|
|
23
|
+
* mean querying a corpus this projection never enumerated, and a confident
|
|
24
|
+
* "nothing here" would be indistinguishable from a typo inside the tree
|
|
25
|
+
*/
|
|
26
|
+
export function targetPathWithin(root, pathArg, commandName) {
|
|
27
|
+
const relative = safePath.relative(root, safePath.resolve(process.cwd(), pathArg ?? '.'));
|
|
28
|
+
if (relativeEscapesRoot(relative)) {
|
|
29
|
+
throw new Error(`${pathArg ?? process.cwd()} resolves outside the corpus root ${root}.`
|
|
30
|
+
+ ` ${commandName} answers only for paths inside the root it discovered —`
|
|
31
|
+
+ ' run it from within the project you mean to ask about.');
|
|
32
|
+
}
|
|
33
|
+
return relative;
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=corpus-target.js.map
|