@vibe-agent-toolkit/cli 0.2.0-rc.2 → 0.2.0-rc.4
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/dist/bin/vat +68 -16
- package/dist/bin/vat.js +68 -16
- package/dist/bin/vat.js.map +1 -1
- package/dist/bin.js +157 -37
- 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 +58 -0
- package/dist/command-loaders.js.map +1 -0
- package/dist/commands/agent/index.js +1 -1
- package/dist/commands/agent/install.d.ts.map +1 -1
- package/dist/commands/agent/install.js +46 -5
- package/dist/commands/agent/install.js.map +1 -1
- 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 +2 -1
- package/dist/commands/audit/distributed-tree.js.map +1 -1
- package/dist/commands/audit/git-url-clone.d.ts +1 -1
- package/dist/commands/audit/git-url-clone.d.ts.map +1 -1
- package/dist/commands/audit/git-url-clone.js.map +1 -1
- package/dist/commands/audit/hierarchical-output.d.ts +1 -1
- package/dist/commands/audit/hierarchical-output.d.ts.map +1 -1
- package/dist/commands/audit/hierarchical-output.js +1 -1
- package/dist/commands/audit/hierarchical-output.js.map +1 -1
- package/dist/commands/audit.d.ts +22 -1
- package/dist/commands/audit.d.ts.map +1 -1
- package/dist/commands/audit.js +224 -24
- 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 +15 -12
- 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 +17 -3
- package/dist/commands/cache/clear.d.ts.map +1 -1
- package/dist/commands/cache/clear.js +68 -3
- 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 +38 -79
- package/dist/commands/cache/index.js.map +1 -1
- package/dist/commands/claude/budget.d.ts +157 -0
- package/dist/commands/claude/budget.d.ts.map +1 -0
- package/dist/commands/claude/budget.js +412 -0
- package/dist/commands/claude/budget.js.map +1 -0
- package/dist/commands/claude/context.d.ts +340 -0
- package/dist/commands/claude/context.d.ts.map +1 -0
- package/dist/commands/claude/context.js +1079 -0
- package/dist/commands/claude/context.js.map +1 -0
- package/dist/commands/claude/index.d.ts +13 -0
- package/dist/commands/claude/index.d.ts.map +1 -1
- package/dist/commands/claude/index.js +24 -2
- package/dist/commands/claude/index.js.map +1 -1
- package/dist/commands/claude/marketplace/git-publish.d.ts.map +1 -1
- package/dist/commands/claude/marketplace/git-publish.js +18 -19
- package/dist/commands/claude/marketplace/git-publish.js.map +1 -1
- package/dist/commands/claude/marketplace/validate.d.ts +19 -1
- package/dist/commands/claude/marketplace/validate.d.ts.map +1 -1
- package/dist/commands/claude/marketplace/validate.js +41 -21
- package/dist/commands/claude/marketplace/validate.js.map +1 -1
- package/dist/commands/claude/plugin/build.d.ts +18 -2
- package/dist/commands/claude/plugin/build.d.ts.map +1 -1
- package/dist/commands/claude/plugin/build.js +55 -18
- 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 -1
- package/dist/commands/claude/plugin/helpers.js.map +1 -1
- package/dist/commands/claude/plugin/install.d.ts.map +1 -1
- package/dist/commands/claude/plugin/install.js +24 -3
- package/dist/commands/claude/plugin/install.js.map +1 -1
- package/dist/commands/claude/plugin/tree-copy.d.ts.map +1 -1
- package/dist/commands/claude/plugin/tree-copy.js +2 -1
- package/dist/commands/claude/plugin/tree-copy.js.map +1 -1
- package/dist/commands/consistency-check.d.ts.map +1 -1
- package/dist/commands/consistency-check.js +4 -3
- package/dist/commands/consistency-check.js.map +1 -1
- package/dist/commands/corpus/report.d.ts +1 -1
- package/dist/commands/corpus/report.d.ts.map +1 -1
- package/dist/commands/corpus/runner.d.ts.map +1 -1
- package/dist/commands/corpus/runner.js +3 -2
- 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 +18 -8
- package/dist/commands/corpus/scan.js.map +1 -1
- package/dist/commands/doctor.d.ts +36 -0
- package/dist/commands/doctor.d.ts.map +1 -1
- package/dist/commands/doctor.js +99 -2
- 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 +118 -13
- 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/phase-utils.d.ts +155 -104
- package/dist/commands/phase-utils.d.ts.map +1 -1
- package/dist/commands/phase-utils.js +109 -155
- package/dist/commands/phase-utils.js.map +1 -1
- package/dist/commands/rag/index-command.d.ts +39 -0
- package/dist/commands/rag/index-command.d.ts.map +1 -1
- package/dist/commands/rag/index-command.js +28 -2
- 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 +21 -10
- package/dist/commands/rag/index.js.map +1 -1
- package/dist/commands/resources/index.d.ts.map +1 -1
- package/dist/commands/resources/index.js +10 -2
- package/dist/commands/resources/index.js.map +1 -1
- 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 +19 -6
- package/dist/commands/resources/scan.js.map +1 -1
- package/dist/commands/resources/validate.d.ts +12 -1
- package/dist/commands/resources/validate.d.ts.map +1 -1
- package/dist/commands/resources/validate.js +102 -51
- package/dist/commands/resources/validate.js.map +1 -1
- package/dist/commands/skill/review-checklist.d.ts.map +1 -1
- package/dist/commands/skill/review-checklist.js +1 -0
- package/dist/commands/skill/review-checklist.js.map +1 -1
- package/dist/commands/skill/review.js +2 -2
- package/dist/commands/skill/review.js.map +1 -1
- package/dist/commands/skill/test/configure.d.ts +19 -0
- package/dist/commands/skill/test/configure.d.ts.map +1 -1
- package/dist/commands/skill/test/configure.js +18 -3
- package/dist/commands/skill/test/configure.js.map +1 -1
- package/dist/commands/skill/test/run.d.ts +51 -4
- package/dist/commands/skill/test/run.d.ts.map +1 -1
- package/dist/commands/skill/test/run.js +123 -12
- package/dist/commands/skill/test/run.js.map +1 -1
- package/dist/commands/skills/build.d.ts +11 -1
- package/dist/commands/skills/build.d.ts.map +1 -1
- package/dist/commands/skills/build.js +154 -61
- package/dist/commands/skills/build.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.map +1 -1
- package/dist/commands/skills/skill-discovery.d.ts.map +1 -1
- package/dist/commands/skills/skill-discovery.js +2 -1
- package/dist/commands/skills/skill-discovery.js.map +1 -1
- package/dist/commands/skills/validate.d.ts +79 -2
- package/dist/commands/skills/validate.d.ts.map +1 -1
- package/dist/commands/skills/validate.js +101 -48
- package/dist/commands/skills/validate.js.map +1 -1
- package/dist/commands/validate.d.ts.map +1 -1
- package/dist/commands/validate.js +26 -16
- package/dist/commands/validate.js.map +1 -1
- package/dist/commands/verify.d.ts +11 -10
- package/dist/commands/verify.d.ts.map +1 -1
- package/dist/commands/verify.js +49 -38
- package/dist/commands/verify.js.map +1 -1
- package/dist/utils/command-error.d.ts +33 -2
- package/dist/utils/command-error.d.ts.map +1 -1
- package/dist/utils/command-error.js +34 -10
- package/dist/utils/command-error.js.map +1 -1
- package/dist/utils/config-loader.d.ts.map +1 -1
- package/dist/utils/config-loader.js +7 -1
- package/dist/utils/config-loader.js.map +1 -1
- package/dist/utils/context-budget-issues.d.ts +108 -0
- package/dist/utils/context-budget-issues.d.ts.map +1 -0
- package/dist/utils/context-budget-issues.js +280 -0
- package/dist/utils/context-budget-issues.js.map +1 -0
- package/dist/utils/corpus-target.d.ts +48 -0
- package/dist/utils/corpus-target.d.ts.map +1 -0
- package/dist/utils/corpus-target.js +61 -0
- package/dist/utils/corpus-target.js.map +1 -0
- 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 +1 -1
- package/dist/utils/issue-rendering.d.ts.map +1 -1
- package/dist/utils/issue-rendering.js +1 -1
- package/dist/utils/issue-rendering.js.map +1 -1
- package/dist/utils/issue-severity.d.ts +1 -1
- 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 +77 -0
- package/dist/utils/optional-backend.d.ts.map +1 -0
- package/dist/utils/optional-backend.js +115 -0
- package/dist/utils/optional-backend.js.map +1 -0
- package/dist/utils/output.d.ts +17 -0
- package/dist/utils/output.d.ts.map +1 -1
- package/dist/utils/output.js +19 -0
- package/dist/utils/output.js.map +1 -1
- 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/projection-store.d.ts +188 -0
- package/dist/utils/projection-store.d.ts.map +1 -0
- package/dist/utils/projection-store.js +257 -0
- package/dist/utils/projection-store.js.map +1 -0
- package/dist/utils/resource-loader.d.ts +128 -2
- package/dist/utils/resource-loader.d.ts.map +1 -1
- package/dist/utils/resource-loader.js +234 -7
- package/dist/utils/resource-loader.js.map +1 -1
- 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/docs/agent.md +2 -2
- package/docs/mcp.md +2 -2
- package/docs/resources.md +8 -1
- package/package.json +15 -12
- 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
package/dist/bin/vat
CHANGED
|
@@ -16,9 +16,11 @@
|
|
|
16
16
|
*/
|
|
17
17
|
import { spawnSync } from 'node:child_process';
|
|
18
18
|
import { existsSync, readFileSync } from 'node:fs';
|
|
19
|
+
import { createRequire } from 'node:module';
|
|
19
20
|
import { dirname } from 'node:path';
|
|
20
21
|
import { fileURLToPath } from 'node:url';
|
|
21
|
-
import {
|
|
22
|
+
import { findNodeWorkspaceRoot, safePath, } from '@vibe-agent-toolkit/utils';
|
|
23
|
+
import { describeStdioBlocking, makeStdioBlocking, } from '@vibe-agent-toolkit/utils/process';
|
|
22
24
|
// Before ANY output. This file — not bin.ts — is what package.json maps `vat` to,
|
|
23
25
|
// so it is the CLI entry point in every installed copy, and `makeStdioBlocking`
|
|
24
26
|
// is documented as belonging first thing in one. The delegated child applies it
|
|
@@ -77,29 +79,79 @@ function getDevModeBinary(projectRoot) {
|
|
|
77
79
|
return null;
|
|
78
80
|
}
|
|
79
81
|
/**
|
|
80
|
-
* Find
|
|
81
|
-
* Walks up directory tree from project root
|
|
82
|
+
* Find the CLI the adopter's lockfile pinned, wherever their package manager put it.
|
|
82
83
|
*
|
|
83
|
-
*
|
|
84
|
-
*
|
|
84
|
+
* Resolved through Node's OWN resolver rather than by probing a path, because the
|
|
85
|
+
* path this used to probe —
|
|
86
|
+
* `<dir>/node_modules/@vibe-agent-toolkit/cli/dist/bin.js` — assumes npm's flat
|
|
87
|
+
* layout and **does not exist under pnpm** (issue #172). An adopter depending on
|
|
88
|
+
* the umbrella `vibe-agent-toolkit` package gets no top-level
|
|
89
|
+
* `node_modules/@vibe-agent-toolkit/` directory at all; the real CLI lives under
|
|
90
|
+
* `node_modules/.pnpm/@vibe-agent-toolkit+cli@<ver>_<hash>/…`. So priority 3 never
|
|
91
|
+
* fired for them, resolution fell through to priority 4, and whichever copy of
|
|
92
|
+
* `vat.js` happened to be invoked won — silently ignoring the version they pinned.
|
|
93
|
+
* That is the exact failure `findLocalInstall` exists to prevent, and it was
|
|
94
|
+
* invisible on npm/bun, where the flat layout makes the probe succeed.
|
|
95
|
+
*
|
|
96
|
+
* `createRequire` resolution walks the ancestor `node_modules` chain itself, which
|
|
97
|
+
* is what the hand-rolled loop here used to do — and it does so correctly for
|
|
98
|
+
* npm, bun, pnpm and yarn PnP without enumerating any of their layouts.
|
|
99
|
+
*
|
|
100
|
+
* It asks for `package.json` (exported by this package precisely so it can be
|
|
101
|
+
* located) and derives the binary from the package DIRECTORY rather than from the
|
|
102
|
+
* manifest's `bin` field. `bin.vat` names `dist/bin/vat.js` — THIS wrapper — so
|
|
103
|
+
* honouring it would make the wrapper delegate to itself and spawn forever. The
|
|
104
|
+
* target is the real CLI entry, `dist/bin.js`, exactly as before; only the way it
|
|
105
|
+
* is located has changed.
|
|
106
|
+
*
|
|
107
|
+
* TWO resolution bases are tried, and the second is not redundant. Under pnpm's
|
|
108
|
+
* isolated layout only DIRECT dependencies are symlinked into the adopter's
|
|
109
|
+
* top-level `node_modules`, so when the adopter depends on the umbrella
|
|
110
|
+
* `vibe-agent-toolkit` package — the documented way to adopt VAT — the CLI is a
|
|
111
|
+
* TRANSITIVE dependency and is deliberately unreachable from the adopter root.
|
|
112
|
+
* Resolving from the adopter alone would still miss it, which is the umbrella case
|
|
113
|
+
* the issue actually describes. It IS reachable from the umbrella package's own
|
|
114
|
+
* directory, so that package is resolved first (it is a direct dependency, hence
|
|
115
|
+
* visible) and used as the base for the second hop.
|
|
116
|
+
*
|
|
117
|
+
* @param projectRoot - Directory to resolve from; ancestors are searched too.
|
|
118
|
+
* @returns Path to the local `dist/bin.js` if one is installed and built, else null.
|
|
85
119
|
*/
|
|
86
120
|
function findLocalInstall(projectRoot) {
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
121
|
+
// The base need not exist — `createRequire` treats it purely as the directory
|
|
122
|
+
// to resolve relative to.
|
|
123
|
+
const fromProject = safePath.join(projectRoot, 'noop.js');
|
|
124
|
+
const umbrellaManifest = tryResolve(fromProject, 'vibe-agent-toolkit/package.json');
|
|
125
|
+
const bases = umbrellaManifest === null ? [fromProject] : [fromProject, umbrellaManifest];
|
|
126
|
+
for (const base of bases) {
|
|
127
|
+
const manifestPath = tryResolve(base, '@vibe-agent-toolkit/cli/package.json');
|
|
128
|
+
if (manifestPath === null)
|
|
129
|
+
continue;
|
|
130
|
+
const localBin = safePath.join(dirname(manifestPath), 'dist', 'bin.js');
|
|
131
|
+
// Still existence-checked: a dependency can be installed without having been
|
|
132
|
+
// built (a fresh workspace checkout, a partial install), and spawning a
|
|
133
|
+
// missing file would fail far from its cause.
|
|
90
134
|
// eslint-disable-next-line security/detect-non-literal-fs-filename -- checking for local install
|
|
91
|
-
if (existsSync(localBin))
|
|
135
|
+
if (existsSync(localBin))
|
|
92
136
|
return localBin;
|
|
93
|
-
}
|
|
94
|
-
const parent = dirname(current);
|
|
95
|
-
if (parent === current) {
|
|
96
|
-
// Reached filesystem root
|
|
97
|
-
break;
|
|
98
|
-
}
|
|
99
|
-
current = parent;
|
|
100
137
|
}
|
|
101
138
|
return null;
|
|
102
139
|
}
|
|
140
|
+
/**
|
|
141
|
+
* `require.resolve` reduced to "found it, or didn't".
|
|
142
|
+
*
|
|
143
|
+
* A failure here is priority 3's ordinary "not applicable" answer — no local
|
|
144
|
+
* install on this base — so it falls through to the next base and ultimately to
|
|
145
|
+
* the global install rather than failing the run.
|
|
146
|
+
*/
|
|
147
|
+
function tryResolve(fromPath, specifier) {
|
|
148
|
+
try {
|
|
149
|
+
return createRequire(fromPath).resolve(specifier);
|
|
150
|
+
}
|
|
151
|
+
catch {
|
|
152
|
+
return null;
|
|
153
|
+
}
|
|
154
|
+
}
|
|
103
155
|
/**
|
|
104
156
|
* Read version from package.json
|
|
105
157
|
* @param packageJsonPath - Path to package.json file
|
package/dist/bin/vat.js
CHANGED
|
@@ -16,9 +16,11 @@
|
|
|
16
16
|
*/
|
|
17
17
|
import { spawnSync } from 'node:child_process';
|
|
18
18
|
import { existsSync, readFileSync } from 'node:fs';
|
|
19
|
+
import { createRequire } from 'node:module';
|
|
19
20
|
import { dirname } from 'node:path';
|
|
20
21
|
import { fileURLToPath } from 'node:url';
|
|
21
|
-
import {
|
|
22
|
+
import { findNodeWorkspaceRoot, safePath, } from '@vibe-agent-toolkit/utils';
|
|
23
|
+
import { describeStdioBlocking, makeStdioBlocking, } from '@vibe-agent-toolkit/utils/process';
|
|
22
24
|
// Before ANY output. This file — not bin.ts — is what package.json maps `vat` to,
|
|
23
25
|
// so it is the CLI entry point in every installed copy, and `makeStdioBlocking`
|
|
24
26
|
// is documented as belonging first thing in one. The delegated child applies it
|
|
@@ -77,29 +79,79 @@ function getDevModeBinary(projectRoot) {
|
|
|
77
79
|
return null;
|
|
78
80
|
}
|
|
79
81
|
/**
|
|
80
|
-
* Find
|
|
81
|
-
* Walks up directory tree from project root
|
|
82
|
+
* Find the CLI the adopter's lockfile pinned, wherever their package manager put it.
|
|
82
83
|
*
|
|
83
|
-
*
|
|
84
|
-
*
|
|
84
|
+
* Resolved through Node's OWN resolver rather than by probing a path, because the
|
|
85
|
+
* path this used to probe —
|
|
86
|
+
* `<dir>/node_modules/@vibe-agent-toolkit/cli/dist/bin.js` — assumes npm's flat
|
|
87
|
+
* layout and **does not exist under pnpm** (issue #172). An adopter depending on
|
|
88
|
+
* the umbrella `vibe-agent-toolkit` package gets no top-level
|
|
89
|
+
* `node_modules/@vibe-agent-toolkit/` directory at all; the real CLI lives under
|
|
90
|
+
* `node_modules/.pnpm/@vibe-agent-toolkit+cli@<ver>_<hash>/…`. So priority 3 never
|
|
91
|
+
* fired for them, resolution fell through to priority 4, and whichever copy of
|
|
92
|
+
* `vat.js` happened to be invoked won — silently ignoring the version they pinned.
|
|
93
|
+
* That is the exact failure `findLocalInstall` exists to prevent, and it was
|
|
94
|
+
* invisible on npm/bun, where the flat layout makes the probe succeed.
|
|
95
|
+
*
|
|
96
|
+
* `createRequire` resolution walks the ancestor `node_modules` chain itself, which
|
|
97
|
+
* is what the hand-rolled loop here used to do — and it does so correctly for
|
|
98
|
+
* npm, bun, pnpm and yarn PnP without enumerating any of their layouts.
|
|
99
|
+
*
|
|
100
|
+
* It asks for `package.json` (exported by this package precisely so it can be
|
|
101
|
+
* located) and derives the binary from the package DIRECTORY rather than from the
|
|
102
|
+
* manifest's `bin` field. `bin.vat` names `dist/bin/vat.js` — THIS wrapper — so
|
|
103
|
+
* honouring it would make the wrapper delegate to itself and spawn forever. The
|
|
104
|
+
* target is the real CLI entry, `dist/bin.js`, exactly as before; only the way it
|
|
105
|
+
* is located has changed.
|
|
106
|
+
*
|
|
107
|
+
* TWO resolution bases are tried, and the second is not redundant. Under pnpm's
|
|
108
|
+
* isolated layout only DIRECT dependencies are symlinked into the adopter's
|
|
109
|
+
* top-level `node_modules`, so when the adopter depends on the umbrella
|
|
110
|
+
* `vibe-agent-toolkit` package — the documented way to adopt VAT — the CLI is a
|
|
111
|
+
* TRANSITIVE dependency and is deliberately unreachable from the adopter root.
|
|
112
|
+
* Resolving from the adopter alone would still miss it, which is the umbrella case
|
|
113
|
+
* the issue actually describes. It IS reachable from the umbrella package's own
|
|
114
|
+
* directory, so that package is resolved first (it is a direct dependency, hence
|
|
115
|
+
* visible) and used as the base for the second hop.
|
|
116
|
+
*
|
|
117
|
+
* @param projectRoot - Directory to resolve from; ancestors are searched too.
|
|
118
|
+
* @returns Path to the local `dist/bin.js` if one is installed and built, else null.
|
|
85
119
|
*/
|
|
86
120
|
function findLocalInstall(projectRoot) {
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
121
|
+
// The base need not exist — `createRequire` treats it purely as the directory
|
|
122
|
+
// to resolve relative to.
|
|
123
|
+
const fromProject = safePath.join(projectRoot, 'noop.js');
|
|
124
|
+
const umbrellaManifest = tryResolve(fromProject, 'vibe-agent-toolkit/package.json');
|
|
125
|
+
const bases = umbrellaManifest === null ? [fromProject] : [fromProject, umbrellaManifest];
|
|
126
|
+
for (const base of bases) {
|
|
127
|
+
const manifestPath = tryResolve(base, '@vibe-agent-toolkit/cli/package.json');
|
|
128
|
+
if (manifestPath === null)
|
|
129
|
+
continue;
|
|
130
|
+
const localBin = safePath.join(dirname(manifestPath), 'dist', 'bin.js');
|
|
131
|
+
// Still existence-checked: a dependency can be installed without having been
|
|
132
|
+
// built (a fresh workspace checkout, a partial install), and spawning a
|
|
133
|
+
// missing file would fail far from its cause.
|
|
90
134
|
// eslint-disable-next-line security/detect-non-literal-fs-filename -- checking for local install
|
|
91
|
-
if (existsSync(localBin))
|
|
135
|
+
if (existsSync(localBin))
|
|
92
136
|
return localBin;
|
|
93
|
-
}
|
|
94
|
-
const parent = dirname(current);
|
|
95
|
-
if (parent === current) {
|
|
96
|
-
// Reached filesystem root
|
|
97
|
-
break;
|
|
98
|
-
}
|
|
99
|
-
current = parent;
|
|
100
137
|
}
|
|
101
138
|
return null;
|
|
102
139
|
}
|
|
140
|
+
/**
|
|
141
|
+
* `require.resolve` reduced to "found it, or didn't".
|
|
142
|
+
*
|
|
143
|
+
* A failure here is priority 3's ordinary "not applicable" answer — no local
|
|
144
|
+
* install on this base — so it falls through to the next base and ultimately to
|
|
145
|
+
* the global install rather than failing the run.
|
|
146
|
+
*/
|
|
147
|
+
function tryResolve(fromPath, specifier) {
|
|
148
|
+
try {
|
|
149
|
+
return createRequire(fromPath).resolve(specifier);
|
|
150
|
+
}
|
|
151
|
+
catch {
|
|
152
|
+
return null;
|
|
153
|
+
}
|
|
154
|
+
}
|
|
103
155
|
/**
|
|
104
156
|
* Read version from package.json
|
|
105
157
|
* @param packageJsonPath - Path to package.json file
|
package/dist/bin/vat.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vat.js","sourceRoot":"","sources":["../../src/bin/vat.ts"],"names":[],"mappings":";AAEA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAG,OAAO,EAAE,MAAM,WAAW,CAAC;AACrC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,OAAO,EACL,qBAAqB,EACrB,qBAAqB,EACrB,iBAAiB,
|
|
1
|
+
{"version":3,"file":"vat.js","sourceRoot":"","sources":["../../src/bin/vat.ts"],"names":[],"mappings":";AAEA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAG,OAAO,EAAE,MAAM,WAAW,CAAC;AACrC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,OAAO,EACL,qBAAqB,EACrB,QAAQ,GACT,MAAM,2BAA2B,CAAC;AACnC,OAAO,EACL,qBAAqB,EACrB,iBAAiB,GAClB,MAAM,mCAAmC,CAAC;AAE3C,kFAAkF;AAClF,gFAAgF;AAChF,gFAAgF;AAChF,2EAA2E;AAC3E,mEAAmE;AACnE,0CAA0C;AAC1C,MAAM,aAAa,GAAG,iBAAiB,EAAE,CAAC;AAE1C;;;;;;;GAOG;AACH,SAAS,mBAAmB,CAAC,KAAc;IACzC,IAAI,KAAK,EAAE,CAAC;QACV,OAAO,CAAC,KAAK,CAAC,eAAe,qBAAqB,CAAC,aAAa,CAAC,EAAE,CAAC,CAAC;IACvE,CAAC;AACH,CAAC;AAED,MAAM,SAAS,GAAG,OAAO,CAAC,aAAa,CAAC,MAAM,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,CAAC;QACxB,MAAM,YAAY,GAAG,QAAQ,CAAC,IAAI,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC;QAC3D,YAAY,GAAG,WAAW,CAAC,YAAY,CAAC,CAAC;IAC3C,CAAC;IAED,eAAe;IACf,IAAI,KAAK,EAAE,CAAC;QACV,OAAO,CAAC,KAAK,CAAC,oBAAoB,GAAG,EAAE,CAAC,CAAC;QACzC,OAAO,CAAC,KAAK,CAAC,6BAA6B,WAAW,EAAE,CAAC,CAAC;QAC1D,OAAO,CAAC,KAAK,CAAC,wBAAwB,OAAO,EAAE,CAAC,CAAC;QACjD,OAAO,CAAC,KAAK,CAAC,uBAAuB,OAAO,EAAE,CAAC,CAAC;QAChD,OAAO,CAAC,KAAK,CAAC,+BAA+B,aAAa,IAAI,SAAS,EAAE,CAAC,CAAC;QAC3E,OAAO,CAAC,KAAK,CAAC,8BAA8B,YAAY,IAAI,KAAK,EAAE,CAAC,CAAC;QACrE,OAAO,CAAC,KAAK,CAAC,qBAAqB,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IACvD,CAAC;IAED,sFAAsF;IACtF,MAAM,WAAW,GAAG,OAAO,KAAK,KAAK,IAAI,OAAO,KAAK,OAAO,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,SAAS,CAAC;IACvF,QAAQ,CAAC,OAAO,EAAE,OAAO,EAAE,WAAW,CAAC,CAAC;AAC1C,CAAC;AAED,oBAAoB;AACpB,IAAI,EAAE,CAAC"}
|
package/dist/bin.js
CHANGED
|
@@ -3,23 +3,11 @@
|
|
|
3
3
|
* Main entry point for vat CLI
|
|
4
4
|
* Uses Commander.js for command structure
|
|
5
5
|
*/
|
|
6
|
-
import {
|
|
6
|
+
import { safePath } from '@vibe-agent-toolkit/utils';
|
|
7
|
+
import { describeStdioBlocking, makeStdioBlocking } from '@vibe-agent-toolkit/utils/process';
|
|
7
8
|
import { Command } from 'commander';
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import { createBuildTopLevelCommand } from './commands/build.js';
|
|
11
|
-
import { createCacheCommand, registerCacheControl } from './commands/cache/index.js';
|
|
12
|
-
import { createClaudeCommand } from './commands/claude/index.js';
|
|
13
|
-
import { createCorpusCommand } from './commands/corpus/index.js';
|
|
14
|
-
import { doctorCommand } from './commands/doctor.js';
|
|
15
|
-
import { createInventoryCommand } from './commands/inventory.js';
|
|
16
|
-
import { createMCPCommand } from './commands/mcp/index.js';
|
|
17
|
-
import { createRagCommand, showRagVerboseHelp } from './commands/rag/index.js';
|
|
18
|
-
import { createResourcesCommand, showResourcesVerboseHelp } from './commands/resources/index.js';
|
|
19
|
-
import { createSkillCommand } from './commands/skill/index.js';
|
|
20
|
-
import { createSkillsCommand } from './commands/skills/index.js';
|
|
21
|
-
import { createValidateTopLevelCommand } from './commands/validate.js';
|
|
22
|
-
import { createVerifyTopLevelCommand } from './commands/verify.js';
|
|
9
|
+
import { COMMAND_LOADERS } from './command-loaders.js';
|
|
10
|
+
import { registerCacheControl } from './commands/cache/cache-control.js';
|
|
23
11
|
import { loadVerboseHelp, writeHelpSync } from './utils/help-loader.js';
|
|
24
12
|
import { createLogger } from './utils/logger.js';
|
|
25
13
|
import { version, getVersionString } from './version.js';
|
|
@@ -122,7 +110,7 @@ if (process.argv.includes('resources') && process.argv.includes('--verbose')) {
|
|
|
122
110
|
const afterResources = argv.slice(resourcesIndex + 1);
|
|
123
111
|
const hasSubcommand = afterResources.some(arg => !arg.startsWith('-'));
|
|
124
112
|
if (!hasSubcommand) {
|
|
125
|
-
showResourcesVerboseHelp();
|
|
113
|
+
(await import('./commands/resources/index.js')).showResourcesVerboseHelp();
|
|
126
114
|
process.exit(0);
|
|
127
115
|
}
|
|
128
116
|
}
|
|
@@ -134,7 +122,7 @@ if (process.argv.includes('rag') && process.argv.includes('--verbose')) {
|
|
|
134
122
|
const afterRag = argv.slice(ragIndex + 1);
|
|
135
123
|
const hasSubcommand = afterRag.some(arg => !arg.startsWith('-'));
|
|
136
124
|
if (!hasSubcommand) {
|
|
137
|
-
showRagVerboseHelp();
|
|
125
|
+
(await import('./commands/rag/index.js')).showRagVerboseHelp();
|
|
138
126
|
process.exit(0);
|
|
139
127
|
}
|
|
140
128
|
}
|
|
@@ -146,28 +134,160 @@ if (process.argv.includes('agent') && process.argv.includes('--verbose')) {
|
|
|
146
134
|
const afterAgent = argv.slice(agentIndex + 1);
|
|
147
135
|
const hasSubcommand = afterAgent.some(arg => !arg.startsWith('-'));
|
|
148
136
|
if (!hasSubcommand) {
|
|
149
|
-
showAgentVerboseHelp();
|
|
137
|
+
(await import('./commands/agent/index.js')).showAgentVerboseHelp();
|
|
150
138
|
process.exit(0);
|
|
151
139
|
}
|
|
152
140
|
}
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
program
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
program
|
|
164
|
-
program.
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
141
|
+
/** Registers `doctor`, which attaches itself to the program rather than being added. */
|
|
142
|
+
const loadDoctor = async () => (await import('./commands/doctor.js')).doctorCommand(program);
|
|
143
|
+
/**
|
|
144
|
+
* Every option token this program DECLARES, and the subset that consumes the
|
|
145
|
+
* argv token after it.
|
|
146
|
+
*
|
|
147
|
+
* Read off commander's own declarations rather than hardcoded, because the
|
|
148
|
+
* blast radius grows with every future root option. Today that is `--version`,
|
|
149
|
+
* `--cwd <dir>`, `--debug` and `--no-cache`; only `--cwd` takes a value.
|
|
150
|
+
*
|
|
151
|
+
* ORDERING MATTERS: this must run AFTER `registerCacheControl(program)` above,
|
|
152
|
+
* which is what puts `--no-cache` into `program.options`. Built before that
|
|
153
|
+
* call, `--no-cache` would read as undeclared and every `vat --no-cache <verb>`
|
|
154
|
+
* would silently give up the lazy load and register the whole tree — a quiet
|
|
155
|
+
* perf regression with no failing test to announce it.
|
|
156
|
+
*
|
|
157
|
+
* Note what is deliberately NOT synthesised here: a `--no-x` twin for boolean
|
|
158
|
+
* options, and a positive `--cache` twin for `--no-cache`. Commander matches an
|
|
159
|
+
* option by exact string (`Option.is()` is `short === arg || long === arg`), so
|
|
160
|
+
* `--no-debug` and `--cache` are UNKNOWN options that end the parse in an
|
|
161
|
+
* error. Accepting them here would re-create the very bug this scan exists to
|
|
162
|
+
* avoid: a token commander rejects, treated by us as an ordinary flag to skip.
|
|
163
|
+
*/
|
|
164
|
+
const declaredRootFlags = new Set(['-h', '--help']);
|
|
165
|
+
const valueTakingRootFlags = new Set();
|
|
166
|
+
const declareRootFlag = (flag, takesValue) => {
|
|
167
|
+
if (!flag)
|
|
168
|
+
return;
|
|
169
|
+
declaredRootFlags.add(flag);
|
|
170
|
+
if (takesValue)
|
|
171
|
+
valueTakingRootFlags.add(flag);
|
|
172
|
+
};
|
|
173
|
+
for (const option of program.options) {
|
|
174
|
+
const takesValue = Boolean(option.required || option.optional);
|
|
175
|
+
declareRootFlag(option.short, takesValue);
|
|
176
|
+
declareRootFlag(option.long, takesValue);
|
|
177
|
+
}
|
|
178
|
+
/**
|
|
179
|
+
* Classify an option-shaped token against what this program declares.
|
|
180
|
+
*
|
|
181
|
+
* The `--flag=value` case is not just "strip the suffix": commander only
|
|
182
|
+
* accepts the inline form for a VALUE-TAKING option — its `--foo=bar` branch
|
|
183
|
+
* requires `option.required || option.optional` — so `--debug=1` is an unknown
|
|
184
|
+
* option even though `--debug` is declared.
|
|
185
|
+
*
|
|
186
|
+
* Anything unrecognised is reported as `undeclared` rather than guessed at.
|
|
187
|
+
* The cost of being wrong is asymmetric: a false `undeclared` only forfeits the
|
|
188
|
+
* lazy-load saving, while a false "declared" ships a wrong help page at exit 0.
|
|
189
|
+
*/
|
|
190
|
+
function classifyOptionToken(arg) {
|
|
191
|
+
const equalsIndex = arg.indexOf('=');
|
|
192
|
+
if (equalsIndex !== -1) {
|
|
193
|
+
return valueTakingRootFlags.has(arg.slice(0, equalsIndex)) ? 'self-contained' : 'undeclared';
|
|
194
|
+
}
|
|
195
|
+
if (!declaredRootFlags.has(arg))
|
|
196
|
+
return 'undeclared';
|
|
197
|
+
return valueTakingRootFlags.has(arg) ? 'consumes-next' : 'self-contained';
|
|
198
|
+
}
|
|
199
|
+
/**
|
|
200
|
+
* The command the user actually asked for, or `undefined` when the whole tree
|
|
201
|
+
* is needed (or nothing is).
|
|
202
|
+
*
|
|
203
|
+
* This must model commander's grammar, not just "the first token without a
|
|
204
|
+
* dash". Two ways a naive scan got it wrong, both shipped and both verified:
|
|
205
|
+
*
|
|
206
|
+
* - **An option's VALUE is not a verb.** `--cwd <dir>` takes a value that does
|
|
207
|
+
* not start with `-`, so `vat --cwd skills validate` picked `skills`,
|
|
208
|
+
* registered only that, and left `validate` unregistered — while
|
|
209
|
+
* `vat --cwd skills validate --help` printed ROOT help and exited **0**.
|
|
210
|
+
* Only the space-separated form was affected; `--cwd=skills` carries its
|
|
211
|
+
* value inline. The advertised `vat --cwd <dir> build` also lost the entire
|
|
212
|
+
* startup saving, since a non-colliding directory matched no loader key and
|
|
213
|
+
* fell through to loading everything.
|
|
214
|
+
* - **`--help` BEFORE the verb renders ROOT help**, which has to list every
|
|
215
|
+
* command. Loading only the named one made `vat --help audit` print a help
|
|
216
|
+
* page claiming the CLI has exactly one command, and exit 0. `vat audit
|
|
217
|
+
* --help` is the other order and returns on the verb before reaching the
|
|
218
|
+
* flag, so it still loads just `audit`.
|
|
219
|
+
* - **An UNDECLARED option is not a flag to skip over.** `--help` is only the
|
|
220
|
+
* most visible member of that class — it is not in `program.options` either,
|
|
221
|
+
* which is exactly why the bail-out above works. Commander's `parseOptions`
|
|
222
|
+
* switches its destination to `unknown` at the FIRST unrecognised
|
|
223
|
+
* option-shaped token and never switches back, so the verb after it never
|
|
224
|
+
* reaches `operands`; the run ends in `unknownOption()` +
|
|
225
|
+
* `showHelpAfterError()`, i.e. ROOT help. `vat --verbose audit` therefore
|
|
226
|
+
* printed an error page listing exactly one command. Every undeclared option
|
|
227
|
+
* gets the `--help` treatment for that reason.
|
|
228
|
+
* - **A lone `-` is an OPERAND, not an option.** Commander's `maybeOption`
|
|
229
|
+
* requires `arg.length > 1`, so `-` lands in `operands` and reaches the
|
|
230
|
+
* `command:*` handler as an unknown command — which again renders root help.
|
|
231
|
+
* Falling through to the operand return below hands `-` to the dispatcher,
|
|
232
|
+
* where it matches no loader key and the whole tree loads.
|
|
233
|
+
*
|
|
234
|
+
* `--` is option-shaped by the length test but declared by nobody, so it takes
|
|
235
|
+
* the undeclared bail-out. That is the right answer: commander treats every
|
|
236
|
+
* token after it as an operand, and loading the whole tree is always
|
|
237
|
+
* behaviourally correct — the scan only ever trades away startup time.
|
|
238
|
+
*/
|
|
239
|
+
function readRequestedCommand(argv) {
|
|
240
|
+
for (let index = 0; index < argv.length; index++) {
|
|
241
|
+
const arg = argv[index];
|
|
242
|
+
/* c8 ignore next -- index is bounded by argv.length */
|
|
243
|
+
if (arg === undefined)
|
|
244
|
+
continue;
|
|
245
|
+
if (arg === '--help' || arg === '-h')
|
|
246
|
+
return undefined;
|
|
247
|
+
if (arg.length > 1 && arg.startsWith('-')) {
|
|
248
|
+
const kind = classifyOptionToken(arg);
|
|
249
|
+
if (kind === 'undeclared')
|
|
250
|
+
return undefined;
|
|
251
|
+
if (kind === 'consumes-next')
|
|
252
|
+
index++;
|
|
253
|
+
continue;
|
|
254
|
+
}
|
|
255
|
+
return arg;
|
|
256
|
+
}
|
|
257
|
+
return undefined;
|
|
258
|
+
}
|
|
259
|
+
const requestedCommand = readRequestedCommand(process.argv.slice(2));
|
|
260
|
+
/**
|
|
261
|
+
* Whether this invocation is answerable without any command module.
|
|
262
|
+
*
|
|
263
|
+
* Only `--version` is: commander prints the version itself. A bare `vat` and
|
|
264
|
+
* every unknown command render help, which must list the whole tree.
|
|
265
|
+
*
|
|
266
|
+
* `-V` is deliberately NOT here. The short flag is unregistered on purpose (see
|
|
267
|
+
* the `-v` incident above `.version()`), so commander errors on it and
|
|
268
|
+
* `showHelpAfterError()` renders help — which, from a program with zero
|
|
269
|
+
* commands loaded, had no `Commands:` section at all and told the user the tool
|
|
270
|
+
* has no subcommands.
|
|
271
|
+
*/
|
|
272
|
+
const versionOnly = requestedCommand === undefined
|
|
273
|
+
&& process.argv.length > 2
|
|
274
|
+
&& process.argv.slice(2).every(arg => arg === '--version');
|
|
275
|
+
if (requestedCommand === 'doctor') {
|
|
276
|
+
await loadDoctor();
|
|
277
|
+
}
|
|
278
|
+
else if (requestedCommand !== undefined && Object.hasOwn(COMMAND_LOADERS, requestedCommand)) {
|
|
279
|
+
const load = COMMAND_LOADERS[requestedCommand];
|
|
280
|
+
/* c8 ignore next -- the hasOwn check above already proved the key is present */
|
|
281
|
+
if (load)
|
|
282
|
+
program.addCommand(await load());
|
|
283
|
+
}
|
|
284
|
+
else if (!versionOnly) {
|
|
285
|
+
// Help, a bare `vat`, or an unknown command: the whole tree has to exist so
|
|
286
|
+
// `--help` lists it and `command:*` can report what was not recognised.
|
|
287
|
+
for (const load of Object.values(COMMAND_LOADERS))
|
|
288
|
+
program.addCommand(await load());
|
|
289
|
+
await loadDoctor();
|
|
290
|
+
}
|
|
171
291
|
// Handle unknown commands
|
|
172
292
|
program.on('command:*', (operands) => {
|
|
173
293
|
const logger = createLogger();
|
package/dist/bin.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bin.js","sourceRoot":"","sources":["../src/bin.ts"],"names":[],"mappings":";AAEA;;;GAGG;AAGH,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"bin.js","sourceRoot":"","sources":["../src/bin.ts"],"names":[],"mappings":";AAEA;;;GAGG;AAGH,OAAO,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AACrD,OAAO,EAAE,qBAAqB,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAC;AAC7F,OAAO,EAAE,OAAO,EAAE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AAO,CAAC,KAAK,EAAE,CAAC;AAEhB,SAAS,eAAe;IACtB,aAAa,CAAC,eAAe,EAAE,CAAC,CAAC,CAAC,wCAAwC;AAC5E,CAAC"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Every top-level command except `doctor`, behind a loader.
|
|
3
|
+
*
|
|
4
|
+
* ## Why the factories are not called at module scope
|
|
5
|
+
*
|
|
6
|
+
* Each one transitively pulls `@vibe-agent-toolkit/resources` (~1.6s of module
|
|
7
|
+
* load on Windows, dominated by the markdown toolchain), so importing all
|
|
8
|
+
* fourteen made every invocation — `vat --version` included — pay for the whole
|
|
9
|
+
* CLI surface. Only the command named on the command line is loaded.
|
|
10
|
+
*
|
|
11
|
+
* ## Why `doctor` is not in the table
|
|
12
|
+
*
|
|
13
|
+
* It is the fifteenth top-level command and the only one outside this table, on
|
|
14
|
+
* purpose. `doctorCommand(program)` registers itself ONTO the program instead of
|
|
15
|
+
* returning a `Command`, so it does not fit the `() => Promise<Command>` shape —
|
|
16
|
+
* `bin.ts` special-cases it — and it is the command that READS this table, in
|
|
17
|
+
* `checkCommandModules`. Adding it here would have `doctor` check the one module
|
|
18
|
+
* that must already have loaded for the check to run at all.
|
|
19
|
+
*
|
|
20
|
+
* ## Why this is its own module and not part of `bin.ts`
|
|
21
|
+
*
|
|
22
|
+
* `bin.ts` is the executable: importing it PARSES ARGV AND RUNS A COMMAND. So
|
|
23
|
+
* nothing can read the loader table from there. `vat doctor` needs to, in order
|
|
24
|
+
* to answer "is this install complete?" — see `checkCommandModules`. Keep this
|
|
25
|
+
* module's own imports to `commander` and dynamic `import()` only; a static
|
|
26
|
+
* import added here is paid by every `vat` invocation again.
|
|
27
|
+
*/
|
|
28
|
+
import type { Command } from 'commander';
|
|
29
|
+
/**
|
|
30
|
+
* Command name → a loader that imports its module and builds the command.
|
|
31
|
+
*
|
|
32
|
+
* Insertion order is the order commands appear in `--help`; audit is common, so
|
|
33
|
+
* it is first.
|
|
34
|
+
*
|
|
35
|
+
* ⚠️ Look membership up with `Object.hasOwn`, never `in` and never a bare
|
|
36
|
+
* index. This is an object literal, so its prototype is `Object.prototype` and
|
|
37
|
+
* both of those see through to it: `vat toString` resolved to
|
|
38
|
+
* `Object.prototype.toString` — truthy, and callable — which got invoked and
|
|
39
|
+
* handed to `addCommand()`, crashing with an internal commander error where
|
|
40
|
+
* every other unrecognised verb prints "unknown command". Pinned by
|
|
41
|
+
* `test/integration/cli-basics.integration.test.ts`.
|
|
42
|
+
*/
|
|
43
|
+
export declare const COMMAND_LOADERS: Record<string, () => Promise<Command>>;
|
|
44
|
+
//# sourceMappingURL=command-loaders.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"command-loaders.d.ts","sourceRoot":"","sources":["../src/command-loaders.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEzC;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,OAAO,CAAC,OAAO,CAAC,CAelE,CAAC"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Every top-level command except `doctor`, behind a loader.
|
|
3
|
+
*
|
|
4
|
+
* ## Why the factories are not called at module scope
|
|
5
|
+
*
|
|
6
|
+
* Each one transitively pulls `@vibe-agent-toolkit/resources` (~1.6s of module
|
|
7
|
+
* load on Windows, dominated by the markdown toolchain), so importing all
|
|
8
|
+
* fourteen made every invocation — `vat --version` included — pay for the whole
|
|
9
|
+
* CLI surface. Only the command named on the command line is loaded.
|
|
10
|
+
*
|
|
11
|
+
* ## Why `doctor` is not in the table
|
|
12
|
+
*
|
|
13
|
+
* It is the fifteenth top-level command and the only one outside this table, on
|
|
14
|
+
* purpose. `doctorCommand(program)` registers itself ONTO the program instead of
|
|
15
|
+
* returning a `Command`, so it does not fit the `() => Promise<Command>` shape —
|
|
16
|
+
* `bin.ts` special-cases it — and it is the command that READS this table, in
|
|
17
|
+
* `checkCommandModules`. Adding it here would have `doctor` check the one module
|
|
18
|
+
* that must already have loaded for the check to run at all.
|
|
19
|
+
*
|
|
20
|
+
* ## Why this is its own module and not part of `bin.ts`
|
|
21
|
+
*
|
|
22
|
+
* `bin.ts` is the executable: importing it PARSES ARGV AND RUNS A COMMAND. So
|
|
23
|
+
* nothing can read the loader table from there. `vat doctor` needs to, in order
|
|
24
|
+
* to answer "is this install complete?" — see `checkCommandModules`. Keep this
|
|
25
|
+
* module's own imports to `commander` and dynamic `import()` only; a static
|
|
26
|
+
* import added here is paid by every `vat` invocation again.
|
|
27
|
+
*/
|
|
28
|
+
/**
|
|
29
|
+
* Command name → a loader that imports its module and builds the command.
|
|
30
|
+
*
|
|
31
|
+
* Insertion order is the order commands appear in `--help`; audit is common, so
|
|
32
|
+
* it is first.
|
|
33
|
+
*
|
|
34
|
+
* ⚠️ Look membership up with `Object.hasOwn`, never `in` and never a bare
|
|
35
|
+
* index. This is an object literal, so its prototype is `Object.prototype` and
|
|
36
|
+
* both of those see through to it: `vat toString` resolved to
|
|
37
|
+
* `Object.prototype.toString` — truthy, and callable — which got invoked and
|
|
38
|
+
* handed to `addCommand()`, crashing with an internal commander error where
|
|
39
|
+
* every other unrecognised verb prints "unknown command". Pinned by
|
|
40
|
+
* `test/integration/cli-basics.integration.test.ts`.
|
|
41
|
+
*/
|
|
42
|
+
export const COMMAND_LOADERS = {
|
|
43
|
+
audit: async () => (await import('./commands/audit.js')).createAuditCommand(),
|
|
44
|
+
corpus: async () => (await import('./commands/corpus/index.js')).createCorpusCommand(),
|
|
45
|
+
inventory: async () => (await import('./commands/inventory.js')).createInventoryCommand(),
|
|
46
|
+
resources: async () => (await import('./commands/resources/index.js')).createResourcesCommand(),
|
|
47
|
+
rag: async () => (await import('./commands/rag/index.js')).createRagCommand(),
|
|
48
|
+
agent: async () => (await import('./commands/agent/index.js')).createAgentCommand(),
|
|
49
|
+
mcp: async () => (await import('./commands/mcp/index.js')).createMCPCommand(),
|
|
50
|
+
skills: async () => (await import('./commands/skills/index.js')).createSkillsCommand(),
|
|
51
|
+
skill: async () => (await import('./commands/skill/index.js')).createSkillCommand(),
|
|
52
|
+
claude: async () => (await import('./commands/claude/index.js')).createClaudeCommand(),
|
|
53
|
+
cache: async () => (await import('./commands/cache/index.js')).createCacheCommand(),
|
|
54
|
+
build: async () => (await import('./commands/build.js')).createBuildTopLevelCommand(),
|
|
55
|
+
validate: async () => (await import('./commands/validate.js')).createValidateTopLevelCommand(),
|
|
56
|
+
verify: async () => (await import('./commands/verify.js')).createVerifyTopLevelCommand(),
|
|
57
|
+
};
|
|
58
|
+
//# sourceMappingURL=command-loaders.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"command-loaders.js","sourceRoot":"","sources":["../src/command-loaders.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAIH;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAC,MAAM,eAAe,GAA2C;IACrE,KAAK,EAAE,KAAK,IAAI,EAAE,CAAC,CAAC,MAAM,MAAM,CAAC,qBAAqB,CAAC,CAAC,CAAC,kBAAkB,EAAE;IAC7E,MAAM,EAAE,KAAK,IAAI,EAAE,CAAC,CAAC,MAAM,MAAM,CAAC,4BAA4B,CAAC,CAAC,CAAC,mBAAmB,EAAE;IACtF,SAAS,EAAE,KAAK,IAAI,EAAE,CAAC,CAAC,MAAM,MAAM,CAAC,yBAAyB,CAAC,CAAC,CAAC,sBAAsB,EAAE;IACzF,SAAS,EAAE,KAAK,IAAI,EAAE,CAAC,CAAC,MAAM,MAAM,CAAC,+BAA+B,CAAC,CAAC,CAAC,sBAAsB,EAAE;IAC/F,GAAG,EAAE,KAAK,IAAI,EAAE,CAAC,CAAC,MAAM,MAAM,CAAC,yBAAyB,CAAC,CAAC,CAAC,gBAAgB,EAAE;IAC7E,KAAK,EAAE,KAAK,IAAI,EAAE,CAAC,CAAC,MAAM,MAAM,CAAC,2BAA2B,CAAC,CAAC,CAAC,kBAAkB,EAAE;IACnF,GAAG,EAAE,KAAK,IAAI,EAAE,CAAC,CAAC,MAAM,MAAM,CAAC,yBAAyB,CAAC,CAAC,CAAC,gBAAgB,EAAE;IAC7E,MAAM,EAAE,KAAK,IAAI,EAAE,CAAC,CAAC,MAAM,MAAM,CAAC,4BAA4B,CAAC,CAAC,CAAC,mBAAmB,EAAE;IACtF,KAAK,EAAE,KAAK,IAAI,EAAE,CAAC,CAAC,MAAM,MAAM,CAAC,2BAA2B,CAAC,CAAC,CAAC,kBAAkB,EAAE;IACnF,MAAM,EAAE,KAAK,IAAI,EAAE,CAAC,CAAC,MAAM,MAAM,CAAC,4BAA4B,CAAC,CAAC,CAAC,mBAAmB,EAAE;IACtF,KAAK,EAAE,KAAK,IAAI,EAAE,CAAC,CAAC,MAAM,MAAM,CAAC,2BAA2B,CAAC,CAAC,CAAC,kBAAkB,EAAE;IACnF,KAAK,EAAE,KAAK,IAAI,EAAE,CAAC,CAAC,MAAM,MAAM,CAAC,qBAAqB,CAAC,CAAC,CAAC,0BAA0B,EAAE;IACrF,QAAQ,EAAE,KAAK,IAAI,EAAE,CAAC,CAAC,MAAM,MAAM,CAAC,wBAAwB,CAAC,CAAC,CAAC,6BAA6B,EAAE;IAC9F,MAAM,EAAE,KAAK,IAAI,EAAE,CAAC,CAAC,MAAM,MAAM,CAAC,sBAAsB,CAAC,CAAC,CAAC,2BAA2B,EAAE;CACzF,CAAC"}
|
|
@@ -135,7 +135,7 @@ Requirements:
|
|
|
135
135
|
.action(validateCommand)
|
|
136
136
|
.addHelpText('after', `
|
|
137
137
|
Description:
|
|
138
|
-
Validates agent manifest schema (using @vibe-agent-toolkit/
|
|
138
|
+
Validates agent manifest schema (using @vibe-agent-toolkit/schema),
|
|
139
139
|
LLM configuration, tool definitions, and resource availability. Outputs
|
|
140
140
|
YAML validation report to stdout, errors to stderr.
|
|
141
141
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"install.d.ts","sourceRoot":"","sources":["../../../src/commands/agent/install.ts"],"names":[],"mappings":"AAAA;;GAEG;AAaH,MAAM,WAAW,cAAc;IAC7B,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC3B,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED;;GAEG;AACH,wBAAsB,YAAY,CAChC,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,cAAc,GACtB,OAAO,CAAC,IAAI,CAAC,
|
|
1
|
+
{"version":3,"file":"install.d.ts","sourceRoot":"","sources":["../../../src/commands/agent/install.ts"],"names":[],"mappings":"AAAA;;GAEG;AAaH,MAAM,WAAW,cAAc;IAC7B,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC3B,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED;;GAEG;AACH,wBAAsB,YAAY,CAChC,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,cAAc,GACtB,OAAO,CAAC,IAAI,CAAC,CAoEf"}
|