@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,209 @@
1
+ /**
2
+ * Session usage accounting, shared across every host (Claude Code, Cursor, and
3
+ * plain MCP). It answers the one question the README rests on: when an agent had
4
+ * both julius and grep in front of it, which did it reach for, and how much did
5
+ * that save?
6
+ *
7
+ * The counters (`juliusReads`, `sourceReads`, `savedTokens`) already live on
8
+ * {@link SessionState}; before this module nothing ever incremented the first
9
+ * two, so `session_summary` telemetry shipped 0/0 for every session. Everything
10
+ * here is a pure classify + read-modify-write over `julius/.cache/session/`, so a
11
+ * host adapter is a few lines: parse its payload, call {@link recordToolUse}.
12
+ *
13
+ * Two payload shapes feed it, confirmed against the vendor docs rather than
14
+ * guessed (the matcher depends on getting the names right):
15
+ *
16
+ * - Claude Code `PostToolUse` — `{ tool_name, tool_input: { command }, tool_response }`.
17
+ * A julius retrieval prints a `[julius] tokens saved ≈ N` footer into
18
+ * `tool_response`, which is itself proof julius ran.
19
+ * - Cursor `postToolUse` — `{ tool_name, tool_input, tool_output, conversation_id }`
20
+ * (https://cursor.com/docs/hooks). `tool_output` is the JSON-stringified
21
+ * result; a Shell `julius …` call carries the same footer inside its stdout.
22
+ * - Cursor `afterMCPExecution` — `{ tool_name, tool_input, result_json, duration }`.
23
+ * Fires only for MCP tools, so a julius tool is recognised by its name and
24
+ * its savings read out of `result_json`.
25
+ *
26
+ * MCP tool names arrive host-prefixed in different shapes (`julius_find_code`,
27
+ * `MCP:julius_find_code`, `mcp__julius__julius_find_code`). {@link isJuliusMcpTool}
28
+ * strips the prefix to the last delimited segment and checks it against the real
29
+ * name list (`JULIUS_MCP_TOOL_NAMES`), so a julius tool is recognised across every
30
+ * host format while a third-party tool that merely contains "julius" is not.
31
+ */
32
+ import { statSync } from 'node:fs';
33
+ import { join } from 'node:path';
34
+ import { sumSavingsFooters } from '../context/savings.js';
35
+ import { dollarsSaved, formatDollars } from '../context/price.js';
36
+ import { readSession, writeSession, sessionDir, listSessionIds } from './state.js';
37
+ import { JULIUS_MCP_TOOL_NAMES } from '../mcp/tool-names.js';
38
+ import { brand, cmd } from '../brand.js';
39
+ /** Native tools that mean "the agent went to read source itself" — the grep/read
40
+ * path julius is meant to replace. These are the host tool NAMES (Claude Code and
41
+ * Cursor both use Read/Grep/Glob; Cursor adds Search); shell builtins like `ls`
42
+ * are commands, never tool names, so they belong to the Shell branch, not here.
43
+ * Compared lower-cased. */
44
+ const SOURCE_TOOLS = new Set(['read', 'grep', 'glob', 'search']);
45
+ /** The host's shell tool, whose `command` we then inspect for a julius invocation. */
46
+ function isShellTool(t) {
47
+ return t === 'bash' || t === 'shell';
48
+ }
49
+ /** An MCP-style tool name (server-prefixed), as opposed to a native Read/Shell.
50
+ * Used to hand julius MCP calls to the dedicated MCP hook so a host that fires
51
+ * BOTH a generic post-tool hook and an MCP hook can't double-count them. */
52
+ export function isMcpToolName(toolName) {
53
+ const t = toolName.toLowerCase();
54
+ return t.startsWith('mcp') || t.includes(':') || t.includes('__');
55
+ }
56
+ /**
57
+ * Whether a tool name is one of julius's MCP tools, across every host prefix.
58
+ * Anchored on the real name list (`julius_find_code`, its legacy aliases, …), not
59
+ * a loose `includes('julius')`: a third-party MCP tool whose name merely contains
60
+ * "julius" (or a repo working on julius itself) must not count as a julius read —
61
+ * the same care `commandInvokesJulius` takes for the CLI side. Strips the host
62
+ * prefix first (`mcp__julius__julius_find_code`, `MCP:julius_find_code`) by taking
63
+ * the last delimited segment. */
64
+ export function isJuliusMcpTool(toolName) {
65
+ const t = toolName.toLowerCase();
66
+ const bare = t.split(/[:./]|__/).pop() ?? t;
67
+ return JULIUS_MCP_TOOL_NAMES.has(bare);
68
+ }
69
+ /** Whether a shell command line invokes the CLI under either name (any of its install shapes). */
70
+ export function commandInvokesJulius(command) {
71
+ const c = command.trim();
72
+ // running from a source checkout
73
+ if (/dist[/\\](cli|bin[/\\]julius)\.js/.test(c))
74
+ return true;
75
+ // `julius …`, `julius-dev …`, `npx [-y] [@ruverd/]julius …`, and the same for
76
+ // `julius` / `@ruverd/julius`, at the start of the line or of a &&/;/| segment —
77
+ // not "myjulius" or a path that merely contains it.
78
+ return /(^|[|&;]\s*)(npx\s+(-y\s+)?(@ruverd\/)?)?julius(-dev)?\b/i.test(c);
79
+ }
80
+ /**
81
+ * Classify one tool use as a julius retrieval, a source read, or neither
82
+ * (an edit, a task spawn, an unrelated shell command — no retrieval signal).
83
+ * `command` is the shell command line when `toolName` is the host's shell tool.
84
+ */
85
+ export function classifyToolUse(toolName, command) {
86
+ const t = (toolName ?? '').toLowerCase();
87
+ if (!t)
88
+ return null;
89
+ if (isJuliusMcpTool(t))
90
+ return 'julius';
91
+ if (SOURCE_TOOLS.has(t))
92
+ return 'source';
93
+ if (isShellTool(t) && command && commandInvokesJulius(command))
94
+ return 'julius';
95
+ return null;
96
+ }
97
+ /** Sum every `[julius] tokens saved ≈ N` footer in a blob of tool output. Thin
98
+ * alias over {@link sumSavingsFooters}, which lives next to the code that writes
99
+ * the footer so the two can't drift. */
100
+ export function parseSavings(blob) {
101
+ return sumSavingsFooters(blob);
102
+ }
103
+ /**
104
+ * Fold one tool use into a session's counters. A no-op when there is nothing to
105
+ * record (kind null and no savings), so a host can call it unconditionally after
106
+ * every tool without first checking whether the tool was interesting — the
107
+ * no-write path is what keeps it cheap on the Write/Edit/Task majority.
108
+ *
109
+ * Best-effort read-modify-write, not locked — mirroring `patchStats` in
110
+ * util/state.ts. Two tool-use hooks racing on the same session file can lose a
111
+ * count; that is acceptable for an episodic usage estimate (worst case is an
112
+ * undercount by one, never corruption thanks to the atomic write), and a lock
113
+ * here would contend with the build lock these hooks also touch.
114
+ */
115
+ export function recordToolUse(dir, sessionId, use) {
116
+ const saved = use.savedTokens ?? 0;
117
+ if (!use.kind && saved <= 0)
118
+ return;
119
+ const id = sessionId || 'default';
120
+ const s = readSession(dir, id);
121
+ if (use.kind === 'julius')
122
+ s.juliusReads = (s.juliusReads ?? 0) + 1;
123
+ else if (use.kind === 'source')
124
+ s.sourceReads = (s.sourceReads ?? 0) + 1;
125
+ if (saved > 0)
126
+ s.savedTokens = (s.savedTokens ?? 0) + saved;
127
+ // A julius use owes a tally in this turn's reply; the Stop hook (countTallyTurn)
128
+ // resolves whether it got one and clears the flag. A flag, not a count — a turn
129
+ // with several julius calls is still one reply to the user.
130
+ if (use.kind === 'julius')
131
+ s.turnUsedJulius = true;
132
+ // Stamp the host once; the first tool use that lands owns the attribution.
133
+ if (use.host && !s.host)
134
+ s.host = use.host;
135
+ writeSession(dir, id, s);
136
+ }
137
+ /** The most-recently-touched session file for a repo, or null when none exist —
138
+ * what `julius stats` shows by default: the session you were just in. */
139
+ export function latestSession(dir) {
140
+ const sdir = sessionDir(dir);
141
+ let bestId = null;
142
+ let bestMtime = -Infinity;
143
+ for (const id of listSessionIds(dir)) {
144
+ let mtime;
145
+ try {
146
+ mtime = statSync(join(sdir, `${id}.json`)).mtimeMs;
147
+ }
148
+ catch {
149
+ continue;
150
+ }
151
+ if (mtime > bestMtime) {
152
+ bestMtime = mtime;
153
+ bestId = id;
154
+ }
155
+ }
156
+ if (bestId === null)
157
+ return null;
158
+ return { id: bestId, ...readSession(dir, bestId) };
159
+ }
160
+ /**
161
+ * A one-line-per-fact readout of a session's usage mix — Cursor has no
162
+ * statusline, so this is how you see the numbers the Claude Code bar would show.
163
+ * Reads local JSON only; sends nothing.
164
+ */
165
+ /**
166
+ * What this repo's most recent session has actually been paying per million
167
+ * input tokens, or null when no turn has been billed yet.
168
+ *
169
+ * `latestSession` rather than a session id because the callers are CLI and MCP
170
+ * processes answering one query: they know the repo, never the host's session
171
+ * id. The rate belongs to the repo's current session, which is the one whose
172
+ * reply the number is about to appear in.
173
+ */
174
+ export function sessionInputRate(dir) {
175
+ const s = latestSession(dir);
176
+ if (!s?.inputCostMicros || !s?.inputTokensBilled)
177
+ return null;
178
+ // Micro-dollars per token and dollars per million tokens are the same number:
179
+ // both divide by 1e6 once. Returned as $/Mtok because that is the unit the
180
+ // price table is written in and the one a reader can sanity-check against it.
181
+ return s.inputCostMicros / s.inputTokensBilled;
182
+ }
183
+ export function formatSessionStats(s) {
184
+ if (s === null) {
185
+ return `${cmd('julius status')}: no session recorded yet — use ${brand()} in an agent session, then look again.`;
186
+ }
187
+ const julius = s.juliusReads ?? 0;
188
+ const source = s.sourceReads ?? 0;
189
+ const saved = s.savedTokens ?? 0;
190
+ const total = julius + source;
191
+ const mix = total === 0 ? 'no retrieval yet' : `${Math.round((julius / total) * 100)}% julius`;
192
+ const lines = [
193
+ `${cmd('julius status')} — session ${s.id}`,
194
+ ` julius reads: ${julius}`,
195
+ ` source reads: ${source} (Read / Grep / Glob)`,
196
+ ` mix: ${mix}`,
197
+ ` tokens saved: ~${saved.toLocaleString()}`,
198
+ ];
199
+ // Omitted, not zeroed, when no turn has been billed yet: a host whose hooks
200
+ // name no transcript can't know what a token costs here, and a made-up rate
201
+ // would be worse than the silence.
202
+ const usd = dollarsSaved(saved, s.inputCostMicros, s.inputTokensBilled);
203
+ if (usd !== null)
204
+ lines.push(` value saved: ~${formatDollars(usd)}`);
205
+ if (s.lastQuery)
206
+ lines.push(` last query: ${s.lastQuery}`);
207
+ return lines.join('\n');
208
+ }
209
+ //# sourceMappingURL=session-metrics.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"session-metrics.js","sourceRoot":"","sources":["../../src/claude/session-metrics.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACnC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAClE,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,UAAU,EAAE,cAAc,EAAqB,MAAM,YAAY,CAAC;AAEtG,OAAO,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAC7D,OAAO,EAAE,KAAK,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AAIzC;;;;4BAI4B;AAC5B,MAAM,YAAY,GAAG,IAAI,GAAG,CAAC,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAC,CAAC;AAEjE,sFAAsF;AACtF,SA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+ type Json = Record<string, any>;
2
+ /** julius's committed hook, `.julius/hook.cjs`, run for one event. */
3
+ export declare function juliusHookCmd(arg: string): string;
4
+ /**
5
+ * Is this allowlist entry one julius wrote?
6
+ *
7
+ * Scoped to the forms julius is actually invoked as — NOT any rule mentioning
8
+ * "julius". A user who allowlists their own `Bash(julius-mytool:*)` keeps it; only
9
+ * julius's own set is replaced, which is what lets a renamed entry disappear on
10
+ * upgrade instead of accumulating beside its replacement.
11
+ */
12
+ export declare function isJuliusAllowEntry(entry: unknown): boolean;
13
+ /** Is this footer regex julius's? It points at the card tree, which is julius's alone. */
14
+ export declare function isJuliusFooterRegex(re: unknown): boolean;
15
+ /** True when init should write (or refresh) Julius's Claude Code statusLine. */
16
+ export declare function statuslineWanted(opts?: {
17
+ statusline?: boolean;
18
+ }): boolean;
19
+ export declare function mergeJuliusSettings(existing: Json, opts?: {
20
+ statusline?: boolean;
21
+ name?: 'julius';
22
+ }): {
23
+ merged: Json;
24
+ warnings: string[];
25
+ };
26
+ /**
27
+ * The hook blocks alone, merged into a settings file, with the shims addressed by
28
+ * absolute path — `~/.claude/settings.json`, where a write reaches every project on
29
+ * the machine (see hosts/claude-global.ts for why that copy has to exist).
30
+ *
31
+ * Hooks only, deliberately. `mergeJuliusSettings` also claims the statusline, the
32
+ * footer regex and a Bash allowlist, and each of those is a reasonable thing to
33
+ * accept for a repo you ran `julius init` in and an unreasonable thing to impose on
34
+ * every repo you ever open — a statusline especially, since a session allows exactly
35
+ * one and taking it globally would silently outrank the user's own. The hooks are the
36
+ * piece that has to be global, because they are what a worktree loses.
37
+ *
38
+ * Same idempotent shape as the repo merge: julius's prior entries are dropped before
39
+ * the current set is added, so re-running converges instead of stacking.
40
+ */
41
+ export declare function mergeJuliusHooks(existing: Json, helpers: string): {
42
+ merged: Json;
43
+ };
44
+ /**
45
+ * julius's part of the committed `.claude/settings.json`: one SessionStart entry
46
+ * running `.julius/hook.cjs`, and nothing else. For a teammate without julius it
47
+ * shows the learnings and offers julius; with julius it hands off to the install.
48
+ * Anything an older init put here (status line, the other hooks, allowlist,
49
+ * footer regex) comes out, so the file a team commits is the same on every machine.
50
+ */
51
+ export declare function mergeJuliusShared(existing: Json): Json;
52
+ /**
53
+ * julius's part of `.claude/settings.local.json`, the person's own: the status
54
+ * line, the footer regex and the allowlist, plus, when `~/.claude` doesn't carry
55
+ * them (`--no-global`), the hooks for every event but session start, which the
56
+ * shared file already runs once.
57
+ */
58
+ export declare function mergeJuliusLocal(existing: Json, opts?: {
59
+ statusline?: boolean;
60
+ hooks?: boolean;
61
+ }): {
62
+ merged: Json;
63
+ warnings: string[];
64
+ };
65
+ export {};
66
+ //# sourceMappingURL=settings-merge.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"settings-merge.d.ts","sourceRoot":"","sources":["../../src/claude/settings-merge.ts"],"names":[],"mappings":"AAEA,KAAK,IAAI,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;AAiChC,sEAAsE;AACtE,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAEjD;AAiCD;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAE1D;AAED,0FAA0F;AAC1F,wBAAgB,mBAAmB,CAAC,EAAE,EAAE,OAAO,GAAG,OAAO,CAExD;AAOD,gFAAgF;AAChF,wBAAgB,gBAAgB,CAAC,IAAI,GAAE;IAAE,UAAU,CAAC,EAAE,OAAO,CAAA;CAAO,GAAG,OAAO,CAE7E;AA8BD,wBAAgB,mBAAmB,CACjC,QAAQ,EAAE,IAAI,EACd,IAAI,GAAE;IAAE,UAAU,CAAC,EAAE,OAAO,CAAC;IAAC,IAAI,CAAC,EAAE,QAAQ,CAAA;CAAO,GACnD;IAAE,MAAM,EAAE,IAAI,CAAC;IAAC,QAAQ,EAAE,MAAM,EAAE,CAAA;CAAE,CAuCtC;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,GAAG;IAAE,MAAM,EAAE,IAAI,CAAA;CAAE,CASlF;AA+BD;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,IAAI,GAAG,IAAI,CAQtD;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAC9B,QAAQ,EAAE,IAAI,EACd,IAAI,GAAE;IAAE,UAAU,CAAC,EAAE,OAAO,CAAC;IAAC,KAAK,CAAC,EAAE,OAAO,CAAA;CAAO,GACnD;IAAE,MAAM,EAAE,IAAI,CAAC;IAAC,QAAQ,EAAE,MAAM,EAAE,CAAA;CAAE,CAoBtC"}
@@ -0,0 +1,249 @@
1
+ import { isJuliusEntry } from '../hosts/config-write.js';
2
+ const slCmd = (name = 'julius') => `node "\${CLAUDE_PROJECT_DIR:-.}/.claude/helpers/${name}-statusline.cjs"`;
3
+ /** julius's status line, from the shim in `.julius/` (see claude/init.ts). */
4
+ const JULIUS_SL_CMD = 'node "${CLAUDE_PROJECT_DIR:-.}/.julius/statusline.cjs"';
5
+ /** Stable marker for "this statusLine is Julius's", not the full command string —
6
+ * an older shim path or a JULIUS_DIR wrapper still names this file. Either name. */
7
+ const STATUSLINE_HELPER = /(julius)-statusline\.cjs|\.julius\/statusline\.cjs/;
8
+ const FOOTER = 'julius/[\\w./-]+\\.md';
9
+ // Every form julius is actually invoked as. 'julius:*' covers a global install;
10
+ // the other two cover a repo working on julius itself (or any consumer running it
11
+ // from a checkout), where the binary is not on PATH under that name. A retrieval
12
+ // call that raises a permission prompt loses to grep, which never does.
13
+ const ALLOW_ENTRIES = [
14
+ 'Bash(julius:*)',
15
+ 'Bash(npx julius:*)',
16
+ 'Bash(julius-dev:*)',
17
+ 'Bash(node dist/cli.js:*)',
18
+ ];
19
+ /** Where the repo-level install's shims sit, relative to whatever project is open. */
20
+ const REPO_HELPERS = '${CLAUDE_PROJECT_DIR:-.}/.claude/helpers';
21
+ /**
22
+ * `helpers` is the directory holding `julius-hooks.cjs`, and it is a parameter for
23
+ * one reason: the user-level install (see hosts/claude-global.ts) has to name an
24
+ * absolute path. A `${CLAUDE_PROJECT_DIR}` command works only where a previous
25
+ * `julius init` wrote a shim into that project — which is exactly the case the
26
+ * global copy exists to cover, so it cannot reuse the repo form.
27
+ */
28
+ function hookCmd(arg, helpers = REPO_HELPERS, name = 'julius') {
29
+ return `node "${helpers}/${name}-hooks.cjs" ${arg}`;
30
+ }
31
+ /** julius's committed hook, `.julius/hook.cjs`, run for one event. */
32
+ export function juliusHookCmd(arg) {
33
+ return `node "\${CLAUDE_PROJECT_DIR:-.}/.julius/hook.cjs" ${arg}`;
34
+ }
35
+ function juliusBlocks(helpers, name = 'julius') {
36
+ return hookBlocks((arg) => hookCmd(arg, helpers, name));
37
+ }
38
+ function hookBlocks(hookCmd_) {
39
+ return {
40
+ PostToolUse: [
41
+ { matcher: 'Write|Edit|MultiEdit', hooks: [{ type: 'command', command: hookCmd_('post-edit'), timeout: 10000 }] },
42
+ // Score the usage mix and sum token savings. A julius retrieval (CLI `julius …`
43
+ // via Bash, or the `julius_*` MCP tools) prints a `[julius] tokens saved ≈ N`
44
+ // footer this hook sums into the session total; the same hook classifies
45
+ // Read/Grep/Glob as source reads vs julius as julius reads, which is what feeds
46
+ // `julius stats` and the `session_summary` julius-vs-grep ratio. Broad matcher,
47
+ // but the handler no-ops instantly unless there is something to record, so an
48
+ // unrelated Bash or a plain Read costs only a stdin read.
49
+ { matcher: 'Bash|mcp__julius__|Read|Grep|Glob', hooks: [{ type: 'command', command: hookCmd_('tool-savings'), timeout: 8000 }] },
50
+ ],
51
+ // Longer budget than the other hooks: its `julius ask` is a real query, and a
52
+ // query now brings the graph up to date first (graph/refresh.ts) — usually
53
+ // milliseconds, but the first one after an upgrade re-parses the repo once.
54
+ // `hooks.ts` reads this number back out of the installed settings.json at
55
+ // runtime and caps its `julius ask` child just under it, so a repo wired before
56
+ // this bump (8s) keeps a child that fits inside 8s. Changing the number here is
57
+ // therefore safe on its own — but it only reaches an existing repo when someone
58
+ // re-runs `julius init`, since that is the only caller of this function.
59
+ UserPromptSubmit: [{ hooks: [{ type: 'command', command: hookCmd_('prompt'), timeout: 15000 }] }],
60
+ SessionStart: [{ hooks: [{ type: 'command', command: hookCmd_('session-start'), timeout: 8000 }] }],
61
+ Stop: [{ hooks: [{ type: 'command', command: hookCmd_('stop'), timeout: 8000 }] }],
62
+ // Sends the telemetry queue in a detached child, so closing Claude isn't
63
+ // slowed. Not fired when the terminal is killed; session start sends what's left.
64
+ SessionEnd: [{ hooks: [{ type: 'command', command: hookCmd_('session-end'), timeout: 5000 }] }],
65
+ };
66
+ }
67
+ /**
68
+ * Is this allowlist entry one julius wrote?
69
+ *
70
+ * Scoped to the forms julius is actually invoked as — NOT any rule mentioning
71
+ * "julius". A user who allowlists their own `Bash(julius-mytool:*)` keeps it; only
72
+ * julius's own set is replaced, which is what lets a renamed entry disappear on
73
+ * upgrade instead of accumulating beside its replacement.
74
+ */
75
+ export function isJuliusAllowEntry(entry) {
76
+ return /^Bash\((?:julius|npx julius|julius-dev|node dist\/cli\.js)(?::|\))/.test(String(entry));
77
+ }
78
+ /** Is this footer regex julius's? It points at the card tree, which is julius's alone. */
79
+ export function isJuliusFooterRegex(re) {
80
+ return String(re).includes('julius/');
81
+ }
82
+ function envNoStatusline() {
83
+ const v = process.env.JULIUS_NO_STATUSLINE;
84
+ return v !== undefined && v !== '' && v !== '0' && v !== 'false';
85
+ }
86
+ /** True when init should write (or refresh) Julius's Claude Code statusLine. */
87
+ export function statuslineWanted(opts = {}) {
88
+ return opts.statusline !== false && !envNoStatusline();
89
+ }
90
+ function isJuliusStatusline(value) {
91
+ if (!value || typeof value !== 'object')
92
+ return false;
93
+ const command = value.command;
94
+ return typeof command === 'string' && STATUSLINE_HELPER.test(command);
95
+ }
96
+ function applyStatusline(merged, key, warnings, wanted, foreignWarning, name = 'julius') {
97
+ const current = merged[key];
98
+ const ours = isJuliusStatusline(current);
99
+ if (!wanted) {
100
+ if (!current || ours)
101
+ delete merged[key];
102
+ else
103
+ warnings.push(foreignWarning);
104
+ return;
105
+ }
106
+ if (!current || ours) {
107
+ merged[key] = { type: 'command', command: slCmd(name) };
108
+ return;
109
+ }
110
+ warnings.push(foreignWarning);
111
+ }
112
+ export function mergeJuliusSettings(existing, opts = {}) {
113
+ const merged = { ...(existing ?? {}) };
114
+ const name = opts.name ?? 'julius';
115
+ const warnings = [];
116
+ const wanted = statuslineWanted(opts);
117
+ applyStatusline(merged, 'statusLine', warnings, wanted, `Existing statusLine left untouched (a session allows only one). To use ${'Julius'}, point it at .claude/helpers/${name}-statusline.cjs.`, name);
118
+ applyStatusline(merged, 'subagentStatusLine', warnings, wanted, 'Existing subagentStatusLine left untouched.', name);
119
+ merged.hooks = { ...(merged.hooks ?? {}) };
120
+ for (const [event, blocks] of Object.entries(juliusBlocks(undefined, name))) {
121
+ const prior = Array.isArray(merged.hooks[event]) ? merged.hooks[event] : [];
122
+ const foreign = prior.filter((e) => !isJuliusEntry(e)); // drop old Julius entries → idempotent
123
+ merged.hooks[event] = [...foreign, ...blocks];
124
+ }
125
+ // Drop julius's own prior regex before re-adding, so a change to FOOTER replaces
126
+ // the old pattern instead of stacking beside it. The user's regexes are kept.
127
+ const priorFooter = Array.isArray(merged.footerLinksRegexes) ? merged.footerLinksRegexes : [];
128
+ merged.footerLinksRegexes = [...priorFooter.filter((r) => !isJuliusFooterRegex(r)), FOOTER];
129
+ // headless/subagent runs hard-deny Bash by default; without an allowlist entry
130
+ // `julius ask`'s own Bash calls (and the skill it installs) can't run out-of-box.
131
+ // Same shape as the hooks merge above: drop julius's prior entries, then add the
132
+ // current set. Append-only left a renamed invocation form in the user's settings
133
+ // forever, with nothing able to remove it.
134
+ merged.permissions = { ...(merged.permissions ?? {}) };
135
+ const priorAllow = Array.isArray(merged.permissions.allow) ? merged.permissions.allow : [];
136
+ merged.permissions.allow = [...priorAllow.filter((e) => !isJuliusAllowEntry(e)), ...ALLOW_ENTRIES];
137
+ return { merged, warnings };
138
+ }
139
+ /**
140
+ * The hook blocks alone, merged into a settings file, with the shims addressed by
141
+ * absolute path — `~/.claude/settings.json`, where a write reaches every project on
142
+ * the machine (see hosts/claude-global.ts for why that copy has to exist).
143
+ *
144
+ * Hooks only, deliberately. `mergeJuliusSettings` also claims the statusline, the
145
+ * footer regex and a Bash allowlist, and each of those is a reasonable thing to
146
+ * accept for a repo you ran `julius init` in and an unreasonable thing to impose on
147
+ * every repo you ever open — a statusline especially, since a session allows exactly
148
+ * one and taking it globally would silently outrank the user's own. The hooks are the
149
+ * piece that has to be global, because they are what a worktree loses.
150
+ *
151
+ * Same idempotent shape as the repo merge: julius's prior entries are dropped before
152
+ * the current set is added, so re-running converges instead of stacking.
153
+ */
154
+ export function mergeJuliusHooks(existing, helpers) {
155
+ const merged = { ...(existing ?? {}) };
156
+ merged.hooks = { ...(merged.hooks ?? {}) };
157
+ for (const [event, blocks] of Object.entries(juliusBlocks(helpers))) {
158
+ const prior = Array.isArray(merged.hooks[event]) ? merged.hooks[event] : [];
159
+ const foreign = prior.filter((e) => !isJuliusEntry(e));
160
+ merged.hooks[event] = [...foreign, ...blocks];
161
+ }
162
+ return { merged };
163
+ }
164
+ /** Drop every fragment julius wrote from a settings object, keeping the user's. */
165
+ function withoutOurs(existing) {
166
+ const merged = { ...(existing ?? {}) };
167
+ for (const key of ['statusLine', 'subagentStatusLine'])
168
+ if (isJuliusStatusline(merged[key]))
169
+ delete merged[key];
170
+ if (merged.hooks && typeof merged.hooks === 'object' && !Array.isArray(merged.hooks)) {
171
+ const hooks = {};
172
+ for (const [event, prior] of Object.entries(merged.hooks)) {
173
+ const kept = Array.isArray(prior) ? prior.filter((e) => !isJuliusEntry(e)) : prior;
174
+ if (!Array.isArray(kept) || kept.length)
175
+ hooks[event] = kept;
176
+ }
177
+ if (Object.keys(hooks).length)
178
+ merged.hooks = hooks;
179
+ else
180
+ delete merged.hooks;
181
+ }
182
+ if (Array.isArray(merged.footerLinksRegexes)) {
183
+ const kept = merged.footerLinksRegexes.filter((r) => !isJuliusFooterRegex(r));
184
+ if (kept.length)
185
+ merged.footerLinksRegexes = kept;
186
+ else
187
+ delete merged.footerLinksRegexes;
188
+ }
189
+ if (merged.permissions && typeof merged.permissions === 'object' && Array.isArray(merged.permissions.allow)) {
190
+ const allow = merged.permissions.allow.filter((e) => !isJuliusAllowEntry(e));
191
+ const permissions = { ...merged.permissions };
192
+ if (allow.length)
193
+ permissions.allow = allow;
194
+ else
195
+ delete permissions.allow;
196
+ if (Object.keys(permissions).length)
197
+ merged.permissions = permissions;
198
+ else
199
+ delete merged.permissions;
200
+ }
201
+ return merged;
202
+ }
203
+ /**
204
+ * julius's part of the committed `.claude/settings.json`: one SessionStart entry
205
+ * running `.julius/hook.cjs`, and nothing else. For a teammate without julius it
206
+ * shows the learnings and offers julius; with julius it hands off to the install.
207
+ * Anything an older init put here (status line, the other hooks, allowlist,
208
+ * footer regex) comes out, so the file a team commits is the same on every machine.
209
+ */
210
+ export function mergeJuliusShared(existing) {
211
+ const merged = withoutOurs(existing);
212
+ merged.hooks = { ...(merged.hooks ?? {}) };
213
+ merged.hooks.SessionStart = [
214
+ ...(Array.isArray(merged.hooks.SessionStart) ? merged.hooks.SessionStart : []),
215
+ { hooks: [{ type: 'command', command: juliusHookCmd('session-start'), timeout: 8000 }] },
216
+ ];
217
+ return merged;
218
+ }
219
+ /**
220
+ * julius's part of `.claude/settings.local.json`, the person's own: the status
221
+ * line, the footer regex and the allowlist, plus, when `~/.claude` doesn't carry
222
+ * them (`--no-global`), the hooks for every event but session start, which the
223
+ * shared file already runs once.
224
+ */
225
+ export function mergeJuliusLocal(existing, opts = {}) {
226
+ const merged = withoutOurs(existing);
227
+ const warnings = [];
228
+ if (statuslineWanted(opts)) {
229
+ for (const key of ['statusLine', 'subagentStatusLine']) {
230
+ if (!merged[key])
231
+ merged[key] = { type: 'command', command: JULIUS_SL_CMD };
232
+ else if (key === 'statusLine')
233
+ warnings.push('Existing statusLine left untouched (a session allows only one). To use Julius, point it at .julius/statusline.cjs.');
234
+ }
235
+ }
236
+ if (opts.hooks) {
237
+ merged.hooks = { ...(merged.hooks ?? {}) };
238
+ for (const [event, blocks] of Object.entries(hookBlocks(juliusHookCmd))) {
239
+ if (event === 'SessionStart')
240
+ continue;
241
+ merged.hooks[event] = [...(Array.isArray(merged.hooks[event]) ? merged.hooks[event] : []), ...blocks];
242
+ }
243
+ }
244
+ merged.footerLinksRegexes = [...(merged.footerLinksRegexes ?? []), FOOTER];
245
+ merged.permissions = { ...(merged.permissions ?? {}) };
246
+ merged.permissions.allow = [...(merged.permissions.allow ?? []), ...ALLOW_ENTRIES];
247
+ return { merged, warnings };
248
+ }
249
+ //# sourceMappingURL=settings-merge.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"settings-merge.js","sourceRoot":"","sources":["../../src/claude/settings-merge.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAIzD,MAAM,KAAK,GAAG,CAAC,IAAI,GAAa,QAAQ,EAAE,EAAE,CAAC,mDAAmD,IAAI,kBAAkB,CAAC;AACvH,8EAA8E;AAC9E,MAAM,aAAa,GAAG,wDAAwD,CAAC;AAC/E;oFACoF;AACpF,MAAM,iBAAiB,GAAG,oDAAoD,CAAC;AAC/E,MAAM,MAAM,GAAG,uBAAuB,CAAC;AACvC,gFAAgF;AAChF,kFAAkF;AAClF,iFAAiF;AACjF,wEAAwE;AACxE,MAAM,aAAa,GAAG;IACpB,gBAAgB;IAChB,oBAAoB;IACpB,oBAAoB;IACpB,0BAA0B;CAC3B,CAAC;AAEF,sFAAsF;AACtF,MAAM,YAAY,GAAG,0CAA0C,CAAC;AAEhE;;;;;;GAMG;AACH,SAAS,OAAO,CAAC,GAAW,EAAE,OAAO,GAAW,YAAY,EAAE,IAAI,GAAa,QAAQ;IACrF,OAAO,SAAS,OAAO,IAAI,IAAI,eAAe,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AC,CAAC;QACxG,CAAC;IACH,CAAC;IACD,MAAM,CAAC,kBAAkB,GAAG,CAAC,GAAG,CAAC,MAAM,CAAC,kBAAkB,IAAI,EAAE,CAAC,EAAE,MAAM,CAAC,CAAC;IAC3E,MAAM,CAAC,WAAW,GAAG,EAAE,GAAG,CAAC,MAAM,CAAC,WAAW,IAAI,EAAE,CAAC,EAAE,CAAC;IACvD,MAAM,CAAC,WAAW,CAAC,KAAK,GAAG,CAAC,GAAG,CAAC,MAAM,CAAC,WAAW,CAAC,KAAK,IAAI,EAAE,CAAC,EAAE,GAAG,aAAa,CAAC,CAAC;IACnF,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC;AAC9B,CAAC"}
@@ -0,0 +1,18 @@
1
+ export declare function statuslineShim(): string;
2
+ export declare function hooksShim(): string;
3
+ /** Where `rememberInstall` writes, and the shims read: `<julius home>/install.json`. */
4
+ export declare function installHintPath(home?: string, env?: NodeJS.ProcessEnv): string;
5
+ /**
6
+ * Record the `dist/claude` this process runs from, for the shims to find first.
7
+ *
8
+ * This is the machine-specific half of what a shim needs, kept on the machine:
9
+ * the julius home is never committed, so the path never reaches a teammate.
10
+ * Called wherever a shim is written. Written under `--no-global` too: like the
11
+ * learnings beside it, it is julius's own state, not another tool's config.
12
+ *
13
+ * Skipped when `dist` holds no built entry (running from source, under tsx),
14
+ * where there is nothing a shim could load. Best-effort: without the file the
15
+ * shims still find the package on their own.
16
+ */
17
+ export declare function rememberInstall(home?: string, env?: NodeJS.ProcessEnv, dist?: string): void;
18
+ //# sourceMappingURL=shim-template.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shim-template.d.ts","sourceRoot":"","sources":["../../src/claude/shim-template.ts"],"names":[],"mappings":"AA2MA,wBAAgB,cAAc,IAAI,MAAM,CAA8C;AACtF,wBAAgB,SAAS,IAAI,MAAM,CAAsE;AAEzG,wFAAwF;AACxF,wBAAgB,eAAe,CAAC,IAAI,GAAE,MAAkB,EAAE,GAAG,GAAE,MAAM,CAAC,UAAwB,GAAG,MAAM,CAEtG;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,eAAe,CAAC,IAAI,GAAE,MAAkB,EAAE,GAAG,GAAE,MAAM,CAAC,UAAwB,EAAE,IAAI,GAAE,MAAwB,GAAG,IAAI,CAGpI"}