@vibe-agent-toolkit/cli 0.2.0-rc.6 → 0.2.0-rc.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -4
- package/dist/bin.js +41 -158
- package/dist/bin.js.map +1 -1
- package/dist/command-loaders.d.ts +2 -2
- package/dist/command-loaders.d.ts.map +1 -1
- package/dist/command-loaders.js +4 -2
- package/dist/command-loaders.js.map +1 -1
- package/dist/commands/ard/emit.d.ts +104 -0
- package/dist/commands/ard/emit.d.ts.map +1 -0
- package/dist/commands/ard/emit.js +223 -0
- package/dist/commands/ard/emit.js.map +1 -0
- package/dist/commands/ard/index.d.ts +12 -0
- package/dist/commands/ard/index.d.ts.map +1 -0
- package/dist/commands/ard/index.js +79 -0
- package/dist/commands/ard/index.js.map +1 -0
- package/dist/commands/ard/surfaces.d.ts +56 -0
- package/dist/commands/ard/surfaces.d.ts.map +1 -0
- package/dist/commands/ard/surfaces.js +150 -0
- package/dist/commands/ard/surfaces.js.map +1 -0
- package/dist/commands/audit.d.ts +75 -8
- package/dist/commands/audit.d.ts.map +1 -1
- package/dist/commands/audit.js +605 -140
- package/dist/commands/audit.js.map +1 -1
- package/dist/commands/claude/budget.d.ts +13 -0
- package/dist/commands/claude/budget.d.ts.map +1 -1
- package/dist/commands/claude/budget.js +80 -28
- package/dist/commands/claude/budget.js.map +1 -1
- package/dist/commands/claude/context.js +1 -1
- package/dist/commands/claude/context.js.map +1 -1
- package/dist/commands/claude/marketplace/validate.d.ts +55 -22
- package/dist/commands/claude/marketplace/validate.d.ts.map +1 -1
- package/dist/commands/claude/marketplace/validate.js +380 -75
- package/dist/commands/claude/marketplace/validate.js.map +1 -1
- package/dist/commands/claude/org/skills.d.ts +84 -3
- package/dist/commands/claude/org/skills.d.ts.map +1 -1
- package/dist/commands/claude/org/skills.js +218 -46
- package/dist/commands/claude/org/skills.js.map +1 -1
- package/dist/commands/claude/plugin/build.d.ts +8 -0
- package/dist/commands/claude/plugin/build.d.ts.map +1 -1
- package/dist/commands/claude/plugin/build.js +16 -2
- package/dist/commands/claude/plugin/build.js.map +1 -1
- package/dist/commands/claude/plugin/tree-copy.d.ts +72 -0
- package/dist/commands/claude/plugin/tree-copy.d.ts.map +1 -1
- package/dist/commands/claude/plugin/tree-copy.js +215 -10
- package/dist/commands/claude/plugin/tree-copy.js.map +1 -1
- package/dist/commands/corpus/index.d.ts.map +1 -1
- package/dist/commands/corpus/index.js +3 -0
- package/dist/commands/corpus/index.js.map +1 -1
- package/dist/commands/corpus/report.d.ts +0 -1
- package/dist/commands/corpus/report.d.ts.map +1 -1
- package/dist/commands/corpus/report.js +0 -1
- package/dist/commands/corpus/report.js.map +1 -1
- package/dist/commands/corpus/runner.d.ts +58 -1
- package/dist/commands/corpus/runner.d.ts.map +1 -1
- package/dist/commands/corpus/runner.js +90 -15
- 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 +0 -1
- package/dist/commands/corpus/scan.js.map +1 -1
- package/dist/commands/doctor.d.ts +14 -0
- package/dist/commands/doctor.d.ts.map +1 -1
- package/dist/commands/doctor.js +96 -18
- package/dist/commands/doctor.js.map +1 -1
- package/dist/commands/okf/index.d.ts +11 -0
- package/dist/commands/okf/index.d.ts.map +1 -0
- package/dist/commands/okf/index.js +102 -0
- package/dist/commands/okf/index.js.map +1 -0
- package/dist/commands/okf/validate.d.ts +82 -0
- package/dist/commands/okf/validate.d.ts.map +1 -0
- package/dist/commands/okf/validate.js +157 -0
- package/dist/commands/okf/validate.js.map +1 -0
- package/dist/commands/phase-utils.d.ts +19 -3
- package/dist/commands/phase-utils.d.ts.map +1 -1
- package/dist/commands/phase-utils.js +26 -5
- package/dist/commands/phase-utils.js.map +1 -1
- package/dist/commands/rag/index-command.d.ts +27 -2
- package/dist/commands/rag/index-command.d.ts.map +1 -1
- package/dist/commands/rag/index-command.js +44 -7
- 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 +2 -0
- package/dist/commands/rag/index.js.map +1 -1
- package/dist/commands/resources/check-progress.d.ts +3 -0
- package/dist/commands/resources/check-progress.d.ts.map +1 -1
- package/dist/commands/resources/check-progress.js +6 -0
- package/dist/commands/resources/check-progress.js.map +1 -1
- package/dist/commands/resources/check.d.ts +33 -4
- package/dist/commands/resources/check.d.ts.map +1 -1
- package/dist/commands/resources/check.js +131 -44
- package/dist/commands/resources/check.js.map +1 -1
- package/dist/commands/resources/index.d.ts.map +1 -1
- package/dist/commands/resources/index.js +41 -9
- package/dist/commands/resources/index.js.map +1 -1
- package/dist/commands/resources/query.d.ts +18 -1
- package/dist/commands/resources/query.d.ts.map +1 -1
- package/dist/commands/resources/query.js +29 -4
- package/dist/commands/resources/query.js.map +1 -1
- package/dist/commands/resources/validate.d.ts +29 -0
- package/dist/commands/resources/validate.d.ts.map +1 -1
- package/dist/commands/resources/validate.js +116 -13
- package/dist/commands/resources/validate.js.map +1 -1
- package/dist/commands/skill/review.d.ts.map +1 -1
- package/dist/commands/skill/review.js +9 -2
- package/dist/commands/skill/review.js.map +1 -1
- package/dist/commands/skill/test/run.d.ts.map +1 -1
- package/dist/commands/skill/test/run.js +21 -6
- package/dist/commands/skill/test/run.js.map +1 -1
- package/dist/commands/skills/build.d.ts.map +1 -1
- package/dist/commands/skills/build.js +16 -3
- package/dist/commands/skills/build.js.map +1 -1
- package/dist/commands/skills/list.d.ts +2 -1
- package/dist/commands/skills/list.d.ts.map +1 -1
- package/dist/commands/skills/list.js +31 -9
- package/dist/commands/skills/list.js.map +1 -1
- package/dist/commands/skills/skill-discovery.d.ts +40 -1
- package/dist/commands/skills/skill-discovery.d.ts.map +1 -1
- package/dist/commands/skills/skill-discovery.js +32 -3
- package/dist/commands/skills/skill-discovery.js.map +1 -1
- package/dist/commands/skills/validate-command.d.ts.map +1 -1
- package/dist/commands/skills/validate-command.js +11 -3
- package/dist/commands/skills/validate-command.js.map +1 -1
- package/dist/commands/skills/validate.d.ts +66 -7
- package/dist/commands/skills/validate.d.ts.map +1 -1
- package/dist/commands/skills/validate.js +133 -29
- package/dist/commands/skills/validate.js.map +1 -1
- package/dist/commands/verify.d.ts +94 -3
- package/dist/commands/verify.d.ts.map +1 -1
- package/dist/commands/verify.js +192 -45
- package/dist/commands/verify.js.map +1 -1
- package/dist/skill-resolution/packaging-config.d.ts +49 -5
- package/dist/skill-resolution/packaging-config.d.ts.map +1 -1
- package/dist/skill-resolution/packaging-config.js +59 -19
- package/dist/skill-resolution/packaging-config.js.map +1 -1
- package/dist/skill-resolution/resolve-skill-reference.d.ts.map +1 -1
- package/dist/skill-resolution/resolve-skill-reference.js +6 -3
- package/dist/skill-resolution/resolve-skill-reference.js.map +1 -1
- package/dist/utils/command-error.d.ts +31 -0
- package/dist/utils/command-error.d.ts.map +1 -1
- package/dist/utils/command-error.js +45 -0
- package/dist/utils/command-error.js.map +1 -1
- package/dist/utils/edge-lens-evaluation.d.ts +83 -0
- package/dist/utils/edge-lens-evaluation.d.ts.map +1 -0
- package/dist/utils/edge-lens-evaluation.js +110 -0
- package/dist/utils/edge-lens-evaluation.js.map +1 -0
- package/dist/utils/optional-backend.d.ts +5 -4
- package/dist/utils/optional-backend.d.ts.map +1 -1
- package/dist/utils/optional-backend.js +5 -4
- package/dist/utils/optional-backend.js.map +1 -1
- package/dist/utils/project-root-policy.d.ts +20 -0
- package/dist/utils/project-root-policy.d.ts.map +1 -1
- package/dist/utils/project-root-policy.js +32 -0
- package/dist/utils/project-root-policy.js.map +1 -1
- package/dist/utils/projection-query.d.ts +41 -4
- package/dist/utils/projection-query.d.ts.map +1 -1
- package/dist/utils/projection-query.js +44 -10
- package/dist/utils/projection-query.js.map +1 -1
- package/dist/utils/projection-store.d.ts +41 -15
- package/dist/utils/projection-store.d.ts.map +1 -1
- package/dist/utils/projection-store.js +65 -18
- package/dist/utils/projection-store.js.map +1 -1
- package/dist/utils/repeatable-option.d.ts +37 -0
- package/dist/utils/repeatable-option.d.ts.map +1 -0
- package/dist/utils/repeatable-option.js +39 -0
- package/dist/utils/repeatable-option.js.map +1 -0
- package/dist/utils/resource-loader.d.ts +4 -3
- package/dist/utils/resource-loader.d.ts.map +1 -1
- package/dist/utils/resource-loader.js +61 -30
- package/dist/utils/resource-loader.js.map +1 -1
- package/dist/utils/root-argv.d.ts +53 -0
- package/dist/utils/root-argv.d.ts.map +1 -0
- package/dist/utils/root-argv.js +215 -0
- package/dist/utils/root-argv.js.map +1 -0
- package/dist/utils/run-integrity.d.ts +95 -0
- package/dist/utils/run-integrity.d.ts.map +1 -0
- package/dist/utils/run-integrity.js +102 -0
- package/dist/utils/run-integrity.js.map +1 -0
- package/dist/utils/sqlite-experimental-warning.d.ts +69 -0
- package/dist/utils/sqlite-experimental-warning.d.ts.map +1 -0
- package/dist/utils/sqlite-experimental-warning.js +144 -0
- package/dist/utils/sqlite-experimental-warning.js.map +1 -0
- package/dist/utils/user-context-scanner.d.ts +8 -0
- package/dist/utils/user-context-scanner.d.ts.map +1 -1
- package/dist/utils/user-context-scanner.js +4 -0
- package/dist/utils/user-context-scanner.js.map +1 -1
- package/dist/utils/validate-help-files.d.ts.map +1 -1
- package/dist/utils/validate-help-files.js +9 -2
- package/dist/utils/validate-help-files.js.map +1 -1
- package/docs/audit.md +120 -7
- package/docs/doctor.md +6 -6
- package/docs/index.md +1 -1
- package/docs/rag.md +3 -1
- package/docs/resources.md +5 -1
- package/docs/skills.md +47 -62
- package/package.json +18 -18
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
* `.action(...)` callbacks). Inner library functions should take the resolved
|
|
13
13
|
* root as a parameter — never call `findProjectRoot` themselves.
|
|
14
14
|
*/
|
|
15
|
+
import { existsSync, statSync } from 'node:fs';
|
|
15
16
|
import { findProjectRoot, safePath } from '@vibe-agent-toolkit/utils';
|
|
16
17
|
/**
|
|
17
18
|
* `required` policy — refuse to run if no projectRoot can be discovered.
|
|
@@ -46,4 +47,35 @@ export function projectRootOrLoudCwd(startDir, logger) {
|
|
|
46
47
|
export function projectRootOrNull(startDir) {
|
|
47
48
|
return findProjectRoot(startDir);
|
|
48
49
|
}
|
|
50
|
+
/**
|
|
51
|
+
* Fail loudly on a `[path]` argument that names no directory.
|
|
52
|
+
*
|
|
53
|
+
* Every `resources` verb takes an optional `[path]`, and two things can be
|
|
54
|
+
* meant by it: a SCOPE (`scan`, `validate` — crawl this subtree) or a LOCATOR
|
|
55
|
+
* (`query`, `check` — find the project from here; the projection is always the
|
|
56
|
+
* whole tree). Both start by resolving the argument, and both must refuse one
|
|
57
|
+
* that resolves to nothing — the scoping verbs would otherwise degrade into a
|
|
58
|
+
* glob matching nothing (`filesScanned: 0`, green), and the locating verbs
|
|
59
|
+
* walked UP from the missing path to whatever project the cwd is in and
|
|
60
|
+
* answered about THAT tree at exit 0, byte-identical to a correct run.
|
|
61
|
+
*
|
|
62
|
+
* One function so the two families refuse with one message; a reader who saw
|
|
63
|
+
* `validate` say "Path does not exist" should get the same words from `query`.
|
|
64
|
+
*
|
|
65
|
+
* @param pathArg - The argument as typed, relative to cwd or absolute
|
|
66
|
+
* @returns The resolved absolute path
|
|
67
|
+
* @throws When it does not exist or is not a directory
|
|
68
|
+
*/
|
|
69
|
+
export function assertDirectoryArgument(pathArg) {
|
|
70
|
+
const resolved = safePath.resolve(pathArg);
|
|
71
|
+
// eslint-disable-next-line security/detect-non-literal-fs-filename -- CLI path argument, resolved above
|
|
72
|
+
if (!existsSync(resolved)) {
|
|
73
|
+
throw new Error(`Path does not exist: ${resolved}`);
|
|
74
|
+
}
|
|
75
|
+
// eslint-disable-next-line security/detect-non-literal-fs-filename -- CLI path argument, existence checked above
|
|
76
|
+
if (!statSync(resolved).isDirectory()) {
|
|
77
|
+
throw new Error(`Path is not a directory: ${resolved}`);
|
|
78
|
+
}
|
|
79
|
+
return resolved;
|
|
80
|
+
}
|
|
49
81
|
//# sourceMappingURL=project-root-policy.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"project-root-policy.js","sourceRoot":"","sources":["../../src/utils/project-root-policy.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,eAAe,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AAItE;;;;GAIG;AACH,MAAM,UAAU,kBAAkB,CAAC,QAAgB,EAAE,WAAmB;IACtE,MAAM,IAAI,GAAG,eAAe,CAAC,QAAQ,CAAC,CAAC;IACvC,IAAI,IAAI,KAAK,IAAI,EAAE,CAAC;QAClB,MAAM,IAAI,KAAK,CACb,GAAG,WAAW,gEAAgE;YAC5E,kDAAkD,CACrD,CAAC;IACJ,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,oBAAoB,CAAC,QAAgB,EAAE,MAAc;IACnE,MAAM,IAAI,GAAG,eAAe,CAAC,QAAQ,CAAC,CAAC;IACvC,IAAI,IAAI,KAAK,IAAI;QAAE,OAAO,IAAI,CAAC;IAC/B,MAAM,GAAG,GAAG,QAAQ,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;IACvC,MAAM,CAAC,IAAI,CACT,oEAAoE,GAAG,iBAAiB,CACzF,CAAC;IACF,OAAO,GAAG,CAAC;AACb,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,iBAAiB,CAAC,QAAgB;IAChD,OAAO,eAAe,CAAC,QAAQ,CAAC,CAAC;AACnC,CAAC"}
|
|
1
|
+
{"version":3,"file":"project-root-policy.js","sourceRoot":"","sources":["../../src/utils/project-root-policy.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAE/C,OAAO,EAAE,eAAe,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AAItE;;;;GAIG;AACH,MAAM,UAAU,kBAAkB,CAAC,QAAgB,EAAE,WAAmB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ocabulary.
|
|
128
128
|
*/
|
|
129
129
|
readonly populationMs: number;
|
|
130
|
+
/**
|
|
131
|
+
* What EVALUATING THE LENS cost, separately from populating the tree.
|
|
132
|
+
*
|
|
133
|
+
* Separate because the two answer different questions and a reader must be
|
|
134
|
+
* able to tell them apart. Population is work every verb pays and the store
|
|
135
|
+
* can make cheap; this is work the *edge relations* cost, it is paid on every
|
|
136
|
+
* run whether or not the caller's statement mentions them, and a store hit
|
|
137
|
+
* does NOT make it cheaper — the lens is evaluated over the served rows just
|
|
138
|
+
* as over derived ones. Folded into `populationMs` it would look like the
|
|
139
|
+
* store getting worse.
|
|
140
|
+
*
|
|
141
|
+
* ⚠️ **DISJOINT from `populationMs`, and that is enforced by where the
|
|
142
|
+
* population clock stops, not by convention.** It shipped overlapping: the
|
|
143
|
+
* population span ended after the lens write, so this value was contained in
|
|
144
|
+
* that one while all three docstrings said otherwise, and anyone adding the
|
|
145
|
+
* two over-counted wall time. If you move either clock, keep them disjoint —
|
|
146
|
+
* a reader comparing a served run against a derived one is the whole reason
|
|
147
|
+
* they are two fields.
|
|
148
|
+
*
|
|
149
|
+
* ⚠️ Published rather than merely measured, because an unconditional cost
|
|
150
|
+
* that is invisible is the one nobody can argue with. If this ever grows
|
|
151
|
+
* large enough to be worth a flag, this field is the evidence that says so.
|
|
152
|
+
*/
|
|
153
|
+
readonly lensMs: number;
|
|
130
154
|
}
|
|
131
155
|
/**
|
|
132
156
|
* How much of the tree the population actually covered.
|
|
@@ -167,6 +191,12 @@ export interface PopulationExtent {
|
|
|
167
191
|
*/
|
|
168
192
|
readonly membersEnumerated: number;
|
|
169
193
|
}
|
|
194
|
+
/** One statement a run intends to ask, with the values it will bind to it. */
|
|
195
|
+
export interface PreflightStatement {
|
|
196
|
+
readonly sql: string;
|
|
197
|
+
/** Bound in order, one per `?`. Empty for a statement that binds nothing. */
|
|
198
|
+
readonly parameters: readonly string[];
|
|
199
|
+
}
|
|
170
200
|
/** Run one read-only statement against the populated projection. */
|
|
171
201
|
export type AskProjection = (sql: string, ...parameters: readonly string[]) => readonly Record<string, unknown>[];
|
|
172
202
|
/**
|
|
@@ -199,11 +229,18 @@ export type AskProjection = (sql: string, ...parameters: readonly string[]) => r
|
|
|
199
229
|
* unbounded cost lives, and a preflight that ran `WITH RECURSIVE …` would hang
|
|
200
230
|
* before the run it exists to make cheap had begun.
|
|
201
231
|
*
|
|
202
|
-
*
|
|
232
|
+
* ⚠️ Each statement comes WITH the values it will be bound to, because the
|
|
233
|
+
* placeholder count is part of what compiles: a `?` the caller forgot to bind is
|
|
234
|
+
* SQL NULL at run time, and the statement then selects nothing and reports
|
|
235
|
+
* success — the same silent class as a typo'd column, and worth the same early
|
|
236
|
+
* refusal. The backend does the counting; this only has to hand it the values.
|
|
237
|
+
*
|
|
238
|
+
* @param statements - Every statement the run will ask, in any order, each with
|
|
239
|
+
* the values it will bind
|
|
203
240
|
* @throws The same legible failure `ask` throws, for the first statement that
|
|
204
|
-
* does not compile
|
|
241
|
+
* does not compile or does not pair its placeholders with its values
|
|
205
242
|
*/
|
|
206
|
-
export declare function assertQueriesCompile(statements: readonly
|
|
243
|
+
export declare function assertQueriesCompile(statements: readonly PreflightStatement[]): Promise<void>;
|
|
207
244
|
/**
|
|
208
245
|
* Populate the tree, load it into something askable, and hand the caller a way
|
|
209
246
|
* to ask.
|
|
@@ -223,7 +260,7 @@ export declare function assertQueriesCompile(statements: readonly string[]): Pro
|
|
|
223
260
|
export declare function withQueriedProjection<T>(options: {
|
|
224
261
|
root: string;
|
|
225
262
|
logger: Logger;
|
|
226
|
-
preflight?: readonly
|
|
263
|
+
preflight?: readonly PreflightStatement[];
|
|
227
264
|
}, work: (ask: AskProjection, provenance: ProjectionProvenance, extent: PopulationExtent) => Promise<T> | T): Promise<T>;
|
|
228
265
|
/**
|
|
229
266
|
* Turn a rejected statement into a message that names the surface it missed.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"projection-query.d.ts","sourceRoot":"","sources":["../../src/utils/projection-query.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8CG;
|
|
1
|
+
{"version":3,"file":"projection-query.d.ts","sourceRoot":"","sources":["../../src/utils/projection-query.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8CG;AAcH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAkB1C,8DAA8D;AAC9D,MAAM,MAAM,gBAAgB,GAAG,SAAS,GAAG,OAAO,CAAC;AAEnD;;;;;;;;GAQG;AACH,MAAM,WAAW,oBAAoB;IACnC;;;;;;;OAOG;IACH,QAAQ,CAAC,UAAU,EAAE,gBAAgB,CAAC;IAEtC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA0DG;IACH,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAE9B;;;;;;;;;;;;;;;;;;;;;;OAsBG;IACH,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,MAAM,WAAW,gBAAgB;IAC/B;;;;;;;;;;;OAWG;IACH,QAAQ,CAAC,iBAAiB,EAAE,MAAM,CAAC;CACpC;AAED,8EAA8E;AAC9E,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,6EAA6E;IAC7E,QAAQ,CAAC,UAAU,EAAE,SAAS,MAAM,EAAE,CAAC;CACxC;AAED,oEAAoE;AACpE,MAAM,MAAM,aAAa,GAAG,CAC1B,GAAG,EAAE,MAAM,EACX,GAAG,UAAU,EAAE,SAAS,MAAM,EAAE,KAC7B,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,CAAC;AAExC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AACH,wBAAsB,oBAAoB,CAAC,UAAU,EAAE,SAAS,kBAAkB,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAgBnG;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAsB,qBAAqB,CAAC,CAAC,EAC3C,OAAO,EAAE;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,SAAS,CAAC,EAAE,SAAS,kBAAkB,EAAE,CAAA;CAAE,EACpF,IAAI,EAAE,CACJ,GAAG,EAAE,aAAa,EAClB,UAAU,EAAE,oBAAoB,EAChC,MAAM,EAAE,gBAAgB,KACrB,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,GAClB,OAAO,CAAC,CAAC,CAAC,CAgHZ;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,CAoBzE"}
|
|
@@ -46,8 +46,9 @@
|
|
|
46
46
|
* throw, so no command can forget it.
|
|
47
47
|
*/
|
|
48
48
|
import { performance } from 'node:perf_hooks';
|
|
49
|
-
import { buildResourceProjection, PROJECTION_TABLES, splitProjectionByScope, } from '@vibe-agent-toolkit/resources';
|
|
49
|
+
import { allDerivedSpecs, buildResourceProjection, PROJECTION_TABLES, splitProjectionByScope, } from '@vibe-agent-toolkit/resources';
|
|
50
50
|
import { gitTrackerForProjectRoot } from '../commands/audit/distributed-tree.js';
|
|
51
|
+
import { evaluateAuthoredLenses } from './edge-lens-evaluation.js';
|
|
51
52
|
import { populationWiring } from './population-wiring.js';
|
|
52
53
|
import { openEphemeralQueryStore, withPopulationCache } from './projection-store.js';
|
|
53
54
|
/**
|
|
@@ -92,18 +93,25 @@ const NAME_NOT_FOUND = ['no such table:', 'no such column:'];
|
|
|
92
93
|
* unbounded cost lives, and a preflight that ran `WITH RECURSIVE …` would hang
|
|
93
94
|
* before the run it exists to make cheap had begun.
|
|
94
95
|
*
|
|
95
|
-
*
|
|
96
|
+
* ⚠️ Each statement comes WITH the values it will be bound to, because the
|
|
97
|
+
* placeholder count is part of what compiles: a `?` the caller forgot to bind is
|
|
98
|
+
* SQL NULL at run time, and the statement then selects nothing and reports
|
|
99
|
+
* success — the same silent class as a typo'd column, and worth the same early
|
|
100
|
+
* refusal. The backend does the counting; this only has to hand it the values.
|
|
101
|
+
*
|
|
102
|
+
* @param statements - Every statement the run will ask, in any order, each with
|
|
103
|
+
* the values it will bind
|
|
96
104
|
* @throws The same legible failure `ask` throws, for the first statement that
|
|
97
|
-
* does not compile
|
|
105
|
+
* does not compile or does not pair its placeholders with its values
|
|
98
106
|
*/
|
|
99
107
|
export async function assertQueriesCompile(statements) {
|
|
100
108
|
if (statements.length === 0)
|
|
101
109
|
return;
|
|
102
110
|
const probe = await openEphemeralQueryStore();
|
|
103
111
|
try {
|
|
104
|
-
for (const sql of statements) {
|
|
112
|
+
for (const { sql, parameters } of statements) {
|
|
105
113
|
try {
|
|
106
|
-
probe.assertCompiles(sql);
|
|
114
|
+
probe.assertCompiles(sql, parameters);
|
|
107
115
|
}
|
|
108
116
|
catch (error) {
|
|
109
117
|
throw new Error(describeQueryFailure(sql, error instanceof Error ? error.message : String(error)));
|
|
@@ -187,8 +195,27 @@ export async function withQueriedProjection(options, work) {
|
|
|
187
195
|
const { blobs, extent } = splitProjectionByScope(projection);
|
|
188
196
|
await store.writeBlobFacts(blobs);
|
|
189
197
|
await store.writeExtent({ rootId, treeHash: EPHEMERAL_TREE_HASH }, extent);
|
|
190
|
-
// The
|
|
198
|
+
// 🚨 The population clock STOPS HERE, before the lens runs. It used to
|
|
199
|
+
// stop after, which made `populationSecs` silently CONTAIN `lensSecs`
|
|
200
|
+
// while this comment and both payloads said it did not. The two numbers
|
|
201
|
+
// are published side by side precisely so a reader can compare a served
|
|
202
|
+
// population against a derived one — and folding the lens into the
|
|
203
|
+
// population put its cost on the arm the store's value is argued from,
|
|
204
|
+
// which is the "store got worse" reading the separation exists to
|
|
205
|
+
// prevent. Overlapping spans also made `populationSecs + lensSecs`
|
|
206
|
+
// over-count wall time for anyone who added them.
|
|
191
207
|
const populationMs = performance.now() - populationStart;
|
|
208
|
+
// The lens's output, alongside the tree's facts. Unconditional rather
|
|
209
|
+
// than behind a flag: the relations are the answer to questions the
|
|
210
|
+
// projection was built to support, and a surface that exists only when
|
|
211
|
+
// someone remembered a flag is one nobody writes a check against. What it
|
|
212
|
+
// costs is published as `lensSecs` rather than folded into the population
|
|
213
|
+
// — a caller who finds it too expensive can see the number they are
|
|
214
|
+
// paying, which a hidden cost never permits.
|
|
215
|
+
const lensStart = performance.now();
|
|
216
|
+
await store.writeDerived(evaluateAuthoredLenses(projection));
|
|
217
|
+
const lensMs = performance.now() - lensStart;
|
|
218
|
+
// The shared setup is done. Everything after this line is the caller's.
|
|
192
219
|
const ask = (sql, ...parameters) => {
|
|
193
220
|
try {
|
|
194
221
|
return store.query(sql, ...parameters);
|
|
@@ -197,7 +224,7 @@ export async function withQueriedProjection(options, work) {
|
|
|
197
224
|
throw new Error(describeQueryFailure(sql, error instanceof Error ? error.message : String(error)));
|
|
198
225
|
}
|
|
199
226
|
};
|
|
200
|
-
return await work(ask, { population: contributorRecords === 0 ? 'store' : 'derived', populationMs },
|
|
227
|
+
return await work(ask, { population: contributorRecords === 0 ? 'store' : 'derived', populationMs, lensMs },
|
|
201
228
|
// Read off the PROJECTION rather than counted back out of the store with
|
|
202
229
|
// a `SELECT COUNT(*)`: a count that travelled through the same `ask` the
|
|
203
230
|
// caller's statements do would be broken by the very schema drift it
|
|
@@ -249,14 +276,21 @@ export async function withQueriedProjection(options, work) {
|
|
|
249
276
|
export function describeQueryFailure(sql, message) {
|
|
250
277
|
if (!NAME_NOT_FOUND.some((prefix) => message.includes(prefix)))
|
|
251
278
|
return message;
|
|
279
|
+
// 🪤 The derived relations belong in this listing even though they are not
|
|
280
|
+
// projection tables. A user who mistypes `edge_resolution` gets "no such
|
|
281
|
+
// table" and a list of everything they could have meant — and a list that
|
|
282
|
+
// omitted the very relation they were reaching for would read as proof it
|
|
283
|
+
// does not exist. What the listing answers is "what can I name here", which
|
|
284
|
+
// is the queryable surface, not the registry.
|
|
285
|
+
const askable = [...Object.values(PROJECTION_TABLES), ...allDerivedSpecs()];
|
|
252
286
|
const lowered = sql.toLowerCase();
|
|
253
|
-
const named =
|
|
287
|
+
const named = askable.filter((spec) => lowered.includes(spec.name.toLowerCase()));
|
|
254
288
|
const surface = named.length > 0
|
|
255
289
|
? named.map((spec) => ` ${spec.name}(${spec.columns.join(', ')})`).join('\n')
|
|
256
|
-
:
|
|
290
|
+
: askable.map((spec) => ` ${spec.name}`).join('\n');
|
|
257
291
|
const heading = named.length > 0
|
|
258
292
|
? 'The tables this statement names hold these columns:'
|
|
259
|
-
: '
|
|
293
|
+
: 'This tree is queryable through these relations:';
|
|
260
294
|
return `${message}\n\n${heading}\n${surface}`;
|
|
261
295
|
}
|
|
262
296
|
//# sourceMappingURL=projection-query.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"projection-query.js","sourceRoot":"","sources":["../../src/utils/projection-query.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8CG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAE9C,OAAO,EACL,uBAAuB,EACvB,iBAAiB,EACjB,sBAAsB,GACvB,MAAM,+BAA+B,CAAC;AAEvC,OAAO,EAAE,wBAAwB,EAAE,MAAM,uCAAuC,CAAC;
|
|
1
|
+
{"version":3,"file":"projection-query.js","sourceRoot":"","sources":["../../src/utils/projection-query.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8CG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAE9C,OAAO,EACL,eAAe,EACf,uBAAuB,E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KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,KAAK,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC;QAC9E,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,KAAK,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACvD,MAAM,OAAO,GAAG,KAAK,CAAC,MAAM,GAAG,CAAC;QAC9B,CAAC,CAAC,qDAAqD;QACvD,CAAC,CAAC,iDAAiD,CAAC;IAEtD,OAAO,GAAG,OAAO,OAAO,OAAO,KAAK,OAAO,EAAE,CAAC;AAChD,CAAC"}
|
|
@@ -129,8 +129,6 @@ export declare const PROJECTION_STORE_DIR_ENV = "VAT_PROJECTION_STORE_DIR";
|
|
|
129
129
|
* flag was written for.
|
|
130
130
|
*/
|
|
131
131
|
export declare const CACHE_ENV = "VAT_CACHE";
|
|
132
|
-
/** {@link CACHE_ENV}'s one off value. Exactly `'0'`, never truthiness — see {@link projectionStoreSelected}. */
|
|
133
|
-
export declare const CACHE_DISABLED = "0";
|
|
134
132
|
/**
|
|
135
133
|
* Whether this process should read and write a projection store.
|
|
136
134
|
*
|
|
@@ -154,10 +152,16 @@ export declare const CACHE_DISABLED = "0";
|
|
|
154
152
|
* `vat cache`'s own help text described three caches while a fourth was being
|
|
155
153
|
* written beside them.
|
|
156
154
|
*
|
|
157
|
-
* 🪤
|
|
158
|
-
*
|
|
159
|
-
*
|
|
160
|
-
*
|
|
155
|
+
* 🪤 Read through `parseEnvBoolean`, never for truthiness — `VAT_CACHE=1` is
|
|
156
|
+
* the value an operator writes to turn caching ON, and a truthiness test would
|
|
157
|
+
* read it as a reason to decline. It was previously a comparison against the
|
|
158
|
+
* literal `'0'`, which is the same shape `ParseCache` carried and the same
|
|
159
|
+
* defect: `VAT_CACHE=false` disabled nothing. The two now share one parser
|
|
160
|
+
* (`@vibe-agent-toolkit/utils`) so the variable cannot be read two ways again.
|
|
161
|
+
*
|
|
162
|
+
* Only an explicit `false` vetoes. `parseEnvBoolean` returns `undefined` for a
|
|
163
|
+
* value it cannot read, and an unreadable value is not something the operator
|
|
164
|
+
* said — the veto has to be a statement, not a shrug.
|
|
161
165
|
*
|
|
162
166
|
* @returns `true` when a store is selected
|
|
163
167
|
*/
|
|
@@ -232,19 +236,41 @@ export declare function openEphemeralQueryStore(): Promise<ProjectionSqlite.SqlQ
|
|
|
232
236
|
*
|
|
233
237
|
* 🪤 The two are **different error codes**, and only one of them reaches
|
|
234
238
|
* {@link isModuleMissing}. `@vibe-agent-toolkit/projection-sqlite` imports
|
|
235
|
-
* `node:sqlite`, which
|
|
239
|
+
* `node:sqlite`, which loads unflagged from Node 22.13.0 (it was added in 22.5.0
|
|
240
|
+
* behind `--experimental-sqlite`); on 22.0–22.12 an ordinary import fails
|
|
236
241
|
* with `ERR_UNKNOWN_BUILTIN_MODULE`, not `ERR_MODULE_NOT_FOUND`. Without this
|
|
237
242
|
* branch the user gets a bare `No such built-in module: node:sqlite` — which
|
|
238
243
|
* names neither the version floor nor the fix.
|
|
239
244
|
*
|
|
240
|
-
* ⚠️ It is reachable on
|
|
241
|
-
*
|
|
242
|
-
*
|
|
243
|
-
*
|
|
244
|
-
*
|
|
245
|
-
*
|
|
246
|
-
*
|
|
247
|
-
*
|
|
245
|
+
* ⚠️ It is reachable on an ordinary run and is not a corner: the query lane has
|
|
246
|
+
* always fallen back to {@link openEphemeralQueryStore} when no store is
|
|
247
|
+
* selected, which is the default, so `node:sqlite` is required on a default
|
|
248
|
+
* `vat resources query` whichever way the lane resolves its store.
|
|
249
|
+
*
|
|
250
|
+
* 🪤 This used to say "EVERY `vat resources query`/`check` run", and that was
|
|
251
|
+
* too strong for `check`. Measured against the built CLI on Node v24.13.1 by
|
|
252
|
+
* counting the `ExperimentalWarning` `node:sqlite` emits at load — the only
|
|
253
|
+
* externally visible tell that the module was reached at all:
|
|
254
|
+
*
|
|
255
|
+
* | Command | Warnings | Backend loaded? |
|
|
256
|
+
* |---|---|---|
|
|
257
|
+
* | `vat resources query "SELECT …"` | 1 | yes |
|
|
258
|
+
* | `vat resources check`, no checks declared | 0 | **no** |
|
|
259
|
+
*
|
|
260
|
+
* `check` reaches a store only when the project declares checks for it to
|
|
261
|
+
* evaluate, so a repo with none never loads the backend and never needed the
|
|
262
|
+
* floor for that command. The floor argument is unaffected — `query` alone
|
|
263
|
+
* establishes it — but "every default run of those two commands" was a claim
|
|
264
|
+
* nothing had counted.
|
|
265
|
+
*
|
|
266
|
+
* ✅ **VAT's declared floor is now `>=22.13.0`, so this no longer fires on a
|
|
267
|
+
* SUPPORTED Node.** It used to: the manifests said `>=22.0.0` while these two
|
|
268
|
+
* commands could not run below 22.13.0, which meant thirteen Node patch
|
|
269
|
+
* releases were advertised as supported and hard-failed here. The floor was
|
|
270
|
+
* raised to stop advertising what VAT cannot do. The branch stays load-bearing
|
|
271
|
+
* for the Node that is merely *installed* rather than supported — `engines` is
|
|
272
|
+
* a warning in npm and nothing at all under most runners, so a user on 22.4
|
|
273
|
+
* still reaches this and still deserves to be told which number is wrong.
|
|
248
274
|
*
|
|
249
275
|
* The repair stays distinct from the missing-package one on purpose:
|
|
250
276
|
* "install this package" is the wrong instruction for "upgrade Node", and
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"projection-store.d.ts","sourceRoot":"","sources":["../../src/utils/projection-store.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6CG;AAEH,OAAO,KAAK,KAAK,gBAAgB,MAAM,uCAAuC,CAAC;AAC/E,OAAO,KAAK,EAAE,eAAe,EAAmB,MAAM,+BAA+B,CAAC;
|
|
1
|
+
{"version":3,"file":"projection-store.d.ts","sourceRoot":"","sources":["../../src/utils/projection-store.ts"],"names":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B,mBAAmB,CAAC,CAAC,EACzC,OAAO,EAAE;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,EACzB,IAAI,EAAE,CAAC,KAAK,EAAE,eAAe,GAAG,SAAS,KAAK,OAAO,CAAC,CAAC,CAAC,GACvD,OAAO,CAAC,CAAC,CAAC,CA0BZ"}
|
|
@@ -44,8 +44,10 @@
|
|
|
44
44
|
* standard legible error, and a tree that cannot be keyed says so on stderr
|
|
45
45
|
* rather than silently declining.
|
|
46
46
|
*/
|
|
47
|
+
import { parseEnvBoolean } from '@vibe-agent-toolkit/utils';
|
|
47
48
|
import { gitTreeSnapshot, withGitSnapshotCache } from '@vibe-agent-toolkit/utils/git';
|
|
48
49
|
import { isModuleMissing, reportMissingBackend } from './optional-backend.js';
|
|
50
|
+
import { installSqliteWarningFilter } from './sqlite-experimental-warning.js';
|
|
49
51
|
/**
|
|
50
52
|
* The env var that selects a projection store for this process.
|
|
51
53
|
*
|
|
@@ -129,8 +131,6 @@ export const PROJECTION_STORE_DIR_ENV = 'VAT_PROJECTION_STORE_DIR';
|
|
|
129
131
|
* flag was written for.
|
|
130
132
|
*/
|
|
131
133
|
export const CACHE_ENV = 'VAT_CACHE';
|
|
132
|
-
/** {@link CACHE_ENV}'s one off value. Exactly `'0'`, never truthiness — see {@link projectionStoreSelected}. */
|
|
133
|
-
export const CACHE_DISABLED = '0';
|
|
134
134
|
/**
|
|
135
135
|
* The backend as a user is told to install it.
|
|
136
136
|
*
|
|
@@ -139,7 +139,7 @@ export const CACHE_DISABLED = '0';
|
|
|
139
139
|
* it: RAG carries a platform-native binary, while this one carries a Node
|
|
140
140
|
* version floor.
|
|
141
141
|
*/
|
|
142
|
-
/** What Node throws for `import('node:sqlite')`
|
|
142
|
+
/** What Node throws for `import('node:sqlite')` when it is absent or still flagged. */
|
|
143
143
|
const UNKNOWN_BUILTIN_MODULE = 'ERR_UNKNOWN_BUILTIN_MODULE';
|
|
144
144
|
const PROJECTION_STORE_BACKEND = {
|
|
145
145
|
feature: 'The projection store',
|
|
@@ -168,15 +168,21 @@ const PROJECTION_STORE_BACKEND = {
|
|
|
168
168
|
* `vat cache`'s own help text described three caches while a fourth was being
|
|
169
169
|
* written beside them.
|
|
170
170
|
*
|
|
171
|
-
* 🪤
|
|
172
|
-
*
|
|
173
|
-
*
|
|
174
|
-
*
|
|
171
|
+
* 🪤 Read through `parseEnvBoolean`, never for truthiness — `VAT_CACHE=1` is
|
|
172
|
+
* the value an operator writes to turn caching ON, and a truthiness test would
|
|
173
|
+
* read it as a reason to decline. It was previously a comparison against the
|
|
174
|
+
* literal `'0'`, which is the same shape `ParseCache` carried and the same
|
|
175
|
+
* defect: `VAT_CACHE=false` disabled nothing. The two now share one parser
|
|
176
|
+
* (`@vibe-agent-toolkit/utils`) so the variable cannot be read two ways again.
|
|
177
|
+
*
|
|
178
|
+
* Only an explicit `false` vetoes. `parseEnvBoolean` returns `undefined` for a
|
|
179
|
+
* value it cannot read, and an unreadable value is not something the operator
|
|
180
|
+
* said — the veto has to be a statement, not a shrug.
|
|
175
181
|
*
|
|
176
182
|
* @returns `true` when a store is selected
|
|
177
183
|
*/
|
|
178
184
|
export function projectionStoreSelected() {
|
|
179
|
-
if (process.env[CACHE_ENV] ===
|
|
185
|
+
if (parseEnvBoolean(process.env[CACHE_ENV]) === false)
|
|
180
186
|
return false;
|
|
181
187
|
return process.env[PROJECTION_STORE_ENV] === PROJECTION_STORE_SQLITE;
|
|
182
188
|
}
|
|
@@ -260,6 +266,16 @@ export async function openEphemeralQueryStore() {
|
|
|
260
266
|
* @returns The backend's module namespace
|
|
261
267
|
*/
|
|
262
268
|
async function loadBackend() {
|
|
269
|
+
// `node:sqlite` emits one ExperimentalWarning as it loads, even on a Node that
|
|
270
|
+
// needs no flag for it. `projection-sqlite` refuses to suppress that itself —
|
|
271
|
+
// correctly, since a blanket NODE_NO_WARNINGS hides real warnings — and
|
|
272
|
+
// assigns the filter to whichever caller turns the backend on by default.
|
|
273
|
+
// That caller is this module, and this import is the boundary.
|
|
274
|
+
//
|
|
275
|
+
// Restored immediately afterwards: the warning fires at module evaluation, so
|
|
276
|
+
// holding the filter open any longer would start hiding warnings this import
|
|
277
|
+
// did not cause.
|
|
278
|
+
const restoreWarnings = installSqliteWarningFilter();
|
|
263
279
|
try {
|
|
264
280
|
return await import('@vibe-agent-toolkit/projection-sqlite');
|
|
265
281
|
}
|
|
@@ -271,6 +287,9 @@ async function loadBackend() {
|
|
|
271
287
|
throw error;
|
|
272
288
|
reportMissingBackend(PROJECTION_STORE_BACKEND);
|
|
273
289
|
}
|
|
290
|
+
finally {
|
|
291
|
+
restoreWarnings();
|
|
292
|
+
}
|
|
274
293
|
}
|
|
275
294
|
/**
|
|
276
295
|
* The legible failure for "your Node is too old", or `undefined` when this is
|
|
@@ -284,19 +303,41 @@ async function loadBackend() {
|
|
|
284
303
|
*
|
|
285
304
|
* 🪤 The two are **different error codes**, and only one of them reaches
|
|
286
305
|
* {@link isModuleMissing}. `@vibe-agent-toolkit/projection-sqlite` imports
|
|
287
|
-
* `node:sqlite`, which
|
|
306
|
+
* `node:sqlite`, which loads unflagged from Node 22.13.0 (it was added in 22.5.0
|
|
307
|
+
* behind `--experimental-sqlite`); on 22.0–22.12 an ordinary import fails
|
|
288
308
|
* with `ERR_UNKNOWN_BUILTIN_MODULE`, not `ERR_MODULE_NOT_FOUND`. Without this
|
|
289
309
|
* branch the user gets a bare `No such built-in module: node:sqlite` — which
|
|
290
310
|
* names neither the version floor nor the fix.
|
|
291
311
|
*
|
|
292
|
-
* ⚠️ It is reachable on
|
|
293
|
-
*
|
|
294
|
-
*
|
|
295
|
-
*
|
|
296
|
-
*
|
|
297
|
-
*
|
|
298
|
-
*
|
|
299
|
-
*
|
|
312
|
+
* ⚠️ It is reachable on an ordinary run and is not a corner: the query lane has
|
|
313
|
+
* always fallen back to {@link openEphemeralQueryStore} when no store is
|
|
314
|
+
* selected, which is the default, so `node:sqlite` is required on a default
|
|
315
|
+
* `vat resources query` whichever way the lane resolves its store.
|
|
316
|
+
*
|
|
317
|
+
* 🪤 This used to say "EVERY `vat resources query`/`check` run", and that was
|
|
318
|
+
* too strong for `check`. Measured against the built CLI on Node v24.13.1 by
|
|
319
|
+
* counting the `ExperimentalWarning` `node:sqlite` emits at load — the only
|
|
320
|
+
* externally visible tell that the module was reached at all:
|
|
321
|
+
*
|
|
322
|
+
* | Command | Warnings | Backend loaded? |
|
|
323
|
+
* |---|---|---|
|
|
324
|
+
* | `vat resources query "SELECT …"` | 1 | yes |
|
|
325
|
+
* | `vat resources check`, no checks declared | 0 | **no** |
|
|
326
|
+
*
|
|
327
|
+
* `check` reaches a store only when the project declares checks for it to
|
|
328
|
+
* evaluate, so a repo with none never loads the backend and never needed the
|
|
329
|
+
* floor for that command. The floor argument is unaffected — `query` alone
|
|
330
|
+
* establishes it — but "every default run of those two commands" was a claim
|
|
331
|
+
* nothing had counted.
|
|
332
|
+
*
|
|
333
|
+
* ✅ **VAT's declared floor is now `>=22.13.0`, so this no longer fires on a
|
|
334
|
+
* SUPPORTED Node.** It used to: the manifests said `>=22.0.0` while these two
|
|
335
|
+
* commands could not run below 22.13.0, which meant thirteen Node patch
|
|
336
|
+
* releases were advertised as supported and hard-failed here. The floor was
|
|
337
|
+
* raised to stop advertising what VAT cannot do. The branch stays load-bearing
|
|
338
|
+
* for the Node that is merely *installed* rather than supported — `engines` is
|
|
339
|
+
* a warning in npm and nothing at all under most runners, so a user on 22.4
|
|
340
|
+
* still reaches this and still deserves to be told which number is wrong.
|
|
300
341
|
*
|
|
301
342
|
* The repair stays distinct from the missing-package one on purpose:
|
|
302
343
|
* "install this package" is the wrong instruction for "upgrade Node", and
|
|
@@ -314,7 +355,13 @@ export function nodeSqliteFloorFailure(error) {
|
|
|
314
355
|
if (!isFloor)
|
|
315
356
|
return undefined;
|
|
316
357
|
return new Error('The projection store needs `node:sqlite`, which this Node does not have.'
|
|
317
|
-
|
|
358
|
+
// States the NODE fact (when the module arrived), never VAT's floor. The
|
|
359
|
+
// floor lives in `engines.node` and `vat doctor` derives it from there
|
|
360
|
+
// precisely so it has one home; restating it in a string would be the
|
|
361
|
+
// second copy that change exists to remove, and it would go stale silently
|
|
362
|
+
// the next time the floor moves.
|
|
363
|
+
+ ` \`node:sqlite\` loads unflagged from Node 22.13.0 (added in 22.5.0 behind`
|
|
364
|
+
+ ` \`--experimental-sqlite\`) — you are on ${process.version}.`
|
|
318
365
|
+ ' Upgrade Node to 22.13.0 or newer. Installing a package will not help:'
|
|
319
366
|
+ ' the module is built into Node, not published to npm.');
|
|
320
367
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"projection-store.js","sourceRoot":"","sources":["../../src/utils/projection-store.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6CG;AAIH,OAAO,EAAE,eAAe,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AAEtF,OAAO,EAAE,eAAe,EAAE,oBAAoB,EAAwB,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"projection-store.js","sourceRoot":"","sources":["../../src/utils/projection-store.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6CG;AAIH,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAC5D,OAAO,EAAE,eAAe,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AAEtF,OAAO,EAAE,eAAe,EAAE,oBAAoB,EAAwB,MAAM,uBAAuB,CAAC;AACpG,OAAO,EAAE,0BAA0B,EAAE,MAAM,kCAAkC,CAAC;AAE9E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,sBAAsB,CAAC;AAE3D,4EAA4E;AAC5E,MAAM,CAAC,MAAM,uBAAuB,GAAG,QAAQ,CAAC;AAEhD;;;;;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,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The collector every REPEATABLE option in this CLI uses, and the reason none
|
|
3
|
+
* of them is variadic.
|
|
4
|
+
*
|
|
5
|
+
* Commander offers two spellings for "this flag takes several values":
|
|
6
|
+
*
|
|
7
|
+
* - **Variadic** — `--param <values...>`, which consumes every following token
|
|
8
|
+
* up to the next option-shaped one.
|
|
9
|
+
* - **Repeatable** — `--param <value>` passed more than once, accumulated by a
|
|
10
|
+
* custom collector. This one.
|
|
11
|
+
*
|
|
12
|
+
* The variadic spelling is unusable on a command that also has a positional
|
|
13
|
+
* argument, and every command here has one. It ate the positional:
|
|
14
|
+
* `vat resources query 'SELECT ? AS x, ? AS y' --param a docs/` bound `docs/`
|
|
15
|
+
* as the SECOND SQL VALUE, left the `[path]` positional unread, and reported
|
|
16
|
+
* `status: success` at exit 0 with `y: 'docs/'` in its rows — a token the
|
|
17
|
+
* operator typed as a location, silently reinterpreted as data. On
|
|
18
|
+
* `vat skill test run <skill>` the same shape consumed the subject and the run
|
|
19
|
+
* died claiming the subject was missing.
|
|
20
|
+
*
|
|
21
|
+
* ⚠️ What the swallowed token would have DONE is a separate question, and on
|
|
22
|
+
* `query` the answer is "located the project": `[path]` there is a root
|
|
23
|
+
* locator, not a scope — see `queryCommand` — so an earlier reading of this
|
|
24
|
+
* incident as "answered about the whole tree instead of `docs/`" claimed a
|
|
25
|
+
* scoping the verb never had. The defect this module fixes is the swallow.
|
|
26
|
+
*
|
|
27
|
+
* So: no variadic options. `test/commands/no-variadic-cli-options.test.ts`
|
|
28
|
+
* enforces that against the source, because the defect is a declaration shape
|
|
29
|
+
* rather than a bug in any one command.
|
|
30
|
+
*
|
|
31
|
+
* @param value - The value Commander parsed for this occurrence of the flag
|
|
32
|
+
* @param previous - What earlier occurrences accumulated, or `undefined` for the first
|
|
33
|
+
* @returns A NEW array — never a mutation of `previous`, which on a defaulted
|
|
34
|
+
* option is shared by every parse of the same `Option` instance
|
|
35
|
+
*/
|
|
36
|
+
export declare function collectRepeated(value: string, previous?: readonly string[]): string[];
|
|
37
|
+
//# sourceMappingURL=repeatable-option.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"repeatable-option.d.ts","sourceRoot":"","sources":["../../src/utils/repeatable-option.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,SAAS,MAAM,EAAE,GAAG,MAAM,EAAE,CAErF"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The collector every REPEATABLE option in this CLI uses, and the reason none
|
|
3
|
+
* of them is variadic.
|
|
4
|
+
*
|
|
5
|
+
* Commander offers two spellings for "this flag takes several values":
|
|
6
|
+
*
|
|
7
|
+
* - **Variadic** — `--param <values...>`, which consumes every following token
|
|
8
|
+
* up to the next option-shaped one.
|
|
9
|
+
* - **Repeatable** — `--param <value>` passed more than once, accumulated by a
|
|
10
|
+
* custom collector. This one.
|
|
11
|
+
*
|
|
12
|
+
* The variadic spelling is unusable on a command that also has a positional
|
|
13
|
+
* argument, and every command here has one. It ate the positional:
|
|
14
|
+
* `vat resources query 'SELECT ? AS x, ? AS y' --param a docs/` bound `docs/`
|
|
15
|
+
* as the SECOND SQL VALUE, left the `[path]` positional unread, and reported
|
|
16
|
+
* `status: success` at exit 0 with `y: 'docs/'` in its rows — a token the
|
|
17
|
+
* operator typed as a location, silently reinterpreted as data. On
|
|
18
|
+
* `vat skill test run <skill>` the same shape consumed the subject and the run
|
|
19
|
+
* died claiming the subject was missing.
|
|
20
|
+
*
|
|
21
|
+
* ⚠️ What the swallowed token would have DONE is a separate question, and on
|
|
22
|
+
* `query` the answer is "located the project": `[path]` there is a root
|
|
23
|
+
* locator, not a scope — see `queryCommand` — so an earlier reading of this
|
|
24
|
+
* incident as "answered about the whole tree instead of `docs/`" claimed a
|
|
25
|
+
* scoping the verb never had. The defect this module fixes is the swallow.
|
|
26
|
+
*
|
|
27
|
+
* So: no variadic options. `test/commands/no-variadic-cli-options.test.ts`
|
|
28
|
+
* enforces that against the source, because the defect is a declaration shape
|
|
29
|
+
* rather than a bug in any one command.
|
|
30
|
+
*
|
|
31
|
+
* @param value - The value Commander parsed for this occurrence of the flag
|
|
32
|
+
* @param previous - What earlier occurrences accumulated, or `undefined` for the first
|
|
33
|
+
* @returns A NEW array — never a mutation of `previous`, which on a defaulted
|
|
34
|
+
* option is shared by every parse of the same `Option` instance
|
|
35
|
+
*/
|
|
36
|
+
export function collectRepeated(value, previous) {
|
|
37
|
+
return [...(previous ?? []), value];
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=repeatable-option.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"repeatable-option.js","sourceRoot":"","sources":["../../src/utils/repeatable-option.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,MAAM,UAAU,eAAe,CAAC,KAAa,EAAE,QAA4B;IACzE,OAAO,CAAC,GAAG,CAAC,QAAQ,IAAI,EAAE,CAAC,EAAE,KAAK,CAAC,CAAC;AACtC,CAAC"}
|