@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.
Files changed (211) hide show
  1. package/dist/bin/vat +68 -16
  2. package/dist/bin/vat.js +68 -16
  3. package/dist/bin/vat.js.map +1 -1
  4. package/dist/bin.js +157 -37
  5. package/dist/bin.js.map +1 -1
  6. package/dist/command-loaders.d.ts +44 -0
  7. package/dist/command-loaders.d.ts.map +1 -0
  8. package/dist/command-loaders.js +58 -0
  9. package/dist/command-loaders.js.map +1 -0
  10. package/dist/commands/agent/index.js +1 -1
  11. package/dist/commands/agent/install.d.ts.map +1 -1
  12. package/dist/commands/agent/install.js +46 -5
  13. package/dist/commands/agent/install.js.map +1 -1
  14. package/dist/commands/audit/distributed-tree.d.ts +2 -2
  15. package/dist/commands/audit/distributed-tree.d.ts.map +1 -1
  16. package/dist/commands/audit/distributed-tree.js +2 -1
  17. package/dist/commands/audit/distributed-tree.js.map +1 -1
  18. package/dist/commands/audit/git-url-clone.d.ts +1 -1
  19. package/dist/commands/audit/git-url-clone.d.ts.map +1 -1
  20. package/dist/commands/audit/git-url-clone.js.map +1 -1
  21. package/dist/commands/audit/hierarchical-output.d.ts +1 -1
  22. package/dist/commands/audit/hierarchical-output.d.ts.map +1 -1
  23. package/dist/commands/audit/hierarchical-output.js +1 -1
  24. package/dist/commands/audit/hierarchical-output.js.map +1 -1
  25. package/dist/commands/audit.d.ts +22 -1
  26. package/dist/commands/audit.d.ts.map +1 -1
  27. package/dist/commands/audit.js +224 -24
  28. package/dist/commands/audit.js.map +1 -1
  29. package/dist/commands/build.d.ts +1 -1
  30. package/dist/commands/build.d.ts.map +1 -1
  31. package/dist/commands/build.js +15 -12
  32. package/dist/commands/build.js.map +1 -1
  33. package/dist/commands/cache/cache-control.d.ts +82 -0
  34. package/dist/commands/cache/cache-control.d.ts.map +1 -0
  35. package/dist/commands/cache/cache-control.js +86 -0
  36. package/dist/commands/cache/cache-control.js.map +1 -0
  37. package/dist/commands/cache/clear.d.ts +17 -3
  38. package/dist/commands/cache/clear.d.ts.map +1 -1
  39. package/dist/commands/cache/clear.js +68 -3
  40. package/dist/commands/cache/clear.js.map +1 -1
  41. package/dist/commands/cache/index.d.ts +13 -63
  42. package/dist/commands/cache/index.d.ts.map +1 -1
  43. package/dist/commands/cache/index.js +38 -79
  44. package/dist/commands/cache/index.js.map +1 -1
  45. package/dist/commands/claude/budget.d.ts +157 -0
  46. package/dist/commands/claude/budget.d.ts.map +1 -0
  47. package/dist/commands/claude/budget.js +412 -0
  48. package/dist/commands/claude/budget.js.map +1 -0
  49. package/dist/commands/claude/context.d.ts +340 -0
  50. package/dist/commands/claude/context.d.ts.map +1 -0
  51. package/dist/commands/claude/context.js +1079 -0
  52. package/dist/commands/claude/context.js.map +1 -0
  53. package/dist/commands/claude/index.d.ts +13 -0
  54. package/dist/commands/claude/index.d.ts.map +1 -1
  55. package/dist/commands/claude/index.js +24 -2
  56. package/dist/commands/claude/index.js.map +1 -1
  57. package/dist/commands/claude/marketplace/git-publish.d.ts.map +1 -1
  58. package/dist/commands/claude/marketplace/git-publish.js +18 -19
  59. package/dist/commands/claude/marketplace/git-publish.js.map +1 -1
  60. package/dist/commands/claude/marketplace/validate.d.ts +19 -1
  61. package/dist/commands/claude/marketplace/validate.d.ts.map +1 -1
  62. package/dist/commands/claude/marketplace/validate.js +41 -21
  63. package/dist/commands/claude/marketplace/validate.js.map +1 -1
  64. package/dist/commands/claude/plugin/build.d.ts +18 -2
  65. package/dist/commands/claude/plugin/build.d.ts.map +1 -1
  66. package/dist/commands/claude/plugin/build.js +55 -18
  67. package/dist/commands/claude/plugin/build.js.map +1 -1
  68. package/dist/commands/claude/plugin/helpers.d.ts.map +1 -1
  69. package/dist/commands/claude/plugin/helpers.js +2 -1
  70. package/dist/commands/claude/plugin/helpers.js.map +1 -1
  71. package/dist/commands/claude/plugin/install.d.ts.map +1 -1
  72. package/dist/commands/claude/plugin/install.js +24 -3
  73. package/dist/commands/claude/plugin/install.js.map +1 -1
  74. package/dist/commands/claude/plugin/tree-copy.d.ts.map +1 -1
  75. package/dist/commands/claude/plugin/tree-copy.js +2 -1
  76. package/dist/commands/claude/plugin/tree-copy.js.map +1 -1
  77. package/dist/commands/consistency-check.d.ts.map +1 -1
  78. package/dist/commands/consistency-check.js +4 -3
  79. package/dist/commands/consistency-check.js.map +1 -1
  80. package/dist/commands/corpus/report.d.ts +1 -1
  81. package/dist/commands/corpus/report.d.ts.map +1 -1
  82. package/dist/commands/corpus/runner.d.ts.map +1 -1
  83. package/dist/commands/corpus/runner.js +3 -2
  84. package/dist/commands/corpus/runner.js.map +1 -1
  85. package/dist/commands/corpus/scan.d.ts.map +1 -1
  86. package/dist/commands/corpus/scan.js +18 -8
  87. package/dist/commands/corpus/scan.js.map +1 -1
  88. package/dist/commands/doctor.d.ts +36 -0
  89. package/dist/commands/doctor.d.ts.map +1 -1
  90. package/dist/commands/doctor.js +99 -2
  91. package/dist/commands/doctor.js.map +1 -1
  92. package/dist/commands/inventory.d.ts +13 -1
  93. package/dist/commands/inventory.d.ts.map +1 -1
  94. package/dist/commands/inventory.js +118 -13
  95. package/dist/commands/inventory.js.map +1 -1
  96. package/dist/commands/mcp/collections.d.ts +1 -1
  97. package/dist/commands/mcp/collections.d.ts.map +1 -1
  98. package/dist/commands/phase-utils.d.ts +155 -104
  99. package/dist/commands/phase-utils.d.ts.map +1 -1
  100. package/dist/commands/phase-utils.js +109 -155
  101. package/dist/commands/phase-utils.js.map +1 -1
  102. package/dist/commands/rag/index-command.d.ts +39 -0
  103. package/dist/commands/rag/index-command.d.ts.map +1 -1
  104. package/dist/commands/rag/index-command.js +28 -2
  105. package/dist/commands/rag/index-command.js.map +1 -1
  106. package/dist/commands/rag/index.d.ts.map +1 -1
  107. package/dist/commands/rag/index.js +21 -10
  108. package/dist/commands/rag/index.js.map +1 -1
  109. package/dist/commands/resources/index.d.ts.map +1 -1
  110. package/dist/commands/resources/index.js +10 -2
  111. package/dist/commands/resources/index.js.map +1 -1
  112. package/dist/commands/resources/scan.d.ts +24 -0
  113. package/dist/commands/resources/scan.d.ts.map +1 -1
  114. package/dist/commands/resources/scan.js +19 -6
  115. package/dist/commands/resources/scan.js.map +1 -1
  116. package/dist/commands/resources/validate.d.ts +12 -1
  117. package/dist/commands/resources/validate.d.ts.map +1 -1
  118. package/dist/commands/resources/validate.js +102 -51
  119. package/dist/commands/resources/validate.js.map +1 -1
  120. package/dist/commands/skill/review-checklist.d.ts.map +1 -1
  121. package/dist/commands/skill/review-checklist.js +1 -0
  122. package/dist/commands/skill/review-checklist.js.map +1 -1
  123. package/dist/commands/skill/review.js +2 -2
  124. package/dist/commands/skill/review.js.map +1 -1
  125. package/dist/commands/skill/test/configure.d.ts +19 -0
  126. package/dist/commands/skill/test/configure.d.ts.map +1 -1
  127. package/dist/commands/skill/test/configure.js +18 -3
  128. package/dist/commands/skill/test/configure.js.map +1 -1
  129. package/dist/commands/skill/test/run.d.ts +51 -4
  130. package/dist/commands/skill/test/run.d.ts.map +1 -1
  131. package/dist/commands/skill/test/run.js +123 -12
  132. package/dist/commands/skill/test/run.js.map +1 -1
  133. package/dist/commands/skills/build.d.ts +11 -1
  134. package/dist/commands/skills/build.d.ts.map +1 -1
  135. package/dist/commands/skills/build.js +154 -61
  136. package/dist/commands/skills/build.js.map +1 -1
  137. package/dist/commands/skills/package.d.ts +1 -1
  138. package/dist/commands/skills/package.d.ts.map +1 -1
  139. package/dist/commands/skills/package.js.map +1 -1
  140. package/dist/commands/skills/skill-discovery.d.ts.map +1 -1
  141. package/dist/commands/skills/skill-discovery.js +2 -1
  142. package/dist/commands/skills/skill-discovery.js.map +1 -1
  143. package/dist/commands/skills/validate.d.ts +79 -2
  144. package/dist/commands/skills/validate.d.ts.map +1 -1
  145. package/dist/commands/skills/validate.js +101 -48
  146. package/dist/commands/skills/validate.js.map +1 -1
  147. package/dist/commands/validate.d.ts.map +1 -1
  148. package/dist/commands/validate.js +26 -16
  149. package/dist/commands/validate.js.map +1 -1
  150. package/dist/commands/verify.d.ts +11 -10
  151. package/dist/commands/verify.d.ts.map +1 -1
  152. package/dist/commands/verify.js +49 -38
  153. package/dist/commands/verify.js.map +1 -1
  154. package/dist/utils/command-error.d.ts +33 -2
  155. package/dist/utils/command-error.d.ts.map +1 -1
  156. package/dist/utils/command-error.js +34 -10
  157. package/dist/utils/command-error.js.map +1 -1
  158. package/dist/utils/config-loader.d.ts.map +1 -1
  159. package/dist/utils/config-loader.js +7 -1
  160. package/dist/utils/config-loader.js.map +1 -1
  161. package/dist/utils/context-budget-issues.d.ts +108 -0
  162. package/dist/utils/context-budget-issues.d.ts.map +1 -0
  163. package/dist/utils/context-budget-issues.js +280 -0
  164. package/dist/utils/context-budget-issues.js.map +1 -0
  165. package/dist/utils/corpus-target.d.ts +48 -0
  166. package/dist/utils/corpus-target.d.ts.map +1 -0
  167. package/dist/utils/corpus-target.js +61 -0
  168. package/dist/utils/corpus-target.js.map +1 -0
  169. package/dist/utils/issue-anchor.d.ts +2 -2
  170. package/dist/utils/issue-anchor.d.ts.map +1 -1
  171. package/dist/utils/issue-anchor.js +1 -1
  172. package/dist/utils/issue-rendering.d.ts +1 -1
  173. package/dist/utils/issue-rendering.d.ts.map +1 -1
  174. package/dist/utils/issue-rendering.js +1 -1
  175. package/dist/utils/issue-rendering.js.map +1 -1
  176. package/dist/utils/issue-severity.d.ts +1 -1
  177. package/dist/utils/issue-severity.d.ts.map +1 -1
  178. package/dist/utils/issue-severity.js +1 -1
  179. package/dist/utils/issue-severity.js.map +1 -1
  180. package/dist/utils/optional-backend.d.ts +77 -0
  181. package/dist/utils/optional-backend.d.ts.map +1 -0
  182. package/dist/utils/optional-backend.js +115 -0
  183. package/dist/utils/optional-backend.js.map +1 -0
  184. package/dist/utils/output.d.ts +17 -0
  185. package/dist/utils/output.d.ts.map +1 -1
  186. package/dist/utils/output.js +19 -0
  187. package/dist/utils/output.js.map +1 -1
  188. package/dist/utils/population-wiring.d.ts +100 -0
  189. package/dist/utils/population-wiring.d.ts.map +1 -0
  190. package/dist/utils/population-wiring.js +98 -0
  191. package/dist/utils/population-wiring.js.map +1 -0
  192. package/dist/utils/projection-store.d.ts +188 -0
  193. package/dist/utils/projection-store.d.ts.map +1 -0
  194. package/dist/utils/projection-store.js +257 -0
  195. package/dist/utils/projection-store.js.map +1 -0
  196. package/dist/utils/resource-loader.d.ts +128 -2
  197. package/dist/utils/resource-loader.d.ts.map +1 -1
  198. package/dist/utils/resource-loader.js +234 -7
  199. package/dist/utils/resource-loader.js.map +1 -1
  200. package/dist/utils/verdict-helpers.d.ts +1 -1
  201. package/dist/utils/verdict-helpers.d.ts.map +1 -1
  202. package/dist/utils/verdict-helpers.js +1 -1
  203. package/dist/utils/verdict-helpers.js.map +1 -1
  204. package/docs/agent.md +2 -2
  205. package/docs/mcp.md +2 -2
  206. package/docs/resources.md +8 -1
  207. package/package.json +15 -12
  208. package/dist/commands/resources/command-helpers.d.ts +0 -5
  209. package/dist/commands/resources/command-helpers.d.ts.map +0 -1
  210. package/dist/commands/resources/command-helpers.js +0 -6
  211. package/dist/commands/resources/command-helpers.js.map +0 -1
@@ -2,9 +2,12 @@
2
2
  * Utilities for loading and crawling resources
3
3
  */
4
4
  import { existsSync, statSync } from 'node:fs';
5
- import { DEFAULT_RESOURCE_INCLUDE, ResourceRegistry, } from '@vibe-agent-toolkit/resources';
6
- import { GitTracker, safePath, toForwardSlash } from '@vibe-agent-toolkit/utils';
5
+ import { buildResourcePopulation, DEFAULT_RESOURCE_INCLUDE, gitExtentSelected, ResourceRegistry, } from '@vibe-agent-toolkit/resources';
6
+ import { safePath, toForwardSlash } from '@vibe-agent-toolkit/utils';
7
+ import { GitTracker, gitTreeSnapshot } from '@vibe-agent-toolkit/utils/git';
7
8
  import { loadConfig } from './config-loader.js';
9
+ import { collectionsOption } from './population-wiring.js';
10
+ import { withPopulationCache } from './projection-store.js';
8
11
  /**
9
12
  * Scope resource include patterns to a subdirectory of the crawl base.
10
13
  *
@@ -56,6 +59,177 @@ function crawlOptionsForPath(pathArg, projectRoot, config, logger) {
56
59
  ...(config?.resources?.exclude ? { exclude: config.resources.exclude } : {}),
57
60
  };
58
61
  }
62
+ /**
63
+ * The env var that selects the crawler behind every resources-crawling verb —
64
+ * `vat resources scan`/`validate`, `vat rag index`, the pipeline oracles, and
65
+ * (via {@link withResourcePopulationSource}) the packaging verbs
66
+ * `vat skills build`/`validate` and `vat claude plugin build`, which is what
67
+ * puts `vat build` on the lane at all.
68
+ *
69
+ * An environment switch rather than a config field, for the same reason
70
+ * `VAT_INVENTORY_CRAWL` is one: it selects which INSTRUMENT runs, not what
71
+ * the project means, and it has to be reachable from the lab, which spawns the
72
+ * binary and controls its environment. A config field would put the A and B arms
73
+ * inside the subject's own tree, where a measurement edits the thing it measures.
74
+ */
75
+ export const RESOURCES_CRAWL_ENV = 'VAT_RESOURCES_CRAWL';
76
+ /** {@link RESOURCES_CRAWL_ENV}'s value that selects the projection lane. */
77
+ export const RESOURCES_CRAWL_PROJECTION = 'projection';
78
+ /**
79
+ * {@link RESOURCES_CRAWL_ENV}'s value that opts BACK to the incumbent walk.
80
+ *
81
+ * The projection lane is the default now, so this is the escape hatch rather
82
+ * than the selector. Any other value — including the historical `projection` —
83
+ * leaves the projection lane selected, so existing scripts and lab arms that
84
+ * name it explicitly keep working and keep MEANING the same thing.
85
+ */
86
+ export const RESOURCES_CRAWL_WALK = 'walk';
87
+ /**
88
+ * Whether this process should source the resources population from a projection.
89
+ *
90
+ * **Defaults to the projection lane.** Both lanes now enumerate
91
+ * `tracked ∪ (untracked ∧ ¬ignored)` — `ResourceRegistry.crawl` passes
92
+ * `includeUntracked: true` per `docs/architecture/resource-scanning-and-caching.md`
93
+ * §2.1 — so the population question they answer is the same one.
94
+ *
95
+ * ⚠️⚠️ **ONE DISAGREEMENT SURVIVES, AND IT DROPS FINDINGS: SYMLINKS.** The
96
+ * `filesystem` extent crawls with `followSymlinks: false` and records no link's
97
+ * own path, and `GitCrawlSource` skips mode `120000` deliberately to match it —
98
+ * so BOTH projection extents omit a committed symlink that the incumbent walk
99
+ * includes. For an out-of-tree target those bytes have no other path into the
100
+ * population, which means **a broken symlink the walk reports as
101
+ * `LINK_BROKEN_FILE` is not reported on this lane.** That is a real loss, it is
102
+ * known, and it is the cost this default was accepted at; closing it is its own
103
+ * change (teaching an extent to admit `120000` entries as their own paths).
104
+ * {@link RESOURCES_CRAWL_WALK} is the one-value escape hatch meanwhile.
105
+ *
106
+ * Read from the environment at each call rather than memoized at module load:
107
+ * `vitest.setup.js` deletes every `VAT_*` variable before any test module loads,
108
+ * so a module-level binding would make the switch unobservable to every test
109
+ * that sets it.
110
+ *
111
+ * @returns `true` when the projection lane is selected
112
+ */
113
+ export function resourcesProjectionCrawlSelected() {
114
+ return process.env[RESOURCES_CRAWL_ENV] !== RESOURCES_CRAWL_WALK;
115
+ }
116
+ /**
117
+ * The projection-backed enumeration for this run, or `undefined` to keep the
118
+ * incumbent `crawlDirectory` walk.
119
+ *
120
+ * Gated on the selector alone — and NOT additionally on a discoverable project
121
+ * root, which is where this differs from `vat inventory`'s
122
+ * `populationProviderFor`. That gate exists there because inventory membership
123
+ * is resolved per skill against a root the extractor derives itself, so a
124
+ * population rooted anywhere else answers a different question.
125
+ *
126
+ * The root the caller resolved is carried ON the source rather than merely used
127
+ * to build it, which is what lets `ResourceRegistry.populationFrom` decline a
128
+ * crawl of some OTHER tree instead of answering it with this tree's ignore
129
+ * oracle. This function used to argue that no second root existed to disagree
130
+ * with; it does — `crawlOptionsForPath` re-bases `baseDir` onto a path argument
131
+ * that lies outside the project root, and the packaging validator's
132
+ * `findProjectRoot(...) ?? dirname(skillPath)` can land on a build output
133
+ * directory. Both are now declined rather than served.
134
+ *
135
+ * The tracker is threaded through because its absence is not cosmetic: with no
136
+ * tracker every realization row reads `gitignored: false`, and the population
137
+ * would admit the ignored half of a git tree rather than decline it. See
138
+ * `buildResourcePopulation`.
139
+ *
140
+ * @param root - The root this source may answer for, and no other
141
+ * @param gitTracker - The run's ignore oracle
142
+ * @param observeExtentSource - Called with the enumerator that actually ran,
143
+ * once per enumerated root. The value cannot be recovered afterwards by
144
+ * re-reading the environment — see {@link ResourceLoadResult.extentSource}.
145
+ * 🪤 On a cache hit NO enumerator runs and this still reports the one this
146
+ * process selected, because the source is chosen before the store is asked
147
+ * @param cache - The run's projection store, or `undefined` to enumerate every
148
+ * time. A SEPARATE selector from {@link RESOURCES_CRAWL_ENV}: which lane
149
+ * enumerates and whether its answer is cached are independent choices, and a
150
+ * cache folded into the lane switch could never be measured against it
151
+ * @returns A population source, or `undefined` to use the walk
152
+ */
153
+ function populationSourceFor(root, gitTracker, observeExtentSource, cache) {
154
+ if (!resourcesProjectionCrawlSelected()) {
155
+ return undefined;
156
+ }
157
+ return {
158
+ root: safePath.resolve(root),
159
+ enumerate: async (enumeratedRoot) => {
160
+ const population = await buildResourcePopulation({
161
+ root: enumeratedRoot,
162
+ gitTracker,
163
+ ...(cache !== undefined && { cache }),
164
+ // `enumeratedRoot` and this source's own `root` are the SAME directory,
165
+ // always: `populationFrom` compares them and declines outright when they
166
+ // differ, so `enumerate` is never called for another tree. Reading the
167
+ // declarations off the root being enumerated is therefore not a guard
168
+ // against a second root — it is how the declaration and the enumeration
169
+ // are kept demonstrably on one tree at the point of use, with no second
170
+ // variable to fall out of step with the one that was checked.
171
+ ...collectionsOption(enumeratedRoot),
172
+ });
173
+ observeExtentSource(population.extentSource);
174
+ return population.paths;
175
+ },
176
+ };
177
+ }
178
+ /**
179
+ * Run one command's work with the projection-backed population source it
180
+ * selected, and the store that answers it open for the whole call.
181
+ *
182
+ * The lane-selection seam for every command that builds its OWN registry rather
183
+ * than going through {@link loadResourcesWithConfig} — `vat skills build` and
184
+ * `vat claude plugin build` (via `createProjectRegistry`) and
185
+ * `vat skills validate` (via its shared-context registry). Those three are what
186
+ * put `vat build` on the projection lane at all: before this, that verb reached
187
+ * a projection store on NO phase.
188
+ *
189
+ * Same selector, same store, same ignore oracle as the resource loader —
190
+ * deliberately, and not merely for tidiness. A second way to decide the lane is
191
+ * a second thing to keep in step, and a packaging lane that answered the
192
+ * selector differently from the validation lane would make a whole-run A/B
193
+ * uninterpretable: half the phases on one population, half on the other, and
194
+ * nothing in the output saying so.
195
+ *
196
+ * ⚠️ The tracker is **not optional dressing**. With no `GitTracker` every
197
+ * realization row reads `gitignored: false`, so the population would admit the
198
+ * ignored half of a git tree — generated markdown, caches, vendored corpora —
199
+ * and the packaging run would start bundling and validating files the project
200
+ * told git to forget. One is built here when the caller has none, rooted at the
201
+ * same root the population is enumerated from.
202
+ *
203
+ * @param options - Where the corpus is, and what to reuse
204
+ * @param options.root - The absolute corpus root, which is also the basis every
205
+ * enumerated path is returned against
206
+ * @param options.gitTracker - An already-initialized tracker to reuse. Omit to
207
+ * have one built, which costs a `git ls-files` spawn — and only when the lane
208
+ * is actually selected
209
+ * @param options.observeExtentSource - Called with the enumerator that ran, once
210
+ * per enumerated root. 🪤 NOT a cache-hit marker: on a hit no enumerator runs
211
+ * and this still reports the one this process selected
212
+ * @param work - Given the source, or `undefined` when the walk stays selected
213
+ * @returns Whatever `work` returned
214
+ */
215
+ export async function withResourcePopulationSource(options, work) {
216
+ // Checked before anything is built or opened: an unselected lane must cost
217
+ // nothing, or every command pays a tracker and a store to decline them.
218
+ if (!resourcesProjectionCrawlSelected()) {
219
+ return work(undefined);
220
+ }
221
+ const gitTracker = options.gitTracker ?? new GitTracker(options.root);
222
+ return withPopulationCache({ root: options.root }, async (cache) => {
223
+ // Initialized inside the bracket for the reason `loadResourcesWithConfig`
224
+ // gives at its own call: the store has already taken the snapshot that
225
+ // answers this tracker's question, so asking git again is a spawn spent
226
+ // rebuilding a set the process is holding.
227
+ if (options.gitTracker === undefined) {
228
+ await gitTracker.initialize();
229
+ }
230
+ return work(populationSourceFor(options.root, gitTracker, options.observeExtentSource ?? (() => undefined), cache));
231
+ });
232
+ }
59
233
  /**
60
234
  * Fail loudly on a path argument that cannot be crawled.
61
235
  *
@@ -108,11 +282,10 @@ export async function loadResourcesWithConfig(pathArg, projectRoot, logger) {
108
282
  if (config) {
109
283
  logger.debug(`Loaded config from ${projectRoot}`);
110
284
  }
111
- // Create and initialize GitTracker anchored at the resolved projectRoot.
285
+ // Built here, but deliberately NOT initialized here — see the call inside the
286
+ // population-cache bracket below. The registry only reads the tracker during
287
+ // `crawl`, which happens inside that bracket, so nothing observes it empty.
112
288
  const gitTracker = new GitTracker(projectRoot);
113
- await gitTracker.initialize();
114
- const stats = gitTracker.getStats();
115
- logger.debug(`GitTracker initialized with ${stats.cacheSize} tracked files`);
116
289
  // Create registry and crawl
117
290
  // Build options conditionally to satisfy exactOptionalPropertyTypes
118
291
  const registryOptions = {
@@ -142,13 +315,67 @@ export async function loadResourcesWithConfig(pathArg, projectRoot, logger) {
142
315
  ...(config?.resources?.exclude ? { exclude: config.resources.exclude } : {}),
143
316
  };
144
317
  }
145
- await registry.crawl(crawlOptions);
318
+ // Which lane enumerates. Applied to the options both branches above produced,
319
+ // so the path-argument case and the whole-root case cannot end up on different
320
+ // crawlers — the bug shape this file already carries one fix for.
321
+ let extentSource = null;
322
+ // The store brackets the crawl and is closed however the crawl ends. Nothing
323
+ // outside this bracket can reach it: the population source is called from
324
+ // inside `registry.crawl` and nowhere else.
325
+ const lane = await withPopulationCache({ root: projectRoot }, async (cache) => {
326
+ // The git enumerator takes a `gitTreeSnapshot` during the crawl below no matter
327
+ // what. Taking it HERE instead is the same snapshot moved a few lines earlier —
328
+ // the open bracket memoizes it, so the enumerator's own call becomes a lookup —
329
+ // and it puts the answer in hand before the tracker asks its question.
330
+ //
331
+ // ⚠️ Gated, because ungated this is a LOSS: a snapshot is `git add --all` plus
332
+ // two more spawns, and on the filesystem enumerator or the incumbent walk
333
+ // nothing would ever consume it. Guarded by `gitExtentSelected` rather than a
334
+ // second copy of the condition, so the two cannot drift.
335
+ //
336
+ // ⚠️⚠️ BOTH HALVES, and the second one is not redundant. `gitExtentSelected`
337
+ // answers "which ENUMERATOR would the projection lane use", which stopped
338
+ // implying "the projection lane is running" the moment git became the extent
339
+ // default: under `VAT_RESOURCES_CRAWL=walk` it still answers true inside any
340
+ // repository, so the walk paid for a snapshot nothing consumed — measured at
341
+ // 7 git spawns on the escape hatch against 2 before the flip. The lane check
342
+ // is the half that went missing when the default moved.
343
+ if (resourcesProjectionCrawlSelected() && gitExtentSelected(projectRoot)) {
344
+ gitTreeSnapshot({ cwd: projectRoot });
345
+ }
346
+ // Now inside the bracket, and after the snapshot above. The set a snapshot
347
+ // describes — `tracked ∪ (untracked ∧ ¬ignored)` — is exactly the set this
348
+ // would otherwise spawn `git ls-files --cached --others --exclude-standard` to
349
+ // rebuild, so on the git lane it reads the answer instead of re-asking. Where
350
+ // no snapshot was taken the peek misses and it spawns exactly as before.
351
+ await gitTracker.initialize();
352
+ logger.debug(`GitTracker initialized with ${gitTracker.getStats().cacheSize} tracked files`);
353
+ const populationSource = populationSourceFor(projectRoot, gitTracker, (kind) => {
354
+ extentSource = kind;
355
+ }, cache);
356
+ const selected = populationSource ? 'projection' : 'walk';
357
+ if (populationSource) {
358
+ logger.debug(`Enumerating via the projection lane (${RESOURCES_CRAWL_ENV}=${RESOURCES_CRAWL_PROJECTION})`);
359
+ crawlOptions = { ...crawlOptions, populationSource };
360
+ }
361
+ else {
362
+ // Said for the same reason the projection branch says it, and the symmetry
363
+ // is the point: a marker that only one lane emits makes the other lane
364
+ // identifiable by ABSENCE, which is indistinguishable from a build too old
365
+ // to have either lane.
366
+ logger.debug(`Enumerating via the incumbent walk (${RESOURCES_CRAWL_ENV} unset)`);
367
+ }
368
+ await registry.crawl(crawlOptions);
369
+ return selected;
370
+ });
146
371
  return {
147
372
  scanPath: pathArg ?? projectRoot,
148
373
  projectRoot,
149
374
  config,
150
375
  registry,
151
376
  gitTracker,
377
+ lane,
378
+ extentSource,
152
379
  };
153
380
  }
154
381
  //# sourceMappingURL=resource-loader.js.map
@@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* options).
14
14
  */
15
- import { type ValidationIssue } from '@vibe-agent-toolkit/agent-schema';
16
15
  import { type Observation, type PackagingValidationResult } from '@vibe-agent-toolkit/agent-skills';
17
16
  import { type Target, type Verdict } from '@vibe-agent-toolkit/claude-marketplace';
17
+ import { type ValidationIssue } from '@vibe-agent-toolkit/schema';
18
18
  /**
19
19
  * Convert a verdict into a ValidationIssue using CODE_REGISTRY for severity,
20
20
  * fix and reference. Pure function — no I/O.
@@ -1 +1 @@
1
- {"version":3,"file":"verdict-helpers.d.ts","sourceRoot":"","sources":["../../src/utils/verdict-helpers.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAiB,KAAK,eAAe,EAAE,MAAM,kCAAkC,CAAC;AACvF,OAAO,EACL,KAAK,WAAW,EAChB,KAAK,yBAAyB,EAC/B,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EAGL,KAAK,MAAM,EACX,KAAK,OAAO,EACb,MAAM,wCAAwC,CAAC;AAGhD;;;GAGG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,GAAG,eAAe,CAUlF;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,qBAAqB,CACnC,YAAY,EAAE,SAAS,WAAW,EAAE,EACpC,aAAa,EAAE,aAAa,CAAC,MAAM,CAAC,GAAG,SAAS,EAChD,eAAe,EAAE,MAAM,EACvB,YAAY,EAAE,MAAM,GACnB,eAAe,EAAE,CAkBnB;AAED;;;;;;;;GAQG;AACH,wBAAgB,mBAAmB,CACjC,MAAM,EAAE,yBAAyB,EACjC,aAAa,EAAE,aAAa,CAAC,MAAM,CAAC,GAAG,SAAS,EAChD,eAAe,EAAE,MAAM,EACvB,YAAY,EAAE,MAAM,GACnB,IAAI,CAcN"}
1
+ {"version":3,"file":"verdict-helpers.d.ts","sourceRoot":"","sources":["../../src/utils/verdict-helpers.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EACL,KAAK,WAAW,EAChB,KAAK,yBAAyB,EAC/B,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EAGL,KAAK,MAAM,EACX,KAAK,OAAO,EACb,MAAM,wCAAwC,CAAC;AAChD,OAAO,EAAiB,KAAK,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAGjF;;;GAGG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,GAAG,eAAe,CAUlF;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,qBAAqB,CACnC,YAAY,EAAE,SAAS,WAAW,EAAE,EACpC,aAAa,EAAE,aAAa,CAAC,MAAM,CAAC,GAAG,SAAS,EAChD,eAAe,EAAE,MAAM,EACvB,YAAY,EAAE,MAAM,GACnB,eAAe,EAAE,CAkBnB;AAED;;;;;;;;GAQG;AACH,wBAAgB,mBAAmB,CACjC,MAAM,EAAE,yBAAyB,EACjC,aAAa,EAAE,aAAa,CAAC,MAAM,CAAC,GAAG,SAAS,EAChD,eAAe,EAAE,MAAM,EACvB,YAAY,EAAE,MAAM,GACnB,IAAI,CAcN"}
@@ -12,8 +12,8 @@
12
12
  * nor in marketplace (which knows nothing about config-level packaging
13
13
  * options).
14
14
  */
15
- import { CODE_REGISTRY } from '@vibe-agent-toolkit/agent-schema';
16
15
  import { computeVerdicts, resolveEffectiveTargets, } from '@vibe-agent-toolkit/claude-marketplace';
16
+ import { CODE_REGISTRY } from '@vibe-agent-toolkit/schema';
17
17
  import { issueLocation } from '@vibe-agent-toolkit/utils';
18
18
  /**
19
19
  * Convert a verdict into a ValidationIssue using CODE_REGISTRY for severity,
@@ -1 +1 @@
1
- {"version":3,"file":"verdict-helpers.js","sourceRoot":"","sources":["../../src/utils/verdict-helpers.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,aAAa,EAAwB,MAAM,kCAAkC,CAAC;AAKvF,OAAO,EACL,eAAe,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@vibe-agent-toolkit/agent-schema` for complete schema reference.
73
+ See `@vibe-agent-toolkit/schema` for complete schema reference.
74
74
 
75
75
  ## Examples
76
76
 
@@ -120,6 +120,6 @@ for terminology.
120
120
 
121
121
  ## See Also
122
122
 
123
- - [@vibe-agent-toolkit/agent-schema](../../agent-schema/README.md) - Schema reference
123
+ - [@vibe-agent-toolkit/schema](../../schema/README.md) - Schema reference
124
124
  - [agent-generator](../../vat-development-agents/agents/agent-generator/README.md) - Example agent
125
125
  - [RAG Commands](./rag.md) - Indexing documentation for RAG tools
package/docs/mcp.md CHANGED
@@ -152,8 +152,8 @@ MCP agent packages must export collections via the `/mcp-collections` entrypoint
152
152
  ### Example: `src/mcp-collections.ts`
153
153
 
154
154
  ```typescript
155
- import type { Agent, OneShotAgentOutput } from '@vibe-agent-toolkit/agent-schema';
156
- import { createSuccess } from '@vibe-agent-toolkit/agent-schema';
155
+ import type { Agent, OneShotAgentOutput } from '@vibe-agent-toolkit/schema';
156
+ import { createSuccess } from '@vibe-agent-toolkit/schema';
157
157
 
158
158
  export interface MCPAgentRegistration {
159
159
  name: string;
package/docs/resources.md CHANGED
@@ -31,16 +31,23 @@ including link integrity checking and anchor validation.
31
31
  - `--debug` - Enable debug logging
32
32
  - `--verbose` - Add a `files:` list with per-file link/anchor counts and checksums
33
33
  - `--collection <id>` - Only report files in the named collection (config mode — no path argument)
34
+ - `--format <format>` - `yaml` (default) or `json`. The same document either way
34
35
 
35
36
  **Exit Codes:**
36
37
  - `0` - Always (scan is informational)
37
38
  - `2` - System error (file access, parsing error)
38
39
 
39
- **Output:** YAML on stdout, logs on stderr
40
+ **Output:** YAML on stdout (JSON with `--format json`), logs on stderr
40
41
 
41
42
  `root` is stated once and is the only absolute path in the document; every
42
43
  `path` beneath it is relative to it.
43
44
 
45
+ `lane` names which enumerator produced the population — `walk` (the default
46
+ crawl) or `projection` (`VAT_RESOURCES_CRAWL=projection`). Two scans of one tree
47
+ that report different populations are only interpretable if each says which lane
48
+ produced it, so the field is derived from the load that ran rather than read back
49
+ from the environment.
50
+
44
51
  **Example:**
45
52
  ```bash
46
53
  # Recursively scan all *.md files under docs/
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vibe-agent-toolkit/cli",
3
- "version": "0.2.0-rc.2",
3
+ "version": "0.2.0-rc.4",
4
4
  "description": "Command-line interface for vibe-agent-toolkit",
5
5
  "type": "module",
6
6
  "bin": {
@@ -46,16 +46,14 @@
46
46
  "//dependencies-note": "DO NOT add example agent packages or adopter packages here. Adopter packages (like vat-development-agents) depend on the CLI binary at build time — declaring them as deps creates a circular build dependency. They are built in a second turbo pass via package#task overrides in turbo.json.",
47
47
  "dependencies": {
48
48
  "@anthropic-ai/sdk": "^0.71.2",
49
- "@vibe-agent-toolkit/agent-config": "0.2.0-rc.2",
50
- "@vibe-agent-toolkit/agent-schema": "0.2.0-rc.2",
51
- "@vibe-agent-toolkit/agent-skills": "0.2.0-rc.2",
52
- "@vibe-agent-toolkit/claude-marketplace": "0.2.0-rc.2",
53
- "@vibe-agent-toolkit/discovery": "0.2.0-rc.2",
54
- "@vibe-agent-toolkit/gateway-mcp": "0.2.0-rc.2",
55
- "@vibe-agent-toolkit/rag": "0.2.0-rc.2",
56
- "@vibe-agent-toolkit/rag-lancedb": "0.2.0-rc.2",
57
- "@vibe-agent-toolkit/resources": "0.2.0-rc.2",
58
- "@vibe-agent-toolkit/utils": "0.2.0-rc.2",
49
+ "@vibe-agent-toolkit/agent-config": "0.2.0-rc.4",
50
+ "@vibe-agent-toolkit/schema": "0.2.0-rc.4",
51
+ "@vibe-agent-toolkit/agent-skills": "0.2.0-rc.4",
52
+ "@vibe-agent-toolkit/claude-marketplace": "0.2.0-rc.4",
53
+ "@vibe-agent-toolkit/discovery": "0.2.0-rc.4",
54
+ "@vibe-agent-toolkit/gateway-mcp": "0.2.0-rc.4",
55
+ "@vibe-agent-toolkit/resources": "0.2.0-rc.4",
56
+ "@vibe-agent-toolkit/utils": "0.2.0-rc.4",
59
57
  "adm-zip": "^0.6.0",
60
58
  "commander": "^12.1.0",
61
59
  "picomatch": "^4.0.3",
@@ -70,7 +68,7 @@
70
68
  "@types/picomatch": "^4.0.2",
71
69
  "@types/semver": "^7.7.1",
72
70
  "@types/tar": "^6.1.13",
73
- "@vibe-agent-toolkit/dev-tools": "0.2.0-rc.2",
71
+ "@vibe-agent-toolkit/dev-tools": "0.2.0-rc.4",
74
72
  "rimraf": "^6.0.1",
75
73
  "typescript": "^5.7.3",
76
74
  "vitest": "^3.2.4"
@@ -81,5 +79,10 @@
81
79
  "repository": {
82
80
  "type": "git",
83
81
  "url": "https://github.com/jdutton/vibe-agent-toolkit.git"
82
+ },
83
+ "optionalDependencies": {
84
+ "@vibe-agent-toolkit/projection-sqlite": "0.2.0-rc.4",
85
+ "@vibe-agent-toolkit/rag": "0.2.0-rc.4",
86
+ "@vibe-agent-toolkit/rag-lancedb": "0.2.0-rc.4"
84
87
  }
85
88
  }
@@ -1,5 +0,0 @@
1
- /**
2
- * Shared helper functions for resources commands
3
- */
4
- export { handleCommandError } from '../../utils/command-error.js';
5
- //# sourceMappingURL=command-helpers.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"command-helpers.d.ts","sourceRoot":"","sources":["../../../src/commands/resources/command-helpers.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC"}
@@ -1,6 +0,0 @@
1
- /**
2
- * Shared helper functions for resources commands
3
- */
4
- // Re-export shared utilities for convenience
5
- export { handleCommandError } from '../../utils/command-error.js';
6
- //# sourceMappingURL=command-helpers.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"command-helpers.js","sourceRoot":"","sources":["../../../src/commands/resources/command-helpers.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,6CAA6C;AAC7C,OAAO,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC"}