aicodeman 0.2.8

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 (246) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +403 -0
  3. package/dist/ai-checker-base.d.ts +175 -0
  4. package/dist/ai-checker-base.d.ts.map +1 -0
  5. package/dist/ai-checker-base.js +424 -0
  6. package/dist/ai-checker-base.js.map +1 -0
  7. package/dist/ai-idle-checker.d.ts +53 -0
  8. package/dist/ai-idle-checker.d.ts.map +1 -0
  9. package/dist/ai-idle-checker.js +141 -0
  10. package/dist/ai-idle-checker.js.map +1 -0
  11. package/dist/ai-plan-checker.d.ts +52 -0
  12. package/dist/ai-plan-checker.d.ts.map +1 -0
  13. package/dist/ai-plan-checker.js +103 -0
  14. package/dist/ai-plan-checker.js.map +1 -0
  15. package/dist/bash-tool-parser.d.ts +191 -0
  16. package/dist/bash-tool-parser.d.ts.map +1 -0
  17. package/dist/bash-tool-parser.js +598 -0
  18. package/dist/bash-tool-parser.js.map +1 -0
  19. package/dist/cli.d.ts +12 -0
  20. package/dist/cli.d.ts.map +1 -0
  21. package/dist/cli.js +460 -0
  22. package/dist/cli.js.map +1 -0
  23. package/dist/config/buffer-limits.d.ts +59 -0
  24. package/dist/config/buffer-limits.d.ts.map +1 -0
  25. package/dist/config/buffer-limits.js +74 -0
  26. package/dist/config/buffer-limits.js.map +1 -0
  27. package/dist/config/map-limits.d.ts +40 -0
  28. package/dist/config/map-limits.d.ts.map +1 -0
  29. package/dist/config/map-limits.js +52 -0
  30. package/dist/config/map-limits.js.map +1 -0
  31. package/dist/file-stream-manager.d.ts +148 -0
  32. package/dist/file-stream-manager.d.ts.map +1 -0
  33. package/dist/file-stream-manager.js +351 -0
  34. package/dist/file-stream-manager.js.map +1 -0
  35. package/dist/hooks-config.d.ts +31 -0
  36. package/dist/hooks-config.d.ts.map +1 -0
  37. package/dist/hooks-config.js +115 -0
  38. package/dist/hooks-config.js.map +1 -0
  39. package/dist/image-watcher.d.ts +86 -0
  40. package/dist/image-watcher.d.ts.map +1 -0
  41. package/dist/image-watcher.js +275 -0
  42. package/dist/image-watcher.js.map +1 -0
  43. package/dist/index.d.ts +11 -0
  44. package/dist/index.d.ts.map +1 -0
  45. package/dist/index.js +54 -0
  46. package/dist/index.js.map +1 -0
  47. package/dist/mux-factory.d.ts +13 -0
  48. package/dist/mux-factory.d.ts.map +1 -0
  49. package/dist/mux-factory.js +19 -0
  50. package/dist/mux-factory.js.map +1 -0
  51. package/dist/mux-interface.d.ts +145 -0
  52. package/dist/mux-interface.d.ts.map +1 -0
  53. package/dist/mux-interface.js +9 -0
  54. package/dist/mux-interface.js.map +1 -0
  55. package/dist/plan-orchestrator.d.ts +123 -0
  56. package/dist/plan-orchestrator.d.ts.map +1 -0
  57. package/dist/plan-orchestrator.js +500 -0
  58. package/dist/plan-orchestrator.js.map +1 -0
  59. package/dist/prompts/index.d.ts +9 -0
  60. package/dist/prompts/index.d.ts.map +1 -0
  61. package/dist/prompts/index.js +9 -0
  62. package/dist/prompts/index.js.map +1 -0
  63. package/dist/prompts/planner.d.ts +14 -0
  64. package/dist/prompts/planner.d.ts.map +1 -0
  65. package/dist/prompts/planner.js +83 -0
  66. package/dist/prompts/planner.js.map +1 -0
  67. package/dist/prompts/research-agent.d.ts +10 -0
  68. package/dist/prompts/research-agent.d.ts.map +1 -0
  69. package/dist/prompts/research-agent.js +143 -0
  70. package/dist/prompts/research-agent.js.map +1 -0
  71. package/dist/push-store.d.ts +41 -0
  72. package/dist/push-store.d.ts.map +1 -0
  73. package/dist/push-store.js +168 -0
  74. package/dist/push-store.js.map +1 -0
  75. package/dist/ralph-config.d.ts +67 -0
  76. package/dist/ralph-config.d.ts.map +1 -0
  77. package/dist/ralph-config.js +134 -0
  78. package/dist/ralph-config.js.map +1 -0
  79. package/dist/ralph-loop.d.ts +124 -0
  80. package/dist/ralph-loop.d.ts.map +1 -0
  81. package/dist/ralph-loop.js +418 -0
  82. package/dist/ralph-loop.js.map +1 -0
  83. package/dist/ralph-tracker.d.ts +1081 -0
  84. package/dist/ralph-tracker.d.ts.map +1 -0
  85. package/dist/ralph-tracker.js +3343 -0
  86. package/dist/ralph-tracker.js.map +1 -0
  87. package/dist/respawn-controller.d.ts +1182 -0
  88. package/dist/respawn-controller.d.ts.map +1 -0
  89. package/dist/respawn-controller.js +2754 -0
  90. package/dist/respawn-controller.js.map +1 -0
  91. package/dist/run-summary.d.ts +123 -0
  92. package/dist/run-summary.d.ts.map +1 -0
  93. package/dist/run-summary.js +325 -0
  94. package/dist/run-summary.js.map +1 -0
  95. package/dist/session-lifecycle-log.d.ts +36 -0
  96. package/dist/session-lifecycle-log.d.ts.map +1 -0
  97. package/dist/session-lifecycle-log.js +101 -0
  98. package/dist/session-lifecycle-log.js.map +1 -0
  99. package/dist/session-manager.d.ts +97 -0
  100. package/dist/session-manager.d.ts.map +1 -0
  101. package/dist/session-manager.js +224 -0
  102. package/dist/session-manager.js.map +1 -0
  103. package/dist/session.d.ts +686 -0
  104. package/dist/session.d.ts.map +1 -0
  105. package/dist/session.js +2025 -0
  106. package/dist/session.js.map +1 -0
  107. package/dist/state-store.d.ts +189 -0
  108. package/dist/state-store.d.ts.map +1 -0
  109. package/dist/state-store.js +730 -0
  110. package/dist/state-store.js.map +1 -0
  111. package/dist/subagent-watcher.d.ts +345 -0
  112. package/dist/subagent-watcher.d.ts.map +1 -0
  113. package/dist/subagent-watcher.js +1469 -0
  114. package/dist/subagent-watcher.js.map +1 -0
  115. package/dist/task-queue.d.ts +108 -0
  116. package/dist/task-queue.d.ts.map +1 -0
  117. package/dist/task-queue.js +235 -0
  118. package/dist/task-queue.js.map +1 -0
  119. package/dist/task-tracker.d.ts +306 -0
  120. package/dist/task-tracker.d.ts.map +1 -0
  121. package/dist/task-tracker.js +488 -0
  122. package/dist/task-tracker.js.map +1 -0
  123. package/dist/task.d.ts +73 -0
  124. package/dist/task.d.ts.map +1 -0
  125. package/dist/task.js +177 -0
  126. package/dist/task.js.map +1 -0
  127. package/dist/team-watcher.d.ts +53 -0
  128. package/dist/team-watcher.d.ts.map +1 -0
  129. package/dist/team-watcher.js +313 -0
  130. package/dist/team-watcher.js.map +1 -0
  131. package/dist/templates/case-template.md +461 -0
  132. package/dist/templates/claude-md.d.ts +26 -0
  133. package/dist/templates/claude-md.d.ts.map +1 -0
  134. package/dist/templates/claude-md.js +74 -0
  135. package/dist/templates/claude-md.js.map +1 -0
  136. package/dist/tmux-manager.d.ts +181 -0
  137. package/dist/tmux-manager.d.ts.map +1 -0
  138. package/dist/tmux-manager.js +1405 -0
  139. package/dist/tmux-manager.js.map +1 -0
  140. package/dist/transcript-watcher.d.ts +110 -0
  141. package/dist/transcript-watcher.d.ts.map +1 -0
  142. package/dist/transcript-watcher.js +338 -0
  143. package/dist/transcript-watcher.js.map +1 -0
  144. package/dist/tunnel-manager.d.ts +54 -0
  145. package/dist/tunnel-manager.d.ts.map +1 -0
  146. package/dist/tunnel-manager.js +251 -0
  147. package/dist/tunnel-manager.js.map +1 -0
  148. package/dist/types.d.ts +1139 -0
  149. package/dist/types.d.ts.map +1 -0
  150. package/dist/types.js +215 -0
  151. package/dist/types.js.map +1 -0
  152. package/dist/utils/buffer-accumulator.d.ts +111 -0
  153. package/dist/utils/buffer-accumulator.d.ts.map +1 -0
  154. package/dist/utils/buffer-accumulator.js +172 -0
  155. package/dist/utils/buffer-accumulator.js.map +1 -0
  156. package/dist/utils/claude-cli-resolver.d.ts +26 -0
  157. package/dist/utils/claude-cli-resolver.d.ts.map +1 -0
  158. package/dist/utils/claude-cli-resolver.js +78 -0
  159. package/dist/utils/claude-cli-resolver.js.map +1 -0
  160. package/dist/utils/cleanup-manager.d.ts +165 -0
  161. package/dist/utils/cleanup-manager.d.ts.map +1 -0
  162. package/dist/utils/cleanup-manager.js +274 -0
  163. package/dist/utils/cleanup-manager.js.map +1 -0
  164. package/dist/utils/index.d.ts +19 -0
  165. package/dist/utils/index.d.ts.map +1 -0
  166. package/dist/utils/index.js +19 -0
  167. package/dist/utils/index.js.map +1 -0
  168. package/dist/utils/lru-map.d.ts +140 -0
  169. package/dist/utils/lru-map.d.ts.map +1 -0
  170. package/dist/utils/lru-map.js +234 -0
  171. package/dist/utils/lru-map.js.map +1 -0
  172. package/dist/utils/nice-wrapper.d.ts +13 -0
  173. package/dist/utils/nice-wrapper.d.ts.map +1 -0
  174. package/dist/utils/nice-wrapper.js +17 -0
  175. package/dist/utils/nice-wrapper.js.map +1 -0
  176. package/dist/utils/opencode-cli-resolver.d.ts +21 -0
  177. package/dist/utils/opencode-cli-resolver.d.ts.map +1 -0
  178. package/dist/utils/opencode-cli-resolver.js +67 -0
  179. package/dist/utils/opencode-cli-resolver.js.map +1 -0
  180. package/dist/utils/regex-patterns.d.ts +64 -0
  181. package/dist/utils/regex-patterns.d.ts.map +1 -0
  182. package/dist/utils/regex-patterns.js +74 -0
  183. package/dist/utils/regex-patterns.js.map +1 -0
  184. package/dist/utils/stale-expiration-map.d.ts +159 -0
  185. package/dist/utils/stale-expiration-map.d.ts.map +1 -0
  186. package/dist/utils/stale-expiration-map.js +277 -0
  187. package/dist/utils/stale-expiration-map.js.map +1 -0
  188. package/dist/utils/string-similarity.d.ts +108 -0
  189. package/dist/utils/string-similarity.d.ts.map +1 -0
  190. package/dist/utils/string-similarity.js +189 -0
  191. package/dist/utils/string-similarity.js.map +1 -0
  192. package/dist/utils/token-validation.d.ts +39 -0
  193. package/dist/utils/token-validation.d.ts.map +1 -0
  194. package/dist/utils/token-validation.js +59 -0
  195. package/dist/utils/token-validation.js.map +1 -0
  196. package/dist/utils/type-safety.d.ts +33 -0
  197. package/dist/utils/type-safety.d.ts.map +1 -0
  198. package/dist/utils/type-safety.js +35 -0
  199. package/dist/utils/type-safety.js.map +1 -0
  200. package/dist/web/public/app.js +491 -0
  201. package/dist/web/public/app.js.br +0 -0
  202. package/dist/web/public/app.js.gz +0 -0
  203. package/dist/web/public/index.html +1675 -0
  204. package/dist/web/public/index.html.br +0 -0
  205. package/dist/web/public/index.html.gz +0 -0
  206. package/dist/web/public/manifest.json +8 -0
  207. package/dist/web/public/mobile.css +1 -0
  208. package/dist/web/public/mobile.css.br +0 -0
  209. package/dist/web/public/mobile.css.gz +0 -0
  210. package/dist/web/public/ralph-wizard.js +1037 -0
  211. package/dist/web/public/ralph-wizard.js.br +0 -0
  212. package/dist/web/public/ralph-wizard.js.gz +0 -0
  213. package/dist/web/public/styles.css +1 -0
  214. package/dist/web/public/styles.css.br +0 -0
  215. package/dist/web/public/styles.css.gz +0 -0
  216. package/dist/web/public/sw.js +67 -0
  217. package/dist/web/public/sw.js.br +0 -0
  218. package/dist/web/public/sw.js.gz +0 -0
  219. package/dist/web/public/upload.html +155 -0
  220. package/dist/web/public/upload.html.br +0 -0
  221. package/dist/web/public/upload.html.gz +0 -0
  222. package/dist/web/public/vendor/xterm-addon-fit.min.js +1 -0
  223. package/dist/web/public/vendor/xterm-addon-fit.min.js.br +0 -0
  224. package/dist/web/public/vendor/xterm-addon-fit.min.js.gz +0 -0
  225. package/dist/web/public/vendor/xterm-addon-unicode11.min.js +1 -0
  226. package/dist/web/public/vendor/xterm-addon-unicode11.min.js.br +0 -0
  227. package/dist/web/public/vendor/xterm-addon-unicode11.min.js.gz +0 -0
  228. package/dist/web/public/vendor/xterm-addon-webgl.min.js +2 -0
  229. package/dist/web/public/vendor/xterm-addon-webgl.min.js.br +0 -0
  230. package/dist/web/public/vendor/xterm-addon-webgl.min.js.gz +0 -0
  231. package/dist/web/public/vendor/xterm.css +209 -0
  232. package/dist/web/public/vendor/xterm.css.br +0 -0
  233. package/dist/web/public/vendor/xterm.css.gz +0 -0
  234. package/dist/web/public/vendor/xterm.min.js +9 -0
  235. package/dist/web/public/vendor/xterm.min.js.br +0 -0
  236. package/dist/web/public/vendor/xterm.min.js.gz +0 -0
  237. package/dist/web/schemas.d.ts +479 -0
  238. package/dist/web/schemas.d.ts.map +1 -0
  239. package/dist/web/schemas.js +448 -0
  240. package/dist/web/schemas.js.map +1 -0
  241. package/dist/web/server.d.ts +207 -0
  242. package/dist/web/server.d.ts.map +1 -0
  243. package/dist/web/server.js +5784 -0
  244. package/dist/web/server.js.map +1 -0
  245. package/package.json +110 -0
  246. package/scripts/postinstall.js +390 -0
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Research Agent Prompt
3
+ *
4
+ * Gathers external resources, codebase patterns, and technical context
5
+ * before other agents analyze the task.
6
+ *
7
+ * Placeholders: {TASK}, {WORKING_DIR}
8
+ */
9
+ export declare const RESEARCH_AGENT_PROMPT = "You are a Research Specialist preparing context for an implementation task. Your job is to gather all relevant information that will help the development team succeed.\n\n## YOUR TASK\nResearch and gather comprehensive context for implementing this task:\n\n## TASK DESCRIPTION\n{TASK}\n\n## WORKING DIRECTORY\n{WORKING_DIR}\n\n## INSTRUCTIONS\nPerform thorough research across multiple sources:\n\n### 1. LOCAL PROJECT EXPLORATION (DO THIS FIRST)\nExplore the working directory to understand the existing project:\n\n**PRIORITY: Read CLAUDE.md First!**\nIf a CLAUDE.md file exists in the working directory, READ IT IMMEDIATELY. This file contains:\n- Project-specific instructions and conventions\n- Build and test commands\n- Architecture overview\n- Important patterns and gotchas\n- Files and directories to focus on\n\n**Project Structure:**\n- List files and directories to understand the project layout\n- Look for package.json, tsconfig.json, Cargo.toml, requirements.txt, etc. to identify tech stack\n- Also check README.md or docs/ for additional documentation\n- Identify the main source directories (src/, lib/, app/, etc.)\n\n**Existing Code Patterns:**\n- Search for similar features or functionality already implemented\n- Identify coding conventions (naming, file organization, module patterns)\n- Look at existing tests to understand testing patterns\n- Check for configuration files, environment setup, types/interfaces\n\n**Key Files to Examine:**\n- Entry points (index.ts, main.py, App.tsx, etc.)\n- Type definitions and interfaces\n- Utility functions and shared code\n- Database models or schemas if applicable\n\nUSE THESE TOOLS:\n- `Glob` to find files by pattern (e.g., \"**/*.ts\", \"src/**/*.tsx\")\n- `Grep` to search for specific patterns, function names, or imports\n- `Read` to examine file contents\n- Look at the most recently modified files - they're likely relevant\n\n### 2. WEB RESEARCH\nUse web search to find:\n- **Official documentation** for technologies used in the project\n- **GitHub repositories** that implement similar features\n- **Best practice guides** for the tech stack identified\n- **Stack Overflow answers** for specific implementation questions\n\nFocus your web search on:\n- How others have solved similar problems with the same tech stack\n- Common pitfalls and gotchas for the specific technologies\n- Library/package recommendations compatible with the project\n- API usage examples\n\n### 3. TECHNICAL ANALYSIS\nBased on your research:\n- Recommend the best approach that fits the existing codebase style\n- Identify files that will need to be modified or created\n- Suggest where new code should live based on existing structure\n- Note any compatibility or integration concerns\n\n## OUTPUT FORMAT\nReturn ONLY a JSON object:\n{\n \"projectContext\": {\n \"techStack\": [\"TypeScript\", \"React\", \"Node.js\", ...],\n \"projectType\": \"web-app|cli|library|api|monorepo|...\",\n \"buildSystem\": \"npm|yarn|pnpm|cargo|pip|...\",\n \"testFramework\": \"vitest|jest|pytest|...\",\n \"keyDirectories\": {\n \"source\": \"src/\",\n \"tests\": \"test/\",\n \"config\": \"...\"\n },\n \"entryPoints\": [\"src/index.ts\", ...],\n \"hasDocumentation\": true|false,\n \"documentationNotes\": \"Summary of CLAUDE.md or README if found\"\n },\n \"existingPatterns\": [\n {\n \"pattern\": \"Pattern name (e.g., 'EventEmitter for async communication')\",\n \"location\": \"src/events/*.ts\",\n \"example\": \"Brief code example or file reference\",\n \"relevance\": \"Why this pattern matters for the task\"\n }\n ],\n \"relevantFiles\": [\n {\n \"path\": \"src/components/Auth.tsx\",\n \"purpose\": \"What this file does\",\n \"relevance\": \"Why it's relevant to the task\",\n \"shouldModify\": true|false\n }\n ],\n \"externalResources\": [\n {\n \"type\": \"github|documentation|tutorial|article|stackoverflow\",\n \"url\": \"https://...\",\n \"title\": \"Resource title\",\n \"relevance\": \"Why this is relevant to the task\",\n \"keyInsights\": [\"Insight 1\", \"Insight 2\"]\n }\n ],\n \"technicalRecommendations\": [\n \"Use the existing EventEmitter pattern from src/events/ for...\",\n \"Follow the component structure in src/components/...\"\n ],\n \"potentialChallenges\": [\n \"The existing auth system uses X, need to integrate with...\",\n \"Watch out for Y when modifying Z\"\n ],\n \"suggestedApproach\": {\n \"summary\": \"Brief 2-3 sentence approach recommendation\",\n \"newFiles\": [\"src/features/new-feature.ts\", ...],\n \"modifyFiles\": [\"src/index.ts\", ...],\n \"testFiles\": [\"test/new-feature.test.ts\", ...]\n },\n \"enrichedTaskDescription\": \"A detailed version of the original task, enriched with specific file paths, existing patterns to follow, and technical details from your exploration. Should reference actual files and patterns found in the codebase.\"\n}\n\nCRITICAL REQUIREMENTS:\n1. ALWAYS explore the local project FIRST - understand what exists before searching online\n2. Reference ACTUAL files and patterns found in the codebase, not hypothetical ones\n3. The enrichedTaskDescription MUST include specific file paths and patterns from the project\n4. Use Glob/Grep/Read tools to actually explore - don't guess about project structure\n5. If web search finds useful resources, include real URLs";
10
+ //# sourceMappingURL=research-agent.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"research-agent.d.ts","sourceRoot":"","sources":["../../src/prompts/research-agent.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,eAAO,MAAM,qBAAqB,01KAqIyB,CAAC"}
@@ -0,0 +1,143 @@
1
+ /**
2
+ * Research Agent Prompt
3
+ *
4
+ * Gathers external resources, codebase patterns, and technical context
5
+ * before other agents analyze the task.
6
+ *
7
+ * Placeholders: {TASK}, {WORKING_DIR}
8
+ */
9
+ export const RESEARCH_AGENT_PROMPT = `You are a Research Specialist preparing context for an implementation task. Your job is to gather all relevant information that will help the development team succeed.
10
+
11
+ ## YOUR TASK
12
+ Research and gather comprehensive context for implementing this task:
13
+
14
+ ## TASK DESCRIPTION
15
+ {TASK}
16
+
17
+ ## WORKING DIRECTORY
18
+ {WORKING_DIR}
19
+
20
+ ## INSTRUCTIONS
21
+ Perform thorough research across multiple sources:
22
+
23
+ ### 1. LOCAL PROJECT EXPLORATION (DO THIS FIRST)
24
+ Explore the working directory to understand the existing project:
25
+
26
+ **PRIORITY: Read CLAUDE.md First!**
27
+ If a CLAUDE.md file exists in the working directory, READ IT IMMEDIATELY. This file contains:
28
+ - Project-specific instructions and conventions
29
+ - Build and test commands
30
+ - Architecture overview
31
+ - Important patterns and gotchas
32
+ - Files and directories to focus on
33
+
34
+ **Project Structure:**
35
+ - List files and directories to understand the project layout
36
+ - Look for package.json, tsconfig.json, Cargo.toml, requirements.txt, etc. to identify tech stack
37
+ - Also check README.md or docs/ for additional documentation
38
+ - Identify the main source directories (src/, lib/, app/, etc.)
39
+
40
+ **Existing Code Patterns:**
41
+ - Search for similar features or functionality already implemented
42
+ - Identify coding conventions (naming, file organization, module patterns)
43
+ - Look at existing tests to understand testing patterns
44
+ - Check for configuration files, environment setup, types/interfaces
45
+
46
+ **Key Files to Examine:**
47
+ - Entry points (index.ts, main.py, App.tsx, etc.)
48
+ - Type definitions and interfaces
49
+ - Utility functions and shared code
50
+ - Database models or schemas if applicable
51
+
52
+ USE THESE TOOLS:
53
+ - \`Glob\` to find files by pattern (e.g., "**/*.ts", "src/**/*.tsx")
54
+ - \`Grep\` to search for specific patterns, function names, or imports
55
+ - \`Read\` to examine file contents
56
+ - Look at the most recently modified files - they're likely relevant
57
+
58
+ ### 2. WEB RESEARCH
59
+ Use web search to find:
60
+ - **Official documentation** for technologies used in the project
61
+ - **GitHub repositories** that implement similar features
62
+ - **Best practice guides** for the tech stack identified
63
+ - **Stack Overflow answers** for specific implementation questions
64
+
65
+ Focus your web search on:
66
+ - How others have solved similar problems with the same tech stack
67
+ - Common pitfalls and gotchas for the specific technologies
68
+ - Library/package recommendations compatible with the project
69
+ - API usage examples
70
+
71
+ ### 3. TECHNICAL ANALYSIS
72
+ Based on your research:
73
+ - Recommend the best approach that fits the existing codebase style
74
+ - Identify files that will need to be modified or created
75
+ - Suggest where new code should live based on existing structure
76
+ - Note any compatibility or integration concerns
77
+
78
+ ## OUTPUT FORMAT
79
+ Return ONLY a JSON object:
80
+ {
81
+ "projectContext": {
82
+ "techStack": ["TypeScript", "React", "Node.js", ...],
83
+ "projectType": "web-app|cli|library|api|monorepo|...",
84
+ "buildSystem": "npm|yarn|pnpm|cargo|pip|...",
85
+ "testFramework": "vitest|jest|pytest|...",
86
+ "keyDirectories": {
87
+ "source": "src/",
88
+ "tests": "test/",
89
+ "config": "..."
90
+ },
91
+ "entryPoints": ["src/index.ts", ...],
92
+ "hasDocumentation": true|false,
93
+ "documentationNotes": "Summary of CLAUDE.md or README if found"
94
+ },
95
+ "existingPatterns": [
96
+ {
97
+ "pattern": "Pattern name (e.g., 'EventEmitter for async communication')",
98
+ "location": "src/events/*.ts",
99
+ "example": "Brief code example or file reference",
100
+ "relevance": "Why this pattern matters for the task"
101
+ }
102
+ ],
103
+ "relevantFiles": [
104
+ {
105
+ "path": "src/components/Auth.tsx",
106
+ "purpose": "What this file does",
107
+ "relevance": "Why it's relevant to the task",
108
+ "shouldModify": true|false
109
+ }
110
+ ],
111
+ "externalResources": [
112
+ {
113
+ "type": "github|documentation|tutorial|article|stackoverflow",
114
+ "url": "https://...",
115
+ "title": "Resource title",
116
+ "relevance": "Why this is relevant to the task",
117
+ "keyInsights": ["Insight 1", "Insight 2"]
118
+ }
119
+ ],
120
+ "technicalRecommendations": [
121
+ "Use the existing EventEmitter pattern from src/events/ for...",
122
+ "Follow the component structure in src/components/..."
123
+ ],
124
+ "potentialChallenges": [
125
+ "The existing auth system uses X, need to integrate with...",
126
+ "Watch out for Y when modifying Z"
127
+ ],
128
+ "suggestedApproach": {
129
+ "summary": "Brief 2-3 sentence approach recommendation",
130
+ "newFiles": ["src/features/new-feature.ts", ...],
131
+ "modifyFiles": ["src/index.ts", ...],
132
+ "testFiles": ["test/new-feature.test.ts", ...]
133
+ },
134
+ "enrichedTaskDescription": "A detailed version of the original task, enriched with specific file paths, existing patterns to follow, and technical details from your exploration. Should reference actual files and patterns found in the codebase."
135
+ }
136
+
137
+ CRITICAL REQUIREMENTS:
138
+ 1. ALWAYS explore the local project FIRST - understand what exists before searching online
139
+ 2. Reference ACTUAL files and patterns found in the codebase, not hypothetical ones
140
+ 3. The enrichedTaskDescription MUST include specific file paths and patterns from the project
141
+ 4. Use Glob/Grep/Read tools to actually explore - don't guess about project structure
142
+ 5. If web search finds useful resources, include real URLs`;
143
+ //# sourceMappingURL=research-agent.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"research-agent.js","sourceRoot":"","sources":["../../src/prompts/research-agent.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,MAAM,CAAC,MAAM,qBAAqB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2DAqIsB,CAAC"}
@@ -0,0 +1,41 @@
1
+ /**
2
+ * @fileoverview VAPID key auto-generation and push subscription CRUD.
3
+ *
4
+ * Persists VAPID keys to ~/.codeman/push-keys.json and subscriptions
5
+ * to ~/.codeman/push-subscriptions.json. Debounced saves prevent
6
+ * excessive disk I/O during rapid subscription updates.
7
+ */
8
+ import type { VapidKeys, PushSubscriptionRecord } from './types.js';
9
+ export declare class PushSubscriptionStore {
10
+ private vapidKeys;
11
+ private subscriptions;
12
+ private saveTimer;
13
+ private _disposed;
14
+ constructor();
15
+ get isDisposed(): boolean;
16
+ /** Get or generate VAPID keys */
17
+ getVapidKeys(): VapidKeys;
18
+ /** Get the public VAPID key for client subscription */
19
+ getPublicKey(): string;
20
+ /** Register or update a push subscription (deduplicates by endpoint) */
21
+ addSubscription(sub: Omit<PushSubscriptionRecord, 'lastUsedAt'>): PushSubscriptionRecord;
22
+ /** Update push preferences for a subscription */
23
+ updatePreferences(id: string, preferences: Record<string, boolean>): PushSubscriptionRecord | null;
24
+ /** Remove a subscription */
25
+ removeSubscription(id: string): boolean;
26
+ /** Remove subscription by endpoint (used for auto-cleanup of expired subs) */
27
+ removeByEndpoint(endpoint: string): void;
28
+ /** Get all subscriptions */
29
+ getAll(): PushSubscriptionRecord[];
30
+ /** Get a single subscription by ID */
31
+ get(id: string): PushSubscriptionRecord | null;
32
+ /** Load subscriptions from disk */
33
+ private loadSubscriptions;
34
+ /** Schedule a debounced save */
35
+ private scheduleSave;
36
+ /** Immediately persist subscriptions to disk */
37
+ private flushSave;
38
+ /** Clean shutdown */
39
+ dispose(): void;
40
+ }
41
+ //# sourceMappingURL=push-store.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"push-store.d.ts","sourceRoot":"","sources":["../src/push-store.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAMH,OAAO,KAAK,EAAE,SAAS,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAC;AAOpE,qBAAa,qBAAqB;IAChC,OAAO,CAAC,SAAS,CAA0B;IAC3C,OAAO,CAAC,aAAa,CAAkD;IACvE,OAAO,CAAC,SAAS,CAA+B;IAChD,OAAO,CAAC,SAAS,CAAS;;IAM1B,IAAI,UAAU,IAAI,OAAO,CAExB;IAED,iCAAiC;IACjC,YAAY,IAAI,SAAS;IA4BzB,uDAAuD;IACvD,YAAY,IAAI,MAAM;IAItB,wEAAwE;IACxE,eAAe,CAAC,GAAG,EAAE,IAAI,CAAC,sBAAsB,EAAE,YAAY,CAAC,GAAG,sBAAsB;IA4BxF,iDAAiD;IACjD,iBAAiB,CAAC,EAAE,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,sBAAsB,GAAG,IAAI;IASlG,4BAA4B;IAC5B,kBAAkB,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO;IAMvC,8EAA8E;IAC9E,gBAAgB,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI;IAUxC,4BAA4B;IAC5B,MAAM,IAAI,sBAAsB,EAAE;IAIlC,sCAAsC;IACtC,GAAG,CAAC,EAAE,EAAE,MAAM,GAAG,sBAAsB,GAAG,IAAI;IAI9C,mCAAmC;IACnC,OAAO,CAAC,iBAAiB;IAazB,gCAAgC;IAChC,OAAO,CAAC,YAAY;IAQpB,gDAAgD;IAChD,OAAO,CAAC,SAAS;IASjB,qBAAqB;IACrB,OAAO,IAAI,IAAI;CAUhB"}
@@ -0,0 +1,168 @@
1
+ /**
2
+ * @fileoverview VAPID key auto-generation and push subscription CRUD.
3
+ *
4
+ * Persists VAPID keys to ~/.codeman/push-keys.json and subscriptions
5
+ * to ~/.codeman/push-subscriptions.json. Debounced saves prevent
6
+ * excessive disk I/O during rapid subscription updates.
7
+ */
8
+ import { existsSync, readFileSync, writeFileSync, mkdirSync } from 'node:fs';
9
+ import { join } from 'node:path';
10
+ import { homedir } from 'node:os';
11
+ import webpush from 'web-push';
12
+ const DATA_DIR = join(homedir(), '.codeman');
13
+ const KEYS_FILE = join(DATA_DIR, 'push-keys.json');
14
+ const SUBS_FILE = join(DATA_DIR, 'push-subscriptions.json');
15
+ const SAVE_DEBOUNCE_MS = 500;
16
+ export class PushSubscriptionStore {
17
+ vapidKeys = null;
18
+ subscriptions = new Map();
19
+ saveTimer = null;
20
+ _disposed = false;
21
+ constructor() {
22
+ this.loadSubscriptions();
23
+ }
24
+ get isDisposed() {
25
+ return this._disposed;
26
+ }
27
+ /** Get or generate VAPID keys */
28
+ getVapidKeys() {
29
+ if (this.vapidKeys)
30
+ return this.vapidKeys;
31
+ // Try loading from disk
32
+ if (existsSync(KEYS_FILE)) {
33
+ try {
34
+ const raw = readFileSync(KEYS_FILE, 'utf-8');
35
+ this.vapidKeys = JSON.parse(raw);
36
+ return this.vapidKeys;
37
+ }
38
+ catch {
39
+ // Regenerate on parse error
40
+ }
41
+ }
42
+ // Generate new keys
43
+ const keys = webpush.generateVAPIDKeys();
44
+ this.vapidKeys = {
45
+ publicKey: keys.publicKey,
46
+ privateKey: keys.privateKey,
47
+ generatedAt: Date.now(),
48
+ };
49
+ // Persist
50
+ mkdirSync(DATA_DIR, { recursive: true });
51
+ writeFileSync(KEYS_FILE, JSON.stringify(this.vapidKeys, null, 2));
52
+ return this.vapidKeys;
53
+ }
54
+ /** Get the public VAPID key for client subscription */
55
+ getPublicKey() {
56
+ return this.getVapidKeys().publicKey;
57
+ }
58
+ /** Register or update a push subscription (deduplicates by endpoint) */
59
+ addSubscription(sub) {
60
+ // Check for existing subscription with same endpoint
61
+ for (const [existingId, existing] of this.subscriptions) {
62
+ if (existing.endpoint === sub.endpoint) {
63
+ // Update existing
64
+ const updated = {
65
+ ...existing,
66
+ keys: sub.keys,
67
+ userAgent: sub.userAgent,
68
+ lastUsedAt: Date.now(),
69
+ pushPreferences: sub.pushPreferences,
70
+ };
71
+ this.subscriptions.set(existingId, updated);
72
+ this.scheduleSave();
73
+ return updated;
74
+ }
75
+ }
76
+ // New subscription
77
+ const record = {
78
+ ...sub,
79
+ lastUsedAt: Date.now(),
80
+ };
81
+ this.subscriptions.set(record.id, record);
82
+ this.scheduleSave();
83
+ return record;
84
+ }
85
+ /** Update push preferences for a subscription */
86
+ updatePreferences(id, preferences) {
87
+ const sub = this.subscriptions.get(id);
88
+ if (!sub)
89
+ return null;
90
+ sub.pushPreferences = preferences;
91
+ sub.lastUsedAt = Date.now();
92
+ this.scheduleSave();
93
+ return sub;
94
+ }
95
+ /** Remove a subscription */
96
+ removeSubscription(id) {
97
+ const deleted = this.subscriptions.delete(id);
98
+ if (deleted)
99
+ this.scheduleSave();
100
+ return deleted;
101
+ }
102
+ /** Remove subscription by endpoint (used for auto-cleanup of expired subs) */
103
+ removeByEndpoint(endpoint) {
104
+ for (const [id, sub] of this.subscriptions) {
105
+ if (sub.endpoint === endpoint) {
106
+ this.subscriptions.delete(id);
107
+ this.scheduleSave();
108
+ return;
109
+ }
110
+ }
111
+ }
112
+ /** Get all subscriptions */
113
+ getAll() {
114
+ return Array.from(this.subscriptions.values());
115
+ }
116
+ /** Get a single subscription by ID */
117
+ get(id) {
118
+ return this.subscriptions.get(id) ?? null;
119
+ }
120
+ /** Load subscriptions from disk */
121
+ loadSubscriptions() {
122
+ if (!existsSync(SUBS_FILE))
123
+ return;
124
+ try {
125
+ const raw = readFileSync(SUBS_FILE, 'utf-8');
126
+ const arr = JSON.parse(raw);
127
+ for (const sub of arr) {
128
+ this.subscriptions.set(sub.id, sub);
129
+ }
130
+ }
131
+ catch {
132
+ // Start fresh on parse error
133
+ }
134
+ }
135
+ /** Schedule a debounced save */
136
+ scheduleSave() {
137
+ if (this._disposed)
138
+ return;
139
+ if (this.saveTimer)
140
+ clearTimeout(this.saveTimer);
141
+ this.saveTimer = setTimeout(() => {
142
+ this.flushSave();
143
+ }, SAVE_DEBOUNCE_MS);
144
+ }
145
+ /** Immediately persist subscriptions to disk */
146
+ flushSave() {
147
+ try {
148
+ mkdirSync(DATA_DIR, { recursive: true });
149
+ writeFileSync(SUBS_FILE, JSON.stringify(Array.from(this.subscriptions.values()), null, 2));
150
+ }
151
+ catch {
152
+ // Ignore write errors
153
+ }
154
+ }
155
+ /** Clean shutdown */
156
+ dispose() {
157
+ if (this._disposed)
158
+ return;
159
+ this._disposed = true;
160
+ if (this.saveTimer) {
161
+ clearTimeout(this.saveTimer);
162
+ this.saveTimer = null;
163
+ }
164
+ // Final flush
165
+ this.flushSave();
166
+ }
167
+ }
168
+ //# sourceMappingURL=push-store.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"push-store.js","sourceRoot":"","sources":["../src/push-store.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAC7E,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,OAAO,MAAM,UAAU,CAAC;AAG/B,MAAM,QAAQ,GAAG,IAAI,CAAC,OAAO,EAAE,EAAE,UAAU,CAAC,CAAC;AAC7C,MAAM,SAAS,GAAG,IAAI,CAAC,QAAQ,EAAE,gBAAgB,CAAC,CAAC;AACn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,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,EAAE,GAAG,CAAC,CAAC;YACtC,CAAC;QACH,CAAC;QAAC,MAAM,CAAC;YACP,6BAA6B;QAC/B,CAAC;IACH,CAAC;IAED,gCAAgC;IACxB,YAAY;QAClB,IAAI,IAAI,CAAC,SAAS;YAAE,OAAO;QAC3B,IAAI,IAAI,CAAC,SAAS;YAAE,YAAY,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QACjD,IAAI,CAAC,SAAS,GAAG,UAAU,CAAC,GAAG,EAAE;YAC/B,IAAI,CAAC,SAAS,EAAE,CAAC;QACnB,CAAC,EAAE,gBAAgB,CAAC,CAAC;IACvB,CAAC;IAED,gDAAgD;IACxC,SAAS;QACf,IAAI,CAAC;YACH,SAAS,CAAC,QAAQ,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;YACzC,aAAa,CAAC,SAAS,EAAE,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,MAAM,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;QAC7F,CAAC;QAAC,MAAM,CAAC;YACP,sBAAsB;QACxB,CAAC;IACH,CAAC;IAED,qBAAqB;IACrB,OAAO;QACL,IAAI,IAAI,CAAC,SAAS;YAAE,OAAO;QAC3B,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC;QACtB,IAAI,IAAI,CAAC,SAAS,EAAE,CAAC;YACnB,YAAY,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;YAC7B,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC;QACxB,CAAC;QACD,cAAc;QACd,IAAI,CAAC,SAAS,EAAE,CAAC;IACnB,CAAC;CACF"}
@@ -0,0 +1,67 @@
1
+ /**
2
+ * @fileoverview Ralph Wiggum configuration parser
3
+ *
4
+ * Parses the official Ralph Wiggum plugin state file (.claude/ralph-loop.local.md)
5
+ * and extracts configuration for session tracking.
6
+ *
7
+ * @module ralph-config
8
+ */
9
+ /**
10
+ * Ralph Loop configuration from .claude/ralph-loop.local.md
11
+ */
12
+ export interface RalphLoopConfig {
13
+ enabled: boolean;
14
+ iteration: number;
15
+ maxIterations: number | null;
16
+ completionPromise: string | null;
17
+ }
18
+ /**
19
+ * Parse Ralph Wiggum loop config from .claude/ralph-loop.local.md
20
+ *
21
+ * The official Ralph Wiggum plugin stores state in this file with YAML frontmatter:
22
+ * ```yaml
23
+ * ---
24
+ * enabled: true
25
+ * iteration: 5
26
+ * max-iterations: 50
27
+ * completion-promise: "COMPLETE"
28
+ * ---
29
+ * # Original Prompt
30
+ * ...
31
+ * ```
32
+ *
33
+ * @param workingDir - Working directory to search in
34
+ * @returns Parsed config or null if file doesn't exist or is invalid
35
+ */
36
+ export declare function parseRalphLoopConfig(workingDir: string): RalphLoopConfig | null;
37
+ /**
38
+ * Parse Ralph Wiggum loop config from file content.
39
+ * Exported for testing.
40
+ *
41
+ * @param content - File content to parse
42
+ * @returns Parsed config or null if content is invalid
43
+ */
44
+ export declare function parseRalphLoopConfigFromContent(content: string): RalphLoopConfig | null;
45
+ /**
46
+ * Extract completion phrase from CLAUDE.md content.
47
+ * Looks for <promise>PHRASE</promise> pattern.
48
+ *
49
+ * Handles multiple variations:
50
+ * - Raw text: <promise>PHRASE</promise>
51
+ * - In backticks: `<promise>PHRASE</promise>`
52
+ * - With whitespace: <promise> PHRASE </promise>
53
+ * - Multiple occurrences: returns the first one
54
+ *
55
+ * @param claudeMdPath - Path to CLAUDE.md file
56
+ * @returns The completion phrase (uppercase), or null if not found
57
+ */
58
+ export declare function extractCompletionPhrase(claudeMdPath: string): string | null;
59
+ /**
60
+ * Extract completion phrase from CLAUDE.md content string.
61
+ * Exported for testing.
62
+ *
63
+ * @param content - CLAUDE.md content to parse
64
+ * @returns The completion phrase (uppercase), or null if not found
65
+ */
66
+ export declare function extractCompletionPhraseFromContent(content: string): string | null;
67
+ //# sourceMappingURL=ralph-config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ralph-config.d.ts","sourceRoot":"","sources":["../src/ralph-config.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAeH;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,OAAO,EAAE,OAAO,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,iBAAiB,EAAE,MAAM,GAAG,IAAI,CAAC;CAClC;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,oBAAoB,CAAC,UAAU,EAAE,MAAM,GAAG,eAAe,GAAG,IAAI,CAY/E;AAED;;;;;;GAMG;AACH,wBAAgB,+BAA+B,CAAC,OAAO,EAAE,MAAM,GAAG,eAAe,GAAG,IAAI,CAqCvF;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,uBAAuB,CAAC,YAAY,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAU3E;AAED;;;;;;GAMG;AACH,wBAAgB,kCAAkC,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAUjF"}
@@ -0,0 +1,134 @@
1
+ /**
2
+ * @fileoverview Ralph Wiggum configuration parser
3
+ *
4
+ * Parses the official Ralph Wiggum plugin state file (.claude/ralph-loop.local.md)
5
+ * and extracts configuration for session tracking.
6
+ *
7
+ * @module ralph-config
8
+ */
9
+ import { existsSync, readFileSync } from 'node:fs';
10
+ import { join } from 'node:path';
11
+ // Pattern to extract completion phrase from CLAUDE.md
12
+ // Matches <promise>PHRASE</promise> with optional whitespace
13
+ // Allows: letters, numbers, underscores, hyphens (e.g., TESTS-PASS, ALL_DONE)
14
+ const CLAUDE_MD_PROMISE_PATTERN = /<promise>\s*([A-Z0-9_-]+)\s*<\/promise>/gi;
15
+ // Pattern to parse YAML frontmatter from ralph-loop.local.md
16
+ // Extracts key: value pairs from between --- markers
17
+ const YAML_FRONTMATTER_PATTERN = /^---\s*\n([\s\S]*?)\n---/;
18
+ const YAML_LINE_PATTERN = /^([a-zA-Z_-]+):\s*"?([^"\n]+)"?\s*$/gm;
19
+ /**
20
+ * Parse Ralph Wiggum loop config from .claude/ralph-loop.local.md
21
+ *
22
+ * The official Ralph Wiggum plugin stores state in this file with YAML frontmatter:
23
+ * ```yaml
24
+ * ---
25
+ * enabled: true
26
+ * iteration: 5
27
+ * max-iterations: 50
28
+ * completion-promise: "COMPLETE"
29
+ * ---
30
+ * # Original Prompt
31
+ * ...
32
+ * ```
33
+ *
34
+ * @param workingDir - Working directory to search in
35
+ * @returns Parsed config or null if file doesn't exist or is invalid
36
+ */
37
+ export function parseRalphLoopConfig(workingDir) {
38
+ const configPath = join(workingDir, '.claude', 'ralph-loop.local.md');
39
+ try {
40
+ if (!existsSync(configPath))
41
+ return null;
42
+ const content = readFileSync(configPath, 'utf-8');
43
+ return parseRalphLoopConfigFromContent(content);
44
+ }
45
+ catch (err) {
46
+ console.error(`[ralph-config] Error reading ralph-loop.local.md: ${err}`);
47
+ return null;
48
+ }
49
+ }
50
+ /**
51
+ * Parse Ralph Wiggum loop config from file content.
52
+ * Exported for testing.
53
+ *
54
+ * @param content - File content to parse
55
+ * @returns Parsed config or null if content is invalid
56
+ */
57
+ export function parseRalphLoopConfigFromContent(content) {
58
+ // Extract YAML frontmatter
59
+ const frontmatterMatch = content.match(YAML_FRONTMATTER_PATTERN);
60
+ if (!frontmatterMatch)
61
+ return null;
62
+ const yaml = frontmatterMatch[1];
63
+ const config = {
64
+ enabled: false,
65
+ iteration: 0,
66
+ maxIterations: null,
67
+ completionPromise: null,
68
+ };
69
+ // Parse each YAML line
70
+ let match;
71
+ YAML_LINE_PATTERN.lastIndex = 0;
72
+ while ((match = YAML_LINE_PATTERN.exec(yaml)) !== null) {
73
+ const key = match[1].toLowerCase();
74
+ const value = match[2].trim();
75
+ switch (key) {
76
+ case 'enabled':
77
+ config.enabled = value.toLowerCase() === 'true' || value.toLowerCase() === 'yes';
78
+ break;
79
+ case 'iteration':
80
+ config.iteration = parseInt(value, 10) || 0;
81
+ break;
82
+ case 'max-iterations':
83
+ config.maxIterations = parseInt(value, 10) || null;
84
+ break;
85
+ case 'completion-promise':
86
+ config.completionPromise = value.toUpperCase();
87
+ break;
88
+ }
89
+ }
90
+ return config;
91
+ }
92
+ /**
93
+ * Extract completion phrase from CLAUDE.md content.
94
+ * Looks for <promise>PHRASE</promise> pattern.
95
+ *
96
+ * Handles multiple variations:
97
+ * - Raw text: <promise>PHRASE</promise>
98
+ * - In backticks: `<promise>PHRASE</promise>`
99
+ * - With whitespace: <promise> PHRASE </promise>
100
+ * - Multiple occurrences: returns the first one
101
+ *
102
+ * @param claudeMdPath - Path to CLAUDE.md file
103
+ * @returns The completion phrase (uppercase), or null if not found
104
+ */
105
+ export function extractCompletionPhrase(claudeMdPath) {
106
+ try {
107
+ if (!existsSync(claudeMdPath))
108
+ return null;
109
+ const content = readFileSync(claudeMdPath, 'utf-8');
110
+ return extractCompletionPhraseFromContent(content);
111
+ }
112
+ catch (err) {
113
+ console.error(`[ralph-config] Error reading CLAUDE.md: ${err}`);
114
+ return null;
115
+ }
116
+ }
117
+ /**
118
+ * Extract completion phrase from CLAUDE.md content string.
119
+ * Exported for testing.
120
+ *
121
+ * @param content - CLAUDE.md content to parse
122
+ * @returns The completion phrase (uppercase), or null if not found
123
+ */
124
+ export function extractCompletionPhraseFromContent(content) {
125
+ // Reset regex state (global flag)
126
+ CLAUDE_MD_PROMISE_PATTERN.lastIndex = 0;
127
+ // Find all matches and return the first one
128
+ const match = CLAUDE_MD_PROMISE_PATTERN.exec(content);
129
+ if (match && match[1]) {
130
+ return match[1].trim().toUpperCase();
131
+ }
132
+ return null;
133
+ }
134
+ //# sourceMappingURL=ralph-config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ralph-config.js","sourceRoot":"","sources":["../src/ralph-config.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,UAAU,EAAE,YAAY,EA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