@vibe-agent-toolkit/cli 0.2.0-rc.1 → 0.2.0-rc.3
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 +66 -15
- package/dist/bin/vat.js +66 -15
- package/dist/bin/vat.js.map +1 -1
- package/dist/bin.js +155 -36
- 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 +1 -1
- package/dist/commands/audit/distributed-tree.d.ts.map +1 -1
- package/dist/commands/audit/distributed-tree.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 +223 -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 +2 -2
- package/dist/commands/build.js.map +1 -1
- package/dist/commands/cache/cache-control.d.ts +73 -0
- package/dist/commands/cache/cache-control.d.ts.map +1 -0
- package/dist/commands/cache/cache-control.js +77 -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 +211 -0
- package/dist/commands/claude/context.d.ts.map +1 -0
- package/dist/commands/claude/context.js +709 -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 -20
- package/dist/commands/claude/marketplace/git-publish.js.map +1 -1
- package/dist/commands/claude/marketplace/validate.d.ts +1 -1
- package/dist/commands/claude/marketplace/validate.d.ts.map +1 -1
- package/dist/commands/claude/marketplace/validate.js +1 -1
- package/dist/commands/claude/marketplace/validate.js.map +1 -1
- package/dist/commands/claude/plugin/build.d.ts +16 -2
- package/dist/commands/claude/plugin/build.d.ts.map +1 -1
- package/dist/commands/claude/plugin/build.js +64 -11
- package/dist/commands/claude/plugin/build.js.map +1 -1
- package/dist/commands/claude/plugin/install.d.ts.map +1 -1
- package/dist/commands/claude/plugin/install.js +22 -2
- package/dist/commands/claude/plugin/install.js.map +1 -1
- package/dist/commands/claude/plugin/marketplace-json.d.ts +24 -9
- package/dist/commands/claude/plugin/marketplace-json.d.ts.map +1 -1
- package/dist/commands/claude/plugin/marketplace-json.js +10 -9
- package/dist/commands/claude/plugin/marketplace-json.js.map +1 -1
- package/dist/commands/consistency-check.d.ts.map +1 -1
- package/dist/commands/consistency-check.js +3 -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.js +1 -1
- 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 +17 -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 +96 -0
- 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 +1 -1
- package/dist/commands/phase-utils.d.ts.map +1 -1
- package/dist/commands/positional-args.js +1 -1
- package/dist/commands/positional-args.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 +18 -5
- 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 +6 -3
- 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 +112 -10
- package/dist/commands/skill/test/run.js.map +1 -1
- package/dist/commands/skills/build.d.ts +1 -1
- package/dist/commands/skills/build.d.ts.map +1 -1
- package/dist/commands/skills/build.js +72 -37
- 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/scope-guard.js +1 -1
- package/dist/commands/skills/scope-guard.js.map +1 -1
- package/dist/commands/skills/validate.d.ts +1 -1
- package/dist/commands/skills/validate.d.ts.map +1 -1
- package/dist/commands/skills/validate.js +37 -19
- package/dist/commands/skills/validate.js.map +1 -1
- package/dist/commands/validate.d.ts.map +1 -1
- package/dist/commands/validate.js +2 -1
- package/dist/commands/validate.js.map +1 -1
- package/dist/commands/verify.d.ts +2 -2
- package/dist/commands/verify.d.ts.map +1 -1
- package/dist/commands/verify.js +4 -4
- package/dist/commands/verify.js.map +1 -1
- package/dist/utils/command-error.d.ts +1 -1
- package/dist/utils/command-error.d.ts.map +1 -1
- package/dist/utils/command-error.js +1 -1
- 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 +59 -0
- package/dist/utils/population-wiring.d.ts.map +1 -0
- package/dist/utils/population-wiring.js +55 -0
- package/dist/utils/population-wiring.js.map +1 -0
- package/dist/utils/projection-store.d.ts +186 -0
- package/dist/utils/projection-store.d.ts.map +1 -0
- package/dist/utils/projection-store.js +255 -0
- package/dist/utils/projection-store.js.map +1 -0
- package/dist/utils/resource-loader.d.ts +127 -1
- package/dist/utils/resource-loader.d.ts.map +1 -1
- package/dist/utils/resource-loader.js +224 -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
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Resolving a command-line path argument into a target INSIDE a corpus root.
|
|
3
|
+
*
|
|
4
|
+
* Shared by every command that populates one tree and then answers questions
|
|
5
|
+
* about positions in it — `vat claude context` and `vat claude budget` today.
|
|
6
|
+
* They ask different questions and default differently when no path is named,
|
|
7
|
+
* but "is this argument inside the tree I enumerated, and what is it called
|
|
8
|
+
* there" is one rule, and a second copy of it would be free to drift on the one
|
|
9
|
+
* clause that only fails where nobody looks (see {@link escapesCorpusRoot}).
|
|
10
|
+
*/
|
|
11
|
+
import { isAbsoluteAnyPlatform, safePath } from '@vibe-agent-toolkit/utils';
|
|
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
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* The root-relative path to query, refusing anything outside the corpus.
|
|
43
|
+
*
|
|
44
|
+
* @param root - The discovered project root
|
|
45
|
+
* @param pathArg - The path argument, or undefined for the current directory
|
|
46
|
+
* @param commandName - The command saying so, for the refusal's wording
|
|
47
|
+
* @returns The root-relative, forward-slashed target. `''` is the corpus root
|
|
48
|
+
* @throws When the argument resolves outside `root` — answering for it would
|
|
49
|
+
* mean querying a corpus this projection never enumerated, and a confident
|
|
50
|
+
* "nothing here" would be indistinguishable from a typo inside the tree
|
|
51
|
+
*/
|
|
52
|
+
export function targetPathWithin(root, pathArg, commandName) {
|
|
53
|
+
const relative = safePath.relative(root, safePath.resolve(process.cwd(), pathArg ?? '.'));
|
|
54
|
+
if (escapesCorpusRoot(relative)) {
|
|
55
|
+
throw new Error(`${pathArg ?? process.cwd()} resolves outside the corpus root ${root}.`
|
|
56
|
+
+ ` ${commandName} answers only for paths inside the root it discovered —`
|
|
57
|
+
+ ' run it from within the project you mean to ask about.');
|
|
58
|
+
}
|
|
59
|
+
return relative;
|
|
60
|
+
}
|
|
61
|
+
//# sourceMappingURL=corpus-target.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"corpus-target.js","sourceRoot":"","sources":["../../src/utils/corpus-target.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,qBAAqB,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AAE5E;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,MAAM,UAAU,iBAAiB,CAAC,kBAA0B;IAC1D,OAAO,kBAAkB,KAAK,IAAI;WAC7B,kBAAkB,CAAC,UAAU,CAAC,KAAK,CAAC;WACpC,qBAAqB,CAAC,kBAAkB,CAAC,CAAC;AACjD,CAAC;AAED;;;;;;;;;;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,iBAAiB,CAAC,QAAQ,CAAC,EAAE,CAAC;QAChC,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"}
|
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
* Rendering for the four `ValidationIssue` anchors.
|
|
3
3
|
*
|
|
4
4
|
* `location` / `line` / `field` are independent fields on the issue (see the
|
|
5
|
-
* anchor contract on `ValidationIssue` in `@vibe-agent-toolkit/
|
|
5
|
+
* anchor contract on `ValidationIssue` in `@vibe-agent-toolkit/schema`).
|
|
6
6
|
* Splitting them apart in the producers only pays off if the renderers put
|
|
7
7
|
* them back together — a `line` that no output surface prints is a `line` that,
|
|
8
8
|
* from the user's side, was deleted. This is the one place that join happens,
|
|
9
9
|
* so every command spells an anchor the same way.
|
|
10
10
|
*/
|
|
11
|
-
import type { ValidationIssue } from '@vibe-agent-toolkit/
|
|
11
|
+
import type { ValidationIssue } from '@vibe-agent-toolkit/schema';
|
|
12
12
|
/**
|
|
13
13
|
* Render an issue's anchor as a single human/tool-readable string.
|
|
14
14
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"issue-anchor.d.ts","sourceRoot":"","sources":["../../src/utils/issue-anchor.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"issue-anchor.d.ts","sourceRoot":"","sources":["../../src/utils/issue-anchor.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAElE;;;;;;;;;;;;GAYG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,eAAe,GAAG,MAAM,GAAG,SAAS,CAe5E"}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Rendering for the four `ValidationIssue` anchors.
|
|
3
3
|
*
|
|
4
4
|
* `location` / `line` / `field` are independent fields on the issue (see the
|
|
5
|
-
* anchor contract on `ValidationIssue` in `@vibe-agent-toolkit/
|
|
5
|
+
* anchor contract on `ValidationIssue` in `@vibe-agent-toolkit/schema`).
|
|
6
6
|
* Splitting them apart in the producers only pays off if the renderers put
|
|
7
7
|
* them back together — a `line` that no output surface prints is a `line` that,
|
|
8
8
|
* from the user's side, was deleted. This is the one place that join happens,
|
|
@@ -15,8 +15,8 @@
|
|
|
15
15
|
* passed"). That is why none of it was ever reported — it produces silence, not
|
|
16
16
|
* a false alarm.
|
|
17
17
|
*/
|
|
18
|
-
import { type SeverityCounts, type ValidationIssue } from '@vibe-agent-toolkit/agent-schema';
|
|
19
18
|
import type { PackageSkillResult } from '@vibe-agent-toolkit/agent-skills';
|
|
19
|
+
import { type SeverityCounts, type ValidationIssue } from '@vibe-agent-toolkit/schema';
|
|
20
20
|
/** Render an issue's own severity as itself. */
|
|
21
21
|
export declare function severityLabel(severity: ValidationIssue['severity']): string;
|
|
22
22
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"issue-rendering.d.ts","sourceRoot":"","sources":["../../src/utils/issue-rendering.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,
|
|
1
|
+
{"version":3,"file":"issue-rendering.d.ts","sourceRoot":"","sources":["../../src/utils/issue-rendering.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAC;AAC3E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sB,CACpC,MAAM,EAAE,SAAS,eAAe,EAAE,EAClC,OAAO,EAAE,OAAO,GACf,MAAM,CAKR;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,2BAA2B,CACzC,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,MAAM,GACb,MAAM,GAAG,SAAS,CAMpB;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,kBAAkB,GAAG,MAAM,CAG1E;AAED,2EAA2E;AAC3E,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,SAAS,cAAc,EAAE,GAAG,cAAc,CASnF"}
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
* passed"). That is why none of it was ever reported — it produces silence, not
|
|
16
16
|
* a false alarm.
|
|
17
17
|
*/
|
|
18
|
-
import { countBySeverity, } from '@vibe-agent-toolkit/
|
|
18
|
+
import { countBySeverity, } from '@vibe-agent-toolkit/schema';
|
|
19
19
|
import { formatIssueAnchor } from './issue-anchor.js';
|
|
20
20
|
/**
|
|
21
21
|
* Uppercase label for a resolved severity.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"issue-rendering.js","sourceRoot":"","sources":["../../src/utils/issue-rendering.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;
|
|
1
|
+
{"version":3,"file":"issue-rendering.js","sourceRoot":"","sources":["../../src/utils/issue-rendering.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAGH,OAAO,EACL,eAAe,GAGhB,MAAM,4BAA4B,CAAC;AAEpC,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAEtD;;;;;GAKG;AACH,MAAM,eAAe,GAAgD;IACnE,KAAK,EAAE,OAAO;IACd,OAAO,EAAE,SAAS;IAClB,IAAI,EAAE,MAAM;IACZ,MAAM,EAAE,SAAS;CAClB,CAAC;AAEF,gDAAgD;AAChD,MAAM,UAAU,aAAa,CAA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AAC,MAAM,EAAE,IAAI,CAAC,CAAC,MAAM;UAC5C,yBAAyB,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,MAAM,CACpD,CAAC;AACJ,CAAC;AAED;;;;;;;;;;;;;;;GAeG;AACH,MAAM,UAAU,2BAA2B,CACzC,SAAiB,EACjB,MAAc;IAEd,IAAI,SAAS,IAAI,CAAC;QAAE,OAAO,SAAS,CAAC;IACrC,OAAO,CACL,KAAK,SAAS,8DAA8D;UAC1E,gBAAgB,MAAM,sDAAsD,CAC/E,CAAC;AACJ,CAAC;AAED;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,uBAAuB,CAAC,MAA0B;IAChE,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC,YAAY,CAAC,MAAM,GAAG,CAAC,CAAC;IACnD,OAAO,GAAG,KAAK,QAAQ,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC;AAClD,CAAC;AAED,2EAA2E;AAC3E,MAAM,UAAU,iBAAiB,CAAC,MAAiC;IACjE,OAAO,MAAM,CAAC,MAAM,CAClB,CAAC,GAAG,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC;QACX,MAAM,EAAE,GAAG,CAAC,MAAM,GAAG,CAAC,CAAC,MAAM;QAC7B,QAAQ,EAAE,GAAG,CAAC,QAAQ,GAAG,CAAC,CAAC,QAAQ;QACnC,IAAI,EAAE,GAAG,CAAC,IAAI,GAAG,CAAC,CAAC,IAAI;KACxB,CAAC,EACF,EAAE,MAAM,EAAE,CAAC,EAAE,QAAQ,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,CACpC,CAAC;AACJ,CAAC"}
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
* findings imports this; nobody writes a fourth copy. Same rule as
|
|
19
19
|
* `resolveAssetReference` and `resolveSkillReference` in CLAUDE.md.
|
|
20
20
|
*/
|
|
21
|
-
import { type ValidationIssue } from '@vibe-agent-toolkit/
|
|
21
|
+
import { type ValidationIssue } from '@vibe-agent-toolkit/schema';
|
|
22
22
|
/** A `validation.severity` map as it appears in config, or nothing. */
|
|
23
23
|
export interface SeverityOverrides {
|
|
24
24
|
severity?: Record<string, string> | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"issue-severity.d.ts","sourceRoot":"","sources":["../../src/utils/issue-severity.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAmC,KAAK,eAAe,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"issue-severity.d.ts","sourceRoot":"","sources":["../../src/utils/issue-severity.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAmC,KAAK,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAEnG,uEAAuE;AACvE,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,SAAS,CAAC;CAC/C;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,oBAAoB,CAClC,MAAM,EAAE,SAAS,eAAe,EAAE,EAClC,UAAU,EAAE,iBAAiB,GAAG,SAAS,GACxC,eAAe,EAAE,CAenB"}
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
* findings imports this; nobody writes a fourth copy. Same rule as
|
|
19
19
|
* `resolveAssetReference` and `resolveSkillReference` in CLAUDE.md.
|
|
20
20
|
*/
|
|
21
|
-
import { resolveSeverity } from '@vibe-agent-toolkit/
|
|
21
|
+
import { resolveSeverity } from '@vibe-agent-toolkit/schema';
|
|
22
22
|
/**
|
|
23
23
|
* Re-severity findings against a `validation.severity` map, dropping the codes
|
|
24
24
|
* resolved to `ignore`.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"issue-severity.js","sourceRoot":"","sources":["../../src/utils/issue-severity.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAkB,eAAe,EAAwB,MAAM,
|
|
1
|
+
{"version":3,"file":"issue-severity.js","sourceRoot":"","sources":["../../src/utils/issue-severity.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAkB,eAAe,EAAwB,MAAM,4BAA4B,CAAC;AAOnG;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,MAAM,UAAU,oBAAoB,CAClC,MAAkC,EAClC,UAAyC;IAEzC,MAAM,SAAS,GAAG,UAAU,EAAE,QAAQ,CAAC;IACvC,IAAI,SAAS,KAAK,SAAS;QAAE,OAAO,CAAC,GAAG,MAAM,CAAC,CAAC;IAEhD,MAAM,QAAQ,GAAsB,EAAE,CAAC;IACvC,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE,CAAC;QAC3B,IAAI,CAAC,CAAC,KAAK,CAAC,IAAI,IAAI,SAAS,CAAC,EAAE,CAAC;YAC/B,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;YACrB,SAAS;QACX,CAAC;QACD,MAAM,QAAQ,GAAG,eAAe,CAAC,KAAK,CAAC,IAAiB,EAAE,EAAE,QAAQ,EAAE,SAAS,EAAE,CAAC,CAAC;QACnF,IAAI,QAAQ,KAAK,QAAQ;YAAE,SAAS;QACpC,QAAQ,CAAC,IAAI,CAAC,QAAQ,KAAK,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,GAAG,KAAK,EAAE,QAAQ,EAAE,CAAC,CAAC;IAC9E,CAAC;IACD,OAAO,QAAQ,CAAC;AAClB,CAAC"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Lazy loading for **optional heavy backends** — the seam that keeps a
|
|
3
|
+
* multi-hundred-megabyte dependency out of every other command's cost.
|
|
4
|
+
*
|
|
5
|
+
* ## Why this exists rather than four `await import()` calls
|
|
6
|
+
*
|
|
7
|
+
* `@vibe-agent-toolkit/rag-lancedb` pulls a platform-native LanceDB binary
|
|
8
|
+
* (119.6 MiB unpacked on `win32-x64`, 40.3 MiB compressed to download) plus
|
|
9
|
+
* `onnxruntime-web` (133 MB) and `gpt-tokenizer` (44 MB). Measured on the
|
|
10
|
+
* published `vibe-agent-toolkit@0.1.42`: **275 MB of a 351 MB install is the
|
|
11
|
+
* RAG lane**, and a static import chain from `bin.ts` meant
|
|
12
|
+
* `import('@lancedb/lancedb')` — **1,350 ms cold** — ran before `vat --version`
|
|
13
|
+
* could print a string. It is a named seam rather than a one-off fix because
|
|
14
|
+
* "optional backend" is a shape VAT keeps growing — a projection store is
|
|
15
|
+
* loaded through it too — not because any one dependency is special.
|
|
16
|
+
*
|
|
17
|
+
* ## What it does NOT do
|
|
18
|
+
*
|
|
19
|
+
* It does not fall back, retry, or degrade. An absent backend is a legible
|
|
20
|
+
* error naming the package to install, and nothing more — the point is that
|
|
21
|
+
* the failure is readable, not that it is survivable.
|
|
22
|
+
*/
|
|
23
|
+
/**
|
|
24
|
+
* Whether a thrown value is Node's "module not installed" error.
|
|
25
|
+
*
|
|
26
|
+
* Exported because every optional backend asks it, and a second copy would be
|
|
27
|
+
* free to drift onto the message.
|
|
28
|
+
*
|
|
29
|
+
* @param error - The thrown value
|
|
30
|
+
* @returns True when the module could not be resolved at all
|
|
31
|
+
*/
|
|
32
|
+
export declare function isModuleMissing(error: unknown): boolean;
|
|
33
|
+
/**
|
|
34
|
+
* Report an uninstalled backend and exit, in the shape every other command
|
|
35
|
+
* failure takes.
|
|
36
|
+
*
|
|
37
|
+
* Exit code **2** — a system error, not a validation failure. An absent
|
|
38
|
+
* optional package is a fact about the installation rather than about the
|
|
39
|
+
* user's corpus, and a caller scripting `vat` must be able to tell those apart
|
|
40
|
+
* from the exit code alone.
|
|
41
|
+
*
|
|
42
|
+
* Exported for the backends that are not selected by a Commander action —
|
|
43
|
+
* {@link lazyAction} is the shape most take, but a store chosen by an
|
|
44
|
+
* environment variable is loaded from inside a command rather than in place of
|
|
45
|
+
* one, and it must fail the same way.
|
|
46
|
+
*
|
|
47
|
+
* @param backend - What to name and how to install it
|
|
48
|
+
* @returns Never; the process exits
|
|
49
|
+
*/
|
|
50
|
+
export declare function reportMissingBackend(backend: OptionalBackend): never;
|
|
51
|
+
/** One optional backend, as a user is told to install it. */
|
|
52
|
+
export interface OptionalBackend {
|
|
53
|
+
/** Human name used in the error message, e.g. `RAG`. */
|
|
54
|
+
readonly feature: string;
|
|
55
|
+
/** The npm package to install, e.g. `@vibe-agent-toolkit/rag-lancedb`. */
|
|
56
|
+
readonly packageName: string;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Bind a Commander action that loads its implementation on first invocation.
|
|
60
|
+
*
|
|
61
|
+
* The returned function has the same shape Commander expects, so a command
|
|
62
|
+
* declaration keeps every option, description and help block it had — only the
|
|
63
|
+
* *implementation* moves behind the `await`. Help text is static data and must
|
|
64
|
+
* stay eagerly available, which is exactly why the split is at the action
|
|
65
|
+
* rather than at the command.
|
|
66
|
+
*
|
|
67
|
+
* @param backend - What to name in the error when the import fails to resolve
|
|
68
|
+
* @param load - Imports the module and returns the handler out of it
|
|
69
|
+
* @returns A Commander action that loads, then delegates
|
|
70
|
+
*
|
|
71
|
+
* @example
|
|
72
|
+
* ```typescript
|
|
73
|
+
* .action(lazyAction(RAG_BACKEND, async () => (await import('./index-command.js')).indexCommand))
|
|
74
|
+
* ```
|
|
75
|
+
*/
|
|
76
|
+
export declare function lazyAction<Args extends readonly unknown[]>(backend: OptionalBackend, load: () => Promise<(...args: Args) => unknown>): (...args: Args) => Promise<void>;
|
|
77
|
+
//# sourceMappingURL=optional-backend.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"optional-backend.d.ts","sourceRoot":"","sources":["../../src/utils/optional-backend.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAkBH;;;;;;;;GAQG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAOvD;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,eAAe,GAAG,KAAK,CAcpE;AAED,6DAA6D;AAC7D,MAAM,WAAW,eAAe;IAC9B,wDAAwD;IACxD,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,0EAA0E;IAC1E,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;CAC9B;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,UAAU,CAAC,IAAI,SAAS,SAAS,OAAO,EAAE,EACxD,OAAO,EAAE,eAAe,EACxB,IAAI,EAAE,MAAM,OAAO,CAAC,CAAC,GAAG,IAAI,EAAE,IAAI,KAAK,OAAO,CAAC,GAC9C,CAAC,GAAG,IAAI,EAAE,IAAI,KAAK,OAAO,CAAC,IAAI,CAAC,CAalC"}
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Lazy loading for **optional heavy backends** — the seam that keeps a
|
|
3
|
+
* multi-hundred-megabyte dependency out of every other command's cost.
|
|
4
|
+
*
|
|
5
|
+
* ## Why this exists rather than four `await import()` calls
|
|
6
|
+
*
|
|
7
|
+
* `@vibe-agent-toolkit/rag-lancedb` pulls a platform-native LanceDB binary
|
|
8
|
+
* (119.6 MiB unpacked on `win32-x64`, 40.3 MiB compressed to download) plus
|
|
9
|
+
* `onnxruntime-web` (133 MB) and `gpt-tokenizer` (44 MB). Measured on the
|
|
10
|
+
* published `vibe-agent-toolkit@0.1.42`: **275 MB of a 351 MB install is the
|
|
11
|
+
* RAG lane**, and a static import chain from `bin.ts` meant
|
|
12
|
+
* `import('@lancedb/lancedb')` — **1,350 ms cold** — ran before `vat --version`
|
|
13
|
+
* could print a string. It is a named seam rather than a one-off fix because
|
|
14
|
+
* "optional backend" is a shape VAT keeps growing — a projection store is
|
|
15
|
+
* loaded through it too — not because any one dependency is special.
|
|
16
|
+
*
|
|
17
|
+
* ## What it does NOT do
|
|
18
|
+
*
|
|
19
|
+
* It does not fall back, retry, or degrade. An absent backend is a legible
|
|
20
|
+
* error naming the package to install, and nothing more — the point is that
|
|
21
|
+
* the failure is readable, not that it is survivable.
|
|
22
|
+
*/
|
|
23
|
+
// Deliberately NOT `commands/rag/command-helpers.js`, which is where the rest
|
|
24
|
+
// of the rag lane's shared helpers live: that module statically imports
|
|
25
|
+
// `@vibe-agent-toolkit/rag-lancedb`, so reaching for its `handleCommandError`
|
|
26
|
+
// here would load the very backend this file exists to defer.
|
|
27
|
+
import { writeYamlOutput } from './output.js';
|
|
28
|
+
/**
|
|
29
|
+
* Node's code for "the module is genuinely not installed".
|
|
30
|
+
*
|
|
31
|
+
* Matched on `code`, never on the message: the message embeds the specifier and
|
|
32
|
+
* the importing file and is not a stable contract, while the code is. A miss
|
|
33
|
+
* here would be reported as a missing backend when the real cause was a syntax
|
|
34
|
+
* error *inside* the backend, which is the worst possible diagnosis.
|
|
35
|
+
*/
|
|
36
|
+
const MODULE_NOT_FOUND = 'ERR_MODULE_NOT_FOUND';
|
|
37
|
+
/**
|
|
38
|
+
* Whether a thrown value is Node's "module not installed" error.
|
|
39
|
+
*
|
|
40
|
+
* Exported because every optional backend asks it, and a second copy would be
|
|
41
|
+
* free to drift onto the message.
|
|
42
|
+
*
|
|
43
|
+
* @param error - The thrown value
|
|
44
|
+
* @returns True when the module could not be resolved at all
|
|
45
|
+
*/
|
|
46
|
+
export function isModuleMissing(error) {
|
|
47
|
+
return (typeof error === 'object'
|
|
48
|
+
&& error !== null
|
|
49
|
+
&& 'code' in error
|
|
50
|
+
&& error.code === MODULE_NOT_FOUND);
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Report an uninstalled backend and exit, in the shape every other command
|
|
54
|
+
* failure takes.
|
|
55
|
+
*
|
|
56
|
+
* Exit code **2** — a system error, not a validation failure. An absent
|
|
57
|
+
* optional package is a fact about the installation rather than about the
|
|
58
|
+
* user's corpus, and a caller scripting `vat` must be able to tell those apart
|
|
59
|
+
* from the exit code alone.
|
|
60
|
+
*
|
|
61
|
+
* Exported for the backends that are not selected by a Commander action —
|
|
62
|
+
* {@link lazyAction} is the shape most take, but a store chosen by an
|
|
63
|
+
* environment variable is loaded from inside a command rather than in place of
|
|
64
|
+
* one, and it must fail the same way.
|
|
65
|
+
*
|
|
66
|
+
* @param backend - What to name and how to install it
|
|
67
|
+
* @returns Never; the process exits
|
|
68
|
+
*/
|
|
69
|
+
export function reportMissingBackend(backend) {
|
|
70
|
+
const install = `npm install ${backend.packageName}`;
|
|
71
|
+
process.stderr.write(`${backend.feature} is an optional feature and its backend is not installed.\n`
|
|
72
|
+
+ `\nInstall it with: ${install}\n`
|
|
73
|
+
+ '\nIt ships separately because it carries a platform-native binary that every\n'
|
|
74
|
+
+ 'other vat command would otherwise download and load.\n');
|
|
75
|
+
writeYamlOutput({
|
|
76
|
+
status: 'error',
|
|
77
|
+
error: `${backend.feature} backend not installed: ${backend.packageName}`,
|
|
78
|
+
fix: install,
|
|
79
|
+
});
|
|
80
|
+
process.exit(2);
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Bind a Commander action that loads its implementation on first invocation.
|
|
84
|
+
*
|
|
85
|
+
* The returned function has the same shape Commander expects, so a command
|
|
86
|
+
* declaration keeps every option, description and help block it had — only the
|
|
87
|
+
* *implementation* moves behind the `await`. Help text is static data and must
|
|
88
|
+
* stay eagerly available, which is exactly why the split is at the action
|
|
89
|
+
* rather than at the command.
|
|
90
|
+
*
|
|
91
|
+
* @param backend - What to name in the error when the import fails to resolve
|
|
92
|
+
* @param load - Imports the module and returns the handler out of it
|
|
93
|
+
* @returns A Commander action that loads, then delegates
|
|
94
|
+
*
|
|
95
|
+
* @example
|
|
96
|
+
* ```typescript
|
|
97
|
+
* .action(lazyAction(RAG_BACKEND, async () => (await import('./index-command.js')).indexCommand))
|
|
98
|
+
* ```
|
|
99
|
+
*/
|
|
100
|
+
export function lazyAction(backend, load) {
|
|
101
|
+
return async (...args) => {
|
|
102
|
+
let handler;
|
|
103
|
+
try {
|
|
104
|
+
handler = await load();
|
|
105
|
+
}
|
|
106
|
+
catch (error) {
|
|
107
|
+
if (!isModuleMissing(error)) {
|
|
108
|
+
throw error;
|
|
109
|
+
}
|
|
110
|
+
reportMissingBackend(backend);
|
|
111
|
+
}
|
|
112
|
+
await handler(...args);
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
//# sourceMappingURL=optional-backend.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"optional-backend.js","sourceRoot":"","sources":["../../src/utils/optional-backend.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,8EAA8E;AAC9E,wEAAwE;AACxE,8EAA8E;AAC9E,8DAA8D;AAC9D,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAE9C;;;;;;;GAOG;AACH,MAAM,gBAAgB,GAAG,sBAAsB,CAAC;AAEhD;;;;;;;;GAQG;AACH,MAAM,UAAU,eAAe,CAAC,KAAc;IAC5C,OAAO,CACL,OAAO,KAAK,KAAK,QAAQ;WACtB,KAAK,KAAK,IAAI;WACd,MAAM,IAAI,KAAK;WACd,KAA4B,CAAC,IAAI,KAAK,gBAAgB,CAC3D,CAAC;AACJ,CAAC;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,UAAU,oBAAoB,CAAC,OAAwB;IAC3D,MAAM,OAAO,GAAG,eAAe,OAAO,CAAC,WAAW,EAAE,CAAC;IACrD,OAAO,CAAC,MAAM,CAAC,KAAK,CAClB,GAAG,OAAO,CAAC,OAAO,6DAA6D;UAC7E,uBAAuB,OAAO,IAAI;UAClC,gFAAgF;UAChF,wDAAwD,CAC3D,CAAC;IACF,eAAe,CAAC;QACd,MAAM,EAAE,OAAO;QACf,KAAK,EAAE,GAAG,OAAO,CAAC,OAAO,2BAA2B,OAAO,CAAC,WAAW,EAAE;QACzE,GAAG,EAAE,OAAO;KACb,CAAC,CAAC;IACH,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC;AAUD;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,UAAU,UAAU,CACxB,OAAwB,EACxB,IAA+C;IAE/C,OAAO,KAAK,EAAE,GAAG,IAAU,EAAiB,EAAE;QAC5C,IAAI,OAA0C,CAAC;QAC/C,IAAI,CAAC;YACH,OAAO,GAAG,MAAM,IAAI,EAAE,CAAC;QACzB,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,IAAI,CAAC,eAAe,CAAC,KAAK,CAAC,EAAE,CAAC;gBAC5B,MAAM,KAAK,CAAC;YACd,CAAC;YACD,oBAAoB,CAAC,OAAO,CAAC,CAAC;QAChC,CAAC;QACD,MAAM,OAAO,CAAC,GAAG,IAAI,CAAC,CAAC;IACzB,CAAC,CAAC;AACJ,CAAC"}
|
package/dist/utils/output.d.ts
CHANGED
|
@@ -76,6 +76,23 @@ export declare function writeAllSync(write: SyncWriter, buffer: Buffer, options?
|
|
|
76
76
|
* @param data - Data to serialize as YAML
|
|
77
77
|
*/
|
|
78
78
|
export declare function writeYamlOutput(data: unknown): void;
|
|
79
|
+
/**
|
|
80
|
+
* Write a single JSON document to stdout.
|
|
81
|
+
*
|
|
82
|
+
* The sibling of {@link writeYamlOutput}, for the same payloads, and it exists
|
|
83
|
+
* because a consumer that has to parse YAML needs a YAML parser: JSON is the
|
|
84
|
+
* format every language reads without one. `vat resources validate` already
|
|
85
|
+
* offers `--format json` for exactly this reason; a scan document that could
|
|
86
|
+
* only be had as YAML made the population it reports the harder of the two to
|
|
87
|
+
* consume programmatically, which is backwards.
|
|
88
|
+
*
|
|
89
|
+
* Written the same way as its YAML sibling, and the comment there applies
|
|
90
|
+
* verbatim: the ordinary stream write keeps this summary behind any
|
|
91
|
+
* human-readable progress already buffered on the same channel.
|
|
92
|
+
*
|
|
93
|
+
* @param data - Data to serialize as JSON
|
|
94
|
+
*/
|
|
95
|
+
export declare function writeJsonOutput(data: unknown): void;
|
|
79
96
|
/**
|
|
80
97
|
* Write a test-format finding to stderr.
|
|
81
98
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"output.d.ts","sourceRoot":"","sources":["../../src/utils/output.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAMH;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAKrD;AAED;;;;;GAKG;AACH,MAAM,MAAM,UAAU,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,KAAK,MAAM,CAAC;AAoCpF,MAAM,WAAW,mBAAmB;IAClC,gFAAgF;IAChF,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,6EAA6E;IAC7E,kBAAkB,CAAC,EAAE,CAAC,kBAAkB,EAAE,MAAM,KAAK,IAAI,CAAC;CAC3D;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,YAAY,CAC1B,KAAK,EAAE,UAAU,EACjB,MAAM,EAAE,MAAM,EACd,OAAO,GAAE,mBAAwB,GAChC,IAAI,CA+BN;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI,CAWnD;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,oBAAoB,CAClC,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,MAAM,GACd,IAAI,CAEN"}
|
|
1
|
+
{"version":3,"file":"output.d.ts","sourceRoot":"","sources":["../../src/utils/output.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAMH;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAKrD;AAED;;;;;GAKG;AACH,MAAM,MAAM,UAAU,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,KAAK,MAAM,CAAC;AAoCpF,MAAM,WAAW,mBAAmB;IAClC,gFAAgF;IAChF,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,6EAA6E;IAC7E,kBAAkB,CAAC,EAAE,CAAC,kBAAkB,EAAE,MAAM,KAAK,IAAI,CAAC;CAC3D;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,YAAY,CAC1B,KAAK,EAAE,UAAU,EACjB,MAAM,EAAE,MAAM,EACd,OAAO,GAAE,mBAAwB,GAChC,IAAI,CA+BN;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI,CAWnD;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI,CAEnD;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,oBAAoB,CAClC,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,MAAM,GACd,IAAI,CAEN"}
|
package/dist/utils/output.js
CHANGED
|
@@ -138,6 +138,25 @@ export function writeYamlOutput(data) {
|
|
|
138
138
|
aliasDuplicateObjects: false,
|
|
139
139
|
})}`);
|
|
140
140
|
}
|
|
141
|
+
/**
|
|
142
|
+
* Write a single JSON document to stdout.
|
|
143
|
+
*
|
|
144
|
+
* The sibling of {@link writeYamlOutput}, for the same payloads, and it exists
|
|
145
|
+
* because a consumer that has to parse YAML needs a YAML parser: JSON is the
|
|
146
|
+
* format every language reads without one. `vat resources validate` already
|
|
147
|
+
* offers `--format json` for exactly this reason; a scan document that could
|
|
148
|
+
* only be had as YAML made the population it reports the harder of the two to
|
|
149
|
+
* consume programmatically, which is backwards.
|
|
150
|
+
*
|
|
151
|
+
* Written the same way as its YAML sibling, and the comment there applies
|
|
152
|
+
* verbatim: the ordinary stream write keeps this summary behind any
|
|
153
|
+
* human-readable progress already buffered on the same channel.
|
|
154
|
+
*
|
|
155
|
+
* @param data - Data to serialize as JSON
|
|
156
|
+
*/
|
|
157
|
+
export function writeJsonOutput(data) {
|
|
158
|
+
process.stdout.write(`${JSON.stringify(data, null, 2)}\n`);
|
|
159
|
+
}
|
|
141
160
|
/**
|
|
142
161
|
* Write a test-format finding to stderr.
|
|
143
162
|
*
|
package/dist/utils/output.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"output.js","sourceRoot":"","sources":["../../src/utils/output.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAEpC,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAE7B;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,UAAU,eAAe,CAAC,OAAe;IAC7C,YAAY,CACV,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,EAAE,CAAC,SAAS,CAAC,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,EAChE,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,MAAM,CAAC,CAC7B,CAAC;AACJ,CAAC;AAUD;;;;;;;;;GASG;AACH,MAAM,8BAA8B,GAAG,MAAM,CAAC;AAE9C,uEAAuE;AACvE,MAAM,mBAAmB,GAAG,EAAE,CAAC;AAE/B;;;;;GAKG;AACH,SAAS,SAAS,CAAC,EAAU;IAC3B,OAAO,CAAC,IAAI,CAAC,IAAI,UAAU,CAAC,IAAI,iBAAiB,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC;AACnE,CAAC;A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AU,EAAE,CAAC;gBACpC,MAAM,IAAI,KAAK,CACb,kBAAkB,UAAU,sDAAsD,OAAO,OAAO,MAAM,CAAC,MAAM,8CAA8C,CAC5J,CAAC;YACJ,CAAC;YACD,IAAI,CAAC,kBAAkB,CAAC,CAAC;QAC3B,CAAC;IACH,CAAC;AACH,CAAC;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,UAAU,eAAe,CAAC,IAAa;IAC3C,4EAA4E;IAC5E,wEAAwE;IACxE,4EAA4E;IAC5E,8EAA8E;IAC9E,2DAA2D;IAC3D,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,QAAQ,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE;QAChD,MAAM,EAAE,CAAC;QACT,SAAS,EAAE,GAAG;QACd,qBAAqB,EAAE,KAAK;KAC7B,CAAC,EAAE,CAAC,CAAC;AACR,CAAC;AAED;;;;;;;;;;;;;;;GAeG;AACH,MAAM,UAAU,eAAe,CAAC,IAAa;IAC3C,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC;AAC7D,CAAC;AAED;;;;;;;;;;GAUG;AACH,MAAM,UAAU,oBAAoB,CAClC,IAAY,EACZ,IAAY,EACZ,MAAc,EACd,QAAgB,EAChB,OAAe;IAEf,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,IAAI,IAAI,IAAI,IAAI,MAAM,KAAK,QAAQ,KAAK,OAAO,IAAI,CAAC,CAAC;AAC/E,CAAC"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The three arguments every CLI lane hands a projection population builder the
|
|
3
|
+
* same way: the blob-stage observer, the ignore oracle, and the run's store.
|
|
4
|
+
*
|
|
5
|
+
* ## Why this is CLI code and not `resources` code
|
|
6
|
+
*
|
|
7
|
+
* Nothing here decides anything about a projection. The observer's whole body is
|
|
8
|
+
* `describeBlobRefusals` — owned by `@vibe-agent-toolkit/resources` — routed to a
|
|
9
|
+
* {@link Logger}, which is a CLI type no other package has; the two spreads exist
|
|
10
|
+
* only because `exactOptionalPropertyTypes` makes "absent" and "present and
|
|
11
|
+
* undefined" different arguments. That is command plumbing, in the same family as
|
|
12
|
+
* `projection-store.ts` next door, so it stays inside the package the CLI-stays-
|
|
13
|
+
* dumb rule allows it in.
|
|
14
|
+
*
|
|
15
|
+
* ## The observer is the reason this is shared rather than retyped
|
|
16
|
+
*
|
|
17
|
+
* `buildInventoryPopulation` and `buildClaudeContextPopulation` both REQUIRE
|
|
18
|
+
* `onBlobPopulation` — a caller with nothing to do with the counts must name
|
|
19
|
+
* `DISCARD_BLOB_POPULATION` rather than leave it off — because a tree whose every
|
|
20
|
+
* document was declined as binary otherwise populates as empty and reports
|
|
21
|
+
* success. Two hand-written copies of the reporting half is two places for that
|
|
22
|
+
* report to quietly become a no-op.
|
|
23
|
+
*/
|
|
24
|
+
import { type BlobPopulationReport, type PopulationCache } from '@vibe-agent-toolkit/resources';
|
|
25
|
+
import type { GitTracker } from '@vibe-agent-toolkit/utils';
|
|
26
|
+
import type { Logger } from './logger.js';
|
|
27
|
+
/**
|
|
28
|
+
* The population arguments {@link populationWiring} supplies.
|
|
29
|
+
*
|
|
30
|
+
* Spread into a builder's options object, so the two oracles are optional in the
|
|
31
|
+
* `exactOptionalPropertyTypes` sense — omitted entirely when they are absent,
|
|
32
|
+
* never present-and-undefined.
|
|
33
|
+
*/
|
|
34
|
+
export interface PopulationWiring {
|
|
35
|
+
onBlobPopulation: (report: BlobPopulationReport) => void;
|
|
36
|
+
gitTracker?: GitTracker | undefined;
|
|
37
|
+
cache?: PopulationCache | undefined;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Wire one population's blob-stage observer, ignore oracle and store.
|
|
41
|
+
*
|
|
42
|
+
* `describeBlobRefusals` returns undefined on a run that refused nothing, so a
|
|
43
|
+
* clean population stays exactly as quiet as it was — which is the only thing
|
|
44
|
+
* that keeps the line worth reading when it does appear.
|
|
45
|
+
*
|
|
46
|
+
* ⚠️ The refusals go to `logger.warn`, i.e. **stderr**. Both callers write a
|
|
47
|
+
* parseable document to stdout, and a diagnostic in the middle of it breaks every
|
|
48
|
+
* consumer.
|
|
49
|
+
*
|
|
50
|
+
* @param logger - Where blob-stage refusals are reported
|
|
51
|
+
* @param gitTracker - The ignore oracle, or undefined when there is none. Not
|
|
52
|
+
* cosmetic: `resource_realizations.gitignored` is filled only when a tracker
|
|
53
|
+
* was supplied, so its absence decides whether a consumer can TELL which
|
|
54
|
+
* members were ignored
|
|
55
|
+
* @param cache - The run's projection store, or undefined to re-derive
|
|
56
|
+
* @returns The options to spread into the population builder's argument
|
|
57
|
+
*/
|
|
58
|
+
export declare function populationWiring(logger: Logger, gitTracker: GitTracker | undefined, cache: PopulationCache | undefined): PopulationWiring;
|
|
59
|
+
//# sourceMappingURL=population-wiring.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"population-wiring.d.ts","sourceRoot":"","sources":["../../src/utils/population-wiring.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,EAAwB,KAAK,oBAAoB,EAAE,KAAK,eAAe,EAAE,MACzE,+BAA+B,CAAC;AACvC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAE5D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAE1C;;;;;;GAMG;AACH,MAAM,WAAW,gBAAgB;IAC/B,gBAAgB,EAAE,CAAC,MAAM,EAAE,oBAAoB,KAAK,IAAI,CAAC;IACzD,UAAU,CAAC,EAAE,UAAU,GAAG,SAAS,CAAC;IACpC,KAAK,CAAC,EAAE,eAAe,GAAG,SAAS,CAAC;CACrC;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,gBAAgB,CAC9B,MAAM,EAAE,MAAM,EACd,UAAU,EAAE,UAAU,GAAG,SAAS,EAClC,KAAK,EAAE,eAAe,GAAG,SAAS,GACjC,gBAAgB,CASlB"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The three arguments every CLI lane hands a projection population builder the
|
|
3
|
+
* same way: the blob-stage observer, the ignore oracle, and the run's store.
|
|
4
|
+
*
|
|
5
|
+
* ## Why this is CLI code and not `resources` code
|
|
6
|
+
*
|
|
7
|
+
* Nothing here decides anything about a projection. The observer's whole body is
|
|
8
|
+
* `describeBlobRefusals` — owned by `@vibe-agent-toolkit/resources` — routed to a
|
|
9
|
+
* {@link Logger}, which is a CLI type no other package has; the two spreads exist
|
|
10
|
+
* only because `exactOptionalPropertyTypes` makes "absent" and "present and
|
|
11
|
+
* undefined" different arguments. That is command plumbing, in the same family as
|
|
12
|
+
* `projection-store.ts` next door, so it stays inside the package the CLI-stays-
|
|
13
|
+
* dumb rule allows it in.
|
|
14
|
+
*
|
|
15
|
+
* ## The observer is the reason this is shared rather than retyped
|
|
16
|
+
*
|
|
17
|
+
* `buildInventoryPopulation` and `buildClaudeContextPopulation` both REQUIRE
|
|
18
|
+
* `onBlobPopulation` — a caller with nothing to do with the counts must name
|
|
19
|
+
* `DISCARD_BLOB_POPULATION` rather than leave it off — because a tree whose every
|
|
20
|
+
* document was declined as binary otherwise populates as empty and reports
|
|
21
|
+
* success. Two hand-written copies of the reporting half is two places for that
|
|
22
|
+
* report to quietly become a no-op.
|
|
23
|
+
*/
|
|
24
|
+
import { describeBlobRefusals } from '@vibe-agent-toolkit/resources';
|
|
25
|
+
/**
|
|
26
|
+
* Wire one population's blob-stage observer, ignore oracle and store.
|
|
27
|
+
*
|
|
28
|
+
* `describeBlobRefusals` returns undefined on a run that refused nothing, so a
|
|
29
|
+
* clean population stays exactly as quiet as it was — which is the only thing
|
|
30
|
+
* that keeps the line worth reading when it does appear.
|
|
31
|
+
*
|
|
32
|
+
* ⚠️ The refusals go to `logger.warn`, i.e. **stderr**. Both callers write a
|
|
33
|
+
* parseable document to stdout, and a diagnostic in the middle of it breaks every
|
|
34
|
+
* consumer.
|
|
35
|
+
*
|
|
36
|
+
* @param logger - Where blob-stage refusals are reported
|
|
37
|
+
* @param gitTracker - The ignore oracle, or undefined when there is none. Not
|
|
38
|
+
* cosmetic: `resource_realizations.gitignored` is filled only when a tracker
|
|
39
|
+
* was supplied, so its absence decides whether a consumer can TELL which
|
|
40
|
+
* members were ignored
|
|
41
|
+
* @param cache - The run's projection store, or undefined to re-derive
|
|
42
|
+
* @returns The options to spread into the population builder's argument
|
|
43
|
+
*/
|
|
44
|
+
export function populationWiring(logger, gitTracker, cache) {
|
|
45
|
+
return {
|
|
46
|
+
onBlobPopulation: (report) => {
|
|
47
|
+
const refusals = describeBlobRefusals(report);
|
|
48
|
+
if (refusals !== undefined)
|
|
49
|
+
logger.warn(refusals);
|
|
50
|
+
},
|
|
51
|
+
...(gitTracker !== undefined && { gitTracker }),
|
|
52
|
+
...(cache !== undefined && { cache }),
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
//# sourceMappingURL=population-wiring.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"population-wiring.js","sourceRoot":"","sources":["../../src/utils/population-wiring.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,EAAE,oBAAoB,EAAmD,MACzE,+BAA+B,CAAC;AAkBvC;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,UAAU,gBAAgB,CAC9B,MAAc,EACd,UAAkC,EAClC,KAAkC;IAElC,OAAO;QACL,gBAAgB,EAAE,CAAC,MAAM,EAAE,EAAE;YAC3B,MAAM,QAAQ,GAAG,oBAAoB,CAAC,MAAM,CAAC,CAAC;YAC9C,IAAI,QAAQ,KAAK,SAAS;gBAAE,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QACpD,CAAC;QACD,GAAG,CAAC,UAAU,KAAK,SAAS,IAAI,EAAE,UAAU,EAAE,CAAC;QAC/C,GAAG,CAAC,KAAK,KAAK,SAAS,IAAI,EAAE,KAAK,EAAE,CAAC;KACtC,CAAC;AACJ,CAAC"}
|