olympus-ai 1.0.0

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 (573) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +691 -0
  3. package/dist/__tests__/example.test.d.ts +2 -0
  4. package/dist/__tests__/example.test.d.ts.map +1 -0
  5. package/dist/__tests__/example.test.js +20 -0
  6. package/dist/__tests__/example.test.js.map +1 -0
  7. package/dist/__tests__/hooks.test.d.ts +2 -0
  8. package/dist/__tests__/hooks.test.d.ts.map +1 -0
  9. package/dist/__tests__/hooks.test.js +644 -0
  10. package/dist/__tests__/hooks.test.js.map +1 -0
  11. package/dist/__tests__/installer.test.d.ts +2 -0
  12. package/dist/__tests__/installer.test.d.ts.map +1 -0
  13. package/dist/__tests__/installer.test.js +369 -0
  14. package/dist/__tests__/installer.test.js.map +1 -0
  15. package/dist/__tests__/model-routing.test.d.ts +2 -0
  16. package/dist/__tests__/model-routing.test.d.ts.map +1 -0
  17. package/dist/__tests__/model-routing.test.js +814 -0
  18. package/dist/__tests__/model-routing.test.js.map +1 -0
  19. package/dist/__tests__/skills.test.d.ts +2 -0
  20. package/dist/__tests__/skills.test.d.ts.map +1 -0
  21. package/dist/__tests__/skills.test.js +126 -0
  22. package/dist/__tests__/skills.test.js.map +1 -0
  23. package/dist/__tests__/types.test.d.ts +2 -0
  24. package/dist/__tests__/types.test.d.ts.map +1 -0
  25. package/dist/__tests__/types.test.js +77 -0
  26. package/dist/__tests__/types.test.js.map +1 -0
  27. package/dist/agents/definitions.d.ts +105 -0
  28. package/dist/agents/definitions.d.ts.map +1 -0
  29. package/dist/agents/definitions.js +1379 -0
  30. package/dist/agents/definitions.js.map +1 -0
  31. package/dist/agents/document-writer.d.ts +11 -0
  32. package/dist/agents/document-writer.d.ts.map +1 -0
  33. package/dist/agents/document-writer.js +209 -0
  34. package/dist/agents/document-writer.js.map +1 -0
  35. package/dist/agents/explore.d.ts +12 -0
  36. package/dist/agents/explore.d.ts.map +1 -0
  37. package/dist/agents/explore.js +103 -0
  38. package/dist/agents/explore.js.map +1 -0
  39. package/dist/agents/frontend-engineer.d.ts +11 -0
  40. package/dist/agents/frontend-engineer.d.ts.map +1 -0
  41. package/dist/agents/frontend-engineer.js +115 -0
  42. package/dist/agents/frontend-engineer.js.map +1 -0
  43. package/dist/agents/index.d.ts +21 -0
  44. package/dist/agents/index.d.ts.map +1 -0
  45. package/dist/agents/index.js +27 -0
  46. package/dist/agents/index.js.map +1 -0
  47. package/dist/agents/librarian.d.ts +12 -0
  48. package/dist/agents/librarian.d.ts.map +1 -0
  49. package/dist/agents/librarian.js +103 -0
  50. package/dist/agents/librarian.js.map +1 -0
  51. package/dist/agents/metis.d.ts +12 -0
  52. package/dist/agents/metis.d.ts.map +1 -0
  53. package/dist/agents/metis.js +117 -0
  54. package/dist/agents/metis.js.map +1 -0
  55. package/dist/agents/momus.d.ts +12 -0
  56. package/dist/agents/momus.d.ts.map +1 -0
  57. package/dist/agents/momus.js +128 -0
  58. package/dist/agents/momus.js.map +1 -0
  59. package/dist/agents/multimodal-looker.d.ts +11 -0
  60. package/dist/agents/multimodal-looker.d.ts.map +1 -0
  61. package/dist/agents/multimodal-looker.js +70 -0
  62. package/dist/agents/multimodal-looker.js.map +1 -0
  63. package/dist/agents/olympian.d.ts +12 -0
  64. package/dist/agents/olympian.d.ts.map +1 -0
  65. package/dist/agents/olympian.js +93 -0
  66. package/dist/agents/olympian.js.map +1 -0
  67. package/dist/agents/oracle.d.ts +13 -0
  68. package/dist/agents/oracle.d.ts.map +1 -0
  69. package/dist/agents/oracle.js +191 -0
  70. package/dist/agents/oracle.js.map +1 -0
  71. package/dist/agents/orchestrator-olympus.d.ts +11 -0
  72. package/dist/agents/orchestrator-olympus.d.ts.map +1 -0
  73. package/dist/agents/orchestrator-olympus.js +115 -0
  74. package/dist/agents/orchestrator-olympus.js.map +1 -0
  75. package/dist/agents/orchestrator-sisyphus.d.ts +11 -0
  76. package/dist/agents/orchestrator-sisyphus.d.ts.map +1 -0
  77. package/dist/agents/orchestrator-sisyphus.js +115 -0
  78. package/dist/agents/orchestrator-sisyphus.js.map +1 -0
  79. package/dist/agents/prometheus.d.ts +12 -0
  80. package/dist/agents/prometheus.d.ts.map +1 -0
  81. package/dist/agents/prometheus.js +156 -0
  82. package/dist/agents/prometheus.js.map +1 -0
  83. package/dist/agents/qa-tester.d.ts +16 -0
  84. package/dist/agents/qa-tester.d.ts.map +1 -0
  85. package/dist/agents/qa-tester.js +367 -0
  86. package/dist/agents/qa-tester.js.map +1 -0
  87. package/dist/agents/sisyphus-junior.d.ts +12 -0
  88. package/dist/agents/sisyphus-junior.d.ts.map +1 -0
  89. package/dist/agents/sisyphus-junior.js +93 -0
  90. package/dist/agents/sisyphus-junior.js.map +1 -0
  91. package/dist/agents/types.d.ts +120 -0
  92. package/dist/agents/types.d.ts.map +1 -0
  93. package/dist/agents/types.js +38 -0
  94. package/dist/agents/types.js.map +1 -0
  95. package/dist/agents/utils.d.ts +49 -0
  96. package/dist/agents/utils.d.ts.map +1 -0
  97. package/dist/agents/utils.js +164 -0
  98. package/dist/agents/utils.js.map +1 -0
  99. package/dist/cli/index.d.ts +13 -0
  100. package/dist/cli/index.d.ts.map +1 -0
  101. package/dist/cli/index.js +496 -0
  102. package/dist/cli/index.js.map +1 -0
  103. package/dist/commands/index.d.ts +78 -0
  104. package/dist/commands/index.d.ts.map +1 -0
  105. package/dist/commands/index.js +148 -0
  106. package/dist/commands/index.js.map +1 -0
  107. package/dist/config/index.d.ts +5 -0
  108. package/dist/config/index.d.ts.map +1 -0
  109. package/dist/config/index.js +5 -0
  110. package/dist/config/index.js.map +1 -0
  111. package/dist/config/loader.d.ts +49 -0
  112. package/dist/config/loader.d.ts.map +1 -0
  113. package/dist/config/loader.js +380 -0
  114. package/dist/config/loader.js.map +1 -0
  115. package/dist/features/auto-update.d.ts +187 -0
  116. package/dist/features/auto-update.d.ts.map +1 -0
  117. package/dist/features/auto-update.js +539 -0
  118. package/dist/features/auto-update.js.map +1 -0
  119. package/dist/features/background-agent/concurrency.d.ts +53 -0
  120. package/dist/features/background-agent/concurrency.d.ts.map +1 -0
  121. package/dist/features/background-agent/concurrency.js +121 -0
  122. package/dist/features/background-agent/concurrency.js.map +1 -0
  123. package/dist/features/background-agent/index.d.ts +12 -0
  124. package/dist/features/background-agent/index.d.ts.map +1 -0
  125. package/dist/features/background-agent/index.js +12 -0
  126. package/dist/features/background-agent/index.js.map +1 -0
  127. package/dist/features/background-agent/manager.d.ts +134 -0
  128. package/dist/features/background-agent/manager.d.ts.map +1 -0
  129. package/dist/features/background-agent/manager.js +412 -0
  130. package/dist/features/background-agent/manager.js.map +1 -0
  131. package/dist/features/background-agent/types.d.ts +99 -0
  132. package/dist/features/background-agent/types.d.ts.map +1 -0
  133. package/dist/features/background-agent/types.js +9 -0
  134. package/dist/features/background-agent/types.js.map +1 -0
  135. package/dist/features/background-tasks.d.ts +99 -0
  136. package/dist/features/background-tasks.d.ts.map +1 -0
  137. package/dist/features/background-tasks.js +265 -0
  138. package/dist/features/background-tasks.js.map +1 -0
  139. package/dist/features/boulder-state/constants.d.ts +20 -0
  140. package/dist/features/boulder-state/constants.d.ts.map +1 -0
  141. package/dist/features/boulder-state/constants.js +20 -0
  142. package/dist/features/boulder-state/constants.js.map +1 -0
  143. package/dist/features/boulder-state/index.d.ts +12 -0
  144. package/dist/features/boulder-state/index.d.ts.map +1 -0
  145. package/dist/features/boulder-state/index.js +13 -0
  146. package/dist/features/boulder-state/index.js.map +1 -0
  147. package/dist/features/boulder-state/storage.d.ts +58 -0
  148. package/dist/features/boulder-state/storage.d.ts.map +1 -0
  149. package/dist/features/boulder-state/storage.js +174 -0
  150. package/dist/features/boulder-state/storage.js.map +1 -0
  151. package/dist/features/boulder-state/types.d.ts +48 -0
  152. package/dist/features/boulder-state/types.d.ts.map +1 -0
  153. package/dist/features/boulder-state/types.js +10 -0
  154. package/dist/features/boulder-state/types.js.map +1 -0
  155. package/dist/features/builtin-skills/index.d.ts +10 -0
  156. package/dist/features/builtin-skills/index.d.ts.map +1 -0
  157. package/dist/features/builtin-skills/index.js +10 -0
  158. package/dist/features/builtin-skills/index.js.map +1 -0
  159. package/dist/features/builtin-skills/skills.d.ts +21 -0
  160. package/dist/features/builtin-skills/skills.d.ts.map +1 -0
  161. package/dist/features/builtin-skills/skills.js +1082 -0
  162. package/dist/features/builtin-skills/skills.js.map +1 -0
  163. package/dist/features/builtin-skills/types.d.ts +60 -0
  164. package/dist/features/builtin-skills/types.d.ts.map +1 -0
  165. package/dist/features/builtin-skills/types.js +9 -0
  166. package/dist/features/builtin-skills/types.js.map +1 -0
  167. package/dist/features/context-injector/collector.d.ts +56 -0
  168. package/dist/features/context-injector/collector.d.ts.map +1 -0
  169. package/dist/features/context-injector/collector.js +122 -0
  170. package/dist/features/context-injector/collector.js.map +1 -0
  171. package/dist/features/context-injector/index.d.ts +12 -0
  172. package/dist/features/context-injector/index.d.ts.map +1 -0
  173. package/dist/features/context-injector/index.js +13 -0
  174. package/dist/features/context-injector/index.js.map +1 -0
  175. package/dist/features/context-injector/injector.d.ts +47 -0
  176. package/dist/features/context-injector/injector.d.ts.map +1 -0
  177. package/dist/features/context-injector/injector.js +103 -0
  178. package/dist/features/context-injector/injector.js.map +1 -0
  179. package/dist/features/context-injector/types.d.ts +103 -0
  180. package/dist/features/context-injector/types.d.ts.map +1 -0
  181. package/dist/features/context-injector/types.js +11 -0
  182. package/dist/features/context-injector/types.js.map +1 -0
  183. package/dist/features/continuation-enforcement.d.ts +36 -0
  184. package/dist/features/continuation-enforcement.d.ts.map +1 -0
  185. package/dist/features/continuation-enforcement.js +175 -0
  186. package/dist/features/continuation-enforcement.js.map +1 -0
  187. package/dist/features/index.d.ts +12 -0
  188. package/dist/features/index.d.ts.map +1 -0
  189. package/dist/features/index.js +49 -0
  190. package/dist/features/index.js.map +1 -0
  191. package/dist/features/magic-keywords.d.ts +28 -0
  192. package/dist/features/magic-keywords.d.ts.map +1 -0
  193. package/dist/features/magic-keywords.js +421 -0
  194. package/dist/features/magic-keywords.js.map +1 -0
  195. package/dist/features/model-routing/index.d.ts +34 -0
  196. package/dist/features/model-routing/index.d.ts.map +1 -0
  197. package/dist/features/model-routing/index.js +48 -0
  198. package/dist/features/model-routing/index.js.map +1 -0
  199. package/dist/features/model-routing/prompts/haiku.d.ts +54 -0
  200. package/dist/features/model-routing/prompts/haiku.d.ts.map +1 -0
  201. package/dist/features/model-routing/prompts/haiku.js +141 -0
  202. package/dist/features/model-routing/prompts/haiku.js.map +1 -0
  203. package/dist/features/model-routing/prompts/index.d.ts +45 -0
  204. package/dist/features/model-routing/prompts/index.d.ts.map +1 -0
  205. package/dist/features/model-routing/prompts/index.js +116 -0
  206. package/dist/features/model-routing/prompts/index.js.map +1 -0
  207. package/dist/features/model-routing/prompts/opus.d.ts +34 -0
  208. package/dist/features/model-routing/prompts/opus.d.ts.map +1 -0
  209. package/dist/features/model-routing/prompts/opus.js +153 -0
  210. package/dist/features/model-routing/prompts/opus.js.map +1 -0
  211. package/dist/features/model-routing/prompts/sonnet.d.ts +38 -0
  212. package/dist/features/model-routing/prompts/sonnet.d.ts.map +1 -0
  213. package/dist/features/model-routing/prompts/sonnet.js +149 -0
  214. package/dist/features/model-routing/prompts/sonnet.js.map +1 -0
  215. package/dist/features/model-routing/router.d.ts +92 -0
  216. package/dist/features/model-routing/router.d.ts.map +1 -0
  217. package/dist/features/model-routing/router.js +267 -0
  218. package/dist/features/model-routing/router.js.map +1 -0
  219. package/dist/features/model-routing/rules.d.ts +32 -0
  220. package/dist/features/model-routing/rules.d.ts.map +1 -0
  221. package/dist/features/model-routing/rules.js +224 -0
  222. package/dist/features/model-routing/rules.js.map +1 -0
  223. package/dist/features/model-routing/scorer.d.ts +35 -0
  224. package/dist/features/model-routing/scorer.d.ts.map +1 -0
  225. package/dist/features/model-routing/scorer.js +241 -0
  226. package/dist/features/model-routing/scorer.js.map +1 -0
  227. package/dist/features/model-routing/signals.d.ts +26 -0
  228. package/dist/features/model-routing/signals.d.ts.map +1 -0
  229. package/dist/features/model-routing/signals.js +283 -0
  230. package/dist/features/model-routing/signals.js.map +1 -0
  231. package/dist/features/model-routing/types.d.ts +195 -0
  232. package/dist/features/model-routing/types.d.ts.map +1 -0
  233. package/dist/features/model-routing/types.js +86 -0
  234. package/dist/features/model-routing/types.js.map +1 -0
  235. package/dist/hooks/agent-usage-reminder/constants.d.ts +17 -0
  236. package/dist/hooks/agent-usage-reminder/constants.d.ts.map +1 -0
  237. package/dist/hooks/agent-usage-reminder/constants.js +58 -0
  238. package/dist/hooks/agent-usage-reminder/constants.js.map +1 -0
  239. package/dist/hooks/agent-usage-reminder/index.d.ts +36 -0
  240. package/dist/hooks/agent-usage-reminder/index.d.ts.map +1 -0
  241. package/dist/hooks/agent-usage-reminder/index.js +89 -0
  242. package/dist/hooks/agent-usage-reminder/index.js.map +1 -0
  243. package/dist/hooks/agent-usage-reminder/storage.d.ts +12 -0
  244. package/dist/hooks/agent-usage-reminder/storage.d.ts.map +1 -0
  245. package/dist/hooks/agent-usage-reminder/storage.js +39 -0
  246. package/dist/hooks/agent-usage-reminder/storage.js.map +1 -0
  247. package/dist/hooks/agent-usage-reminder/types.d.ts +14 -0
  248. package/dist/hooks/agent-usage-reminder/types.d.ts.map +1 -0
  249. package/dist/hooks/agent-usage-reminder/types.js +9 -0
  250. package/dist/hooks/agent-usage-reminder/types.js.map +1 -0
  251. package/dist/hooks/ascent-verifier/index.d.ts +72 -0
  252. package/dist/hooks/ascent-verifier/index.d.ts.map +1 -0
  253. package/dist/hooks/ascent-verifier/index.js +223 -0
  254. package/dist/hooks/ascent-verifier/index.js.map +1 -0
  255. package/dist/hooks/auto-slash-command/constants.d.ts +19 -0
  256. package/dist/hooks/auto-slash-command/constants.d.ts.map +1 -0
  257. package/dist/hooks/auto-slash-command/constants.js +28 -0
  258. package/dist/hooks/auto-slash-command/constants.js.map +1 -0
  259. package/dist/hooks/auto-slash-command/detector.d.ts +33 -0
  260. package/dist/hooks/auto-slash-command/detector.d.ts.map +1 -0
  261. package/dist/hooks/auto-slash-command/detector.js +73 -0
  262. package/dist/hooks/auto-slash-command/detector.js.map +1 -0
  263. package/dist/hooks/auto-slash-command/executor.d.ts +29 -0
  264. package/dist/hooks/auto-slash-command/executor.d.ts.map +1 -0
  265. package/dist/hooks/auto-slash-command/executor.js +214 -0
  266. package/dist/hooks/auto-slash-command/executor.js.map +1 -0
  267. package/dist/hooks/auto-slash-command/index.d.ts +53 -0
  268. package/dist/hooks/auto-slash-command/index.d.ts.map +1 -0
  269. package/dist/hooks/auto-slash-command/index.js +105 -0
  270. package/dist/hooks/auto-slash-command/index.js.map +1 -0
  271. package/dist/hooks/auto-slash-command/types.d.ts +77 -0
  272. package/dist/hooks/auto-slash-command/types.d.ts.map +1 -0
  273. package/dist/hooks/auto-slash-command/types.js +9 -0
  274. package/dist/hooks/auto-slash-command/types.js.map +1 -0
  275. package/dist/hooks/background-notification/index.d.ts +60 -0
  276. package/dist/hooks/background-notification/index.d.ts.map +1 -0
  277. package/dist/hooks/background-notification/index.js +180 -0
  278. package/dist/hooks/background-notification/index.js.map +1 -0
  279. package/dist/hooks/background-notification/types.d.ts +64 -0
  280. package/dist/hooks/background-notification/types.d.ts.map +1 -0
  281. package/dist/hooks/background-notification/types.js +8 -0
  282. package/dist/hooks/background-notification/types.js.map +1 -0
  283. package/dist/hooks/bridge.d.ts +68 -0
  284. package/dist/hooks/bridge.d.ts.map +1 -0
  285. package/dist/hooks/bridge.js +321 -0
  286. package/dist/hooks/bridge.js.map +1 -0
  287. package/dist/hooks/comment-checker/constants.d.ts +28 -0
  288. package/dist/hooks/comment-checker/constants.d.ts.map +1 -0
  289. package/dist/hooks/comment-checker/constants.js +189 -0
  290. package/dist/hooks/comment-checker/constants.js.map +1 -0
  291. package/dist/hooks/comment-checker/filters.d.ts +39 -0
  292. package/dist/hooks/comment-checker/filters.d.ts.map +1 -0
  293. package/dist/hooks/comment-checker/filters.js +126 -0
  294. package/dist/hooks/comment-checker/filters.js.map +1 -0
  295. package/dist/hooks/comment-checker/index.d.ts +58 -0
  296. package/dist/hooks/comment-checker/index.d.ts.map +1 -0
  297. package/dist/hooks/comment-checker/index.js +298 -0
  298. package/dist/hooks/comment-checker/index.js.map +1 -0
  299. package/dist/hooks/comment-checker/types.d.ts +88 -0
  300. package/dist/hooks/comment-checker/types.d.ts.map +1 -0
  301. package/dist/hooks/comment-checker/types.js +9 -0
  302. package/dist/hooks/comment-checker/types.js.map +1 -0
  303. package/dist/hooks/context-window-limit-recovery/constants.d.ts +28 -0
  304. package/dist/hooks/context-window-limit-recovery/constants.d.ts.map +1 -0
  305. package/dist/hooks/context-window-limit-recovery/constants.js +85 -0
  306. package/dist/hooks/context-window-limit-recovery/constants.js.map +1 -0
  307. package/dist/hooks/context-window-limit-recovery/index.d.ts +62 -0
  308. package/dist/hooks/context-window-limit-recovery/index.d.ts.map +1 -0
  309. package/dist/hooks/context-window-limit-recovery/index.js +201 -0
  310. package/dist/hooks/context-window-limit-recovery/index.js.map +1 -0
  311. package/dist/hooks/context-window-limit-recovery/parser.d.ts +31 -0
  312. package/dist/hooks/context-window-limit-recovery/parser.d.ts.map +1 -0
  313. package/dist/hooks/context-window-limit-recovery/parser.js +241 -0
  314. package/dist/hooks/context-window-limit-recovery/parser.js.map +1 -0
  315. package/dist/hooks/context-window-limit-recovery/types.d.ts +84 -0
  316. package/dist/hooks/context-window-limit-recovery/types.d.ts.map +1 -0
  317. package/dist/hooks/context-window-limit-recovery/types.js +34 -0
  318. package/dist/hooks/context-window-limit-recovery/types.js.map +1 -0
  319. package/dist/hooks/directory-readme-injector/constants.d.ts +15 -0
  320. package/dist/hooks/directory-readme-injector/constants.d.ts.map +1 -0
  321. package/dist/hooks/directory-readme-injector/constants.js +17 -0
  322. package/dist/hooks/directory-readme-injector/constants.js.map +1 -0
  323. package/dist/hooks/directory-readme-injector/index.d.ts +41 -0
  324. package/dist/hooks/directory-readme-injector/index.d.ts.map +1 -0
  325. package/dist/hooks/directory-readme-injector/index.js +162 -0
  326. package/dist/hooks/directory-readme-injector/index.js.map +1 -0
  327. package/dist/hooks/directory-readme-injector/storage.d.ts +20 -0
  328. package/dist/hooks/directory-readme-injector/storage.d.ts.map +1 -0
  329. package/dist/hooks/directory-readme-injector/storage.js +56 -0
  330. package/dist/hooks/directory-readme-injector/storage.js.map +1 -0
  331. package/dist/hooks/directory-readme-injector/types.d.ts +20 -0
  332. package/dist/hooks/directory-readme-injector/types.d.ts.map +1 -0
  333. package/dist/hooks/directory-readme-injector/types.js +9 -0
  334. package/dist/hooks/directory-readme-injector/types.js.map +1 -0
  335. package/dist/hooks/edit-error-recovery/index.d.ts +62 -0
  336. package/dist/hooks/edit-error-recovery/index.d.ts.map +1 -0
  337. package/dist/hooks/edit-error-recovery/index.js +89 -0
  338. package/dist/hooks/edit-error-recovery/index.js.map +1 -0
  339. package/dist/hooks/empty-message-sanitizer/constants.d.ts +33 -0
  340. package/dist/hooks/empty-message-sanitizer/constants.d.ts.map +1 -0
  341. package/dist/hooks/empty-message-sanitizer/constants.js +37 -0
  342. package/dist/hooks/empty-message-sanitizer/constants.js.map +1 -0
  343. package/dist/hooks/empty-message-sanitizer/index.d.ts +59 -0
  344. package/dist/hooks/empty-message-sanitizer/index.d.ts.map +1 -0
  345. package/dist/hooks/empty-message-sanitizer/index.js +171 -0
  346. package/dist/hooks/empty-message-sanitizer/index.js.map +1 -0
  347. package/dist/hooks/empty-message-sanitizer/types.d.ts +79 -0
  348. package/dist/hooks/empty-message-sanitizer/types.d.ts.map +1 -0
  349. package/dist/hooks/empty-message-sanitizer/types.js +10 -0
  350. package/dist/hooks/empty-message-sanitizer/types.js.map +1 -0
  351. package/dist/hooks/index.d.ts +35 -0
  352. package/dist/hooks/index.d.ts.map +1 -0
  353. package/dist/hooks/index.js +81 -0
  354. package/dist/hooks/index.js.map +1 -0
  355. package/dist/hooks/keyword-detector/index.d.ts +40 -0
  356. package/dist/hooks/keyword-detector/index.d.ts.map +1 -0
  357. package/dist/hooks/keyword-detector/index.js +88 -0
  358. package/dist/hooks/keyword-detector/index.js.map +1 -0
  359. package/dist/hooks/non-interactive-env/constants.d.ts +35 -0
  360. package/dist/hooks/non-interactive-env/constants.d.ts.map +1 -0
  361. package/dist/hooks/non-interactive-env/constants.js +69 -0
  362. package/dist/hooks/non-interactive-env/constants.js.map +1 -0
  363. package/dist/hooks/non-interactive-env/detector.d.ts +2 -0
  364. package/dist/hooks/non-interactive-env/detector.d.ts.map +1 -0
  365. package/dist/hooks/non-interactive-env/detector.js +16 -0
  366. package/dist/hooks/non-interactive-env/detector.js.map +1 -0
  367. package/dist/hooks/non-interactive-env/index.d.ts +14 -0
  368. package/dist/hooks/non-interactive-env/index.d.ts.map +1 -0
  369. package/dist/hooks/non-interactive-env/index.js +72 -0
  370. package/dist/hooks/non-interactive-env/index.js.map +1 -0
  371. package/dist/hooks/non-interactive-env/types.d.ts +14 -0
  372. package/dist/hooks/non-interactive-env/types.d.ts.map +1 -0
  373. package/dist/hooks/non-interactive-env/types.js +2 -0
  374. package/dist/hooks/non-interactive-env/types.js.map +1 -0
  375. package/dist/hooks/olympus-orchestrator/constants.d.ts +23 -0
  376. package/dist/hooks/olympus-orchestrator/constants.d.ts.map +1 -0
  377. package/dist/hooks/olympus-orchestrator/constants.js +142 -0
  378. package/dist/hooks/olympus-orchestrator/constants.js.map +1 -0
  379. package/dist/hooks/olympus-orchestrator/index.d.ts +113 -0
  380. package/dist/hooks/olympus-orchestrator/index.d.ts.map +1 -0
  381. package/dist/hooks/olympus-orchestrator/index.js +283 -0
  382. package/dist/hooks/olympus-orchestrator/index.js.map +1 -0
  383. package/dist/hooks/persistent-mode/index.d.ts +40 -0
  384. package/dist/hooks/persistent-mode/index.d.ts.map +1 -0
  385. package/dist/hooks/persistent-mode/index.js +322 -0
  386. package/dist/hooks/persistent-mode/index.js.map +1 -0
  387. package/dist/hooks/plugin-patterns/index.d.ts +107 -0
  388. package/dist/hooks/plugin-patterns/index.d.ts.map +1 -0
  389. package/dist/hooks/plugin-patterns/index.js +289 -0
  390. package/dist/hooks/plugin-patterns/index.js.map +1 -0
  391. package/dist/hooks/preemptive-compaction/constants.d.ts +48 -0
  392. package/dist/hooks/preemptive-compaction/constants.d.ts.map +1 -0
  393. package/dist/hooks/preemptive-compaction/constants.js +90 -0
  394. package/dist/hooks/preemptive-compaction/constants.js.map +1 -0
  395. package/dist/hooks/preemptive-compaction/index.d.ts +55 -0
  396. package/dist/hooks/preemptive-compaction/index.d.ts.map +1 -0
  397. package/dist/hooks/preemptive-compaction/index.js +227 -0
  398. package/dist/hooks/preemptive-compaction/index.js.map +1 -0
  399. package/dist/hooks/preemptive-compaction/types.d.ts +76 -0
  400. package/dist/hooks/preemptive-compaction/types.d.ts.map +1 -0
  401. package/dist/hooks/preemptive-compaction/types.js +9 -0
  402. package/dist/hooks/preemptive-compaction/types.js.map +1 -0
  403. package/dist/hooks/ralph-loop/index.d.ts +60 -0
  404. package/dist/hooks/ralph-loop/index.d.ts.map +1 -0
  405. package/dist/hooks/ralph-loop/index.js +155 -0
  406. package/dist/hooks/ralph-loop/index.js.map +1 -0
  407. package/dist/hooks/ralph-verifier/index.d.ts +72 -0
  408. package/dist/hooks/ralph-verifier/index.d.ts.map +1 -0
  409. package/dist/hooks/ralph-verifier/index.js +223 -0
  410. package/dist/hooks/ralph-verifier/index.js.map +1 -0
  411. package/dist/hooks/rules-injector/constants.d.ts +25 -0
  412. package/dist/hooks/rules-injector/constants.d.ts.map +1 -0
  413. package/dist/hooks/rules-injector/constants.js +40 -0
  414. package/dist/hooks/rules-injector/constants.js.map +1 -0
  415. package/dist/hooks/rules-injector/finder.d.ts +24 -0
  416. package/dist/hooks/rules-injector/finder.d.ts.map +1 -0
  417. package/dist/hooks/rules-injector/finder.js +215 -0
  418. package/dist/hooks/rules-injector/finder.js.map +1 -0
  419. package/dist/hooks/rules-injector/index.d.ts +45 -0
  420. package/dist/hooks/rules-injector/index.d.ts.map +1 -0
  421. package/dist/hooks/rules-injector/index.js +187 -0
  422. package/dist/hooks/rules-injector/index.js.map +1 -0
  423. package/dist/hooks/rules-injector/matcher.d.ts +25 -0
  424. package/dist/hooks/rules-injector/matcher.d.ts.map +1 -0
  425. package/dist/hooks/rules-injector/matcher.js +70 -0
  426. package/dist/hooks/rules-injector/matcher.js.map +1 -0
  427. package/dist/hooks/rules-injector/parser.d.ts +20 -0
  428. package/dist/hooks/rules-injector/parser.d.ts.map +1 -0
  429. package/dist/hooks/rules-injector/parser.js +179 -0
  430. package/dist/hooks/rules-injector/parser.js.map +1 -0
  431. package/dist/hooks/rules-injector/storage.d.ts +26 -0
  432. package/dist/hooks/rules-injector/storage.d.ts.map +1 -0
  433. package/dist/hooks/rules-injector/storage.js +61 -0
  434. package/dist/hooks/rules-injector/storage.js.map +1 -0
  435. package/dist/hooks/rules-injector/types.d.ts +101 -0
  436. package/dist/hooks/rules-injector/types.d.ts.map +1 -0
  437. package/dist/hooks/rules-injector/types.js +10 -0
  438. package/dist/hooks/rules-injector/types.js.map +1 -0
  439. package/dist/hooks/session-recovery/constants.d.ts +56 -0
  440. package/dist/hooks/session-recovery/constants.d.ts.map +1 -0
  441. package/dist/hooks/session-recovery/constants.js +78 -0
  442. package/dist/hooks/session-recovery/constants.js.map +1 -0
  443. package/dist/hooks/session-recovery/index.d.ts +53 -0
  444. package/dist/hooks/session-recovery/index.d.ts.map +1 -0
  445. package/dist/hooks/session-recovery/index.js +321 -0
  446. package/dist/hooks/session-recovery/index.js.map +1 -0
  447. package/dist/hooks/session-recovery/storage.d.ts +76 -0
  448. package/dist/hooks/session-recovery/storage.d.ts.map +1 -0
  449. package/dist/hooks/session-recovery/storage.js +383 -0
  450. package/dist/hooks/session-recovery/storage.js.map +1 -0
  451. package/dist/hooks/session-recovery/types.d.ts +145 -0
  452. package/dist/hooks/session-recovery/types.d.ts.map +1 -0
  453. package/dist/hooks/session-recovery/types.js +8 -0
  454. package/dist/hooks/session-recovery/types.js.map +1 -0
  455. package/dist/hooks/sisyphus-orchestrator/constants.d.ts +23 -0
  456. package/dist/hooks/sisyphus-orchestrator/constants.d.ts.map +1 -0
  457. package/dist/hooks/sisyphus-orchestrator/constants.js +142 -0
  458. package/dist/hooks/sisyphus-orchestrator/constants.js.map +1 -0
  459. package/dist/hooks/sisyphus-orchestrator/index.d.ts +113 -0
  460. package/dist/hooks/sisyphus-orchestrator/index.d.ts.map +1 -0
  461. package/dist/hooks/sisyphus-orchestrator/index.js +283 -0
  462. package/dist/hooks/sisyphus-orchestrator/index.js.map +1 -0
  463. package/dist/hooks/the-ascent/index.d.ts +60 -0
  464. package/dist/hooks/the-ascent/index.d.ts.map +1 -0
  465. package/dist/hooks/the-ascent/index.js +155 -0
  466. package/dist/hooks/the-ascent/index.js.map +1 -0
  467. package/dist/hooks/think-mode/detector.d.ts +28 -0
  468. package/dist/hooks/think-mode/detector.d.ts.map +1 -0
  469. package/dist/hooks/think-mode/detector.js +105 -0
  470. package/dist/hooks/think-mode/detector.js.map +1 -0
  471. package/dist/hooks/think-mode/index.d.ts +70 -0
  472. package/dist/hooks/think-mode/index.d.ts.map +1 -0
  473. package/dist/hooks/think-mode/index.js +144 -0
  474. package/dist/hooks/think-mode/index.js.map +1 -0
  475. package/dist/hooks/think-mode/switcher.d.ts +39 -0
  476. package/dist/hooks/think-mode/switcher.d.ts.map +1 -0
  477. package/dist/hooks/think-mode/switcher.js +180 -0
  478. package/dist/hooks/think-mode/switcher.js.map +1 -0
  479. package/dist/hooks/think-mode/types.d.ts +60 -0
  480. package/dist/hooks/think-mode/types.d.ts.map +1 -0
  481. package/dist/hooks/think-mode/types.js +9 -0
  482. package/dist/hooks/think-mode/types.js.map +1 -0
  483. package/dist/hooks/thinking-block-validator/constants.d.ts +37 -0
  484. package/dist/hooks/thinking-block-validator/constants.d.ts.map +1 -0
  485. package/dist/hooks/thinking-block-validator/constants.js +50 -0
  486. package/dist/hooks/thinking-block-validator/constants.js.map +1 -0
  487. package/dist/hooks/thinking-block-validator/index.d.ts +35 -0
  488. package/dist/hooks/thinking-block-validator/index.d.ts.map +1 -0
  489. package/dist/hooks/thinking-block-validator/index.js +156 -0
  490. package/dist/hooks/thinking-block-validator/index.js.map +1 -0
  491. package/dist/hooks/thinking-block-validator/types.d.ts +67 -0
  492. package/dist/hooks/thinking-block-validator/types.d.ts.map +1 -0
  493. package/dist/hooks/thinking-block-validator/types.js +9 -0
  494. package/dist/hooks/thinking-block-validator/types.js.map +1 -0
  495. package/dist/hooks/todo-continuation/index.d.ts +39 -0
  496. package/dist/hooks/todo-continuation/index.d.ts.map +1 -0
  497. package/dist/hooks/todo-continuation/index.js +140 -0
  498. package/dist/hooks/todo-continuation/index.js.map +1 -0
  499. package/dist/hooks/ultrawork-state/index.d.ts +60 -0
  500. package/dist/hooks/ultrawork-state/index.d.ts.map +1 -0
  501. package/dist/hooks/ultrawork-state/index.js +207 -0
  502. package/dist/hooks/ultrawork-state/index.js.map +1 -0
  503. package/dist/index.d.ts +117 -0
  504. package/dist/index.d.ts.map +1 -0
  505. package/dist/index.js +175 -0
  506. package/dist/index.js.map +1 -0
  507. package/dist/installer/hooks.d.ts +196 -0
  508. package/dist/installer/hooks.d.ts.map +1 -0
  509. package/dist/installer/hooks.js +1385 -0
  510. package/dist/installer/hooks.js.map +1 -0
  511. package/dist/installer/index.d.ts +92 -0
  512. package/dist/installer/index.d.ts.map +1 -0
  513. package/dist/installer/index.js +2249 -0
  514. package/dist/installer/index.js.map +1 -0
  515. package/dist/mcp/index.d.ts +6 -0
  516. package/dist/mcp/index.d.ts.map +1 -0
  517. package/dist/mcp/index.js +5 -0
  518. package/dist/mcp/index.js.map +1 -0
  519. package/dist/mcp/servers.d.ts +77 -0
  520. package/dist/mcp/servers.d.ts.map +1 -0
  521. package/dist/mcp/servers.js +122 -0
  522. package/dist/mcp/servers.js.map +1 -0
  523. package/dist/shared/index.d.ts +5 -0
  524. package/dist/shared/index.d.ts.map +1 -0
  525. package/dist/shared/index.js +5 -0
  526. package/dist/shared/index.js.map +1 -0
  527. package/dist/shared/types.d.ts +159 -0
  528. package/dist/shared/types.d.ts.map +1 -0
  529. package/dist/shared/types.js +5 -0
  530. package/dist/shared/types.js.map +1 -0
  531. package/dist/tools/ast-tools.d.ts +63 -0
  532. package/dist/tools/ast-tools.d.ts.map +1 -0
  533. package/dist/tools/ast-tools.js +450 -0
  534. package/dist/tools/ast-tools.js.map +1 -0
  535. package/dist/tools/index.d.ts +52 -0
  536. package/dist/tools/index.d.ts.map +1 -0
  537. package/dist/tools/index.js +120 -0
  538. package/dist/tools/index.js.map +1 -0
  539. package/dist/tools/lsp/client.d.ts +201 -0
  540. package/dist/tools/lsp/client.d.ts.map +1 -0
  541. package/dist/tools/lsp/client.js +454 -0
  542. package/dist/tools/lsp/client.js.map +1 -0
  543. package/dist/tools/lsp/index.d.ts +9 -0
  544. package/dist/tools/lsp/index.d.ts.map +1 -0
  545. package/dist/tools/lsp/index.js +7 -0
  546. package/dist/tools/lsp/index.js.map +1 -0
  547. package/dist/tools/lsp/servers.d.ts +37 -0
  548. package/dist/tools/lsp/servers.d.ts.map +1 -0
  549. package/dist/tools/lsp/servers.js +149 -0
  550. package/dist/tools/lsp/servers.js.map +1 -0
  551. package/dist/tools/lsp/utils.d.ts +58 -0
  552. package/dist/tools/lsp/utils.d.ts.map +1 -0
  553. package/dist/tools/lsp/utils.js +236 -0
  554. package/dist/tools/lsp/utils.js.map +1 -0
  555. package/dist/tools/lsp-tools.d.ts +151 -0
  556. package/dist/tools/lsp-tools.d.ts.map +1 -0
  557. package/dist/tools/lsp-tools.js +358 -0
  558. package/dist/tools/lsp-tools.js.map +1 -0
  559. package/package.json +85 -0
  560. package/scripts/claude-sisyphus.sh +9 -0
  561. package/scripts/install.sh +1774 -0
  562. package/scripts/keyword-detector.mjs +209 -0
  563. package/scripts/keyword-detector.sh +71 -0
  564. package/scripts/persistent-mode.mjs +241 -0
  565. package/scripts/persistent-mode.sh +300 -0
  566. package/scripts/post-tool-verifier.mjs +217 -0
  567. package/scripts/post-tool-verifier.sh +196 -0
  568. package/scripts/pre-tool-enforcer.mjs +99 -0
  569. package/scripts/pre-tool-enforcer.sh +76 -0
  570. package/scripts/sisyphus-aliases.sh +18 -0
  571. package/scripts/stop-continuation.sh +31 -0
  572. package/scripts/test-pr25.sh +525 -0
  573. package/scripts/uninstall.sh +171 -0
@@ -0,0 +1,223 @@
1
+ /**
2
+ * The Ascent Verifier
3
+ *
4
+ * Adds oracle verification to the-ascent completion claims.
5
+ * When the-ascent outputs a completion promise, instead of immediately
6
+ * accepting it, we trigger an oracle verification phase.
7
+ *
8
+ * Flow:
9
+ * 1. Ascent-loop outputs <promise>TASK_COMPLETE</promise>
10
+ * 2. System detects this and enters verification mode
11
+ * 3. Oracle agent is invoked to verify the work
12
+ * 4. If oracle approves -> truly complete
13
+ * 5. If oracle finds flaws -> continue the-ascent with oracle feedback
14
+ */
15
+ import { existsSync, readFileSync, writeFileSync, unlinkSync, mkdirSync } from 'fs';
16
+ import { join } from 'path';
17
+ const DEFAULT_MAX_VERIFICATION_ATTEMPTS = 3;
18
+ /**
19
+ * Get verification state file path
20
+ */
21
+ function getVerificationStatePath(directory) {
22
+ return join(directory, '.olympus', 'ascent-verification.json');
23
+ }
24
+ /**
25
+ * Read verification state
26
+ */
27
+ export function readVerificationState(directory) {
28
+ const statePath = getVerificationStatePath(directory);
29
+ if (!existsSync(statePath)) {
30
+ return null;
31
+ }
32
+ try {
33
+ return JSON.parse(readFileSync(statePath, 'utf-8'));
34
+ }
35
+ catch {
36
+ return null;
37
+ }
38
+ }
39
+ /**
40
+ * Write verification state
41
+ */
42
+ export function writeVerificationState(directory, state) {
43
+ const statePath = getVerificationStatePath(directory);
44
+ const stateDir = join(directory, '.olympus');
45
+ if (!existsSync(stateDir)) {
46
+ try {
47
+ mkdirSync(stateDir, { recursive: true });
48
+ }
49
+ catch {
50
+ return false;
51
+ }
52
+ }
53
+ try {
54
+ writeFileSync(statePath, JSON.stringify(state, null, 2));
55
+ return true;
56
+ }
57
+ catch {
58
+ return false;
59
+ }
60
+ }
61
+ /**
62
+ * Clear verification state
63
+ */
64
+ export function clearVerificationState(directory) {
65
+ const statePath = getVerificationStatePath(directory);
66
+ if (existsSync(statePath)) {
67
+ try {
68
+ unlinkSync(statePath);
69
+ return true;
70
+ }
71
+ catch {
72
+ return false;
73
+ }
74
+ }
75
+ return true;
76
+ }
77
+ /**
78
+ * Start verification process
79
+ */
80
+ export function startVerification(directory, completionClaim, originalTask) {
81
+ const state = {
82
+ pending: true,
83
+ completion_claim: completionClaim,
84
+ verification_attempts: 0,
85
+ max_verification_attempts: DEFAULT_MAX_VERIFICATION_ATTEMPTS,
86
+ requested_at: new Date().toISOString(),
87
+ original_task: originalTask
88
+ };
89
+ writeVerificationState(directory, state);
90
+ return state;
91
+ }
92
+ /**
93
+ * Record oracle feedback
94
+ */
95
+ export function recordOracleFeedback(directory, approved, feedback) {
96
+ const state = readVerificationState(directory);
97
+ if (!state) {
98
+ return null;
99
+ }
100
+ state.verification_attempts += 1;
101
+ state.oracle_approved = approved;
102
+ state.oracle_feedback = feedback;
103
+ if (approved) {
104
+ // Clear state on approval
105
+ clearVerificationState(directory);
106
+ return { ...state, pending: false };
107
+ }
108
+ // Check if max attempts reached
109
+ if (state.verification_attempts >= state.max_verification_attempts) {
110
+ clearVerificationState(directory);
111
+ return { ...state, pending: false };
112
+ }
113
+ // Continue verification loop
114
+ writeVerificationState(directory, state);
115
+ return state;
116
+ }
117
+ /**
118
+ * Generate oracle verification prompt
119
+ */
120
+ export function getOracleVerificationPrompt(state) {
121
+ return `<ascent-verification>
122
+
123
+ [ORACLE VERIFICATION REQUIRED - Attempt ${state.verification_attempts + 1}/${state.max_verification_attempts}]
124
+
125
+ The agent claims the task is complete. Before accepting, YOU MUST verify with Oracle.
126
+
127
+ **Original Task:**
128
+ ${state.original_task}
129
+
130
+ **Completion Claim:**
131
+ ${state.completion_claim}
132
+
133
+ ${state.oracle_feedback ? `**Previous Oracle Feedback (rejected):**\n${state.oracle_feedback}\n` : ''}
134
+
135
+ ## MANDATORY VERIFICATION STEPS
136
+
137
+ 1. **Spawn Oracle Agent** for verification:
138
+ \`\`\`
139
+ Task(subagent_type="oracle", prompt="Verify this task completion claim...")
140
+ \`\`\`
141
+
142
+ 2. **Oracle must check:**
143
+ - Are ALL requirements from the original task met?
144
+ - Is the implementation complete, not partial?
145
+ - Are there any obvious bugs or issues?
146
+ - Does the code compile/run without errors?
147
+ - Are tests passing (if applicable)?
148
+
149
+ 3. **Based on Oracle's response:**
150
+ - If APPROVED: Output \`<oracle-approved>VERIFIED_COMPLETE</oracle-approved>\`
151
+ - If REJECTED: Continue working on the identified issues
152
+
153
+ DO NOT output the completion promise again until Oracle approves.
154
+
155
+ </ascent-verification>
156
+
157
+ ---
158
+
159
+ `;
160
+ }
161
+ /**
162
+ * Generate continuation prompt after oracle rejection
163
+ */
164
+ export function getOracleRejectionContinuationPrompt(state) {
165
+ return `<ascent-continuation-after-rejection>
166
+
167
+ [ORACLE REJECTED - Continue Working]
168
+
169
+ Oracle found issues with your completion claim. You must address them.
170
+
171
+ **Oracle Feedback:**
172
+ ${state.oracle_feedback}
173
+
174
+ **Original Task:**
175
+ ${state.original_task}
176
+
177
+ ## INSTRUCTIONS
178
+
179
+ 1. Address ALL issues identified by Oracle
180
+ 2. Do NOT claim completion again until issues are fixed
181
+ 3. When truly done, output the completion promise again
182
+ 4. Another Oracle verification will be triggered
183
+
184
+ Continue working now.
185
+
186
+ </ascent-continuation-after-rejection>
187
+
188
+ ---
189
+
190
+ `;
191
+ }
192
+ /**
193
+ * Check if text contains oracle approval
194
+ */
195
+ export function detectOracleApproval(text) {
196
+ return /<oracle-approved>.*?VERIFIED_COMPLETE.*?<\/oracle-approved>/is.test(text);
197
+ }
198
+ /**
199
+ * Check if text contains oracle rejection indicators
200
+ */
201
+ export function detectOracleRejection(text) {
202
+ // Look for explicit rejection patterns
203
+ const rejectionPatterns = [
204
+ /oracle.*?(rejected|found issues|not complete|incomplete)/i,
205
+ /issues? (found|identified|detected)/i,
206
+ /not yet complete/i,
207
+ /missing.*?(implementation|feature|test)/i,
208
+ /bug.*?(found|detected|identified)/i,
209
+ /error.*?(found|detected|identified)/i
210
+ ];
211
+ for (const pattern of rejectionPatterns) {
212
+ if (pattern.test(text)) {
213
+ // Extract feedback (rough heuristic)
214
+ const feedbackMatch = text.match(/(?:oracle|feedback|issue|problem|error|bug)[:\s]+([^.]+\.)/i);
215
+ return {
216
+ rejected: true,
217
+ feedback: feedbackMatch ? feedbackMatch[1] : 'Oracle found issues with the implementation.'
218
+ };
219
+ }
220
+ }
221
+ return { rejected: false, feedback: '' };
222
+ }
223
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/hooks/ralph-verifier/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,aAAa,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,IAAI,CAAC;AACpF,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAqB5B,MAAM,iCAAiC,GAAG,CAAC,CAAC;AAE5C;;GAEG;AACH,SAAS,wBAAwB,CAAC,SAAiB;IACjD,OAAO,IAAI,CAAC,SAAS,EAAE,UAAU,EAAE,0BAA0B,CAAC,CAAC;AACjE,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,qBAAqB,CAAC,SAAiB;IACrD,MAAM,SAAS,GAAG,wBAAwB,CAAC,SAAS,CAAC,CAAC;IACtD,IAAI,CAAC,UAAU,CAAC,SAAS,CAAC,EAAE,CAAC;QAC3B,OAAO,IAAI,CAAC;IACd,CAAC;IACD,IAAI,CAAC;QACH,OAAO,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC,CAAC;IACtD,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;I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AAE;;;;;;;;;;;;;;;;;;;;;;;;;;CA0BpG,CAAC;AACF,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,oCAAoC,CAAC,KAAwB;IAC3E,OAAO;;;;;;;EAOP,KAAK,CAAC,eAAe;;;EAGrB,KAAK,CAAC,aAAa;;;;;;;;;;;;;;;CAepB,CAAC;AACF,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,oBAAoB,CAAC,IAAY;IAC/C,OAAO,+DAA+D,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACpF,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,qBAAqB,CAAC,IAAY;IAChD,uCAAuC;IACvC,MAAM,iBAAiB,GAAG;QACxB,2DAA2D;QAC3D,sCAAsC;QACtC,mBAAmB;QACnB,0CAA0C;QAC1C,oCAAoC;QACpC,sCAAsC;KACvC,CAAC;IAEF,KAAK,MAAM,OAAO,IAAI,iBAAiB,EAAE,CAAC;QACxC,IAAI,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;YACvB,qCAAqC;YACrC,MAAM,aAAa,GAAG,IAAI,CAAC,KAAK,CAAC,6DAA6D,CAAC,CAAC;YAChG,OAAO;gBACL,QAAQ,EAAE,IAAI;gBACd,QAAQ,EAAE,aAAa,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,8CAA8C;aAC5F,CAAC;QACJ,CAAC;IACH,CAAC;IAED,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC;AAC3C,CAAC"}
@@ -0,0 +1,25 @@
1
+ /**
2
+ * Rules Injector Constants
3
+ *
4
+ * Constants for rule file discovery and matching.
5
+ *
6
+ * Ported from oh-my-opencode's rules-injector hook.
7
+ */
8
+ /** Storage directory for rules injector state */
9
+ export declare const OLYMPUS_STORAGE_DIR: string;
10
+ export declare const RULES_INJECTOR_STORAGE: string;
11
+ /** Project marker files that indicate a project root */
12
+ export declare const PROJECT_MARKERS: string[];
13
+ /** Subdirectories to search for rules within projects */
14
+ export declare const PROJECT_RULE_SUBDIRS: [string, string][];
15
+ /** Single-file rules that always apply */
16
+ export declare const PROJECT_RULE_FILES: string[];
17
+ /** Pattern for GitHub instructions files */
18
+ export declare const GITHUB_INSTRUCTIONS_PATTERN: RegExp;
19
+ /** User-level rule directory */
20
+ export declare const USER_RULE_DIR = ".claude/rules";
21
+ /** Valid rule file extensions */
22
+ export declare const RULE_EXTENSIONS: string[];
23
+ /** Tools that trigger rule injection */
24
+ export declare const TRACKED_TOOLS: string[];
25
+ //# sourceMappingURL=constants.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../src/hooks/rules-injector/constants.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAKH,iDAAiD;AACjD,eAAO,MAAM,mBAAmB,QAA8B,CAAC;AAC/D,eAAO,MAAM,sBAAsB,QAA8C,CAAC;AAElF,wDAAwD;AACxD,eAAO,MAAM,eAAe,UAO3B,CAAC;AAEF,yDAAyD;AACzD,eAAO,MAAM,oBAAoB,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,EAIlD,CAAC;AAEF,0CAA0C;AAC1C,eAAO,MAAM,kBAAkB,EAAE,MAAM,EAEtC,CAAC;AAEF,4CAA4C;AAC5C,eAAO,MAAM,2BAA2B,QAAwB,CAAC;AAEjE,gCAAgC;AAChC,eAAO,MAAM,aAAa,kBAAkB,CAAC;AAE7C,iCAAiC;AACjC,eAAO,MAAM,eAAe,UAAkB,CAAC;AAE/C,wCAAwC;AACxC,eAAO,MAAM,aAAa,UAAyC,CAAC"}
@@ -0,0 +1,40 @@
1
+ /**
2
+ * Rules Injector Constants
3
+ *
4
+ * Constants for rule file discovery and matching.
5
+ *
6
+ * Ported from oh-my-opencode's rules-injector hook.
7
+ */
8
+ import { join } from 'path';
9
+ import { homedir } from 'os';
10
+ /** Storage directory for rules injector state */
11
+ export const OLYMPUS_STORAGE_DIR = join(homedir(), '.olympus');
12
+ export const RULES_INJECTOR_STORAGE = join(OLYMPUS_STORAGE_DIR, 'rules-injector');
13
+ /** Project marker files that indicate a project root */
14
+ export const PROJECT_MARKERS = [
15
+ '.git',
16
+ 'pyproject.toml',
17
+ 'package.json',
18
+ 'Cargo.toml',
19
+ 'go.mod',
20
+ '.venv',
21
+ ];
22
+ /** Subdirectories to search for rules within projects */
23
+ export const PROJECT_RULE_SUBDIRS = [
24
+ ['.github', 'instructions'],
25
+ ['.cursor', 'rules'],
26
+ ['.claude', 'rules'],
27
+ ];
28
+ /** Single-file rules that always apply */
29
+ export const PROJECT_RULE_FILES = [
30
+ '.github/copilot-instructions.md',
31
+ ];
32
+ /** Pattern for GitHub instructions files */
33
+ export const GITHUB_INSTRUCTIONS_PATTERN = /\.instructions\.md$/;
34
+ /** User-level rule directory */
35
+ export const USER_RULE_DIR = '.claude/rules';
36
+ /** Valid rule file extensions */
37
+ export const RULE_EXTENSIONS = ['.md', '.mdc'];
38
+ /** Tools that trigger rule injection */
39
+ export const TRACKED_TOOLS = ['read', 'write', 'edit', 'multiedit'];
40
+ //# sourceMappingURL=constants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../src/hooks/rules-injector/constants.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC5B,OAAO,EAAE,OAAO,EAAE,MAAM,IAAI,CAAC;AAE7B,iDAAiD;AACjD,MAAM,CAAC,MAAM,mBAAmB,GAAG,IAAI,CAAC,OAAO,EAAE,EAAE,UAAU,CAAC,CAAC;AAC/D,MAAM,CAAC,MAAM,sBAAsB,GAAG,IAAI,CAAC,mBAAmB,EAAE,gBAAgB,CAAC,CAAC;AAElF,wDAAwD;AACxD,MAAM,CAAC,MAAM,eAAe,GAAG;IAC7B,MAAM;IACN,gBAAgB;IAChB,cAAc;IACd,YAAY;IACZ,QAAQ;IACR,OAAO;CACR,CAAC;AAEF,yDAAyD;AACzD,MAAM,CAAC,MAAM,oBAAoB,GAAuB;IACtD,CAAC,SAAS,EAAE,cAAc,CAAC;IAC3B,CAAC,SAAS,EAAE,OAAO,CAAC;IACpB,CAAC,SAAS,EAAE,OAAO,CAAC;CACrB,CAAC;AAEF,0CAA0C;AAC1C,MAAM,CAAC,MAAM,kBAAkB,GAAa;IAC1C,iCAAiC;CAClC,CAAC;AAEF,4CAA4C;AAC5C,MAAM,CAAC,MAAM,2BAA2B,GAAG,qBAAqB,CAAC;AAEjE,gCAAgC;AAChC,MAAM,CAAC,MAAM,aAAa,GAAG,eAAe,CAAC;AAE7C,iCAAiC;AACjC,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;AAE/C,wCAAwC;AACxC,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,WAAW,CAAC,CAAC"}
@@ -0,0 +1,24 @@
1
+ /**
2
+ * Rules Finder
3
+ *
4
+ * Finds rule files in project directories and user home.
5
+ *
6
+ * Ported from oh-my-opencode's rules-injector hook.
7
+ */
8
+ import type { RuleFileCandidate } from './types.js';
9
+ /**
10
+ * Find project root by walking up from startPath.
11
+ * Checks for PROJECT_MARKERS (.git, package.json, etc.)
12
+ */
13
+ export declare function findProjectRoot(startPath: string): string | null;
14
+ /**
15
+ * Calculate directory distance between a rule file and current file.
16
+ */
17
+ export declare function calculateDistance(rulePath: string, currentFile: string, projectRoot: string | null): number;
18
+ /**
19
+ * Find all rule files for a given context.
20
+ * Searches from currentFile upward to projectRoot for rule directories,
21
+ * then user-level directory (~/.claude/rules).
22
+ */
23
+ export declare function findRuleFiles(projectRoot: string | null, homeDir: string, currentFile: string): RuleFileCandidate[];
24
+ //# sourceMappingURL=finder.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"finder.d.ts","sourceRoot":"","sources":["../../../src/hooks/rules-injector/finder.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAiBH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAmBpD;;;GAGG;AACH,wBAAgB,eAAe,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAwBhE;AAqCD;;GAEG;AACH,wBAAgB,iBAAiB,CAC/B,QAAQ,EAAE,MAAM,EAChB,WAAW,EAAE,MAAM,EACnB,WAAW,EAAE,MAAM,GAAG,IAAI,GACzB,MAAM,CAoCR;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAC3B,WAAW,EAAE,MAAM,GAAG,IAAI,EAC1B,OAAO,EAAE,MAAM,EACf,WAAW,EAAE,MAAM,GAClB,iBAAiB,EAAE,CA2FrB"}
@@ -0,0 +1,215 @@
1
+ /**
2
+ * Rules Finder
3
+ *
4
+ * Finds rule files in project directories and user home.
5
+ *
6
+ * Ported from oh-my-opencode's rules-injector hook.
7
+ */
8
+ import { existsSync, readdirSync, realpathSync, statSync, } from 'fs';
9
+ import { dirname, join, relative } from 'path';
10
+ import { GITHUB_INSTRUCTIONS_PATTERN, PROJECT_MARKERS, PROJECT_RULE_FILES, PROJECT_RULE_SUBDIRS, RULE_EXTENSIONS, USER_RULE_DIR, } from './constants.js';
11
+ /**
12
+ * Check if a directory is a GitHub instructions directory.
13
+ */
14
+ function isGitHubInstructionsDir(dir) {
15
+ return dir.includes('.github/instructions') || dir.endsWith('.github/instructions');
16
+ }
17
+ /**
18
+ * Check if a file is a valid rule file.
19
+ */
20
+ function isValidRuleFile(fileName, dir) {
21
+ if (isGitHubInstructionsDir(dir)) {
22
+ return GITHUB_INSTRUCTIONS_PATTERN.test(fileName);
23
+ }
24
+ return RULE_EXTENSIONS.some((ext) => fileName.endsWith(ext));
25
+ }
26
+ /**
27
+ * Find project root by walking up from startPath.
28
+ * Checks for PROJECT_MARKERS (.git, package.json, etc.)
29
+ */
30
+ export function findProjectRoot(startPath) {
31
+ let current;
32
+ try {
33
+ const stat = statSync(startPath);
34
+ current = stat.isDirectory() ? startPath : dirname(startPath);
35
+ }
36
+ catch {
37
+ current = dirname(startPath);
38
+ }
39
+ while (true) {
40
+ for (const marker of PROJECT_MARKERS) {
41
+ const markerPath = join(current, marker);
42
+ if (existsSync(markerPath)) {
43
+ return current;
44
+ }
45
+ }
46
+ const parent = dirname(current);
47
+ if (parent === current) {
48
+ return null;
49
+ }
50
+ current = parent;
51
+ }
52
+ }
53
+ /**
54
+ * Recursively find all rule files in a directory.
55
+ */
56
+ function findRuleFilesRecursive(dir, results) {
57
+ if (!existsSync(dir))
58
+ return;
59
+ try {
60
+ const entries = readdirSync(dir, { withFileTypes: true });
61
+ for (const entry of entries) {
62
+ const fullPath = join(dir, entry.name);
63
+ if (entry.isDirectory()) {
64
+ findRuleFilesRecursive(fullPath, results);
65
+ }
66
+ else if (entry.isFile()) {
67
+ if (isValidRuleFile(entry.name, dir)) {
68
+ results.push(fullPath);
69
+ }
70
+ }
71
+ }
72
+ }
73
+ catch {
74
+ // Permission denied or other errors - silently skip
75
+ }
76
+ }
77
+ /**
78
+ * Resolve symlinks safely with fallback to original path.
79
+ */
80
+ function safeRealpathSync(filePath) {
81
+ try {
82
+ return realpathSync(filePath);
83
+ }
84
+ catch {
85
+ return filePath;
86
+ }
87
+ }
88
+ /**
89
+ * Calculate directory distance between a rule file and current file.
90
+ */
91
+ export function calculateDistance(rulePath, currentFile, projectRoot) {
92
+ if (!projectRoot) {
93
+ return 9999;
94
+ }
95
+ try {
96
+ const ruleDir = dirname(rulePath);
97
+ const currentDir = dirname(currentFile);
98
+ const ruleRel = relative(projectRoot, ruleDir);
99
+ const currentRel = relative(projectRoot, currentDir);
100
+ // Handle paths outside project root
101
+ if (ruleRel.startsWith('..') || currentRel.startsWith('..')) {
102
+ return 9999;
103
+ }
104
+ // Split by both forward and back slashes for cross-platform compatibility
105
+ const ruleParts = ruleRel ? ruleRel.split(/[/\\]/) : [];
106
+ const currentParts = currentRel ? currentRel.split(/[/\\]/) : [];
107
+ // Find common prefix length
108
+ let common = 0;
109
+ for (let i = 0; i < Math.min(ruleParts.length, currentParts.length); i++) {
110
+ if (ruleParts[i] === currentParts[i]) {
111
+ common++;
112
+ }
113
+ else {
114
+ break;
115
+ }
116
+ }
117
+ // Distance is how many directories up from current file to common ancestor
118
+ return currentParts.length - common;
119
+ }
120
+ catch {
121
+ return 9999;
122
+ }
123
+ }
124
+ /**
125
+ * Find all rule files for a given context.
126
+ * Searches from currentFile upward to projectRoot for rule directories,
127
+ * then user-level directory (~/.claude/rules).
128
+ */
129
+ export function findRuleFiles(projectRoot, homeDir, currentFile) {
130
+ const candidates = [];
131
+ const seenRealPaths = new Set();
132
+ // Search from current file's directory up to project root
133
+ let currentDir = dirname(currentFile);
134
+ let distance = 0;
135
+ while (true) {
136
+ // Search rule directories in current directory
137
+ for (const [parent, subdir] of PROJECT_RULE_SUBDIRS) {
138
+ const ruleDir = join(currentDir, parent, subdir);
139
+ const files = [];
140
+ findRuleFilesRecursive(ruleDir, files);
141
+ for (const filePath of files) {
142
+ const realPath = safeRealpathSync(filePath);
143
+ if (seenRealPaths.has(realPath))
144
+ continue;
145
+ seenRealPaths.add(realPath);
146
+ candidates.push({
147
+ path: filePath,
148
+ realPath,
149
+ isGlobal: false,
150
+ distance,
151
+ });
152
+ }
153
+ }
154
+ // Stop at project root or filesystem root
155
+ if (projectRoot && currentDir === projectRoot)
156
+ break;
157
+ const parentDir = dirname(currentDir);
158
+ if (parentDir === currentDir)
159
+ break;
160
+ currentDir = parentDir;
161
+ distance++;
162
+ }
163
+ // Check for single-file rules at project root
164
+ if (projectRoot) {
165
+ for (const ruleFile of PROJECT_RULE_FILES) {
166
+ const filePath = join(projectRoot, ruleFile);
167
+ if (existsSync(filePath)) {
168
+ try {
169
+ const stat = statSync(filePath);
170
+ if (stat.isFile()) {
171
+ const realPath = safeRealpathSync(filePath);
172
+ if (!seenRealPaths.has(realPath)) {
173
+ seenRealPaths.add(realPath);
174
+ candidates.push({
175
+ path: filePath,
176
+ realPath,
177
+ isGlobal: false,
178
+ distance: 0,
179
+ isSingleFile: true,
180
+ });
181
+ }
182
+ }
183
+ }
184
+ catch {
185
+ // Skip if file can't be read
186
+ }
187
+ }
188
+ }
189
+ }
190
+ // Search user-level rule directory (~/.claude/rules)
191
+ const userRuleDir = join(homeDir, USER_RULE_DIR);
192
+ const userFiles = [];
193
+ findRuleFilesRecursive(userRuleDir, userFiles);
194
+ for (const filePath of userFiles) {
195
+ const realPath = safeRealpathSync(filePath);
196
+ if (seenRealPaths.has(realPath))
197
+ continue;
198
+ seenRealPaths.add(realPath);
199
+ candidates.push({
200
+ path: filePath,
201
+ realPath,
202
+ isGlobal: true,
203
+ distance: 9999, // Global rules always have max distance
204
+ });
205
+ }
206
+ // Sort by distance (closest first, then global rules last)
207
+ candidates.sort((a, b) => {
208
+ if (a.isGlobal !== b.isGlobal) {
209
+ return a.isGlobal ? 1 : -1;
210
+ }
211
+ return a.distance - b.distance;
212
+ });
213
+ return candidates;
214
+ }
215
+ //# sourceMappingURL=finder.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"finder.js","sourceRoot":"","sources":["../../../src/hooks/rules-injector/finder.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EACL,UAAU,EACV,WAAW,EACX,YAAY,EACZ,QAAQ,GACT,MAAM,IAAI,CAAC;AACZ,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,MAAM,CAAC;AAC/C,OAAO,EACL,2BAA2B,EAC3B,eAAe,EACf,kBAAkB,EAClB,oBAAoB,EACpB,eAAe,EACf,aAAa,GACd,MAAM,gBAAgB,CAAC;AAGxB;;GAEG;AACH,SAAS,uBAAuB,CAAC,GAAW;IAC1C,OAAO,GAAG,CAAC,QAAQ,CAAC,sBAAsB,CAAC,IAAI,GAAG,CAAC,QAAQ,CAAC,sBAAsB,CAAC,CAAC;AACtF,CAAC;AAED;;GAEG;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C;IAEH,OAAO,UAAU,CAAC;AACpB,CAAC"}
@@ -0,0 +1,45 @@
1
+ /**
2
+ * Rules Injector Hook
3
+ *
4
+ * Automatically injects relevant rule files when Claude accesses files.
5
+ * Supports project-level (.claude/rules, .github/instructions) and
6
+ * user-level (~/.claude/rules) rule files.
7
+ *
8
+ * Ported from oh-my-opencode's rules-injector hook.
9
+ */
10
+ import type { RuleToInject } from './types.js';
11
+ export * from './types.js';
12
+ export * from './constants.js';
13
+ export * from './finder.js';
14
+ export * from './parser.js';
15
+ export * from './matcher.js';
16
+ export * from './storage.js';
17
+ /**
18
+ * Create a rules injector hook for Claude Code.
19
+ *
20
+ * @param workingDirectory - The working directory for resolving paths
21
+ * @returns Hook handlers for tool execution
22
+ */
23
+ export declare function createRulesInjectorHook(workingDirectory: string): {
24
+ /**
25
+ * Process a tool execution and inject rules if relevant.
26
+ */
27
+ processToolExecution: (toolName: string, filePath: string, sessionId: string) => string;
28
+ /**
29
+ * Get rules for a specific file without marking as injected.
30
+ */
31
+ getRulesForFile: (filePath: string) => RuleToInject[];
32
+ /**
33
+ * Clear session cache when session ends.
34
+ */
35
+ clearSession: (sessionId: string) => void;
36
+ /**
37
+ * Check if a tool triggers rule injection.
38
+ */
39
+ isTrackedTool: (toolName: string) => boolean;
40
+ };
41
+ /**
42
+ * Get rules for a file path (simple utility function).
43
+ */
44
+ export declare function getRulesForPath(filePath: string, workingDirectory?: string): RuleToInject[];
45
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/hooks/rules-injector/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAmBH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAG/C,cAAc,YAAY,CAAC;AAC3B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAU7B;;;;;GAKG;AACH,wBAAgB,uBAAuB,CAAC,gBAAgB,EAAE,MAAM;IA6F5D;;OAEG;qCAES,MAAM,YACN,MAAM,aACL,MAAM,KAChB,MAAM;IAST;;OAEG;gCACyB,MAAM,KAAG,YAAY,EAAE;IA0CnD;;OAEG;8BACuB,MAAM,KAAG,IAAI;IAKvC;;OAEG;8BACuB,MAAM,KAAG,OAAO;EAI7C;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,QAAQ,EAAE,MAAM,EAAE,gBAAgB,CAAC,EAAE,MAAM,GAAG,YAAY,EAAE,CAI3F"}