aiwcli 0.15.7 → 0.17.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 (272) hide show
  1. package/README.md +106 -1125
  2. package/bin/run.js +0 -4
  3. package/dist/capabilities/installation/control-plane/clear-command.d.ts +2 -0
  4. package/dist/capabilities/installation/control-plane/clear-command.js +32 -3
  5. package/dist/capabilities/installation/control-plane/init-command.js +2 -2
  6. package/dist/capabilities/launch/contracts.d.ts +39 -4
  7. package/dist/capabilities/launch/control-plane/execute-launch.js +158 -119
  8. package/dist/capabilities/launch/runtime-core/launch-decisions.d.ts +82 -0
  9. package/dist/capabilities/launch/runtime-core/launch-decisions.js +202 -0
  10. package/dist/commands/branch.d.ts +1 -1
  11. package/dist/commands/branch.js +1 -1
  12. package/dist/commands/launch.d.ts +0 -5
  13. package/dist/commands/launch.js +2 -37
  14. package/dist/lib/config.js +1 -2
  15. package/dist/lib/context/context-store.js +28 -2
  16. package/dist/lib/core-installer.d.ts +1 -1
  17. package/dist/lib/core-installer.js +6 -27
  18. package/dist/lib/debug.d.ts +0 -10
  19. package/dist/lib/debug.js +0 -10
  20. package/dist/lib/env-sanitizer.d.ts +25 -0
  21. package/dist/lib/env-sanitizer.js +46 -0
  22. package/dist/lib/errors.d.ts +0 -13
  23. package/dist/lib/errors.js +0 -15
  24. package/dist/lib/git-exclude-manager.js +1 -1
  25. package/dist/lib/hooks/context-monitor-logic.d.ts +6 -0
  26. package/dist/lib/hooks/context-monitor-logic.js +25 -0
  27. package/dist/lib/hooks/hook-utils.js +11 -0
  28. package/dist/lib/hooks/prompt-binding-logic.d.ts +7 -0
  29. package/dist/lib/hooks/prompt-binding-logic.js +50 -0
  30. package/dist/lib/hooks/session-end-logic.js +2 -14
  31. package/dist/lib/install-state.js +6 -13
  32. package/dist/lib/json-io.d.ts +12 -0
  33. package/dist/lib/json-io.js +30 -0
  34. package/dist/lib/multiplexer.d.ts +43 -35
  35. package/dist/lib/multiplexer.js +21 -2
  36. package/dist/lib/multiplexers/psmux.d.ts +14 -34
  37. package/dist/lib/multiplexers/psmux.js +70 -130
  38. package/dist/lib/multiplexers/tmux.d.ts +11 -19
  39. package/dist/lib/multiplexers/tmux.js +79 -120
  40. package/dist/lib/multiplexers/wezterm.d.ts +38 -0
  41. package/dist/lib/multiplexers/wezterm.js +225 -0
  42. package/dist/lib/mux-utils.d.ts +4 -3
  43. package/dist/lib/mux-utils.js +7 -13
  44. package/dist/lib/prompt-file-manager.d.ts +23 -0
  45. package/dist/lib/prompt-file-manager.js +41 -0
  46. package/dist/lib/runtime/agent-launcher.d.ts +67 -0
  47. package/dist/lib/runtime/agent-launcher.js +262 -0
  48. package/dist/lib/runtime/aiw-cli.d.ts +2 -0
  49. package/dist/lib/runtime/aiw-cli.js +3 -1
  50. package/dist/lib/runtime/cli-args.d.ts +5 -2
  51. package/dist/lib/runtime/cli-args.js +18 -3
  52. package/dist/lib/runtime/inference.js +3 -14
  53. package/dist/lib/runtime/models.d.ts +6 -0
  54. package/dist/lib/runtime/models.js +6 -0
  55. package/dist/lib/runtime/state-io.d.ts +2 -1
  56. package/dist/lib/runtime/state-io.js +9 -4
  57. package/dist/lib/runtime/utils.d.ts +8 -0
  58. package/dist/lib/runtime/utils.js +31 -1
  59. package/dist/lib/schemas.d.ts +250 -0
  60. package/dist/lib/schemas.js +216 -0
  61. package/dist/lib/sentinel-manager.d.ts +32 -0
  62. package/dist/lib/sentinel-manager.js +62 -0
  63. package/dist/lib/sentinel-wrapper.d.ts +1 -0
  64. package/dist/lib/sentinel-wrapper.js +12 -3
  65. package/dist/lib/settings-hierarchy.js +3 -20
  66. package/dist/lib/shell-adapters/bash-adapter.d.ts +18 -0
  67. package/dist/lib/shell-adapters/bash-adapter.js +69 -0
  68. package/dist/lib/shell-adapters/index.d.ts +5 -0
  69. package/dist/lib/shell-adapters/index.js +7 -0
  70. package/dist/lib/shell-adapters/powershell-adapter.d.ts +18 -0
  71. package/dist/lib/shell-adapters/powershell-adapter.js +62 -0
  72. package/dist/lib/shell-adapters/shell-adapter.d.ts +45 -0
  73. package/dist/lib/shell-adapters/shell-adapter.js +5 -0
  74. package/dist/lib/spawn-errors.d.ts +3 -0
  75. package/dist/lib/spawn-errors.js +15 -1
  76. package/dist/lib/spinner.d.ts +0 -5
  77. package/dist/lib/spinner.js +0 -16
  78. package/dist/lib/template-installer.d.ts +10 -0
  79. package/dist/lib/template-installer.js +4 -4
  80. package/dist/lib/terminal-strategy.d.ts +1 -0
  81. package/dist/lib/terminal-strategy.js +12 -6
  82. package/dist/lib/terminal.d.ts +7 -5
  83. package/dist/lib/terminal.js +42 -19
  84. package/dist/lib/tmux-primitives.d.ts +0 -2
  85. package/dist/lib/tmux-primitives.js +0 -4
  86. package/dist/lib/tmux-session.js +2 -1
  87. package/dist/lib/windsurf-hooks-hierarchy.js +6 -23
  88. package/dist/platform/launch.d.ts +2 -1
  89. package/dist/platform/launch.js +1 -0
  90. package/dist/templates/CLAUDE.md +0 -1
  91. package/dist/templates/cc-native/.claude/settings.json +0 -10
  92. package/dist/templates/cc-native/TEMPLATE-SCHEMA.md +11 -4
  93. package/dist/templates/cc-native/_cc-native/cc-native.config.json +3 -7
  94. package/dist/templates/cc-native/_cc-native/hooks/CLAUDE.md +26 -47
  95. package/dist/templates/cc-native/_cc-native/hooks/cc-native-plan-review.ts +7 -9
  96. package/dist/templates/cc-native/_cc-native/hooks/enhance_plan_post_write.ts +2 -3
  97. package/dist/templates/cc-native/_cc-native/hooks/mark_questions_asked.ts +2 -2
  98. package/dist/templates/cc-native/_cc-native/hooks/plan_questions_early.ts +0 -25
  99. package/dist/templates/cc-native/_cc-native/hooks/validate_task_prompt.ts +4 -4
  100. package/dist/templates/cc-native/_cc-native/lib-ts/.mocharc.json +9 -0
  101. package/dist/templates/cc-native/_cc-native/lib-ts/__tests__/aggregate-agents.test.ts +118 -0
  102. package/dist/templates/cc-native/_cc-native/lib-ts/__tests__/artifacts.test.ts +234 -0
  103. package/dist/templates/cc-native/_cc-native/lib-ts/__tests__/cc-native-state.test.ts +170 -0
  104. package/dist/templates/cc-native/_cc-native/lib-ts/__tests__/cli-output-parser.test.ts +73 -0
  105. package/dist/templates/cc-native/_cc-native/lib-ts/__tests__/config.test.ts +64 -0
  106. package/dist/templates/cc-native/_cc-native/lib-ts/__tests__/constants.test.ts +40 -0
  107. package/dist/templates/cc-native/_cc-native/lib-ts/__tests__/debug.test.ts +42 -0
  108. package/dist/templates/cc-native/_cc-native/lib-ts/__tests__/exports.test.ts +58 -0
  109. package/dist/templates/cc-native/_cc-native/lib-ts/__tests__/helpers.ts +107 -0
  110. package/dist/templates/cc-native/_cc-native/lib-ts/__tests__/hooks/add-plan-context.hook.test.ts +97 -0
  111. package/dist/templates/cc-native/_cc-native/lib-ts/__tests__/hooks/plan-questions.hook.test.ts +81 -0
  112. package/dist/templates/cc-native/_cc-native/lib-ts/__tests__/hooks/plan-review.hook.test.ts +71 -0
  113. package/dist/templates/cc-native/_cc-native/lib-ts/__tests__/json-parser.test.ts +99 -0
  114. package/dist/templates/cc-native/_cc-native/lib-ts/__tests__/orchestrator-agent.test.ts +288 -0
  115. package/dist/templates/cc-native/_cc-native/lib-ts/__tests__/orchestrator.test.ts +48 -0
  116. package/dist/templates/cc-native/_cc-native/lib-ts/__tests__/reviewers.test.ts +32 -0
  117. package/dist/templates/cc-native/_cc-native/lib-ts/__tests__/state.test.ts +124 -0
  118. package/dist/templates/cc-native/_cc-native/lib-ts/__tests__/verdict.test.ts +93 -0
  119. package/dist/templates/cc-native/_cc-native/lib-ts/agent-selection.ts +163 -0
  120. package/dist/templates/cc-native/_cc-native/lib-ts/aggregate-agents.ts +6 -14
  121. package/dist/templates/cc-native/_cc-native/{artifacts/lib → lib-ts/artifacts}/format.ts +597 -599
  122. package/dist/templates/cc-native/_cc-native/{artifacts/lib → lib-ts/artifacts}/index.ts +26 -26
  123. package/dist/templates/cc-native/_cc-native/{artifacts/lib → lib-ts/artifacts}/tracker.ts +106 -107
  124. package/dist/templates/cc-native/_cc-native/{artifacts/lib → lib-ts/artifacts}/write.ts +118 -119
  125. package/dist/templates/cc-native/_cc-native/lib-ts/artifacts.ts +21 -0
  126. package/dist/templates/cc-native/_cc-native/lib-ts/cc-native-state.ts +16 -15
  127. package/dist/templates/cc-native/_cc-native/lib-ts/cli-output-parser.ts +132 -10
  128. package/dist/templates/cc-native/_cc-native/lib-ts/constants.ts +6 -6
  129. package/dist/templates/cc-native/_cc-native/{plan-review/lib → lib-ts}/corroboration.ts +119 -119
  130. package/dist/templates/cc-native/_cc-native/lib-ts/debug.ts +1 -2
  131. package/dist/templates/cc-native/_cc-native/{plan-review/lib → lib-ts}/graduation.ts +132 -132
  132. package/dist/templates/cc-native/_cc-native/lib-ts/index.ts +88 -86
  133. package/dist/templates/cc-native/_cc-native/lib-ts/json-parser.ts +5 -6
  134. package/dist/templates/cc-native/_cc-native/{plan-review/lib → lib-ts}/orchestrator.ts +70 -70
  135. package/dist/templates/cc-native/_cc-native/{plan-review/lib → lib-ts}/output-builder.ts +130 -121
  136. package/dist/templates/cc-native/_cc-native/lib-ts/package-lock.json +1679 -0
  137. package/dist/templates/cc-native/_cc-native/lib-ts/package.json +24 -0
  138. package/dist/templates/cc-native/_cc-native/lib-ts/plan-discovery.ts +4 -4
  139. package/dist/templates/cc-native/_cc-native/lib-ts/plan-enhancement.ts +1 -6
  140. package/dist/templates/cc-native/_cc-native/{plan-review/lib → lib-ts}/plan-questions.ts +101 -101
  141. package/dist/templates/cc-native/_cc-native/{plan-review/lib → lib-ts}/review-pipeline.ts +511 -543
  142. package/dist/templates/cc-native/_cc-native/lib-ts/reviewers/__tests__/agent-providers.test.ts +262 -0
  143. package/dist/templates/cc-native/_cc-native/{plan-review/lib → lib-ts}/reviewers/agent.ts +71 -85
  144. package/dist/templates/{core/lib-ts/agent-exec → cc-native/_cc-native/lib-ts/reviewers/base}/base-agent.ts +138 -152
  145. package/dist/templates/cc-native/_cc-native/{plan-review/lib → lib-ts}/reviewers/index.ts +12 -12
  146. package/dist/templates/cc-native/_cc-native/{plan-review/lib → lib-ts}/reviewers/providers/claude-agent.ts +66 -57
  147. package/dist/templates/cc-native/_cc-native/{plan-review/lib → lib-ts}/reviewers/providers/codex-agent.ts +185 -200
  148. package/dist/templates/cc-native/_cc-native/{plan-review/lib → lib-ts}/reviewers/providers/gemini-agent.ts +39 -40
  149. package/dist/templates/cc-native/_cc-native/{plan-review/lib → lib-ts}/reviewers/providers/orchestrator-claude-agent.ts +196 -224
  150. package/dist/templates/cc-native/_cc-native/{plan-review/lib → lib-ts}/reviewers/schemas.ts +201 -201
  151. package/dist/templates/cc-native/_cc-native/{plan-review/lib → lib-ts}/reviewers/types.ts +21 -23
  152. package/dist/templates/cc-native/_cc-native/lib-ts/rlm/__tests__/hyde.test.ts +365 -0
  153. package/dist/templates/cc-native/_cc-native/lib-ts/rlm/__tests__/ollama-client.test.ts +223 -0
  154. package/dist/templates/cc-native/_cc-native/lib-ts/rlm/embedding-indexer.ts +12 -16
  155. package/dist/templates/cc-native/_cc-native/lib-ts/rlm/hyde.ts +3 -2
  156. package/dist/templates/cc-native/_cc-native/lib-ts/rlm/index.ts +31 -31
  157. package/dist/templates/cc-native/_cc-native/lib-ts/rlm/logger.ts +6 -7
  158. package/dist/templates/cc-native/_cc-native/lib-ts/rlm/ollama-client.ts +7 -9
  159. package/dist/templates/cc-native/_cc-native/lib-ts/rlm/retrieval-pipeline.ts +14 -17
  160. package/dist/templates/cc-native/_cc-native/lib-ts/rlm/transcript-indexer.ts +37 -41
  161. package/dist/templates/cc-native/_cc-native/lib-ts/rlm/transcript-loader.ts +33 -43
  162. package/dist/templates/cc-native/_cc-native/lib-ts/rlm/transcript-searcher.ts +20 -20
  163. package/dist/templates/cc-native/_cc-native/lib-ts/rlm/types.ts +8 -9
  164. package/dist/templates/cc-native/_cc-native/lib-ts/rlm/vector-store.ts +3 -4
  165. package/dist/templates/cc-native/_cc-native/lib-ts/settings.ts +50 -126
  166. package/dist/templates/cc-native/_cc-native/lib-ts/state.ts +19 -21
  167. package/dist/templates/cc-native/_cc-native/lib-ts/types.ts +13 -88
  168. package/dist/templates/cc-native/_cc-native/{plan-review/lib → lib-ts}/verdict.ts +72 -72
  169. package/dist/templates/cc-native/_cc-native/plan-review/CLAUDE.md +35 -0
  170. package/dist/templates/cc-native/_cc-native/plan-review/lib/agent-selection.ts +1 -1
  171. package/dist/templates/cc-native/_cc-native/scripts/council_debate.ts +242 -0
  172. package/dist/templates/cc-native/_cc-native/scripts/council_debate_simple.ts +294 -0
  173. package/dist/templates/cc-native/_cc-native/{plan-review/workflows → workflows}/specdev.md +9 -9
  174. package/dist/templates/core/.claude/skills/codex/SKILL.md +25 -0
  175. package/dist/templates/core/.claude/skills/devin/SKILL.md +25 -0
  176. package/dist/templates/core/.claude/skills/handoff/SKILL.md +11 -0
  177. package/dist/templates/core/.claude/skills/handoff-resume/SKILL.md +11 -0
  178. package/dist/templates/core/.claude/skills/meta-plan/SKILL.md +13 -0
  179. package/dist/templates/core/.codex/skills/codex/SKILL.md +13 -0
  180. package/dist/templates/core/.codex/skills/devin/SKILL.md +19 -0
  181. package/dist/templates/core/.codex/skills/handoff/SKILL.md +11 -0
  182. package/dist/templates/core/.codex/skills/handoff-resume/SKILL.md +11 -0
  183. package/dist/templates/core/.codex/{workflows/meta-plan.md → skills/meta-plan/SKILL.md} +6 -0
  184. package/dist/templates/core/{.cognition → .devin}/AGENTS.md +2 -2
  185. package/dist/templates/core/.devin/skills/codex/SKILL.md +19 -0
  186. package/dist/templates/core/.devin/skills/devin/SKILL.md +13 -0
  187. package/dist/templates/core/.devin/skills/handoff/SKILL.md +11 -0
  188. package/dist/templates/core/.devin/skills/handoff-resume/SKILL.md +11 -0
  189. package/dist/templates/core/.devin/skills/meta-plan/SKILL.md +13 -0
  190. package/dist/templates/core/.windsurf/workflows/handoff-resume.md +9 -0
  191. package/dist/templates/core/hooks-ts/archive_plan.ts +1 -21
  192. package/dist/templates/core/hooks-ts/file-suggestion.ts +1 -19
  193. package/dist/templates/core/hooks-ts/pre_compact.ts +5 -18
  194. package/dist/templates/core/lib-ts/context/context-store.ts +29 -2
  195. package/dist/templates/core/lib-ts/hooks/hook-utils.ts +11 -0
  196. package/dist/templates/core/lib-ts/hooks/session-end-logic.ts +2 -13
  197. package/dist/templates/core/lib-ts/runtime/agent-launcher.ts +74 -0
  198. package/dist/templates/core/lib-ts/runtime/aiw-cli.ts +4 -2
  199. package/dist/templates/core/lib-ts/runtime/cli-args.ts +18 -4
  200. package/dist/templates/core/lib-ts/runtime/inference.ts +3 -15
  201. package/dist/templates/core/lib-ts/runtime/models.ts +7 -0
  202. package/dist/templates/core/lib-ts/runtime/state-io.ts +9 -4
  203. package/dist/templates/core/lib-ts/runtime/utils.ts +30 -1
  204. package/dist/templates/core/lib-ts/schemas.ts +233 -0
  205. package/dist/templates/core/scripts/resolve-run.ts +34 -2
  206. package/dist/templates/core/scripts/status_line.ts +1 -1
  207. package/dist/templates/core/skills/codex/CLAUDE.md +9 -4
  208. package/dist/templates/core/skills/codex/SKILL.md +6 -0
  209. package/dist/templates/core/skills/codex/lib/codex-watcher.ts +3 -10
  210. package/dist/templates/core/skills/codex/scripts/launch-codex.ts +26 -26
  211. package/dist/templates/core/skills/devin/CLAUDE.md +63 -6
  212. package/dist/templates/core/skills/devin/lib/devin-watcher.ts +116 -96
  213. package/dist/templates/core/skills/devin/scripts/launch-devin.ts +22 -21
  214. package/dist/templates/core/skills/handoff-system/CLAUDE.md +1 -1
  215. package/oclif.manifest.json +4 -4
  216. package/package.json +4 -4
  217. package/dist/lib/base-command.d.ts +0 -1
  218. package/dist/lib/base-command.js +0 -1
  219. package/dist/lib/env-compat.d.ts +0 -18
  220. package/dist/lib/env-compat.js +0 -23
  221. package/dist/lib/launch-options.d.ts +0 -1
  222. package/dist/lib/launch-options.js +0 -1
  223. package/dist/lib/stdin.d.ts +0 -48
  224. package/dist/lib/stdin.js +0 -60
  225. package/dist/templates/cc-native/_cc-native/CLAUDE.md +0 -73
  226. package/dist/templates/cc-native/_cc-native/artifacts/CLAUDE.md +0 -64
  227. package/dist/templates/cc-native/_cc-native/lib-ts/CLAUDE.md +0 -70
  228. package/dist/templates/cc-native/_cc-native/plan-review/CODING-STANDARDS-CHECKLIST.md +0 -75
  229. package/dist/templates/cc-native/_cc-native/plan-review/agents/CLAUDE.md +0 -143
  230. package/dist/templates/cc-native/_cc-native/plan-review/agents/PLAN-ORCHESTRATOR.md +0 -213
  231. package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-questions/PLAN-QUESTIONER.md +0 -70
  232. package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-review/ARCH-EVOLUTION.md +0 -62
  233. package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-review/ARCH-PATTERNS.md +0 -61
  234. package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-review/ARCH-STRUCTURE.md +0 -62
  235. package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-review/ASSUMPTION-TRACER.md +0 -56
  236. package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-review/CLARITY-AUDITOR.md +0 -53
  237. package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-review/COMPLETENESS-FEASIBILITY.md +0 -66
  238. package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-review/COMPLETENESS-GAPS.md +0 -70
  239. package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-review/COMPLETENESS-ORDERING.md +0 -62
  240. package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-review/CONSTRAINT-VALIDATOR.md +0 -72
  241. package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-review/DESIGN-ADR-VALIDATOR.md +0 -61
  242. package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-review/DESIGN-SCALE-MATCHER.md +0 -64
  243. package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-review/DEVILS-ADVOCATE.md +0 -56
  244. package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-review/DOCUMENTATION-PHILOSOPHY.md +0 -86
  245. package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-review/HANDOFF-READINESS.md +0 -59
  246. package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-review/HIDDEN-COMPLEXITY.md +0 -58
  247. package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-review/INCREMENTAL-DELIVERY.md +0 -66
  248. package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-review/RISK-DEPENDENCY.md +0 -62
  249. package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-review/RISK-FMEA.md +0 -66
  250. package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-review/RISK-PREMORTEM.md +0 -71
  251. package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-review/RISK-REVERSIBILITY.md +0 -74
  252. package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-review/SCOPE-BOUNDARY.md +0 -77
  253. package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-review/SIMPLICITY-GUARDIAN.md +0 -62
  254. package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-review/SKEPTIC.md +0 -68
  255. package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-review/TESTDRIVEN-BEHAVIOR-AUDITOR.md +0 -61
  256. package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-review/TESTDRIVEN-CHARACTERIZATION.md +0 -71
  257. package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-review/TESTDRIVEN-FIRST-VALIDATOR.md +0 -61
  258. package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-review/TESTDRIVEN-PYRAMID-ANALYZER.md +0 -61
  259. package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-review/TRADEOFF-COSTS.md +0 -67
  260. package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-review/TRADEOFF-STAKEHOLDERS.md +0 -65
  261. package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-review/VERIFY-COVERAGE.md +0 -74
  262. package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-review/VERIFY-STRENGTH.md +0 -69
  263. package/dist/templates/cc-native/_cc-native/plan-review/lib/reviewers/base/base-agent.ts +0 -7
  264. package/dist/templates/core/.codex/workflows/codex.md +0 -17
  265. package/dist/templates/core/.codex/workflows/handoff.md +0 -5
  266. package/dist/templates/core/lib-ts/agent-exec/backends/headless.ts +0 -34
  267. package/dist/templates/core/lib-ts/agent-exec/backends/index.ts +0 -6
  268. package/dist/templates/core/lib-ts/agent-exec/backends/tmux.ts +0 -148
  269. package/dist/templates/core/lib-ts/agent-exec/execution-backend.ts +0 -50
  270. package/dist/templates/core/lib-ts/agent-exec/index.ts +0 -6
  271. package/dist/templates/core/lib-ts/agent-exec/structured-output.ts +0 -165
  272. /package/dist/templates/core/{.cognition → .devin}/config.json +0 -0
@@ -4,51 +4,51 @@
4
4
  * Public API re-exports for programmatic use from hooks/agents.
5
5
  */
6
6
 
7
- export { checkOllamaHealth, embed, embedOne, type OllamaConfig } from "./ollama-client.js";
7
+ export {
8
+ CURRENT_SCHEMA_VERSION,
9
+ CLAUDE_PROJECTS_DIR,
10
+ RLM_INDEX_DIR,
11
+ RLM_VECTOR_DB_PATH,
12
+ OLLAMA_BASE_URL,
13
+ OLLAMA_EMBED_MODEL,
14
+ EMBED_DIMENSIONS,
15
+ VECTOR_TOP_K,
16
+ MAX_LOADER_CHARS,
17
+ MAX_PARALLEL_SUMMARIZERS,
18
+ TOP_N_HEAP,
19
+ WEIGHT,
20
+ type SessionIndex,
21
+ type SearchResult,
22
+ type LoadedSegment,
23
+ type IndexSegment,
24
+ type VectorSearchResult,
25
+ type ChunkSummary,
26
+ type RankedSession,
27
+ type RetrievalResult,
28
+ } from "./types.js";
8
29
 
9
30
  export {
10
31
  discoverSessions,
11
32
  indexSession,
33
+ writeIndex,
12
34
  needsIndexing,
13
35
  runBatch,
14
- writeIndex,
15
36
  } from "./transcript-indexer.js";
16
37
 
17
- export { loadTranscript } from "./transcript-loader.js";
38
+ export { search, scoreIndex, tokenize, type SearchOptions } from "./transcript-searcher.js";
18
39
 
19
- export { scoreIndex, search, type SearchOptions, tokenize } from "./transcript-searcher.js";
40
+ export { loadTranscript } from "./transcript-loader.js";
20
41
 
21
- export {
22
- type ChunkSummary,
23
- CLAUDE_PROJECTS_DIR,
24
- CURRENT_SCHEMA_VERSION,
25
- EMBED_DIMENSIONS,
26
- type IndexSegment,
27
- type LoadedSegment,
28
- MAX_LOADER_CHARS,
29
- MAX_PARALLEL_SUMMARIZERS,
30
- OLLAMA_BASE_URL,
31
- OLLAMA_EMBED_MODEL,
32
- type RankedSession,
33
- type RetrievalResult,
34
- RLM_INDEX_DIR,
35
- RLM_VECTOR_DB_PATH,
36
- type SearchResult,
37
- type SessionIndex,
38
- TOP_N_HEAP,
39
- VECTOR_TOP_K,
40
- type VectorSearchResult,
41
- WEIGHT,
42
- } from "./types.js";
42
+ export { checkOllamaHealth, embed, embedOne, type OllamaConfig } from "./ollama-client.js";
43
43
 
44
44
  export {
45
- type ChunkRow,
46
- deleteSessionChunks,
47
- getStats,
45
+ openVectorDb,
48
46
  insertChunks,
49
- isSessionEmbedded,
50
47
  markSessionEmbedded,
51
- openVectorDb,
48
+ isSessionEmbedded,
49
+ deleteSessionChunks,
52
50
  searchKnn,
51
+ getStats,
52
+ type ChunkRow,
53
53
  type VectorStats,
54
54
  } from "./vector-store.js";
@@ -25,18 +25,16 @@ try {
25
25
  logDebug = mod.logDebug;
26
26
  } catch {
27
27
  // Fallback: minimal stderr+file logger for standalone CLI execution
28
- // eslint-disable-next-line unicorn/consistent-function-scoping -- must be inside catch for conditional init
29
- const fallback = (level: string) => (hookName: string, message: string, opts?: Record<string, unknown>) => {
28
+ const fallback = (level: string) => {
29
+ return (hookName: string, message: string, opts?: Record<string, unknown>) => {
30
30
  const shouldStderr = opts?.stderr === true || level === "error";
31
31
  if (shouldStderr) {
32
32
  process.stderr.write(`[${hookName}] ${message}\n`);
33
33
  }
34
34
  // Also try JSONL file logging
35
35
  try {
36
- // eslint-disable-next-line @typescript-eslint/no-require-imports, no-undef -- dynamic require in fallback path
37
- const fs = require("node:fs");
38
- // eslint-disable-next-line @typescript-eslint/no-require-imports, no-undef -- dynamic require in fallback path
39
- const path = require("node:path");
36
+ const fs = require("fs");
37
+ const path = require("path");
40
38
  const logDir = path.join(process.cwd(), "_output");
41
39
  fs.mkdirSync(logDir, { recursive: true });
42
40
  const entry = JSON.stringify({
@@ -50,10 +48,11 @@ try {
50
48
  // Never crash on logging failure
51
49
  }
52
50
  };
51
+ };
53
52
  logInfo = fallback("info");
54
53
  logWarn = fallback("warn");
55
54
  logError = fallback("error");
56
55
  logDebug = fallback("debug");
57
56
  }
58
57
 
59
- export { logDebug, logError, logInfo, logWarn };
58
+ export { logInfo, logWarn, logError, logDebug };
@@ -1,4 +1,3 @@
1
- /* eslint-disable n/no-unsupported-features/node-builtins -- Bun runtime provides fetch */
2
1
  /**
3
2
  * Ollama HTTP client for local embeddings.
4
3
  *
@@ -7,14 +6,13 @@
7
6
  */
8
7
 
9
8
  import { z } from "zod";
10
-
11
- import { logDebug } from "./logger.js";
12
9
  import {
13
10
  OLLAMA_BASE_URL,
14
11
  OLLAMA_EMBED_MODEL,
15
12
  EMBED_DIMENSIONS,
16
13
  HYDE_OLLAMA_MODEL,
17
14
  } from "./types.js";
15
+ import { logDebug, logError } from "./logger.js";
18
16
 
19
17
  const HOOK_NAME = "rlm_ollama";
20
18
  const BATCH_SIZE = 32;
@@ -54,7 +52,7 @@ export async function checkOllamaHealth(
54
52
  const cfg = { ...DEFAULT_CONFIG, ...config };
55
53
  try {
56
54
  const resp = await fetch(`${cfg.baseUrl}/api/tags`, {
57
- signal: AbortSignal.timeout(5000),
55
+ signal: AbortSignal.timeout(5_000),
58
56
  });
59
57
  if (!resp.ok) {
60
58
  return { ok: false, error: `Ollama responded with ${resp.status}` };
@@ -76,8 +74,8 @@ export async function checkOllamaHealth(
76
74
  };
77
75
  }
78
76
  return { ok: true };
79
- } catch (error: unknown) {
80
- const msg = error instanceof Error ? error.message : String(error);
77
+ } catch (e: unknown) {
78
+ const msg = e instanceof Error ? e.message : String(e);
81
79
  return {
82
80
  ok: false,
83
81
  error: `Cannot reach Ollama at ${cfg.baseUrl}: ${msg}. Is Ollama running?`,
@@ -119,7 +117,7 @@ export async function embed(
119
117
  throw new Error(`Invalid Ollama embed response: ${parseResult.error.message}`);
120
118
  }
121
119
 
122
- const {data} = parseResult;
120
+ const data = parseResult.data;
123
121
  if (data.embeddings.length !== batch.length) {
124
122
  throw new Error(
125
123
  `Expected ${batch.length} embeddings, got ${data.embeddings.length}`,
@@ -199,11 +197,11 @@ export async function generateText(
199
197
  text: data.response || "",
200
198
  latency_ms: Date.now() - startTime,
201
199
  };
202
- } catch (error) {
200
+ } catch (e) {
203
201
  return {
204
202
  success: false,
205
203
  text: "",
206
- error: String(error),
204
+ error: String(e),
207
205
  latency_ms: Date.now() - startTime,
208
206
  };
209
207
  }
@@ -13,11 +13,6 @@
13
13
  */
14
14
 
15
15
  import { z } from "zod";
16
-
17
- import { hydeQueryEmbedding } from "./hyde.js";
18
- import { logInfo, logWarn, logError } from "./logger.js";
19
- import { checkOllamaHealth, embedOne } from "./ollama-client.js";
20
- import { loadTranscript } from "./transcript-loader.js";
21
16
  import {
22
17
  VECTOR_TOP_K,
23
18
  MAX_PARALLEL_SUMMARIZERS,
@@ -31,7 +26,11 @@ import {
31
26
  type RankedSession,
32
27
  type RetrievalResult,
33
28
  } from "./types.js";
29
+ import { logInfo, logWarn, logError, logDebug } from "./logger.js";
30
+ import { checkOllamaHealth, embedOne } from "./ollama-client.js";
34
31
  import { openVectorDb, searchKnn } from "./vector-store.js";
32
+ import { loadTranscript } from "./transcript-loader.js";
33
+ import { hydeQueryEmbedding } from "./hyde.js";
35
34
 
36
35
  const HOOK_NAME = "rlm_retrieve";
37
36
 
@@ -79,12 +78,10 @@ if (!query) {
79
78
  );
80
79
  process.exitCode = 1;
81
80
  } else {
82
- try {
83
- await runPipeline(query, topK, projectFilter);
84
- } catch (error) {
85
- logError(HOOK_NAME, `Fatal: ${error}`, { stderr: true });
81
+ runPipeline(query, topK, projectFilter).catch((e) => {
82
+ logError(HOOK_NAME, `Fatal: ${e}`, { stderr: true });
86
83
  process.exitCode = 1;
87
- }
84
+ });
88
85
  }
89
86
 
90
87
  // ---------------------------------------------------------------------------
@@ -130,8 +127,8 @@ async function runPipeline(
130
127
  });
131
128
  hydeTiming = Date.now() - hydeStart;
132
129
  logInfo(HOOK_NAME, `HyDE query embedding completed in ${hydeTiming}ms`);
133
- } catch (error) {
134
- logWarn(HOOK_NAME, `HyDE failed: ${error}, falling back to direct query embedding`);
130
+ } catch (e) {
131
+ logWarn(HOOK_NAME, `HyDE failed: ${e}, falling back to direct query embedding`);
135
132
  queryEmbedding = await embedOne(query);
136
133
  }
137
134
  } else {
@@ -185,7 +182,7 @@ async function runPipeline(
185
182
  }
186
183
  }
187
184
  }
188
- const sessions = [...sessionMap.values()];
185
+ const sessions = Array.from(sessionMap.values());
189
186
  logInfo(
190
187
  HOOK_NAME,
191
188
  `Stage 2: ${results.length} chunks → ${sessions.length} sessions`,
@@ -257,10 +254,10 @@ async function summarizeSessions(
257
254
  const promises = batch.map(async (session) => {
258
255
  try {
259
256
  return await summarizeOneSession(query, session);
260
- } catch (error) {
257
+ } catch (e) {
261
258
  logWarn(
262
259
  HOOK_NAME,
263
- `Summarize failed for ${session.result.session_id}: ${error}`,
260
+ `Summarize failed for ${session.result.session_id}: ${e}`,
264
261
  );
265
262
  return null;
266
263
  }
@@ -400,8 +397,8 @@ async function rankSessions(
400
397
  key_findings: r.key_findings,
401
398
  };
402
399
  }).filter((r): r is RankedSession => r !== null);
403
- } catch (error) {
404
- logWarn(HOOK_NAME, `Rank parse failed: ${error}, marking all as relevant`);
400
+ } catch (e) {
401
+ logWarn(HOOK_NAME, `Rank parse failed: ${e}, marking all as relevant`);
405
402
  return summaries.map((s) => ({
406
403
  session_id: s.session_id,
407
404
  project: s.project,
@@ -12,18 +12,18 @@
12
12
  * bun transcript-indexer.ts --batch --project=aiwcli # Index matching project only
13
13
  */
14
14
 
15
- import { createReadStream, existsSync } from "node:fs";
16
- import { readdir, stat, mkdir, writeFile } from "node:fs/promises";
17
- import { join, basename } from "node:path";
18
- import { createInterface } from "node:readline";
19
-
20
- import { logInfo, logWarn, logError } from "./logger.js";
15
+ import { readdir, stat, mkdir, readFile, writeFile } from "fs/promises";
16
+ import { createReadStream, existsSync, readFileSync } from "fs";
17
+ import { join, basename } from "path";
18
+ import { createInterface } from "readline";
21
19
  import {
22
20
  CURRENT_SCHEMA_VERSION,
23
21
  CLAUDE_PROJECTS_DIR,
24
22
  RLM_INDEX_DIR,
25
23
  type SessionIndex,
24
+ type IndexSegment,
26
25
  } from "./types.js";
26
+ import { logInfo, logWarn, logError, logDebug } from "./logger.js";
27
27
 
28
28
  const HOOK_NAME = "rlm_indexer";
29
29
 
@@ -39,12 +39,10 @@ const projectArg = args.find((a) => a.startsWith("--project="));
39
39
  const projectFilter = projectArg ? projectArg.split("=")[1] : null;
40
40
 
41
41
  if (isBatch) {
42
- try {
43
- await runBatch();
44
- } catch (error) {
45
- logError(HOOK_NAME, `Fatal: ${error}`, { stderr: true });
42
+ runBatch().catch((e) => {
43
+ logError(HOOK_NAME, `Fatal: ${e}`, { stderr: true });
46
44
  process.exitCode = 1;
47
- }
45
+ });
48
46
  }
49
47
 
50
48
  // ---------------------------------------------------------------------------
@@ -91,24 +89,22 @@ async function discoverSessions(): Promise<SessionFile[]> {
91
89
  return sessions;
92
90
  }
93
91
 
94
- function needsIndexing(session: SessionFile, _sourceMtime: number): boolean {
92
+ function needsIndexing(session: SessionFile, sourceMtime: number): boolean {
95
93
  const indexPath = join(RLM_INDEX_DIR, session.project, `${session.sessionId}.index.json`);
96
94
  if (!existsSync(indexPath)) return true;
97
95
  try {
98
96
  // Fast path: Read only first 100 bytes to check schema_version
99
97
  // If version matches, skip without checking mtime (schema bumps trigger full reindex anyway)
100
- // eslint-disable-next-line @typescript-eslint/no-require-imports, no-undef -- dynamic fs for perf
101
- const nodeFs = require("node:fs");
102
- const fd = nodeFs.openSync(indexPath, "r");
98
+ const fd = require("fs").openSync(indexPath, "r");
103
99
  const buffer = Buffer.alloc(100);
104
- const bytesRead = nodeFs.readSync(fd, buffer, 0, 100, 0);
105
- nodeFs.closeSync(fd);
100
+ const bytesRead = require("fs").readSync(fd, buffer, 0, 100, 0);
101
+ require("fs").closeSync(fd);
106
102
 
107
103
  const partial = buffer.toString("utf-8", 0, bytesRead);
108
104
  const versionMatch = partial.match(/"schema_version"\s*:\s*(\d+)/);
109
105
 
110
106
  // If version matches, skip (no mtime check needed - schema version bump handles major changes)
111
- if (versionMatch && parseInt(versionMatch[1], 10) === CURRENT_SCHEMA_VERSION) {
107
+ if (versionMatch && parseInt(versionMatch[1]) === CURRENT_SCHEMA_VERSION) {
112
108
  return false; // Skip - index is current
113
109
  }
114
110
 
@@ -156,9 +152,9 @@ async function runBatch(): Promise<void> {
156
152
  if (indexed % 10 === 0 || indexed === 1) {
157
153
  logInfo(HOOK_NAME, `Indexing: ${indexed} indexed, ${skipped} skipped, ${errors} errors (of ${allSessions.length} total)`, { stderr: true });
158
154
  }
159
- } catch (error) {
155
+ } catch (e) {
160
156
  errors++;
161
- logError(HOOK_NAME, `Error indexing ${session.sessionId}: ${error}`);
157
+ logError(HOOK_NAME, `Error indexing ${session.sessionId}: ${e}`);
162
158
  }
163
159
  }
164
160
 
@@ -238,7 +234,7 @@ async function indexSession(session: SessionFile, sourceMtime: number): Promise<
238
234
  index.user_message_count++;
239
235
  const msg = obj.message as Record<string, unknown> | undefined;
240
236
  if (msg) {
241
- const {content} = msg;
237
+ const content = msg.content;
242
238
  if (typeof content === "string") {
243
239
  const snippet = content.slice(0, 200);
244
240
  userSnippets.push(snippet);
@@ -248,7 +244,7 @@ async function indexSession(session: SessionFile, sourceMtime: number): Promise<
248
244
  } else if (Array.isArray(content)) {
249
245
  for (const block of content) {
250
246
  if (typeof block === "object" && block !== null && "text" in block) {
251
- const {text} = (block as Record<string, unknown>);
247
+ const text = (block as Record<string, unknown>).text;
252
248
  if (typeof text === "string") {
253
249
  extractKeywords(text, keywordBag);
254
250
  extractKeywords(text, segmentKeywordBag);
@@ -259,8 +255,8 @@ async function indexSession(session: SessionFile, sourceMtime: number): Promise<
259
255
  // Extract cwd for context
260
256
  const cwd = obj.cwd as string | undefined;
261
257
  if (cwd) {
262
- const parts = cwd.replaceAll('\\', "/").split("/");
263
- const last = parts.at(-1);
258
+ const parts = cwd.replace(/\\/g, "/").split("/");
259
+ const last = parts[parts.length - 1];
264
260
  if (last) addKeyword(keywordBag, last);
265
261
  }
266
262
  // Git branch
@@ -273,7 +269,7 @@ async function indexSession(session: SessionFile, sourceMtime: number): Promise<
273
269
  index.assistant_message_count++;
274
270
  const msg = obj.message as Record<string, unknown> | undefined;
275
271
  if (msg) {
276
- const {content} = msg;
272
+ const content = msg.content;
277
273
  if (Array.isArray(content)) {
278
274
  for (const block of content) {
279
275
  if (typeof block !== "object" || block === null) continue;
@@ -344,19 +340,19 @@ async function indexSession(session: SessionFile, sourceMtime: number): Promise<
344
340
  // ---------------------------------------------------------------------------
345
341
 
346
342
  const STOP_WORDS = new Set([
347
- "a", "about", "above", "after", "all", "also", "an", "and", "any", "are",
348
- "as", "at", "be", "been", "before", "being", "below", "between", "both",
349
- "but", "by", "can", "class", "const", "could", "default", "did", "do",
350
- "does", "during", "each", "either", "every", "export", "false", "few", "for",
351
- "from", "function", "had", "has", "have", "he", "here",
352
- "how", "i", "if", "import", "in", "into", "is", "it", "its", "just",
353
- "let", "may", "me", "might", "more", "most", "must", "my", "neither",
354
- "new", "no", "nor", "not", "now", "null", "of", "on", "or",
355
- "other", "our", "return", "shall", "she", "should", "so", "some", "such",
356
- "than", "that", "the", "their", "them", "then", "there", "these", "they", "this",
357
- "those", "through", "to", "too", "true", "type", "undefined", "var", "very",
358
- "was", "we", "were", "what", "when", "where", "which",
359
- "who", "why", "will", "with", "would", "yet", "you", "your",
343
+ "the", "a", "an", "is", "are", "was", "were", "be", "been", "being",
344
+ "have", "has", "had", "do", "does", "did", "will", "would", "shall",
345
+ "should", "may", "might", "must", "can", "could", "of", "in", "to",
346
+ "for", "with", "on", "at", "from", "by", "about", "as", "into",
347
+ "through", "during", "before", "after", "above", "below", "between",
348
+ "and", "but", "or", "nor", "not", "no", "so", "yet", "both", "either",
349
+ "neither", "each", "every", "all", "any", "few", "more", "most", "other",
350
+ "some", "such", "than", "too", "very", "just", "also", "now", "then",
351
+ "here", "there", "when", "where", "why", "how", "what", "which", "who",
352
+ "this", "that", "these", "those", "it", "its", "i", "me", "my", "we",
353
+ "our", "you", "your", "he", "she", "they", "them", "their", "if",
354
+ "true", "false", "null", "undefined", "function", "return", "const",
355
+ "let", "var", "import", "export", "default", "class", "new", "type",
360
356
  ]);
361
357
 
362
358
  function extractKeywords(text: string, bag: Map<string, number>): void {
@@ -395,9 +391,9 @@ function extractToolMetadata(
395
391
  // File paths from Read, Edit, Write, Glob
396
392
  const filePath = input.file_path as string | undefined;
397
393
  if (filePath) {
398
- const normalized = filePath.replaceAll('\\', "/");
394
+ const normalized = filePath.replace(/\\/g, "/");
399
395
  const parts = normalized.split("/");
400
- const fileName = parts.at(-1);
396
+ const fileName = parts[parts.length - 1];
401
397
  if (fileName) {
402
398
  files.add(fileName);
403
399
  addKeyword(keywords, fileName.replace(/\.[^.]+$/, "")); // stem
@@ -447,4 +443,4 @@ async function writeIndex(project: string, sessionId: string, index: SessionInde
447
443
  // Exports for programmatic use
448
444
  // ---------------------------------------------------------------------------
449
445
 
450
- export { discoverSessions, indexSession, needsIndexing, runBatch, writeIndex };
446
+ export { discoverSessions, indexSession, writeIndex, needsIndexing, runBatch };
@@ -11,12 +11,11 @@
11
11
  * bun transcript-loader.ts <jsonl-path> --lines=46-120
12
12
  */
13
13
 
14
- import { createReadStream } from "node:fs";
15
- import { basename } from "node:path";
16
- import { createInterface } from "node:readline";
17
-
18
- import { logInfo, logError } from "./logger.js";
14
+ import { createReadStream } from "fs";
15
+ import { createInterface } from "readline";
16
+ import { basename } from "path";
19
17
  import { MAX_LOADER_CHARS, type LoadedSegment } from "./types.js";
18
+ import { logInfo, logWarn, logError } from "./logger.js";
20
19
 
21
20
  const HOOK_NAME = "rlm_loader";
22
21
 
@@ -36,16 +35,17 @@ if (linesArg) {
36
35
  }
37
36
 
38
37
  if (jsonlPath && !process.env.RLM_LIB_MODE) {
39
- try {
40
- const seg = await loadTranscript(jsonlPath, lineRange);
41
- process.stdout.write(seg.content);
42
- if (seg.truncated) {
43
- logInfo(HOOK_NAME, "Output truncated at 50K chars", { stderr: true });
44
- }
45
- } catch (error) {
46
- logError(HOOK_NAME, `Load failed: ${error}`, { stderr: true });
47
- process.exitCode = 1;
48
- }
38
+ loadTranscript(jsonlPath, lineRange)
39
+ .then((seg) => {
40
+ process.stdout.write(seg.content);
41
+ if (seg.truncated) {
42
+ logInfo(HOOK_NAME, "Output truncated at 50K chars", { stderr: true });
43
+ }
44
+ })
45
+ .catch((e) => {
46
+ logError(HOOK_NAME, `Load failed: ${e}`, { stderr: true });
47
+ process.exitCode = 1;
48
+ });
49
49
  }
50
50
 
51
51
  // ---------------------------------------------------------------------------
@@ -135,9 +135,9 @@ async function loadTranscript(
135
135
  }
136
136
 
137
137
  // Derive project from path
138
- const pathParts = filePath.replaceAll('\\', "/").split("/");
138
+ const pathParts = filePath.replace(/\\/g, "/").split("/");
139
139
  const projectsIdx = pathParts.indexOf("projects");
140
- if (projectsIdx !== -1 && projectsIdx + 1 < pathParts.length) {
140
+ if (projectsIdx >= 0 && projectsIdx + 1 < pathParts.length) {
141
141
  project = pathParts[projectsIdx + 1];
142
142
  }
143
143
 
@@ -155,7 +155,7 @@ async function loadTranscript(
155
155
  // ---------------------------------------------------------------------------
156
156
 
157
157
  function extractContent(msg: Record<string, unknown>): string | null {
158
- const {content} = msg;
158
+ const content = msg.content;
159
159
  if (typeof content === "string") return content;
160
160
  if (Array.isArray(content)) {
161
161
  const texts: string[] = [];
@@ -187,7 +187,7 @@ function extractAssistantContent(msg: Record<string, unknown>): {
187
187
  text: string;
188
188
  toolUses: ToolUse[];
189
189
  } {
190
- const {content} = msg;
190
+ const content = msg.content;
191
191
  let text = "";
192
192
  const toolUses: ToolUse[] = [];
193
193
 
@@ -219,36 +219,26 @@ function extractAssistantContent(msg: Record<string, unknown>): {
219
219
  function summarizeToolInput(toolName: string, input?: Record<string, unknown>): string {
220
220
  if (!input) return "";
221
221
  switch (toolName) {
222
- case "Bash": {
223
- return input.command ? `${(input.command as string).slice(0, 80)}` : "";
224
- }
225
- case "Edit": {
222
+ case "Read":
226
223
  return input.file_path ? `${input.file_path}` : "";
227
- }
228
- case "Glob": {
224
+ case "Write":
225
+ return input.file_path ? `${input.file_path}` : "";
226
+ case "Edit":
227
+ return input.file_path ? `${input.file_path}` : "";
228
+ case "Bash":
229
+ return input.command ? `${(input.command as string).slice(0, 80)}` : "";
230
+ case "Glob":
229
231
  return input.pattern ? `${input.pattern}` : "";
230
- }
231
- case "Grep": {
232
+ case "Grep":
232
233
  return input.pattern ? `/${input.pattern}/` : "";
233
- }
234
- case "Read": {
235
- return input.file_path ? `${input.file_path}` : "";
236
- }
237
- case "Task": {
234
+ case "Task":
238
235
  return input.description ? `${input.description}` : "";
239
- }
240
- case "WebFetch": {
241
- return input.url ? `${input.url}` : "";
242
- }
243
- case "WebSearch": {
236
+ case "WebSearch":
244
237
  return input.query ? `"${input.query}"` : "";
245
- }
246
- case "Write": {
247
- return input.file_path ? `${input.file_path}` : "";
248
- }
249
- default: {
238
+ case "WebFetch":
239
+ return input.url ? `${input.url}` : "";
240
+ default:
250
241
  return Object.keys(input).slice(0, 3).join(", ");
251
- }
252
242
  }
253
243
  }
254
244
 
@@ -11,11 +11,12 @@
11
11
  * bun transcript-searcher.ts "plan review" --project=aiwcli
12
12
  */
13
13
 
14
- import { existsSync } from "node:fs";
15
- import { readdir, readFile } from "node:fs/promises";
16
- import { join } from "node:path";
14
+ import { readdir, readFile } from "fs/promises";
15
+ import { existsSync } from "fs";
16
+ import { join } from "path";
17
+ import { logInfo, logWarn, logError, logDebug } from "./logger.js";
17
18
 
18
- import { logInfo, logWarn, logError } from "./logger.js";
19
+ const HOOK_NAME = "rlm_searcher";
19
20
  import {
20
21
  CURRENT_SCHEMA_VERSION,
21
22
  CLAUDE_PROJECTS_DIR,
@@ -27,8 +28,6 @@ import {
27
28
  type IndexSegment,
28
29
  } from "./types.js";
29
30
 
30
- const HOOK_NAME = "rlm_searcher";
31
-
32
31
  // ---------------------------------------------------------------------------
33
32
  // CLI entry
34
33
  // ---------------------------------------------------------------------------
@@ -41,19 +40,20 @@ const projectArg = args.find((a) => a.startsWith("--project="));
41
40
  const projectFilter = projectArg ? projectArg.split("=")[1] : null;
42
41
 
43
42
  if (query && !process.env.RLM_LIB_MODE) {
44
- try {
45
- const results = await search(query, { topN, projectFilter });
46
- if (typeof results === "string") {
47
- logWarn(HOOK_NAME, results, { stderr: true });
43
+ search(query, { topN, projectFilter })
44
+ .then((results) => {
45
+ if (typeof results === "string") {
46
+ logWarn(HOOK_NAME, results, { stderr: true });
47
+ process.exitCode = 1;
48
+ } else {
49
+ logInfo(HOOK_NAME, `Search returned ${results.length} results`);
50
+ process.stdout.write(JSON.stringify(results, null, 2) + "\n");
51
+ }
52
+ })
53
+ .catch((e) => {
54
+ logError(HOOK_NAME, `Search failed: ${e}`, { stderr: true });
48
55
  process.exitCode = 1;
49
- } else {
50
- logInfo(HOOK_NAME, `Search returned ${results.length} results`);
51
- process.stdout.write(JSON.stringify(results, null, 2) + "\n");
52
- }
53
- } catch (error) {
54
- logError(HOOK_NAME, `Search failed: ${error}`, { stderr: true });
55
- process.exitCode = 1;
56
- }
56
+ });
57
57
  }
58
58
 
59
59
  // ---------------------------------------------------------------------------
@@ -251,7 +251,7 @@ function tokenize(query: string): string[] {
251
251
  return query
252
252
  .toLowerCase()
253
253
  .split(/\s+/)
254
- .map((t) => t.replaceAll(/[^a-z0-9_-]/g, ""))
254
+ .map((t) => t.replace(/[^a-z0-9_-]/g, ""))
255
255
  .filter((t) => t.length >= 2);
256
256
  }
257
257
 
@@ -271,4 +271,4 @@ function insertSorted(arr: SearchResult[], item: SearchResult, maxSize: number):
271
271
  // Exports
272
272
  // ---------------------------------------------------------------------------
273
273
 
274
- export { scoreIndex, search, type SearchOptions, tokenize };
274
+ export { search, scoreIndex, tokenize, type SearchOptions };