@vibe-agent-toolkit/cli 0.2.0-rc.2 → 0.2.0-rc.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin/vat +68 -16
- package/dist/bin/vat.js +68 -16
- package/dist/bin/vat.js.map +1 -1
- package/dist/bin.js +157 -37
- package/dist/bin.js.map +1 -1
- package/dist/command-loaders.d.ts +44 -0
- package/dist/command-loaders.d.ts.map +1 -0
- package/dist/command-loaders.js +58 -0
- package/dist/command-loaders.js.map +1 -0
- package/dist/commands/agent/index.js +1 -1
- package/dist/commands/agent/install.d.ts.map +1 -1
- package/dist/commands/agent/install.js +46 -5
- package/dist/commands/agent/install.js.map +1 -1
- package/dist/commands/audit/distributed-tree.d.ts +2 -2
- package/dist/commands/audit/distributed-tree.d.ts.map +1 -1
- package/dist/commands/audit/distributed-tree.js +2 -1
- package/dist/commands/audit/distributed-tree.js.map +1 -1
- package/dist/commands/audit/git-url-clone.d.ts +1 -1
- package/dist/commands/audit/git-url-clone.d.ts.map +1 -1
- package/dist/commands/audit/git-url-clone.js.map +1 -1
- package/dist/commands/audit/hierarchical-output.d.ts +1 -1
- package/dist/commands/audit/hierarchical-output.d.ts.map +1 -1
- package/dist/commands/audit/hierarchical-output.js +1 -1
- package/dist/commands/audit/hierarchical-output.js.map +1 -1
- package/dist/commands/audit.d.ts +22 -1
- package/dist/commands/audit.d.ts.map +1 -1
- package/dist/commands/audit.js +224 -24
- package/dist/commands/audit.js.map +1 -1
- package/dist/commands/build.d.ts +1 -1
- package/dist/commands/build.d.ts.map +1 -1
- package/dist/commands/build.js +15 -12
- package/dist/commands/build.js.map +1 -1
- package/dist/commands/cache/cache-control.d.ts +82 -0
- package/dist/commands/cache/cache-control.d.ts.map +1 -0
- package/dist/commands/cache/cache-control.js +86 -0
- package/dist/commands/cache/cache-control.js.map +1 -0
- package/dist/commands/cache/clear.d.ts +17 -3
- package/dist/commands/cache/clear.d.ts.map +1 -1
- package/dist/commands/cache/clear.js +68 -3
- package/dist/commands/cache/clear.js.map +1 -1
- package/dist/commands/cache/index.d.ts +13 -63
- package/dist/commands/cache/index.d.ts.map +1 -1
- package/dist/commands/cache/index.js +38 -79
- package/dist/commands/cache/index.js.map +1 -1
- package/dist/commands/claude/budget.d.ts +157 -0
- package/dist/commands/claude/budget.d.ts.map +1 -0
- package/dist/commands/claude/budget.js +412 -0
- package/dist/commands/claude/budget.js.map +1 -0
- package/dist/commands/claude/context.d.ts +340 -0
- package/dist/commands/claude/context.d.ts.map +1 -0
- package/dist/commands/claude/context.js +1079 -0
- package/dist/commands/claude/context.js.map +1 -0
- package/dist/commands/claude/index.d.ts +13 -0
- package/dist/commands/claude/index.d.ts.map +1 -1
- package/dist/commands/claude/index.js +24 -2
- package/dist/commands/claude/index.js.map +1 -1
- package/dist/commands/claude/marketplace/git-publish.d.ts.map +1 -1
- package/dist/commands/claude/marketplace/git-publish.js +18 -19
- package/dist/commands/claude/marketplace/git-publish.js.map +1 -1
- package/dist/commands/claude/marketplace/validate.d.ts +19 -1
- package/dist/commands/claude/marketplace/validate.d.ts.map +1 -1
- package/dist/commands/claude/marketplace/validate.js +41 -21
- package/dist/commands/claude/marketplace/validate.js.map +1 -1
- package/dist/commands/claude/plugin/build.d.ts +18 -2
- package/dist/commands/claude/plugin/build.d.ts.map +1 -1
- package/dist/commands/claude/plugin/build.js +55 -18
- package/dist/commands/claude/plugin/build.js.map +1 -1
- package/dist/commands/claude/plugin/helpers.d.ts.map +1 -1
- package/dist/commands/claude/plugin/helpers.js +2 -1
- package/dist/commands/claude/plugin/helpers.js.map +1 -1
- package/dist/commands/claude/plugin/install.d.ts.map +1 -1
- package/dist/commands/claude/plugin/install.js +24 -3
- package/dist/commands/claude/plugin/install.js.map +1 -1
- package/dist/commands/claude/plugin/tree-copy.d.ts.map +1 -1
- package/dist/commands/claude/plugin/tree-copy.js +2 -1
- package/dist/commands/claude/plugin/tree-copy.js.map +1 -1
- package/dist/commands/consistency-check.d.ts.map +1 -1
- package/dist/commands/consistency-check.js +4 -3
- package/dist/commands/consistency-check.js.map +1 -1
- package/dist/commands/corpus/report.d.ts +1 -1
- package/dist/commands/corpus/report.d.ts.map +1 -1
- package/dist/commands/corpus/runner.d.ts.map +1 -1
- package/dist/commands/corpus/runner.js +3 -2
- package/dist/commands/corpus/runner.js.map +1 -1
- package/dist/commands/corpus/scan.d.ts.map +1 -1
- package/dist/commands/corpus/scan.js +18 -8
- package/dist/commands/corpus/scan.js.map +1 -1
- package/dist/commands/doctor.d.ts +36 -0
- package/dist/commands/doctor.d.ts.map +1 -1
- package/dist/commands/doctor.js +99 -2
- package/dist/commands/doctor.js.map +1 -1
- package/dist/commands/inventory.d.ts +13 -1
- package/dist/commands/inventory.d.ts.map +1 -1
- package/dist/commands/inventory.js +118 -13
- package/dist/commands/inventory.js.map +1 -1
- package/dist/commands/mcp/collections.d.ts +1 -1
- package/dist/commands/mcp/collections.d.ts.map +1 -1
- package/dist/commands/phase-utils.d.ts +155 -104
- package/dist/commands/phase-utils.d.ts.map +1 -1
- package/dist/commands/phase-utils.js +109 -155
- package/dist/commands/phase-utils.js.map +1 -1
- package/dist/commands/rag/index-command.d.ts +39 -0
- package/dist/commands/rag/index-command.d.ts.map +1 -1
- package/dist/commands/rag/index-command.js +28 -2
- package/dist/commands/rag/index-command.js.map +1 -1
- package/dist/commands/rag/index.d.ts.map +1 -1
- package/dist/commands/rag/index.js +21 -10
- package/dist/commands/rag/index.js.map +1 -1
- package/dist/commands/resources/index.d.ts.map +1 -1
- package/dist/commands/resources/index.js +10 -2
- package/dist/commands/resources/index.js.map +1 -1
- package/dist/commands/resources/scan.d.ts +24 -0
- package/dist/commands/resources/scan.d.ts.map +1 -1
- package/dist/commands/resources/scan.js +19 -6
- package/dist/commands/resources/scan.js.map +1 -1
- package/dist/commands/resources/validate.d.ts +12 -1
- package/dist/commands/resources/validate.d.ts.map +1 -1
- package/dist/commands/resources/validate.js +102 -51
- package/dist/commands/resources/validate.js.map +1 -1
- package/dist/commands/skill/review-checklist.d.ts.map +1 -1
- package/dist/commands/skill/review-checklist.js +1 -0
- package/dist/commands/skill/review-checklist.js.map +1 -1
- package/dist/commands/skill/review.js +2 -2
- package/dist/commands/skill/review.js.map +1 -1
- package/dist/commands/skill/test/configure.d.ts +19 -0
- package/dist/commands/skill/test/configure.d.ts.map +1 -1
- package/dist/commands/skill/test/configure.js +18 -3
- package/dist/commands/skill/test/configure.js.map +1 -1
- package/dist/commands/skill/test/run.d.ts +51 -4
- package/dist/commands/skill/test/run.d.ts.map +1 -1
- package/dist/commands/skill/test/run.js +123 -12
- package/dist/commands/skill/test/run.js.map +1 -1
- package/dist/commands/skills/build.d.ts +11 -1
- package/dist/commands/skills/build.d.ts.map +1 -1
- package/dist/commands/skills/build.js +154 -61
- package/dist/commands/skills/build.js.map +1 -1
- package/dist/commands/skills/package.d.ts +1 -1
- package/dist/commands/skills/package.d.ts.map +1 -1
- package/dist/commands/skills/package.js.map +1 -1
- package/dist/commands/skills/skill-discovery.d.ts.map +1 -1
- package/dist/commands/skills/skill-discovery.js +2 -1
- package/dist/commands/skills/skill-discovery.js.map +1 -1
- package/dist/commands/skills/validate.d.ts +79 -2
- package/dist/commands/skills/validate.d.ts.map +1 -1
- package/dist/commands/skills/validate.js +101 -48
- package/dist/commands/skills/validate.js.map +1 -1
- package/dist/commands/validate.d.ts.map +1 -1
- package/dist/commands/validate.js +26 -16
- package/dist/commands/validate.js.map +1 -1
- package/dist/commands/verify.d.ts +11 -10
- package/dist/commands/verify.d.ts.map +1 -1
- package/dist/commands/verify.js +49 -38
- package/dist/commands/verify.js.map +1 -1
- package/dist/utils/command-error.d.ts +33 -2
- package/dist/utils/command-error.d.ts.map +1 -1
- package/dist/utils/command-error.js +34 -10
- package/dist/utils/command-error.js.map +1 -1
- package/dist/utils/config-loader.d.ts.map +1 -1
- package/dist/utils/config-loader.js +7 -1
- package/dist/utils/config-loader.js.map +1 -1
- package/dist/utils/context-budget-issues.d.ts +108 -0
- package/dist/utils/context-budget-issues.d.ts.map +1 -0
- package/dist/utils/context-budget-issues.js +280 -0
- package/dist/utils/context-budget-issues.js.map +1 -0
- package/dist/utils/corpus-target.d.ts +48 -0
- package/dist/utils/corpus-target.d.ts.map +1 -0
- package/dist/utils/corpus-target.js +61 -0
- package/dist/utils/corpus-target.js.map +1 -0
- package/dist/utils/issue-anchor.d.ts +2 -2
- package/dist/utils/issue-anchor.d.ts.map +1 -1
- package/dist/utils/issue-anchor.js +1 -1
- package/dist/utils/issue-rendering.d.ts +1 -1
- package/dist/utils/issue-rendering.d.ts.map +1 -1
- package/dist/utils/issue-rendering.js +1 -1
- package/dist/utils/issue-rendering.js.map +1 -1
- package/dist/utils/issue-severity.d.ts +1 -1
- package/dist/utils/issue-severity.d.ts.map +1 -1
- package/dist/utils/issue-severity.js +1 -1
- package/dist/utils/issue-severity.js.map +1 -1
- package/dist/utils/optional-backend.d.ts +77 -0
- package/dist/utils/optional-backend.d.ts.map +1 -0
- package/dist/utils/optional-backend.js +115 -0
- package/dist/utils/optional-backend.js.map +1 -0
- package/dist/utils/output.d.ts +17 -0
- package/dist/utils/output.d.ts.map +1 -1
- package/dist/utils/output.js +19 -0
- package/dist/utils/output.js.map +1 -1
- package/dist/utils/population-wiring.d.ts +100 -0
- package/dist/utils/population-wiring.d.ts.map +1 -0
- package/dist/utils/population-wiring.js +98 -0
- package/dist/utils/population-wiring.js.map +1 -0
- package/dist/utils/projection-store.d.ts +188 -0
- package/dist/utils/projection-store.d.ts.map +1 -0
- package/dist/utils/projection-store.js +257 -0
- package/dist/utils/projection-store.js.map +1 -0
- package/dist/utils/resource-loader.d.ts +128 -2
- package/dist/utils/resource-loader.d.ts.map +1 -1
- package/dist/utils/resource-loader.js +234 -7
- package/dist/utils/resource-loader.js.map +1 -1
- package/dist/utils/verdict-helpers.d.ts +1 -1
- package/dist/utils/verdict-helpers.d.ts.map +1 -1
- package/dist/utils/verdict-helpers.js +1 -1
- package/dist/utils/verdict-helpers.js.map +1 -1
- package/docs/agent.md +2 -2
- package/docs/mcp.md +2 -2
- package/docs/resources.md +8 -1
- package/package.json +15 -12
- package/dist/commands/resources/command-helpers.d.ts +0 -5
- package/dist/commands/resources/command-helpers.d.ts.map +0 -1
- package/dist/commands/resources/command-helpers.js +0 -6
- package/dist/commands/resources/command-helpers.js.map +0 -1
|
@@ -0,0 +1,280 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The always-loaded context budget sweep, rendered as validation findings.
|
|
3
|
+
*
|
|
4
|
+
* Pure: no I/O, no config, no severity resolution, no exit code. It takes the
|
|
5
|
+
* {@link BudgetSweep} `@vibe-agent-toolkit/resources` produced and answers
|
|
6
|
+
* "which of these does a reader need to be told about, and in what words". The
|
|
7
|
+
* command that calls it stays a thin orchestrator, and this file is where the
|
|
8
|
+
* decision worth testing lives.
|
|
9
|
+
*
|
|
10
|
+
* ## ONE issue per REPRESENTATIVE, never one per working location
|
|
11
|
+
*
|
|
12
|
+
* A sweep reports every working location, and locations sharing an instruction
|
|
13
|
+
* chain share one budget — that is the whole point of the collapse. Re-measured
|
|
14
|
+
* on VAT's own tree 2026-08-23, after the context population began declining the
|
|
15
|
+
* gitignored half: **366 of 589 directories** pay the single chain
|
|
16
|
+
* `['CLAUDE.md']`, so emitting per location would print 366 byte-identical
|
|
17
|
+
* findings, all blaming one file, the moment the root `CLAUDE.md` crossed the
|
|
18
|
+
* budget. (It read *"553 of 819"* against the wider population; the ratio barely
|
|
19
|
+
* moved, and the argument does not turn on it.) There are **9** distinct chains
|
|
20
|
+
* on this tree either way, so per-representative emission caps the output at 9
|
|
21
|
+
* findings at any threshold.
|
|
22
|
+
*
|
|
23
|
+
* That is not a formatting preference. A check that emits 366 findings for one
|
|
24
|
+
* cause is a check an adopter silences with
|
|
25
|
+
* `severity.ALWAYS_LOADED_CONTEXT_BUDGET: ignore` rather than fixes — and a
|
|
26
|
+
* silenced check reports nothing forever, which is strictly worse than the
|
|
27
|
+
* finding it was trying to deliver.
|
|
28
|
+
*
|
|
29
|
+
* ## What the message may and may not claim
|
|
30
|
+
*
|
|
31
|
+
* ⛔ Never "the total cost". A global `~/.claude/CLAUDE.md` and the enabled skill
|
|
32
|
+
* index are real always-loaded cost that this TREE-ONLY projection cannot see, so
|
|
33
|
+
* even a budget reporting zero exclusions is a floor — see the module doc of
|
|
34
|
+
* `packages/resources/src/projection/claude-context-budget.ts`, which states the
|
|
35
|
+
* bound precisely and which this wording must not contradict. The messages here
|
|
36
|
+
* therefore say "estimated at", and the narrower, checkable claim carried by
|
|
37
|
+
* {@link AlwaysLoadedBudget.lowerBound} — that rows VAT *did* see were left out
|
|
38
|
+
* of the sum — is appended as its own sentence with the three counts behind it.
|
|
39
|
+
*
|
|
40
|
+
* 🔑 `excludedRuleRows` is deliberately NOT one of those counts. What it counts is
|
|
41
|
+
* PATH-SCOPED rules — the ones carrying a `paths:` list — and those are excluded
|
|
42
|
+
* by DESIGN: they are `selected`, not `always`, so their absence from the sum is a
|
|
43
|
+
* decision rather than a gap in what we know, and only ignorance makes a sum a
|
|
44
|
+
* lower bound.
|
|
45
|
+
*
|
|
46
|
+
* ⛔ Not "rules files" as a class. An UNSCOPED rule in the root `.claude/rules/`
|
|
47
|
+
* is classed `always` and IS charged into the budget — nothing gates it on a path,
|
|
48
|
+
* so it loads at launch exactly as a CLAUDE.md does. The blanket reading was true
|
|
49
|
+
* while every rule was excluded and became a false statement about a check that
|
|
50
|
+
* gates the moment the root-rule admission started qualifying. It matters here
|
|
51
|
+
* because the largest contributor a message names may now be a rules file, which
|
|
52
|
+
* is why the registry `fix` points at the named contributors rather than at a file
|
|
53
|
+
* type.
|
|
54
|
+
*/
|
|
55
|
+
import { createRegistryIssue } from '@vibe-agent-toolkit/schema';
|
|
56
|
+
import { toForwardSlash } from '@vibe-agent-toolkit/utils';
|
|
57
|
+
/**
|
|
58
|
+
* How many contributors a message names before it starts counting them.
|
|
59
|
+
*
|
|
60
|
+
* The chain can be five files deep and the message is read in a terminal, beside
|
|
61
|
+
* every other finding of the run. Three names the files worth opening; the tail
|
|
62
|
+
* is a count so nothing is silently dropped.
|
|
63
|
+
*/
|
|
64
|
+
const MAX_NAMED_CONTRIBUTORS = 3;
|
|
65
|
+
/**
|
|
66
|
+
* Narrow a sweep to the instruction chains the requested paths inherit.
|
|
67
|
+
*
|
|
68
|
+
* ## The retention rule, which is the whole design
|
|
69
|
+
*
|
|
70
|
+
* A scope selects CHAINS, never payers. Every location paying a selected chain
|
|
71
|
+
* is retained even when it sits outside the scope, because the finding's message
|
|
72
|
+
* says how many working locations pay it — and that number is a fact about the
|
|
73
|
+
* TREE. Retaining only the in-scope payers would make `vat claude budget
|
|
74
|
+
* docs/guides` report *"1 working location pays it"* for a chain 366 directories
|
|
75
|
+
* pay: a confidently wrong number, which costs more than no number.
|
|
76
|
+
*
|
|
77
|
+
* ## Matching is on SEGMENT boundaries
|
|
78
|
+
*
|
|
79
|
+
* `'packages/cli-x'.startsWith('packages/cli')` is true, so a bare prefix test
|
|
80
|
+
* hands a sibling directory its neighbour's scope. The same trap
|
|
81
|
+
* `representativeFor` in `claude-context-budget-sweep.ts` exists to avoid, one
|
|
82
|
+
* layer down.
|
|
83
|
+
*
|
|
84
|
+
* @param sweep - Every working location's budget, from `sweepAlwaysLoadedBudgets`
|
|
85
|
+
* @param scope - Root-relative directories to report for. `''` is the corpus
|
|
86
|
+
* root and selects the whole tree; an empty list selects nothing
|
|
87
|
+
* @returns The narrowed sweep and the requested paths that matched no location
|
|
88
|
+
*/
|
|
89
|
+
export function scopeSweepToPaths(sweep, scope) {
|
|
90
|
+
const selected = new Set();
|
|
91
|
+
const unmatched = [];
|
|
92
|
+
for (const target of scope) {
|
|
93
|
+
const matched = sweep.locations.filter((location) => coversDirectory(target, location.directory));
|
|
94
|
+
if (matched.length === 0) {
|
|
95
|
+
unmatched.push(target);
|
|
96
|
+
continue;
|
|
97
|
+
}
|
|
98
|
+
for (const location of matched)
|
|
99
|
+
selected.add(location.representative);
|
|
100
|
+
}
|
|
101
|
+
return {
|
|
102
|
+
// Counters are carried through untouched: they describe the SWEEP, and a
|
|
103
|
+
// scope narrows what is reported without changing what was measured.
|
|
104
|
+
sweep: {
|
|
105
|
+
...sweep,
|
|
106
|
+
locations: sweep.locations.filter((location) => selected.has(location.representative)),
|
|
107
|
+
},
|
|
108
|
+
unmatchedScope: unmatched,
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Does a requested directory cover another one — itself included?
|
|
113
|
+
*
|
|
114
|
+
* @param target - The requested root-relative directory; `''` is the corpus root
|
|
115
|
+
* @param directory - A working location
|
|
116
|
+
* @returns True when `target` is `directory` or one of its ancestors
|
|
117
|
+
*/
|
|
118
|
+
function coversDirectory(target, directory) {
|
|
119
|
+
if (target === '')
|
|
120
|
+
return true;
|
|
121
|
+
// Both sides are already forward-slashed — the projection's `dir` column and
|
|
122
|
+
// `safePath.relative`'s output both are — but normalizing anyway is what keeps
|
|
123
|
+
// a Windows-separator string from silently matching nothing here.
|
|
124
|
+
const normalizedScope = toForwardSlash(target);
|
|
125
|
+
const normalizedLocation = toForwardSlash(directory);
|
|
126
|
+
return normalizedLocation === normalizedScope
|
|
127
|
+
|| normalizedLocation.startsWith(`${normalizedScope}/`);
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* One finding per over-budget instruction chain, ordered for a clean diff.
|
|
131
|
+
*
|
|
132
|
+
* @param sweep - Every working location's budget, from `sweepAlwaysLoadedBudgets`
|
|
133
|
+
* @returns The issues, ascending by representative directory (code point)
|
|
134
|
+
*/
|
|
135
|
+
export function contextBudgetIssues(sweep) {
|
|
136
|
+
return [...groupByRepresentative(sweep).values()]
|
|
137
|
+
.filter((group) => group.budget.overBudget)
|
|
138
|
+
.sort((left, right) => comparePaths(left.representative, right.representative))
|
|
139
|
+
.map(issueFor);
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* Collapse the sweep's locations onto the representatives that produced them.
|
|
143
|
+
*
|
|
144
|
+
* Every location in a group carries the SAME `budget` object — the sweep memoizes
|
|
145
|
+
* one answer per representative — so the first one seen is the group's budget and
|
|
146
|
+
* the rest only add to the count.
|
|
147
|
+
*
|
|
148
|
+
* @param sweep - The sweep
|
|
149
|
+
* @returns Representative directory → its budget and its location count
|
|
150
|
+
*/
|
|
151
|
+
function groupByRepresentative(sweep) {
|
|
152
|
+
const groups = new Map();
|
|
153
|
+
for (const location of sweep.locations) {
|
|
154
|
+
const existing = groups.get(location.representative);
|
|
155
|
+
if (existing === undefined) {
|
|
156
|
+
groups.set(location.representative, {
|
|
157
|
+
representative: location.representative,
|
|
158
|
+
budget: location.budget,
|
|
159
|
+
locations: 1,
|
|
160
|
+
});
|
|
161
|
+
continue;
|
|
162
|
+
}
|
|
163
|
+
existing.locations += 1;
|
|
164
|
+
}
|
|
165
|
+
return groups;
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* One group's finding, with severity, `fix` and `reference` taken from the
|
|
169
|
+
* registry rather than restated here.
|
|
170
|
+
*
|
|
171
|
+
* ⛔ `location` is OMITTED entirely for the corpus root. `ValidationIssue.
|
|
172
|
+
* location` is a project-relative POSIX path, and `''` is not one — the schema's
|
|
173
|
+
* own refinements would be handed a value that means "nowhere", while the message
|
|
174
|
+
* carries the same fact in words a reader can act on.
|
|
175
|
+
*
|
|
176
|
+
* @param group - The over-budget representative
|
|
177
|
+
* @returns The issue
|
|
178
|
+
*/
|
|
179
|
+
function issueFor(group) {
|
|
180
|
+
return createRegistryIssue('ALWAYS_LOADED_CONTEXT_BUDGET', messageFor(group), group.representative === '' ? {} : { location: group.representative });
|
|
181
|
+
}
|
|
182
|
+
/**
|
|
183
|
+
* The finding's prose: where, how much, against what, who pays it, and what is
|
|
184
|
+
* biggest — in that order, because that is the order a reader needs them to
|
|
185
|
+
* decide whether to open anything.
|
|
186
|
+
*
|
|
187
|
+
* @param group - The over-budget representative
|
|
188
|
+
* @returns The message
|
|
189
|
+
*/
|
|
190
|
+
function messageFor(group) {
|
|
191
|
+
const { budget, locations } = group;
|
|
192
|
+
const paying = locations === 1
|
|
193
|
+
? '1 working location pays it'
|
|
194
|
+
: `${count(locations)} working locations pay it`;
|
|
195
|
+
return `Always-loaded context at ${subjectOf(group.representative)} is estimated at`
|
|
196
|
+
+ ` ${count(budget.tokens)} tokens, over the ${count(budget.threshold)}-token budget;`
|
|
197
|
+
+ ` ${paying}. ${contributorsOf(budget)}${lowerBoundOf(budget)}`;
|
|
198
|
+
}
|
|
199
|
+
/**
|
|
200
|
+
* How the representative is named in prose.
|
|
201
|
+
*
|
|
202
|
+
* The corpus root is `''`, which renders as nothing at all and reads like a bug —
|
|
203
|
+
* and it is also the one case that carries no `location` field, so the prose is
|
|
204
|
+
* the ONLY place a reader learns which directory the finding is about.
|
|
205
|
+
*
|
|
206
|
+
* @param representative - The representative directory
|
|
207
|
+
* @returns Its display form
|
|
208
|
+
*/
|
|
209
|
+
function subjectOf(representative) {
|
|
210
|
+
return representative === '' ? 'the repository root' : representative;
|
|
211
|
+
}
|
|
212
|
+
/**
|
|
213
|
+
* The largest contributors, capped, with the tail counted rather than dropped.
|
|
214
|
+
*
|
|
215
|
+
* The sweep already sorted contributors descending by tokens (ties broken on path
|
|
216
|
+
* by code point), so "largest" is a prefix and this function does no ordering of
|
|
217
|
+
* its own.
|
|
218
|
+
*
|
|
219
|
+
* @param budget - The over-budget answer
|
|
220
|
+
* @returns The sentence, ending in a period
|
|
221
|
+
*/
|
|
222
|
+
function contributorsOf(budget) {
|
|
223
|
+
const { contributors } = budget;
|
|
224
|
+
if (contributors.length === 0)
|
|
225
|
+
return 'No contributor was charged.';
|
|
226
|
+
const named = contributors
|
|
227
|
+
.slice(0, MAX_NAMED_CONTRIBUTORS)
|
|
228
|
+
.map((contributor) => `${contributor.path} (${count(contributor.tokens)} tokens)`);
|
|
229
|
+
const remaining = contributors.length - named.length;
|
|
230
|
+
const tail = remaining > 0 ? `, +${count(remaining)} more` : '';
|
|
231
|
+
return `Largest contributors: ${named.join(', ')}${tail}.`;
|
|
232
|
+
}
|
|
233
|
+
/**
|
|
234
|
+
* The bound sentence, when — and only when — rows VAT saw were left unsummed.
|
|
235
|
+
*
|
|
236
|
+
* All three counts are named even at zero, so a reader learns which kind of
|
|
237
|
+
* ignorance is behind the bound rather than having to infer it from silence.
|
|
238
|
+
*
|
|
239
|
+
* @param budget - The over-budget answer
|
|
240
|
+
* @returns The sentence with a leading space, or the empty string
|
|
241
|
+
*/
|
|
242
|
+
function lowerBoundOf(budget) {
|
|
243
|
+
if (!budget.lowerBound)
|
|
244
|
+
return '';
|
|
245
|
+
return ' That figure is a lower bound: '
|
|
246
|
+
+ `${count(budget.unknownTokenRows)} rows of unknown size, `
|
|
247
|
+
+ `${count(budget.excludedDeepImportRows)} import rows past one hop and `
|
|
248
|
+
+ `${count(budget.unattributedImportRows)} unattributed import rows`
|
|
249
|
+
+ ' were seen but left out of the sum.';
|
|
250
|
+
}
|
|
251
|
+
/**
|
|
252
|
+
* A count as a reader reads it.
|
|
253
|
+
*
|
|
254
|
+
* Pinned to `en-US` rather than left to the host locale: the same finding must
|
|
255
|
+
* render byte-identically on two developers' machines, for the same reason the
|
|
256
|
+
* ordering below is code-point and not `localeCompare`.
|
|
257
|
+
*
|
|
258
|
+
* @param value - The number
|
|
259
|
+
* @returns Its thousands-separated form
|
|
260
|
+
*/
|
|
261
|
+
function count(value) {
|
|
262
|
+
return value.toLocaleString('en-US');
|
|
263
|
+
}
|
|
264
|
+
/**
|
|
265
|
+
* Order two root-relative directories by UTF-16 code point.
|
|
266
|
+
*
|
|
267
|
+
* ⛔ Not `localeCompare`: ICU collation is locale-dependent, so two developers
|
|
268
|
+
* diffing the same run's findings would see churn neither of them caused. Matches
|
|
269
|
+
* every other ordering in the projection lane.
|
|
270
|
+
*
|
|
271
|
+
* @param left - One representative
|
|
272
|
+
* @param right - The other
|
|
273
|
+
* @returns Negative, zero or positive, per the `Array#sort` contract
|
|
274
|
+
*/
|
|
275
|
+
function comparePaths(left, right) {
|
|
276
|
+
if (left === right)
|
|
277
|
+
return 0;
|
|
278
|
+
return left < right ? -1 : 1;
|
|
279
|
+
}
|
|
280
|
+
//# sourceMappingURL=context-budget-issues.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context-budget-issues.js","sourceRoot":"","sources":["../../src/utils/context-budget-issues.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqDG;AAGH,OAAO,EAAE,mBAAmB,EAAwB,MAAM,4BAA4B,CAAC;AACvF,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAE3D;;;;;;GAMG;AACH,MAAM,sBAAsB,GAAG,CAAC,CAAC;AAsBjC;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,MAAM,UAAU,iBAAiB,CAAC,KAAkB,EAAE,KAAwB;IAC5E,MAAM,QAAQ,GAAG,IAAI,GAAG,EAAU,CAAC;IACnC,MAAM,SAAS,GAAa,EAAE,CAAC;IAC/B,KAAK,MAAM,MAAM,IAAI,KAAK,EAAE,CAAC;QAC3B,MAAM,OAAO,GAAG,KAAK,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,eAAe,CAAC,MAAM,EAAE,QAAQ,CAAC,SAAS,CAAC,CAAC,CAAC;QAClG,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACzB,SAAS,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;YACvB,SAAS;QACX,CAAC;QACD,KAAK,MAAM,QAAQ,IAAI,OAAO;YAAE,QAAQ,CAAC,GAAG,CAAC,QAAQ,CAAC,cAAc,CAAC,CAAC;IACxE,CAAC;IACD,OAAO;QACL,yEAAyE;QACzE,qEAAqE;QACrE,KAAK,EAAE;YACL,GAAG,KAAK;YACR,SAAS,EAAE,KAAK,CAAC,SAAS,CAAC,MAAM,CA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AC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAC/B,CAAC"}
|
|
@@ -0,0 +1,48 @@
|
|
|
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
|
+
/**
|
|
12
|
+
* Does a path already stated against the corpus root fall OUTSIDE it?
|
|
13
|
+
*
|
|
14
|
+
* Three spellings of "outside", not two, and the third is the one that could
|
|
15
|
+
* only fail where nobody would see it. `safePath.relative` says "not under this
|
|
16
|
+
* root" with a `..`-prefixed path in the ordinary case, but returns an ABSOLUTE
|
|
17
|
+
* path when no relative route exists at all — which on Windows is exactly what a
|
|
18
|
+
* different drive letter produces. Without the third test, `vat claude context
|
|
19
|
+
* D:\elsewhere\doc.md` run from a `C:` repo passes the guard and answers `kind:
|
|
20
|
+
* unknown`, indistinguishable from a typo inside the tree, which is the one
|
|
21
|
+
* outcome {@link targetPathWithin}'s `@throws` claims to prevent. Its sibling
|
|
22
|
+
* `escapesRoot` (`closure-extent.ts`) applies the same triple for the same
|
|
23
|
+
* reason.
|
|
24
|
+
*
|
|
25
|
+
* ⛔ Exported so it can be TESTED. On POSIX `safePath.relative` between two
|
|
26
|
+
* absolute paths never returns an absolute string, so the third clause is
|
|
27
|
+
* unreachable through {@link targetPathWithin} on every machine a developer
|
|
28
|
+
* runs — the branch has to be exercised directly or not at all, and "not at
|
|
29
|
+
* all" is how it went missing in the first place.
|
|
30
|
+
*
|
|
31
|
+
* @param normalizedRelative - A forward-slashed path already stated against the
|
|
32
|
+
* corpus root
|
|
33
|
+
* @returns True when the corpus root does not contain it
|
|
34
|
+
*/
|
|
35
|
+
export declare function escapesCorpusRoot(normalizedRelative: string): boolean;
|
|
36
|
+
/**
|
|
37
|
+
* The root-relative path to query, refusing anything outside the corpus.
|
|
38
|
+
*
|
|
39
|
+
* @param root - The discovered project root
|
|
40
|
+
* @param pathArg - The path argument, or undefined for the current directory
|
|
41
|
+
* @param commandName - The command saying so, for the refusal's wording
|
|
42
|
+
* @returns The root-relative, forward-slashed target. `''` is the corpus root
|
|
43
|
+
* @throws When the argument resolves outside `root` — answering for it would
|
|
44
|
+
* mean querying a corpus this projection never enumerated, and a confident
|
|
45
|
+
* "nothing here" would be indistinguishable from a typo inside the tree
|
|
46
|
+
*/
|
|
47
|
+
export declare function targetPathWithin(root: string, pathArg: string | undefined, commandName: string): string;
|
|
48
|
+
//# sourceMappingURL=corpus-target.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"corpus-target.d.ts","sourceRoot":"","sources":["../../src/utils/corpus-target.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAIH;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,iBAAiB,CAAC,kBAAkB,EAAE,MAAM,GAAG,OAAO,CAIrE;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,gBAAgB,CAC9B,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,MAAM,GAAG,SAAS,EAC3B,WAAW,EAAE,MAAM,GAClB,MAAM,CAUR"}
|
|
@@ -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,OAAO,EAEL,KAAK,cAAc,EACnB,KAAK,eAAe,EACrB,MAAM,4BAA4B,CAAC;AAiBpC,gDAAgD;AAChD,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;;;;;;;;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,CAAC,QAAqC;IACjE,OAAO,eAAe,CAAC,QAAQ,CAAC,CAAC;AACnC,CAAC;AAED;;;;;;GAMG;AACH,MAAM,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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"}
|