@vibe-agent-toolkit/cli 0.2.0-rc.7 → 0.2.0-rc.9
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 +0 -1
- package/dist/bin/vat +34 -19
- package/dist/bin/vat.js +34 -19
- package/dist/bin/vat.js.map +1 -1
- package/dist/bin.js +5 -2
- package/dist/bin.js.map +1 -1
- 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/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 +22 -10
- 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 +72 -23
- package/dist/commands/ard/emit.d.ts.map +1 -1
- package/dist/commands/ard/emit.js +109 -56
- package/dist/commands/ard/emit.js.map +1 -1
- package/dist/commands/ard/index.d.ts +1 -1
- package/dist/commands/ard/index.d.ts.map +1 -1
- package/dist/commands/ard/index.js +4 -3
- package/dist/commands/ard/index.js.map +1 -1
- package/dist/commands/audit/distributed-tree.d.ts.map +1 -1
- package/dist/commands/audit/distributed-tree.js +9 -6
- package/dist/commands/audit/distributed-tree.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 +16 -14
- package/dist/commands/audit.d.ts.map +1 -1
- package/dist/commands/audit.js +304 -389
- package/dist/commands/audit.js.map +1 -1
- package/dist/commands/build.d.ts.map +1 -1
- package/dist/commands/build.js +25 -24
- package/dist/commands/build.js.map +1 -1
- package/dist/commands/cache/clear.d.ts +17 -3
- package/dist/commands/cache/clear.d.ts.map +1 -1
- package/dist/commands/cache/clear.js +34 -13
- package/dist/commands/cache/clear.js.map +1 -1
- package/dist/commands/cache/index.d.ts.map +1 -1
- package/dist/commands/cache/index.js +19 -10
- package/dist/commands/cache/index.js.map +1 -1
- package/dist/commands/claude/context.d.ts +2 -2
- package/dist/commands/claude/context.d.ts.map +1 -1
- package/dist/commands/claude/context.js +7 -6
- package/dist/commands/claude/context.js.map +1 -1
- package/dist/commands/claude/index.d.ts +12 -11
- package/dist/commands/claude/index.d.ts.map +1 -1
- package/dist/commands/claude/index.js +14 -16
- 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 +22 -12
- 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.map +1 -1
- package/dist/commands/claude/marketplace/validate.js +26 -16
- 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 +17 -22
- package/dist/commands/claude/org/helpers.d.ts.map +1 -1
- package/dist/commands/claude/org/helpers.js +6 -22
- package/dist/commands/claude/org/helpers.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 +19 -1
- package/dist/commands/claude/org/skills.d.ts.map +1 -1
- package/dist/commands/claude/org/skills.js +147 -111
- 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 +3 -2
- 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 +6 -5
- package/dist/commands/claude/org/workspaces.js.map +1 -1
- package/dist/commands/claude/plugin/build.d.ts.map +1 -1
- package/dist/commands/claude/plugin/build.js +23 -52
- 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 +0 -6
- 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 +71 -60
- 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/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 +2 -1
- package/dist/commands/claude/plugin/tree-copy.d.ts.map +1 -1
- package/dist/commands/claude/plugin/tree-copy.js +15 -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 +149 -104
- package/dist/commands/consistency-check.js.map +1 -1
- package/dist/commands/corpus/report.d.ts.map +1 -1
- package/dist/commands/corpus/report.js +1 -2
- package/dist/commands/corpus/report.js.map +1 -1
- package/dist/commands/corpus/runner.d.ts.map +1 -1
- package/dist/commands/corpus/runner.js +2 -6
- 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 +2 -3
- 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.map +1 -1
- package/dist/commands/doctor.js +55 -37
- package/dist/commands/doctor.js.map +1 -1
- package/dist/commands/inventory.d.ts.map +1 -1
- package/dist/commands/inventory.js +6 -7
- package/dist/commands/inventory.js.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.map +1 -1
- package/dist/commands/okf/index.js +14 -2
- package/dist/commands/okf/index.js.map +1 -1
- package/dist/commands/okf/validate.d.ts +157 -48
- package/dist/commands/okf/validate.d.ts.map +1 -1
- package/dist/commands/okf/validate.js +109 -76
- package/dist/commands/okf/validate.js.map +1 -1
- package/dist/commands/phase-utils.d.ts +11 -10
- package/dist/commands/phase-utils.d.ts.map +1 -1
- package/dist/commands/phase-utils.js +30 -14
- 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 +2 -1
- 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.map +1 -1
- package/dist/commands/rag/index-command.js +4 -1
- package/dist/commands/rag/index-command.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/check-progress.d.ts +6 -0
- package/dist/commands/resources/check-progress.d.ts.map +1 -1
- package/dist/commands/resources/check-progress.js +15 -4
- package/dist/commands/resources/check-progress.js.map +1 -1
- package/dist/commands/resources/check-supervisor.d.ts.map +1 -1
- package/dist/commands/resources/check-supervisor.js +14 -7
- package/dist/commands/resources/check-supervisor.js.map +1 -1
- package/dist/commands/resources/check.d.ts +315 -205
- package/dist/commands/resources/check.d.ts.map +1 -1
- package/dist/commands/resources/check.js +368 -327
- package/dist/commands/resources/check.js.map +1 -1
- package/dist/commands/resources/index.d.ts.map +1 -1
- package/dist/commands/resources/index.js +159 -39
- package/dist/commands/resources/index.js.map +1 -1
- package/dist/commands/resources/query.d.ts +2 -2
- package/dist/commands/resources/query.d.ts.map +1 -1
- package/dist/commands/resources/query.js +24 -18
- package/dist/commands/resources/query.js.map +1 -1
- package/dist/commands/resources/scan.d.ts.map +1 -1
- package/dist/commands/resources/scan.js +4 -8
- package/dist/commands/resources/scan.js.map +1 -1
- package/dist/commands/resources/validate.d.ts +1 -1
- package/dist/commands/resources/validate.d.ts.map +1 -1
- package/dist/commands/resources/validate.js +0 -1
- 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 +4 -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 +90 -60
- package/dist/commands/skill/review.js.map +1 -1
- package/dist/commands/skill/test/configure.d.ts.map +1 -1
- package/dist/commands/skill/test/configure.js +0 -1
- package/dist/commands/skill/test/configure.js.map +1 -1
- package/dist/commands/skill/test/run.d.ts +12 -6
- package/dist/commands/skill/test/run.d.ts.map +1 -1
- package/dist/commands/skill/test/run.js +120 -65
- package/dist/commands/skill/test/run.js.map +1 -1
- package/dist/commands/skills/build.d.ts +83 -3
- package/dist/commands/skills/build.d.ts.map +1 -1
- package/dist/commands/skills/build.js +162 -40
- 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 -30
- package/dist/commands/skills/install.js.map +1 -1
- package/dist/commands/skills/list.d.ts.map +1 -1
- package/dist/commands/skills/list.js +14 -18
- 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 +2 -4
- 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 +15 -13
- package/dist/commands/skills/skill-discovery.d.ts.map +1 -1
- package/dist/commands/skills/skill-discovery.js +23 -5
- 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/validate.d.ts +1 -1
- package/dist/commands/validate.d.ts.map +1 -1
- package/dist/commands/validate.js +39 -14
- package/dist/commands/validate.js.map +1 -1
- package/dist/commands/verify.d.ts +17 -5
- package/dist/commands/verify.d.ts.map +1 -1
- package/dist/commands/verify.js +161 -104
- 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/resolve-skill-reference.d.ts.map +1 -1
- package/dist/skill-resolution/resolve-skill-reference.js +50 -55
- 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 +0 -1
- 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 +63 -62
- package/dist/utils/command-error.d.ts.map +1 -1
- package/dist/utils/command-error.js +80 -76
- 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 +3 -6
- package/dist/utils/config-loader.js.map +1 -1
- package/dist/utils/corpus-target.d.ts +5 -27
- package/dist/utils/corpus-target.d.ts.map +1 -1
- package/dist/utils/corpus-target.js +7 -33
- package/dist/utils/corpus-target.js.map +1 -1
- 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-rendering.d.ts +2 -2
- package/dist/utils/issue-rendering.js +2 -2
- package/dist/utils/optional-backend.d.ts.map +1 -1
- package/dist/utils/optional-backend.js +2 -1
- package/dist/utils/optional-backend.js.map +1 -1
- package/dist/utils/output.d.ts +9 -0
- package/dist/utils/output.d.ts.map +1 -1
- package/dist/utils/output.js +16 -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/project-root-policy.d.ts.map +1 -1
- package/dist/utils/project-root-policy.js +0 -2
- 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 +38 -14
- package/dist/utils/projection-query.d.ts.map +1 -1
- package/dist/utils/projection-query.js +78 -17
- package/dist/utils/projection-query.js.map +1 -1
- package/dist/utils/projection-store.d.ts +61 -42
- package/dist/utils/projection-store.d.ts.map +1 -1
- package/dist/utils/projection-store.js +155 -59
- package/dist/utils/projection-store.js.map +1 -1
- 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/resource-loader.js +2 -2
- package/dist/utils/resource-loader.js.map +1 -1
- 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/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.map +1 -1
- package/dist/utils/user-context-scanner.js +0 -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 +3 -4
- package/dist/utils/validate-help-files.js.map +1 -1
- package/dist/utils/vat-bin-path.d.ts.map +1 -1
- package/dist/utils/vat-bin-path.js +0 -1
- package/dist/utils/vat-bin-path.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/audit.md +44 -53
- package/docs/doctor.md +1 -0
- package/docs/index.md +18 -10
- package/docs/rag.md +0 -1
- package/docs/resources.md +0 -1
- package/docs/skill-test.md +10 -9
- package/docs/skills.md +6 -7
- package/package.json +23 -28
- 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/claude/budget.d.ts +0 -170
- package/dist/commands/claude/budget.d.ts.map +0 -1
- package/dist/commands/claude/budget.js +0 -464
- package/dist/commands/claude/budget.js.map +0 -1
- package/dist/utils/context-budget-issues.d.ts +0 -108
- package/dist/utils/context-budget-issues.d.ts.map +0 -1
- package/dist/utils/context-budget-issues.js +0 -280
- package/dist/utils/context-budget-issues.js.map +0 -1
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Shared command error handling utilities.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
4
|
+
* The failure endings a command may take, each publishing a document and
|
|
5
|
+
* ending on one member of the `ExitCode` contract. `commands/skills/` used to
|
|
5
6
|
* carry its own `handleCommandError` that logged to stderr and exited 2 having
|
|
6
7
|
* written nothing to stdout — same name, same signature, same documented
|
|
7
|
-
* contract, silently different behaviour.
|
|
8
|
+
* contract, silently different behaviour. A command that ends some other way
|
|
9
|
+
* still names its code from `ExitCode`; the lint rule
|
|
10
|
+
* `no-literal-process-exit` refuses a bare number.
|
|
8
11
|
*/
|
|
9
|
-
import { type SeverityCounts, type ValidationIssue } from '@vibe-agent-toolkit/schema';
|
|
12
|
+
import { type ExitCodeValue, type SeverityCounts, type ValidationIssue } from '@vibe-agent-toolkit/schema';
|
|
10
13
|
import type { Logger } from './logger.js';
|
|
11
14
|
/**
|
|
12
15
|
* Format duration for human readability
|
|
@@ -14,25 +17,6 @@ import type { Logger } from './logger.js';
|
|
|
14
17
|
* @returns Formatted duration string (e.g., "500ms", "1.5s", "1.5m")
|
|
15
18
|
*/
|
|
16
19
|
export declare function formatDuration(ms: number): string;
|
|
17
|
-
/**
|
|
18
|
-
* Everything about a thrown value that `error.message` alone discards.
|
|
19
|
-
*
|
|
20
|
-
* Exit 2 is the UNEXPECTED failure — an internal bug, not a usage mistake — and
|
|
21
|
-
* the one thing a reader needs there is the frame that threw. A real `TypeError`
|
|
22
|
-
* arrived here as a single line (`Cannot read properties of undefined (reading
|
|
23
|
-
* 'readdir')`) with no file, no frames, and no flag that would produce them; the
|
|
24
|
-
* only way to find the throw site was to hand-patch the built `dist`. A value
|
|
25
|
-
* thrown that is not an `Error` fared worse still — the envelope flattens it to
|
|
26
|
-
* the literal string `Unknown error`, which names neither its type nor its
|
|
27
|
-
* contents.
|
|
28
|
-
*
|
|
29
|
-
* The result rides the logger's **debug** channel (`--debug`), so default output
|
|
30
|
-
* is unchanged and no golden moves.
|
|
31
|
-
*
|
|
32
|
-
* @param error - The value that was thrown
|
|
33
|
-
* @returns Stack trace for an `Error`, or an inspected rendering of a non-`Error`
|
|
34
|
-
*/
|
|
35
|
-
export declare function errorDiagnostics(error: unknown): string;
|
|
36
20
|
/** The document a command publishes when an unexpected failure stops it. */
|
|
37
21
|
export interface CommandErrorDocument {
|
|
38
22
|
status: 'error';
|
|
@@ -63,8 +47,8 @@ export declare function reportCommandError(error: unknown, logger: Logger, start
|
|
|
63
47
|
/**
|
|
64
48
|
* Handle command error with standard formatting and exit.
|
|
65
49
|
*
|
|
66
|
-
* The command-line ending for {@link reportCommandError}.
|
|
67
|
-
* UNEXPECTED failure, per the exit-code contract every command's help documents.
|
|
50
|
+
* The command-line ending for {@link reportCommandError}. `ExitCode.ERROR` is
|
|
51
|
+
* the UNEXPECTED failure, per the exit-code contract every command's help documents.
|
|
68
52
|
*
|
|
69
53
|
* 🔑 **`format` is not decoration.** Every command offering `--format json`
|
|
70
54
|
* honoured it on the success path and emitted YAML here, so the one document a
|
|
@@ -87,12 +71,12 @@ export declare function handleCommandError(error: unknown, logger: Logger, start
|
|
|
87
71
|
* with the code the command's own contract assigns it.
|
|
88
72
|
*
|
|
89
73
|
* The third ending of one failure, beside {@link handleCommandError} (the
|
|
90
|
-
* UNEXPECTED failure, always
|
|
91
|
-
* (a validation gate, always
|
|
92
|
-
* that is neither: the command ran, understood the project, and has a
|
|
93
|
-
* documented non-zero code for what it found — `vat ard emit`
|
|
94
|
-
* "this project declares no `ard:` block" or
|
|
95
|
-
* here".
|
|
74
|
+
* UNEXPECTED failure, always `ERROR`) and {@link handleValidationGateFailure}
|
|
75
|
+
* (a validation gate, always `FINDINGS`, always YAML). This one covers the
|
|
76
|
+
* failure that is neither: the command ran, understood the project, and has a
|
|
77
|
+
* documented non-zero code for what it found — `vat ard emit` ending on
|
|
78
|
+
* `FINDINGS` for "this project declares no `ard:` block" or `ERROR` for "there
|
|
79
|
+
* is no config file here".
|
|
96
80
|
*
|
|
97
81
|
* 🔑 It exists because those endings were written inline, and an inline ending
|
|
98
82
|
* publishes nothing: `ard emit` honoured `--format json` on its success path
|
|
@@ -112,7 +96,35 @@ export declare function handleCommandError(error: unknown, logger: Logger, start
|
|
|
112
96
|
* @param format - What the operator asked for: `json`, or anything else (and
|
|
113
97
|
* omitted) for YAML — the same two-branch switch the success path uses
|
|
114
98
|
*/
|
|
115
|
-
export declare function handleExpectedFailure(message: string, exitCode:
|
|
99
|
+
export declare function handleExpectedFailure(message: string, exitCode: ExitCodeValue, startTime: number, format?: string | undefined): never;
|
|
100
|
+
/**
|
|
101
|
+
* {@link handleCommandError} for a command whose document is the shared
|
|
102
|
+
* `Report<T>` envelope: the failure document IS the envelope
|
|
103
|
+
* (`buildErrorReport`), so the emitted `schemas/<command>.json` describes the
|
|
104
|
+
* failed run too. Every command registered as `report` in `report-schemas.ts`
|
|
105
|
+
* ends its unexpected failures here; `handleCommandError`'s
|
|
106
|
+
* `CommandErrorDocument` is the shape the legacy documents keep.
|
|
107
|
+
*
|
|
108
|
+
* @param error - The value that was thrown
|
|
109
|
+
* @param logger - Logger instance for error output
|
|
110
|
+
* @param startTime - Command start time (from Date.now())
|
|
111
|
+
* @param commandName - Name of the command (for the stderr line)
|
|
112
|
+
* @param format - What the operator asked for: `json`, or anything else (and
|
|
113
|
+
* omitted) for YAML
|
|
114
|
+
*/
|
|
115
|
+
export declare function handleReportCommandError(error: unknown, logger: Logger, startTime: number, commandName: string, format?: string | undefined): never;
|
|
116
|
+
/**
|
|
117
|
+
* {@link handleExpectedFailure} for a command whose document is the shared
|
|
118
|
+
* `Report<T>` envelope — same document as {@link handleReportCommandError},
|
|
119
|
+
* with the exit code the command's own contract assigns.
|
|
120
|
+
*
|
|
121
|
+
* @param message - What went wrong, in the command's own words
|
|
122
|
+
* @param exitCode - The code this command's `--help` assigns to this outcome
|
|
123
|
+
* @param startTime - Command start time (from Date.now())
|
|
124
|
+
* @param format - What the operator asked for: `json`, or anything else (and
|
|
125
|
+
* omitted) for YAML
|
|
126
|
+
*/
|
|
127
|
+
export declare function handleReportExpectedFailure(message: string, exitCode: ExitCodeValue, startTime: number, format?: string | undefined): never;
|
|
116
128
|
/** The payload a command publishes when its own validation gate stops it. */
|
|
117
129
|
export interface ValidationGateFailure {
|
|
118
130
|
status: 'error';
|
|
@@ -130,9 +142,9 @@ export interface ValidationGateFailure {
|
|
|
130
142
|
export declare function buildValidationGateFailure(subject: string, issues: readonly ValidationIssue[]): ValidationGateFailure;
|
|
131
143
|
/**
|
|
132
144
|
* Publish the documented failure payload for a command stopped by its OWN
|
|
133
|
-
* validation gate, then
|
|
145
|
+
* validation gate, then end on `FINDINGS`.
|
|
134
146
|
*
|
|
135
|
-
* {@link handleCommandError} above covers the UNEXPECTED failure (
|
|
147
|
+
* {@link handleCommandError} above covers the UNEXPECTED failure (`ERROR`). This
|
|
136
148
|
* covers the expected one, and `vat skills build` / `vat skills package` both
|
|
137
149
|
* exited it after writing zero bytes to stdout — while their `--help` texts
|
|
138
150
|
* document a YAML summary on stdout and reserve exit 1 for exactly this case.
|
|
@@ -140,40 +152,29 @@ export declare function buildValidationGateFailure(subject: string, issues: read
|
|
|
140
152
|
* a bare non-zero code.
|
|
141
153
|
*/
|
|
142
154
|
export declare function handleValidationGateFailure(subject: string, issues: readonly ValidationIssue[]): never;
|
|
143
|
-
/**
|
|
144
|
-
* The exit code a USAGE mistake ends on: a flag this program does not declare,
|
|
145
|
-
* a verb it does not know, a missing or invalid argument.
|
|
146
|
-
*
|
|
147
|
-
* 🔑 **Two is not a style choice — one was a factual lie.** Every command's
|
|
148
|
-
* `--help` publishes the same three-way contract: `0` no error-severity
|
|
149
|
-
* findings, `1` at least one, `2` a system error. Commander's default for a
|
|
150
|
-
* usage mistake is `process.exit(1)`, so `vat resources check --json` (the
|
|
151
|
-
* option is `--format json`) exited **1** — which, read against the contract
|
|
152
|
-
* the command itself prints, asserts that at least one check was violated.
|
|
153
|
-
* Nothing had run. A CI wrapper spelled `if [ $? -ne 0 ]; then report_findings`
|
|
154
|
-
* therefore reported findings that were never computed, and the operator went
|
|
155
|
-
* looking for a violation that did not exist.
|
|
156
|
-
*
|
|
157
|
-
* The same hole swallowed a mistyped verb (`vat resources chekc`) and every
|
|
158
|
-
* unknown option on all 69 commands. VAT's own refusals were already correct —
|
|
159
|
-
* an unknown `--check` name and an unusable `--budget` both exit 2 — so the
|
|
160
|
-
* inconsistency was Commander's default leaking through the one path VAT had
|
|
161
|
-
* not claimed.
|
|
162
|
-
*
|
|
163
|
-
* ⚠️ **Help and `--version` are NOT usage mistakes.** They terminate through
|
|
164
|
-
* the same `_exit` path with code 0 and must stay 0; only a non-zero commander
|
|
165
|
-
* ending is remapped. See {@link exitCodeForCommanderEnding}.
|
|
166
|
-
*/
|
|
167
|
-
export declare const USAGE_ERROR_EXIT_CODE = 2;
|
|
168
155
|
/**
|
|
169
156
|
* Map a commander termination to the exit code VAT's contract promises.
|
|
170
157
|
*
|
|
158
|
+
* A USAGE mistake — a flag this program does not declare, a verb it does not
|
|
159
|
+
* know, a missing or invalid argument — ends on `ExitCode.ERROR`, and the
|
|
160
|
+
* reason is not style. Commander's default for a usage mistake is
|
|
161
|
+
* `process.exit(1)`, so `vat resources check --json` (the option is
|
|
162
|
+
* `--format json`) exited **1** — which, read against the contract the command
|
|
163
|
+
* itself prints, asserts that at least one check was violated. Nothing had
|
|
164
|
+
* run. A CI wrapper spelled `if [ $? -ne 0 ]; then report_findings` therefore
|
|
165
|
+
* reported findings that were never computed. The same hole swallowed a
|
|
166
|
+
* mistyped verb (`vat resources chekc`) and every unknown option on every
|
|
167
|
+
* command.
|
|
168
|
+
*
|
|
171
169
|
* Commander reports BOTH successful and failing terminations through the same
|
|
172
170
|
* `CommanderError`: `--help` and `--version` carry `exitCode` 0, while an
|
|
173
171
|
* unknown option, an unknown command and `help({ error: true })` carry non-zero.
|
|
174
172
|
* Anything non-zero is a usage mistake by construction — commander raises these
|
|
175
|
-
* only while parsing, before any action runs — so it maps to
|
|
176
|
-
*
|
|
173
|
+
* only while parsing, before any action runs — so it maps to `ERROR`.
|
|
174
|
+
*
|
|
175
|
+
* ⚠️ **Help and `--version` are NOT usage mistakes.** They terminate through
|
|
176
|
+
* the same `_exit` path with code 0 and must stay `OK`; only a non-zero
|
|
177
|
+
* commander ending is remapped.
|
|
177
178
|
*
|
|
178
179
|
* 🪤 Do NOT switch on `error.code` (`commander.unknownOption`, `commander.help`,
|
|
179
180
|
* …). The unknown-COMMAND path arrives as `commander.help` with exitCode 1,
|
|
@@ -182,7 +183,7 @@ export declare const USAGE_ERROR_EXIT_CODE = 2;
|
|
|
182
183
|
* code commander already computed is the honest discriminator; the string is not.
|
|
183
184
|
*
|
|
184
185
|
* @param commanderExitCode - The `exitCode` commander put on its CommanderError
|
|
185
|
-
* @returns
|
|
186
|
+
* @returns `OK` for a successful ending, `ERROR` otherwise
|
|
186
187
|
*/
|
|
187
|
-
export declare function exitCodeForCommanderEnding(commanderExitCode: number):
|
|
188
|
+
export declare function exitCodeForCommanderEnding(commanderExitCode: number): ExitCodeValue;
|
|
188
189
|
//# sourceMappingURL=command-error.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"command-error.d.ts","sourceRoot":"","sources":["../../src/utils/command-error.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"command-error.d.ts","sourceRoot":"","sources":["../../src/utils/command-error.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAGH,OAAO,EAAiE,KAAK,aAAa,EAAE,KAAK,cAAc,EAAE,KAAK,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAE1K,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAG1C;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,CAQjD;AAED,4EAA4E;AAC5E,MAAM,WAAW,oBAAoB;IACnC,MAAM,EAAE,OAAO,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,kBAAkB,CAChC,KAAK,EAAE,OAAO,EACd,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,MAAM,EACjB,WAAW,EAAE,MAAM,GAClB,oBAAoB,CAQtB;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,kBAAkB,CAChC,KAAK,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F"}
|
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Shared command error handling utilities.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
4
|
+
* The failure endings a command may take, each publishing a document and
|
|
5
|
+
* ending on one member of the `ExitCode` contract. `commands/skills/` used to
|
|
5
6
|
* carry its own `handleCommandError` that logged to stderr and exited 2 having
|
|
6
7
|
* written nothing to stdout — same name, same signature, same documented
|
|
7
|
-
* contract, silently different behaviour.
|
|
8
|
+
* contract, silently different behaviour. A command that ends some other way
|
|
9
|
+
* still names its code from `ExitCode`; the lint rule
|
|
10
|
+
* `no-literal-process-exit` refuses a bare number.
|
|
8
11
|
*/
|
|
9
|
-
import {
|
|
10
|
-
import { countBySeverity } from '@vibe-agent-toolkit/schema';
|
|
12
|
+
import { ExitCode, buildErrorReport, countBySeverity, errorDiagnostics } from '@vibe-agent-toolkit/schema';
|
|
11
13
|
import { writeJsonOutput, writeYamlOutput } from './output.js';
|
|
12
14
|
/**
|
|
13
15
|
* Format duration for human readability
|
|
@@ -23,31 +25,6 @@ export function formatDuration(ms) {
|
|
|
23
25
|
}
|
|
24
26
|
return `${(ms / 60000).toFixed(1)}m`;
|
|
25
27
|
}
|
|
26
|
-
/**
|
|
27
|
-
* Everything about a thrown value that `error.message` alone discards.
|
|
28
|
-
*
|
|
29
|
-
* Exit 2 is the UNEXPECTED failure — an internal bug, not a usage mistake — and
|
|
30
|
-
* the one thing a reader needs there is the frame that threw. A real `TypeError`
|
|
31
|
-
* arrived here as a single line (`Cannot read properties of undefined (reading
|
|
32
|
-
* 'readdir')`) with no file, no frames, and no flag that would produce them; the
|
|
33
|
-
* only way to find the throw site was to hand-patch the built `dist`. A value
|
|
34
|
-
* thrown that is not an `Error` fared worse still — the envelope flattens it to
|
|
35
|
-
* the literal string `Unknown error`, which names neither its type nor its
|
|
36
|
-
* contents.
|
|
37
|
-
*
|
|
38
|
-
* The result rides the logger's **debug** channel (`--debug`), so default output
|
|
39
|
-
* is unchanged and no golden moves.
|
|
40
|
-
*
|
|
41
|
-
* @param error - The value that was thrown
|
|
42
|
-
* @returns Stack trace for an `Error`, or an inspected rendering of a non-`Error`
|
|
43
|
-
*/
|
|
44
|
-
export function errorDiagnostics(error) {
|
|
45
|
-
if (error instanceof Error) {
|
|
46
|
-
// `stack` is optional in the type and absent on some cross-realm errors.
|
|
47
|
-
return error.stack ?? `${error.name}: ${error.message}`;
|
|
48
|
-
}
|
|
49
|
-
return `Non-Error value thrown: ${inspect(error, { depth: 3 })}`;
|
|
50
|
-
}
|
|
51
28
|
/**
|
|
52
29
|
* Report an unexpected failure on stderr and return the document that describes
|
|
53
30
|
* it, WITHOUT deciding how the caller ends.
|
|
@@ -78,8 +55,8 @@ export function reportCommandError(error, logger, startTime, commandName) {
|
|
|
78
55
|
/**
|
|
79
56
|
* Handle command error with standard formatting and exit.
|
|
80
57
|
*
|
|
81
|
-
* The command-line ending for {@link reportCommandError}.
|
|
82
|
-
* UNEXPECTED failure, per the exit-code contract every command's help documents.
|
|
58
|
+
* The command-line ending for {@link reportCommandError}. `ExitCode.ERROR` is
|
|
59
|
+
* the UNEXPECTED failure, per the exit-code contract every command's help documents.
|
|
83
60
|
*
|
|
84
61
|
* 🔑 **`format` is not decoration.** Every command offering `--format json`
|
|
85
62
|
* honoured it on the success path and emitted YAML here, so the one document a
|
|
@@ -98,25 +75,19 @@ export function reportCommandError(error, logger, startTime, commandName) {
|
|
|
98
75
|
*/
|
|
99
76
|
export function handleCommandError(error, logger, startTime, commandName, format) {
|
|
100
77
|
const document = reportCommandError(error, logger, startTime, commandName);
|
|
101
|
-
|
|
102
|
-
writeJsonOutput(document);
|
|
103
|
-
}
|
|
104
|
-
else {
|
|
105
|
-
writeYamlOutput(document);
|
|
106
|
-
}
|
|
107
|
-
process.exit(2);
|
|
78
|
+
return publishFailure(document, format, ExitCode.ERROR);
|
|
108
79
|
}
|
|
109
80
|
/**
|
|
110
81
|
* Publish an EXPECTED failure in the format the operator asked for, then exit
|
|
111
82
|
* with the code the command's own contract assigns it.
|
|
112
83
|
*
|
|
113
84
|
* The third ending of one failure, beside {@link handleCommandError} (the
|
|
114
|
-
* UNEXPECTED failure, always
|
|
115
|
-
* (a validation gate, always
|
|
116
|
-
* that is neither: the command ran, understood the project, and has a
|
|
117
|
-
* documented non-zero code for what it found — `vat ard emit`
|
|
118
|
-
* "this project declares no `ard:` block" or
|
|
119
|
-
* here".
|
|
85
|
+
* UNEXPECTED failure, always `ERROR`) and {@link handleValidationGateFailure}
|
|
86
|
+
* (a validation gate, always `FINDINGS`, always YAML). This one covers the
|
|
87
|
+
* failure that is neither: the command ran, understood the project, and has a
|
|
88
|
+
* documented non-zero code for what it found — `vat ard emit` ending on
|
|
89
|
+
* `FINDINGS` for "this project declares no `ard:` block" or `ERROR` for "there
|
|
90
|
+
* is no config file here".
|
|
120
91
|
*
|
|
121
92
|
* 🔑 It exists because those endings were written inline, and an inline ending
|
|
122
93
|
* publishes nothing: `ard emit` honoured `--format json` on its success path
|
|
@@ -143,6 +114,16 @@ export function handleExpectedFailure(message, exitCode, startTime, format) {
|
|
|
143
114
|
error: message,
|
|
144
115
|
duration: formatDuration(Date.now() - startTime),
|
|
145
116
|
};
|
|
117
|
+
return publishFailure(document, format, exitCode);
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Publish a failure document in the operator's format, then end on `exitCode`.
|
|
121
|
+
*
|
|
122
|
+
* @param document - What to write to stdout
|
|
123
|
+
* @param format - `json`, or anything else (and omitted) for YAML
|
|
124
|
+
* @param exitCode - The member of the contract this ending is
|
|
125
|
+
*/
|
|
126
|
+
function publishFailure(document, format, exitCode) {
|
|
146
127
|
if (format === 'json') {
|
|
147
128
|
writeJsonOutput(document);
|
|
148
129
|
}
|
|
@@ -151,6 +132,40 @@ export function handleExpectedFailure(message, exitCode, startTime, format) {
|
|
|
151
132
|
}
|
|
152
133
|
process.exit(exitCode);
|
|
153
134
|
}
|
|
135
|
+
/**
|
|
136
|
+
* {@link handleCommandError} for a command whose document is the shared
|
|
137
|
+
* `Report<T>` envelope: the failure document IS the envelope
|
|
138
|
+
* (`buildErrorReport`), so the emitted `schemas/<command>.json` describes the
|
|
139
|
+
* failed run too. Every command registered as `report` in `report-schemas.ts`
|
|
140
|
+
* ends its unexpected failures here; `handleCommandError`'s
|
|
141
|
+
* `CommandErrorDocument` is the shape the legacy documents keep.
|
|
142
|
+
*
|
|
143
|
+
* @param error - The value that was thrown
|
|
144
|
+
* @param logger - Logger instance for error output
|
|
145
|
+
* @param startTime - Command start time (from Date.now())
|
|
146
|
+
* @param commandName - Name of the command (for the stderr line)
|
|
147
|
+
* @param format - What the operator asked for: `json`, or anything else (and
|
|
148
|
+
* omitted) for YAML
|
|
149
|
+
*/
|
|
150
|
+
export function handleReportCommandError(error, logger, startTime, commandName, format) {
|
|
151
|
+
const { error: message } = reportCommandError(error, logger, startTime, commandName);
|
|
152
|
+
return publishFailure(buildErrorReport(message, Date.now() - startTime), format, ExitCode.ERROR);
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* {@link handleExpectedFailure} for a command whose document is the shared
|
|
156
|
+
* `Report<T>` envelope — same document as {@link handleReportCommandError},
|
|
157
|
+
* with the exit code the command's own contract assigns.
|
|
158
|
+
*
|
|
159
|
+
* @param message - What went wrong, in the command's own words
|
|
160
|
+
* @param exitCode - The code this command's `--help` assigns to this outcome
|
|
161
|
+
* @param startTime - Command start time (from Date.now())
|
|
162
|
+
* @param format - What the operator asked for: `json`, or anything else (and
|
|
163
|
+
* omitted) for YAML
|
|
164
|
+
*/
|
|
165
|
+
export function handleReportExpectedFailure(message, exitCode, startTime, format) {
|
|
166
|
+
process.stderr.write(`${message}\n`);
|
|
167
|
+
return publishFailure(buildErrorReport(message, Date.now() - startTime), format, exitCode);
|
|
168
|
+
}
|
|
154
169
|
/**
|
|
155
170
|
* Pure: the document {@link handleValidationGateFailure} writes.
|
|
156
171
|
*
|
|
@@ -163,9 +178,9 @@ export function buildValidationGateFailure(subject, issues) {
|
|
|
163
178
|
}
|
|
164
179
|
/**
|
|
165
180
|
* Publish the documented failure payload for a command stopped by its OWN
|
|
166
|
-
* validation gate, then
|
|
181
|
+
* validation gate, then end on `FINDINGS`.
|
|
167
182
|
*
|
|
168
|
-
* {@link handleCommandError} above covers the UNEXPECTED failure (
|
|
183
|
+
* {@link handleCommandError} above covers the UNEXPECTED failure (`ERROR`). This
|
|
169
184
|
* covers the expected one, and `vat skills build` / `vat skills package` both
|
|
170
185
|
* exited it after writing zero bytes to stdout — while their `--help` texts
|
|
171
186
|
* document a YAML summary on stdout and reserve exit 1 for exactly this case.
|
|
@@ -174,42 +189,31 @@ export function buildValidationGateFailure(subject, issues) {
|
|
|
174
189
|
*/
|
|
175
190
|
export function handleValidationGateFailure(subject, issues) {
|
|
176
191
|
writeYamlOutput(buildValidationGateFailure(subject, issues));
|
|
177
|
-
process.exit(
|
|
192
|
+
process.exit(ExitCode.FINDINGS);
|
|
178
193
|
}
|
|
179
|
-
/**
|
|
180
|
-
* The exit code a USAGE mistake ends on: a flag this program does not declare,
|
|
181
|
-
* a verb it does not know, a missing or invalid argument.
|
|
182
|
-
*
|
|
183
|
-
* 🔑 **Two is not a style choice — one was a factual lie.** Every command's
|
|
184
|
-
* `--help` publishes the same three-way contract: `0` no error-severity
|
|
185
|
-
* findings, `1` at least one, `2` a system error. Commander's default for a
|
|
186
|
-
* usage mistake is `process.exit(1)`, so `vat resources check --json` (the
|
|
187
|
-
* option is `--format json`) exited **1** — which, read against the contract
|
|
188
|
-
* the command itself prints, asserts that at least one check was violated.
|
|
189
|
-
* Nothing had run. A CI wrapper spelled `if [ $? -ne 0 ]; then report_findings`
|
|
190
|
-
* therefore reported findings that were never computed, and the operator went
|
|
191
|
-
* looking for a violation that did not exist.
|
|
192
|
-
*
|
|
193
|
-
* The same hole swallowed a mistyped verb (`vat resources chekc`) and every
|
|
194
|
-
* unknown option on all 69 commands. VAT's own refusals were already correct —
|
|
195
|
-
* an unknown `--check` name and an unusable `--budget` both exit 2 — so the
|
|
196
|
-
* inconsistency was Commander's default leaking through the one path VAT had
|
|
197
|
-
* not claimed.
|
|
198
|
-
*
|
|
199
|
-
* ⚠️ **Help and `--version` are NOT usage mistakes.** They terminate through
|
|
200
|
-
* the same `_exit` path with code 0 and must stay 0; only a non-zero commander
|
|
201
|
-
* ending is remapped. See {@link exitCodeForCommanderEnding}.
|
|
202
|
-
*/
|
|
203
|
-
export const USAGE_ERROR_EXIT_CODE = 2;
|
|
204
194
|
/**
|
|
205
195
|
* Map a commander termination to the exit code VAT's contract promises.
|
|
206
196
|
*
|
|
197
|
+
* A USAGE mistake — a flag this program does not declare, a verb it does not
|
|
198
|
+
* know, a missing or invalid argument — ends on `ExitCode.ERROR`, and the
|
|
199
|
+
* reason is not style. Commander's default for a usage mistake is
|
|
200
|
+
* `process.exit(1)`, so `vat resources check --json` (the option is
|
|
201
|
+
* `--format json`) exited **1** — which, read against the contract the command
|
|
202
|
+
* itself prints, asserts that at least one check was violated. Nothing had
|
|
203
|
+
* run. A CI wrapper spelled `if [ $? -ne 0 ]; then report_findings` therefore
|
|
204
|
+
* reported findings that were never computed. The same hole swallowed a
|
|
205
|
+
* mistyped verb (`vat resources chekc`) and every unknown option on every
|
|
206
|
+
* command.
|
|
207
|
+
*
|
|
207
208
|
* Commander reports BOTH successful and failing terminations through the same
|
|
208
209
|
* `CommanderError`: `--help` and `--version` carry `exitCode` 0, while an
|
|
209
210
|
* unknown option, an unknown command and `help({ error: true })` carry non-zero.
|
|
210
211
|
* Anything non-zero is a usage mistake by construction — commander raises these
|
|
211
|
-
* only while parsing, before any action runs — so it maps to
|
|
212
|
-
*
|
|
212
|
+
* only while parsing, before any action runs — so it maps to `ERROR`.
|
|
213
|
+
*
|
|
214
|
+
* ⚠️ **Help and `--version` are NOT usage mistakes.** They terminate through
|
|
215
|
+
* the same `_exit` path with code 0 and must stay `OK`; only a non-zero
|
|
216
|
+
* commander ending is remapped.
|
|
213
217
|
*
|
|
214
218
|
* 🪤 Do NOT switch on `error.code` (`commander.unknownOption`, `commander.help`,
|
|
215
219
|
* …). The unknown-COMMAND path arrives as `commander.help` with exitCode 1,
|
|
@@ -218,9 +222,9 @@ export const USAGE_ERROR_EXIT_CODE = 2;
|
|
|
218
222
|
* code commander already computed is the honest discriminator; the string is not.
|
|
219
223
|
*
|
|
220
224
|
* @param commanderExitCode - The `exitCode` commander put on its CommanderError
|
|
221
|
-
* @returns
|
|
225
|
+
* @returns `OK` for a successful ending, `ERROR` otherwise
|
|
222
226
|
*/
|
|
223
227
|
export function exitCodeForCommanderEnding(commanderExitCode) {
|
|
224
|
-
return commanderExitCode === 0 ?
|
|
228
|
+
return commanderExitCode === 0 ? ExitCode.OK : ExitCode.ERROR;
|
|
225
229
|
}
|
|
226
230
|
//# sourceMappingURL=command-error.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"command-error.js","sourceRoot":"","sources":["../../src/utils/command-error.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"command-error.js","sourceRoot":"","sources":["../../src/utils/command-error.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAGH,OAAO,EAAE,QAAQ,EAAE,gBAAgB,EAAE,eAAe,EAAE,gBAAgB,EAAiE,MAAM,4BAA4B,CAAC;AAG1K,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAE/D;;;;GAIG;AACH,MAAM,UAAU,cAAc,CAAC,EAAU;IACvC,IAAI,EAAE,GAAG,IAAI,EAAE,CAAC;QACd,OAAO,GAAG,EAAE,IAAI,CAAC;IACnB,CAAC;IACD,IAAI,EAAE,GAAG,KAAK,EAAE,CAAC;QACf,OAAO,GAAG,CAAC,EAAE,GAAG,IAAI,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC;IACtC,CAAC;IACD,OAAO,GAAG,CAAC,EAAE,GAAG,KAAK,CAAC,CAAC,OAAO,CAAC,CAAC,C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AE,KAAK,EAAE,OAAO,EAAE,CAAC;AACnF,CAAC;AAED;;;;;;;;;;GAUG;AACH,MAAM,UAAU,2BAA2B,CACzC,OAAe,EACf,MAAkC;IAElC,eAAe,CAAC,0BAA0B,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC,CAAC;IAC7D,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;AAClC,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,MAAM,UAAU,0BAA0B,CAAC,iBAAyB;IAClE,OAAO,iBAAiB,KAAK,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC;AAChE,CAAC"}
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
* - VAT_TEST_CONFIG: Override config file path for testing (absolute path)
|
|
6
6
|
*/
|
|
7
7
|
import { type ProjectConfig } from '@vibe-agent-toolkit/resources';
|
|
8
|
+
import { VatError } from '@vibe-agent-toolkit/utils';
|
|
8
9
|
/**
|
|
9
10
|
* A `vibe-agent-toolkit.config.yaml` exists but failed to parse or validate.
|
|
10
11
|
*
|
|
@@ -14,7 +15,7 @@ import { type ProjectConfig } from '@vibe-agent-toolkit/resources';
|
|
|
14
15
|
* `vat skill test`) should surface this; a bulk linter (`vat audit`) may catch
|
|
15
16
|
* it and fall back to config-free validation.
|
|
16
17
|
*/
|
|
17
|
-
export declare class ConfigLoadError extends
|
|
18
|
+
export declare class ConfigLoadError extends VatError {
|
|
18
19
|
readonly projectRoot: string;
|
|
19
20
|
constructor(projectRoot: string, cause: unknown);
|
|
20
21
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config-loader.d.ts","sourceRoot":"","sources":["../../src/utils/config-loader.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAKH,OAAO,EAAuD,KAAK,aAAa,EAAE,MAAM,+BAA+B,CAAC;
|
|
1
|
+
{"version":3,"file":"config-loader.d.ts","sourceRoot":"","sources":["../../src/utils/config-loader.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAKH,OAAO,EAAuD,KAAK,aAAa,EAAE,MAAM,+BAA+B,CAAC;AACxH,OAAO,EAAY,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AAY/D;;;;;;;;GAQG;AACH,qBAAa,eAAgB,SAAQ,QAAQ;IAC3C,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;gBACjB,WAAW,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO;CAKhD;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,UAAU,CAAC,WAAW,EAAE,MAAM,GAAG,aAAa,GAAG,SAAS,CAgDzE;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,CAEvD;AAqBD;;;;;GAKG;AACH,wBAAgB,sBAAsB,IAAI,IAAI,CAM7C;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,gBAAgB,CAAC,WAAW,EAAE,MAAM,GAAG,aAAa,GAAG,SAAS,CAgB/E"}
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
import { readFileSync, existsSync } from 'node:fs';
|
|
8
8
|
import { dirname } from 'node:path';
|
|
9
9
|
import { parseConfigAllowingUnknownKeys, ProjectConfigSchema } from '@vibe-agent-toolkit/resources';
|
|
10
|
-
import { safePath } from '@vibe-agent-toolkit/utils';
|
|
10
|
+
import { safePath, VatError } from '@vibe-agent-toolkit/utils';
|
|
11
11
|
import * as yaml from 'yaml';
|
|
12
12
|
const CONFIG_FILENAME = 'vibe-agent-toolkit.config.yaml';
|
|
13
13
|
/**
|
|
@@ -25,11 +25,10 @@ const warnedConfigPaths = new Set();
|
|
|
25
25
|
* `vat skill test`) should surface this; a bulk linter (`vat audit`) may catch
|
|
26
26
|
* it and fall back to config-free validation.
|
|
27
27
|
*/
|
|
28
|
-
export class ConfigLoadError extends
|
|
28
|
+
export class ConfigLoadError extends VatError {
|
|
29
29
|
projectRoot;
|
|
30
30
|
constructor(projectRoot, cause) {
|
|
31
|
-
super(cause instanceof Error ? cause.message : String(cause));
|
|
32
|
-
this.name = 'ConfigLoadError';
|
|
31
|
+
super('CONFIG_LOAD', cause instanceof Error ? cause.message : String(cause));
|
|
33
32
|
this.projectRoot = projectRoot;
|
|
34
33
|
if (cause instanceof Error)
|
|
35
34
|
this.cause = cause;
|
|
@@ -59,12 +58,10 @@ export class ConfigLoadError extends Error {
|
|
|
59
58
|
export function loadConfig(projectRoot) {
|
|
60
59
|
// Override for testing: VAT_TEST_CONFIG provides explicit config path
|
|
61
60
|
const configPath = process.env['VAT_TEST_CONFIG'] ?? safePath.join(projectRoot, CONFIG_FILENAME);
|
|
62
|
-
// eslint-disable-next-line security/detect-non-literal-fs-filename -- configPath is derived from projectRoot parameter or env override
|
|
63
61
|
if (!existsSync(configPath)) {
|
|
64
62
|
return undefined;
|
|
65
63
|
}
|
|
66
64
|
try {
|
|
67
|
-
// eslint-disable-next-line security/detect-non-literal-fs-filename -- configPath is derived from projectRoot parameter
|
|
68
65
|
const content = readFileSync(configPath, 'utf-8');
|
|
69
66
|
const parsed = yaml.parse(content);
|
|
70
67
|
// Validate with canonical schema from resources package.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config-loader.js","sourceRoot":"","sources":["../../src/utils/config-loader.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,OAAO,EAAE,8BAA8B,EAAE,mBAAmB,EAAsB,MAAM,+BAA+B,CAAC;AACxH,OAAO,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;
|
|
1
|
+
{"version":3,"file":"config-loader.js","sourceRoot":"","sources":["../../src/utils/config-loader.ts"],"names":[],"mappings":"AAAA;;;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6E;IAC7E,yEAAyE;IACzE,iBAAiB,CAAC,KAAK,EAAE,CAAC;AAC5B,CAAC;AAED;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,gBAAgB,CAAC,WAAmB;IAClD,MAAM,WAAW,GAAG,cAAc,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;IACpD,IAAI,WAAW,KAAK,SAAS;QAAE,MAAM,WAAW,CAAC;IACjD,MAAM,MAAM,GAAG,iBAAiB,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;IAClD,IAAI,MAAM,KAAK,SAAS;QAAE,OAAO,MAAM,IAAI,SAAS,CAAC;IACrD,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,UAAU,CAAC,WAAW,CAAC,CAAC;QACvC,iBAAiB,CAAC,GAAG,CAAC,WAAW,EAAE,MAAM,IAAI,IAAI,CAAC,CAAC;QACnD,OAAO,MAAM,CAAC;IAChB,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,4EAA4E;QAC5E,8EAA8E;QAC9E,MAAM,SAAS,GAAG,GAAG,YAAY,eAAe,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,eAAe,CAAC,WAAW,EAAE,GAAG,CAAC,CAAC;QAC/F,cAAc,CAAC,GAAG,CAAC,WAAW,EAAE,SAAS,CAAC,CAAC;QAC3C,MAAM,SAAS,CAAC;IAClB,CAAC;AACH,CAAC"}
|
|
@@ -5,34 +5,12 @@
|
|
|
5
5
|
* about positions in it — `vat claude context` and `vat claude budget` today.
|
|
6
6
|
* They ask different questions and default differently when no path is named,
|
|
7
7
|
* but "is this argument inside the tree I enumerated, and what is it called
|
|
8
|
-
* there" is one rule
|
|
9
|
-
*
|
|
8
|
+
* there" is one rule. The predicate itself is `relativeEscapesRoot` from
|
|
9
|
+
* `@vibe-agent-toolkit/utils` — the one lexical classifier every lane shares,
|
|
10
|
+
* so the clause that only fails on Windows (a cross-drive `relative()` comes
|
|
11
|
+
* back ABSOLUTE, not `..`-prefixed) is tested once, there, with the string
|
|
12
|
+
* Windows really produces.
|
|
10
13
|
*/
|
|
11
|
-
/**
|
|
12
|
-
* Does a path already stated against the corpus root fall OUTSIDE it?
|
|
13
|
-
*
|
|
14
|
-
* Three spellings of "outside", not two, and the third is the one that could
|
|
15
|
-
* only fail where nobody would see it. `safePath.relative` says "not under this
|
|
16
|
-
* root" with a `..`-prefixed path in the ordinary case, but returns an ABSOLUTE
|
|
17
|
-
* path when no relative route exists at all — which on Windows is exactly what a
|
|
18
|
-
* different drive letter produces. Without the third test, `vat claude context
|
|
19
|
-
* D:\elsewhere\doc.md` run from a `C:` repo passes the guard and answers `kind:
|
|
20
|
-
* unknown`, indistinguishable from a typo inside the tree, which is the one
|
|
21
|
-
* outcome {@link targetPathWithin}'s `@throws` claims to prevent. Its sibling
|
|
22
|
-
* `escapesRoot` (`closure-extent.ts`) applies the same triple for the same
|
|
23
|
-
* reason.
|
|
24
|
-
*
|
|
25
|
-
* ⛔ Exported so it can be TESTED. On POSIX `safePath.relative` between two
|
|
26
|
-
* absolute paths never returns an absolute string, so the third clause is
|
|
27
|
-
* unreachable through {@link targetPathWithin} on every machine a developer
|
|
28
|
-
* runs — the branch has to be exercised directly or not at all, and "not at
|
|
29
|
-
* all" is how it went missing in the first place.
|
|
30
|
-
*
|
|
31
|
-
* @param normalizedRelative - A forward-slashed path already stated against the
|
|
32
|
-
* corpus root
|
|
33
|
-
* @returns True when the corpus root does not contain it
|
|
34
|
-
*/
|
|
35
|
-
export declare function escapesCorpusRoot(normalizedRelative: string): boolean;
|
|
36
14
|
/**
|
|
37
15
|
* The root-relative path to query, refusing anything outside the corpus.
|
|
38
16
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"corpus-target.d.ts","sourceRoot":"","sources":["../../src/utils/corpus-target.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"corpus-target.d.ts","sourceRoot":"","sources":["../../src/utils/corpus-target.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAIH;;;;;;;;;;GAUG;AACH,wBAAgB,gBAAgB,CAC9B,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,MAAM,GAAG,SAAS,EAC3B,WAAW,EAAE,MAAM,GAClB,MAAM,CAUR"}
|
|
@@ -5,39 +5,13 @@
|
|
|
5
5
|
* about positions in it — `vat claude context` and `vat claude budget` today.
|
|
6
6
|
* They ask different questions and default differently when no path is named,
|
|
7
7
|
* but "is this argument inside the tree I enumerated, and what is it called
|
|
8
|
-
* there" is one rule
|
|
9
|
-
*
|
|
8
|
+
* there" is one rule. The predicate itself is `relativeEscapesRoot` from
|
|
9
|
+
* `@vibe-agent-toolkit/utils` — the one lexical classifier every lane shares,
|
|
10
|
+
* so the clause that only fails on Windows (a cross-drive `relative()` comes
|
|
11
|
+
* back ABSOLUTE, not `..`-prefixed) is tested once, there, with the string
|
|
12
|
+
* Windows really produces.
|
|
10
13
|
*/
|
|
11
|
-
import {
|
|
12
|
-
/**
|
|
13
|
-
* Does a path already stated against the corpus root fall OUTSIDE it?
|
|
14
|
-
*
|
|
15
|
-
* Three spellings of "outside", not two, and the third is the one that could
|
|
16
|
-
* only fail where nobody would see it. `safePath.relative` says "not under this
|
|
17
|
-
* root" with a `..`-prefixed path in the ordinary case, but returns an ABSOLUTE
|
|
18
|
-
* path when no relative route exists at all — which on Windows is exactly what a
|
|
19
|
-
* different drive letter produces. Without the third test, `vat claude context
|
|
20
|
-
* D:\elsewhere\doc.md` run from a `C:` repo passes the guard and answers `kind:
|
|
21
|
-
* unknown`, indistinguishable from a typo inside the tree, which is the one
|
|
22
|
-
* outcome {@link targetPathWithin}'s `@throws` claims to prevent. Its sibling
|
|
23
|
-
* `escapesRoot` (`closure-extent.ts`) applies the same triple for the same
|
|
24
|
-
* reason.
|
|
25
|
-
*
|
|
26
|
-
* ⛔ Exported so it can be TESTED. On POSIX `safePath.relative` between two
|
|
27
|
-
* absolute paths never returns an absolute string, so the third clause is
|
|
28
|
-
* unreachable through {@link targetPathWithin} on every machine a developer
|
|
29
|
-
* runs — the branch has to be exercised directly or not at all, and "not at
|
|
30
|
-
* all" is how it went missing in the first place.
|
|
31
|
-
*
|
|
32
|
-
* @param normalizedRelative - A forward-slashed path already stated against the
|
|
33
|
-
* corpus root
|
|
34
|
-
* @returns True when the corpus root does not contain it
|
|
35
|
-
*/
|
|
36
|
-
export function escapesCorpusRoot(normalizedRelative) {
|
|
37
|
-
return normalizedRelative === '..'
|
|
38
|
-
|| normalizedRelative.startsWith('../')
|
|
39
|
-
|| isAbsoluteAnyPlatform(normalizedRelative);
|
|
40
|
-
}
|
|
14
|
+
import { relativeEscapesRoot, safePath } from '@vibe-agent-toolkit/utils';
|
|
41
15
|
/**
|
|
42
16
|
* The root-relative path to query, refusing anything outside the corpus.
|
|
43
17
|
*
|
|
@@ -51,7 +25,7 @@ export function escapesCorpusRoot(normalizedRelative) {
|
|
|
51
25
|
*/
|
|
52
26
|
export function targetPathWithin(root, pathArg, commandName) {
|
|
53
27
|
const relative = safePath.relative(root, safePath.resolve(process.cwd(), pathArg ?? '.'));
|
|
54
|
-
if (
|
|
28
|
+
if (relativeEscapesRoot(relative)) {
|
|
55
29
|
throw new Error(`${pathArg ?? process.cwd()} resolves outside the corpus root ${root}.`
|
|
56
30
|
+ ` ${commandName} answers only for paths inside the root it discovered —`
|
|
57
31
|
+ ' run it from within the project you mean to ask about.');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"corpus-target.js","sourceRoot":"","sources":["../../src/utils/corpus-target.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"corpus-target.js","sourceRoot":"","sources":["../../src/utils/corpus-target.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,mBAAmB,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AAE1E;;;;;;;;;;GAUG;AACH,MAAM,UAAU,gBAAgB,CAC9B,IAAY,EACZ,OAA2B,EAC3B,WAAmB;IAEnB,MAAM,QAAQ,GAAG,QAAQ,CAAC,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,OAAO,IAAI,GAAG,CAAC,CAAC,CAAC;IAC1F,IAAI,mBAAmB,CAAC,QAAQ,CAAC,EAAE,CAAC;QAClC,MAAM,IAAI,KAAK,CACb,GAAG,OAAO,IAAI,OAAO,CAAC,GAAG,EAAE,qCAAqC,IAAI,GAAG;cACrE,IAAI,WAAW,yDAAyD;cACxE,wDAAwD,CAC3D,CAAC;IACJ,CAAC;IACD,OAAO,QAAQ,CAAC;AAClB,CAAC"}
|