@vibe-agent-toolkit/utils 0.2.0-rc.1 → 0.2.0-rc.10

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 (270) hide show
  1. package/README.md +69 -23
  2. package/dist/asset-reference.js +3 -11
  3. package/dist/asset-reference.js.map +1 -1
  4. package/dist/compare-code-units.d.ts +28 -0
  5. package/dist/compare-code-units.d.ts.map +1 -0
  6. package/dist/compare-code-units.js +33 -0
  7. package/dist/compare-code-units.js.map +1 -0
  8. package/dist/crawl-timing.d.ts +657 -0
  9. package/dist/crawl-timing.d.ts.map +1 -0
  10. package/dist/crawl-timing.js +765 -0
  11. package/dist/crawl-timing.js.map +1 -0
  12. package/dist/crawl.d.ts +2 -4
  13. package/dist/crawl.d.ts.map +1 -1
  14. package/dist/crawl.js +2 -4
  15. package/dist/crawl.js.map +1 -1
  16. package/dist/dirent-kind.d.ts +83 -0
  17. package/dist/dirent-kind.d.ts.map +1 -0
  18. package/dist/dirent-kind.js +129 -0
  19. package/dist/dirent-kind.js.map +1 -0
  20. package/dist/entrypoint.d.ts +54 -0
  21. package/dist/entrypoint.d.ts.map +1 -0
  22. package/dist/entrypoint.js +71 -0
  23. package/dist/entrypoint.js.map +1 -0
  24. package/dist/env-flag.d.ts +51 -0
  25. package/dist/env-flag.d.ts.map +1 -0
  26. package/dist/env-flag.js +62 -0
  27. package/dist/env-flag.js.map +1 -0
  28. package/dist/errors/errno.d.ts +51 -0
  29. package/dist/errors/errno.d.ts.map +1 -0
  30. package/dist/errors/errno.js +112 -0
  31. package/dist/errors/errno.js.map +1 -0
  32. package/dist/errors/vat-error.d.ts +60 -0
  33. package/dist/errors/vat-error.d.ts.map +1 -0
  34. package/dist/errors/vat-error.js +86 -0
  35. package/dist/errors/vat-error.js.map +1 -0
  36. package/dist/file-crawler.d.ts +60 -0
  37. package/dist/file-crawler.d.ts.map +1 -1
  38. package/dist/file-crawler.js +133 -29
  39. package/dist/file-crawler.js.map +1 -1
  40. package/dist/fs/file-hash.d.ts.map +1 -1
  41. package/dist/fs/file-hash.js +0 -1
  42. package/dist/fs/file-hash.js.map +1 -1
  43. package/dist/fs-utils.d.ts +422 -191
  44. package/dist/fs-utils.d.ts.map +1 -1
  45. package/dist/fs-utils.js +534 -204
  46. package/dist/fs-utils.js.map +1 -1
  47. package/dist/fs.d.ts +5 -2
  48. package/dist/fs.d.ts.map +1 -1
  49. package/dist/fs.js +9 -7
  50. package/dist/fs.js.map +1 -1
  51. package/dist/git-run.d.ts +167 -0
  52. package/dist/git-run.d.ts.map +1 -0
  53. package/dist/git-run.js +154 -0
  54. package/dist/git-run.js.map +1 -0
  55. package/dist/git-snapshot.d.ts +199 -0
  56. package/dist/git-snapshot.d.ts.map +1 -0
  57. package/dist/git-snapshot.js +250 -0
  58. package/dist/git-snapshot.js.map +1 -0
  59. package/dist/git-tracker.d.ts +166 -3
  60. package/dist/git-tracker.d.ts.map +1 -1
  61. package/dist/git-tracker.js +250 -22
  62. package/dist/git-tracker.js.map +1 -1
  63. package/dist/git-utils.d.ts +84 -1
  64. package/dist/git-utils.d.ts.map +1 -1
  65. package/dist/git-utils.js +208 -82
  66. package/dist/git-utils.js.map +1 -1
  67. package/dist/git.d.ts +13 -4
  68. package/dist/git.d.ts.map +1 -1
  69. package/dist/git.js +12 -4
  70. package/dist/git.js.map +1 -1
  71. package/dist/gitignore-checker.d.ts.map +1 -1
  72. package/dist/gitignore-checker.js +15 -6
  73. package/dist/gitignore-checker.js.map +1 -1
  74. package/dist/glob/glob-pattern.js +5 -5
  75. package/dist/glob/glob-pattern.js.map +1 -1
  76. package/dist/index.d.ts +32 -20
  77. package/dist/index.d.ts.map +1 -1
  78. package/dist/index.js +95 -50
  79. package/dist/index.js.map +1 -1
  80. package/dist/listing-refusal.d.ts +112 -0
  81. package/dist/listing-refusal.d.ts.map +1 -0
  82. package/dist/listing-refusal.js +105 -0
  83. package/dist/listing-refusal.js.map +1 -0
  84. package/dist/path-containment.d.ts +64 -0
  85. package/dist/path-containment.d.ts.map +1 -0
  86. package/dist/path-containment.js +111 -0
  87. package/dist/path-containment.js.map +1 -0
  88. package/dist/path-core.d.ts +113 -18
  89. package/dist/path-core.d.ts.map +1 -1
  90. package/dist/path-core.js +139 -23
  91. package/dist/path-core.js.map +1 -1
  92. package/dist/path-utils.d.ts.map +1 -1
  93. package/dist/path-utils.js +42 -47
  94. package/dist/path-utils.js.map +1 -1
  95. package/dist/path.d.ts +1 -1
  96. package/dist/path.d.ts.map +1 -1
  97. package/dist/path.js +1 -1
  98. package/dist/path.js.map +1 -1
  99. package/dist/process.d.ts +7 -0
  100. package/dist/process.d.ts.map +1 -1
  101. package/dist/process.js +7 -0
  102. package/dist/process.js.map +1 -1
  103. package/dist/project-utils.d.ts.map +1 -1
  104. package/dist/project-utils.js +15 -9
  105. package/dist/project-utils.js.map +1 -1
  106. package/dist/project.d.ts +7 -5
  107. package/dist/project.d.ts.map +1 -1
  108. package/dist/project.js +7 -5
  109. package/dist/project.js.map +1 -1
  110. package/dist/safe-exec.d.ts +40 -11
  111. package/dist/safe-exec.d.ts.map +1 -1
  112. package/dist/safe-exec.js +111 -25
  113. package/dist/safe-exec.js.map +1 -1
  114. package/dist/skill-targets.d.ts +2 -2
  115. package/dist/skill-targets.js +2 -2
  116. package/dist/skill-test/auth-resolver.d.ts +10 -2
  117. package/dist/skill-test/auth-resolver.d.ts.map +1 -1
  118. package/dist/skill-test/auth-resolver.js +26 -11
  119. package/dist/skill-test/auth-resolver.js.map +1 -1
  120. package/dist/skill-test/index.d.ts +1 -1
  121. package/dist/skill-test/index.d.ts.map +1 -1
  122. package/dist/skill-test/index.js +1 -1
  123. package/dist/skill-test/index.js.map +1 -1
  124. package/dist/skill-test/spawn-claude.d.ts +30 -1
  125. package/dist/skill-test/spawn-claude.d.ts.map +1 -1
  126. package/dist/skill-test/spawn-claude.js +71 -5
  127. package/dist/skill-test/spawn-claude.js.map +1 -1
  128. package/dist/skill-test/transcript.d.ts +41 -2
  129. package/dist/skill-test/transcript.d.ts.map +1 -1
  130. package/dist/skill-test/transcript.js +55 -10
  131. package/dist/skill-test/transcript.js.map +1 -1
  132. package/dist/spawn-hardened.js +0 -1
  133. package/dist/spawn-hardened.js.map +1 -1
  134. package/dist/stdio-blocking.js +13 -14
  135. package/dist/stdio-blocking.js.map +1 -1
  136. package/dist/test-helpers.d.ts +135 -100
  137. package/dist/test-helpers.d.ts.map +1 -1
  138. package/dist/test-helpers.js +224 -146
  139. package/dist/test-helpers.js.map +1 -1
  140. package/dist/testing/executables.d.ts +32 -0
  141. package/dist/testing/executables.d.ts.map +1 -0
  142. package/dist/testing/executables.js +70 -0
  143. package/dist/testing/executables.js.map +1 -0
  144. package/dist/testing/hostile-tree.d.ts +79 -0
  145. package/dist/testing/hostile-tree.d.ts.map +1 -0
  146. package/dist/testing/hostile-tree.js +164 -0
  147. package/dist/testing/hostile-tree.js.map +1 -0
  148. package/dist/testing/platform-gates.d.ts +31 -0
  149. package/dist/testing/platform-gates.d.ts.map +1 -0
  150. package/dist/testing/platform-gates.js +31 -0
  151. package/dist/testing/platform-gates.js.map +1 -0
  152. package/dist/testing/temp-dir.d.ts +255 -0
  153. package/dist/testing/temp-dir.d.ts.map +1 -0
  154. package/dist/testing/temp-dir.js +363 -0
  155. package/dist/testing/temp-dir.js.map +1 -0
  156. package/dist/testing.d.ts +94 -3
  157. package/dist/testing.d.ts.map +1 -1
  158. package/dist/testing.js +119 -3
  159. package/dist/testing.js.map +1 -1
  160. package/dist/text-content.d.ts +197 -0
  161. package/dist/text-content.d.ts.map +1 -0
  162. package/dist/text-content.js +354 -0
  163. package/dist/text-content.js.map +1 -0
  164. package/dist/text-file.d.ts +45 -0
  165. package/dist/text-file.d.ts.map +1 -0
  166. package/dist/text-file.js +51 -0
  167. package/dist/text-file.js.map +1 -0
  168. package/dist/text.d.ts +16 -0
  169. package/dist/text.d.ts.map +1 -0
  170. package/dist/text.js +16 -0
  171. package/dist/text.js.map +1 -0
  172. package/dist/timing-dump.d.ts +136 -0
  173. package/dist/timing-dump.d.ts.map +1 -0
  174. package/dist/timing-dump.js +229 -0
  175. package/dist/timing-dump.js.map +1 -0
  176. package/dist/windows-shell.d.ts +0 -1
  177. package/dist/windows-shell.d.ts.map +1 -1
  178. package/dist/windows-shell.js +0 -1
  179. package/dist/windows-shell.js.map +1 -1
  180. package/dist/zod-introspection.js +2 -2
  181. package/dist/zod-introspection.js.map +1 -1
  182. package/eslint/README.md +223 -49
  183. package/eslint/index.cjs +111 -97
  184. package/eslint/index.d.cts +16 -6
  185. package/eslint/rules/callee-name.cjs +23 -0
  186. package/eslint/rules/commands-import-boundary.cjs +148 -0
  187. package/eslint/rules/dead-import.cjs +1 -1
  188. package/eslint/rules/dirent-type-needs-symlink-check.cjs +282 -0
  189. package/eslint/rules/eslint-rule-factory.cjs +5 -2
  190. package/eslint/rules/exempt-path-matcher.cjs +2 -1
  191. package/eslint/rules/explicit-zod-strictness.cjs +120 -0
  192. package/eslint/rules/no-bare-dynamic-import-path.cjs +5 -1
  193. package/eslint/rules/no-bare-executable-spawn.cjs +70 -0
  194. package/eslint/rules/no-bare-symlink-in-tests.cjs +213 -0
  195. package/eslint/rules/no-blind-catch.cjs +171 -0
  196. package/eslint/rules/no-child-process-execSync.cjs +8 -0
  197. package/eslint/rules/no-decaying-referent.cjs +217 -0
  198. package/eslint/rules/no-dotdot-containment.cjs +160 -0
  199. package/eslint/rules/no-file-url-string-concat.cjs +4 -1
  200. package/eslint/rules/no-fragile-entrypoint-guard.cjs +228 -0
  201. package/eslint/rules/no-fs-mkdirSync.cjs +8 -0
  202. package/eslint/rules/no-fs-promises-cp.cjs +7 -0
  203. package/eslint/rules/no-fs-realpathSync.cjs +8 -0
  204. package/eslint/rules/no-hardcoded-path-split.cjs +29 -18
  205. package/eslint/rules/no-io-in-unit-tier.cjs +129 -0
  206. package/eslint/rules/no-literal-process-exit.cjs +129 -0
  207. package/eslint/rules/no-manual-path-normalize.cjs +136 -107
  208. package/eslint/rules/no-os-tmpdir.cjs +8 -0
  209. package/eslint/rules/no-path-operations-in-comparisons.cjs +7 -2
  210. package/eslint/rules/no-path-sep-in-strings.cjs +7 -2
  211. package/eslint/rules/no-path-startswith.cjs +7 -2
  212. package/eslint/rules/no-process-exit-in-phase.cjs +127 -0
  213. package/eslint/rules/no-raw-node-path.cjs +563 -0
  214. package/eslint/rules/no-raw-text-decode.cjs +305 -0
  215. package/eslint/rules/no-registry-count-pin.cjs +255 -0
  216. package/eslint/rules/no-self-package-import.cjs +168 -0
  217. package/eslint/rules/no-test-scoped-functions.cjs +10 -3
  218. package/eslint/rules/no-unix-shell-commands.cjs +6 -2
  219. package/eslint/rules/no-unsafe-root-join.cjs +23 -2
  220. package/eslint/rules/no-url-pathname-for-fs.cjs +5 -1
  221. package/eslint/rules/no-version-literal.cjs +151 -0
  222. package/eslint/rules/prefer-startswith-over-regex.cjs +9 -0
  223. package/eslint/rules/require-justified-skip.cjs +8 -2
  224. package/eslint/rules/safe-import.cjs +1 -1
  225. package/package.json +16 -16
  226. package/dist/link-auth/build-headers.d.ts +0 -34
  227. package/dist/link-auth/build-headers.d.ts.map +0 -1
  228. package/dist/link-auth/build-headers.js +0 -58
  229. package/dist/link-auth/build-headers.js.map +0 -1
  230. package/dist/link-auth/expand-macro.d.ts +0 -38
  231. package/dist/link-auth/expand-macro.d.ts.map +0 -1
  232. package/dist/link-auth/expand-macro.js +0 -133
  233. package/dist/link-auth/expand-macro.js.map +0 -1
  234. package/dist/link-auth/macros.yaml +0 -50
  235. package/dist/link-auth/resolve-token.d.ts +0 -83
  236. package/dist/link-auth/resolve-token.d.ts.map +0 -1
  237. package/dist/link-auth/resolve-token.js +0 -101
  238. package/dist/link-auth/resolve-token.js.map +0 -1
  239. package/dist/link-auth/resolve.d.ts +0 -102
  240. package/dist/link-auth/resolve.d.ts.map +0 -1
  241. package/dist/link-auth/resolve.js +0 -66
  242. package/dist/link-auth/resolve.js.map +0 -1
  243. package/dist/link-auth/rewrite.d.ts +0 -52
  244. package/dist/link-auth/rewrite.d.ts.map +0 -1
  245. package/dist/link-auth/rewrite.js +0 -102
  246. package/dist/link-auth/rewrite.js.map +0 -1
  247. package/dist/link-auth/select-provider.d.ts +0 -30
  248. package/dist/link-auth/select-provider.d.ts.map +0 -1
  249. package/dist/link-auth/select-provider.js +0 -55
  250. package/dist/link-auth/select-provider.js.map +0 -1
  251. package/dist/link-auth/template.d.ts +0 -40
  252. package/dist/link-auth/template.d.ts.map +0 -1
  253. package/dist/link-auth/template.js +0 -89
  254. package/dist/link-auth/template.js.map +0 -1
  255. package/dist/link-auth/transforms.d.ts +0 -46
  256. package/dist/link-auth/transforms.d.ts.map +0 -1
  257. package/dist/link-auth/transforms.js +0 -52
  258. package/dist/link-auth/transforms.js.map +0 -1
  259. package/dist/template-entry.d.ts +0 -10
  260. package/dist/template-entry.d.ts.map +0 -1
  261. package/dist/template-entry.js +0 -10
  262. package/dist/template-entry.js.map +0 -1
  263. package/dist/template.d.ts +0 -7
  264. package/dist/template.d.ts.map +0 -1
  265. package/dist/template.js +0 -18
  266. package/dist/template.js.map +0 -1
  267. package/eslint/rules/no-path-join.cjs +0 -14
  268. package/eslint/rules/no-path-relative.cjs +0 -14
  269. package/eslint/rules/no-path-resolve.cjs +0 -14
  270. package/eslint/rules/path-function-rule-factory.cjs +0 -496
@@ -1 +1 @@
1
- {"version":3,"file":"fs-utils.js","sourceRoot":"","sources":["../src/fs-utils.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,gFAAgF;AAChF,6EAA6E;AAC7E,2EAA2E;AAC3E,0EAA0E;AAC1E,gFAAgF;AAChF,8EAA8E;AAC9E,4EAA4E;AAC5E,iFAAiF;AACjF,sCAAsC;AACtC,OAAO,MAAM,MAAM,SAAS,CAAC;AAC7B,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAClC,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAE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,MAAM,uBAAuB,QAAQ,MAAM;YAClE,kDAAkD,CACrD,CAAC;IACJ,CAAC;IACD,OAAO,QAAQ,CAAC;AAClB,CAAC;AAcD;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,CAAC,KAAK,UAAU,aAAa,CACjC,KAAuB,EACvB,OAAsB;IAEtB,MAAM,aAAa,GAAG,IAAI,GAAG,CAAC,KAAK,CAAC,CAAC;IAErC,MAAM,KAAK,GAAG,IAAI,GAAG,EAAkB,CAAC;IACxC,MAAM,OAAO,CAAC,GAAG,CACf,CAAC,GAAG,aAAa,CAAC,CAAC,GAAG,CAAC,KAAK,EAAE,QAAQ,EAAE,EAAE;QACxC,KAAK,CAAC,GAAG,CAAC,QAAQ,EAAE,MAAM,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC;IACxD,CAAC,CAAC,CACH,CAAC;IAEF,OAAO,KAAK,CAAC;AACf,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,MAAM,UAAU,YAAY,CAAC,KAAoB,EAAE,QAAgB;IACjE,2EAA2E;IAC3E,sEAAsE;IACtE,6EAA6E;IAC7E,aAAa;IACb,MAAM,QAAQ,GAAG,KAAK,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;IACrC,IAAI,QAAQ,KAAK,SAAS,EAAE,CAAC;QAC3B,MAAM,IAAI,KAAK,CACb,0BAA0B,QAAQ,iDAAiD,CACpF,CAAC;IACJ,CAAC;IAED,OAAO,QAAQ,CAAC;AAClB,CAAC"}
package/dist/fs.d.ts CHANGED
@@ -8,6 +8,9 @@
8
8
  * `@vibe-agent-toolkit/utils/path` instead — it is dramatically cheaper.
9
9
  */
10
10
  export { normalizePath, normalizedTmpdir, mkdirSyncReal, resolveFromImportMeta, dynamicImportPath, } from './path-utils.js';
11
- export { classifyFilenameCaseFrom, copyDirectory, fillRealpaths, fillSiblingNames, FsLookupCache, realpathFrom, } from './fs-utils.js';
12
- export type { FilenameCaseVerdict, FilenameMatch, PathProbe, PathProbeStats, RealpathTable, SiblingNamesTable, } from './fs-utils.js';
11
+ export { readTextContent, readTextContentSync } from './text-file.js';
12
+ export type { DecodedText, EncodingSource, TextEncoding, TextProvenance } from './text-content.js';
13
+ export { isFilesystemAccessError, isPathAbsentError } from './errors/errno.js';
14
+ export { copyDirectory, DirectorySpellingIndex, fillPathSpellings, fillRealpaths, FsLookupCache, pathSpellingFrom, realpathFrom, spellingWalkRoot, } from './fs-utils.js';
15
+ export type { ComponentMatch, FilenameMatch, PathProbe, PathProbeStats, PathSpelling, PathSpellingRequest, PathSpellingTable, RealpathTable, } from './fs-utils.js';
13
16
  //# sourceMappingURL=fs.d.ts.map
package/dist/fs.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"fs.d.ts","sourceRoot":"","sources":["../src/fs.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EACL,aAAa,EACb,gBAAgB,EAChB,aAAa,EACb,qBAAqB,EACrB,iBAAiB,GAClB,MAAM,iBAAiB,CAAC;AAQzB,OAAO,EACL,wBAAwB,EACxB,aAAa,EACb,aAAa,EACb,gBAAgB,EAChB,aAAa,EACb,YAAY,GACb,MAAM,eAAe,CAAC;AACvB,YAAY,EACV,mBAAmB,EACnB,aAAa,EACb,SAAS,EACT,cAAc,EACd,aAAa,EACb,iBAAiB,GAClB,MAAM,eAAe,CAAC"}
1
+ {"version":3,"file":"fs.d.ts","sourceRoot":"","sources":["../src/fs.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EACL,aAAa,EACb,gBAAgB,EAChB,aAAa,EACb,qBAAqB,EACrB,iBAAiB,GAClB,MAAM,iBAAiB,CAAC;AAKzB,OAAO,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AACtE,YAAY,EAAE,WAAW,EAAE,cAAc,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAKnG,OAAO,EAAE,uBAAuB,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAC/E,OAAO,EACL,aAAa,EACb,sBAAsB,EACtB,iBAAiB,EACjB,aAAa,EACb,aAAa,EACb,gBAAgB,EAChB,YAAY,EACZ,gBAAgB,GACjB,MAAM,eAAe,CAAC;AACvB,YAAY,EACV,cAAc,EACd,aAAa,EACb,SAAS,EACT,cAAc,EACd,YAAY,EACZ,mBAAmB,EACnB,iBAAiB,EACjB,aAAa,GACd,MAAM,eAAe,CAAC"}
package/dist/fs.js CHANGED
@@ -8,11 +8,13 @@
8
8
  * `@vibe-agent-toolkit/utils/path` instead — it is dramatically cheaper.
9
9
  */
10
10
  export { normalizePath, normalizedTmpdir, mkdirSyncReal, resolveFromImportMeta, dynamicImportPath, } from './path-utils.js';
11
- // Two materialized columns, each a fill+judge pair and nothing else. For sibling
12
- // names the judge is `classifyFilenameCaseFrom`, and the internal
13
- // `classifyFilenameCase`/`siblingNamesFrom` members plus the `SiblingNames` row
14
- // type they trade in stay module-local — a row there is not yet an answer. For
15
- // realpaths the row IS the answer, so the row lookup `realpathFrom` is itself the
16
- // judge and is exported. See `index.ts` for the full reasoning.
17
- export { classifyFilenameCaseFrom, copyDirectory, fillRealpaths, fillSiblingNames, FsLookupCache, realpathFrom, } from './fs-utils.js';
11
+ // Read a file and decode it through the one content-decoding seam. The DECISION
12
+ // about what the bytes say is pure and lives on `./text`; these two are that
13
+ // plus a `readFile`, which is why they are here and not there.
14
+ export { readTextContent, readTextContentSync } from './text-file.js';
15
+ // Two materialized columns, each a fill+judge pair and nothing else. In both the
16
+ // row IS the answer, so the row lookup — `pathSpellingFrom`, `realpathFrom` — is
17
+ // itself the judge and is exported. See `index.ts` for the full reasoning.
18
+ export { isFilesystemAccessError, isPathAbsentError } from './errors/errno.js';
19
+ export { copyDirectory, DirectorySpellingIndex, fillPathSpellings, fillRealpaths, FsLookupCache, pathSpellingFrom, realpathFrom, spellingWalkRoot, } from './fs-utils.js';
18
20
  //# sourceMappingURL=fs.js.map
package/dist/fs.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"fs.js","sourceRoot":"","sources":["../src/fs.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EACL,aAAa,EACb,gBAAgB,EAChB,aAAa,EACb,qBAAqB,EACrB,iBAAiB,GAClB,MAAM,iBAAiB,CAAC;AAEzB,iFAAiF;AACjF,kEAAkE;AAClE,gFAAgF;AAChF,+EAA+E;AAC/E,kFAAkF;AAClF,gEAAgE;AAChE,OAAO,EACL,wBAAwB,EACxB,aAAa,EACb,aAAa,EACb,gBAAgB,EAChB,aAAa,EACb,YAAY,GACb,MAAM,eAAe,CAAC"}
1
+ {"version":3,"file":"fs.js","sourceRoot":"","sources":["../src/fs.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EACL,aAAa,EACb,gBAAgB,EAChB,aAAa,EACb,qBAAqB,EACrB,iBAAiB,GAClB,MAAM,iBAAiB,CAAC;AAEzB,gFAAgF;AAChF,6EAA6E;AAC7E,+DAA+D;AAC/D,OAAO,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAGtE,iFAAiF;AACjF,iFAAiF;AACjF,2EAA2E;AAC3E,OAAO,EAAE,uBAAuB,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAC/E,OAAO,EACL,aAAa,EACb,sBAAsB,EACtB,iBAAiB,EACjB,aAAa,EACb,aAAa,EACb,gBAAgB,EAChB,YAAY,EACZ,gBAAgB,GACjB,MAAM,eAAe,CAAC"}
@@ -0,0 +1,167 @@
1
+ /**
2
+ * The one way to run `git` — safe by construction, for VAT and for anyone
3
+ * building on `@vibe-agent-toolkit/utils`.
4
+ *
5
+ * ## Why this exists rather than "remember to pass the right options"
6
+ *
7
+ * A `git` child inherits `GIT_DIR`, `GIT_INDEX_FILE`, `GIT_PREFIX` and friends
8
+ * from any ancestor `git` process, and **those override the `cwd` you passed**.
9
+ * The result is not an error — it is a well-formed answer about a different
10
+ * repository, at exit 0. Measured against real pre-commit hooks:
11
+ *
12
+ * - `git status --porcelain` at a caller-supplied path reported the *committing*
13
+ * repository's status, exit 0.
14
+ * - `git init` in a fresh directory silently re-initialized the inherited
15
+ * `GIT_DIR` — no `.git` appeared where it was asked for — and the following
16
+ * `add`/`commit` landed in a **bystander repository**, switching its branch
17
+ * and rewriting its index, while every step reported success.
18
+ * - `git rev-parse --show-toplevel` answered **correctly** throughout, so the
19
+ * obvious "am I in the right repository?" guard cannot detect any of it.
20
+ *
21
+ * The hazard is therefore invisible at every call site, which is exactly the
22
+ * kind of thing that must be handled by the default rather than by discipline.
23
+ *
24
+ * ## The default is the whole design
25
+ *
26
+ * **The environment is scrubbed unless you say `ambient: true`.** Almost every
27
+ * git command in a tool is about a path the caller was *handed* — a project
28
+ * root, a temp staging repo, a clone destination — and for those the inherited
29
+ * environment is always wrong. The rare command that genuinely means "the
30
+ * repository I am standing in" (`git remote get-url` inside the user's own
31
+ * checkout, say) opts out explicitly, and has to name itself when it does.
32
+ *
33
+ * ## What this is, mechanically: a set of defaults over `@vibe-validate/git`
34
+ *
35
+ * The spawn itself, the environment scrub and the treatment of a spawn-level
36
+ * error all live in `executeGitCommand`, which is that package's single
37
+ * chokepoint and is exercised by vibe-validate on every commit it gates. This
38
+ * module supplies only the three defaults VAT needs to differ on, and a result
39
+ * shape that never throws:
40
+ *
41
+ * - **`scrubGitEnv` is on unless `ambient: true`** — the inverse of
42
+ * `executeGitCommand`'s `false`. That default is right for vibe-validate,
43
+ * which mostly operates on the repository it was invoked in; it is wrong here,
44
+ * because VAT and its adopters are handed a root. Consolidating without this
45
+ * wrapper would relocate the opt-in rather than remove the hazard.
46
+ * - **`maxBuffer` is 64 MiB, never Node's 1 MiB** (`executeGitCommand` defaults
47
+ * to 10 MiB). `git ls-files -s -z` emits ~104 bytes per path, so an
48
+ * 8,500-file tree reaches 84% of Node's default and a larger one truncates.
49
+ * - **A spawn-level failure is a failure regardless of exit status**, which
50
+ * `executeGitCommand` now enforces itself; `ok` simply forwards its `success`.
51
+ *
52
+ * ⚠️ **One property was given up in the consolidation:** this used to resolve the
53
+ * binary with `which.sync('git')` and spawn an absolute path. `executeGitCommand`
54
+ * spawns bare `'git'` and lets the OS search `PATH`, so a "git is not on PATH"
55
+ * condition now arrives as an `ENOENT` in `error` rather than as a distinct
56
+ * pre-spawn message. Both are reported through {@link GitRunResult}, so no caller
57
+ * can mistake either for success.
58
+ */
59
+ /** How to run one git command. */
60
+ export interface GitRunOptions {
61
+ /**
62
+ * Directory to run in. Honoured for real, because the inherited environment
63
+ * that would otherwise override it is removed first.
64
+ */
65
+ cwd?: string;
66
+ /**
67
+ * Opt out of the scrub, for a command that genuinely means "the repository I
68
+ * am standing in" rather than a path handed to it.
69
+ *
70
+ * ⚠️ Setting this inside a git hook makes the command operate on whatever the
71
+ * outer `git` was operating on. That is occasionally what you want — and it is
72
+ * never what you want when `cwd` names something specific.
73
+ *
74
+ * @default false
75
+ */
76
+ ambient?: boolean;
77
+ /** Variables applied *after* the scrub, so a deliberate one survives. */
78
+ env?: Record<string, string>;
79
+ /** Milliseconds before the child is killed. @default 60000 */
80
+ timeout?: number;
81
+ /** Bytes of stdout/stderr to capture. @default 67108864 (64 MiB) */
82
+ maxBuffer?: number;
83
+ /** Data written to the child's stdin. */
84
+ input?: string;
85
+ /** Discard the child's stderr instead of capturing it. @default false */
86
+ suppressStderr?: boolean;
87
+ /**
88
+ * Trim surrounding whitespace from `stdout` and `stderr`.
89
+ *
90
+ * **Pass `false` for a NUL-delimited (`-z`) listing.** git sorts by byte value
91
+ * and 0x20 sorts below every printable character, so a path beginning with a
92
+ * space is listed *first* — where the trim reaches it. The caller then holds a
93
+ * path that does not exist, and every lookup against it reads as "not there"
94
+ * rather than as an error. Also pass `false` when the output is file content
95
+ * (`git show HEAD:file`), whose trailing newline is data.
96
+ *
97
+ * `ls-files -s -z` does not need it: the mode occupies position 0.
98
+ *
99
+ * @default true
100
+ */
101
+ trim?: boolean;
102
+ }
103
+ /** What one git command did. */
104
+ export interface GitRunResult {
105
+ /**
106
+ * True only when git actually ran **and** exited 0. A truncated or killed
107
+ * child is never `ok`, whatever its exit status says.
108
+ */
109
+ ok: boolean;
110
+ /**
111
+ * Exit status, or `1` when the process never ran or was killed — the two are
112
+ * not distinguishable here, so branch on {@link GitRunResult.error} rather
113
+ * than on this when you need to tell a real `exit 1` from a failure to spawn.
114
+ */
115
+ status: number;
116
+ /** Decoded stdout, trimmed. */
117
+ stdout: string;
118
+ /** Decoded stderr, trimmed — or the spawn failure's message when there is one. */
119
+ stderr: string;
120
+ /**
121
+ * The spawn-level failure, when git could not run, was killed, or overran
122
+ * `maxBuffer`. Present independently of `status`.
123
+ */
124
+ error?: Error;
125
+ }
126
+ /**
127
+ * Run one `git` command.
128
+ *
129
+ * Never throws: a missing binary, a timeout and a non-zero exit are all reported
130
+ * through {@link GitRunResult} so a caller can tell them apart and choose. Check
131
+ * `ok`, not `status`.
132
+ *
133
+ * @param args - Arguments after the `git` executable, e.g. `['status', '--porcelain']`
134
+ * @param options - See {@link GitRunOptions}; the environment is scrubbed unless
135
+ * `ambient` is set
136
+ * @returns The outcome, including any spawn-level failure
137
+ *
138
+ * @example
139
+ * ```typescript
140
+ * // About a path you were handed — the ordinary case, safe by default.
141
+ * const r = runGit(['status', '--porcelain'], { cwd: projectRoot });
142
+ * if (!r.ok) throw new Error(`git status failed: ${r.stderr}`);
143
+ * ```
144
+ *
145
+ * @example
146
+ * ```typescript
147
+ * // About the repository this process is standing in — opt out explicitly.
148
+ * const url = runGit(['remote', 'get-url', 'origin'], { ambient: true });
149
+ * ```
150
+ */
151
+ export declare function runGit(args: readonly string[], options?: GitRunOptions): GitRunResult;
152
+ /**
153
+ * {@link runGit}, but a failure throws instead of being reported.
154
+ *
155
+ * For callers whose next line has no meaning if the command did not work —
156
+ * setting up a fixture repository, or any step whose failure should stop the
157
+ * run rather than be interpreted. Prefer {@link runGit} wherever a non-zero
158
+ * exit carries information ("no commit yet", "not a repository", "no such
159
+ * remote"), because those are answers rather than faults.
160
+ *
161
+ * @param args - Arguments after the `git` executable
162
+ * @param options - See {@link GitRunOptions}
163
+ * @returns The trimmed stdout
164
+ * @throws {Error} When git could not run, or ran and exited non-zero
165
+ */
166
+ export declare function runGitOrThrow(args: readonly string[], options?: GitRunOptions): string;
167
+ //# sourceMappingURL=git-run.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"git-run.d.ts","sourceRoot":"","sources":["../src/git-run.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyDG;AAcH,kCAAkC;AAClC,MAAM,WAAW,aAAa;IAC5B;;;OAGG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;IAEb;;;;;;;;;OASG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAElB,yEAAyE;IACzE,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAE7B,8DAA8D;IAC9D,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB,oEAAoE;IACpE,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB,yCAAyC;IACzC,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf,yEAAyE;IACzE,cAAc,CAAC,EAAE,OAAO,CAAC;IAEzB;;;;;;;;;;;;;OAaG;IACH,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB;AAED,gCAAgC;AAChC,MAAM,WAAW,YAAY;IAC3B;;;OAGG;IACH,EAAE,EAAE,OAAO,CAAC;IACZ;;;;OAIG;IACH,MAAM,EAAE,MAAM,CAAC;IACf,+BAA+B;IAC/B,MAAM,EAAE,MAAM,CAAC;IACf,kFAAkF;IAClF,MAAM,EAAE,MAAM,CAAC;IACf;;;OAGG;IACH,KAAK,CAAC,EAAE,KAAK,CAAC;CACf;AAED;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAgB,MAAM,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,EAAE,OAAO,GAAE,aAAkB,GAAG,YAAY,CAsCzF;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,EAAE,OAAO,GAAE,aAAkB,GAAG,MAAM,CAS1F"}
@@ -0,0 +1,154 @@
1
+ /**
2
+ * The one way to run `git` — safe by construction, for VAT and for anyone
3
+ * building on `@vibe-agent-toolkit/utils`.
4
+ *
5
+ * ## Why this exists rather than "remember to pass the right options"
6
+ *
7
+ * A `git` child inherits `GIT_DIR`, `GIT_INDEX_FILE`, `GIT_PREFIX` and friends
8
+ * from any ancestor `git` process, and **those override the `cwd` you passed**.
9
+ * The result is not an error — it is a well-formed answer about a different
10
+ * repository, at exit 0. Measured against real pre-commit hooks:
11
+ *
12
+ * - `git status --porcelain` at a caller-supplied path reported the *committing*
13
+ * repository's status, exit 0.
14
+ * - `git init` in a fresh directory silently re-initialized the inherited
15
+ * `GIT_DIR` — no `.git` appeared where it was asked for — and the following
16
+ * `add`/`commit` landed in a **bystander repository**, switching its branch
17
+ * and rewriting its index, while every step reported success.
18
+ * - `git rev-parse --show-toplevel` answered **correctly** throughout, so the
19
+ * obvious "am I in the right repository?" guard cannot detect any of it.
20
+ *
21
+ * The hazard is therefore invisible at every call site, which is exactly the
22
+ * kind of thing that must be handled by the default rather than by discipline.
23
+ *
24
+ * ## The default is the whole design
25
+ *
26
+ * **The environment is scrubbed unless you say `ambient: true`.** Almost every
27
+ * git command in a tool is about a path the caller was *handed* — a project
28
+ * root, a temp staging repo, a clone destination — and for those the inherited
29
+ * environment is always wrong. The rare command that genuinely means "the
30
+ * repository I am standing in" (`git remote get-url` inside the user's own
31
+ * checkout, say) opts out explicitly, and has to name itself when it does.
32
+ *
33
+ * ## What this is, mechanically: a set of defaults over `@vibe-validate/git`
34
+ *
35
+ * The spawn itself, the environment scrub and the treatment of a spawn-level
36
+ * error all live in `executeGitCommand`, which is that package's single
37
+ * chokepoint and is exercised by vibe-validate on every commit it gates. This
38
+ * module supplies only the three defaults VAT needs to differ on, and a result
39
+ * shape that never throws:
40
+ *
41
+ * - **`scrubGitEnv` is on unless `ambient: true`** — the inverse of
42
+ * `executeGitCommand`'s `false`. That default is right for vibe-validate,
43
+ * which mostly operates on the repository it was invoked in; it is wrong here,
44
+ * because VAT and its adopters are handed a root. Consolidating without this
45
+ * wrapper would relocate the opt-in rather than remove the hazard.
46
+ * - **`maxBuffer` is 64 MiB, never Node's 1 MiB** (`executeGitCommand` defaults
47
+ * to 10 MiB). `git ls-files -s -z` emits ~104 bytes per path, so an
48
+ * 8,500-file tree reaches 84% of Node's default and a larger one truncates.
49
+ * - **A spawn-level failure is a failure regardless of exit status**, which
50
+ * `executeGitCommand` now enforces itself; `ok` simply forwards its `success`.
51
+ *
52
+ * ⚠️ **One property was given up in the consolidation:** this used to resolve the
53
+ * binary with `which.sync('git')` and spawn an absolute path. `executeGitCommand`
54
+ * spawns bare `'git'` and lets the OS search `PATH`, so a "git is not on PATH"
55
+ * condition now arrives as an `ENOENT` in `error` rather than as a distinct
56
+ * pre-spawn message. Both are reported through {@link GitRunResult}, so no caller
57
+ * can mistake either for success.
58
+ */
59
+ import { executeGitCommand } from '@vibe-validate/git';
60
+ /**
61
+ * 64 MiB. Chosen against `git ls-files -s -z`, the widest-output command here:
62
+ * ~104 bytes per path means this covers roughly 640,000 paths, while Node's
63
+ * 1 MiB default covers about 10,000 — a ceiling ordinary monorepos reach.
64
+ */
65
+ const DEFAULT_MAX_BUFFER = 64 * 1024 * 1024;
66
+ /** Wall-clock ceiling on one invocation, so a hung remote cannot wedge a build. */
67
+ const DEFAULT_TIMEOUT_MS = 60_000;
68
+ /**
69
+ * Run one `git` command.
70
+ *
71
+ * Never throws: a missing binary, a timeout and a non-zero exit are all reported
72
+ * through {@link GitRunResult} so a caller can tell them apart and choose. Check
73
+ * `ok`, not `status`.
74
+ *
75
+ * @param args - Arguments after the `git` executable, e.g. `['status', '--porcelain']`
76
+ * @param options - See {@link GitRunOptions}; the environment is scrubbed unless
77
+ * `ambient` is set
78
+ * @returns The outcome, including any spawn-level failure
79
+ *
80
+ * @example
81
+ * ```typescript
82
+ * // About a path you were handed — the ordinary case, safe by default.
83
+ * const r = runGit(['status', '--porcelain'], { cwd: projectRoot });
84
+ * if (!r.ok) throw new Error(`git status failed: ${r.stderr}`);
85
+ * ```
86
+ *
87
+ * @example
88
+ * ```typescript
89
+ * // About the repository this process is standing in — opt out explicitly.
90
+ * const url = runGit(['remote', 'get-url', 'origin'], { ambient: true });
91
+ * ```
92
+ */
93
+ export function runGit(args, options = {}) {
94
+ if (args.length === 0) {
95
+ // Handled here rather than by `executeGitCommand`, which THROWS on an empty
96
+ // argv. This function's whole contract is that it never throws.
97
+ return {
98
+ ok: false,
99
+ status: 1,
100
+ stdout: '',
101
+ stderr: 'runGit() needs at least one argument',
102
+ error: new Error('runGit() needs at least one argument'),
103
+ };
104
+ }
105
+ // `ignoreErrors` is what makes this non-throwing, and it is safe to set
106
+ // unconditionally only because `executeGitCommand` now reports `error` on that
107
+ // path too. Before that fix it dropped the spawn cause entirely, and a caller
108
+ // reading the result could not tell "git is not installed" from "exit 1 is the
109
+ // answer" from "your listing was truncated" — which is why this wrapper could
110
+ // not have been written against the previous release.
111
+ const result = executeGitCommand([...args], {
112
+ ...(options.cwd === undefined ? {} : { cwd: options.cwd }),
113
+ ...(options.env === undefined ? {} : { env: options.env }),
114
+ ...(options.input === undefined ? {} : { stdin: options.input }),
115
+ scrubGitEnv: options.ambient !== true,
116
+ suppressStderr: options.suppressStderr ?? false,
117
+ trimOutput: options.trim ?? true,
118
+ ignoreErrors: true,
119
+ timeout: options.timeout ?? DEFAULT_TIMEOUT_MS,
120
+ maxBuffer: options.maxBuffer ?? DEFAULT_MAX_BUFFER,
121
+ });
122
+ return {
123
+ ok: result.success,
124
+ status: result.exitCode,
125
+ stdout: result.stdout,
126
+ stderr: result.stderr,
127
+ ...(result.error === undefined ? {} : { error: result.error }),
128
+ };
129
+ }
130
+ /**
131
+ * {@link runGit}, but a failure throws instead of being reported.
132
+ *
133
+ * For callers whose next line has no meaning if the command did not work —
134
+ * setting up a fixture repository, or any step whose failure should stop the
135
+ * run rather than be interpreted. Prefer {@link runGit} wherever a non-zero
136
+ * exit carries information ("no commit yet", "not a repository", "no such
137
+ * remote"), because those are answers rather than faults.
138
+ *
139
+ * @param args - Arguments after the `git` executable
140
+ * @param options - See {@link GitRunOptions}
141
+ * @returns The trimmed stdout
142
+ * @throws {Error} When git could not run, or ran and exited non-zero
143
+ */
144
+ export function runGitOrThrow(args, options = {}) {
145
+ const result = runGit(args, options);
146
+ if (result.ok)
147
+ return result.stdout;
148
+ // The subcommand only: a commit message can be hundreds of KB, and
149
+ // interpolating the whole argv buries the actual error in CI output.
150
+ const label = args[0] ?? '<no args>';
151
+ const detail = result.stderr || `exit ${String(result.status)}`;
152
+ throw new Error(`git ${label} failed: ${detail}`);
153
+ }
154
+ //# sourceMappingURL=git-run.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"git-run.js","sourceRoot":"","sources":["../src/git-run.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyDG;AAEH,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAEvD;;;;GAIG;AACH,MAAM,kBAAkB,GAAG,EAAE,GAAG,IAAI,GAAG,IAAI,CAAC;AAE5C,mFAAmF;AACnF,MAAM,kBAAkB,GAAG,MAAM,CAAC;AA8ElC;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,MAAM,UAAU,MAAM,CAAC,IAAuB,EAAE,UAAyB,EAAE;IACzE,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACtB,4EAA4E;QAC5E,gEAAgE;QAChE,OAAO;YACL,E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AS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,EAAE,CAAC;KAC/D,CAAC;AACJ,CAAC;AAED;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,aAAa,CAAC,IAAuB,EAAE,UAAyB,EAAE;IAChF,MAAM,MAAM,GAAG,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IACrC,IAAI,MAAM,CAAC,EAAE;QAAE,OAAO,MAAM,CAAC,MAAM,CAAC;IAEpC,mEAAmE;IACnE,qEAAqE;IACrE,MAAM,KAAK,GAAG,IAAI,CAAC,CAAC,CAAC,IAAI,WAAW,CAAC;IACrC,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,IAAI,QAAQ,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC;IAChE,MAAM,IAAI,KAAK,CAAC,OAAO,KAAK,YAAY,MAAM,EAAE,CAAC,CAAC;AACpD,CAAC"}
@@ -0,0 +1,199 @@
1
+ /**
2
+ * A **dirty-corrected git tree snapshot**, rebased onto absolute paths.
3
+ *
4
+ * `@vibe-validate/git`'s `getGitTreeSnapshot` answers the question git is
5
+ * uniquely good at: every path git can see under a directory, each with a blob
6
+ * OID naming *the bytes that are actually on disk right now* — dirty working-tree
7
+ * edits included, not the stale committed-index SHA — plus one deterministic
8
+ * `write-tree` hash over the whole set. Membership is `git add --all` without
9
+ * `--force`, i.e. `tracked ∪ (untracked ∧ ¬ignored)`.
10
+ *
11
+ * This module is the thin layer VAT needs on top, and it exists for one reason
12
+ * that is easy to get wrong: **git spells those paths relative to the repository
13
+ * root, not to the directory you asked about.** A caller scanning
14
+ * `<repo>/packages/foo` gets back `packages/foo/x.md`, and a caller that joined
15
+ * those onto its own root would build `<repo>/packages/foo/packages/foo/x.md` —
16
+ * a path that does not exist, so every consumer reads it as "absent" rather than
17
+ * as a bug. Resolving against the repository root here makes that unrepresentable
18
+ * at the call site.
19
+ *
20
+ * ## ⚠️ This is not a pure read
21
+ *
22
+ * Taking a snapshot runs `git add --all` against a throwaway index, which
23
+ * **writes loose blob objects into the target repository's `.git/objects`** for
24
+ * any content git has not already stored. The real index and working tree are
25
+ * never touched, and the objects are ordinary unreferenced blobs that `git gc`
26
+ * reclaims — but a command that advertises itself as read-only is, at the byte
27
+ * level, not. `vibe-validate` accepts this cost on every commit it gates; a VAT
28
+ * lane that adopts it inherits the same trade rather than a different one.
29
+ *
30
+ * ## ⚠️ A symlink's OID names its TARGET STRING, not a file's bytes
31
+ *
32
+ * Git stores a symlink as a blob whose content is the link target, under mode
33
+ * `120000`. Two links with the same relative target but different resolutions
34
+ * therefore share an OID while a consumer that follows them reads two different
35
+ * documents. {@link GitSnapshotEntry.isSymlink} is computed here precisely so
36
+ * that a consumer keying work off `oid` can exclude them — see
37
+ * `packages/resources/src/content-key.ts`, whose standing rule is that a git SHA
38
+ * may be a *lookup hint whose miss is free* and must never be the key itself.
39
+ *
40
+ * ## ⚠️ Two consumers want the SAME snapshot — see {@link withGitSnapshotCache}
41
+ *
42
+ * One command takes this snapshot twice, of one repository, sequentially, and
43
+ * keeps a different half of each: the projection store keeps `hash` as its
44
+ * cache key, and the git crawl source keeps `entries`. Bracketing the command
45
+ * makes that one snapshot. Everything outside the bracket still pays per call,
46
+ * deliberately.
47
+ */
48
+ /** One path in a {@link GitTreeSnapshot}, located absolutely. */
49
+ export interface GitSnapshotEntry {
50
+ /** Absolute, forward-slashed path, resolved against the repository root. */
51
+ absolutePath: string;
52
+ /**
53
+ * Blob OID for this path's **on-disk** bytes.
54
+ *
55
+ * Equal OIDs mean equal bytes, which is what makes this usable as a lookup
56
+ * hint. It is NOT usable as a content key — see the module docstring.
57
+ */
58
+ oid: string;
59
+ /** Git's six-digit mode, verbatim: `100644`, `100755`, `120000`, `160000`. */
60
+ mode: string;
61
+ /** Mode `120000`. Its {@link GitSnapshotEntry.oid} is the target string. */
62
+ isSymlink: boolean;
63
+ /**
64
+ * Mode `160000` — a submodule.
65
+ *
66
+ * The OID is a **commit**, not a blob, so `cat-file` on it yields no file
67
+ * bytes, and none of the submodule's own files appear anywhere in the
68
+ * snapshot. A consumer that needs them takes a second snapshot rooted there.
69
+ */
70
+ isSubmodule: boolean;
71
+ }
72
+ /** One repository's snapshot. */
73
+ export interface GitTreeSnapshot {
74
+ /**
75
+ * `git write-tree` over the snapshot — a deterministic key for the whole set.
76
+ *
77
+ * Byte-identical content always produces it, because a tree object carries no
78
+ * timestamp. (A `stash create` would not: a stash is a commit, and two calls
79
+ * over identical content agree only within the same wall-clock second.)
80
+ */
81
+ hash: string;
82
+ /** The repository root every entry was resolved against, forward-slashed. */
83
+ repositoryRoot: string;
84
+ /** Every path git can see, in git's own order. */
85
+ entries: GitSnapshotEntry[];
86
+ }
87
+ /**
88
+ * Run work that may snapshot the same repository more than once, and pay for
89
+ * each repository ONCE.
90
+ *
91
+ * ## What this buys, in both currencies
92
+ *
93
+ * A snapshot is not a read — it copies the index, runs `git add --all` into it
94
+ * and then `git write-tree`. One `vat` command took two of them, of the same
95
+ * repository, back to back: `openPopulationCache` needs `hash` to key the
96
+ * projection store, and `GitCrawlSource` needs `entries` to enumerate. Measured
97
+ * on a large monorepo, the pair cost 195.22 ms and 158.55 ms.
98
+ *
99
+ * The cost is the smaller half. Two snapshots taken 195 ms apart are two
100
+ * *different answers* whenever the working tree changes in between, and the
101
+ * command then files the second one's extent under the first one's key — a
102
+ * cache entry whose key does not describe its contents, produced silently and
103
+ * discoverable only as a wrong answer much later. One snapshot removes the race
104
+ * rather than merely the duplicate.
105
+ *
106
+ * ## Where to open it
107
+ *
108
+ * At the level that already brackets the whole command, so that it encloses
109
+ * *every* snapshotting consumer. Opened deeper than one of them, the dedupe
110
+ * silently does nothing and looks exactly like a dedupe that works.
111
+ *
112
+ * ## What it deliberately does NOT do
113
+ *
114
+ * Inside the bracket, a working-tree edit made between two calls is not
115
+ * observed by the second — the first snapshot is the answer for the whole
116
+ * bracket. That is the race being closed, not a limitation to work around. Work
117
+ * that must see edits as they land does not belong inside one bracket.
118
+ *
119
+ * Nesting is safe and inner-most wins: an inner bracket starts an empty memo,
120
+ * and the outer one's entries are restored when it returns.
121
+ *
122
+ * @param run - The work to run with the memo open. Sync or async — the return
123
+ * value is passed straight through, so an async `run` keeps the memo for the
124
+ * whole promise it returns
125
+ * @returns Whatever `run` returned
126
+ *
127
+ * @example
128
+ * ```typescript
129
+ * return withGitSnapshotCache(async () => {
130
+ * const opened = await openPopulationCache(options); // snapshots
131
+ * return work(opened?.cache); // crawls, snapshots
132
+ * });
133
+ * ```
134
+ */
135
+ export declare function withGitSnapshotCache<T>(run: () => T): T;
136
+ /**
137
+ * Snapshot everything git can see under a directory.
138
+ *
139
+ * Inside a {@link withGitSnapshotCache} bracket the answer for a given
140
+ * repository is taken once and reused — including a `null`. Outside one, every
141
+ * call spawns git, which is what it has always done.
142
+ *
143
+ * @param options - Where to look
144
+ * @param options.cwd - Any directory inside the repository of interest. Git
145
+ * resolves upward to the worktree root, and the snapshot covers that whole
146
+ * root — NOT only the subtree named here. Narrowing is the caller's job, and
147
+ * is why {@link GitSnapshotEntry.absolutePath} is absolute
148
+ * @returns The snapshot, or `null` when git could not answer — no `git` on
149
+ * `PATH`, not a repository, a bare or unreadable one. An empty `entries` is a
150
+ * real answer (an initialized repository with no files) and stays
151
+ * distinguishable from it
152
+ */
153
+ export declare function gitTreeSnapshot(options: {
154
+ cwd: string;
155
+ }): GitTreeSnapshot | null;
156
+ /**
157
+ * A snapshot taken NOW, whatever bracket is open — never read from or written to
158
+ * its memo.
159
+ *
160
+ * ⛔ The bracket makes two consumers agree with EACH OTHER; it cannot make them
161
+ * agree with files read later. A population keyed inside a bracket reads the
162
+ * working tree afterwards, so an edit landing in between is read and then filed
163
+ * under the pre-edit key. This is how a caller checks, before filing, that the
164
+ * bracket's answer still describes the tree. It costs a full snapshot, so it
165
+ * belongs on the write path, never on a hit.
166
+ *
167
+ * @param options - Where to look
168
+ * @param options.cwd - Any directory inside the repository of interest
169
+ * @returns The snapshot, or `null` when git could not answer
170
+ */
171
+ export declare function freshGitTreeSnapshot(options: {
172
+ cwd: string;
173
+ }): GitTreeSnapshot | null;
174
+ /**
175
+ * The snapshot this bracket ALREADY holds for a repository — never a new one.
176
+ *
177
+ * The difference from {@link gitTreeSnapshot} is the whole reason this exists:
178
+ * that function TAKES a snapshot when the memo misses, and a snapshot is three
179
+ * spawns and a `git add --all`. This one only ever reports what a previous
180
+ * caller already paid for, so a consumer can prefer it and fall back to its own
181
+ * cheaper question without any risk of turning a miss into the most expensive
182
+ * git operation in the package.
183
+ *
184
+ * That asymmetry is what makes it safe to reach for from shared code. The
185
+ * {@link GitTracker} does exactly this: inside the projection's git lane a
186
+ * snapshot is already in hand and describes precisely the set its own
187
+ * `git ls-files --cached --others --exclude-standard` would spawn to rebuild,
188
+ * while on the incumbent walk no snapshot is ever taken and the tracker must
189
+ * keep spawning. One consumer, two lanes, and neither pays for the other's
190
+ * strategy.
191
+ *
192
+ * @param cwd - Any directory inside the repository of interest
193
+ * @returns The memoized snapshot, or `undefined` when this bracket has none —
194
+ * which includes there being no bracket open at all, and includes a memoized
195
+ * `null` (git could not answer). Callers treat all three the same way: ask
196
+ * your own question instead
197
+ */
198
+ export declare function peekGitTreeSnapshot(cwd: string): GitTreeSnapshot | undefined;
199
+ //# sourceMappingURL=git-snapshot.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"git-snapshot.d.ts","sourceRoot":"","sources":["../src/git-snapshot.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8CG;AASH,iEAAiE;AACjE,MAAM,WAAW,gBAAgB;IAC/B,4EAA4E;IAC5E,YAAY,EAAE,MAAM,CAAC;IACrB;;;;;OAKG;IACH,GAAG,EAAE,MAAM,CAAC;IACZ,8EAA8E;IAC9E,IAAI,EAAE,MAAM,CAAC;IACb,4EAA4E;IAC5E,SAAS,EAAE,OAAO,CAAC;IACnB;;;;;;OAMG;IACH,WAAW,EAAE,OAAO,CAAC;CACtB;AAED,iCAAiC;AACjC,MAAM,WAAW,eAAe;IAC9B;;;;;;OAMG;IACH,IAAI,EAAE,MAAM,CAAC;IACb,6EAA6E;IAC7E,cAAc,EAAE,MAAM,CAAC;IACvB,kDAAkD;IAClD,OAAO,EAAE,gBAAgB,EAAE,CAAC;CAC7B;AAuBD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+CG;AACH,wBAAgB,oBAAoB,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,CAAC,GAAG,CAAC,CAEvD;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE;IAAE,GAAG,EAAE,MAAM,CAAA;CAAE,GAAG,eAAe,GAAG,IAAI,CA2BhF;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAAE;IAAE,GAAG,EAAE,MAAM,CAAA;CAAE,GAAG,eAAe,GAAG,IAAI,CAErF;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,MAAM,GAAG,eAAe,GAAG,SAAS,CAY5E"}