trail-code 0.0.0-stage → 0.28.0-semantic.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (593) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +567 -2
  3. package/dist/ai/crux.d.ts +88 -0
  4. package/dist/ai/crux.d.ts.map +1 -0
  5. package/dist/ai/crux.js +219 -0
  6. package/dist/ai/crux.js.map +1 -0
  7. package/dist/ai/failure.d.ts +60 -0
  8. package/dist/ai/failure.d.ts.map +1 -0
  9. package/dist/ai/failure.js +86 -0
  10. package/dist/ai/failure.js.map +1 -0
  11. package/dist/ai/llm/anthropic.d.ts +37 -0
  12. package/dist/ai/llm/anthropic.d.ts.map +1 -0
  13. package/dist/ai/llm/anthropic.js +144 -0
  14. package/dist/ai/llm/anthropic.js.map +1 -0
  15. package/dist/ai/llm/factory.d.ts +28 -0
  16. package/dist/ai/llm/factory.d.ts.map +1 -0
  17. package/dist/ai/llm/factory.js +36 -0
  18. package/dist/ai/llm/factory.js.map +1 -0
  19. package/dist/ai/llm/litellm.d.ts +34 -0
  20. package/dist/ai/llm/litellm.d.ts.map +1 -0
  21. package/dist/ai/llm/litellm.js +45 -0
  22. package/dist/ai/llm/litellm.js.map +1 -0
  23. package/dist/ai/llm/openai.d.ts +145 -0
  24. package/dist/ai/llm/openai.d.ts.map +1 -0
  25. package/dist/ai/llm/openai.js +629 -0
  26. package/dist/ai/llm/openai.js.map +1 -0
  27. package/dist/ai/llm/orcarouter.d.ts +34 -0
  28. package/dist/ai/llm/orcarouter.d.ts.map +1 -0
  29. package/dist/ai/llm/orcarouter.js +45 -0
  30. package/dist/ai/llm/orcarouter.js.map +1 -0
  31. package/dist/ai/llm/recover-tool.d.ts +21 -0
  32. package/dist/ai/llm/recover-tool.d.ts.map +1 -0
  33. package/dist/ai/llm/recover-tool.js +109 -0
  34. package/dist/ai/llm/recover-tool.js.map +1 -0
  35. package/dist/ai/llm/types.d.ts +122 -0
  36. package/dist/ai/llm/types.d.ts.map +1 -0
  37. package/dist/ai/llm/types.js +33 -0
  38. package/dist/ai/llm/types.js.map +1 -0
  39. package/dist/ai/providers.d.ts +59 -0
  40. package/dist/ai/providers.d.ts.map +1 -0
  41. package/dist/ai/providers.js +54 -0
  42. package/dist/ai/providers.js.map +1 -0
  43. package/dist/ai/summarize.d.ts +25 -0
  44. package/dist/ai/summarize.d.ts.map +1 -0
  45. package/dist/ai/summarize.js +34 -0
  46. package/dist/ai/summarize.js.map +1 -0
  47. package/dist/ai/synthesize.d.ts +40 -0
  48. package/dist/ai/synthesize.d.ts.map +1 -0
  49. package/dist/ai/synthesize.js +230 -0
  50. package/dist/ai/synthesize.js.map +1 -0
  51. package/dist/ask/ask.d.ts +199 -0
  52. package/dist/ask/ask.d.ts.map +1 -0
  53. package/dist/ask/ask.js +1291 -0
  54. package/dist/ask/ask.js.map +1 -0
  55. package/dist/ask/file-rank.d.ts +72 -0
  56. package/dist/ask/file-rank.d.ts.map +1 -0
  57. package/dist/ask/file-rank.js +160 -0
  58. package/dist/ask/file-rank.js.map +1 -0
  59. package/dist/ask/file-selection.d.ts +22 -0
  60. package/dist/ask/file-selection.d.ts.map +1 -0
  61. package/dist/ask/file-selection.js +66 -0
  62. package/dist/ask/file-selection.js.map +1 -0
  63. package/dist/ask/fuse.d.ts +195 -0
  64. package/dist/ask/fuse.d.ts.map +1 -0
  65. package/dist/ask/fuse.js +344 -0
  66. package/dist/ask/fuse.js.map +1 -0
  67. package/dist/ask/graphrank.d.ts +61 -0
  68. package/dist/ask/graphrank.d.ts.map +1 -0
  69. package/dist/ask/graphrank.js +130 -0
  70. package/dist/ask/graphrank.js.map +1 -0
  71. package/dist/ask/index-file.d.ts +44 -0
  72. package/dist/ask/index-file.d.ts.map +1 -0
  73. package/dist/ask/index-file.js +128 -0
  74. package/dist/ask/index-file.js.map +1 -0
  75. package/dist/ask/semantic.d.ts +42 -0
  76. package/dist/ask/semantic.d.ts.map +1 -0
  77. package/dist/ask/semantic.js +293 -0
  78. package/dist/ask/semantic.js.map +1 -0
  79. package/dist/bin/graft.d.ts +3 -0
  80. package/dist/bin/graft.d.ts.map +1 -0
  81. package/dist/bin/graft.js +14 -0
  82. package/dist/bin/graft.js.map +1 -0
  83. package/dist/bin/trail.d.ts +3 -0
  84. package/dist/bin/trail.d.ts.map +1 -0
  85. package/dist/bin/trail.js +13 -0
  86. package/dist/bin/trail.js.map +1 -0
  87. package/dist/blast/blast-cli.d.ts +35 -0
  88. package/dist/blast/blast-cli.d.ts.map +1 -0
  89. package/dist/blast/blast-cli.js +155 -0
  90. package/dist/blast/blast-cli.js.map +1 -0
  91. package/dist/blast/blast.d.ts +128 -0
  92. package/dist/blast/blast.d.ts.map +1 -0
  93. package/dist/blast/blast.js +383 -0
  94. package/dist/blast/blast.js.map +1 -0
  95. package/dist/blast/diff.d.ts +53 -0
  96. package/dist/blast/diff.d.ts.map +1 -0
  97. package/dist/blast/diff.js +193 -0
  98. package/dist/blast/diff.js.map +1 -0
  99. package/dist/blast/evidence.d.ts +51 -0
  100. package/dist/blast/evidence.d.ts.map +1 -0
  101. package/dist/blast/evidence.js +162 -0
  102. package/dist/blast/evidence.js.map +1 -0
  103. package/dist/blast/modules.d.ts +33 -0
  104. package/dist/blast/modules.d.ts.map +1 -0
  105. package/dist/blast/modules.js +83 -0
  106. package/dist/blast/modules.js.map +1 -0
  107. package/dist/blast/name.d.ts +74 -0
  108. package/dist/blast/name.d.ts.map +1 -0
  109. package/dist/blast/name.js +269 -0
  110. package/dist/blast/name.js.map +1 -0
  111. package/dist/blast/owners.d.ts +85 -0
  112. package/dist/blast/owners.d.ts.map +1 -0
  113. package/dist/blast/owners.js +272 -0
  114. package/dist/blast/owners.js.map +1 -0
  115. package/dist/blast/render.d.ts +46 -0
  116. package/dist/blast/render.d.ts.map +1 -0
  117. package/dist/blast/render.js +422 -0
  118. package/dist/blast/render.js.map +1 -0
  119. package/dist/blast/viz.d.ts +37 -0
  120. package/dist/blast/viz.d.ts.map +1 -0
  121. package/dist/blast/viz.js +180 -0
  122. package/dist/blast/viz.js.map +1 -0
  123. package/dist/brand.d.ts +111 -0
  124. package/dist/brand.d.ts.map +1 -0
  125. package/dist/brand.js +282 -0
  126. package/dist/brand.js.map +1 -0
  127. package/dist/claude/build-progress.d.ts +30 -0
  128. package/dist/claude/build-progress.d.ts.map +1 -0
  129. package/dist/claude/build-progress.js +81 -0
  130. package/dist/claude/build-progress.js.map +1 -0
  131. package/dist/claude/hermes-skill-template.d.ts +16 -0
  132. package/dist/claude/hermes-skill-template.d.ts.map +1 -0
  133. package/dist/claude/hermes-skill-template.js +154 -0
  134. package/dist/claude/hermes-skill-template.js.map +1 -0
  135. package/dist/claude/init.d.ts +65 -0
  136. package/dist/claude/init.d.ts.map +1 -0
  137. package/dist/claude/init.js +258 -0
  138. package/dist/claude/init.js.map +1 -0
  139. package/dist/claude/paths.d.ts +9 -0
  140. package/dist/claude/paths.d.ts.map +1 -0
  141. package/dist/claude/paths.js +22 -0
  142. package/dist/claude/paths.js.map +1 -0
  143. package/dist/claude/session-metrics.d.ts +73 -0
  144. package/dist/claude/session-metrics.d.ts.map +1 -0
  145. package/dist/claude/session-metrics.js +209 -0
  146. package/dist/claude/session-metrics.js.map +1 -0
  147. package/dist/claude/settings-merge.d.ts +76 -0
  148. package/dist/claude/settings-merge.d.ts.map +1 -0
  149. package/dist/claude/settings-merge.js +283 -0
  150. package/dist/claude/settings-merge.js.map +1 -0
  151. package/dist/claude/skill-template.d.ts +13 -0
  152. package/dist/claude/skill-template.d.ts.map +1 -0
  153. package/dist/claude/skill-template.js +290 -0
  154. package/dist/claude/skill-template.js.map +1 -0
  155. package/dist/claude/state.d.ts +85 -0
  156. package/dist/claude/state.d.ts.map +1 -0
  157. package/dist/claude/state.js +88 -0
  158. package/dist/claude/state.js.map +1 -0
  159. package/dist/claude/stats.d.ts +5 -0
  160. package/dist/claude/stats.d.ts.map +1 -0
  161. package/dist/claude/stats.js +24 -0
  162. package/dist/claude/stats.js.map +1 -0
  163. package/dist/cli-epilogue.d.ts +12 -0
  164. package/dist/cli-epilogue.d.ts.map +1 -0
  165. package/dist/cli-epilogue.js +72 -0
  166. package/dist/cli-epilogue.js.map +1 -0
  167. package/dist/cli-meta.d.ts +82 -0
  168. package/dist/cli-meta.d.ts.map +1 -0
  169. package/dist/cli-meta.js +238 -0
  170. package/dist/cli-meta.js.map +1 -0
  171. package/dist/cli-picker.d.ts +139 -0
  172. package/dist/cli-picker.d.ts.map +1 -0
  173. package/dist/cli-picker.js +439 -0
  174. package/dist/cli-picker.js.map +1 -0
  175. package/dist/cli.d.ts +3 -0
  176. package/dist/cli.d.ts.map +1 -0
  177. package/dist/cli.js +1638 -0
  178. package/dist/cli.js.map +1 -0
  179. package/dist/context/batches.d.ts +29 -0
  180. package/dist/context/batches.d.ts.map +1 -0
  181. package/dist/context/batches.js +130 -0
  182. package/dist/context/batches.js.map +1 -0
  183. package/dist/context/build.d.ts +57 -0
  184. package/dist/context/build.d.ts.map +1 -0
  185. package/dist/context/build.js +396 -0
  186. package/dist/context/build.js.map +1 -0
  187. package/dist/context/check.d.ts +42 -0
  188. package/dist/context/check.d.ts.map +1 -0
  189. package/dist/context/check.js +162 -0
  190. package/dist/context/check.js.map +1 -0
  191. package/dist/context/map-dir.d.ts +13 -0
  192. package/dist/context/map-dir.d.ts.map +1 -0
  193. package/dist/context/map-dir.js +81 -0
  194. package/dist/context/map-dir.js.map +1 -0
  195. package/dist/context/node-file.d.ts +109 -0
  196. package/dist/context/node-file.d.ts.map +1 -0
  197. package/dist/context/node-file.js +390 -0
  198. package/dist/context/node-file.js.map +1 -0
  199. package/dist/context/price.d.ts +49 -0
  200. package/dist/context/price.d.ts.map +1 -0
  201. package/dist/context/price.js +83 -0
  202. package/dist/context/price.js.map +1 -0
  203. package/dist/context/savings.d.ts +67 -0
  204. package/dist/context/savings.d.ts.map +1 -0
  205. package/dist/context/savings.js +125 -0
  206. package/dist/context/savings.js.map +1 -0
  207. package/dist/engine.d.ts +85 -0
  208. package/dist/engine.d.ts.map +1 -0
  209. package/dist/engine.js +122 -0
  210. package/dist/engine.js.map +1 -0
  211. package/dist/graph/bindings.d.ts +64 -0
  212. package/dist/graph/bindings.d.ts.map +1 -0
  213. package/dist/graph/bindings.js +713 -0
  214. package/dist/graph/bindings.js.map +1 -0
  215. package/dist/graph/build-run.d.ts +25 -0
  216. package/dist/graph/build-run.d.ts.map +1 -0
  217. package/dist/graph/build-run.js +121 -0
  218. package/dist/graph/build-run.js.map +1 -0
  219. package/dist/graph/build.d.ts +88 -0
  220. package/dist/graph/build.d.ts.map +1 -0
  221. package/dist/graph/build.js +386 -0
  222. package/dist/graph/build.js.map +1 -0
  223. package/dist/graph/cards.d.ts +46 -0
  224. package/dist/graph/cards.d.ts.map +1 -0
  225. package/dist/graph/cards.js +280 -0
  226. package/dist/graph/cards.js.map +1 -0
  227. package/dist/graph/check.d.ts +25 -0
  228. package/dist/graph/check.d.ts.map +1 -0
  229. package/dist/graph/check.js +192 -0
  230. package/dist/graph/check.js.map +1 -0
  231. package/dist/graph/container.d.ts +63 -0
  232. package/dist/graph/container.d.ts.map +1 -0
  233. package/dist/graph/container.js +191 -0
  234. package/dist/graph/container.js.map +1 -0
  235. package/dist/graph/depth-parser.d.ts +61 -0
  236. package/dist/graph/depth-parser.d.ts.map +1 -0
  237. package/dist/graph/depth-parser.js +153 -0
  238. package/dist/graph/depth-parser.js.map +1 -0
  239. package/dist/graph/enrich.d.ts +62 -0
  240. package/dist/graph/enrich.d.ts.map +1 -0
  241. package/dist/graph/enrich.js +258 -0
  242. package/dist/graph/enrich.js.map +1 -0
  243. package/dist/graph/extract-cache.d.ts +101 -0
  244. package/dist/graph/extract-cache.d.ts.map +1 -0
  245. package/dist/graph/extract-cache.js +199 -0
  246. package/dist/graph/extract-cache.js.map +1 -0
  247. package/dist/graph/extract.d.ts +85 -0
  248. package/dist/graph/extract.d.ts.map +1 -0
  249. package/dist/graph/extract.js +2377 -0
  250. package/dist/graph/extract.js.map +1 -0
  251. package/dist/graph/fingerprint.d.ts +76 -0
  252. package/dist/graph/fingerprint.d.ts.map +1 -0
  253. package/dist/graph/fingerprint.js +160 -0
  254. package/dist/graph/fingerprint.js.map +1 -0
  255. package/dist/graph/generic.d.ts +74 -0
  256. package/dist/graph/generic.d.ts.map +1 -0
  257. package/dist/graph/generic.js +773 -0
  258. package/dist/graph/generic.js.map +1 -0
  259. package/dist/graph/invariants.d.ts +33 -0
  260. package/dist/graph/invariants.d.ts.map +1 -0
  261. package/dist/graph/invariants.js +52 -0
  262. package/dist/graph/invariants.js.map +1 -0
  263. package/dist/graph/load.d.ts +29 -0
  264. package/dist/graph/load.d.ts.map +1 -0
  265. package/dist/graph/load.js +97 -0
  266. package/dist/graph/load.js.map +1 -0
  267. package/dist/graph/lsp/client.d.ts +61 -0
  268. package/dist/graph/lsp/client.d.ts.map +1 -0
  269. package/dist/graph/lsp/client.js +217 -0
  270. package/dist/graph/lsp/client.js.map +1 -0
  271. package/dist/graph/lsp/enrich.d.ts +11 -0
  272. package/dist/graph/lsp/enrich.d.ts.map +1 -0
  273. package/dist/graph/lsp/enrich.js +163 -0
  274. package/dist/graph/lsp/enrich.js.map +1 -0
  275. package/dist/graph/lsp/registry.d.ts +22 -0
  276. package/dist/graph/lsp/registry.d.ts.map +1 -0
  277. package/dist/graph/lsp/registry.js +71 -0
  278. package/dist/graph/lsp/registry.js.map +1 -0
  279. package/dist/graph/map.d.ts +107 -0
  280. package/dist/graph/map.d.ts.map +1 -0
  281. package/dist/graph/map.js +239 -0
  282. package/dist/graph/map.js.map +1 -0
  283. package/dist/graph/markdown.d.ts +22 -0
  284. package/dist/graph/markdown.d.ts.map +1 -0
  285. package/dist/graph/markdown.js +143 -0
  286. package/dist/graph/markdown.js.map +1 -0
  287. package/dist/graph/native.d.ts +46 -0
  288. package/dist/graph/native.d.ts.map +1 -0
  289. package/dist/graph/native.js +169 -0
  290. package/dist/graph/native.js.map +1 -0
  291. package/dist/graph/queries/c.scm +13 -0
  292. package/dist/graph/queries/c_sharp.scm +19 -0
  293. package/dist/graph/queries/clojure.scm +58 -0
  294. package/dist/graph/queries/cpp.scm +23 -0
  295. package/dist/graph/queries/dart.scm +42 -0
  296. package/dist/graph/queries/elixir.scm +54 -0
  297. package/dist/graph/queries/gleam.scm +51 -0
  298. package/dist/graph/queries/java.scm +20 -0
  299. package/dist/graph/queries/kotlin.scm +43 -0
  300. package/dist/graph/queries/lua.scm +36 -0
  301. package/dist/graph/queries/nix.scm +32 -0
  302. package/dist/graph/queries/php.scm +40 -0
  303. package/dist/graph/queries/ruby.scm +65 -0
  304. package/dist/graph/queries/rust.scm +41 -0
  305. package/dist/graph/queries/scala.scm +66 -0
  306. package/dist/graph/queries/solidity.scm +43 -0
  307. package/dist/graph/queries/swift.scm +51 -0
  308. package/dist/graph/refresh.d.ts +106 -0
  309. package/dist/graph/refresh.d.ts.map +1 -0
  310. package/dist/graph/refresh.js +430 -0
  311. package/dist/graph/refresh.js.map +1 -0
  312. package/dist/graph/relations.d.ts +14 -0
  313. package/dist/graph/relations.d.ts.map +1 -0
  314. package/dist/graph/relations.js +8 -0
  315. package/dist/graph/relations.js.map +1 -0
  316. package/dist/graph/resolve.d.ts +17 -0
  317. package/dist/graph/resolve.d.ts.map +1 -0
  318. package/dist/graph/resolve.js +716 -0
  319. package/dist/graph/resolve.js.map +1 -0
  320. package/dist/graph/root.d.ts +11 -0
  321. package/dist/graph/root.d.ts.map +1 -0
  322. package/dist/graph/root.js +40 -0
  323. package/dist/graph/root.js.map +1 -0
  324. package/dist/graph/scopes.d.ts +40 -0
  325. package/dist/graph/scopes.d.ts.map +1 -0
  326. package/dist/graph/scopes.js +383 -0
  327. package/dist/graph/scopes.js.map +1 -0
  328. package/dist/graph/seed.d.ts +38 -0
  329. package/dist/graph/seed.d.ts.map +1 -0
  330. package/dist/graph/seed.js +229 -0
  331. package/dist/graph/seed.js.map +1 -0
  332. package/dist/graph/source-files.d.ts +46 -0
  333. package/dist/graph/source-files.d.ts.map +1 -0
  334. package/dist/graph/source-files.js +118 -0
  335. package/dist/graph/source-files.js.map +1 -0
  336. package/dist/graph/traverse-cli.d.ts +55 -0
  337. package/dist/graph/traverse-cli.d.ts.map +1 -0
  338. package/dist/graph/traverse-cli.js +189 -0
  339. package/dist/graph/traverse-cli.js.map +1 -0
  340. package/dist/graph/traverse.d.ts +112 -0
  341. package/dist/graph/traverse.d.ts.map +1 -0
  342. package/dist/graph/traverse.js +192 -0
  343. package/dist/graph/traverse.js.map +1 -0
  344. package/dist/graph/types.d.ts +78 -0
  345. package/dist/graph/types.d.ts.map +1 -0
  346. package/dist/graph/types.js +14 -0
  347. package/dist/graph/types.js.map +1 -0
  348. package/dist/graph/wasm-runtime.d.ts +19 -0
  349. package/dist/graph/wasm-runtime.d.ts.map +1 -0
  350. package/dist/graph/wasm-runtime.js +38 -0
  351. package/dist/graph/wasm-runtime.js.map +1 -0
  352. package/dist/graph/workspace-cli.d.ts +56 -0
  353. package/dist/graph/workspace-cli.d.ts.map +1 -0
  354. package/dist/graph/workspace-cli.js +111 -0
  355. package/dist/graph/workspace-cli.js.map +1 -0
  356. package/dist/graph/workspace.d.ts +172 -0
  357. package/dist/graph/workspace.d.ts.map +1 -0
  358. package/dist/graph/workspace.js +714 -0
  359. package/dist/graph/workspace.js.map +1 -0
  360. package/dist/graph/write.d.ts +13 -0
  361. package/dist/graph/write.d.ts.map +1 -0
  362. package/dist/graph/write.js +86 -0
  363. package/dist/graph/write.js.map +1 -0
  364. package/dist/hosts/antigravity.d.ts +14 -0
  365. package/dist/hosts/antigravity.d.ts.map +1 -0
  366. package/dist/hosts/antigravity.js +59 -0
  367. package/dist/hosts/antigravity.js.map +1 -0
  368. package/dist/hosts/auto.d.ts +37 -0
  369. package/dist/hosts/auto.d.ts.map +1 -0
  370. package/dist/hosts/auto.js +141 -0
  371. package/dist/hosts/auto.js.map +1 -0
  372. package/dist/hosts/claude-global.d.ts +72 -0
  373. package/dist/hosts/claude-global.d.ts.map +1 -0
  374. package/dist/hosts/claude-global.js +230 -0
  375. package/dist/hosts/claude-global.js.map +1 -0
  376. package/dist/hosts/config-write.d.ts +36 -0
  377. package/dist/hosts/config-write.d.ts.map +1 -0
  378. package/dist/hosts/config-write.js +64 -0
  379. package/dist/hosts/config-write.js.map +1 -0
  380. package/dist/hosts/init.d.ts +28 -0
  381. package/dist/hosts/init.d.ts.map +1 -0
  382. package/dist/hosts/init.js +89 -0
  383. package/dist/hosts/init.js.map +1 -0
  384. package/dist/hosts/instructions.d.ts +14 -0
  385. package/dist/hosts/instructions.d.ts.map +1 -0
  386. package/dist/hosts/instructions.js +95 -0
  387. package/dist/hosts/instructions.js.map +1 -0
  388. package/dist/hosts/mcp-config.d.ts +78 -0
  389. package/dist/hosts/mcp-config.d.ts.map +1 -0
  390. package/dist/hosts/mcp-config.js +251 -0
  391. package/dist/hosts/mcp-config.js.map +1 -0
  392. package/dist/hosts/plan.d.ts +32 -0
  393. package/dist/hosts/plan.d.ts.map +1 -0
  394. package/dist/hosts/plan.js +73 -0
  395. package/dist/hosts/plan.js.map +1 -0
  396. package/dist/hosts/registry.d.ts +41 -0
  397. package/dist/hosts/registry.d.ts.map +1 -0
  398. package/dist/hosts/registry.js +164 -0
  399. package/dist/hosts/registry.js.map +1 -0
  400. package/dist/hosts/retract.d.ts +47 -0
  401. package/dist/hosts/retract.d.ts.map +1 -0
  402. package/dist/hosts/retract.js +520 -0
  403. package/dist/hosts/retract.js.map +1 -0
  404. package/dist/hosts/sections.d.ts +47 -0
  405. package/dist/hosts/sections.d.ts.map +1 -0
  406. package/dist/hosts/sections.js +127 -0
  407. package/dist/hosts/sections.js.map +1 -0
  408. package/dist/index.d.ts +41 -0
  409. package/dist/index.d.ts.map +1 -0
  410. package/dist/index.js +32 -0
  411. package/dist/index.js.map +1 -0
  412. package/dist/ingest/fs.d.ts +79 -0
  413. package/dist/ingest/fs.d.ts.map +1 -0
  414. package/dist/ingest/fs.js +306 -0
  415. package/dist/ingest/fs.js.map +1 -0
  416. package/dist/init-guard.d.ts +16 -0
  417. package/dist/init-guard.d.ts.map +1 -0
  418. package/dist/init-guard.js +27 -0
  419. package/dist/init-guard.js.map +1 -0
  420. package/dist/mcp/instructions.d.ts +5 -0
  421. package/dist/mcp/instructions.d.ts.map +1 -0
  422. package/dist/mcp/instructions.js +64 -0
  423. package/dist/mcp/instructions.js.map +1 -0
  424. package/dist/mcp/kept-listing.d.ts +27 -0
  425. package/dist/mcp/kept-listing.d.ts.map +1 -0
  426. package/dist/mcp/kept-listing.js +63 -0
  427. package/dist/mcp/kept-listing.js.map +1 -0
  428. package/dist/mcp/server.d.ts +4 -0
  429. package/dist/mcp/server.d.ts.map +1 -0
  430. package/dist/mcp/server.js +147 -0
  431. package/dist/mcp/server.js.map +1 -0
  432. package/dist/mcp/tool-names.d.ts +27 -0
  433. package/dist/mcp/tool-names.d.ts.map +1 -0
  434. package/dist/mcp/tool-names.js +47 -0
  435. package/dist/mcp/tool-names.js.map +1 -0
  436. package/dist/mcp/tools.d.ts +22 -0
  437. package/dist/mcp/tools.d.ts.map +1 -0
  438. package/dist/mcp/tools.js +440 -0
  439. package/dist/mcp/tools.js.map +1 -0
  440. package/dist/node-version.d.ts +15 -0
  441. package/dist/node-version.d.ts.map +1 -0
  442. package/dist/node-version.js +23 -0
  443. package/dist/node-version.js.map +1 -0
  444. package/dist/search/grep-cli.d.ts +35 -0
  445. package/dist/search/grep-cli.d.ts.map +1 -0
  446. package/dist/search/grep-cli.js +115 -0
  447. package/dist/search/grep-cli.js.map +1 -0
  448. package/dist/search/grep.d.ts +60 -0
  449. package/dist/search/grep.d.ts.map +1 -0
  450. package/dist/search/grep.js +143 -0
  451. package/dist/search/grep.js.map +1 -0
  452. package/dist/search/ignored-code.d.ts +9 -0
  453. package/dist/search/ignored-code.d.ts.map +1 -0
  454. package/dist/search/ignored-code.js +73 -0
  455. package/dist/search/ignored-code.js.map +1 -0
  456. package/dist/search/user-regexp.d.ts +26 -0
  457. package/dist/search/user-regexp.d.ts.map +1 -0
  458. package/dist/search/user-regexp.js +150 -0
  459. package/dist/search/user-regexp.js.map +1 -0
  460. package/dist/telemetry/contract.d.ts +117 -0
  461. package/dist/telemetry/contract.d.ts.map +1 -0
  462. package/dist/telemetry/contract.js +341 -0
  463. package/dist/telemetry/contract.js.map +1 -0
  464. package/dist/telemetry/flush.d.ts +21 -0
  465. package/dist/telemetry/flush.d.ts.map +1 -0
  466. package/dist/telemetry/flush.js +85 -0
  467. package/dist/telemetry/flush.js.map +1 -0
  468. package/dist/telemetry/gate.d.ts +30 -0
  469. package/dist/telemetry/gate.d.ts.map +1 -0
  470. package/dist/telemetry/gate.js +81 -0
  471. package/dist/telemetry/gate.js.map +1 -0
  472. package/dist/telemetry/identity.d.ts +40 -0
  473. package/dist/telemetry/identity.d.ts.map +1 -0
  474. package/dist/telemetry/identity.js +80 -0
  475. package/dist/telemetry/identity.js.map +1 -0
  476. package/dist/telemetry/index.d.ts +18 -0
  477. package/dist/telemetry/index.d.ts.map +1 -0
  478. package/dist/telemetry/index.js +16 -0
  479. package/dist/telemetry/index.js.map +1 -0
  480. package/dist/telemetry/key.d.ts +21 -0
  481. package/dist/telemetry/key.d.ts.map +1 -0
  482. package/dist/telemetry/key.js +49 -0
  483. package/dist/telemetry/key.js.map +1 -0
  484. package/dist/telemetry/notice.d.ts +19 -0
  485. package/dist/telemetry/notice.d.ts.map +1 -0
  486. package/dist/telemetry/notice.js +93 -0
  487. package/dist/telemetry/notice.js.map +1 -0
  488. package/dist/telemetry/queue.d.ts +35 -0
  489. package/dist/telemetry/queue.d.ts.map +1 -0
  490. package/dist/telemetry/queue.js +162 -0
  491. package/dist/telemetry/queue.js.map +1 -0
  492. package/dist/telemetry/send.d.ts +19 -0
  493. package/dist/telemetry/send.d.ts.map +1 -0
  494. package/dist/telemetry/send.js +84 -0
  495. package/dist/telemetry/send.js.map +1 -0
  496. package/dist/telemetry/sessions.d.ts +25 -0
  497. package/dist/telemetry/sessions.d.ts.map +1 -0
  498. package/dist/telemetry/sessions.js +104 -0
  499. package/dist/telemetry/sessions.js.map +1 -0
  500. package/dist/telemetry/track.d.ts +62 -0
  501. package/dist/telemetry/track.d.ts.map +1 -0
  502. package/dist/telemetry/track.js +143 -0
  503. package/dist/telemetry/track.js.map +1 -0
  504. package/dist/upkeep-run.d.ts +22 -0
  505. package/dist/upkeep-run.d.ts.map +1 -0
  506. package/dist/upkeep-run.js +85 -0
  507. package/dist/upkeep-run.js.map +1 -0
  508. package/dist/upkeep.d.ts +127 -0
  509. package/dist/upkeep.d.ts.map +1 -0
  510. package/dist/upkeep.js +252 -0
  511. package/dist/upkeep.js.map +1 -0
  512. package/dist/util/actions-folder.d.ts +2 -0
  513. package/dist/util/actions-folder.d.ts.map +1 -0
  514. package/dist/util/actions-folder.js +9 -0
  515. package/dist/util/actions-folder.js.map +1 -0
  516. package/dist/util/browser.d.ts +3 -0
  517. package/dist/util/browser.d.ts.map +1 -0
  518. package/dist/util/browser.js +14 -0
  519. package/dist/util/browser.js.map +1 -0
  520. package/dist/util/child-process.d.ts +15 -0
  521. package/dist/util/child-process.d.ts.map +1 -0
  522. package/dist/util/child-process.js +15 -0
  523. package/dist/util/child-process.js.map +1 -0
  524. package/dist/util/front-matter.d.ts +46 -0
  525. package/dist/util/front-matter.d.ts.map +1 -0
  526. package/dist/util/front-matter.js +113 -0
  527. package/dist/util/front-matter.js.map +1 -0
  528. package/dist/util/id.d.ts +7 -0
  529. package/dist/util/id.d.ts.map +1 -0
  530. package/dist/util/id.js +14 -0
  531. package/dist/util/id.js.map +1 -0
  532. package/dist/util/paths.d.ts +29 -0
  533. package/dist/util/paths.d.ts.map +1 -0
  534. package/dist/util/paths.js +71 -0
  535. package/dist/util/paths.js.map +1 -0
  536. package/dist/util/private-file.d.ts +14 -0
  537. package/dist/util/private-file.d.ts.map +1 -0
  538. package/dist/util/private-file.js +82 -0
  539. package/dist/util/private-file.js.map +1 -0
  540. package/dist/util/source.d.ts +4 -0
  541. package/dist/util/source.d.ts.map +1 -0
  542. package/dist/util/source.js +12 -0
  543. package/dist/util/source.js.map +1 -0
  544. package/dist/util/spinner.d.ts +15 -0
  545. package/dist/util/spinner.d.ts.map +1 -0
  546. package/dist/util/spinner.js +52 -0
  547. package/dist/util/spinner.js.map +1 -0
  548. package/dist/util/state.d.ts +120 -0
  549. package/dist/util/state.d.ts.map +1 -0
  550. package/dist/util/state.js +264 -0
  551. package/dist/util/state.js.map +1 -0
  552. package/dist/vendor/grammars/tree-sitter-go.LICENSE +21 -0
  553. package/dist/vendor/grammars/tree-sitter-go.wasm +0 -0
  554. package/dist/vendor/grammars/tree-sitter-java.LICENSE +21 -0
  555. package/dist/vendor/grammars/tree-sitter-java.wasm +0 -0
  556. package/dist/vendor/grammars/tree-sitter-kotlin.LICENSE +9 -0
  557. package/dist/vendor/grammars/tree-sitter-kotlin.wasm +0 -0
  558. package/dist/vendor/grammars/tree-sitter-php.LICENSE +22 -0
  559. package/dist/vendor/grammars/tree-sitter-php.wasm +0 -0
  560. package/dist/vendor/grammars/tree-sitter-python.LICENSE +21 -0
  561. package/dist/vendor/grammars/tree-sitter-python.wasm +0 -0
  562. package/dist/vendor/grammars/tree-sitter-r.LICENSE +9 -0
  563. package/dist/vendor/grammars/tree-sitter-r.wasm +0 -0
  564. package/dist/vendor/grammars/tree-sitter-swift.LICENSE +21 -0
  565. package/dist/vendor/grammars/tree-sitter-swift.wasm +0 -0
  566. package/dist/vendor/grammars/tree-sitter-tsx.wasm +0 -0
  567. package/dist/vendor/grammars/tree-sitter-typescript.LICENSE +21 -0
  568. package/dist/vendor/grammars/tree-sitter-typescript.wasm +0 -0
  569. package/dist/viewer/app.js +2 -0
  570. package/dist/viewer/index.html +49 -0
  571. package/dist/viewer/style.css +154 -0
  572. package/dist/viz/assemble.d.ts +83 -0
  573. package/dist/viz/assemble.d.ts.map +1 -0
  574. package/dist/viz/assemble.js +101 -0
  575. package/dist/viz/assemble.js.map +1 -0
  576. package/dist/viz/export.d.ts +39 -0
  577. package/dist/viz/export.d.ts.map +1 -0
  578. package/dist/viz/export.js +98 -0
  579. package/dist/viz/export.js.map +1 -0
  580. package/dist/viz/serve.d.ts +13 -0
  581. package/dist/viz/serve.d.ts.map +1 -0
  582. package/dist/viz/serve.js +130 -0
  583. package/dist/viz/serve.js.map +1 -0
  584. package/package.json +115 -4
  585. package/scripts/build-grammar-wasm.mjs +112 -0
  586. package/scripts/build-viewer.mjs +44 -0
  587. package/scripts/graph-quality.mjs +117 -0
  588. package/scripts/pack-trail.mjs +53 -0
  589. package/scripts/postinstall.mjs +65 -0
  590. package/scripts/run-tests.mjs +72 -0
  591. package/scripts/stamp-telemetry-key.mjs +56 -0
  592. package/scripts/tally-audit.mjs +140 -0
  593. package/scripts/vendor-grammars.mjs +53 -0
@@ -0,0 +1,22 @@
1
+ export interface UpkeepResult {
2
+ /** Lines worth showing the agent/user, already formatted. Usually empty. */
3
+ lines: string[];
4
+ }
5
+ /**
6
+ * Whether a repo wired as graft should move to trail now: the person has the
7
+ * trail command, so they've taken the update that renames graft. Each repo
8
+ * moves the first time a session opens in it. GRAFT_NO_TRAIL_SWITCH=1 keeps a
9
+ * machine on graft.
10
+ */
11
+ export declare function shouldMoveToTrail(repo: string, env?: NodeJS.ProcessEnv): boolean;
12
+ /**
13
+ * @param repo the project dir
14
+ * @param current the running graft's version
15
+ * @param opts.background false in hook contexts: read the update cache, never
16
+ * spawn a fetch. Hooks run under a hard timeout and must stay off the network.
17
+ */
18
+ export declare function runUpkeep(repo: string, current: string, opts?: {
19
+ background?: boolean;
20
+ home?: string;
21
+ }): UpkeepResult;
22
+ //# sourceMappingURL=upkeep-run.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"upkeep-run.d.ts","sourceRoot":"","sources":["../src/upkeep-run.ts"],"names":[],"mappings":"AAqBA,MAAM,WAAW,YAAY;IAC3B,4EAA4E;IAC5E,KAAK,EAAE,MAAM,EAAE,CAAC;CACjB;AAqCD;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,GAAE,MAAM,CAAC,UAAwB,GAAG,OAAO,CAI7F;AAED;;;;;GAKG;AACH,wBAAgB,SAAS,CACvB,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,MAAM,EACf,IAAI,GAAE;IAAE,UAAU,CAAC,EAAE,OAAO,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAA;CAAO,GACjD,YAAY,CAad"}
@@ -0,0 +1,85 @@
1
+ /**
2
+ * The wired-up version of `./upkeep.ts` — one call every entry point makes.
3
+ *
4
+ * Split from `upkeep.ts` so that module stays pure and unit-testable (no init
5
+ * writes, no spawning): this file is the only place that knows how to actually
6
+ * re-run the wiring, and it is deliberately thin.
7
+ */
8
+ import { runInit } from './claude/init.js';
9
+ import { runHostsInit } from './hosts/init.js';
10
+ import { graftCliPath } from './claude/paths.js';
11
+ import { repoWiredForTrail, setBrand, trailOnPath } from './brand.js';
12
+ import { formatUpdateNudge, formatWiringRefresh, maybeRefreshInBackground, readUpdateCache, reconcileWiring, wiredHostIds, } from './upkeep.js';
13
+ /**
14
+ * Re-write the wiring for exactly the hosts a previous `init` chose here, with
15
+ * exactly the flags it was given.
16
+ *
17
+ * `build: false` matters: this runs at session start and at MCP boot, and a graph
18
+ * build there would stall the agent's first turn.
19
+ *
20
+ * The out-of-repo writes (`~/.codex/hooks.json`, `~/.codex/config.toml`) ARE
21
+ * included, because nothing else would ever refresh them: no skill, rule file, or
22
+ * MCP instruction tells an agent to run `graft init`, so leaving them out means a
23
+ * Codex user upgrades the binary and keeps the old hook config forever. They're
24
+ * safe to replay — `installCodexHooks` no-ops when `~/.codex` is absent, rewrites
25
+ * only its own entry (matched on `graft-hooks.cjs`), and reports `unchanged` when
26
+ * the bytes match. A user who declined them at init time is honoured via
27
+ * `opts.global`/`opts.hooks`, replayed from the stamp.
28
+ */
29
+ function rewriteWiring(repo, hosts, opts, toTrail = false) {
30
+ // Moving to trail: everything written from here speaks trail, the repo gets
31
+ // its .trail/, and the hosts are rewired under trail's names.
32
+ if (toTrail)
33
+ setBrand('trail');
34
+ // Under trail, .trail/ is created by runInit when --build is set;
35
+ // ensureRepoHome/ensureRepoTrail removed in trail-solo-grafo change.
36
+ // `opts.global` reaches the claude layer for the same reason `opts.statusline` does:
37
+ // its `~/.claude` writes (hosts/claude-global.ts) are out-of-repo, and a user who
38
+ // declined those at init time must keep declining them on every replay.
39
+ if (hosts.includes('claude'))
40
+ runInit(repo, { build: false, cliPath: graftCliPath(), statusline: opts.statusline, global: opts.global && (!opts.laptop || opts.laptop.includes('claude')), ...(toTrail ? { brand: 'trail' } : {}) });
41
+ // The other agents move with Claude Code: their graft-named files and
42
+ // fenced blocks are replaced by trail's (see hosts/init.ts).
43
+ const others = hosts.filter((h) => h !== 'claude');
44
+ if (others.length)
45
+ runHostsInit(repo, { agents: others, global: opts.global, laptop: opts.laptop, mcp: opts.mcp, hooks: opts.hooks, ...(toTrail ? { brand: 'trail' } : {}) });
46
+ // Past sessions are never read here: only `trail init`, where the person sees what was found and picks.
47
+ }
48
+ /**
49
+ * Whether a repo wired as graft should move to trail now: the person has the
50
+ * trail command, so they've taken the update that renames graft. Each repo
51
+ * moves the first time a session opens in it. GRAFT_NO_TRAIL_SWITCH=1 keeps a
52
+ * machine on graft.
53
+ */
54
+ export function shouldMoveToTrail(repo, env = process.env) {
55
+ if (env.GRAFT_NO_TRAIL_SWITCH === '1')
56
+ return false;
57
+ // Claude Code's wiring is what says a repo is on trail, so only a repo with it moves.
58
+ return wiredHostIds(repo).includes('claude') && !repoWiredForTrail(repo) && trailOnPath(env);
59
+ }
60
+ /**
61
+ * @param repo the project dir
62
+ * @param current the running graft's version
63
+ * @param opts.background false in hook contexts: read the update cache, never
64
+ * spawn a fetch. Hooks run under a hard timeout and must stay off the network.
65
+ */
66
+ export function runUpkeep(repo, current, opts = {}) {
67
+ const lines = [];
68
+ try {
69
+ const refreshed = reconcileWiring(repo, current, { rewrite: rewriteWiring, toTrail: (r) => shouldMoveToTrail(r) });
70
+ const refreshLine = formatWiringRefresh(refreshed);
71
+ if (refreshLine)
72
+ lines.push(refreshLine);
73
+ }
74
+ catch { /* fail-soft: wiring refresh is never worth breaking a session for */ }
75
+ try {
76
+ if (opts.background !== false)
77
+ maybeRefreshInBackground(opts.home);
78
+ const nudge = formatUpdateNudge(current, readUpdateCache(opts.home)?.latest);
79
+ if (nudge)
80
+ lines.push(nudge);
81
+ }
82
+ catch { /* same */ }
83
+ return { lines };
84
+ }
85
+ //# sourceMappingURL=upkeep-run.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"upkeep-run.js","sourceRoot":"","sources":["../src/upkeep-run.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAAE,OAAO,EAAc,MAAM,kBAAkB,CAAC;AACvD,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,iBAAiB,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AACtE,OAAO,EACL,iBAAiB,EACjB,mBAAmB,EACnB,wBAAwB,EACxB,eAAe,EACf,eAAe,EACf,YAAY,GAEb,MAAM,aAAa,CAAC;AAOrB;;;;;;;;;;;;;;;GAeG;AACH,SAAS,aAAa,CAAC,IAAY,EAAE,KAAe,EAAE,IAAgB,EAAE,OAAO,GAAG,KAAK;IACrF,4EAA4E;IAC5E,8DAA8D;IAC9D,IAAI,OAAO;QAAE,QAAQ,CAAC,OAAO,CAAC,CAAC;IAC/B,kEAAkE;IAClE,qEAAqE;IACrE,qFAAqF;IACrF,kFAAkF;IAClF,wEAAwE;IACxE,IAAI,KAAK,CAAC,QAAQ,CAAC,QAAQ,CAAC;QAC1B,OAAO,CAAC,IAAI,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,YAAY,EAAE,EAAE,UAAU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CAAC;IAC3B,IAAI,CAAC;QACH,MAAM,SAAS,GAAG,eAAe,CAAC,IAAI,EAAE,OAAO,EAAE,EAAE,OAAO,EAAE,aAAa,EAAE,OAAO,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,iBAAiB,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;QACnH,MAAM,WAAW,GAAG,mBAAmB,CAAC,SAAS,CAAC,CAAC;QACnD,IAAI,WAAW;YAAE,KAAK,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;IAC3C,CAAC;IAAC,MAAM,CAAC,CAAC,qEAAqE,CAAC,CAAC;IACjF,IAAI,CAAC;QACH,IAAI,IAAI,CAAC,UAAU,KAAK,KAAK;YAAE,wBAAwB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACnE,MAAM,KAAK,GAAG,iBAAiB,CAAC,OAAO,EAAE,eAAe,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC,CAAC;QAC7E,IAAI,KAAK;YAAE,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAC/B,CAAC;IAAC,MAAM,CAAC,CAAC,UAAU,CAAC,CAAC;IACtB,OAAO,EAAE,KAAK,EAAE,CAAC;AACnB,CAAC"}
@@ -0,0 +1,127 @@
1
+ /**
2
+ * The version of the graft package this code was loaded from.
3
+ *
4
+ * Resolved from *this* module rather than the caller's: `readCurrentVersion`
5
+ * looks one level up from the module URL it's given, which lands on the package
6
+ * root for `dist/upkeep.js` but misses entirely for `dist/claude/hooks.js` and
7
+ * `dist/mcp/server.js`. Every caller asking here instead of passing its own
8
+ * `import.meta.url` is what keeps the hook and the MCP server from reading
9
+ * `0.0.0` and re-initing on every single session.
10
+ */
11
+ export declare function runningVersion(): string;
12
+ /** How long a registry answer is considered current. A day: graft ships far less
13
+ * often than that, and this is a nudge, not a security update. */
14
+ export declare const UPDATE_TTL_MS: number;
15
+ /** Numeric-dotted compare of the release part only (`1.2.3-beta.1` → `1.2.3`).
16
+ * Prerelease ordering doesn't matter here: the only question either caller asks
17
+ * is "is the thing on npm ahead of what's on disk", and a prerelease that
18
+ * compares equal simply produces no nudge. */
19
+ export declare function compareVersions(a: string, b: string): number;
20
+ export declare function isNewer(candidate: string | null | undefined, current: string): boolean;
21
+ export interface UpdateCache {
22
+ /** Latest version seen on npm, or null when the last fetch failed. */
23
+ latest: string | null;
24
+ /** Epoch ms of the last *attempt* — written by the parent before it spawns the
25
+ * fetch, so a repeatedly-failing fetch can't make every command spawn a child. */
26
+ checkedAt: number;
27
+ }
28
+ /** Machine-global, not per-repo: "what's the latest graft" is one fact, and a
29
+ * dev with twelve repos should cost the registry one request a day, not twelve. */
30
+ export declare function updateCachePath(home?: string): string;
31
+ export declare function readUpdateCache(home?: string): UpdateCache | null;
32
+ /**
33
+ * The `graft _update-check` command body: hit the registry, store the answer.
34
+ * Runs in a detached child so nothing user-facing ever waits on the network.
35
+ */
36
+ export declare function refreshUpdateCache(home?: string, now?: number): UpdateCache;
37
+ /** True when the cached answer is missing or older than the TTL. */
38
+ export declare function needsRefresh(cache: UpdateCache | null, now?: number): boolean;
39
+ /**
40
+ * Kick off a background registry check if the cache has gone stale. Touches
41
+ * `checkedAt` first so concurrent callers (and a child that dies) don't spawn a
42
+ * fetch per invocation. Never waits, never throws.
43
+ *
44
+ * Only called from long-lived or already-slow contexts (a CLI command, MCP
45
+ * boot) — never from a hook, which reads the cache and nothing else.
46
+ */
47
+ export declare function maybeRefreshInBackground(home?: string, now?: number, env?: NodeJS.ProcessEnv): boolean;
48
+ /** One line, or nothing. Nothing is the common case — don't spend context on
49
+ * "you're up to date". */
50
+ export declare function formatUpdateNudge(current: string, latest: string | null | undefined): string | null;
51
+ /**
52
+ * The subset of `graft init`'s flags a refresh has to replay.
53
+ *
54
+ * Without these, an auto-refresh would install things the user explicitly
55
+ * declined: someone who ran `graft init --no-global` (or `--no-hooks`, or
56
+ * `--no-statusline`) said "keep out of `~/.codex`" / "leave my statusline
57
+ * alone", and a later session silently writing there would be graft overriding a
58
+ * decision rather than maintaining one. Absent from an older stamp → all true,
59
+ * which is what plain `graft init` does.
60
+ */
61
+ export interface WiringOpts {
62
+ /** false → never write outside the repo (`--no-global`). */
63
+ global: boolean;
64
+ /** false → skip MCP server registration (`--no-mcp`). */
65
+ mcp: boolean;
66
+ /** false → skip hook installation (`--no-hooks`). */
67
+ hooks: boolean;
68
+ /** false → skip Claude Code statusLine (`--no-statusline` / GRAFT_NO_STATUSLINE). */
69
+ statusline: boolean;
70
+ /** `--agents auto`: the only hosts that write outside the repo (the agents installed when it ran). Absent → every wired host. */
71
+ laptop?: string[];
72
+ }
73
+ export declare const DEFAULT_WIRING_OPTS: WiringOpts;
74
+ /** An older stamp has no `opts`; a plain `graft init` wired everything. */
75
+ export declare function wiringOpts(stamp: WiringStamp | null): WiringOpts;
76
+ export interface WiringStamp {
77
+ /** The graft version whose `init` wrote this repo's agent files. */
78
+ version: string;
79
+ /** Host ids that were wired, so a refresh re-writes exactly those and never
80
+ * silently adopts an agent the user declined in the picker. */
81
+ hosts: string[];
82
+ /** The init flags to replay — see {@link WiringOpts}. */
83
+ opts?: Partial<WiringOpts>;
84
+ at: string;
85
+ }
86
+ /** Under `graft/.cache/`, beside the other derived state: git-ignored, per-clone,
87
+ * and cheap to lose — a missing stamp just means one idempotent refresh. */
88
+ export declare function stampPath(repo: string): string;
89
+ export declare function readStamp(repo: string): WiringStamp | null;
90
+ export declare function writeStamp(repo: string, version: string, hosts: string[], opts?: Partial<WiringOpts>, at?: string): void;
91
+ /**
92
+ * Which agents this repo is *already* wired for, read off disk rather than
93
+ * re-detected. Detection answers "which editors does this machine have"; for a
94
+ * refresh we need "which files did a previous init actually write" — otherwise
95
+ * installing Windsurf once would silently add graft rules to every repo.
96
+ */
97
+ export declare function wiredHostIds(repo: string): string[];
98
+ export interface WiringRefresh {
99
+ from: string;
100
+ to: string;
101
+ hosts: string[];
102
+ /** True when the refresh included writes outside the repo (`~/.codex/`), so the
103
+ * caller can say so — a session changing machine-wide config should be visible. */
104
+ global: boolean;
105
+ /** True when it moved a repo wired as graft over to trail. */
106
+ switched?: boolean;
107
+ }
108
+ /**
109
+ * Re-run init's writes when the stamp and the running binary disagree.
110
+ *
111
+ * Deliberately narrow: it refreshes the hosts already wired, replays the flags
112
+ * that init was given, never builds the graph (this runs at session start — a
113
+ * rebuild there would stall the agent's first turn), and no-ops when the repo has
114
+ * no graft wiring at all.
115
+ *
116
+ * `toTrail` says whether this repo should move from graft's wiring to trail's
117
+ * (see upkeep-run.ts). When it should, the refresh runs whatever the stamp says:
118
+ * the person installed trail, which is the signal, whether or not graft's own
119
+ * version moved.
120
+ */
121
+ export declare function reconcileWiring(repo: string, current: string, deps: {
122
+ wired?: (repo: string) => string[];
123
+ rewrite: (repo: string, hosts: string[], opts: WiringOpts, toTrail: boolean) => void;
124
+ toTrail?: (repo: string) => boolean;
125
+ }): WiringRefresh | null;
126
+ export declare function formatWiringRefresh(r: WiringRefresh | null): string | null;
127
+ //# sourceMappingURL=upkeep.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"upkeep.d.ts","sourceRoot":"","sources":["../src/upkeep.ts"],"names":[],"mappings":"AAqCA;;;;;;;;;GASG;AACH,wBAAgB,cAAc,IAAI,MAAM,CAEvC;AAED;kEACkE;AAClE,eAAO,MAAM,aAAa,QAAsB,CAAC;AAMjD;;;8CAG8C;AAC9C,wBAAgB,eAAe,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAS5D;AAED,wBAAgB,OAAO,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAGtF;AAMD,MAAM,WAAW,WAAW;IAC1B,sEAAsE;IACtE,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB;sFACkF;IAClF,SAAS,EAAE,MAAM,CAAC;CACnB;AAED;mFACmF;AACnF,wBAAgB,eAAe,CAAC,IAA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ance: keeping an installed graft, and the wiring it wrote, current.
3
+ *
4
+ * Two independent kinds of staleness, both invisible to the user today:
5
+ *
6
+ * 1. **Binary staleness** — they installed once and never upgraded. `graft
7
+ * version` would tell them, but nobody runs it. So we keep a cached,
8
+ * machine-global registry answer and let every entry point surface a
9
+ * one-line nudge from it.
10
+ *
11
+ * 2. **Wiring staleness** — `graft init` copies hooks, shims, skill text and
12
+ * rule files INTO the repo. `npm i -g` replaces the binary but touches none
13
+ * of them, so a repo wired by 0.7 keeps 0.7's prompts and 0.7's hook
14
+ * timeouts forever (see the comment on `promptAskTimeout`, which exists
15
+ * only to work around exactly this). A version stamp written next to the
16
+ * graph lets any entry point notice the skew and re-run the writes.
17
+ *
18
+ * Everything here is fail-soft by construction: it runs inside hooks and inside
19
+ * the MCP server's boot path, where a throw is a broken session, and it must
20
+ * never block on the network — the registry is only ever read from cache, and
21
+ * the refresh happens in a detached child.
22
+ *
23
+ * Called from all three hosts' entry points so no editor is left out:
24
+ * • Claude Code — `session-start` hook (src/claude/hooks.ts)
25
+ * • Cursor/Codex — MCP server boot (src/mcp/server.ts), and any CLI command
26
+ */
27
+ import { existsSync, readFileSync } from 'node:fs';
28
+ import { spawn } from 'node:child_process';
29
+ import { join } from 'node:path';
30
+ import { homedir } from 'node:os';
31
+ import { readJson, writeJsonAtomic, cacheDir } from './util/state.js';
32
+ import { HOSTS, hostRelPath } from './hosts/registry.js';
33
+ import { markersFor } from './hosts/sections.js';
34
+ import { getNpmViewVersion, readCurrentVersion } from './cli-meta.js';
35
+ import { brand } from './brand.js';
36
+ import { graftCliPath } from './claude/paths.js';
37
+ /**
38
+ * The version of the graft package this code was loaded from.
39
+ *
40
+ * Resolved from *this* module rather than the caller's: `readCurrentVersion`
41
+ * looks one level up from the module URL it's given, which lands on the package
42
+ * root for `dist/upkeep.js` but misses entirely for `dist/claude/hooks.js` and
43
+ * `dist/mcp/server.js`. Every caller asking here instead of passing its own
44
+ * `import.meta.url` is what keeps the hook and the MCP server from reading
45
+ * `0.0.0` and re-initing on every single session.
46
+ */
47
+ export function runningVersion() {
48
+ try {
49
+ return readCurrentVersion(import.meta.url);
50
+ }
51
+ catch {
52
+ return '0.0.0';
53
+ }
54
+ }
55
+ /** How long a registry answer is considered current. A day: graft ships far less
56
+ * often than that, and this is a nudge, not a security update. */
57
+ export const UPDATE_TTL_MS = 24 * 60 * 60 * 1000;
58
+ /* -------------------------------------------------------------------------- */
59
+ /* version comparison */
60
+ /* -------------------------------------------------------------------------- */
61
+ /** Numeric-dotted compare of the release part only (`1.2.3-beta.1` → `1.2.3`).
62
+ * Prerelease ordering doesn't matter here: the only question either caller asks
63
+ * is "is the thing on npm ahead of what's on disk", and a prerelease that
64
+ * compares equal simply produces no nudge. */
65
+ export function compareVersions(a, b) {
66
+ const parts = (v) => String(v).split('-')[0].split('.').map((n) => Number(n) || 0);
67
+ const pa = parts(a);
68
+ const pb = parts(b);
69
+ for (let i = 0; i < Math.max(pa.length, pb.length); i++) {
70
+ const d = (pa[i] ?? 0) - (pb[i] ?? 0);
71
+ if (d !== 0)
72
+ return d < 0 ? -1 : 1;
73
+ }
74
+ return 0;
75
+ }
76
+ export function isNewer(candidate, current) {
77
+ if (!candidate)
78
+ return false;
79
+ return compareVersions(candidate, current) > 0;
80
+ }
81
+ /** Machine-global, not per-repo: "what's the latest graft" is one fact, and a
82
+ * dev with twelve repos should cost the registry one request a day, not twelve. */
83
+ export function updateCachePath(home = homedir()) {
84
+ return join(home, '.graft', 'update-check.json');
85
+ }
86
+ export function readUpdateCache(home) {
87
+ return readJson(updateCachePath(home));
88
+ }
89
+ function writeUpdateCache(cache, home) {
90
+ try {
91
+ writeJsonAtomic(updateCachePath(home), cache);
92
+ }
93
+ catch { /* unwritable home — skip */ }
94
+ }
95
+ /**
96
+ * The `graft _update-check` command body: hit the registry, store the answer.
97
+ * Runs in a detached child so nothing user-facing ever waits on the network.
98
+ */
99
+ export function refreshUpdateCache(home, now = Date.now()) {
100
+ const res = getNpmViewVersion();
101
+ const cache = { latest: res.ok ? (res.version ?? null) : null, checkedAt: now };
102
+ writeUpdateCache(cache, home);
103
+ return cache;
104
+ }
105
+ /** True when the cached answer is missing or older than the TTL. */
106
+ export function needsRefresh(cache, now = Date.now()) {
107
+ return !cache || typeof cache.checkedAt !== 'number' || now - cache.checkedAt >= UPDATE_TTL_MS;
108
+ }
109
+ /**
110
+ * Kick off a background registry check if the cache has gone stale. Touches
111
+ * `checkedAt` first so concurrent callers (and a child that dies) don't spawn a
112
+ * fetch per invocation. Never waits, never throws.
113
+ *
114
+ * Only called from long-lived or already-slow contexts (a CLI command, MCP
115
+ * boot) — never from a hook, which reads the cache and nothing else.
116
+ */
117
+ export function maybeRefreshInBackground(home, now = Date.now(), env = process.env) {
118
+ const doNotTrack = env.DO_NOT_TRACK;
119
+ if (doNotTrack !== undefined && doNotTrack !== '' && doNotTrack !== '0')
120
+ return false;
121
+ const cache = readUpdateCache(home);
122
+ if (!needsRefresh(cache, now))
123
+ return false;
124
+ writeUpdateCache({ latest: cache?.latest ?? null, checkedAt: now }, home);
125
+ try {
126
+ const child = spawn(process.execPath, [graftCliPath(), '_update-check'], {
127
+ detached: true,
128
+ stdio: 'ignore',
129
+ windowsHide: true,
130
+ });
131
+ child.unref();
132
+ return true;
133
+ }
134
+ catch {
135
+ return false; // no spawn (sandbox, ENOMEM) — the nudge just uses the old cache
136
+ }
137
+ }
138
+ /** One line, or nothing. Nothing is the common case — don't spend context on
139
+ * "you're up to date". */
140
+ export function formatUpdateNudge(current, latest) {
141
+ if (!isNewer(latest, current))
142
+ return null;
143
+ // `upgrade`, not a bare npm install: under graft it brings the trail command along.
144
+ return `⬆ ${brand()} ${current} → ${latest} available: run \`${brand()} upgrade\` (restart your agent after).`;
145
+ }
146
+ export const DEFAULT_WIRING_OPTS = { global: true, mcp: true, hooks: true, statusline: true };
147
+ /** An older stamp has no `opts`; a plain `graft init` wired everything. */
148
+ export function wiringOpts(stamp) {
149
+ return { ...DEFAULT_WIRING_OPTS, ...(stamp?.opts ?? {}) };
150
+ }
151
+ /** Under `graft/.cache/`, beside the other derived state: git-ignored, per-clone,
152
+ * and cheap to lose — a missing stamp just means one idempotent refresh. */
153
+ export function stampPath(repo) {
154
+ return join(cacheDir(repo), 'wiring-stamp.json');
155
+ }
156
+ export function readStamp(repo) {
157
+ return readJson(stampPath(repo));
158
+ }
159
+ export function writeStamp(repo, version, hosts, opts = {}, at = new Date().toISOString()) {
160
+ try {
161
+ writeJsonAtomic(stampPath(repo), {
162
+ version,
163
+ hosts: [...hosts].sort(),
164
+ opts: { ...DEFAULT_WIRING_OPTS, ...opts },
165
+ at,
166
+ });
167
+ }
168
+ catch { /* unwritable graft/ — a refresh will just be retried next session */ }
169
+ }
170
+ /**
171
+ * Which agents this repo is *already* wired for, read off disk rather than
172
+ * re-detected. Detection answers "which editors does this machine have"; for a
173
+ * refresh we need "which files did a previous init actually write" — otherwise
174
+ * installing Windsurf once would silently add graft rules to every repo.
175
+ */
176
+ export function wiredHostIds(repo) {
177
+ const ids = [];
178
+ if (existsSync(join(repo, '.trail', 'hook.cjs')) || ['graft', 'trail'].some((n) => existsSync(join(repo, '.claude', 'helpers', `${n}-hooks.cjs`))))
179
+ ids.push('claude');
180
+ for (const host of HOSTS) {
181
+ // Under either name: a repo on trail has trail's files and blocks.
182
+ const wired = ['graft', 'trail'].some((n) => {
183
+ const path = join(repo, hostRelPath(host, n));
184
+ if (!existsSync(path))
185
+ return false;
186
+ // A shared file (AGENTS.md, GEMINI.md) counts only if graft's fenced section
187
+ // is in it — the user may own the file for entirely unrelated reasons.
188
+ if (host.kind === 'section') {
189
+ try {
190
+ return readFileSync(path, 'utf8').includes(markersFor(n).start);
191
+ }
192
+ catch {
193
+ return false;
194
+ }
195
+ }
196
+ return true;
197
+ });
198
+ if (wired)
199
+ ids.push(host.id);
200
+ }
201
+ return ids;
202
+ }
203
+ /**
204
+ * Re-run init's writes when the stamp and the running binary disagree.
205
+ *
206
+ * Deliberately narrow: it refreshes the hosts already wired, replays the flags
207
+ * that init was given, never builds the graph (this runs at session start — a
208
+ * rebuild there would stall the agent's first turn), and no-ops when the repo has
209
+ * no graft wiring at all.
210
+ *
211
+ * `toTrail` says whether this repo should move from graft's wiring to trail's
212
+ * (see upkeep-run.ts). When it should, the refresh runs whatever the stamp says:
213
+ * the person installed trail, which is the signal, whether or not graft's own
214
+ * version moved.
215
+ */
216
+ export function reconcileWiring(repo, current, deps) {
217
+ try {
218
+ const stamp = readStamp(repo);
219
+ const toTrail = deps.toTrail?.(repo) ?? false;
220
+ if (stamp && stamp.version === current && !toTrail)
221
+ return null;
222
+ // The stamp is the record of *intent* (what the picker chose); disk is the
223
+ // fallback for repos wired before stamps existed. Union, not just disk:
224
+ // otherwise a host whose rule file went missing — deleted by hand, lost to a
225
+ // merge, or clobbered by another tool — is silently dropped from every future
226
+ // refresh, and that file is precisely what a refresh exists to restore.
227
+ const onDisk = (deps.wired ?? wiredHostIds)(repo);
228
+ const hosts = [...new Set([...(stamp?.hosts ?? []), ...onDisk])].sort();
229
+ if (hosts.length === 0)
230
+ return null; // never wired here — not our business
231
+ const opts = wiringOpts(stamp);
232
+ deps.rewrite(repo, hosts, opts, toTrail);
233
+ writeStamp(repo, current, hosts, opts);
234
+ return { from: stamp?.version ?? 'unwired', to: current, hosts, global: opts.global, ...(toTrail ? { switched: true } : {}) };
235
+ }
236
+ catch {
237
+ return null; // a refresh is an optimization; never fail the caller over it
238
+ }
239
+ }
240
+ export function formatWiringRefresh(r) {
241
+ if (!r)
242
+ return null;
243
+ // Said to the agent at session start, which is who can tell the person.
244
+ if (r.switched)
245
+ return (`[trail] graft is now trail, and this repo just moved to it: the same commands under the new name, plus learnings in .trail/learnings/ for everyone working in this repo. ` +
246
+ `Tell the user this once, in a line at the end of your first reply, and that committing .trail/ and .claude/settings.json once moves the repo over for everyone working in it.`);
247
+ // Name the out-of-repo writes explicitly: those are machine-wide and shared by
248
+ // every repo, so a user seeing this line should not have to guess what moved.
249
+ const scope = r.global && r.hosts.includes('agents') ? " (including this machine's ~/.codex config)" : '';
250
+ return `· graft refreshed this repo's agent wiring${scope} (written by ${r.from}, now ${r.to}): ${r.hosts.join(', ')}.`;
251
+ }
252
+ //# sourceMappingURL=upkeep.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"upkeep.js","sourceRoot":"","sources":["../src/upkeep.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC3C,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,QAAQ,EAAE,eAAe,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AACtE,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AACtE,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEjD;;;;;;;;;GASG;AACH,MAAM,UAAU,cAAc;IAC5B,IAAI,CAAC;QAAC,OAAO,kBAAkB,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAAC,CAAC;IAAC,MAAM,CAAC;QAAC,OAAO,OAAO,CAAC;IAAC,CAAC;AAC/E,CAAC;AAED;kEACkE;AAClE,MAAM,CAAC,MAAM,aAAa,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;AAEjD,gFAAgF;AAChF,gFAAgF;AAChF,gFAAgF;AAEhF;;;8CAG8C;AAC9C,MAAM,UAAU,eAAe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"file":"actions-folder.d.ts","sourceRoot":"","sources":["../../src/util/actions-folder.ts"],"names":[],"mappings":"AAQA,eAAO,MAAM,aAAa,GAAI,KAAK,MAAM,KAAG,MAA2C,CAAC"}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Where a checkout keeps its GitHub Actions files. It lives outside
3
+ * src/skills because the folder's name holds a word the skills copy never
4
+ * uses (phase 2 design rule 6, P22): copy calls it "this repo's GitHub
5
+ * Actions folder", never by its path.
6
+ */
7
+ import { join } from 'node:path';
8
+ export const actionsFolder = (top) => join(top, '.github', 'workflows');
9
+ //# sourceMappingURL=actions-folder.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"actions-folder.js","sourceRoot":"","sources":["../../src/util/actions-folder.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,GAAW,EAAU,EAAE,CAAC,IAAI,CAAC,GAAG,EAAE,SAAS,EAAE,WAAW,CAAC,CAAC"}
@@ -0,0 +1,3 @@
1
+ /** Open `url` in the default browser. Best-effort: the printed URL is the fallback. */
2
+ export declare function openBrowser(url: string): void;
3
+ //# sourceMappingURL=browser.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"browser.d.ts","sourceRoot":"","sources":["../../src/util/browser.ts"],"names":[],"mappings":"AAEA,uFAAuF;AACvF,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAQ7C"}
@@ -0,0 +1,14 @@
1
+ import { spawn } from "node:child_process";
2
+ /** Open `url` in the default browser. Best-effort: the printed URL is the fallback. */
3
+ export function openBrowser(url) {
4
+ if (process.env.GRAFT_NO_BROWSER)
5
+ return;
6
+ const opener = process.platform === "darwin" ? "open" : process.platform === "win32" ? "start" : "xdg-open";
7
+ try {
8
+ spawn(opener, [url], { stdio: "ignore", detached: true, shell: process.platform === "win32" }).unref();
9
+ }
10
+ catch {
11
+ /* the printed URL is the fallback */
12
+ }
13
+ }
14
+ //# sourceMappingURL=browser.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"browser.js","sourceRoot":"","sources":["../../src/util/browser.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAE3C,uFAAuF;AACvF,MAAM,UAAU,WAAW,CAAC,GAAW;IACrC,IAAI,OAAO,CAAC,GAAG,CAAC,gBAAgB;QAAE,OAAO;IACzC,MAAM,MAAM,GAAG,OAAO,CAAC,QAAQ,KAAK,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,QAAQ,KAAK,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,UAAU,CAAC;IAC5G,IAAI,CAAC;QACH,KAAK,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,EAAE,EAAE,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,CAAC,QAAQ,KAAK,OAAO,EAAE,CAAC,CAAC,KAAK,EAAE,CAAC;IACzG,CAAC;IAAC,MAAM,CAAC;QACP,qCAAqC;IACvC,CAAC;AACH,CAAC"}
@@ -0,0 +1,15 @@
1
+ /**
2
+ * windowsHide option for child_process calls.
3
+ * Spread into execFileSync / spawnSync options to suppress CMD windows on Windows.
4
+ *
5
+ * Usage: execFileSync("git", args, { encoding: "utf8", ...WINHIDE, ... })
6
+ *
7
+ * On Linux/macOS this is an empty object — no effect.
8
+ * On Windows this adds windowsHide: true to every child_process call,
9
+ * preventing the 100+ CMD flashes that appear during `trail init` on a
10
+ * workspace with many repos (each git/gh call was opening a console window).
11
+ */
12
+ export declare const WINHIDE: {
13
+ windowsHide?: true;
14
+ };
15
+ //# sourceMappingURL=child-process.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"child-process.d.ts","sourceRoot":"","sources":["../../src/util/child-process.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,eAAO,MAAM,OAAO;kBAEM,IAAI;CAAE,CAAC"}
@@ -0,0 +1,15 @@
1
+ /**
2
+ * windowsHide option for child_process calls.
3
+ * Spread into execFileSync / spawnSync options to suppress CMD windows on Windows.
4
+ *
5
+ * Usage: execFileSync("git", args, { encoding: "utf8", ...WINHIDE, ... })
6
+ *
7
+ * On Linux/macOS this is an empty object — no effect.
8
+ * On Windows this adds windowsHide: true to every child_process call,
9
+ * preventing the 100+ CMD flashes that appear during `trail init` on a
10
+ * workspace with many repos (each git/gh call was opening a console window).
11
+ */
12
+ export const WINHIDE = process.platform === "win32"
13
+ ? { windowsHide: true }
14
+ : {};
15
+ //# sourceMappingURL=child-process.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"child-process.js","sourceRoot":"","sources":["../../src/util/child-process.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,OAAO,GAAG,OAAO,CAAC,QAAQ,KAAK,OAAO;IACjD,CAAC,CAAC,EAAE,WAAW,EAAE,IAAa,EAAE;IAChC,CAAC,CAAC,EAA4B,CAAC"}