@vibe-agent-toolkit/cli 0.2.0-rc.1 → 0.2.0-rc.11
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 +97 -28
- package/dist/bin/vat.js +97 -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 +165 -0
- package/dist/commands/ard/emit.d.ts.map +1 -0
- package/dist/commands/ard/emit.js +338 -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 +84 -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 +1150 -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 +372 -0
- package/dist/commands/claude/context.d.ts.map +1 -0
- package/dist/commands/claude/context.js +1115 -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 +116 -0
- package/dist/commands/okf/index.js.map +1 -0
- package/dist/commands/okf/validate.d.ts +195 -0
- package/dist/commands/okf/validate.d.ts.map +1 -0
- package/dist/commands/okf/validate.js +199 -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 +167 -0
- package/dist/commands/resources/check-progress.d.ts.map +1 -0
- package/dist/commands/resources/check-progress.js +250 -0
- package/dist/commands/resources/check-progress.js.map +1 -0
- package/dist/commands/resources/check-supervisor.d.ts +479 -0
- package/dist/commands/resources/check-supervisor.d.ts.map +1 -0
- package/dist/commands/resources/check-supervisor.js +587 -0
- package/dist/commands/resources/check-supervisor.js.map +1 -0
- package/dist/commands/resources/check.d.ts +620 -0
- package/dist/commands/resources/check.d.ts.map +1 -0
- package/dist/commands/resources/check.js +1452 -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 +430 -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 +100 -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 +8 -6
- 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 +143 -20
- package/dist/utils/command-error.d.ts.map +1 -1
- package/dist/utils/command-error.js +179 -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 +72 -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 +134 -2
- package/dist/utils/resource-loader.d.ts.map +1 -1
- package/dist/utils/resource-loader.js +290 -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 +143 -39
- 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 +36 -27
- package/schemas/ard-emit.json +152 -0
- package/schemas/okf-validate.json +170 -0
- package/schemas/resources-check.json +257 -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,357 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Populating a tree's resource projection and putting it somewhere ASKABLE —
|
|
3
|
+
* the shared half of every command that runs SQL over it.
|
|
4
|
+
*
|
|
5
|
+
* `vat resources query` runs one statement a person typed; `vat resources check`
|
|
6
|
+
* runs the statements a project wrote down. They differ in what they do with
|
|
7
|
+
* rows and in nothing else: same population, same store selection, same
|
|
8
|
+
* ephemeral fallback, same cache tell. This module is that "and in nothing
|
|
9
|
+
* else", stated once so the two cannot drift into answering about different
|
|
10
|
+
* corpora.
|
|
11
|
+
*
|
|
12
|
+
* ## 🚨 The SQL ALWAYS runs against a per-run in-memory database. Never the store.
|
|
13
|
+
*
|
|
14
|
+
* This is a correctness property, not an optimisation choice, and it was learned
|
|
15
|
+
* the expensive way. The on-disk projection store is **one database per VAT
|
|
16
|
+
* release, shared by every root on the machine** (`defaultStoreDirectory()` is
|
|
17
|
+
* `tmpdir/.vat-cache/<version>/projection-<shapeDigest>`), it retains three tree
|
|
18
|
+
* hashes per root, and its blob tier is never evicted and carries no tree key at
|
|
19
|
+
* all. `ProjectionStore.readExtent` narrows by `(rootId, treeHash)`; **arbitrary
|
|
20
|
+
* SQL does not**, and cannot be made to — a `WHERE` clause the caller wrote is
|
|
21
|
+
* not a key predicate.
|
|
22
|
+
*
|
|
23
|
+
* So running a user's statement against the file-backed store answered from
|
|
24
|
+
* every projection on the machine. Measured on a two-file scratch repository:
|
|
25
|
+
* `SELECT COUNT(*) FROM resource_realizations` returned **3** with no store and
|
|
26
|
+
* **5,779** with one, and `WHERE path LIKE 'packages/%'` returned paths from a
|
|
27
|
+
* different repository entirely. That is a wrong answer and a cross-project
|
|
28
|
+
* disclosure of link text, heading text and frontmatter — the same material
|
|
29
|
+
* `store.ts` cites as the reason it chmods the cache `0o700`.
|
|
30
|
+
*
|
|
31
|
+
* ⇒ The store's job is to make the POPULATION cheap, and that is all. Whatever
|
|
32
|
+
* `populate()` returns — served from the store or derived — is written into a
|
|
33
|
+
* fresh in-memory database that holds this tree and nothing else, and the SQL
|
|
34
|
+
* runs there. The saving is untouched (it was always in the population: on this
|
|
35
|
+
* repository {@link ProjectionProvenance.populationMs} reads 1.16-1.18 s derived
|
|
36
|
+
* against 0.29-0.31 s served), and "one tree, one answer" stops being a claim
|
|
37
|
+
* about how callers behave and becomes a property of the shape.
|
|
38
|
+
*
|
|
39
|
+
* ## The store never reaches a caller
|
|
40
|
+
*
|
|
41
|
+
* Work runs against an `ask` closure rather than a store handle. That is
|
|
42
|
+
* deliberate: `utils/projection-store.ts` is the one module in the toolkit that
|
|
43
|
+
* knows `@vibe-agent-toolkit/projection-sqlite` exists, and handing commands a
|
|
44
|
+
* backend-typed object would spread that knowledge to every future verb. A
|
|
45
|
+
* closure also puts the legible-failure wrapper on the single path that can
|
|
46
|
+
* throw, so no command can forget it.
|
|
47
|
+
*/
|
|
48
|
+
import { performance } from 'node:perf_hooks';
|
|
49
|
+
import { allDerivedSpecs, buildResourceProjection, PROJECTION_TABLES, splitProjectionByScope, } from '@vibe-agent-toolkit/resources';
|
|
50
|
+
import { gitTrackerForProjectRoot } from '../commands/audit/distributed-tree.js';
|
|
51
|
+
import { populationWiring } from './population-wiring.js';
|
|
52
|
+
import { evaluateLens, lensesNamedBy } from './projection-lenses.js';
|
|
53
|
+
import { openCompileProbe, openEphemeralQueryStore, withPopulationCache } from './projection-store.js';
|
|
54
|
+
/**
|
|
55
|
+
* The tree hash an in-memory store's one population is filed under.
|
|
56
|
+
*
|
|
57
|
+
* ⚠️ Deliberately NOT a tree hash. Nothing else ever opens this database, no
|
|
58
|
+
* read-back compares the key against another run's, and the store is gone at the
|
|
59
|
+
* end of the call — so the key only has to be internally consistent. A real
|
|
60
|
+
* `git write-tree` here would cost a spawn to produce a value nobody reads, and
|
|
61
|
+
* would invite the reader to believe the ephemeral store is shareable.
|
|
62
|
+
*/
|
|
63
|
+
const EPHEMERAL_TREE_HASH = 'ephemeral';
|
|
64
|
+
/** What SQLite says when a statement names a table the schema does not have. */
|
|
65
|
+
const TABLE_NOT_FOUND = 'no such table:';
|
|
66
|
+
/** What SQLite says when a statement names something the schema does not have. */
|
|
67
|
+
const NAME_NOT_FOUND = [TABLE_NOT_FOUND, 'no such column:'];
|
|
68
|
+
/**
|
|
69
|
+
* Compile every statement a run intends to ask, against the schema and NO rows,
|
|
70
|
+
* before anything is populated.
|
|
71
|
+
*
|
|
72
|
+
* ## 🔑 What this buys, measured
|
|
73
|
+
*
|
|
74
|
+
* SQLite resolves table and column names when a statement is *prepared*, not
|
|
75
|
+
* when it is stepped — so a typo is knowable before a single row exists. It was
|
|
76
|
+
* not knowable in practice, because the only place a statement met the schema
|
|
77
|
+
* was after the projection had been built. On a real adopter tree, `SELECT path,
|
|
78
|
+
* no_such_column …` cost **8.3 s**, every millisecond of it spent building a
|
|
79
|
+
* projection the statement could never have read. The same typo now costs the
|
|
80
|
+
* price of an empty in-memory database — one extra `createSchema` into
|
|
81
|
+
* `:memory:`, which is the whole overhead this adds on the happy path.
|
|
82
|
+
*
|
|
83
|
+
* It also moves the KIND refusals — a second statement, an `ATTACH`, a `PRAGMA`
|
|
84
|
+
* — in front of the population, so a statement rejected for what it is costs no
|
|
85
|
+
* more than one rejected for what it names.
|
|
86
|
+
*
|
|
87
|
+
* ⚠️ **This is a pre-flight, not a second gate.** `ask` still compiles and runs
|
|
88
|
+
* the real statement against the real projection, and nothing here is trusted in
|
|
89
|
+
* place of that. A statement that compiles here can still fail there — SQLite
|
|
90
|
+
* resolves names against a schema, and this is the same schema, but a run-time
|
|
91
|
+
* error (a bad cast, an overflow) belongs to stepping and is unreachable from a
|
|
92
|
+
* prepare.
|
|
93
|
+
*
|
|
94
|
+
* ⚠️ It deliberately does not STEP anything. Stepping is where a check's
|
|
95
|
+
* unbounded cost lives, and a preflight that ran `WITH RECURSIVE …` would hang
|
|
96
|
+
* before the run it exists to make cheap had begun.
|
|
97
|
+
*
|
|
98
|
+
* ⚠️ Each statement comes WITH the values it will be bound to, because the
|
|
99
|
+
* placeholder count is part of what compiles: a `?` the caller forgot to bind is
|
|
100
|
+
* SQL NULL at run time, and the statement then selects nothing and reports
|
|
101
|
+
* success — the same silent class as a typo'd column, and worth the same early
|
|
102
|
+
* refusal. The backend does the counting; this only has to hand it the values.
|
|
103
|
+
*
|
|
104
|
+
* @param statements - Every statement the run will ask, in any order, each with
|
|
105
|
+
* the values it will bind
|
|
106
|
+
* @throws The same legible failure `ask` throws, for the first statement that
|
|
107
|
+
* does not compile or does not pair its placeholders with its values
|
|
108
|
+
*/
|
|
109
|
+
export async function assertQueriesCompile(statements) {
|
|
110
|
+
if (statements.length === 0)
|
|
111
|
+
return;
|
|
112
|
+
// 🔑 A compile PROBE, not the query store: this runs before any lens is
|
|
113
|
+
// evaluated, and the query store has no table for an unevaluated relation.
|
|
114
|
+
// The probe carries every derived relation and cannot answer a query, so its
|
|
115
|
+
// empty tables can never be read as a result.
|
|
116
|
+
const probe = await openCompileProbe();
|
|
117
|
+
try {
|
|
118
|
+
for (const { sql, parameters } of statements) {
|
|
119
|
+
try {
|
|
120
|
+
probe.assertCompiles(sql, parameters);
|
|
121
|
+
}
|
|
122
|
+
catch (error) {
|
|
123
|
+
throw new Error(describeQueryFailure(sql, error instanceof Error ? error.message : String(error)));
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
finally {
|
|
128
|
+
await probe.close();
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Populate the tree, load it into something askable, and hand the caller a way
|
|
133
|
+
* to ask.
|
|
134
|
+
*
|
|
135
|
+
* @param options - The run
|
|
136
|
+
* @param options.root - Absolute corpus root
|
|
137
|
+
* @param options.logger - Where blob-stage refusals are reported (stderr, so a
|
|
138
|
+
* parseable document on stdout stays parseable)
|
|
139
|
+
* @param options.preflight - Every statement this run intends to ask, compiled
|
|
140
|
+
* against the empty schema BEFORE the population starts. See
|
|
141
|
+
* {@link assertQueriesCompile}
|
|
142
|
+
* @param options.statements - Every statement this run may ask, for LENS
|
|
143
|
+
* SELECTION only — never compiled, never bound, and deliberately separate from
|
|
144
|
+
* `preflight`. ⛔ Omitting it evaluates EVERY lens, which is the correct answer
|
|
145
|
+
* and the expensive one
|
|
146
|
+
* @param work - Given the asker, where its rows came from, how much of the tree
|
|
147
|
+
* they cover, and the ROWS THEMSELVES. The store is open for exactly this call
|
|
148
|
+
* and closed however it ends
|
|
149
|
+
* @returns Whatever `work` returned
|
|
150
|
+
*/
|
|
151
|
+
export async function withQueriedProjection(options, work) {
|
|
152
|
+
const { root, logger } = options;
|
|
153
|
+
// 🔑 BEFORE the clock and before the population, because being before the
|
|
154
|
+
// population is the entire point — see {@link assertQueriesCompile}. It is an
|
|
155
|
+
// option rather than a step each verb remembers for the same reason everything
|
|
156
|
+
// else here is shared: a verb that forgot it would silently go back to paying
|
|
157
|
+
// a full population to learn about a typo, and nothing in its output would say
|
|
158
|
+
// so.
|
|
159
|
+
await assertQueriesCompile(options.preflight ?? []);
|
|
160
|
+
// 🚨 OUTSIDE `withPopulationCache`, and it must stay outside. That helper
|
|
161
|
+
// awaits `openPopulationCache` — a `git write-tree` spawn plus the backend's
|
|
162
|
+
// dynamic import and `openSqliteProjectionStore()` — BEFORE it invokes the
|
|
163
|
+
// callback below, and it pays that cost ONLY when a store is selected. A clock
|
|
164
|
+
// started inside the callback therefore drops the store's own setup out of the
|
|
165
|
+
// measurement on precisely the arm the number is used to praise. See
|
|
166
|
+
// `populationMs` for what that shipped as.
|
|
167
|
+
//
|
|
168
|
+
// What is NOT in the span, deliberately: `withPopulationCache`'s `finally`,
|
|
169
|
+
// which closes the opened cache AFTER `work` returns. A span that ends before
|
|
170
|
+
// `work` begins cannot contain it, and stretching the span past `work` would
|
|
171
|
+
// fold the caller's statements into a number whose entire purpose is to be
|
|
172
|
+
// read against them. The close is a handle release on an already-open
|
|
173
|
+
// database, not population.
|
|
174
|
+
let contributorRecords = 0;
|
|
175
|
+
const populationStart = performance.now();
|
|
176
|
+
// The file-backed store, when one is selected, and ONLY as a population cache.
|
|
177
|
+
// Its rows are never queried — see the header.
|
|
178
|
+
return withPopulationCache({ root }, async (cache) => {
|
|
179
|
+
// The cache tell. `populate()` short-circuits a hit before any contributor
|
|
180
|
+
// is constructed, so this staying at zero is the ONLY observable difference
|
|
181
|
+
// between a served population and a re-derived one. Declared with the clock
|
|
182
|
+
// above rather than here so the two cannot drift apart when one moves.
|
|
183
|
+
const gitTracker = await gitTrackerForProjectRoot(root);
|
|
184
|
+
const projection = await buildResourceProjection({
|
|
185
|
+
root,
|
|
186
|
+
...populationWiring(logger, gitTracker, cache, root),
|
|
187
|
+
onContributorTiming: () => {
|
|
188
|
+
contributorRecords += 1;
|
|
189
|
+
},
|
|
190
|
+
});
|
|
191
|
+
// ONE tree, in a database nothing else can reach, built fresh for this call.
|
|
192
|
+
const store = await openEphemeralQueryStore();
|
|
193
|
+
try {
|
|
194
|
+
// The key is read OFF the projection rather than re-derived from the root.
|
|
195
|
+
// The driver mints `roots.id` with `rootIdFor` and every
|
|
196
|
+
// `resolution_contexts.rootId` is a foreign key into it, so taking it from
|
|
197
|
+
// the rows means the key provably describes them — a second derivation
|
|
198
|
+
// could drift from the first and file rows under an id they do not carry.
|
|
199
|
+
const rootId = projection.roots[0]?.id;
|
|
200
|
+
if (rootId === undefined) {
|
|
201
|
+
throw new Error('The population produced no root row, so there is no id to file its extent under.'
|
|
202
|
+
+ ' This is a driver invariant rather than a user error — `populate()` adds exactly'
|
|
203
|
+
+ ' one, and a projection without it cannot be stored or queried.');
|
|
204
|
+
}
|
|
205
|
+
const { blobs, extent } = splitProjectionByScope(projection);
|
|
206
|
+
await store.writeBlobFacts(blobs);
|
|
207
|
+
await store.writeExtent({ rootId, treeHash: EPHEMERAL_TREE_HASH }, extent);
|
|
208
|
+
// 🚨 The population clock STOPS HERE, before the lens runs. It used to
|
|
209
|
+
// stop after, which made `populationSecs` silently CONTAIN `lensSecs`
|
|
210
|
+
// while this comment and both payloads said it did not. The two numbers
|
|
211
|
+
// are published side by side precisely so a reader can compare a served
|
|
212
|
+
// population against a derived one — and folding the lens into the
|
|
213
|
+
// population put its cost on the arm the store's value is argued from,
|
|
214
|
+
// which is the "store got worse" reading the separation exists to
|
|
215
|
+
// prevent. Overlapping spans also made `populationSecs + lensSecs`
|
|
216
|
+
// over-count wall time for anyone who added them.
|
|
217
|
+
const populationMs = performance.now() - populationStart;
|
|
218
|
+
// 🔑 The lenses this run's statements NAME, and no others — zones.md §2
|
|
219
|
+
// carries why. The relations are still not behind a flag: a surface that
|
|
220
|
+
// exists only when somebody remembered a flag is one nobody writes a check
|
|
221
|
+
// against. What decides is the statement, which cannot be forgotten.
|
|
222
|
+
//
|
|
223
|
+
// ⛔ The narrowing is safe ONLY because an unevaluated relation does not
|
|
224
|
+
// EXIST in `store`: the backend creates a derived table on the write that
|
|
225
|
+
// fills it, so a statement naming one no lens filled fails `no such table`
|
|
226
|
+
// in SQLite itself — whatever spelling slipped past the selector's scan —
|
|
227
|
+
// and {@link describeQueryFailure} says why. Create the relations up front
|
|
228
|
+
// and this becomes a silent wrong answer: an empty table selecting zero rows.
|
|
229
|
+
const lenses = lensesNamedBy(options.statements);
|
|
230
|
+
const lensStart = performance.now();
|
|
231
|
+
for (const lens of lenses) {
|
|
232
|
+
// Sequential, not `Promise.all`: a lens may populate, and two
|
|
233
|
+
// populations racing for one projection store is the concurrency this
|
|
234
|
+
// lane has no reason to invite.
|
|
235
|
+
await store.writeDerived(await evaluateLens(lens, { projection, root, logger, cache }));
|
|
236
|
+
}
|
|
237
|
+
const lensMs = performance.now() - lensStart;
|
|
238
|
+
// The shared setup is done. Everything after this line is the caller's.
|
|
239
|
+
const ask = (sql, ...parameters) => {
|
|
240
|
+
try {
|
|
241
|
+
return store.query(sql, ...parameters);
|
|
242
|
+
}
|
|
243
|
+
catch (error) {
|
|
244
|
+
throw new Error(describeQueryFailure(sql, error instanceof Error ? error.message : String(error)));
|
|
245
|
+
}
|
|
246
|
+
};
|
|
247
|
+
return await work(ask, {
|
|
248
|
+
population: contributorRecords === 0 ? 'store' : 'derived',
|
|
249
|
+
populationMs,
|
|
250
|
+
lensMs,
|
|
251
|
+
lensesEvaluated: lenses.map((lens) => lens.name),
|
|
252
|
+
},
|
|
253
|
+
// Read off the PROJECTION rather than counted back out of the store with
|
|
254
|
+
// a `SELECT COUNT(*)`: a count that travelled through the same `ask` the
|
|
255
|
+
// caller's statements do would be broken by the very schema drift it
|
|
256
|
+
// exists to survive, and it is the population's size either way.
|
|
257
|
+
{ membersEnumerated: projection.resourceRealizations.length }, projection);
|
|
258
|
+
}
|
|
259
|
+
finally {
|
|
260
|
+
// Closed however the work ends. An in-memory database is reclaimed with the
|
|
261
|
+
// process either way, but a command that runs several of these in one
|
|
262
|
+
// process would otherwise hold every one of them open.
|
|
263
|
+
await store.close();
|
|
264
|
+
}
|
|
265
|
+
});
|
|
266
|
+
}
|
|
267
|
+
/**
|
|
268
|
+
* The derived relation a `no such table` failure names, if it names one.
|
|
269
|
+
*
|
|
270
|
+
* SQLite echoes the reference as written — `edges`, `EDGES`, `main.edges` — so
|
|
271
|
+
* the schema prefix is dropped and the comparison case-folds, as SQLite's own
|
|
272
|
+
* name resolution does. Names come from the relation registry, never a list
|
|
273
|
+
* kept here.
|
|
274
|
+
*
|
|
275
|
+
* @param message - What the engine said
|
|
276
|
+
* @returns The relation's registry spelling, or undefined
|
|
277
|
+
*/
|
|
278
|
+
function unevaluatedRelationIn(message) {
|
|
279
|
+
const at = message.indexOf(TABLE_NOT_FOUND);
|
|
280
|
+
if (at === -1)
|
|
281
|
+
return undefined;
|
|
282
|
+
const reference = message.slice(at + TABLE_NOT_FOUND.length).trim().split(/\s/u)[0] ?? '';
|
|
283
|
+
const bare = reference.slice(reference.lastIndexOf('.') + 1).toLowerCase();
|
|
284
|
+
return allDerivedSpecs().find((spec) => spec.name.toLowerCase() === bare)?.name;
|
|
285
|
+
}
|
|
286
|
+
/**
|
|
287
|
+
* Turn a rejected statement into a message that names the surface it missed.
|
|
288
|
+
*
|
|
289
|
+
* ## Why this wrapper exists
|
|
290
|
+
*
|
|
291
|
+
* VAT ships no schema version, by standing rule — the *cache* is safe across a
|
|
292
|
+
* shape change because its digest self-invalidates, but submitted SQL is not: it
|
|
293
|
+
* simply breaks. Pre-1.0 that is acceptable. A raw SQLite error reaching the
|
|
294
|
+
* user is not, because `no such column: contentHash` says nothing about what the
|
|
295
|
+
* column is called now. It matters more for a CHECK than for a query: a query's
|
|
296
|
+
* author is at the keyboard, while a check's author wrote it months ago and the
|
|
297
|
+
* person reading the failure is someone else.
|
|
298
|
+
*
|
|
299
|
+
* ⚠️ **A legibility wrapper, not a validator.** It does not parse SQL and does
|
|
300
|
+
* not check a statement before running it — it reacts to a failure by listing
|
|
301
|
+
* what the query COULD have named. When the statement mentions a known table,
|
|
302
|
+
* that table's columns are listed, which is the case that actually answers "what
|
|
303
|
+
* moved"; otherwise the table names are, which at least answers "what is there".
|
|
304
|
+
*
|
|
305
|
+
* 🪤 **Only a name that was not found gets the listing.** The engine also refuses
|
|
306
|
+
* a write and this backend refuses a second statement, and neither is answered by
|
|
307
|
+
* a column list — appending one says the problem is the schema when the problem
|
|
308
|
+
* is what the caller asked for. A wrapper that decorates every failure identically
|
|
309
|
+
* teaches the reader to skip the decoration, which costs the case it was written for.
|
|
310
|
+
*
|
|
311
|
+
* Matching is a plain lowercase substring test rather than a regex: the input is
|
|
312
|
+
* user text, and a pattern built from it is both a lint failure here and a
|
|
313
|
+
* needless hazard.
|
|
314
|
+
*
|
|
315
|
+
* @param sql - The statement that was submitted
|
|
316
|
+
* @param message - What the engine said
|
|
317
|
+
* @returns The message to surface, with the queryable surface appended when the
|
|
318
|
+
* failure was a name this projection does not have
|
|
319
|
+
*/
|
|
320
|
+
export function describeQueryFailure(sql, message) {
|
|
321
|
+
if (!NAME_NOT_FOUND.some((prefix) => message.includes(prefix)))
|
|
322
|
+
return message;
|
|
323
|
+
// 🚨 A MISSING DERIVED RELATION IS NOT A TYPO — it is the refusal that makes
|
|
324
|
+
// lazy lens evaluation an optimisation. The run's database creates a derived
|
|
325
|
+
// relation only when a lens fills it, so one no lens was evaluated for is
|
|
326
|
+
// absent, and SQLite refuses it rather than answering `0` from an empty table
|
|
327
|
+
// (indistinguishable from a tree with no links, and for `vat resources check`
|
|
328
|
+
// a rule that could no longer fail). The refusal is the engine's, so it holds
|
|
329
|
+
// for any spelling the lens selector's scan missed; this only says why. For
|
|
330
|
+
// `check` it surfaces as a `RESOURCE_CHECK_BROKEN` finding naming the rule.
|
|
331
|
+
// The compile preflight never reaches here with one: its probe has them all.
|
|
332
|
+
const unevaluated = unevaluatedRelationIn(message);
|
|
333
|
+
if (unevaluated !== undefined) {
|
|
334
|
+
return `${message}\n\n`
|
|
335
|
+
+ `This statement reads ${unevaluated}, a derived relation that was not evaluated for this run:`
|
|
336
|
+
+ ' no statement the run DECLARED names it, so no lens producing it ran and there is no answer'
|
|
337
|
+
+ ' to give. Declare this statement (`vat resources query` passes the one it was given;'
|
|
338
|
+
+ ' `vat resources check` passes every statement in `resources.checks`).';
|
|
339
|
+
}
|
|
340
|
+
// 🪤 The derived relations belong in this listing even though they are not
|
|
341
|
+
// projection tables. A user who mistypes `edge_resolution` gets "no such
|
|
342
|
+
// table" and a list of everything they could have meant — and a list that
|
|
343
|
+
// omitted the very relation they were reaching for would read as proof it
|
|
344
|
+
// does not exist. What the listing answers is "what can I name here", which
|
|
345
|
+
// is the queryable surface, not the registry.
|
|
346
|
+
const askable = [...Object.values(PROJECTION_TABLES), ...allDerivedSpecs()];
|
|
347
|
+
const lowered = sql.toLowerCase();
|
|
348
|
+
const named = askable.filter((spec) => lowered.includes(spec.name.toLowerCase()));
|
|
349
|
+
const surface = named.length > 0
|
|
350
|
+
? named.map((spec) => ` ${spec.name}(${spec.columns.join(', ')})`).join('\n')
|
|
351
|
+
: askable.map((spec) => ` ${spec.name}`).join('\n');
|
|
352
|
+
const heading = named.length > 0
|
|
353
|
+
? 'The tables this statement names hold these columns:'
|
|
354
|
+
: 'This tree is queryable through these relations:';
|
|
355
|
+
return `${message}\n\n${heading}\n${surface}`;
|
|
356
|
+
}
|
|
357
|
+
//# sourceMappingURL=projection-query.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"projection-query.js","sourceRoot":"","sources":["../../src/utils/projection-query.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8CG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAE9C,OAAO,EACL,eAAe,EACf,uBAAuB,EACvB,iBAAiB,EACjB,sBAAsB,GAEvB,MAAM,+BAA+B,CAAC;AAEvC,OAAO,EAAE,wBAAwB,EAAE,MAAM,uCAAuC,CAAC;AAGjF,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC1D,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