@ruverd/julius 0.0.0-stage → 0.24.1

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 (704) hide show
  1. package/CHANGELOG.md +47 -0
  2. package/CREDITS.md +25 -0
  3. package/LICENSE +21 -0
  4. package/PROVENANCE.md +9 -0
  5. package/README.md +229 -2
  6. package/dist/ai/crux.d.ts +60 -0
  7. package/dist/ai/crux.d.ts.map +1 -0
  8. package/dist/ai/crux.js +141 -0
  9. package/dist/ai/crux.js.map +1 -0
  10. package/dist/ai/failure.d.ts +60 -0
  11. package/dist/ai/failure.d.ts.map +1 -0
  12. package/dist/ai/failure.js +86 -0
  13. package/dist/ai/failure.js.map +1 -0
  14. package/dist/ai/llm/anthropic.d.ts +37 -0
  15. package/dist/ai/llm/anthropic.d.ts.map +1 -0
  16. package/dist/ai/llm/anthropic.js +144 -0
  17. package/dist/ai/llm/anthropic.js.map +1 -0
  18. package/dist/ai/llm/factory.d.ts +28 -0
  19. package/dist/ai/llm/factory.d.ts.map +1 -0
  20. package/dist/ai/llm/factory.js +36 -0
  21. package/dist/ai/llm/factory.js.map +1 -0
  22. package/dist/ai/llm/litellm.d.ts +34 -0
  23. package/dist/ai/llm/litellm.d.ts.map +1 -0
  24. package/dist/ai/llm/litellm.js +45 -0
  25. package/dist/ai/llm/litellm.js.map +1 -0
  26. package/dist/ai/llm/openai.d.ts +44 -0
  27. package/dist/ai/llm/openai.d.ts.map +1 -0
  28. package/dist/ai/llm/openai.js +239 -0
  29. package/dist/ai/llm/openai.js.map +1 -0
  30. package/dist/ai/llm/orcarouter.d.ts +34 -0
  31. package/dist/ai/llm/orcarouter.d.ts.map +1 -0
  32. package/dist/ai/llm/orcarouter.js +45 -0
  33. package/dist/ai/llm/orcarouter.js.map +1 -0
  34. package/dist/ai/llm/recover-tool.d.ts +19 -0
  35. package/dist/ai/llm/recover-tool.d.ts.map +1 -0
  36. package/dist/ai/llm/recover-tool.js +109 -0
  37. package/dist/ai/llm/recover-tool.js.map +1 -0
  38. package/dist/ai/llm/types.d.ts +122 -0
  39. package/dist/ai/llm/types.d.ts.map +1 -0
  40. package/dist/ai/llm/types.js +33 -0
  41. package/dist/ai/llm/types.js.map +1 -0
  42. package/dist/ai/providers.d.ts +59 -0
  43. package/dist/ai/providers.d.ts.map +1 -0
  44. package/dist/ai/providers.js +54 -0
  45. package/dist/ai/providers.js.map +1 -0
  46. package/dist/ai/summarize.d.ts +25 -0
  47. package/dist/ai/summarize.d.ts.map +1 -0
  48. package/dist/ai/summarize.js +34 -0
  49. package/dist/ai/summarize.js.map +1 -0
  50. package/dist/ai/synthesize.d.ts +40 -0
  51. package/dist/ai/synthesize.d.ts.map +1 -0
  52. package/dist/ai/synthesize.js +131 -0
  53. package/dist/ai/synthesize.js.map +1 -0
  54. package/dist/app/checkout.d.ts +46 -0
  55. package/dist/app/checkout.d.ts.map +1 -0
  56. package/dist/app/checkout.js +223 -0
  57. package/dist/app/checkout.js.map +1 -0
  58. package/dist/app/events.d.ts +44 -0
  59. package/dist/app/events.d.ts.map +1 -0
  60. package/dist/app/events.js +64 -0
  61. package/dist/app/events.js.map +1 -0
  62. package/dist/app/identity.d.ts +54 -0
  63. package/dist/app/identity.d.ts.map +1 -0
  64. package/dist/app/identity.js +96 -0
  65. package/dist/app/identity.js.map +1 -0
  66. package/dist/app/main.d.ts +2 -0
  67. package/dist/app/main.d.ts.map +1 -0
  68. package/dist/app/main.js +62 -0
  69. package/dist/app/main.js.map +1 -0
  70. package/dist/app/pages.d.ts +56 -0
  71. package/dist/app/pages.d.ts.map +1 -0
  72. package/dist/app/pages.js +193 -0
  73. package/dist/app/pages.js.map +1 -0
  74. package/dist/app/queue.d.ts +40 -0
  75. package/dist/app/queue.d.ts.map +1 -0
  76. package/dist/app/queue.js +68 -0
  77. package/dist/app/queue.js.map +1 -0
  78. package/dist/app/review-process.d.ts +66 -0
  79. package/dist/app/review-process.d.ts.map +1 -0
  80. package/dist/app/review-process.js +200 -0
  81. package/dist/app/review-process.js.map +1 -0
  82. package/dist/app/review-worker.d.ts +2 -0
  83. package/dist/app/review-worker.d.ts.map +1 -0
  84. package/dist/app/review-worker.js +108 -0
  85. package/dist/app/review-worker.js.map +1 -0
  86. package/dist/app/review.d.ts +23 -0
  87. package/dist/app/review.d.ts.map +1 -0
  88. package/dist/app/review.js +142 -0
  89. package/dist/app/review.js.map +1 -0
  90. package/dist/app/server.d.ts +49 -0
  91. package/dist/app/server.d.ts.map +1 -0
  92. package/dist/app/server.js +123 -0
  93. package/dist/app/server.js.map +1 -0
  94. package/dist/ask/ask.d.ts +195 -0
  95. package/dist/ask/ask.d.ts.map +1 -0
  96. package/dist/ask/ask.js +1252 -0
  97. package/dist/ask/ask.js.map +1 -0
  98. package/dist/ask/file-rank.d.ts +72 -0
  99. package/dist/ask/file-rank.d.ts.map +1 -0
  100. package/dist/ask/file-rank.js +160 -0
  101. package/dist/ask/file-rank.js.map +1 -0
  102. package/dist/ask/file-selection.d.ts +22 -0
  103. package/dist/ask/file-selection.d.ts.map +1 -0
  104. package/dist/ask/file-selection.js +66 -0
  105. package/dist/ask/file-selection.js.map +1 -0
  106. package/dist/ask/fuse.d.ts +195 -0
  107. package/dist/ask/fuse.d.ts.map +1 -0
  108. package/dist/ask/fuse.js +344 -0
  109. package/dist/ask/fuse.js.map +1 -0
  110. package/dist/ask/graphrank.d.ts +61 -0
  111. package/dist/ask/graphrank.d.ts.map +1 -0
  112. package/dist/ask/graphrank.js +130 -0
  113. package/dist/ask/graphrank.js.map +1 -0
  114. package/dist/ask/index-file.d.ts +44 -0
  115. package/dist/ask/index-file.d.ts.map +1 -0
  116. package/dist/ask/index-file.js +128 -0
  117. package/dist/ask/index-file.js.map +1 -0
  118. package/dist/bin/julius.d.ts +3 -0
  119. package/dist/bin/julius.d.ts.map +1 -0
  120. package/dist/bin/julius.js +4 -0
  121. package/dist/bin/julius.js.map +1 -0
  122. package/dist/blast/blast-cli.d.ts +35 -0
  123. package/dist/blast/blast-cli.d.ts.map +1 -0
  124. package/dist/blast/blast-cli.js +155 -0
  125. package/dist/blast/blast-cli.js.map +1 -0
  126. package/dist/blast/blast.d.ts +128 -0
  127. package/dist/blast/blast.d.ts.map +1 -0
  128. package/dist/blast/blast.js +383 -0
  129. package/dist/blast/blast.js.map +1 -0
  130. package/dist/blast/diff.d.ts +53 -0
  131. package/dist/blast/diff.d.ts.map +1 -0
  132. package/dist/blast/diff.js +193 -0
  133. package/dist/blast/diff.js.map +1 -0
  134. package/dist/blast/evidence.d.ts +51 -0
  135. package/dist/blast/evidence.d.ts.map +1 -0
  136. package/dist/blast/evidence.js +162 -0
  137. package/dist/blast/evidence.js.map +1 -0
  138. package/dist/blast/modules.d.ts +33 -0
  139. package/dist/blast/modules.d.ts.map +1 -0
  140. package/dist/blast/modules.js +83 -0
  141. package/dist/blast/modules.js.map +1 -0
  142. package/dist/blast/name.d.ts +74 -0
  143. package/dist/blast/name.d.ts.map +1 -0
  144. package/dist/blast/name.js +269 -0
  145. package/dist/blast/name.js.map +1 -0
  146. package/dist/blast/owners.d.ts +85 -0
  147. package/dist/blast/owners.d.ts.map +1 -0
  148. package/dist/blast/owners.js +272 -0
  149. package/dist/blast/owners.js.map +1 -0
  150. package/dist/blast/render.d.ts +46 -0
  151. package/dist/blast/render.d.ts.map +1 -0
  152. package/dist/blast/render.js +422 -0
  153. package/dist/blast/render.js.map +1 -0
  154. package/dist/blast/viz.d.ts +37 -0
  155. package/dist/blast/viz.d.ts.map +1 -0
  156. package/dist/blast/viz.js +180 -0
  157. package/dist/blast/viz.js.map +1 -0
  158. package/dist/brand.d.ts +13 -0
  159. package/dist/brand.d.ts.map +1 -0
  160. package/dist/brand.js +43 -0
  161. package/dist/brand.js.map +1 -0
  162. package/dist/check/learning-edits.d.ts +9 -0
  163. package/dist/check/learning-edits.d.ts.map +1 -0
  164. package/dist/check/learning-edits.js +62 -0
  165. package/dist/check/learning-edits.js.map +1 -0
  166. package/dist/check/local-check.d.ts +104 -0
  167. package/dist/check/local-check.d.ts.map +1 -0
  168. package/dist/check/local-check.js +830 -0
  169. package/dist/check/local-check.js.map +1 -0
  170. package/dist/check/types.d.ts +31 -0
  171. package/dist/check/types.d.ts.map +1 -0
  172. package/dist/check/types.js +2 -0
  173. package/dist/check/types.js.map +1 -0
  174. package/dist/claude/build-progress.d.ts +29 -0
  175. package/dist/claude/build-progress.d.ts.map +1 -0
  176. package/dist/claude/build-progress.js +76 -0
  177. package/dist/claude/build-progress.js.map +1 -0
  178. package/dist/claude/format.d.ts +131 -0
  179. package/dist/claude/format.d.ts.map +1 -0
  180. package/dist/claude/format.js +328 -0
  181. package/dist/claude/format.js.map +1 -0
  182. package/dist/claude/hook-layers.d.ts +8 -0
  183. package/dist/claude/hook-layers.d.ts.map +1 -0
  184. package/dist/claude/hook-layers.js +74 -0
  185. package/dist/claude/hook-layers.js.map +1 -0
  186. package/dist/claude/hooks.d.ts +101 -0
  187. package/dist/claude/hooks.d.ts.map +1 -0
  188. package/dist/claude/hooks.js +849 -0
  189. package/dist/claude/hooks.js.map +1 -0
  190. package/dist/claude/init.d.ts +70 -0
  191. package/dist/claude/init.d.ts.map +1 -0
  192. package/dist/claude/init.js +207 -0
  193. package/dist/claude/init.js.map +1 -0
  194. package/dist/claude/note-signals.d.ts +28 -0
  195. package/dist/claude/note-signals.d.ts.map +1 -0
  196. package/dist/claude/note-signals.js +325 -0
  197. package/dist/claude/note-signals.js.map +1 -0
  198. package/dist/claude/paths.d.ts +9 -0
  199. package/dist/claude/paths.d.ts.map +1 -0
  200. package/dist/claude/paths.js +22 -0
  201. package/dist/claude/paths.js.map +1 -0
  202. package/dist/claude/session-metrics.d.ts +73 -0
  203. package/dist/claude/session-metrics.d.ts.map +1 -0
  204. package/dist/claude/session-metrics.js +209 -0
  205. package/dist/claude/session-metrics.js.map +1 -0
  206. package/dist/claude/settings-merge.d.ts +66 -0
  207. package/dist/claude/settings-merge.d.ts.map +1 -0
  208. package/dist/claude/settings-merge.js +249 -0
  209. package/dist/claude/settings-merge.js.map +1 -0
  210. package/dist/claude/shim-template.d.ts +18 -0
  211. package/dist/claude/shim-template.d.ts.map +1 -0
  212. package/dist/claude/shim-template.js +226 -0
  213. package/dist/claude/shim-template.js.map +1 -0
  214. package/dist/claude/skill-template.d.ts +12 -0
  215. package/dist/claude/skill-template.d.ts.map +1 -0
  216. package/dist/claude/skill-template.js +294 -0
  217. package/dist/claude/skill-template.js.map +1 -0
  218. package/dist/claude/state.d.ts +73 -0
  219. package/dist/claude/state.d.ts.map +1 -0
  220. package/dist/claude/state.js +33 -0
  221. package/dist/claude/state.js.map +1 -0
  222. package/dist/claude/stats.d.ts +5 -0
  223. package/dist/claude/stats.d.ts.map +1 -0
  224. package/dist/claude/stats.js +24 -0
  225. package/dist/claude/stats.js.map +1 -0
  226. package/dist/claude/statusline.d.ts +14 -0
  227. package/dist/claude/statusline.d.ts.map +1 -0
  228. package/dist/claude/statusline.js +45 -0
  229. package/dist/claude/statusline.js.map +1 -0
  230. package/dist/claude/sync-run.d.ts +3 -0
  231. package/dist/claude/sync-run.d.ts.map +1 -0
  232. package/dist/claude/sync-run.js +46 -0
  233. package/dist/claude/sync-run.js.map +1 -0
  234. package/dist/claude/tally.d.ts +50 -0
  235. package/dist/claude/tally.d.ts.map +1 -0
  236. package/dist/claude/tally.js +211 -0
  237. package/dist/claude/tally.js.map +1 -0
  238. package/dist/cli-epilogue.d.ts +12 -0
  239. package/dist/cli-epilogue.d.ts.map +1 -0
  240. package/dist/cli-epilogue.js +55 -0
  241. package/dist/cli-epilogue.js.map +1 -0
  242. package/dist/cli-meta.d.ts +45 -0
  243. package/dist/cli-meta.d.ts.map +1 -0
  244. package/dist/cli-meta.js +145 -0
  245. package/dist/cli-meta.js.map +1 -0
  246. package/dist/cli-picker.d.ts +129 -0
  247. package/dist/cli-picker.d.ts.map +1 -0
  248. package/dist/cli-picker.js +432 -0
  249. package/dist/cli-picker.js.map +1 -0
  250. package/dist/cli.d.ts +3 -0
  251. package/dist/cli.d.ts.map +1 -0
  252. package/dist/cli.js +2213 -0
  253. package/dist/cli.js.map +1 -0
  254. package/dist/cloud/diff.d.ts +20 -0
  255. package/dist/cloud/diff.d.ts.map +1 -0
  256. package/dist/cloud/diff.js +59 -0
  257. package/dist/cloud/diff.js.map +1 -0
  258. package/dist/cloud/nudge.d.ts +66 -0
  259. package/dist/cloud/nudge.d.ts.map +1 -0
  260. package/dist/cloud/nudge.js +268 -0
  261. package/dist/cloud/nudge.js.map +1 -0
  262. package/dist/cloud/workspace-sync.d.ts +58 -0
  263. package/dist/cloud/workspace-sync.d.ts.map +1 -0
  264. package/dist/cloud/workspace-sync.js +268 -0
  265. package/dist/cloud/workspace-sync.js.map +1 -0
  266. package/dist/cloud/workspace.d.ts +159 -0
  267. package/dist/cloud/workspace.d.ts.map +1 -0
  268. package/dist/cloud/workspace.js +134 -0
  269. package/dist/cloud/workspace.js.map +1 -0
  270. package/dist/context/build.d.ts +52 -0
  271. package/dist/context/build.d.ts.map +1 -0
  272. package/dist/context/build.js +362 -0
  273. package/dist/context/build.js.map +1 -0
  274. package/dist/context/check.d.ts +42 -0
  275. package/dist/context/check.d.ts.map +1 -0
  276. package/dist/context/check.js +162 -0
  277. package/dist/context/check.js.map +1 -0
  278. package/dist/context/map-dir.d.ts +4 -0
  279. package/dist/context/map-dir.d.ts.map +1 -0
  280. package/dist/context/map-dir.js +6 -0
  281. package/dist/context/map-dir.js.map +1 -0
  282. package/dist/context/node-file.d.ts +109 -0
  283. package/dist/context/node-file.d.ts.map +1 -0
  284. package/dist/context/node-file.js +362 -0
  285. package/dist/context/node-file.js.map +1 -0
  286. package/dist/context/price.d.ts +49 -0
  287. package/dist/context/price.d.ts.map +1 -0
  288. package/dist/context/price.js +83 -0
  289. package/dist/context/price.js.map +1 -0
  290. package/dist/context/savings.d.ts +26 -0
  291. package/dist/context/savings.d.ts.map +1 -0
  292. package/dist/context/savings.js +59 -0
  293. package/dist/context/savings.js.map +1 -0
  294. package/dist/economy/cli.d.ts +3 -0
  295. package/dist/economy/cli.d.ts.map +1 -0
  296. package/dist/economy/cli.js +52 -0
  297. package/dist/economy/cli.js.map +1 -0
  298. package/dist/economy/delivery.d.ts +49 -0
  299. package/dist/economy/delivery.d.ts.map +1 -0
  300. package/dist/economy/delivery.js +176 -0
  301. package/dist/economy/delivery.js.map +1 -0
  302. package/dist/economy/index.d.ts +68 -0
  303. package/dist/economy/index.d.ts.map +1 -0
  304. package/dist/economy/index.js +524 -0
  305. package/dist/economy/index.js.map +1 -0
  306. package/dist/engine.d.ts +83 -0
  307. package/dist/engine.d.ts.map +1 -0
  308. package/dist/engine.js +122 -0
  309. package/dist/engine.js.map +1 -0
  310. package/dist/evaluation/index.d.ts +41 -0
  311. package/dist/evaluation/index.d.ts.map +1 -0
  312. package/dist/evaluation/index.js +61 -0
  313. package/dist/evaluation/index.js.map +1 -0
  314. package/dist/graph/bindings.d.ts +64 -0
  315. package/dist/graph/bindings.d.ts.map +1 -0
  316. package/dist/graph/bindings.js +713 -0
  317. package/dist/graph/bindings.js.map +1 -0
  318. package/dist/graph/build.d.ts +88 -0
  319. package/dist/graph/build.d.ts.map +1 -0
  320. package/dist/graph/build.js +375 -0
  321. package/dist/graph/build.js.map +1 -0
  322. package/dist/graph/cards.d.ts +46 -0
  323. package/dist/graph/cards.d.ts.map +1 -0
  324. package/dist/graph/cards.js +280 -0
  325. package/dist/graph/cards.js.map +1 -0
  326. package/dist/graph/check.d.ts +25 -0
  327. package/dist/graph/check.d.ts.map +1 -0
  328. package/dist/graph/check.js +192 -0
  329. package/dist/graph/check.js.map +1 -0
  330. package/dist/graph/container.d.ts +63 -0
  331. package/dist/graph/container.d.ts.map +1 -0
  332. package/dist/graph/container.js +190 -0
  333. package/dist/graph/container.js.map +1 -0
  334. package/dist/graph/enrich.d.ts +62 -0
  335. package/dist/graph/enrich.d.ts.map +1 -0
  336. package/dist/graph/enrich.js +253 -0
  337. package/dist/graph/enrich.js.map +1 -0
  338. package/dist/graph/extract-cache.d.ts +101 -0
  339. package/dist/graph/extract-cache.d.ts.map +1 -0
  340. package/dist/graph/extract-cache.js +199 -0
  341. package/dist/graph/extract-cache.js.map +1 -0
  342. package/dist/graph/extract.d.ts +85 -0
  343. package/dist/graph/extract.d.ts.map +1 -0
  344. package/dist/graph/extract.js +2376 -0
  345. package/dist/graph/extract.js.map +1 -0
  346. package/dist/graph/fingerprint.d.ts +76 -0
  347. package/dist/graph/fingerprint.d.ts.map +1 -0
  348. package/dist/graph/fingerprint.js +160 -0
  349. package/dist/graph/fingerprint.js.map +1 -0
  350. package/dist/graph/generic.d.ts +74 -0
  351. package/dist/graph/generic.d.ts.map +1 -0
  352. package/dist/graph/generic.js +580 -0
  353. package/dist/graph/generic.js.map +1 -0
  354. package/dist/graph/invariants.d.ts +33 -0
  355. package/dist/graph/invariants.d.ts.map +1 -0
  356. package/dist/graph/invariants.js +52 -0
  357. package/dist/graph/invariants.js.map +1 -0
  358. package/dist/graph/load.d.ts +29 -0
  359. package/dist/graph/load.d.ts.map +1 -0
  360. package/dist/graph/load.js +97 -0
  361. package/dist/graph/load.js.map +1 -0
  362. package/dist/graph/lsp/client.d.ts +43 -0
  363. package/dist/graph/lsp/client.d.ts.map +1 -0
  364. package/dist/graph/lsp/client.js +179 -0
  365. package/dist/graph/lsp/client.js.map +1 -0
  366. package/dist/graph/lsp/enrich.d.ts +11 -0
  367. package/dist/graph/lsp/enrich.d.ts.map +1 -0
  368. package/dist/graph/lsp/enrich.js +155 -0
  369. package/dist/graph/lsp/enrich.js.map +1 -0
  370. package/dist/graph/lsp/registry.d.ts +15 -0
  371. package/dist/graph/lsp/registry.d.ts.map +1 -0
  372. package/dist/graph/lsp/registry.js +46 -0
  373. package/dist/graph/lsp/registry.js.map +1 -0
  374. package/dist/graph/map.d.ts +107 -0
  375. package/dist/graph/map.d.ts.map +1 -0
  376. package/dist/graph/map.js +239 -0
  377. package/dist/graph/map.js.map +1 -0
  378. package/dist/graph/native.d.ts +38 -0
  379. package/dist/graph/native.d.ts.map +1 -0
  380. package/dist/graph/native.js +169 -0
  381. package/dist/graph/native.js.map +1 -0
  382. package/dist/graph/queries/c.scm +13 -0
  383. package/dist/graph/queries/c_sharp.scm +19 -0
  384. package/dist/graph/queries/clojure.scm +58 -0
  385. package/dist/graph/queries/cpp.scm +23 -0
  386. package/dist/graph/queries/dart.scm +42 -0
  387. package/dist/graph/queries/elixir.scm +54 -0
  388. package/dist/graph/queries/java.scm +20 -0
  389. package/dist/graph/queries/kotlin.scm +43 -0
  390. package/dist/graph/queries/lua.scm +36 -0
  391. package/dist/graph/queries/nix.scm +32 -0
  392. package/dist/graph/queries/php.scm +40 -0
  393. package/dist/graph/queries/ruby.scm +65 -0
  394. package/dist/graph/queries/rust.scm +41 -0
  395. package/dist/graph/queries/scala.scm +66 -0
  396. package/dist/graph/queries/solidity.scm +43 -0
  397. package/dist/graph/queries/swift.scm +51 -0
  398. package/dist/graph/refresh.d.ts +49 -0
  399. package/dist/graph/refresh.d.ts.map +1 -0
  400. package/dist/graph/refresh.js +255 -0
  401. package/dist/graph/refresh.js.map +1 -0
  402. package/dist/graph/relations.d.ts +14 -0
  403. package/dist/graph/relations.d.ts.map +1 -0
  404. package/dist/graph/relations.js +8 -0
  405. package/dist/graph/relations.js.map +1 -0
  406. package/dist/graph/resolve.d.ts +17 -0
  407. package/dist/graph/resolve.d.ts.map +1 -0
  408. package/dist/graph/resolve.js +654 -0
  409. package/dist/graph/resolve.js.map +1 -0
  410. package/dist/graph/root.d.ts +11 -0
  411. package/dist/graph/root.d.ts.map +1 -0
  412. package/dist/graph/root.js +40 -0
  413. package/dist/graph/root.js.map +1 -0
  414. package/dist/graph/scopes.d.ts +42 -0
  415. package/dist/graph/scopes.d.ts.map +1 -0
  416. package/dist/graph/scopes.js +342 -0
  417. package/dist/graph/scopes.js.map +1 -0
  418. package/dist/graph/seed.d.ts +38 -0
  419. package/dist/graph/seed.d.ts.map +1 -0
  420. package/dist/graph/seed.js +226 -0
  421. package/dist/graph/seed.js.map +1 -0
  422. package/dist/graph/source-files.d.ts +40 -0
  423. package/dist/graph/source-files.d.ts.map +1 -0
  424. package/dist/graph/source-files.js +85 -0
  425. package/dist/graph/source-files.js.map +1 -0
  426. package/dist/graph/traverse-cli.d.ts +55 -0
  427. package/dist/graph/traverse-cli.d.ts.map +1 -0
  428. package/dist/graph/traverse-cli.js +189 -0
  429. package/dist/graph/traverse-cli.js.map +1 -0
  430. package/dist/graph/traverse.d.ts +112 -0
  431. package/dist/graph/traverse.d.ts.map +1 -0
  432. package/dist/graph/traverse.js +192 -0
  433. package/dist/graph/traverse.js.map +1 -0
  434. package/dist/graph/types.d.ts +78 -0
  435. package/dist/graph/types.d.ts.map +1 -0
  436. package/dist/graph/types.js +14 -0
  437. package/dist/graph/types.js.map +1 -0
  438. package/dist/graph/workspace-cli.d.ts +48 -0
  439. package/dist/graph/workspace-cli.d.ts.map +1 -0
  440. package/dist/graph/workspace-cli.js +102 -0
  441. package/dist/graph/workspace-cli.js.map +1 -0
  442. package/dist/graph/workspace.d.ts +135 -0
  443. package/dist/graph/workspace.d.ts.map +1 -0
  444. package/dist/graph/workspace.js +598 -0
  445. package/dist/graph/workspace.js.map +1 -0
  446. package/dist/graph/write.d.ts +13 -0
  447. package/dist/graph/write.d.ts.map +1 -0
  448. package/dist/graph/write.js +86 -0
  449. package/dist/graph/write.js.map +1 -0
  450. package/dist/hosts/antigravity.d.ts +8 -0
  451. package/dist/hosts/antigravity.d.ts.map +1 -0
  452. package/dist/hosts/antigravity.js +42 -0
  453. package/dist/hosts/antigravity.js.map +1 -0
  454. package/dist/hosts/claude-global.d.ts +36 -0
  455. package/dist/hosts/claude-global.d.ts.map +1 -0
  456. package/dist/hosts/claude-global.js +153 -0
  457. package/dist/hosts/claude-global.js.map +1 -0
  458. package/dist/hosts/codex-hooks.d.ts +11 -0
  459. package/dist/hosts/codex-hooks.d.ts.map +1 -0
  460. package/dist/hosts/codex-hooks.js +80 -0
  461. package/dist/hosts/codex-hooks.js.map +1 -0
  462. package/dist/hosts/config-write.d.ts +36 -0
  463. package/dist/hosts/config-write.d.ts.map +1 -0
  464. package/dist/hosts/config-write.js +64 -0
  465. package/dist/hosts/config-write.js.map +1 -0
  466. package/dist/hosts/cursor-hooks.d.ts +21 -0
  467. package/dist/hosts/cursor-hooks.d.ts.map +1 -0
  468. package/dist/hosts/cursor-hooks.js +103 -0
  469. package/dist/hosts/cursor-hooks.js.map +1 -0
  470. package/dist/hosts/init.d.ts +26 -0
  471. package/dist/hosts/init.d.ts.map +1 -0
  472. package/dist/hosts/init.js +82 -0
  473. package/dist/hosts/init.js.map +1 -0
  474. package/dist/hosts/install.d.ts +12 -0
  475. package/dist/hosts/install.d.ts.map +1 -0
  476. package/dist/hosts/install.js +347 -0
  477. package/dist/hosts/install.js.map +1 -0
  478. package/dist/hosts/instructions.d.ts +7 -0
  479. package/dist/hosts/instructions.d.ts.map +1 -0
  480. package/dist/hosts/instructions.js +71 -0
  481. package/dist/hosts/instructions.js.map +1 -0
  482. package/dist/hosts/investigation-instructions.d.ts +2 -0
  483. package/dist/hosts/investigation-instructions.d.ts.map +1 -0
  484. package/dist/hosts/investigation-instructions.js +2 -0
  485. package/dist/hosts/investigation-instructions.js.map +1 -0
  486. package/dist/hosts/mcp-config.d.ts +59 -0
  487. package/dist/hosts/mcp-config.d.ts.map +1 -0
  488. package/dist/hosts/mcp-config.js +229 -0
  489. package/dist/hosts/mcp-config.js.map +1 -0
  490. package/dist/hosts/plan.d.ts +32 -0
  491. package/dist/hosts/plan.d.ts.map +1 -0
  492. package/dist/hosts/plan.js +77 -0
  493. package/dist/hosts/plan.js.map +1 -0
  494. package/dist/hosts/registry.d.ts +35 -0
  495. package/dist/hosts/registry.d.ts.map +1 -0
  496. package/dist/hosts/registry.js +157 -0
  497. package/dist/hosts/registry.js.map +1 -0
  498. package/dist/hosts/retract.d.ts +47 -0
  499. package/dist/hosts/retract.d.ts.map +1 -0
  500. package/dist/hosts/retract.js +541 -0
  501. package/dist/hosts/retract.js.map +1 -0
  502. package/dist/hosts/sections.d.ts +46 -0
  503. package/dist/hosts/sections.d.ts.map +1 -0
  504. package/dist/hosts/sections.js +126 -0
  505. package/dist/hosts/sections.js.map +1 -0
  506. package/dist/index.d.ts +43 -0
  507. package/dist/index.d.ts.map +1 -0
  508. package/dist/index.js +33 -0
  509. package/dist/index.js.map +1 -0
  510. package/dist/ingest/fs.d.ts +79 -0
  511. package/dist/ingest/fs.d.ts.map +1 -0
  512. package/dist/ingest/fs.js +307 -0
  513. package/dist/ingest/fs.js.map +1 -0
  514. package/dist/init-guard.d.ts +11 -0
  515. package/dist/init-guard.d.ts.map +1 -0
  516. package/dist/init-guard.js +21 -0
  517. package/dist/init-guard.js.map +1 -0
  518. package/dist/investigation/index.d.ts +57 -0
  519. package/dist/investigation/index.d.ts.map +1 -0
  520. package/dist/investigation/index.js +346 -0
  521. package/dist/investigation/index.js.map +1 -0
  522. package/dist/mcp/compact.d.ts +9 -0
  523. package/dist/mcp/compact.d.ts.map +1 -0
  524. package/dist/mcp/compact.js +133 -0
  525. package/dist/mcp/compact.js.map +1 -0
  526. package/dist/mcp/instructions.d.ts +5 -0
  527. package/dist/mcp/instructions.d.ts.map +1 -0
  528. package/dist/mcp/instructions.js +57 -0
  529. package/dist/mcp/instructions.js.map +1 -0
  530. package/dist/mcp/server.d.ts +7 -0
  531. package/dist/mcp/server.d.ts.map +1 -0
  532. package/dist/mcp/server.js +128 -0
  533. package/dist/mcp/server.js.map +1 -0
  534. package/dist/mcp/tool-names.d.ts +20 -0
  535. package/dist/mcp/tool-names.d.ts.map +1 -0
  536. package/dist/mcp/tool-names.js +36 -0
  537. package/dist/mcp/tool-names.js.map +1 -0
  538. package/dist/mcp/tools.d.ts +22 -0
  539. package/dist/mcp/tools.d.ts.map +1 -0
  540. package/dist/mcp/tools.js +300 -0
  541. package/dist/mcp/tools.js.map +1 -0
  542. package/dist/notes/ask-notes.d.ts +8 -0
  543. package/dist/notes/ask-notes.d.ts.map +1 -0
  544. package/dist/notes/ask-notes.js +19 -0
  545. package/dist/notes/ask-notes.js.map +1 -0
  546. package/dist/notes/branches.d.ts +102 -0
  547. package/dist/notes/branches.d.ts.map +1 -0
  548. package/dist/notes/branches.js +304 -0
  549. package/dist/notes/branches.js.map +1 -0
  550. package/dist/notes/cold-start.d.ts +177 -0
  551. package/dist/notes/cold-start.d.ts.map +1 -0
  552. package/dist/notes/cold-start.js +537 -0
  553. package/dist/notes/cold-start.js.map +1 -0
  554. package/dist/notes/edit-overlap.d.ts +62 -0
  555. package/dist/notes/edit-overlap.d.ts.map +1 -0
  556. package/dist/notes/edit-overlap.js +202 -0
  557. package/dist/notes/edit-overlap.js.map +1 -0
  558. package/dist/notes/git-facts.d.ts +21 -0
  559. package/dist/notes/git-facts.d.ts.map +1 -0
  560. package/dist/notes/git-facts.js +121 -0
  561. package/dist/notes/git-facts.js.map +1 -0
  562. package/dist/notes/home.d.ts +87 -0
  563. package/dist/notes/home.d.ts.map +1 -0
  564. package/dist/notes/home.js +430 -0
  565. package/dist/notes/home.js.map +1 -0
  566. package/dist/notes/learning-fields.d.ts +102 -0
  567. package/dist/notes/learning-fields.d.ts.map +1 -0
  568. package/dist/notes/learning-fields.js +217 -0
  569. package/dist/notes/learning-fields.js.map +1 -0
  570. package/dist/notes/note-gate.d.ts +42 -0
  571. package/dist/notes/note-gate.d.ts.map +1 -0
  572. package/dist/notes/note-gate.js +181 -0
  573. package/dist/notes/note-gate.js.map +1 -0
  574. package/dist/notes/notes.d.ts +214 -0
  575. package/dist/notes/notes.d.ts.map +1 -0
  576. package/dist/notes/notes.js +591 -0
  577. package/dist/notes/notes.js.map +1 -0
  578. package/dist/notes/pr-reviews.d.ts +108 -0
  579. package/dist/notes/pr-reviews.d.ts.map +1 -0
  580. package/dist/notes/pr-reviews.js +325 -0
  581. package/dist/notes/pr-reviews.js.map +1 -0
  582. package/dist/notes/repo-julius.d.ts +18 -0
  583. package/dist/notes/repo-julius.d.ts.map +1 -0
  584. package/dist/notes/repo-julius.js +111 -0
  585. package/dist/notes/repo-julius.js.map +1 -0
  586. package/dist/notes/session-cost.d.ts +35 -0
  587. package/dist/notes/session-cost.d.ts.map +1 -0
  588. package/dist/notes/session-cost.js +276 -0
  589. package/dist/notes/session-cost.js.map +1 -0
  590. package/dist/search/grep-cli.d.ts +37 -0
  591. package/dist/search/grep-cli.d.ts.map +1 -0
  592. package/dist/search/grep-cli.js +119 -0
  593. package/dist/search/grep-cli.js.map +1 -0
  594. package/dist/search/grep.d.ts +60 -0
  595. package/dist/search/grep.d.ts.map +1 -0
  596. package/dist/search/grep.js +176 -0
  597. package/dist/search/grep.js.map +1 -0
  598. package/dist/search/ignored-code.d.ts +9 -0
  599. package/dist/search/ignored-code.d.ts.map +1 -0
  600. package/dist/search/ignored-code.js +73 -0
  601. package/dist/search/ignored-code.js.map +1 -0
  602. package/dist/skills/skills.d.ts +118 -0
  603. package/dist/skills/skills.d.ts.map +1 -0
  604. package/dist/skills/skills.js +370 -0
  605. package/dist/skills/skills.js.map +1 -0
  606. package/dist/telemetry/contract.d.ts +103 -0
  607. package/dist/telemetry/contract.d.ts.map +1 -0
  608. package/dist/telemetry/contract.js +270 -0
  609. package/dist/telemetry/contract.js.map +1 -0
  610. package/dist/telemetry/flush.d.ts +21 -0
  611. package/dist/telemetry/flush.d.ts.map +1 -0
  612. package/dist/telemetry/flush.js +85 -0
  613. package/dist/telemetry/flush.js.map +1 -0
  614. package/dist/telemetry/gate.d.ts +30 -0
  615. package/dist/telemetry/gate.d.ts.map +1 -0
  616. package/dist/telemetry/gate.js +81 -0
  617. package/dist/telemetry/gate.js.map +1 -0
  618. package/dist/telemetry/identity.d.ts +40 -0
  619. package/dist/telemetry/identity.d.ts.map +1 -0
  620. package/dist/telemetry/identity.js +80 -0
  621. package/dist/telemetry/identity.js.map +1 -0
  622. package/dist/telemetry/index.d.ts +18 -0
  623. package/dist/telemetry/index.d.ts.map +1 -0
  624. package/dist/telemetry/index.js +16 -0
  625. package/dist/telemetry/index.js.map +1 -0
  626. package/dist/telemetry/key.d.ts +4 -0
  627. package/dist/telemetry/key.d.ts.map +1 -0
  628. package/dist/telemetry/key.js +4 -0
  629. package/dist/telemetry/key.js.map +1 -0
  630. package/dist/telemetry/notice.d.ts +19 -0
  631. package/dist/telemetry/notice.d.ts.map +1 -0
  632. package/dist/telemetry/notice.js +93 -0
  633. package/dist/telemetry/notice.js.map +1 -0
  634. package/dist/telemetry/queue.d.ts +35 -0
  635. package/dist/telemetry/queue.d.ts.map +1 -0
  636. package/dist/telemetry/queue.js +162 -0
  637. package/dist/telemetry/queue.js.map +1 -0
  638. package/dist/telemetry/send.d.ts +19 -0
  639. package/dist/telemetry/send.d.ts.map +1 -0
  640. package/dist/telemetry/send.js +84 -0
  641. package/dist/telemetry/send.js.map +1 -0
  642. package/dist/telemetry/sessions.d.ts +25 -0
  643. package/dist/telemetry/sessions.d.ts.map +1 -0
  644. package/dist/telemetry/sessions.js +104 -0
  645. package/dist/telemetry/sessions.js.map +1 -0
  646. package/dist/telemetry/track.d.ts +62 -0
  647. package/dist/telemetry/track.d.ts.map +1 -0
  648. package/dist/telemetry/track.js +142 -0
  649. package/dist/telemetry/track.js.map +1 -0
  650. package/dist/upkeep-run.d.ts +15 -0
  651. package/dist/upkeep-run.d.ts.map +1 -0
  652. package/dist/upkeep-run.js +71 -0
  653. package/dist/upkeep-run.js.map +1 -0
  654. package/dist/upkeep.d.ts +125 -0
  655. package/dist/upkeep.d.ts.map +1 -0
  656. package/dist/upkeep.js +255 -0
  657. package/dist/upkeep.js.map +1 -0
  658. package/dist/util/browser.d.ts +3 -0
  659. package/dist/util/browser.d.ts.map +1 -0
  660. package/dist/util/browser.js +14 -0
  661. package/dist/util/browser.js.map +1 -0
  662. package/dist/util/front-matter.d.ts +19 -0
  663. package/dist/util/front-matter.d.ts.map +1 -0
  664. package/dist/util/front-matter.js +21 -0
  665. package/dist/util/front-matter.js.map +1 -0
  666. package/dist/util/id.d.ts +7 -0
  667. package/dist/util/id.d.ts.map +1 -0
  668. package/dist/util/id.js +14 -0
  669. package/dist/util/id.js.map +1 -0
  670. package/dist/util/paths.d.ts +29 -0
  671. package/dist/util/paths.d.ts.map +1 -0
  672. package/dist/util/paths.js +71 -0
  673. package/dist/util/paths.js.map +1 -0
  674. package/dist/util/source.d.ts +4 -0
  675. package/dist/util/source.d.ts.map +1 -0
  676. package/dist/util/source.js +12 -0
  677. package/dist/util/source.js.map +1 -0
  678. package/dist/util/spinner.d.ts +15 -0
  679. package/dist/util/spinner.d.ts.map +1 -0
  680. package/dist/util/spinner.js +52 -0
  681. package/dist/util/spinner.js.map +1 -0
  682. package/dist/util/state.d.ts +100 -0
  683. package/dist/util/state.d.ts.map +1 -0
  684. package/dist/util/state.js +186 -0
  685. package/dist/util/state.js.map +1 -0
  686. package/dist/viewer/app.js +2 -0
  687. package/dist/viewer/index.html +49 -0
  688. package/dist/viewer/style.css +154 -0
  689. package/dist/viz/assemble.d.ts +83 -0
  690. package/dist/viz/assemble.d.ts.map +1 -0
  691. package/dist/viz/assemble.js +101 -0
  692. package/dist/viz/assemble.js.map +1 -0
  693. package/dist/viz/export.d.ts +39 -0
  694. package/dist/viz/export.d.ts.map +1 -0
  695. package/dist/viz/export.js +98 -0
  696. package/dist/viz/export.js.map +1 -0
  697. package/dist/viz/serve.d.ts +12 -0
  698. package/dist/viz/serve.d.ts.map +1 -0
  699. package/dist/viz/serve.js +129 -0
  700. package/dist/viz/serve.js.map +1 -0
  701. package/docs/assets/context-benchmark.svg +31 -0
  702. package/docs/assets/julius-hero.png +0 -0
  703. package/docs/upstream-changelog.md +785 -0
  704. package/package.json +138 -4
@@ -0,0 +1,86 @@
1
+ /**
2
+ * Serialize a {@link GraphV1} to `<contextDir>/.graph/wiring.json`.
3
+ *
4
+ * The wiring graph lives in a hidden `.graph/` subdir because it is machine-only:
5
+ * the agent never greps or reads it — it reaches the wiring data through the
6
+ * per-file markdown cards (grep) and the `ask` tool (edge traversal). Output is
7
+ * sorted (nodes by id, edges by source/relation/target) and carries no
8
+ * timestamps, so rebuilding an unchanged repo produces a byte-identical file and
9
+ * git diffs stay minimal.
10
+ */
11
+ import { mkdirSync, readFileSync, renameSync, rmSync, writeFileSync } from "node:fs";
12
+ import { dirname, join } from "node:path";
13
+ /** Hidden subdir under the context dir that holds machine-only graph artifacts. */
14
+ export const GRAPH_DIR = ".graph";
15
+ export const GRAPH_FILE = "wiring.json";
16
+ /** Absolute path to the wiring graph for a context dir: `<dir>/.graph/wiring.json`. */
17
+ export function wiringPath(outDir) {
18
+ return join(outDir, GRAPH_DIR, GRAPH_FILE);
19
+ }
20
+ /**
21
+ * Read an existing wiring graph for use as the Tier-2 cache. Returns null when the
22
+ * file is absent or unparseable (a fresh build, or a corrupt file we'll replace).
23
+ */
24
+ export function readGraph(path) {
25
+ try {
26
+ return JSON.parse(readFileSync(path, "utf8"));
27
+ }
28
+ catch {
29
+ return null;
30
+ }
31
+ }
32
+ export function writeGraph(graph, outDir) {
33
+ const sorted = {
34
+ ...graph,
35
+ nodes: [...graph.nodes].sort((a, b) => a.id.localeCompare(b.id)).map(stripBodyText),
36
+ edges: [...graph.edges].sort(edgeOrder),
37
+ };
38
+ const path = wiringPath(outDir);
39
+ mkdirSync(dirname(path), { recursive: true });
40
+ // Atomic write (temp + rename): the crux pass now checkpoints wiring.json
41
+ // periodically (#128), and a --deep run is exactly what gets killed mid-flush
42
+ // (SIGTERM/CI timeout/laptop sleep). A partial writeFileSync would leave a
43
+ // truncated, unparseable graph; rename swaps it in atomically on the same fs.
44
+ //
45
+ // pid in the temp name, and removed when the write fails — the same discipline
46
+ // `writeJsonAtomic` (util/state.ts) documents: a fixed name lets a concurrent
47
+ // build (a manual `julius build` racing the refresh child) write the same scratch
48
+ // file and hand the loser a corrupt graph, and a failed rename would otherwise
49
+ // leave a full-size orphan behind that nothing ever cleans up.
50
+ const tmp = `${path}.${process.pid}.tmp`;
51
+ try {
52
+ writeFileSync(tmp, JSON.stringify(sorted, null, 2) + "\n");
53
+ renameSync(tmp, path);
54
+ }
55
+ catch (e) {
56
+ try {
57
+ rmSync(tmp, { force: true });
58
+ }
59
+ catch {
60
+ /* nothing more we can do */
61
+ }
62
+ throw e;
63
+ }
64
+ return path;
65
+ }
66
+ /**
67
+ * Drop `body_text` from the SERIALIZED copy of a node — it is ~65% of
68
+ * wiring.json's bytes on a large graph, and every byte of it is already
69
+ * duplicated in the `ask` sidecar (`.cache/ask-index.json`), tokenized, which
70
+ * is the only place anything reads it from. Callers must pass this the
71
+ * in-memory graph BEFORE this stripped copy is produced (see `build.ts`:
72
+ * `writeAskIndex` runs on the original `graph` object, never on a re-read of
73
+ * this slimmed file) — this function never mutates the input node.
74
+ */
75
+ function stripBodyText(node) {
76
+ if (node.body_text === undefined)
77
+ return node;
78
+ const { body_text: _body_text, ...rest } = node;
79
+ return rest;
80
+ }
81
+ function edgeOrder(a, b) {
82
+ return (a.source.localeCompare(b.source) ||
83
+ a.relation.localeCompare(b.relation) ||
84
+ a.target.localeCompare(b.target));
85
+ }
86
+ //# sourceMappingURL=write.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"write.js","sourceRoot":"","sources":["../../src/graph/write.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACrF,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAG1C,mFAAmF;AACnF,MAAM,CAAC,MAAM,SAAS,GAAG,QAAQ,CAAC;AAClC,MAAM,CAAC,MAAM,UAAU,GAAG,aAAa,CAAC;AAExC,uFAAuF;AACvF,MAAM,UAAU,UAAU,CAAC,MAAc;IACvC,OAAO,IAAI,CAAC,MAAM,EAAE,SAAS,EAAE,UAAU,CAAC,CAAC;AAC7C,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,SAAS,CAAC,IAAY;IAC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E,CAAC,CAAC;QAC/B,CAAC;QAAC,MAAM,CAAC;YACP,4BAA4B;QAC9B,CAAC;QACD,MAAM,CAAC,CAAC;IACV,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAED;;;;;;;;GAQG;AACH,SAAS,aAAa,CAAC,IAAY;IACjC,IAAI,IAAI,CAAC,SAAS,KAAK,SAAS;QAAE,OAAO,IAAI,CAAC;IAC9C,MAAM,EAAE,SAAS,EAAE,UAAU,EAAE,GAAG,IAAI,EAAE,GAAG,IAAI,CAAC;IAChD,OAAO,IAAc,CAAC;AACxB,CAAC;AAED,SAAS,SAAS,CAAC,CAAS,EAAE,CAAS;IACrC,OAAO,CACL,CAAC,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC,CAAC,MAAM,CAAC;QAChC,CAAC,CAAC,QAAQ,CAAC,aAAa,CAAC,CAAC,CAAC,QAAQ,CAAC;QACpC,CAAC,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC,CAAC,MAAM,CAAC,CACjC,CAAC;AACJ,CAAC"}
@@ -0,0 +1,8 @@
1
+ import type { PlannedWrite } from './plan.js';
2
+ import type { ConfigWrite } from './config-write.js';
3
+ import type { Brand } from '../brand.js';
4
+ /** The files installing Antigravity's global skill would touch — pure, no writes. */
5
+ export declare function antigravitySkillTargets(home: string, name?: Brand): PlannedWrite[];
6
+ /** Write the shared Julius skill idempotently. */
7
+ export declare function installAntigravitySkill(home: string, name?: Brand): ConfigWrite[];
8
+ //# sourceMappingURL=antigravity.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"antigravity.d.ts","sourceRoot":"","sources":["../../src/hosts/antigravity.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAC9C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAOzC,qFAAqF;AACrF,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,GAAE,KAAgB,GAAG,YAAY,EAAE,CAQ5F;AAED,kDAAkD;AAClD,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,GAAE,KAAgB,GAAG,WAAW,EAAE,CAU3F"}
@@ -0,0 +1,42 @@
1
+ /**
2
+ * Antigravity-specific global writes that don't fit the per-repo host model.
3
+ *
4
+ * Antigravity loads "shared" skills — available to every workspace — from
5
+ * `~/.gemini/skills/`. julius's skill card is the same one Claude Code and AdaL get;
6
+ * placing it here is the skill half of first-class Antigravity support (#62). The
7
+ * instruction file (AGENTS.md) and MCP registration are handled by the `antigravity`
8
+ * host in the registry and `mcp-config.ts` respectively.
9
+ *
10
+ * `antigravitySkillTargets()` is the pure "which files would this touch" half (for
11
+ * `julius init --dry-run` / the picker); `installAntigravitySkill()` does the write.
12
+ */
13
+ import { readFileSync, writeFileSync, mkdirSync, existsSync } from 'node:fs';
14
+ import { dirname, join } from 'node:path';
15
+ import { skillTemplate } from '../claude/skill-template.js';
16
+ /** The skill file path, under the user's global Antigravity skills dir. */
17
+ function skillPath(home, name = 'julius') {
18
+ return join(home, '.gemini', 'skills', name, 'SKILL.md');
19
+ }
20
+ /** The files installing Antigravity's global skill would touch — pure, no writes. */
21
+ export function antigravitySkillTargets(home, name = 'julius') {
22
+ return [
23
+ {
24
+ hostId: 'antigravity', id: 'antigravity-skill',
25
+ path: skillPath(home, name),
26
+ scope: 'global', kind: 'skill', what: `${name} skill (shared)`,
27
+ },
28
+ ];
29
+ }
30
+ /** Write the shared Julius skill idempotently. */
31
+ export function installAntigravitySkill(home, name = 'julius') {
32
+ const path = skillPath(home, name);
33
+ const content = skillTemplate(name);
34
+ const existed = existsSync(path);
35
+ if (existed && readFileSync(path, 'utf8') === content) {
36
+ return [{ id: 'antigravity-skill', path, action: 'unchanged' }];
37
+ }
38
+ mkdirSync(dirname(path), { recursive: true });
39
+ writeFileSync(path, content);
40
+ return [{ id: 'antigravity-skill', path, action: existed ? 'updated' : 'created' }];
41
+ }
42
+ //# sourceMappingURL=antigravity.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"antigravity.js","sourceRoot":"","sources":["../../src/hosts/antigravity.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAC7E,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAK5D,2EAA2E;AAC3E,SAAS,SAAS,CAAC,IAAY,EAAE,IAAI,GAAU,QAAQ;IACrD,OAAO,IAAI,CAAC,IAAI,EAAE,SAAS,EAAE,QAAQ,EAAE,IAAI,EAAE,UAAU,CAAC,CAAC;AAC3D,CAAC;AAED,qFAAqF;AACrF,MAAM,UAAU,uBAAuB,CAAC,IAAY,EAAE,IAAI,GAAU,QAAQ;IAC1E,OAAO;QACL;YACE,MAAM,EAAE,aAAa,EAAE,EAAE,EAAE,mBAAmB;YAC9C,IAAI,EAAE,SAAS,CAAC,IAAI,EAAE,IAAI,CAAC;YAC3B,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,GAAG,IAAI,iBAAiB;SAC/D;KACF,CAAC;AACJ,CAAC;AAED,kDAAkD;AAClD,MAAM,UAAU,uBAAuB,CAAC,IAAY,EAAE,IAAI,GAAU,QAAQ;IAC1E,MAAM,IAAI,GAAG,SAAS,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IACnC,MAAM,OAAO,GAAG,aAAa,CAAC,IAAI,CAAC,CAAC;IACpC,MAAM,OAAO,GAAG,UAAU,CAAC,IAAI,CAAC,CAAC;IACjC,IAAI,OAAO,IAAI,YAAY,CAAC,IAAI,EAAE,MAAM,CAAC,KAAK,OAAO,EAAE,CAAC;QACtD,OAAO,CAAC,EAAE,EAAE,EAAE,mBAAmB,EAAE,IAAI,EAAE,MAAM,EAAE,WAAW,EAAE,CAAC,CAAC;IAClE,CAAC;IACD,SAAS,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IAC9C,aAAa,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IAC7B,OAAO,CAAC,EAAE,EAAE,EAAE,mBAAmB,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS,EAAE,CAAC,CAAC;AACtF,CAAC"}
@@ -0,0 +1,36 @@
1
+ import { type ConfigWrite } from './config-write.js';
2
+ import type { PlannedWrite } from './plan.js';
3
+ import type { Brand } from '../brand.js';
4
+ /** Same `{ id, path, action }` contract every other writer in this layer reports. */
5
+ export type GlobalWrite = ConfigWrite;
6
+ /** The directory the user-level shim lives in — the base every hook command names. */
7
+ export declare function globalHelpersDir(home: string): string;
8
+ /**
9
+ * The files a user-level install would touch — pure, no writes, so `--dry-run` and
10
+ * the picker can report them up front. Both are scoped 'global': they apply to
11
+ * every project opened with Claude Code, not just this one.
12
+ */
13
+ export declare function claudeGlobalTargets(home: string, brand?: Brand): PlannedWrite[];
14
+ /**
15
+ * Install the user-level shim and hook entries, removing stale Julius MCP wiring.
16
+ *
17
+ * The shim is written to `home` and the hook commands name it by absolute path, for
18
+ * the reason the repo form can't be reused: `${CLAUDE_PROJECT_DIR}/.claude/helpers/`
19
+ * resolves inside whatever project is open, and the whole point is to work in one
20
+ * that has no such file. The shim itself is the same one every host gets, and finds
21
+ * the installed package the same way (see claude/shim-template.ts).
22
+ *
23
+ * Best-effort by contract, like every other writer here: a failure is reported as an
24
+ * action, never raised, so a bad `~/.claude.json` can't fail a `julius init`.
25
+ */
26
+ export declare function installClaudeGlobal(home: string, brand?: Brand): GlobalWrite[];
27
+ /**
28
+ * In a repo wired for julius, Claude Code would list julius's user-level server
29
+ * beside the repo's own `julius` one: the same tools twice. Claude Code keeps a
30
+ * per-folder switch for that, `projects["<folder>"].disabledMcpServers` in
31
+ * `~/.claude.json` (what /mcp sets), so julius goes off for this folder only
32
+ * and keeps serving every repo still wired as julius. Nothing to do when julius
33
+ * has no user-level server. Best-effort, like every writer here.
34
+ */
35
+ export declare function disableJuliusServerIn(home: string, folder: string): GlobalWrite;
36
+ //# sourceMappingURL=claude-global.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"claude-global.d.ts","sourceRoot":"","sources":["../../src/hosts/claude-global.ts"],"names":[],"mappings":"AAgCA,OAAO,EAA8B,KAAK,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACjF,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAC9C,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAEzC,qFAAqF;AACrF,MAAM,MAAM,WAAW,GAAG,WAAW,CAAC;AAEtC,sFAAsF;AACtF,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAErD;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,GAAE,KAAgB,GAAG,YAAY,EAAE,CAOzF;AAeD;;;;;;;;;;;GAWG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,GAAE,KAAgB,GAAG,WAAW,EAAE,CA8BxF;AAiBD;;;;;;;GAOG;AACH,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,WAAW,CAkB/E"}
@@ -0,0 +1,153 @@
1
+ /**
2
+ * User-level install for Claude Code: the copy of julius's wiring that lives
3
+ * outside every repo.
4
+ *
5
+ * Why this exists. Everything `julius init` writes for Claude Code lands *in* the
6
+ * repo — `.mcp.json` and `.claude/settings.json`. A `.gitignore` is free to ignore
7
+ * both, and `git worktree add` checks out tracked files only, so a worktree of such
8
+ * a repo starts with julius's shims present and neither of the two files that *point
9
+ * at* them. No settings.json means no SessionStart hook; no `.mcp.json` means no
10
+ * tool server. julius is absent, silently, in a tree that looks correctly wired.
11
+ *
12
+ * julius already carries the repair for exactly that — `reconcileWiring` rewrites
13
+ * both files — and it is unreachable here: `runUpkeep` is called only from the hook
14
+ * and from the MCP server, which are the two things that are missing. Seeding can't
15
+ * help either, since it runs on the query path, which needs the server.
16
+ *
17
+ * So the fix cannot live in the repo. `~/.claude/` is not in anyone's working tree,
18
+ * no `.gitignore` reaches it, and Claude Code reads it for every project — worktrees
19
+ * included. Codex has been installed this way from the start (see ./codex-hooks.ts,
20
+ * whose own note says the entries "fire in every repo opened with Codex, not just
21
+ * this one"); Claude Code was the one host julius wired repo-only. This module closes
22
+ * that gap, and is a deliberate mirror of that file.
23
+ *
24
+ * The repo-level writes stay exactly as they were. A project that has its own
25
+ * `.mcp.json` and settings keeps using them; this is the floor underneath, not a
26
+ * replacement.
27
+ */
28
+ import { writeFileSync, mkdirSync } from 'node:fs';
29
+ import { dirname, join } from 'node:path';
30
+ import { hooksShim } from '../claude/shim-template.js';
31
+ import { mergeJuliusHooks } from '../claude/settings-merge.js';
32
+ import { toPosixPath } from '../util/paths.js';
33
+ import { readJsonObject, writeOwned } from './config-write.js';
34
+ /** The directory the user-level shim lives in — the base every hook command names. */
35
+ export function globalHelpersDir(home) {
36
+ return join(home, '.claude', 'helpers');
37
+ }
38
+ /**
39
+ * The files a user-level install would touch — pure, no writes, so `--dry-run` and
40
+ * the picker can report them up front. Both are scoped 'global': they apply to
41
+ * every project opened with Claude Code, not just this one.
42
+ */
43
+ export function claudeGlobalTargets(home, brand = 'julius') {
44
+ const g = (id, path, kind, what) => ({ hostId: 'claude', id, path, scope: 'global', kind, what });
45
+ return [
46
+ g('claude-global-shim', join(globalHelpersDir(home), 'julius-hooks.cjs'), 'hook', 'hooks shim (user level)'),
47
+ g('claude-global-hooks', join(home, '.claude', 'settings.json'), 'hook', 'SessionStart / UserPromptSubmit / PostToolUse / Stop / SessionEnd'),
48
+ ];
49
+ }
50
+ /** Merge julius's hook blocks into a settings file, preserving everything else. */
51
+ function upsertGlobalHooks(id, path, helpers) {
52
+ const loaded = readJsonObject(path);
53
+ if (loaded === 'unparseable')
54
+ return { id, path, action: 'skipped-unparseable' };
55
+ const { root: existing, existed } = loaded;
56
+ const before = JSON.stringify(existing);
57
+ const { merged } = mergeJuliusHooks(existing, helpers);
58
+ if (JSON.stringify(merged) === before)
59
+ return { id, path, action: 'unchanged' };
60
+ mkdirSync(dirname(path), { recursive: true });
61
+ writeFileSync(path, `${JSON.stringify(merged, null, 2)}\n`);
62
+ return { id, path, action: existed ? 'updated' : 'created' };
63
+ }
64
+ /**
65
+ * Install the user-level shim and hook entries, removing stale Julius MCP wiring.
66
+ *
67
+ * The shim is written to `home` and the hook commands name it by absolute path, for
68
+ * the reason the repo form can't be reused: `${CLAUDE_PROJECT_DIR}/.claude/helpers/`
69
+ * resolves inside whatever project is open, and the whole point is to work in one
70
+ * that has no such file. The shim itself is the same one every host gets, and finds
71
+ * the installed package the same way (see claude/shim-template.ts).
72
+ *
73
+ * Best-effort by contract, like every other writer here: a failure is reported as an
74
+ * action, never raised, so a bad `~/.claude.json` can't fail a `julius init`.
75
+ */
76
+ export function installClaudeGlobal(home, brand = 'julius') {
77
+ const [shim, settings] = claudeGlobalTargets(home, brand);
78
+ const mcp = { id: 'claude-global-mcp', path: join(home, '.claude.json') };
79
+ const out = [];
80
+ try {
81
+ out.push(writeOwned(shim.id, shim.path, hooksShim(), 0o755));
82
+ }
83
+ catch {
84
+ out.push({ id: shim.id, path: shim.path, action: 'skipped-unparseable' });
85
+ }
86
+ // Only wire the hooks once the shim they call is actually on disk — a hook
87
+ // entry pointing at a missing file is an error in every session, which is a
88
+ // worse failure than not installing.
89
+ if (out[0].action !== 'skipped-unparseable') {
90
+ try {
91
+ // Posix form in the command string: `join` gives backslashes on Windows and
92
+ // the template appends `/julius-hooks.cjs`, so the raw path produces a mixed
93
+ // `C:\Users\…\helpers/julius-hooks.cjs`. Node accepts forward slashes on
94
+ // Windows, so one separator throughout is both correct and readable.
95
+ out.push(upsertGlobalHooks(settings.id, settings.path, toPosixPath(globalHelpersDir(home))));
96
+ }
97
+ catch {
98
+ out.push({ id: settings.id, path: settings.path, action: 'skipped-unparseable' });
99
+ }
100
+ }
101
+ // Remove a stale Julius server; current Claude Code wiring uses hooks.
102
+ out.push(dropUserServer(mcp.id, mcp.path, 'julius'));
103
+ return out;
104
+ }
105
+ /** Remove one user-scope server from `~/.claude.json`, leaving everything else. */
106
+ function dropUserServer(id, path, name) {
107
+ try {
108
+ const loaded = readJsonObject(path);
109
+ if (loaded === 'unparseable')
110
+ return { id, path, action: 'skipped-unparseable' };
111
+ const servers = loaded.root.mcpServers;
112
+ if (!servers || typeof servers !== 'object' || !(name in servers))
113
+ return { id, path, action: 'unchanged' };
114
+ delete servers[name];
115
+ writeFileSync(path, `${JSON.stringify(loaded.root, null, 2)}\n`);
116
+ return { id, path, action: 'updated' };
117
+ }
118
+ catch {
119
+ return { id, path, action: 'skipped-unparseable' };
120
+ }
121
+ }
122
+ /**
123
+ * In a repo wired for julius, Claude Code would list julius's user-level server
124
+ * beside the repo's own `julius` one: the same tools twice. Claude Code keeps a
125
+ * per-folder switch for that, `projects["<folder>"].disabledMcpServers` in
126
+ * `~/.claude.json` (what /mcp sets), so julius goes off for this folder only
127
+ * and keeps serving every repo still wired as julius. Nothing to do when julius
128
+ * has no user-level server. Best-effort, like every writer here.
129
+ */
130
+ export function disableJuliusServerIn(home, folder) {
131
+ const id = 'claude-folder-julius-off';
132
+ const path = join(home, '.claude.json');
133
+ try {
134
+ const loaded = readJsonObject(path);
135
+ if (loaded === 'unparseable')
136
+ return { id, path, action: 'skipped-unparseable' };
137
+ const root = loaded.root;
138
+ if (!root.mcpServers?.julius)
139
+ return { id, path, action: 'unchanged' };
140
+ const projects = (root.projects ??= {});
141
+ const here = (projects[folder] ??= {});
142
+ const off = Array.isArray(here.disabledMcpServers) ? here.disabledMcpServers : [];
143
+ if (off.includes('julius'))
144
+ return { id, path, action: 'unchanged' };
145
+ here.disabledMcpServers = [...off, 'julius'];
146
+ writeFileSync(path, `${JSON.stringify(root, null, 2)}\n`);
147
+ return { id, path, action: 'updated' };
148
+ }
149
+ catch {
150
+ return { id, path, action: 'skipped-unparseable' };
151
+ }
152
+ }
153
+ //# sourceMappingURL=claude-global.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"claude-global.js","sourceRoot":"","sources":["../../src/hosts/claude-global.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AACvD,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,cAAc,EAAE,UAAU,EAAoB,MAAM,mBAAmB,CAAC;AAOjF,sFAAsF;AACtF,MAAM,UAAU,gBAAgB,CAAC,IAAY;IAC3C,OAAO,IAAI,CAAC,IAAI,EAAE,SAAS,EAAE,SAAS,CAAC,CAAC;AAC1C,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,mBAAmB,CAAC,IAAY,EAAE,KAAK,GAAU,QAAQ;IACvE,MAAM,CAAC,GAAG,CAAC,EAAU,EAAE,IAAY,EAAE,IAA0B,EAAE,IAAY,EAAgB,EAAE,CAC7F,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;IAChE,OAAO;QACL,CAAC,CAAC,oBAAoB,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E,EAAE,IAAI,EAAE,MAAM,EAAE,qBAAqB,EAAE,CAAC;QACjF,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC;QACzB,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,MAAM;YAAE,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,WAAW,EAAE,CAAC;QACvE,MAAM,QAAQ,GAAG,CAAC,IAAI,CAAC,QAAQ,KAAK,EAAE,CAAqD,CAAC;QAC5F,MAAM,IAAI,GAAG,CAAC,QAAQ,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC;QACvC,MAAM,GAAG,GAAG,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAC,CAAC,CAAE,IAAI,CAAC,kBAA+B,CAAC,CAAC,CAAC,EAAE,CAAC;QAChG,IAAI,GAAG,CAAC,QAAQ,CAAC,QAAQ,CAAC;YAAE,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,WAAW,EAAE,CAAC;QACrE,IAAI,CAAC,kBAAkB,GAAG,CAAC,GAAG,GAAG,EAAE,QAAQ,CAAC,CAAC;QAC7C,aAAa,CAAC,IAAI,EAAE,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC;QAC1D,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,CAAC;IACzC,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,qBAAqB,EAAE,CAAC;IACrD,CAAC;AACH,CAAC"}
@@ -0,0 +1,11 @@
1
+ import type { PlannedWrite } from './plan.js';
2
+ import { type ConfigWrite } from './config-write.js';
3
+ /**
4
+ * The files installing the Codex hook would touch — pure, no writes. Both live
5
+ * under `~/.codex`, so both are scoped 'global': the hook entries fire in every
6
+ * repo opened with Codex, not just this one. Empty when the CLI isn't installed,
7
+ * mirroring `installCodexHooks`' early return.
8
+ */
9
+ export declare function hookTargets(home: string): PlannedWrite[];
10
+ export declare function installCodexHooks(home: string): ConfigWrite[];
11
+ //# sourceMappingURL=codex-hooks.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"codex-hooks.d.ts","sourceRoot":"","sources":["../../src/hosts/codex-hooks.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAC9C,OAAO,EAA6C,KAAK,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAMhG;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,YAAY,EAAE,CAexD;AAuBD,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,WAAW,EAAE,CA6B7D"}
@@ -0,0 +1,80 @@
1
+ /**
2
+ * Active-layer install for CLI agents that read user-level hooks.json with
3
+ * PostToolUse semantics. Writes the shared hook shim and one PostToolUse
4
+ * entry that runs post-edit + background sync after every file edit.
5
+ */
6
+ import { writeFileSync, statSync } from 'node:fs';
7
+ import { join } from 'node:path';
8
+ import { hooksShim } from '../claude/shim-template.js';
9
+ import { writeOwned, isJuliusEntry, readJsonObject } from './config-write.js';
10
+ function dirExists(p) {
11
+ try {
12
+ return statSync(p).isDirectory();
13
+ }
14
+ catch {
15
+ return false;
16
+ }
17
+ }
18
+ /**
19
+ * The files installing the Codex hook would touch — pure, no writes. Both live
20
+ * under `~/.codex`, so both are scoped 'global': the hook entries fire in every
21
+ * repo opened with Codex, not just this one. Empty when the CLI isn't installed,
22
+ * mirroring `installCodexHooks`' early return.
23
+ */
24
+ export function hookTargets(home) {
25
+ const base = join(home, '.codex');
26
+ if (!dirExists(base))
27
+ return [];
28
+ return [
29
+ {
30
+ hostId: 'agents', id: 'codex-hook-shim',
31
+ path: join(base, 'hooks', 'julius', 'julius-hooks.cjs'),
32
+ scope: 'global', kind: 'hook', what: 'post-edit hook shim',
33
+ },
34
+ {
35
+ hostId: 'agents', id: 'codex-hooks',
36
+ path: join(base, 'hooks.json'),
37
+ scope: 'global', kind: 'hook', what: 'SessionStart / UserPromptSubmit / PostToolUse / Stop',
38
+ },
39
+ ];
40
+ }
41
+ function desiredEntries() {
42
+ return [
43
+ { event: 'SessionStart', matcher: 'startup|resume|compact', sub: 'session-start', timeout: 10000 },
44
+ { event: 'UserPromptSubmit', sub: 'prompt', timeout: 15000 },
45
+ { event: 'PostToolUse', matcher: 'apply_patch|Write|Edit|MultiEdit', sub: 'post-edit', timeout: 10000 },
46
+ { event: 'Stop', sub: 'stop', timeout: 10000 },
47
+ ];
48
+ }
49
+ export function installCodexHooks(home) {
50
+ const targets = hookTargets(home);
51
+ if (targets.length === 0)
52
+ return [];
53
+ const shimPath = targets[0].path;
54
+ const shimWrite = writeOwned('codex-hook-shim', shimPath, hooksShim(), 0o755);
55
+ const cfgPath = targets[1].path;
56
+ const skipped = { id: 'codex-hooks', path: cfgPath, action: 'skipped-unparseable' };
57
+ const loaded = readJsonObject(cfgPath);
58
+ if (loaded === 'unparseable')
59
+ return [shimWrite, skipped];
60
+ const { root, existed } = loaded;
61
+ const before = JSON.stringify(root);
62
+ const hooks = (root.hooks ??= {});
63
+ if (typeof hooks !== 'object' || hooks === null || Array.isArray(hooks))
64
+ return [shimWrite, skipped];
65
+ for (const d of desiredEntries()) {
66
+ if (hooks[d.event] !== undefined && !Array.isArray(hooks[d.event]))
67
+ return [shimWrite, skipped];
68
+ const prior = Array.isArray(hooks[d.event]) ? hooks[d.event] : [];
69
+ const handler = { type: 'command', command: `node "${shimPath}" ${d.sub}`, timeout: d.timeout };
70
+ const entry = d.matcher ? { matcher: d.matcher, hooks: [handler] } : { hooks: [handler] };
71
+ // Preserve foreign entries in this event; replace any prior julius entry so an
72
+ // upgrade re-points to the current shim/sub-command instead of stacking.
73
+ hooks[d.event] = [...prior.filter((e) => !isJuliusEntry(e)), entry];
74
+ }
75
+ if (JSON.stringify(root) === before)
76
+ return [shimWrite, { id: 'codex-hooks', path: cfgPath, action: 'unchanged' }];
77
+ writeFileSync(cfgPath, `${JSON.stringify(root, null, 2)}\n`);
78
+ return [shimWrite, { id: 'codex-hooks', path: cfgPath, action: existed ? 'updated' : 'created' }];
79
+ }
80
+ //# sourceMappingURL=codex-hooks.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"codex-hooks.js","sourceRoot":"","sources":["../../src/hosts/codex-hooks.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAClD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AAEvD,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,cAAc,EAAoB,MAAM,mBAAmB,CAAC;AAEhG,SAAS,SAAS,CAAC,CAAS;IAC1B,IAAI,CAAC;QAAC,OAAO,QAAQ,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC;IAAC,CAAC;IAAC,MAAM,CAAC;QAAC,OAAO,KAAK,CAAC;IAAC,CAAC;AACnE,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,WAAW,CAAC,IAAY;IACtC,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;IAClC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC;QAAE,OAAO,EAAE,CAAC;IAChC,OAAO;QACL;YACE,MAAM,EAAE,QAAQ,EAAE,EAAE,EAAE,iBAAiB;YACvC,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,OAAO,EAAE,QAAQ,EAAE,kBAAkB,CAAC;YACvD,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,qBAAqB;SAC3D;QACD;YACE,MAAM,EAAE,QAAQ,EAAE,EAAE,EAAE,aAAa;YACnC,IAAI,EAAE,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,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC;IACtE,CAAC;IAED,IAAI,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,KAAK,MAAM;QAAE,OAAO,CAAC,SAAS,EAAE,EAAE,EAAE,EAAE,aAAa,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,CAAC,CAAC;IACnH,aAAa,CAAC,OAAO,EAAE,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC;IAC7D,OAAO,CAAC,SAAS,EAAE,EAAE,EAAE,EAAE,aAAa,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS,EAAE,CAAC,CAAC;AACpG,CAAC"}
@@ -0,0 +1,36 @@
1
+ /** The result of one config/shim write, reported by every installer and by MCP
2
+ * registration so they speak the same vocabulary. `McpWrite` aliases this. */
3
+ export interface ConfigWrite {
4
+ id: string;
5
+ path: string;
6
+ action: 'created' | 'updated' | 'unchanged' | 'skipped-unparseable';
7
+ }
8
+ /**
9
+ * Write a julius-owned file, idempotently: unchanged when the content already
10
+ * matches (only re-applying `mode` if it drifted), else created/updated. `mode`
11
+ * is applied on POSIX; on Windows the exec bit does not exist and is skipped by
12
+ * the caller's expectations.
13
+ */
14
+ export declare function writeOwned(id: string, path: string, content: string, mode?: number): ConfigWrite;
15
+ /** Whether a hooks-config entry is one julius installed (so an upgrade replaces
16
+ * it in place instead of stacking a second copy next to the stale one). The
17
+ * `?? ''` guards a stray `undefined` entry: `JSON.stringify(undefined)` is
18
+ * `undefined`, whose `.includes` would throw. */
19
+ export declare function isJuliusEntry(entry: unknown): boolean;
20
+ /**
21
+ * Load a JSON config that julius is about to merge into, distinguishing the three
22
+ * outcomes an installer must treat differently:
23
+ * - missing → `{ root: {}, existed: false }`: start fresh, this is a create.
24
+ * - a plain object → `{ root, existed: true }`: merge into it.
25
+ * - anything else (parse error, or a top-level array/null/primitive) →
26
+ * `'unparseable'`: leave the file exactly as the user left it.
27
+ *
28
+ * Deliberately NOT `readJson` from `util/state.ts`, which returns `null` for both
29
+ * missing and unparseable — collapsing those two would let a create silently
30
+ * clobber a hand-edited broken `hooks.json`.
31
+ */
32
+ export declare function readJsonObject(path: string): {
33
+ root: Record<string, any>;
34
+ existed: boolean;
35
+ } | 'unparseable';
36
+ //# sourceMappingURL=config-write.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config-write.d.ts","sourceRoot":"","sources":["../../src/hosts/config-write.ts"],"names":[],"mappings":"AAWA;+EAC+E;AAC/E,MAAM,WAAW,WAAW;IAC1B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,SAAS,GAAG,SAAS,GAAG,WAAW,GAAG,qBAAqB,CAAC;CACrE;AAED;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,WAAW,CAUhG;AAED;;;kDAGkD;AAClD,wBAAgB,aAAa,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAGrD;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,cAAc,CAC5B,IAAI,EAAE,MAAM,GACX;IAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAAC,OAAO,EAAE,OAAO,CAAA;CAAE,GAAG,aAAa,CAUjE"}
@@ -0,0 +1,64 @@
1
+ /**
2
+ * Shared helpers for the host config writers. Both the hook installers (Codex,
3
+ * user-level under `~/.codex`; Cursor, repo-local under `.cursor`) and the MCP
4
+ * registration merge julius entries into a JSON config, own a generated shim, and
5
+ * describe the outcome with the same little result record. The file-owning write,
6
+ * the julius-entry test, and the load-or-skip JSON open are identical across them;
7
+ * the merge itself differs per host, so only the genuinely-shared pieces live here.
8
+ */
9
+ import { readFileSync, writeFileSync, mkdirSync, existsSync, chmodSync, statSync } from 'node:fs';
10
+ import { dirname } from 'node:path';
11
+ /**
12
+ * Write a julius-owned file, idempotently: unchanged when the content already
13
+ * matches (only re-applying `mode` if it drifted), else created/updated. `mode`
14
+ * is applied on POSIX; on Windows the exec bit does not exist and is skipped by
15
+ * the caller's expectations.
16
+ */
17
+ export function writeOwned(id, path, content, mode) {
18
+ const existed = existsSync(path);
19
+ if (existed && readFileSync(path, 'utf8') === content) {
20
+ if (mode !== undefined && (statSync(path).mode & 0o777) !== mode)
21
+ chmodSync(path, mode);
22
+ return { id, path, action: 'unchanged' };
23
+ }
24
+ mkdirSync(dirname(path), { recursive: true });
25
+ writeFileSync(path, content);
26
+ if (mode !== undefined)
27
+ chmodSync(path, mode);
28
+ return { id, path, action: existed ? 'updated' : 'created' };
29
+ }
30
+ /** Whether a hooks-config entry is one julius installed (so an upgrade replaces
31
+ * it in place instead of stacking a second copy next to the stale one). The
32
+ * `?? ''` guards a stray `undefined` entry: `JSON.stringify(undefined)` is
33
+ * `undefined`, whose `.includes` would throw. */
34
+ export function isJuliusEntry(entry) {
35
+ const s = JSON.stringify(entry ?? '');
36
+ return s.includes('julius-hooks.cjs') || s.includes('/.julius/hook.cjs');
37
+ }
38
+ /**
39
+ * Load a JSON config that julius is about to merge into, distinguishing the three
40
+ * outcomes an installer must treat differently:
41
+ * - missing → `{ root: {}, existed: false }`: start fresh, this is a create.
42
+ * - a plain object → `{ root, existed: true }`: merge into it.
43
+ * - anything else (parse error, or a top-level array/null/primitive) →
44
+ * `'unparseable'`: leave the file exactly as the user left it.
45
+ *
46
+ * Deliberately NOT `readJson` from `util/state.ts`, which returns `null` for both
47
+ * missing and unparseable — collapsing those two would let a create silently
48
+ * clobber a hand-edited broken `hooks.json`.
49
+ */
50
+ export function readJsonObject(path) {
51
+ if (!existsSync(path))
52
+ return { root: {}, existed: false };
53
+ let root;
54
+ try {
55
+ root = JSON.parse(readFileSync(path, 'utf8'));
56
+ }
57
+ catch {
58
+ return 'unparseable';
59
+ }
60
+ if (typeof root !== 'object' || root === null || Array.isArray(root))
61
+ return 'unparseable';
62
+ return { root: root, existed: true };
63
+ }
64
+ //# sourceMappingURL=config-write.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config-write.js","sourceRoot":"","sources":["../../src/hosts/config-write.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,SAAS,EAAE,UAAU,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAClG,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAUpC;;;;;GAKG;AACH,MAAM,UAAU,UAAU,CAAC,EAAU,EAAE,IAAY,EAAE,OAAe,EAAE,IAAa;IACjF,MAAM,OAAO,GAAG,UAAU,CAAC,IAAI,CAAC,CAAC;IACjC,IAAI,OAAO,IAAI,YAAY,CAAC,IAAI,EAAE,MAAM,CAAC,KAAK,OAAO,EAAE,CAAC;QACtD,IAAI,IAAI,KAAK,SAAS,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,IAAI,GAAG,KAAK,CAAC,KAAK,IAAI;YAAE,SAAS,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;QACxF,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,WAAW,EAAE,CAAC;IAC3C,CAAC;IACD,SAAS,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IAC9C,aAAa,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IAC7B,IAAI,IAAI,KAAK,SAAS;QAAE,SAAS,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IAC9C,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS,EAAE,CAAC;AAC/D,CAAC;AAED;;;kDAGkD;AAClD,MAAM,UAAU,aAAa,CAAC,KAAc;IAC1C,MAAM,CAAC,GAAG,IAAI,CAAC,SAAS,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC;IACtC,OAAO,CAAC,CAAC,QAAQ,CAAC,kBAAkB,CAAC,IAAI,CAAC,CAAC,QAAQ,CAAC,mBAAmB,CAAC,CAAC;AAC3E,CAAC;AAED;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,cAAc,CAC5B,IAAY;IAEZ,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC;QAAE,OAAO,EAAE,IAAI,EAAE,EAAE,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;IAC3D,IAAI,IAAa,CAAC;IAClB,IAAI,CAAC;QACH,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,CAAC;IAChD,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,aAAa,CAAC;IACvB,CAAC;IACD,IAAI,OAAO,IAAI,KAAK,QAAQ,IAAI,IAAI,KAAK,IAAI,IAAI,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC;QAAE,OAAO,aAAa,CAAC;IAC3F,OAAO,EAAE,IAAI,EAAE,IAA2B,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;AAC9D,CAAC"}
@@ -0,0 +1,21 @@
1
+ import type { PlannedWrite } from './plan.js';
2
+ import { type ConfigWrite } from './config-write.js';
3
+ import type { Brand } from '../brand.js';
4
+ /** `.cursor/hooks/julius-hooks.cjs`, or `julius-hooks.cjs` in a repo that uses julius. */
5
+ export declare function shimPathFor(repo: string, name?: Brand): string;
6
+ /**
7
+ * The files a Cursor-hooks install would touch — pure, no writes. Both are
8
+ * repo-local, so both are scoped 'repo' (they fire only in this repo, matching
9
+ * the Cursor-only, no-global init). Always returns the pair: unlike Codex there
10
+ * is no "is the CLI installed" gate — the repo's own `.cursor/` is what we write.
11
+ */
12
+ export declare function cursorHookTargets(repo: string, name?: Brand): PlannedWrite[];
13
+ /**
14
+ * Install (or refresh) julius's Cursor project hooks in `repo`. Idempotent, and
15
+ * conservative with a hand-edited config: an unparseable or wrong-shaped
16
+ * `hooks.json` is left exactly as-is (reported `skipped-unparseable`) rather than
17
+ * clobbered. Foreign hook entries are preserved; a stale julius entry is replaced
18
+ * so an upgrade re-points to the current shim/sub-command instead of stacking.
19
+ */
20
+ export declare function installCursorHooks(repo: string, name?: Brand): ConfigWrite[];
21
+ //# sourceMappingURL=cursor-hooks.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cursor-hooks.d.ts","sourceRoot":"","sources":["../../src/hosts/cursor-hooks.ts"],"names":[],"mappings":"AA2BA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAC9C,OAAO,EAA6C,KAAK,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhG,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAKzC,0FAA0F;AAC1F,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,GAAE,KAAgB,GAAG,MAAM,CAExE;AAKD;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,GAAE,KAAgB,GAAG,YAAY,EAAE,CAatF;AAgBD;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,GAAE,KAAgB,GAAG,WAAW,EAAE,CA2BtF"}