@vibe-agent-toolkit/cli 0.2.0-rc.1 → 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 +115 -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 +2 -2
- package/dist/commands/audit/distributed-tree.d.ts.map +1 -1
- package/dist/commands/audit/distributed-tree.js +11 -7
- 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 +1126 -394
- 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 +34 -6
- package/dist/commands/cache/clear.d.ts.map +1 -1
- package/dist/commands/cache/clear.js +101 -15
- package/dist/commands/cache/clear.js.map +1 -1
- package/dist/commands/cache/index.d.ts +13 -63
- package/dist/commands/cache/index.d.ts.map +1 -1
- package/dist/commands/cache/index.js +47 -79
- package/dist/commands/cache/index.js.map +1 -1
- 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 +121 -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 +418 -4
- 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 +42 -2
- package/dist/commands/resources/validate.d.ts.map +1 -1
- package/dist/commands/resources/validate.js +208 -55
- 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 +1 -1
- package/dist/commands/skills/package.d.ts.map +1 -1
- package/dist/commands/skills/package.js +6 -8
- 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 +61 -11
- 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 +138 -20
- package/dist/utils/command-error.d.ts.map +1 -1
- package/dist/utils/command-error.js +172 -36
- 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 +19 -11
- 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 +35 -26
- 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,86 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The root-level `--no-cache` control surface, kept apart from the `cache`
|
|
3
|
+
* command itself.
|
|
4
|
+
*
|
|
5
|
+
* `bin.ts` must call {@link registerCacheControl} on every single invocation,
|
|
6
|
+
* before parsing. Co-locating it with `createCacheCommand` in `index.ts` meant
|
|
7
|
+
* that unavoidable call dragged in `./clear.js` and, behind it, the whole
|
|
8
|
+
* resources package — measured at ~1.2s of module load on Windows, paid even by
|
|
9
|
+
* `vat --version`. This module imports nothing but commander, so the always-on
|
|
10
|
+
* path stays cheap — keep it that way: any import added here is paid by every
|
|
11
|
+
* `vat` invocation, and `index.ts` deliberately does not re-export it, so
|
|
12
|
+
* reaching these functions through the command group cannot happen by accident.
|
|
13
|
+
*/
|
|
14
|
+
/**
|
|
15
|
+
* Register the root-level `--no-cache` flag and the hook that gives it effect.
|
|
16
|
+
*
|
|
17
|
+
* ## Why this sets an environment variable instead of plumbing a flag
|
|
18
|
+
*
|
|
19
|
+
* ⚠️ The ORIGINAL reason has expired, and saying so is the point of this note.
|
|
20
|
+
* It was that `vat validate` / `vat verify` / `vat build` enumerated nothing in
|
|
21
|
+
* their own process — each `spawnSync`ed the vat binary once per phase, so a
|
|
22
|
+
* flag parsed in the parent never reached the process doing the parsing, while
|
|
23
|
+
* `process.env` crossed the boundary for free. Phases run in this process now,
|
|
24
|
+
* so that argument no longer holds.
|
|
25
|
+
*
|
|
26
|
+
* What still holds is narrower but sufficient: the flag has to reach code that
|
|
27
|
+
* no CLI option is threaded through. `ParseCache` is constructed deep inside
|
|
28
|
+
* `@vibe-agent-toolkit/resources`, by callers several layers below any command,
|
|
29
|
+
* and `bin.ts` leans on the same mechanism for `VAT_CONTEXT` /
|
|
30
|
+
* `VAT_CONTEXT_PATH`. Plumbing a `noCache` parameter down every one of those
|
|
31
|
+
* call chains is the alternative, and it is a real one — this is now a choice
|
|
32
|
+
* rather than a necessity, so treat it as revisitable rather than as settled.
|
|
33
|
+
*
|
|
34
|
+
* `VAT_CACHE=0` is read by `ParseCache` (packages/resources/src/parse-cache.ts)
|
|
35
|
+
* per construction, never at module load, so setting it from a `preAction` hook
|
|
36
|
+
* — after Commander has parsed, before any command body runs — is observed by
|
|
37
|
+
* every phase, all of which now start after that hook has run.
|
|
38
|
+
*
|
|
39
|
+
* ## The collision with `vat resources validate --no-cache`
|
|
40
|
+
*
|
|
41
|
+
* This root program does NOT use `enablePositionalOptions()`, so Commander scans
|
|
42
|
+
* the WHOLE argv for root options, including everything after the subcommand
|
|
43
|
+
* name. That is the same mechanism that let a root `-v` shadow the subcommands'
|
|
44
|
+
* own `-v, --verbose` (see the incident recorded in `bin.ts`). Measured against
|
|
45
|
+
* commander 12: `vat resources validate docs --no-cache` leaves the ROOT with
|
|
46
|
+
* `cache: false` and the SUBCOMMAND with `cache: true` — the subcommand's
|
|
47
|
+
* identically-named flag is swallowed before it ever sees it, which would have
|
|
48
|
+
* silently re-enabled the external-URL cache the flag exists to bypass.
|
|
49
|
+
*
|
|
50
|
+
* Rather than break a shipped flag, the hook hands the value back down to
|
|
51
|
+
* whichever action command declares a `cache` option of its own. `--no-cache` is
|
|
52
|
+
* a superset — every cache off — so the handoff is a strengthening, never a
|
|
53
|
+
* reversal.
|
|
54
|
+
*
|
|
55
|
+
* @param program - The root program to register the flag and hook on
|
|
56
|
+
*/
|
|
57
|
+
export function registerCacheControl(program) {
|
|
58
|
+
program.option('--no-cache', "Disable VAT's disk caches for this run (every phase included)");
|
|
59
|
+
program.hook('preAction', (_thisCommand, actionCommand) => {
|
|
60
|
+
applyCacheControl(program.opts(), actionCommand);
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Apply the root `--no-cache` decision: export it to child processes, and hand
|
|
65
|
+
* it down to an action command that declares its own `cache` option.
|
|
66
|
+
*
|
|
67
|
+
* Exported so a test can drive it from real parsed options rather than from a
|
|
68
|
+
* hand-built bag. Deliberately does nothing when the flag was not passed — a
|
|
69
|
+
* toggle that writes `VAT_CACHE=1` by default would be indistinguishable from
|
|
70
|
+
* one that is always on.
|
|
71
|
+
*
|
|
72
|
+
* @param rootOptions - Options bag from the ROOT program
|
|
73
|
+
* @param actionCommand - The command whose action is about to run
|
|
74
|
+
*/
|
|
75
|
+
export function applyCacheControl(rootOptions, actionCommand) {
|
|
76
|
+
if (rootOptions.cache !== false)
|
|
77
|
+
return;
|
|
78
|
+
process.env['VAT_CACHE'] = '0';
|
|
79
|
+
// `attributeName()`, not `name()`: for `--no-cache` the latter returns
|
|
80
|
+
// 'no-cache', so a check written against it never matches and the handoff
|
|
81
|
+
// above becomes a no-op that looks like it works.
|
|
82
|
+
if (actionCommand.options.some((option) => option.attributeName() === 'cache')) {
|
|
83
|
+
actionCommand.setOptionValue('cache', false);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
//# sourceMappingURL=cache-control.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cache-control.js","sourceRoot":"","sources":["../../../src/commands/cache/cache-control.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAeH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AACH,MAAM,UAAU,oBAAoB,CAAC,OAAgB;IACnD,OAAO,CAAC,MAAM,CAAC,YAAY,EAAE,+DAA+D,CAAC,CAAC;IAE9F,OAAO,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,YAAY,EAAE,aAAa,EAAE,EAAE;QACxD,iBAAiB,CAAC,OAAO,CAAC,IAAI,EAAuB,EAAE,aAAa,CAAC,CAAC;IACxE,CAAC,CAAC,CAAC;AACL,CAAC;AAED;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,iBAAiB,CAAC,WAAgC,EAAE,aAAsB;IACxF,IAAI,WAAW,CAAC,KAAK,KAAK,KAAK;QAAE,OAAO;IAExC,OAAO,CAAC,GAAG,CAAC,WAAW,CAAC,GAAG,GAAG,CAAC;IAE/B,uEAAuE;IACvE,0EAA0E;IAC1E,kDAAkD;IAClD,IAAI,aAAa,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,aAAa,EAAE,KAAK,OAAO,CAAC,EAAE,CAAC;QAC/E,aAAa,CAAC,cAAc,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;IAC/C,CAAC;AACH,CAAC"}
|
|
@@ -6,20 +6,48 @@
|
|
|
6
6
|
* described in prose. This is that path, named once.
|
|
7
7
|
*
|
|
8
8
|
* Scope is the WHOLE `<tmpdir>/.vat-cache/` tree, not just the parse tenant.
|
|
9
|
-
* That directory is shared — `external-links.json`, `auth-<user
|
|
10
|
-
* all live under it — and
|
|
11
|
-
* the
|
|
9
|
+
* That directory is shared — `external-links.json`, `auth-<user>/`, `parse/` and
|
|
10
|
+
* `<namespace>/projection-<shapeDigest>/projection.db` all live under it — and
|
|
11
|
+
* "clear the cache" cannot honestly mean "clear one of the four". All of them
|
|
12
|
+
* are disposable by construction.
|
|
13
|
+
*
|
|
14
|
+
* 🔑 **The projection store is the one that makes this command matter, and it is
|
|
15
|
+
* covered by SCOPE rather than by a clause about it.** `defaultStoreDirectory()`
|
|
16
|
+
* resolves through `vatCacheNamespaceRoot()`, so it is already inside the tree
|
|
17
|
+
* this removes; the tenant list above is the only thing that has to keep up. It
|
|
18
|
+
* is also by far the largest tenant (71 MB for one 12,602-file tree) and is on
|
|
19
|
+
* by DEFAULT, which is why reclaiming it had to be invocable before the flip.
|
|
20
|
+
*
|
|
21
|
+
* ⚠️ A store relocated with `VAT_PROJECTION_STORE_DIR` is outside this tree and
|
|
22
|
+
* is NOT removed — the variable names a directory this command was never told
|
|
23
|
+
* about, and a clear that hunted for stores by shape would delete directories
|
|
24
|
+
* the operator chose. Stated so nobody reads a clean `bytesRemoved` as "every
|
|
25
|
+
* store is gone".
|
|
12
26
|
*/
|
|
13
27
|
export interface CacheClearOptions {
|
|
14
28
|
debug?: boolean;
|
|
15
29
|
}
|
|
16
|
-
/**
|
|
30
|
+
/**
|
|
31
|
+
* What a clear did, as published on stdout.
|
|
32
|
+
*
|
|
33
|
+
* `partial` is not a failure mode bolted on — it is the *common* outcome when
|
|
34
|
+
* something else on the machine is writing to the shared tree, and it has to be
|
|
35
|
+
* reportable. A recursive delete that gives up part-way has already removed most
|
|
36
|
+
* of the cache; surfacing that as a bare thrown error told the operator only
|
|
37
|
+
* that the command failed, while leaving them to guess how much of their cache
|
|
38
|
+
* still existed. An honest count of what went and what stayed is the whole
|
|
39
|
+
* point of a report.
|
|
40
|
+
*/
|
|
17
41
|
export interface CacheClearReport {
|
|
18
|
-
status: 'success';
|
|
42
|
+
status: 'success' | 'partial';
|
|
19
43
|
cacheDir: string;
|
|
20
44
|
existed: boolean;
|
|
21
|
-
/** Top-level entries that
|
|
45
|
+
/** Top-level entries that are gone, sorted. Empty when nothing was there. */
|
|
22
46
|
removed: string[];
|
|
47
|
+
/** Top-level entries that survived a partial clear, sorted. Absent on success. */
|
|
48
|
+
remaining?: string[];
|
|
49
|
+
/** Why the delete stopped short. Absent on success. */
|
|
50
|
+
reason?: string;
|
|
23
51
|
entriesRemoved: number;
|
|
24
52
|
bytesRemoved: number;
|
|
25
53
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"clear.d.ts","sourceRoot":"","sources":["../../../src/commands/cache/clear.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"clear.d.ts","sourceRoot":"","sources":["../../../src/commands/cache/clear.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAgBH,MAAM,WAAW,iBAAiB;IAChC,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED;;;;;;;;;;GAUG;AACH,MAAM,WAAW,gBAAgB;IAC/B,MAAM,EAAE,SAAS,GAAG,SAAS,CAAC;IAC9B,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,OAAO,CAAC;IACjB,6EAA6E;IAC7E,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,kFAAkF;IAClF,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;IACrB,uDAAuD;IACvD,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,cAAc,EAAE,MAAM,CAAC;IACvB,YAAY,EAAE,MAAM,CAAC;CACtB;AA4BD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,wBAAgB,YAAY,IAAI,MAAM,CAcrC;AAED;;;;;;;;;;;;GAYG;AACH,wBAAsB,mBAAmB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAwBrF;AA+CD;;;;GAIG;AACH,wBAAsB,iBAAiB,CAAC,OAAO,GAAE,iBAAsB,GAAG,OAAO,CAAC,IAAI,CAAC,CAiBtF"}
|
|
@@ -6,20 +6,53 @@
|
|
|
6
6
|
* described in prose. This is that path, named once.
|
|
7
7
|
*
|
|
8
8
|
* Scope is the WHOLE `<tmpdir>/.vat-cache/` tree, not just the parse tenant.
|
|
9
|
-
* That directory is shared — `external-links.json`, `auth-<user
|
|
10
|
-
* all live under it — and
|
|
11
|
-
* the
|
|
9
|
+
* That directory is shared — `external-links.json`, `auth-<user>/`, `parse/` and
|
|
10
|
+
* `<namespace>/projection-<shapeDigest>/projection.db` all live under it — and
|
|
11
|
+
* "clear the cache" cannot honestly mean "clear one of the four". All of them
|
|
12
|
+
* are disposable by construction.
|
|
13
|
+
*
|
|
14
|
+
* 🔑 **The projection store is the one that makes this command matter, and it is
|
|
15
|
+
* covered by SCOPE rather than by a clause about it.** `defaultStoreDirectory()`
|
|
16
|
+
* resolves through `vatCacheNamespaceRoot()`, so it is already inside the tree
|
|
17
|
+
* this removes; the tenant list above is the only thing that has to keep up. It
|
|
18
|
+
* is also by far the largest tenant (71 MB for one 12,602-file tree) and is on
|
|
19
|
+
* by DEFAULT, which is why reclaiming it had to be invocable before the flip.
|
|
20
|
+
*
|
|
21
|
+
* ⚠️ A store relocated with `VAT_PROJECTION_STORE_DIR` is outside this tree and
|
|
22
|
+
* is NOT removed — the variable names a directory this command was never told
|
|
23
|
+
* about, and a clear that hunted for stores by shape would delete directories
|
|
24
|
+
* the operator chose. Stated so nobody reads a clean `bytesRemoved` as "every
|
|
25
|
+
* store is gone".
|
|
12
26
|
*/
|
|
13
27
|
import { promises as fs } from 'node:fs';
|
|
14
28
|
import { basename, dirname } from 'node:path';
|
|
15
29
|
import { parseCacheDirectory } from '@vibe-agent-toolkit/resources';
|
|
16
|
-
import {
|
|
30
|
+
import { ExitCode } from '@vibe-agent-toolkit/schema';
|
|
31
|
+
import { direntKind, isPathAbsentError, safePath } from '@vibe-agent-toolkit/utils';
|
|
17
32
|
import { handleCommandError } from '../../utils/command-error.js';
|
|
18
33
|
import { createLogger } from '../../utils/logger.js';
|
|
19
34
|
import { writeYamlOutput } from '../../utils/output.js';
|
|
20
35
|
/** The one name the shared cache root is allowed to have. See {@link vatCacheRoot}. */
|
|
21
36
|
const VAT_CACHE_DIR_NAME = '.vat-cache';
|
|
22
37
|
const EMPTY_USAGE = { entries: 0, bytes: 0 };
|
|
38
|
+
/**
|
|
39
|
+
* Retry budget for the recursive delete.
|
|
40
|
+
*
|
|
41
|
+
* Not defensive padding — observed. `<tmpdir>/.vat-cache` is shared by every VAT
|
|
42
|
+
* on the machine: other worktrees, other sessions, and any adopter running an
|
|
43
|
+
* *installed* vat all write into it under their own namespace. A `vat cache
|
|
44
|
+
* clear` issued while one of them is mid-run walks a tree that is growing
|
|
45
|
+
* underneath it and `rmdir` fails `ENOTEMPTY` on a shard that gained a file
|
|
46
|
+
* between the listing and the removal. Reproduced twice against a concurrent
|
|
47
|
+
* `vat verify`; the same command succeeded immediately once that run finished.
|
|
48
|
+
*
|
|
49
|
+
* Node retries exactly this error class (`EBUSY`, `EMFILE`, `ENFILE`,
|
|
50
|
+
* `ENOTEMPTY`, `EPERM`) with a linear backoff, which clears a short overlap.
|
|
51
|
+
* It cannot win against a writer that keeps going for the whole window — that
|
|
52
|
+
* case still surfaces as an error, which is correct: "some of your cache is
|
|
53
|
+
* gone and something is still writing" must not be reported as success.
|
|
54
|
+
*/
|
|
55
|
+
const RM_RETRY = { maxRetries: 5, retryDelay: 100 };
|
|
23
56
|
/**
|
|
24
57
|
* The shared cache root, `<tmpdir>/.vat-cache`.
|
|
25
58
|
*
|
|
@@ -80,16 +113,59 @@ export async function clearCacheDirectory(cacheDir) {
|
|
|
80
113
|
return { status: 'success', cacheDir, existed: false, removed: [], entriesRemoved: 0, bytesRemoved: 0 };
|
|
81
114
|
}
|
|
82
115
|
const usage = await measureEntries(cacheDir, entries);
|
|
83
|
-
|
|
116
|
+
const names = entries.map((entry) => entry.name);
|
|
117
|
+
try {
|
|
118
|
+
await fs.rm(cacheDir, { recursive: true, force: true, ...RM_RETRY });
|
|
119
|
+
}
|
|
120
|
+
catch (error) {
|
|
121
|
+
return partialReport(cacheDir, names, usage, error);
|
|
122
|
+
}
|
|
84
123
|
return {
|
|
85
124
|
status: 'success',
|
|
86
125
|
cacheDir,
|
|
87
126
|
existed: true,
|
|
88
|
-
removed:
|
|
127
|
+
removed: sorted(names),
|
|
89
128
|
entriesRemoved: usage.entries,
|
|
90
129
|
bytesRemoved: usage.bytes,
|
|
91
130
|
};
|
|
92
131
|
}
|
|
132
|
+
/**
|
|
133
|
+
* Describe a delete that stopped part-way, by re-reading the tree.
|
|
134
|
+
*
|
|
135
|
+
* The survivors are read back off disk rather than inferred from the error,
|
|
136
|
+
* because the error names one path and says nothing about the other ninety-nine
|
|
137
|
+
* percent. Re-measuring what remains and subtracting is the only way the counts
|
|
138
|
+
* describe what actually happened rather than what was attempted.
|
|
139
|
+
*
|
|
140
|
+
* A concurrent writer can make the remainder *larger* than the original
|
|
141
|
+
* measurement, so the subtraction is floored at zero: reporting a negative
|
|
142
|
+
* number of removed bytes would be worse than reporting none.
|
|
143
|
+
*
|
|
144
|
+
* @param cacheDir - The tree that was being removed
|
|
145
|
+
* @param names - Top-level entry names as they were before the delete
|
|
146
|
+
* @param before - Usage measured before the delete
|
|
147
|
+
* @param error - Whatever `fs.rm` threw
|
|
148
|
+
* @returns A report naming what went, what stayed, and why
|
|
149
|
+
*/
|
|
150
|
+
async function partialReport(cacheDir, names, before, error) {
|
|
151
|
+
const survivors = (await readdirOrNull(cacheDir)) ?? [];
|
|
152
|
+
const remaining = new Set(survivors.map((entry) => entry.name));
|
|
153
|
+
const after = await measureEntries(cacheDir, survivors);
|
|
154
|
+
return {
|
|
155
|
+
status: 'partial',
|
|
156
|
+
cacheDir,
|
|
157
|
+
existed: true,
|
|
158
|
+
removed: sorted(names.filter((name) => !remaining.has(name))),
|
|
159
|
+
remaining: sorted([...remaining]),
|
|
160
|
+
reason: error instanceof Error ? error.message : String(error),
|
|
161
|
+
entriesRemoved: Math.max(0, before.entries - after.entries),
|
|
162
|
+
bytesRemoved: Math.max(0, before.bytes - after.bytes),
|
|
163
|
+
};
|
|
164
|
+
}
|
|
165
|
+
/** Stable ordering for the reported entry lists. */
|
|
166
|
+
function sorted(names) {
|
|
167
|
+
return [...names].sort((left, right) => left.localeCompare(right));
|
|
168
|
+
}
|
|
93
169
|
/**
|
|
94
170
|
* Command entry point: clear the real cache root and publish the report.
|
|
95
171
|
*
|
|
@@ -102,7 +178,12 @@ export async function cacheClearCommand(options = {}) {
|
|
|
102
178
|
const report = await clearCacheDirectory(vatCacheRoot());
|
|
103
179
|
logger.debug(`Cleared ${String(report.entriesRemoved)} cache entries from ${report.cacheDir}`);
|
|
104
180
|
writeYamlOutput(report);
|
|
105
|
-
|
|
181
|
+
// A partial clear publishes its report and *then* fails. Exiting through
|
|
182
|
+
// `handleCommandError` instead would suppress the report entirely, which is
|
|
183
|
+
// the defect this branch exists to fix: the operator most needs to know how
|
|
184
|
+
// much of the cache survived precisely when the command did not finish.
|
|
185
|
+
// A partial clear is a run that did not finish, not a finding about the tree.
|
|
186
|
+
process.exit(report.status === 'partial' ? ExitCode.ERROR : ExitCode.OK);
|
|
106
187
|
}
|
|
107
188
|
catch (error) {
|
|
108
189
|
handleCommandError(error, logger, startTime, 'CacheClear');
|
|
@@ -117,7 +198,6 @@ export async function cacheClearCommand(options = {}) {
|
|
|
117
198
|
*/
|
|
118
199
|
async function readdirOrNull(dir) {
|
|
119
200
|
try {
|
|
120
|
-
// eslint-disable-next-line security/detect-non-literal-fs-filename -- path is the derived cache root or a caller-injected test directory
|
|
121
201
|
return await fs.readdir(dir, { withFileTypes: true });
|
|
122
202
|
}
|
|
123
203
|
catch (error) {
|
|
@@ -130,9 +210,11 @@ async function readdirOrNull(dir) {
|
|
|
130
210
|
async function measureEntries(dir, entries) {
|
|
131
211
|
const usages = await Promise.all(entries.map(async (entry) => {
|
|
132
212
|
const child = safePath.join(dir, entry.name);
|
|
133
|
-
// Not `isFile()
|
|
134
|
-
// be removed, and counting only regular files would
|
|
135
|
-
|
|
213
|
+
// Not `isFile()`, and NOT followed: a symlink or socket is still an entry
|
|
214
|
+
// that is about to be removed, and counting only regular files would
|
|
215
|
+
// under-report it — while walking INTO a linked directory would count a
|
|
216
|
+
// tree `rm -rf` leaves untouched.
|
|
217
|
+
return direntKind(entry) === 'directory' ? measureTree(child) : { entries: 1, bytes: await sizeOf(child) };
|
|
136
218
|
}));
|
|
137
219
|
return usages.reduce((total, usage) => ({ entries: total.entries + usage.entries, bytes: total.bytes + usage.bytes }), EMPTY_USAGE);
|
|
138
220
|
}
|
|
@@ -147,16 +229,20 @@ async function measureTree(dir) {
|
|
|
147
229
|
* A file that disappears between the listing and the stat contributes 0 rather
|
|
148
230
|
* than failing the clear — the whole tree is about to be deleted anyway, and a
|
|
149
231
|
* concurrent vat run pruning its own temp file must not turn cleanup into an
|
|
150
|
-
* error.
|
|
232
|
+
* error. Only a DISAPPEARANCE is 0: an entry the OS refuses to stat is still
|
|
233
|
+
* there, still about to be counted as reclaimed, and the `rm` that follows is
|
|
234
|
+
* about to meet the same refusal — so it is raised here, where it names the
|
|
235
|
+
* entry, rather than read as an empty file.
|
|
151
236
|
*/
|
|
152
237
|
async function sizeOf(target) {
|
|
153
238
|
try {
|
|
154
|
-
// eslint-disable-next-line security/detect-non-literal-fs-filename -- path is inside the cache root being measured
|
|
155
239
|
const stats = await fs.lstat(target);
|
|
156
240
|
return stats.size;
|
|
157
241
|
}
|
|
158
|
-
catch {
|
|
159
|
-
|
|
242
|
+
catch (error) {
|
|
243
|
+
if (isPathAbsentError(error))
|
|
244
|
+
return 0;
|
|
245
|
+
throw error;
|
|
160
246
|
}
|
|
161
247
|
}
|
|
162
248
|
//# sourceMappingURL=clear.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"clear.js","sourceRoot":"","sources":["../../../src/commands/cache/clear.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"clear.js","sourceRoot":"","sources":["../../../src/commands/cache/clear.ts"],"names":[],"mappings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.
|
|
3
|
+
*
|
|
4
|
+
* The paired `--no-cache` control surface lives in `./cache-control.js`:
|
|
5
|
+
* `--no-cache` decides whether this run *writes* to the caches, `vat cache
|
|
6
|
+
* clear` decides whether the caches *survive*. They are separate modules only
|
|
7
|
+
* because `bin.ts` registers the flag on every invocation and must not pay for
|
|
8
|
+
* this command's imports to do it.
|
|
9
|
+
*
|
|
10
|
+
* ⛔ Do NOT re-export `cache-control.js` from here for convenience. Importing it
|
|
11
|
+
* through this module pulls `./clear.js` and the whole resources package behind
|
|
12
|
+
* it — the exact ~1.2s that splitting the file removed — so a re-export leaves
|
|
13
|
+
* the expensive path one identical-looking import away, with nothing pinning
|
|
14
|
+
* the cheap one. Import from `./cache-control.js` directly.
|
|
7
15
|
*/
|
|
8
16
|
import { Command } from 'commander';
|
|
9
|
-
/**
|
|
10
|
-
* Root options this module reads. Commander represents `--no-cache` as the
|
|
11
|
-
* POSITIVE key `cache` — `true` by default, `false` only when the negated flag
|
|
12
|
-
* is passed. It NEVER produces `noCache`; reading that key is the exact bug that
|
|
13
|
-
* made three flags in this package silent no-ops (see
|
|
14
|
-
* `test/commands/commander-option-keys.test.ts`).
|
|
15
|
-
*/
|
|
16
|
-
export interface CacheControlOptions {
|
|
17
|
-
cache?: boolean;
|
|
18
|
-
}
|
|
19
|
-
/**
|
|
20
|
-
* Register the root-level `--no-cache` flag and the hook that gives it effect.
|
|
21
|
-
*
|
|
22
|
-
* ## Why this sets an environment variable instead of plumbing a flag
|
|
23
|
-
*
|
|
24
|
-
* `vat validate`, `vat verify` and `vat build` enumerate nothing in their own
|
|
25
|
-
* process: each `spawnSync`s the vat binary once per phase, and the child is
|
|
26
|
-
* what parses the corpus. A flag parsed in the parent therefore never reaches
|
|
27
|
-
* the process whose caching it is supposed to control, whereas `process.env` is
|
|
28
|
-
* inherited by every child for free. `bin.ts` already leans on exactly that for
|
|
29
|
-
* `VAT_CONTEXT` / `VAT_CONTEXT_PATH`.
|
|
30
|
-
*
|
|
31
|
-
* `VAT_CACHE=0` is read by `ParseCache` (packages/resources/src/parse-cache.ts)
|
|
32
|
-
* per construction, never at module load, so setting it from a `preAction` hook
|
|
33
|
-
* — after Commander has parsed, before any command body runs — is observed.
|
|
34
|
-
*
|
|
35
|
-
* ## The collision with `vat resources validate --no-cache`
|
|
36
|
-
*
|
|
37
|
-
* This root program does NOT use `enablePositionalOptions()`, so Commander scans
|
|
38
|
-
* the WHOLE argv for root options, including everything after the subcommand
|
|
39
|
-
* name. That is the same mechanism that let a root `-v` shadow the subcommands'
|
|
40
|
-
* own `-v, --verbose` (see the incident recorded in `bin.ts`). Measured against
|
|
41
|
-
* commander 12: `vat resources validate docs --no-cache` leaves the ROOT with
|
|
42
|
-
* `cache: false` and the SUBCOMMAND with `cache: true` — the subcommand's
|
|
43
|
-
* identically-named flag is swallowed before it ever sees it, which would have
|
|
44
|
-
* silently re-enabled the external-URL cache the flag exists to bypass.
|
|
45
|
-
*
|
|
46
|
-
* Rather than break a shipped flag, the hook hands the value back down to
|
|
47
|
-
* whichever action command declares a `cache` option of its own. `--no-cache` is
|
|
48
|
-
* a superset — every cache off — so the handoff is a strengthening, never a
|
|
49
|
-
* reversal.
|
|
50
|
-
*
|
|
51
|
-
* @param program - The root program to register the flag and hook on
|
|
52
|
-
*/
|
|
53
|
-
export declare function registerCacheControl(program: Command): void;
|
|
54
|
-
/**
|
|
55
|
-
* Apply the root `--no-cache` decision: export it to child processes, and hand
|
|
56
|
-
* it down to an action command that declares its own `cache` option.
|
|
57
|
-
*
|
|
58
|
-
* Exported so a test can drive it from real parsed options rather than from a
|
|
59
|
-
* hand-built bag. Deliberately does nothing when the flag was not passed — a
|
|
60
|
-
* toggle that writes `VAT_CACHE=1` by default would be indistinguishable from
|
|
61
|
-
* one that is always on.
|
|
62
|
-
*
|
|
63
|
-
* @param rootOptions - Options bag from the ROOT program
|
|
64
|
-
* @param actionCommand - The command whose action is about to run
|
|
65
|
-
*/
|
|
66
|
-
export declare function applyCacheControl(rootOptions: CacheControlOptions, actionCommand: Command): void;
|
|
67
17
|
export declare function createCacheCommand(): Command;
|
|
68
18
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/cache/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/cache/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAKpC,wBAAgB,kBAAkB,IAAI,OAAO,CAoF5C"}
|
|
@@ -1,75 +1,20 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Cache command group
|
|
2
|
+
* Cache command group.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
* clear` decides whether the caches *survive*.
|
|
4
|
+
* The paired `--no-cache` control surface lives in `./cache-control.js`:
|
|
5
|
+
* `--no-cache` decides whether this run *writes* to the caches, `vat cache
|
|
6
|
+
* clear` decides whether the caches *survive*. They are separate modules only
|
|
7
|
+
* because `bin.ts` registers the flag on every invocation and must not pay for
|
|
8
|
+
* this command's imports to do it.
|
|
9
|
+
*
|
|
10
|
+
* ⛔ Do NOT re-export `cache-control.js` from here for convenience. Importing it
|
|
11
|
+
* through this module pulls `./clear.js` and the whole resources package behind
|
|
12
|
+
* it — the exact ~1.2s that splitting the file removed — so a re-export leaves
|
|
13
|
+
* the expensive path one identical-looking import away, with nothing pinning
|
|
14
|
+
* the cheap one. Import from `./cache-control.js` directly.
|
|
7
15
|
*/
|
|
8
16
|
import { Command } from 'commander';
|
|
9
17
|
import { cacheClearCommand } from './clear.js';
|
|
10
|
-
/**
|
|
11
|
-
* Register the root-level `--no-cache` flag and the hook that gives it effect.
|
|
12
|
-
*
|
|
13
|
-
* ## Why this sets an environment variable instead of plumbing a flag
|
|
14
|
-
*
|
|
15
|
-
* `vat validate`, `vat verify` and `vat build` enumerate nothing in their own
|
|
16
|
-
* process: each `spawnSync`s the vat binary once per phase, and the child is
|
|
17
|
-
* what parses the corpus. A flag parsed in the parent therefore never reaches
|
|
18
|
-
* the process whose caching it is supposed to control, whereas `process.env` is
|
|
19
|
-
* inherited by every child for free. `bin.ts` already leans on exactly that for
|
|
20
|
-
* `VAT_CONTEXT` / `VAT_CONTEXT_PATH`.
|
|
21
|
-
*
|
|
22
|
-
* `VAT_CACHE=0` is read by `ParseCache` (packages/resources/src/parse-cache.ts)
|
|
23
|
-
* per construction, never at module load, so setting it from a `preAction` hook
|
|
24
|
-
* — after Commander has parsed, before any command body runs — is observed.
|
|
25
|
-
*
|
|
26
|
-
* ## The collision with `vat resources validate --no-cache`
|
|
27
|
-
*
|
|
28
|
-
* This root program does NOT use `enablePositionalOptions()`, so Commander scans
|
|
29
|
-
* the WHOLE argv for root options, including everything after the subcommand
|
|
30
|
-
* name. That is the same mechanism that let a root `-v` shadow the subcommands'
|
|
31
|
-
* own `-v, --verbose` (see the incident recorded in `bin.ts`). Measured against
|
|
32
|
-
* commander 12: `vat resources validate docs --no-cache` leaves the ROOT with
|
|
33
|
-
* `cache: false` and the SUBCOMMAND with `cache: true` — the subcommand's
|
|
34
|
-
* identically-named flag is swallowed before it ever sees it, which would have
|
|
35
|
-
* silently re-enabled the external-URL cache the flag exists to bypass.
|
|
36
|
-
*
|
|
37
|
-
* Rather than break a shipped flag, the hook hands the value back down to
|
|
38
|
-
* whichever action command declares a `cache` option of its own. `--no-cache` is
|
|
39
|
-
* a superset — every cache off — so the handoff is a strengthening, never a
|
|
40
|
-
* reversal.
|
|
41
|
-
*
|
|
42
|
-
* @param program - The root program to register the flag and hook on
|
|
43
|
-
*/
|
|
44
|
-
export function registerCacheControl(program) {
|
|
45
|
-
program.option('--no-cache', "Disable VAT's disk caches for this run (also applies to spawned phases)");
|
|
46
|
-
program.hook('preAction', (_thisCommand, actionCommand) => {
|
|
47
|
-
applyCacheControl(program.opts(), actionCommand);
|
|
48
|
-
});
|
|
49
|
-
}
|
|
50
|
-
/**
|
|
51
|
-
* Apply the root `--no-cache` decision: export it to child processes, and hand
|
|
52
|
-
* it down to an action command that declares its own `cache` option.
|
|
53
|
-
*
|
|
54
|
-
* Exported so a test can drive it from real parsed options rather than from a
|
|
55
|
-
* hand-built bag. Deliberately does nothing when the flag was not passed — a
|
|
56
|
-
* toggle that writes `VAT_CACHE=1` by default would be indistinguishable from
|
|
57
|
-
* one that is always on.
|
|
58
|
-
*
|
|
59
|
-
* @param rootOptions - Options bag from the ROOT program
|
|
60
|
-
* @param actionCommand - The command whose action is about to run
|
|
61
|
-
*/
|
|
62
|
-
export function applyCacheControl(rootOptions, actionCommand) {
|
|
63
|
-
if (rootOptions.cache !== false)
|
|
64
|
-
return;
|
|
65
|
-
process.env['VAT_CACHE'] = '0';
|
|
66
|
-
// `attributeName()`, not `name()`: for `--no-cache` the latter returns
|
|
67
|
-
// 'no-cache', so a check written against it never matches and the handoff
|
|
68
|
-
// above becomes a no-op that looks like it works.
|
|
69
|
-
if (actionCommand.options.some((option) => option.attributeName() === 'cache')) {
|
|
70
|
-
actionCommand.setOptionValue('cache', false);
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
18
|
export function createCacheCommand() {
|
|
74
19
|
const cache = new Command('cache');
|
|
75
20
|
cache
|
|
@@ -77,13 +22,25 @@ export function createCacheCommand() {
|
|
|
77
22
|
.helpCommand(false)
|
|
78
23
|
.addHelpText('after', `
|
|
79
24
|
Description:
|
|
80
|
-
VAT keeps
|
|
81
|
-
keyed by file content, external-URL validation results,
|
|
82
|
-
authenticated-link content
|
|
83
|
-
|
|
25
|
+
VAT keeps four disposable caches under <tmpdir>/.vat-cache: parse facts
|
|
26
|
+
keyed by file content, external-URL validation results, per-OS-user
|
|
27
|
+
authenticated-link content, and the projection store — a SQLite database
|
|
28
|
+
holding one whole scanned tree per entry, on by default, and by far the
|
|
29
|
+
largest of the four. None of them is durable — recovery is always "rescan".
|
|
30
|
+
|
|
31
|
+
How large: one 12,602-file repository measured 71 MB of projection store,
|
|
32
|
+
and the file holds several trees per repository plus a shared blob tier, so
|
|
33
|
+
a machine that has scanned a few projects reaches the hundreds of MB. The
|
|
34
|
+
other three tenants are a few MB between them.
|
|
35
|
+
|
|
36
|
+
Only the projection store evicts anything on its own: it keeps the three
|
|
37
|
+
most recently written trees per root and the 50,000 most recently written
|
|
38
|
+
content keys, dropping the rest as it writes. The other three rely on the OS
|
|
39
|
+
temp purge, and every one of them is reclaimed in full by vat cache clear.
|
|
84
40
|
|
|
85
41
|
To run WITHOUT the caches rather than remove them, use --no-cache on any
|
|
86
|
-
command (or VAT_CACHE=0), which also applies to spawned phases
|
|
42
|
+
command (or VAT_CACHE=0), which also applies to spawned phases and to the
|
|
43
|
+
projection store. VAT_PROJECTION_STORE=off turns off just the store.
|
|
87
44
|
|
|
88
45
|
Example:
|
|
89
46
|
$ vat cache clear # Reclaim the temp-directory cache tree
|
|
@@ -97,9 +54,15 @@ Example:
|
|
|
97
54
|
.addHelpText('after', `
|
|
98
55
|
Description:
|
|
99
56
|
Removes <tmpdir>/.vat-cache in its entirety — the parse cache, the
|
|
100
|
-
external-URL validation cache,
|
|
101
|
-
|
|
102
|
-
|
|
57
|
+
external-URL validation cache, the per-OS-user authenticated-link cache, and
|
|
58
|
+
the projection store (<namespace>/projection-<shape>/projection.db), which is
|
|
59
|
+
usually most of the bytes this reclaims: 71 MB for a single 12,602-file
|
|
60
|
+
repository, and the hundreds of MB once a machine has scanned several. Every
|
|
61
|
+
one of them is disposable by design: the next run repopulates what it needs,
|
|
62
|
+
so the only cost of clearing is one cold pass.
|
|
63
|
+
|
|
64
|
+
A projection store relocated with VAT_PROJECTION_STORE_DIR lives outside
|
|
65
|
+
this tree and is not removed — delete that directory yourself.
|
|
103
66
|
|
|
104
67
|
Runs regardless of --no-cache / VAT_CACHE=0. Turning caching off must not
|
|
105
68
|
disarm the one command that reclaims the space.
|
|
@@ -107,16 +70,21 @@ Description:
|
|
|
107
70
|
A cache directory that does not exist is not an error — nothing to remove is
|
|
108
71
|
a successful clear.
|
|
109
72
|
|
|
73
|
+
The tree is shared by every VAT on the machine, so another run writing into
|
|
74
|
+
it can make the delete stop part-way. That is reported as status: partial,
|
|
75
|
+
naming what went and what stayed, rather than failing with no account of it.
|
|
76
|
+
|
|
110
77
|
Output:
|
|
111
78
|
- cacheDir: absolute path that was targeted
|
|
112
79
|
- existed: whether the directory was there at all
|
|
113
|
-
- removed: top-level entries that
|
|
114
|
-
-
|
|
115
|
-
|
|
80
|
+
- removed: top-level entries that are now gone
|
|
81
|
+
- remaining / reason: what survived a partial clear, and why (partial only)
|
|
82
|
+
- entriesRemoved / bytesRemoved: file count and total size actually removed
|
|
116
83
|
|
|
117
84
|
Exit Codes:
|
|
118
85
|
0 - Cache cleared (or already absent)
|
|
119
|
-
|
|
86
|
+
1 - Cleared only in part, because something else is using the tree
|
|
87
|
+
2 - Could not read or target the cache at all (permissions, unexpected layout)
|
|
120
88
|
|
|
121
89
|
Example:
|
|
122
90
|
$ vat cache clear # Reclaim the temp-directory cache tree
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commands/cache/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commands/cache/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,OAAO,EAAE,iBAAiB,EAA0B,MAAM,YAAY,CAAC;AAGvE,MAAM,UAAU,kBAAkB;IAChC,MAAM,KAAK,GAAG,IAAI,OAAO,CAAC,OAAO,CAAC,CAAC;IAEnC,KAAK;SACF,WAAW,CAAC,iEAAiE,CAAC;SAC9E,WAAW,CAAC,KAAK,CAAC;SAClB,WAAW,CACV,OAAO,EACP;;;;;;;;;;;;;;;;;;;;;;;;CAwBL,CACI,CAAC;IAEJ,KAAK;SACF,OAAO,CAAC,OAAO,CAAC;SAChB,WAAW,CAAC,gEAAgE,CAAC;SAC7E,MAAM,CAAC,KAAK;QACX,MAAM,iBAAiB,CAAC,IAAI,CAAC,eAAe,EAAuB,CAAC,CAAC;IACvE,CAAC,CAAC;SACD,WAAW,CACV,OAAO,EACP;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAqCL,CACI,CAAC;IAEJ,OAAO,KAAK,CAAC;AACf,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"claude-config.d.ts","sourceRoot":"","sources":["../../../src/commands/claude/claude-config.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH,OAAO,EAAmB,KAAK,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAGnF,MAAM,WAAW,kBAAkB;IACjC,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,YAAY,CAAC;CAC5B;AAED;;;;GAIG;AACH,wBAAsB,uBAAuB,IAAI,OAAO,CAAC;IACvD,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,YAAY,GAAG,SAAS,CAAC;CACxC,CAAC,
|
|
1
|
+
{"version":3,"file":"claude-config.d.ts","sourceRoot":"","sources":["../../../src/commands/claude/claude-config.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH,OAAO,EAAmB,KAAK,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAGnF,MAAM,WAAW,kBAAkB;IACjC,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,YAAY,CAAC;CAC5B;AAED;;;;GAIG;AACH,wBAAsB,uBAAuB,IAAI,OAAO,CAAC;IACvD,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,YAAY,GAAG,SAAS,CAAC;CACxC,CAAC,CAiBD"}
|
|
@@ -15,6 +15,12 @@ export async function loadClaudeProjectConfig() {
|
|
|
15
15
|
if (!configPath) {
|
|
16
16
|
throw new Error('No vibe-agent-toolkit.config.yaml found. Run from a project directory.');
|
|
17
17
|
}
|
|
18
|
+
// No `onUnknownKeys` argument: `parseConfigFile` already DEFAULTS to writing
|
|
19
|
+
// the warning to stderr, which is exactly what this lane needs — unknown keys
|
|
20
|
+
// are a warning rather than a refusal, and stderr keeps the YAML document on
|
|
21
|
+
// stdout machine-readable. Passing a callback byte-identical to the default
|
|
22
|
+
// said "this command has an opinion here" while changing nothing, so a later
|
|
23
|
+
// reader would have to diff it against the default to learn it was dead.
|
|
18
24
|
const config = await parseConfigFile(configPath);
|
|
19
25
|
const configDir = dirname(configPath);
|
|
20
26
|
return { configPath, configDir, claudeConfig: config.claude };
|