rhachet-roles-bhrain 0.3.0 → 0.5.2

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 (247) hide show
  1. package/dist/access/sdk/sdkOpenAi.d.ts +25 -0
  2. package/dist/access/sdk/sdkOpenAi.js +122 -0
  3. package/dist/access/sdk/sdkOpenAi.js.map +1 -1
  4. package/dist/access/sdks/anthropic/sdkAnthropic.d.ts +31 -0
  5. package/dist/access/sdks/anthropic/sdkAnthropic.js +151 -0
  6. package/dist/access/sdks/anthropic/sdkAnthropic.js.map +1 -0
  7. package/dist/access/sdks/qwen/sdkQwen.d.ts +31 -0
  8. package/dist/access/sdks/qwen/sdkQwen.js +134 -0
  9. package/dist/access/sdks/qwen/sdkQwen.js.map +1 -0
  10. package/dist/domain.objects/BrainArch1/BrainArch1Actor.d.ts +67 -0
  11. package/dist/domain.objects/BrainArch1/BrainArch1Actor.js +12 -0
  12. package/dist/domain.objects/BrainArch1/BrainArch1Actor.js.map +1 -0
  13. package/dist/domain.objects/BrainArch1/BrainArch1Atom.d.ts +40 -0
  14. package/dist/domain.objects/BrainArch1/BrainArch1Atom.js +3 -0
  15. package/dist/domain.objects/BrainArch1/BrainArch1Atom.js.map +1 -0
  16. package/dist/domain.objects/BrainArch1/BrainArch1Context.d.ts +30 -0
  17. package/dist/domain.objects/BrainArch1/BrainArch1Context.js +3 -0
  18. package/dist/domain.objects/BrainArch1/BrainArch1Context.js.map +1 -0
  19. package/dist/domain.objects/BrainArch1/BrainArch1LoopIteration.d.ts +34 -0
  20. package/dist/domain.objects/BrainArch1/BrainArch1LoopIteration.js +8 -0
  21. package/dist/domain.objects/BrainArch1/BrainArch1LoopIteration.js.map +1 -0
  22. package/dist/domain.objects/BrainArch1/BrainArch1LoopIterationCompletedEvent.d.ts +23 -0
  23. package/dist/domain.objects/BrainArch1/BrainArch1LoopIterationCompletedEvent.js +9 -0
  24. package/dist/domain.objects/BrainArch1/BrainArch1LoopIterationCompletedEvent.js.map +1 -0
  25. package/dist/domain.objects/BrainArch1/BrainArch1LoopResult.d.ts +49 -0
  26. package/dist/domain.objects/BrainArch1/BrainArch1LoopResult.js +8 -0
  27. package/dist/domain.objects/BrainArch1/BrainArch1LoopResult.js.map +1 -0
  28. package/dist/domain.objects/BrainArch1/BrainArch1MemoryCompactedEvent.d.ts +31 -0
  29. package/dist/domain.objects/BrainArch1/BrainArch1MemoryCompactedEvent.js +9 -0
  30. package/dist/domain.objects/BrainArch1/BrainArch1MemoryCompactedEvent.js.map +1 -0
  31. package/dist/domain.objects/BrainArch1/BrainArch1MemoryCompactionResult.d.ts +27 -0
  32. package/dist/domain.objects/BrainArch1/BrainArch1MemoryCompactionResult.js +8 -0
  33. package/dist/domain.objects/BrainArch1/BrainArch1MemoryCompactionResult.js.map +1 -0
  34. package/dist/domain.objects/BrainArch1/BrainArch1MemoryManager.d.ts +45 -0
  35. package/dist/domain.objects/BrainArch1/BrainArch1MemoryManager.js +3 -0
  36. package/dist/domain.objects/BrainArch1/BrainArch1MemoryManager.js.map +1 -0
  37. package/dist/domain.objects/BrainArch1/BrainArch1MemoryTokenUsage.d.ts +29 -0
  38. package/dist/domain.objects/BrainArch1/BrainArch1MemoryTokenUsage.js +8 -0
  39. package/dist/domain.objects/BrainArch1/BrainArch1MemoryTokenUsage.js.map +1 -0
  40. package/dist/domain.objects/BrainArch1/BrainArch1PermissionDecision.d.ts +22 -0
  41. package/dist/domain.objects/BrainArch1/BrainArch1PermissionDecision.js +8 -0
  42. package/dist/domain.objects/BrainArch1/BrainArch1PermissionDecision.js.map +1 -0
  43. package/dist/domain.objects/BrainArch1/BrainArch1PermissionGuard.d.ts +30 -0
  44. package/dist/domain.objects/BrainArch1/BrainArch1PermissionGuard.js +3 -0
  45. package/dist/domain.objects/BrainArch1/BrainArch1PermissionGuard.js.map +1 -0
  46. package/dist/domain.objects/BrainArch1/BrainArch1Session.d.ts +47 -0
  47. package/dist/domain.objects/BrainArch1/BrainArch1Session.js +17 -0
  48. package/dist/domain.objects/BrainArch1/BrainArch1Session.js.map +1 -0
  49. package/dist/domain.objects/BrainArch1/BrainArch1SessionMessage.d.ts +34 -0
  50. package/dist/domain.objects/BrainArch1/BrainArch1SessionMessage.js +12 -0
  51. package/dist/domain.objects/BrainArch1/BrainArch1SessionMessage.js.map +1 -0
  52. package/dist/domain.objects/BrainArch1/BrainArch1ToolCall.d.ts +21 -0
  53. package/dist/domain.objects/BrainArch1/BrainArch1ToolCall.js +8 -0
  54. package/dist/domain.objects/BrainArch1/BrainArch1ToolCall.js.map +1 -0
  55. package/dist/domain.objects/BrainArch1/BrainArch1ToolDefinition.d.ts +54 -0
  56. package/dist/domain.objects/BrainArch1/BrainArch1ToolDefinition.js +20 -0
  57. package/dist/domain.objects/BrainArch1/BrainArch1ToolDefinition.js.map +1 -0
  58. package/dist/domain.objects/BrainArch1/BrainArch1ToolExecutionCompletedEvent.d.ts +36 -0
  59. package/dist/domain.objects/BrainArch1/BrainArch1ToolExecutionCompletedEvent.js +9 -0
  60. package/dist/domain.objects/BrainArch1/BrainArch1ToolExecutionCompletedEvent.js.map +1 -0
  61. package/dist/domain.objects/BrainArch1/BrainArch1ToolResult.d.ts +25 -0
  62. package/dist/domain.objects/BrainArch1/BrainArch1ToolResult.js +8 -0
  63. package/dist/domain.objects/BrainArch1/BrainArch1ToolResult.js.map +1 -0
  64. package/dist/domain.objects/BrainArch1/BrainArch1Toolbox.d.ts +31 -0
  65. package/dist/domain.objects/BrainArch1/BrainArch1Toolbox.js +3 -0
  66. package/dist/domain.objects/BrainArch1/BrainArch1Toolbox.js.map +1 -0
  67. package/dist/domain.objects/Reviewer/ReviewerReflectManifest.d.ts +44 -0
  68. package/dist/domain.objects/Reviewer/ReviewerReflectManifest.js +8 -0
  69. package/dist/domain.objects/Reviewer/ReviewerReflectManifest.js.map +1 -0
  70. package/dist/domain.objects/Reviewer/ReviewerReflectManifestOperation.d.ts +30 -0
  71. package/dist/domain.objects/Reviewer/ReviewerReflectManifestOperation.js +35 -0
  72. package/dist/domain.objects/Reviewer/ReviewerReflectManifestOperation.js.map +1 -0
  73. package/dist/domain.objects/Reviewer/ReviewerReflectMetrics.d.ts +89 -0
  74. package/dist/domain.objects/Reviewer/ReviewerReflectMetrics.js +8 -0
  75. package/dist/domain.objects/Reviewer/ReviewerReflectMetrics.js.map +1 -0
  76. package/dist/domain.objects/Reviewer/ReviewerReflectRuleProposal.d.ts +43 -0
  77. package/dist/domain.objects/Reviewer/ReviewerReflectRuleProposal.js +8 -0
  78. package/dist/domain.objects/Reviewer/ReviewerReflectRuleProposal.js.map +1 -0
  79. package/dist/domain.operations/artifact/genLoopFeedback.js +1 -1
  80. package/dist/domain.operations/artifact/genLoopFeedback.js.map +1 -1
  81. package/dist/domain.operations/artifact/genStepGrabCallerFeedbackToArtifact.d.ts +1 -1
  82. package/dist/domain.operations/brain.replic.arch1/core/invokeBrainArch1.d.ts +13 -0
  83. package/dist/domain.operations/brain.replic.arch1/core/invokeBrainArch1.js +106 -0
  84. package/dist/domain.operations/brain.replic.arch1/core/invokeBrainArch1.js.map +1 -0
  85. package/dist/domain.operations/brain.replic.arch1/llm/generateBrainArch1LlmResponse.d.ts +18 -0
  86. package/dist/domain.operations/brain.replic.arch1/llm/generateBrainArch1LlmResponse.js +16 -0
  87. package/dist/domain.operations/brain.replic.arch1/llm/generateBrainArch1LlmResponse.js.map +1 -0
  88. package/dist/domain.operations/brain.replic.arch1/loop/iterateBrainArch1Loop.d.ts +30 -0
  89. package/dist/domain.operations/brain.replic.arch1/loop/iterateBrainArch1Loop.js +71 -0
  90. package/dist/domain.operations/brain.replic.arch1/loop/iterateBrainArch1Loop.js.map +1 -0
  91. package/dist/domain.operations/brain.replic.arch1/loop/runBrainArch1Loop.d.ts +20 -0
  92. package/dist/domain.operations/brain.replic.arch1/loop/runBrainArch1Loop.js +90 -0
  93. package/dist/domain.operations/brain.replic.arch1/loop/runBrainArch1Loop.js.map +1 -0
  94. package/dist/domain.operations/brain.replic.arch1/plugins/atoms/anthropic.d.ts +8 -0
  95. package/dist/domain.operations/brain.replic.arch1/plugins/atoms/anthropic.js +31 -0
  96. package/dist/domain.operations/brain.replic.arch1/plugins/atoms/anthropic.js.map +1 -0
  97. package/dist/domain.operations/brain.replic.arch1/plugins/atoms/index.d.ts +3 -0
  98. package/dist/domain.operations/brain.replic.arch1/plugins/atoms/index.js +10 -0
  99. package/dist/domain.operations/brain.replic.arch1/plugins/atoms/index.js.map +1 -0
  100. package/dist/domain.operations/brain.replic.arch1/plugins/atoms/openai.d.ts +8 -0
  101. package/dist/domain.operations/brain.replic.arch1/plugins/atoms/openai.js +31 -0
  102. package/dist/domain.operations/brain.replic.arch1/plugins/atoms/openai.js.map +1 -0
  103. package/dist/domain.operations/brain.replic.arch1/plugins/atoms/qwen.d.ts +8 -0
  104. package/dist/domain.operations/brain.replic.arch1/plugins/atoms/qwen.js +32 -0
  105. package/dist/domain.operations/brain.replic.arch1/plugins/atoms/qwen.js.map +1 -0
  106. package/dist/domain.operations/brain.replic.arch1/plugins/memoryManagers/slidingWindow.d.ts +6 -0
  107. package/dist/domain.operations/brain.replic.arch1/plugins/memoryManagers/slidingWindow.js +80 -0
  108. package/dist/domain.operations/brain.replic.arch1/plugins/memoryManagers/slidingWindow.js.map +1 -0
  109. package/dist/domain.operations/brain.replic.arch1/plugins/permissionGuards/allowAll.d.ts +6 -0
  110. package/dist/domain.operations/brain.replic.arch1/plugins/permissionGuards/allowAll.js +14 -0
  111. package/dist/domain.operations/brain.replic.arch1/plugins/permissionGuards/allowAll.js.map +1 -0
  112. package/dist/domain.operations/brain.replic.arch1/plugins/permissionGuards/promptUser.d.ts +8 -0
  113. package/dist/domain.operations/brain.replic.arch1/plugins/permissionGuards/promptUser.js +52 -0
  114. package/dist/domain.operations/brain.replic.arch1/plugins/permissionGuards/promptUser.js.map +1 -0
  115. package/dist/domain.operations/brain.replic.arch1/plugins/permissionGuards/readOnly.d.ts +8 -0
  116. package/dist/domain.operations/brain.replic.arch1/plugins/permissionGuards/readOnly.js +38 -0
  117. package/dist/domain.operations/brain.replic.arch1/plugins/permissionGuards/readOnly.js.map +1 -0
  118. package/dist/domain.operations/brain.replic.arch1/plugins/toolboxes/bash/exec.d.ts +33 -0
  119. package/dist/domain.operations/brain.replic.arch1/plugins/toolboxes/bash/exec.js +100 -0
  120. package/dist/domain.operations/brain.replic.arch1/plugins/toolboxes/bash/exec.js.map +1 -0
  121. package/dist/domain.operations/brain.replic.arch1/plugins/toolboxes/bash/index.d.ts +6 -0
  122. package/dist/domain.operations/brain.replic.arch1/plugins/toolboxes/bash/index.js +26 -0
  123. package/dist/domain.operations/brain.replic.arch1/plugins/toolboxes/bash/index.js.map +1 -0
  124. package/dist/domain.operations/brain.replic.arch1/plugins/toolboxes/files/edit.d.ts +41 -0
  125. package/dist/domain.operations/brain.replic.arch1/plugins/toolboxes/files/edit.js +107 -0
  126. package/dist/domain.operations/brain.replic.arch1/plugins/toolboxes/files/edit.js.map +1 -0
  127. package/dist/domain.operations/brain.replic.arch1/plugins/toolboxes/files/glob.d.ts +33 -0
  128. package/dist/domain.operations/brain.replic.arch1/plugins/toolboxes/files/glob.js +68 -0
  129. package/dist/domain.operations/brain.replic.arch1/plugins/toolboxes/files/glob.js.map +1 -0
  130. package/dist/domain.operations/brain.replic.arch1/plugins/toolboxes/files/grep.d.ts +41 -0
  131. package/dist/domain.operations/brain.replic.arch1/plugins/toolboxes/files/grep.js +97 -0
  132. package/dist/domain.operations/brain.replic.arch1/plugins/toolboxes/files/grep.js.map +1 -0
  133. package/dist/domain.operations/brain.replic.arch1/plugins/toolboxes/files/index.d.ts +6 -0
  134. package/dist/domain.operations/brain.replic.arch1/plugins/toolboxes/files/index.js +65 -0
  135. package/dist/domain.operations/brain.replic.arch1/plugins/toolboxes/files/index.js.map +1 -0
  136. package/dist/domain.operations/brain.replic.arch1/plugins/toolboxes/files/read.d.ts +37 -0
  137. package/dist/domain.operations/brain.replic.arch1/plugins/toolboxes/files/read.js +96 -0
  138. package/dist/domain.operations/brain.replic.arch1/plugins/toolboxes/files/read.js.map +1 -0
  139. package/dist/domain.operations/brain.replic.arch1/plugins/toolboxes/files/write.d.ts +33 -0
  140. package/dist/domain.operations/brain.replic.arch1/plugins/toolboxes/files/write.js +81 -0
  141. package/dist/domain.operations/brain.replic.arch1/plugins/toolboxes/files/write.js.map +1 -0
  142. package/dist/domain.operations/brain.replic.arch1/plugins/toolboxes/web/fetch.d.ts +33 -0
  143. package/dist/domain.operations/brain.replic.arch1/plugins/toolboxes/web/fetch.js +113 -0
  144. package/dist/domain.operations/brain.replic.arch1/plugins/toolboxes/web/fetch.js.map +1 -0
  145. package/dist/domain.operations/brain.replic.arch1/plugins/toolboxes/web/index.d.ts +6 -0
  146. package/dist/domain.operations/brain.replic.arch1/plugins/toolboxes/web/index.js +36 -0
  147. package/dist/domain.operations/brain.replic.arch1/plugins/toolboxes/web/index.js.map +1 -0
  148. package/dist/domain.operations/brain.replic.arch1/plugins/toolboxes/web/search.d.ts +36 -0
  149. package/dist/domain.operations/brain.replic.arch1/plugins/toolboxes/web/search.js +101 -0
  150. package/dist/domain.operations/brain.replic.arch1/plugins/toolboxes/web/search.js.map +1 -0
  151. package/dist/domain.operations/brain.replic.arch1/tool/executeBrainArch1ToolCall.d.ts +14 -0
  152. package/dist/domain.operations/brain.replic.arch1/tool/executeBrainArch1ToolCall.js +45 -0
  153. package/dist/domain.operations/brain.replic.arch1/tool/executeBrainArch1ToolCall.js.map +1 -0
  154. package/dist/domain.operations/brain.replic.arch1/tool/mergeBrainArch1Toolboxes.d.ts +19 -0
  155. package/dist/domain.operations/brain.replic.arch1/tool/mergeBrainArch1Toolboxes.js +35 -0
  156. package/dist/domain.operations/brain.replic.arch1/tool/mergeBrainArch1Toolboxes.js.map +1 -0
  157. package/dist/domain.operations/git/genGitHubFileUrl.d.ts +9 -0
  158. package/dist/domain.operations/git/genGitHubFileUrl.js +55 -0
  159. package/dist/domain.operations/git/genGitHubFileUrl.js.map +1 -0
  160. package/dist/domain.operations/git/getGitRemoteUrl.d.ts +7 -0
  161. package/dist/domain.operations/git/getGitRemoteUrl.js +40 -0
  162. package/dist/domain.operations/git/getGitRemoteUrl.js.map +1 -0
  163. package/dist/domain.operations/hooks/getInvokeHooks.js +1 -1
  164. package/dist/domain.operations/hooks/getInvokeHooks.js.map +1 -1
  165. package/dist/domain.operations/reflect/createDraftDirectory.d.ts +11 -0
  166. package/dist/domain.operations/reflect/createDraftDirectory.js +46 -0
  167. package/dist/domain.operations/reflect/createDraftDirectory.js.map +1 -0
  168. package/dist/domain.operations/reflect/enumFeedbackFiles.d.ts +7 -0
  169. package/dist/domain.operations/reflect/enumFeedbackFiles.js +69 -0
  170. package/dist/domain.operations/reflect/enumFeedbackFiles.js.map +1 -0
  171. package/dist/domain.operations/reflect/extractJsonFromResultText.d.ts +7 -0
  172. package/dist/domain.operations/reflect/extractJsonFromResultText.js +19 -0
  173. package/dist/domain.operations/reflect/extractJsonFromResultText.js.map +1 -0
  174. package/dist/domain.operations/reflect/invokeClaudeCodeForReflect.d.ts +46 -0
  175. package/dist/domain.operations/reflect/invokeClaudeCodeForReflect.js +120 -0
  176. package/dist/domain.operations/reflect/invokeClaudeCodeForReflect.js.map +1 -0
  177. package/dist/domain.operations/reflect/metrics/computeMetricsExpected.d.ts +12 -0
  178. package/dist/domain.operations/reflect/metrics/computeMetricsExpected.js +28 -0
  179. package/dist/domain.operations/reflect/metrics/computeMetricsExpected.js.map +1 -0
  180. package/dist/domain.operations/reflect/metrics/computeMetricsRealized.d.ts +26 -0
  181. package/dist/domain.operations/reflect/metrics/computeMetricsRealized.js +66 -0
  182. package/dist/domain.operations/reflect/metrics/computeMetricsRealized.js.map +1 -0
  183. package/dist/domain.operations/reflect/metrics/writeLogArtifact.d.ts +17 -0
  184. package/dist/domain.operations/reflect/metrics/writeLogArtifact.js +93 -0
  185. package/dist/domain.operations/reflect/metrics/writeLogArtifact.js.map +1 -0
  186. package/dist/domain.operations/reflect/step1/compileCitationsMarkdown.d.ts +8 -0
  187. package/dist/domain.operations/reflect/step1/compileCitationsMarkdown.js +28 -0
  188. package/dist/domain.operations/reflect/step1/compileCitationsMarkdown.js.map +1 -0
  189. package/dist/domain.operations/reflect/step1/compileReflectStep1Prompt.d.ts +14 -0
  190. package/dist/domain.operations/reflect/step1/compileReflectStep1Prompt.js +93 -0
  191. package/dist/domain.operations/reflect/step1/compileReflectStep1Prompt.js.map +1 -0
  192. package/dist/domain.operations/reflect/step2/compileReflectStep2Prompt.d.ts +18 -0
  193. package/dist/domain.operations/reflect/step2/compileReflectStep2Prompt.js +208 -0
  194. package/dist/domain.operations/reflect/step2/compileReflectStep2Prompt.js.map +1 -0
  195. package/dist/domain.operations/reflect/step2/executeManifestOperations.d.ts +17 -0
  196. package/dist/domain.operations/reflect/step2/executeManifestOperations.js +189 -0
  197. package/dist/domain.operations/reflect/step2/executeManifestOperations.js.map +1 -0
  198. package/dist/domain.operations/reflect/step2/parseManifestOperations.d.ts +8 -0
  199. package/dist/domain.operations/reflect/step2/parseManifestOperations.js +73 -0
  200. package/dist/domain.operations/reflect/step2/parseManifestOperations.js.map +1 -0
  201. package/dist/domain.operations/reflect/validateSourceDirectory.d.ts +9 -0
  202. package/dist/domain.operations/reflect/validateSourceDirectory.js +63 -0
  203. package/dist/domain.operations/reflect/validateSourceDirectory.js.map +1 -0
  204. package/dist/domain.operations/reflect/validateTargetDirectory.d.ts +10 -0
  205. package/dist/domain.operations/reflect/validateTargetDirectory.js +59 -0
  206. package/dist/domain.operations/reflect/validateTargetDirectory.js.map +1 -0
  207. package/dist/domain.operations/review/compileReviewPrompt.js +16 -5
  208. package/dist/domain.operations/review/compileReviewPrompt.js.map +1 -1
  209. package/dist/domain.operations/review/formatReviewOutput.d.ts +15 -6
  210. package/dist/domain.operations/review/formatReviewOutput.js +15 -17
  211. package/dist/domain.operations/review/formatReviewOutput.js.map +1 -1
  212. package/dist/index.js.map +1 -1
  213. package/dist/roles/architect/getArchitectRole.d.ts +6 -0
  214. package/dist/roles/architect/getArchitectRole.js +31 -0
  215. package/dist/roles/architect/getArchitectRole.js.map +1 -0
  216. package/dist/roles/brain/getBrainRole.d.ts +6 -0
  217. package/dist/roles/brain/getBrainRole.js +28 -0
  218. package/dist/roles/brain/getBrainRole.js.map +1 -0
  219. package/dist/roles/brain/skills/act/skillAct.d.ts +5 -0
  220. package/dist/roles/brain/skills/act/skillAct.js +147 -0
  221. package/dist/roles/brain/skills/act/skillAct.js.map +1 -0
  222. package/dist/roles/brain/skills/act/skillAct.ts +186 -0
  223. package/dist/roles/brain/skills/act/stepAct.d.ts +27 -0
  224. package/dist/roles/brain/skills/act/stepAct.js +95 -0
  225. package/dist/roles/brain/skills/act/stepAct.js.map +1 -0
  226. package/dist/roles/brain/skills/act/stepAct.ts +123 -0
  227. package/dist/roles/getRoleRegistry.js +5 -4
  228. package/dist/roles/getRoleRegistry.js.map +1 -1
  229. package/dist/roles/reviewer/briefs/on.rules/rules101.[article].md +41 -0
  230. package/dist/roles/reviewer/briefs/on.rules/rules101.citations.[article].md +88 -0
  231. package/dist/roles/reviewer/briefs/on.rules/rules101.collocated.[article].md +97 -0
  232. package/dist/roles/reviewer/briefs/on.rules/rules101.content.[article].md +228 -0
  233. package/dist/roles/reviewer/briefs/on.rules/rules101.content.[demo].forbid.failhide.md +87 -0
  234. package/dist/roles/reviewer/briefs/on.rules/rules101.content.[demo].forbid.gerunds.md +85 -0
  235. package/dist/roles/reviewer/briefs/on.rules/rules101.content.[demo].require.failfast.md +73 -0
  236. package/dist/roles/reviewer/briefs/on.rules/rules101.structure.[article].md +70 -0
  237. package/dist/roles/reviewer/skills/reflect/reflect.d.ts +30 -0
  238. package/dist/roles/reviewer/skills/reflect/reflect.js +305 -0
  239. package/dist/roles/reviewer/skills/reflect/reflect.js.map +1 -0
  240. package/dist/roles/reviewer/skills/reflect/reflect.sh +38 -0
  241. package/dist/roles/reviewer/skills/reflect/reflect.ts +356 -0
  242. package/dist/roles/reviewer/skills/review/review.js.map +1 -1
  243. package/dist/roles/reviewer/skills/review/review.ts +12 -3
  244. package/dist/roles/thinker/getThinkerBrief.d.ts +1 -1
  245. package/dist/roles/thinker/getThinkerRole.js +8 -8
  246. package/dist/roles/thinker/getThinkerRole.js.map +1 -1
  247. package/package.json +6 -4
@@ -0,0 +1,208 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ Object.defineProperty(exports, "__esModule", { value: true });
26
+ exports.compileReflectStep2Prompt = void 0;
27
+ const fs = __importStar(require("fs/promises"));
28
+ const path = __importStar(require("path"));
29
+ const enumFilesFromGlob_1 = require("../../../domain.operations/review/enumFilesFromGlob");
30
+ /**
31
+ * .what = compiles step 2 brain prompt for rule blend
32
+ * .why = instructs brain to create manifest.json for blend operations
33
+ *
34
+ * .note = when rapid=true (haiku), SET_UPDATE is disabled because haiku cannot
35
+ * reliably provide required fields. this means duplicates may be produced
36
+ * when prior rules exist. use rapid=false (sonnet) for proper deduplication.
37
+ */
38
+ const compileReflectStep2Prompt = async (input) => {
39
+ const rapid = input.rapid ?? false;
40
+ const sections = [];
41
+ // enumerate prior rules in target (excluding .draft directory which contains pure proposals)
42
+ const allRuleFiles = await (0, enumFilesFromGlob_1.enumFilesFromGlob)({
43
+ glob: ['**/rule.*.md'],
44
+ cwd: input.targetDir,
45
+ });
46
+ const priorRuleFiles = allRuleFiles.filter((f) => !f.startsWith('.draft/'));
47
+ // enumerate pure proposals
48
+ const pureProposalFiles = await (0, enumFilesFromGlob_1.enumFilesFromGlob)({
49
+ glob: ['*.md'],
50
+ cwd: input.pureDir,
51
+ });
52
+ // objective section
53
+ sections.push(`# objective
54
+
55
+ blend pure rule proposals with target rules.
56
+
57
+ analyze each pure proposal against target rules and create a manifest.json
58
+ specifying the planned operation for each proposal.
59
+ `);
60
+ // target rules section (numbered for reference)
61
+ sections.push(`# target rules
62
+
63
+ ${priorRuleFiles.length === 0 ? 'no rules in target directory' : priorRuleFiles.map((f, i) => `[${i + 1}] ${f}`).join('\n')}
64
+ `);
65
+ // pure proposals section
66
+ sections.push(`# pure proposals
67
+
68
+ ${pureProposalFiles.length === 0 ? 'no pure proposals found (step 1 may not have produced rules)' : pureProposalFiles.map((f) => `- ${f}`).join('\n')}
69
+ `);
70
+ // include content in hard mode
71
+ if (input.mode === 'hard') {
72
+ // target rule content
73
+ if (priorRuleFiles.length > 0) {
74
+ sections.push('# target rule content\n');
75
+ for (const file of priorRuleFiles) {
76
+ const content = await fs.readFile(path.join(input.targetDir, file), 'utf-8');
77
+ sections.push(`## ${file}\n\n\`\`\`\n${content}\n\`\`\`\n`);
78
+ }
79
+ }
80
+ // pure proposal content
81
+ sections.push('# pure proposal content\n');
82
+ for (const file of pureProposalFiles) {
83
+ const content = await fs.readFile(path.join(input.pureDir, file), 'utf-8');
84
+ sections.push(`## ${file}\n\n\`\`\`\n${content}\n\`\`\`\n`);
85
+ }
86
+ }
87
+ // instructions section - different for rapid vs normal mode
88
+ if (rapid) {
89
+ // rapid mode (haiku): simplified operations, no SET_UPDATE
90
+ // haiku cannot reliably provide required fields for SET_UPDATE
91
+ sections.push(`# instructions
92
+
93
+ ## operations
94
+
95
+ 1. **SET_CREATE** - create new rule in target
96
+ - use for: all new rules
97
+ - requires: path, operation, syncPath
98
+
99
+ 2. **OMIT** - skip this proposal
100
+ - use for: exact duplicates (identical content to a target rule)
101
+ - requires: path, operation, reason
102
+
103
+ 3. **SET_APPEND** - add supplementary material
104
+ - use for: demos, references, examples (not rules)
105
+ - requires: path, operation, syncPath
106
+
107
+ ## decision process
108
+
109
+ for each pure proposal:
110
+ 1. is it an exact duplicate (identical content)? → OMIT
111
+ 2. is it supplementary material? → SET_APPEND
112
+ 3. otherwise → SET_CREATE
113
+
114
+ ## output
115
+
116
+ use the Write tool to write manifest to: ${input.draftDir}/manifest.json
117
+
118
+ example:
119
+ \`\`\`json
120
+ {
121
+ "timestamp": "2025-01-01T00:00:00.000Z",
122
+ "pureRules": [
123
+ {
124
+ "path": "rule.forbid.example.md",
125
+ "operation": "SET_CREATE",
126
+ "syncPath": "practices/code.prod/rule.forbid.example.md"
127
+ },
128
+ {
129
+ "path": "rule.require.tests.md",
130
+ "operation": "SET_CREATE",
131
+ "syncPath": "practices/code.test/rule.require.tests.md"
132
+ }
133
+ ]
134
+ }
135
+ \`\`\`
136
+
137
+ after writing, respond with: \`{ "written": true }\`
138
+ `);
139
+ }
140
+ else {
141
+ // normal mode (sonnet): full operations including SET_UPDATE
142
+ sections.push(`# instructions
143
+
144
+ ## operations
145
+
146
+ 1. **SET_CREATE** - create new rule in target
147
+ - use for: new rules, rules on different topics than existing target rules
148
+ - requires: path, operation, syncPath
149
+
150
+ 2. **SET_UPDATE** - merge proposal with existing target rule
151
+ - use when: proposal covers the SAME topic as an existing target rule (e.g., both about arrow functions)
152
+ - requires: path, operation, targetPath, syncPath (ALL FOUR FIELDS ARE MANDATORY)
153
+ - **targetPath is REQUIRED** - must be the EXACT path from the numbered target rules list above
154
+ - example: if updating rule [1] from target list, set targetPath = "practices/rule.require.arrow-functions.md"
155
+ - WARNING: omitting targetPath will cause the operation to FAIL
156
+
157
+ 3. **OMIT** - skip this proposal
158
+ - use for: exact duplicates (identical content)
159
+ - requires: path, operation, reason
160
+
161
+ 4. **SET_APPEND** - add supplementary material
162
+ - use for: demos, references, examples (not rules)
163
+ - requires: path, operation, syncPath
164
+
165
+ ## decision process
166
+
167
+ for each pure proposal:
168
+ 1. does proposal cover the SAME topic as a target rule? → SET_UPDATE
169
+ - MUST include targetPath copied from the "# target rules" list above
170
+ - e.g., "rule.require.arrow_functions.md" matches "[1] practices/rule.require.arrow-functions.md" → targetPath = "practices/rule.require.arrow-functions.md"
171
+ 2. is it an exact duplicate (identical content)? → OMIT
172
+ 3. is it supplementary material? → SET_APPEND
173
+ 4. otherwise → SET_CREATE
174
+
175
+ ## output
176
+
177
+ use the Write tool to write manifest to: ${input.draftDir}/manifest.json
178
+
179
+ example:
180
+ \`\`\`json
181
+ {
182
+ "timestamp": "2025-01-01T00:00:00.000Z",
183
+ "pureRules": [
184
+ {
185
+ "path": "rule.forbid.example.md",
186
+ "operation": "SET_CREATE",
187
+ "syncPath": "practices/code.prod/rule.forbid.example.md"
188
+ },
189
+ {
190
+ "path": "rule.require.arrow-functions.md",
191
+ "operation": "SET_UPDATE",
192
+ "targetPath": "practices/rule.require.arrow-functions.md",
193
+ "syncPath": "practices/rule.require.arrow-functions.md"
194
+ }
195
+ ]
196
+ }
197
+ \`\`\`
198
+
199
+ after writing, respond with: \`{ "written": true }\`
200
+ `);
201
+ }
202
+ const prompt = sections.join('\n');
203
+ // estimate tokens (rough: 4 chars per token)
204
+ const tokenEstimate = Math.ceil(prompt.length / 4);
205
+ return { prompt, tokenEstimate };
206
+ };
207
+ exports.compileReflectStep2Prompt = compileReflectStep2Prompt;
208
+ //# sourceMappingURL=compileReflectStep2Prompt.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"compileReflectStep2Prompt.js","sourceRoot":"","sources":["../../../../src/domain.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,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2CAmCyB,KAAK,CAAC,QAAQ;;;;;;;;;;;;;;;;;;;;;;;CAuBxD,CAAC,CAAC;IACD,CAAC;IAED,MAAM,MAAM,GAAG,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAEnC,6CAA6C;IAC7C,MAAM,aAAa,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;IAEnD,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,CAAC;AACnC,CAAC,CAAC;AA9LW,QAAA,yBAAyB,6BA8LpC"}
@@ -0,0 +1,17 @@
1
+ import type { ReviewerReflectManifest } from '../../../domain.objects/Reviewer/ReviewerReflectManifest';
2
+ /**
3
+ * .what = executes manifest operations to create sync directory
4
+ * .why = applies blend plan from brain to create final output
5
+ */
6
+ export declare const executeManifestOperations: (input: {
7
+ manifest: ReviewerReflectManifest;
8
+ pureDir: string;
9
+ syncDir: string;
10
+ targetDir: string;
11
+ log: Pick<Console, 'log'>;
12
+ }) => Promise<{
13
+ created: number;
14
+ updated: number;
15
+ appended: number;
16
+ omitted: number;
17
+ }>;
@@ -0,0 +1,189 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ Object.defineProperty(exports, "__esModule", { value: true });
26
+ exports.executeManifestOperations = void 0;
27
+ const fs = __importStar(require("fs/promises"));
28
+ const helpful_errors_1 = require("helpful-errors");
29
+ const path = __importStar(require("path"));
30
+ const ReviewerReflectManifestOperation_1 = require("../../../domain.objects/Reviewer/ReviewerReflectManifestOperation");
31
+ const enumFilesFromGlob_1 = require("../../review/enumFilesFromGlob");
32
+ /**
33
+ * .what = extracts rule name from a file path
34
+ * .why = enables matching rules by name across different directory structures
35
+ *
36
+ * .note = handles paths like "practices/rule.require.arrow-functions.md" and
37
+ * normalizes underscores to hyphens for fuzzy matching
38
+ */
39
+ const extractRuleName = (filePath) => {
40
+ const basename = path.basename(filePath);
41
+ // normalize underscores to hyphens for matching
42
+ return basename.replace(/_/g, '-').toLowerCase();
43
+ };
44
+ /**
45
+ * .what = infers missing targetPath for SET_UPDATE operations
46
+ * .why = models may identify matching rules but omit the targetPath field
47
+ *
48
+ * .note = matches by normalized rule name (ignoring underscores vs hyphens)
49
+ */
50
+ const inferMissingTargetPaths = async (entries, targetDir) => {
51
+ // get all target rules (excluding .draft directory)
52
+ const allTargetRules = await (0, enumFilesFromGlob_1.enumFilesFromGlob)({
53
+ glob: ['**/rule.*.md'],
54
+ cwd: targetDir,
55
+ });
56
+ const targetRules = allTargetRules.filter((f) => !f.startsWith('.draft/'));
57
+ // create normalized lookup map
58
+ const targetRulesByName = new Map();
59
+ for (const rule of targetRules) {
60
+ const normalized = extractRuleName(rule);
61
+ targetRulesByName.set(normalized, rule);
62
+ }
63
+ return entries.map((entry) => {
64
+ // only infer for SET_UPDATE with missing targetPath
65
+ if (entry.operation !== ReviewerReflectManifestOperation_1.ReviewerReflectManifestOperation.SET_UPDATE ||
66
+ entry.targetPath) {
67
+ return entry;
68
+ }
69
+ // try to find a matching target rule by normalized name
70
+ const pureName = extractRuleName(entry.path);
71
+ const matchedTarget = targetRulesByName.get(pureName);
72
+ if (matchedTarget) {
73
+ return { ...entry, targetPath: matchedTarget };
74
+ }
75
+ return entry;
76
+ });
77
+ };
78
+ /**
79
+ * .what = validates manifest entries have required fields per operation type
80
+ * .why = fail-fast on malformed model output before executing operations
81
+ */
82
+ const validateManifestEntries = (entries) => {
83
+ const errors = [];
84
+ for (const entry of entries) {
85
+ switch (entry.operation) {
86
+ case ReviewerReflectManifestOperation_1.ReviewerReflectManifestOperation.OMIT:
87
+ if (!entry.reason)
88
+ errors.push(`OMIT entry missing 'reason': ${entry.path}`);
89
+ break;
90
+ case ReviewerReflectManifestOperation_1.ReviewerReflectManifestOperation.SET_CREATE:
91
+ if (!entry.syncPath)
92
+ errors.push(`SET_CREATE entry missing 'syncPath': ${entry.path}`);
93
+ break;
94
+ case ReviewerReflectManifestOperation_1.ReviewerReflectManifestOperation.SET_UPDATE:
95
+ if (!entry.targetPath)
96
+ errors.push(`SET_UPDATE entry missing 'targetPath': ${entry.path}`);
97
+ if (!entry.syncPath)
98
+ errors.push(`SET_UPDATE entry missing 'syncPath': ${entry.path}`);
99
+ break;
100
+ case ReviewerReflectManifestOperation_1.ReviewerReflectManifestOperation.SET_APPEND:
101
+ if (!entry.syncPath)
102
+ errors.push(`SET_APPEND entry missing 'syncPath': ${entry.path}`);
103
+ break;
104
+ }
105
+ }
106
+ if (errors.length > 0)
107
+ throw new helpful_errors_1.UnexpectedCodePathError('manifest entries have missing required fields', { errors });
108
+ };
109
+ /**
110
+ * .what = executes manifest operations to create sync directory
111
+ * .why = applies blend plan from brain to create final output
112
+ */
113
+ const executeManifestOperations = async (input) => {
114
+ // infer missing targetPath for SET_UPDATE operations before validation
115
+ const entriesWithInferredPaths = await inferMissingTargetPaths(input.manifest.pureRules, input.targetDir);
116
+ // validate all entries upfront - fail fast on malformed model output
117
+ validateManifestEntries(entriesWithInferredPaths);
118
+ let created = 0;
119
+ let updated = 0;
120
+ let appended = 0;
121
+ let omitted = 0;
122
+ for (const entry of entriesWithInferredPaths) {
123
+ const purePath = path.join(input.pureDir, entry.path);
124
+ switch (entry.operation) {
125
+ case ReviewerReflectManifestOperation_1.ReviewerReflectManifestOperation.OMIT: {
126
+ input.log.log(` └─ OMIT: ${entry.path} (${entry.reason})`);
127
+ omitted++;
128
+ break;
129
+ }
130
+ case ReviewerReflectManifestOperation_1.ReviewerReflectManifestOperation.SET_CREATE: {
131
+ // copy pure rule to sync with adapted path
132
+ const syncPath = path.join(input.syncDir, entry.syncPath);
133
+ await fs.mkdir(path.dirname(syncPath), { recursive: true });
134
+ await fs.copyFile(purePath, syncPath);
135
+ input.log.log(` └─ CREATE: ${entry.syncPath}`);
136
+ created++;
137
+ break;
138
+ }
139
+ case ReviewerReflectManifestOperation_1.ReviewerReflectManifestOperation.SET_UPDATE: {
140
+ // merge pure rule with target rule
141
+ const targetRulePath = path.join(input.targetDir, entry.targetPath);
142
+ const syncPath = path.join(input.syncDir, entry.syncPath);
143
+ // read both files
144
+ const pureContent = await fs.readFile(purePath, 'utf-8');
145
+ const targetContent = await fs.readFile(targetRulePath, 'utf-8');
146
+ // merge: append pure content to target content
147
+ const mergedContent = mergeRuleContent({
148
+ target: targetContent,
149
+ pure: pureContent,
150
+ });
151
+ await fs.mkdir(path.dirname(syncPath), { recursive: true });
152
+ await fs.writeFile(syncPath, mergedContent, 'utf-8');
153
+ input.log.log(` └─ UPDATE: ${entry.syncPath}`);
154
+ updated++;
155
+ break;
156
+ }
157
+ case ReviewerReflectManifestOperation_1.ReviewerReflectManifestOperation.SET_APPEND: {
158
+ // add as support document next to existing rule
159
+ const syncPath = path.join(input.syncDir, entry.syncPath);
160
+ await fs.mkdir(path.dirname(syncPath), { recursive: true });
161
+ await fs.copyFile(purePath, syncPath);
162
+ input.log.log(` └─ APPEND: ${entry.syncPath}`);
163
+ appended++;
164
+ break;
165
+ }
166
+ }
167
+ }
168
+ return { created, updated, appended, omitted };
169
+ };
170
+ exports.executeManifestOperations = executeManifestOperations;
171
+ /**
172
+ * .what = merges pure rule content into target rule
173
+ * .why = combines insights without losing target content
174
+ */
175
+ const mergeRuleContent = (input) => {
176
+ // find the # deets section in target
177
+ const deetsMatch = input.target.match(/(^|\n)# deets/);
178
+ if (deetsMatch) {
179
+ // extract new citations from pure rule
180
+ const citationsMatch = input.pure.match(/## \.citations[\s\S]*?(?=\n## |$)/);
181
+ if (citationsMatch) {
182
+ // append new citations to target deets section
183
+ return input.target.trimEnd() + '\n\n' + citationsMatch[0].trim() + '\n';
184
+ }
185
+ }
186
+ // fallback: append entire pure content
187
+ return (input.target.trimEnd() + '\n\n---\n\n# additional insights\n\n' + input.pure);
188
+ };
189
+ //# sourceMappingURL=executeManifestOperations.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"executeManifestOperations.js","sourceRoot":"","sources":["../../../../src/domain.operations/reflect/step2/executeManifestOperations.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,gDAAkC;AAClC,mDAAyD;AACzD,2CAA6B;AAM7B,oHAAiH;AAEjH,sEAAmE;AAEnE;;;;;;GAMG;AACH,MAAM,eAAe,GAAG,CAAC,QAAgB,EAAU,EAAE;IACnD,MAAM,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;IACzC,gDAAgD;IAChD,OAAO,QAAQ,CAAC,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC,WAAW,EAAE,CAAC;AACnD,CAAC,CAAC;AAEF;;;;;GAKG;AACH,MAAM,uBAAuB,GAAG,KAAK,EACnC,OAAuC,EACvC,SAAiB,EACwB,EAAE;IAC3C,oDAAoD;IACpD,MAAM,cAAc,GAAG,MAAM,IAAA,qCAAiB,EAAC;QAC7C,IAAI,EAAE,CAAC,cAAc,CAAC;QACtB,GAAG,EAAE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C;AAEF;;;GAGG;AACH,MAAM,gBAAgB,GAAG,CAAC,KAAuC,EAAU,EAAE;IAC3E,qCAAqC;IACrC,MAAM,UAAU,GAAG,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,eAAe,CAAC,CAAC;IAEvD,IAAI,UAAU,EAAE,CAAC;QACf,uCAAuC;QACvC,MAAM,cAAc,GAAG,KAAK,CAAC,IAAI,CAAC,KAAK,CACrC,mCAAmC,CACpC,CAAC;QACF,IAAI,cAAc,EAAE,CAAC;YACnB,+CAA+C;YAC/C,OAAO,KAAK,CAAC,MAAM,CAAC,OAAO,EAAE,GAAG,MAAM,GAAG,cAAc,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,GAAG,IAAI,CAAC;QAC3E,CAAC;IACH,CAAC;IAED,uCAAuC;IACvC,OAAO,CACL,KAAK,CAAC,MAAM,CAAC,OAAO,EAAE,GAAG,sCAAsC,GAAG,KAAK,CAAC,IAAI,CAC7E,CAAC;AACJ,CAAC,CAAC"}
@@ -0,0 +1,8 @@
1
+ import { ReviewerReflectManifest } from '../../../domain.objects/Reviewer/ReviewerReflectManifest';
2
+ /**
3
+ * .what = parses manifest.json content to ReflectManifest
4
+ * .why = validates and types manifest from brain output
5
+ */
6
+ export declare const parseManifestOperations: (input: {
7
+ content: string;
8
+ }) => ReviewerReflectManifest;
@@ -0,0 +1,73 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.parseManifestOperations = void 0;
4
+ const helpful_errors_1 = require("helpful-errors");
5
+ const ReviewerReflectManifest_1 = require("../../../domain.objects/Reviewer/ReviewerReflectManifest");
6
+ const ReviewerReflectManifestOperation_1 = require("../../../domain.objects/Reviewer/ReviewerReflectManifestOperation");
7
+ /**
8
+ * .what = parses manifest.json content to ReflectManifest
9
+ * .why = validates and types manifest from brain output
10
+ */
11
+ const parseManifestOperations = (input) => {
12
+ // parse JSON
13
+ let parsed;
14
+ try {
15
+ parsed = JSON.parse(input.content);
16
+ }
17
+ catch (error) {
18
+ throw new helpful_errors_1.BadRequestError('manifest.json is not valid JSON', {
19
+ error: error instanceof Error ? error.message : String(error),
20
+ });
21
+ }
22
+ // validate structure
23
+ if (!parsed || typeof parsed !== 'object')
24
+ throw new helpful_errors_1.BadRequestError('manifest.json must be an object');
25
+ const manifest = parsed;
26
+ // validate timestamp
27
+ if (typeof manifest.timestamp !== 'string')
28
+ throw new helpful_errors_1.BadRequestError('manifest.json must have timestamp string');
29
+ // validate pureRules array
30
+ if (!Array.isArray(manifest.pureRules))
31
+ throw new helpful_errors_1.BadRequestError('manifest.json must have pureRules array');
32
+ // validate each entry
33
+ const pureRules = manifest.pureRules.map((entry, index) => {
34
+ if (!entry || typeof entry !== 'object')
35
+ throw new helpful_errors_1.BadRequestError(`pureRules[${index}] must be an object`);
36
+ const e = entry;
37
+ // validate path
38
+ if (typeof e.path !== 'string')
39
+ throw new helpful_errors_1.BadRequestError(`pureRules[${index}].path must be a string`);
40
+ // validate operation
41
+ if (!isValidOperation(e.operation))
42
+ throw new helpful_errors_1.BadRequestError(`pureRules[${index}].operation must be OMIT, SET_CREATE, SET_UPDATE, or SET_APPEND`, { operation: e.operation });
43
+ // validate syncPath for non-OMIT operations
44
+ if (e.operation !== 'OMIT' && typeof e.syncPath !== 'string')
45
+ throw new helpful_errors_1.BadRequestError(`pureRules[${index}].syncPath required for ${e.operation} operation`);
46
+ // validate reason for OMIT
47
+ if (e.operation === 'OMIT' && typeof e.reason !== 'string')
48
+ throw new helpful_errors_1.BadRequestError(`pureRules[${index}].reason required for OMIT operation`);
49
+ return {
50
+ path: e.path,
51
+ operation: e.operation,
52
+ syncPath: e.syncPath,
53
+ targetPath: e.targetPath,
54
+ reason: e.reason,
55
+ };
56
+ });
57
+ return new ReviewerReflectManifest_1.ReviewerReflectManifest({
58
+ timestamp: manifest.timestamp,
59
+ pureRules,
60
+ });
61
+ };
62
+ exports.parseManifestOperations = parseManifestOperations;
63
+ /**
64
+ * .what = validates operation is a known ManifestOperation
65
+ * .why = ensures type safety for manifest entries
66
+ */
67
+ const isValidOperation = (operation) => {
68
+ return (operation === ReviewerReflectManifestOperation_1.ReviewerReflectManifestOperation.OMIT ||
69
+ operation === ReviewerReflectManifestOperation_1.ReviewerReflectManifestOperation.SET_CREATE ||
70
+ operation === ReviewerReflectManifestOperation_1.ReviewerReflectManifestOperation.SET_UPDATE ||
71
+ operation === ReviewerReflectManifestOperation_1.ReviewerReflectManifestOperation.SET_APPEND);
72
+ };
73
+ //# sourceMappingURL=parseManifestOperations.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parseManifestOperations.js","sourceRoot":"","sources":["../../../../src/domain.operations/reflect/step2/parseManifestOperations.ts"],"names":[],"mappings":";;;AAAA,mDAAiD;AAEjD,kGAG8D;AAC9D,oHAAiH;AAEjH;;;GAGG;AACI,MAAM,uBAAuB,GAAG,CAAC,KAEvC,EAA2B,EAAE;IAC5B,aAAa;IACb,IAAI,MAAe,CAAC;IACpB,IAAI,CAAC;QACH,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IACrC,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,IAAI,gCAAe,CAAC,iCAAiC,EAAE;YAC3D,KAAK,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC;SAC9D,CAAC,CAAC;IACL,CAAC;IAED,qBAAqB;IACrB,IAAI,CAAC,MAAM,IAAI,OAAO,MAAM,KAAK,QAAQ;QACvC,MAAM,IAAI,gCAAe,CAAC,iCAAiC,CAAC,CAAC;IAE/D,MAAM,QAAQ,GAAG,MAAiC,CAAC;IAEnD,qBAAqB;IACrB,IAAI,OAAO,QAAQ,CAAC,SAAS,KAAK,QAAQ;QACxC,MAAM,IAAI,gCAAe,CAAC,0CAA0C,CAAC,CAAC;IAExE,2BAA2B;IAC3B,IAAI,CA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CAAC,CAAC,MAA4B;SACvC,CAAC;IACJ,CAAC,CACF,CAAC;IAEF,OAAO,IAAI,iDAAuB,CAAC;QACjC,SAAS,EAAE,QAAQ,CAAC,SAAmB;QACvC,SAAS;KACV,CAAC,CAAC;AACL,CAAC,CAAC;AAxEW,QAAA,uBAAuB,2BAwElC;AAEF;;;GAGG;AACH,MAAM,gBAAgB,GAAG,CAAC,SAAkB,EAAW,EAAE;IACvD,OAAO,CACL,SAAS,KAAK,mEAAgC,CAAC,IAAI;QACnD,SAAS,KAAK,mEAAgC,CAAC,UAAU;QACzD,SAAS,KAAK,mEAAgC,CAAC,UAAU;QACzD,SAAS,KAAK,mEAAgC,CAAC,UAAU,CAC1D,CAAC;AACJ,CAAC,CAAC"}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * .what = validates source directory exists and contains feedback files
3
+ * .why = fail fast on invalid source before expensive operations
4
+ */
5
+ export declare const validateSourceDirectory: (input: {
6
+ source: string;
7
+ }) => Promise<{
8
+ feedbackFiles: string[];
9
+ }>;
@@ -0,0 +1,63 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ Object.defineProperty(exports, "__esModule", { value: true });
26
+ exports.validateSourceDirectory = void 0;
27
+ const fs = __importStar(require("fs/promises"));
28
+ const helpful_errors_1 = require("helpful-errors");
29
+ const enumFeedbackFiles_1 = require("../../domain.operations/reflect/enumFeedbackFiles");
30
+ /**
31
+ * .what = validates source directory exists and contains feedback files
32
+ * .why = fail fast on invalid source before expensive operations
33
+ */
34
+ const validateSourceDirectory = async (input) => {
35
+ // validate directory exists
36
+ try {
37
+ const stat = await fs.stat(input.source);
38
+ if (!stat.isDirectory())
39
+ throw new helpful_errors_1.BadRequestError('source path is not a directory', {
40
+ source: input.source,
41
+ });
42
+ }
43
+ catch (error) {
44
+ if (error instanceof helpful_errors_1.BadRequestError)
45
+ throw error;
46
+ throw new helpful_errors_1.BadRequestError('source directory does not exist', {
47
+ source: input.source,
48
+ });
49
+ }
50
+ // enumerate feedback files
51
+ const feedbackFiles = await (0, enumFeedbackFiles_1.enumFeedbackFiles)({
52
+ directory: input.source,
53
+ });
54
+ // validate at least one feedback file found
55
+ if (feedbackFiles.length === 0)
56
+ throw new helpful_errors_1.BadRequestError('source directory contains no feedback files matching [feedback].*.[given]* pattern', {
57
+ source: input.source,
58
+ hint: 'feedback files must match pattern: [feedback].*.[given]*.md',
59
+ });
60
+ return { feedbackFiles };
61
+ };
62
+ exports.validateSourceDirectory = validateSourceDirectory;
63
+ //# sourceMappingURL=validateSourceDirectory.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validateSourceDirectory.js","sourceRoot":"","sources":["../../../src/domain.operations/reflect/validateSourceDirectory.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,gDAAkC;AAClC,mDAAiD;AAEjD,wFAAqF;AAErF;;;GAGG;AACI,MAAM,uBAAuB,GAAG,KAAK,EAAE,KAE7C,EAEE,EAAE;IACH,4BAA4B;IAC5B,IAAI,CAAC;QACH,MAAM,IAAI,GAAG,MAAM,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;QACzC,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE;YACrB,MAAM,IAAI,gCAAe,CAAC,gCAAgC,EAAE;gBAC1D,MAAM,EAAE,KAAK,CAAC,MAAM;aACrB,CAAC,CAAC;IACP,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,IAAI,KAAK,YAAY,gCAAe;YAAE,MAAM,KAAK,CAAC;QAClD,MAAM,IAAI,gCAAe,CAAC,iCAAiC,EAAE;YAC3D,MAAM,EAAE,KAAK,CAAC,MAAM;SACrB,CAAC,CAAC;IACL,CAAC;IAED,2BAA2B;IAC3B,MAAM,aAAa,GAAG,MAAM,IAAA,qCAAiB,EAAC;QAC5C,SAAS,EAAE,KAAK,CAAC,MAAM;KACxB,CAAC,CAAC;IAEH,4CAA4C;IAC5C,IAAI,aAAa,CAAC,MAAM,KAAK,CAAC;QAC5B,MAAM,IAAI,gCAAe,CACvB,oFAAoF,EACpF;YACE,MAAM,EAAE,KAAK,CAAC,MAAM;YACpB,IAAI,EAAE,6DAA6D;SACpE,CACF,CAAC;IAEJ,OAAO,EAAE,aAAa,EAAE,CAAC;AAC3B,CAAC,CAAC;AAnCW,QAAA,uBAAuB,2BAmClC"}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * .what = validates target directory exists or creates with --force
3
+ * .why = fail fast on invalid target before expensive operations
4
+ */
5
+ export declare const validateTargetDirectory: (input: {
6
+ target: string;
7
+ force?: boolean;
8
+ }) => Promise<{
9
+ created: boolean;
10
+ }>;