bemadralphy 0.1.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 (207) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +468 -0
  3. package/dist/beads/adapter.d.ts +5 -0
  4. package/dist/beads/adapter.js +16 -0
  5. package/dist/beads/adapter.js.map +1 -0
  6. package/dist/beads/index.d.ts +3 -0
  7. package/dist/beads/index.js +4 -0
  8. package/dist/beads/index.js.map +1 -0
  9. package/dist/beads/parse-tasks.d.ts +2 -0
  10. package/dist/beads/parse-tasks.js +12 -0
  11. package/dist/beads/parse-tasks.js.map +1 -0
  12. package/dist/beads/tasks-md.d.ts +6 -0
  13. package/dist/beads/tasks-md.js +8 -0
  14. package/dist/beads/tasks-md.js.map +1 -0
  15. package/dist/beads/writer.d.ts +12 -0
  16. package/dist/beads/writer.js +60 -0
  17. package/dist/beads/writer.js.map +1 -0
  18. package/dist/cli.d.ts +2 -0
  19. package/dist/cli.js +43 -0
  20. package/dist/cli.js.map +1 -0
  21. package/dist/cost.d.ts +6 -0
  22. package/dist/cost.js +18 -0
  23. package/dist/cost.js.map +1 -0
  24. package/dist/docs/pr-body.d.ts +8 -0
  25. package/dist/docs/pr-body.js +11 -0
  26. package/dist/docs/pr-body.js.map +1 -0
  27. package/dist/engines/claude.d.ts +1 -0
  28. package/dist/engines/claude.js +11 -0
  29. package/dist/engines/claude.js.map +1 -0
  30. package/dist/engines/cli-adapter.d.ts +12 -0
  31. package/dist/engines/cli-adapter.js +36 -0
  32. package/dist/engines/cli-adapter.js.map +1 -0
  33. package/dist/engines/cli.d.ts +14 -0
  34. package/dist/engines/cli.js +72 -0
  35. package/dist/engines/cli.js.map +1 -0
  36. package/dist/engines/codex.d.ts +1 -0
  37. package/dist/engines/codex.js +10 -0
  38. package/dist/engines/codex.js.map +1 -0
  39. package/dist/engines/copilot.d.ts +1 -0
  40. package/dist/engines/copilot.js +10 -0
  41. package/dist/engines/copilot.js.map +1 -0
  42. package/dist/engines/cursor.d.ts +1 -0
  43. package/dist/engines/cursor.js +10 -0
  44. package/dist/engines/cursor.js.map +1 -0
  45. package/dist/engines/gemini.d.ts +1 -0
  46. package/dist/engines/gemini.js +10 -0
  47. package/dist/engines/gemini.js.map +1 -0
  48. package/dist/engines/index.d.ts +2 -0
  49. package/dist/engines/index.js +21 -0
  50. package/dist/engines/index.js.map +1 -0
  51. package/dist/engines/kimi.d.ts +1 -0
  52. package/dist/engines/kimi.js +10 -0
  53. package/dist/engines/kimi.js.map +1 -0
  54. package/dist/engines/opencode.d.ts +1 -0
  55. package/dist/engines/opencode.js +10 -0
  56. package/dist/engines/opencode.js.map +1 -0
  57. package/dist/engines/prompt-template.d.ts +2 -0
  58. package/dist/engines/prompt-template.js +96 -0
  59. package/dist/engines/prompt-template.js.map +1 -0
  60. package/dist/engines/qwen.d.ts +1 -0
  61. package/dist/engines/qwen.js +10 -0
  62. package/dist/engines/qwen.js.map +1 -0
  63. package/dist/engines/ralphy.d.ts +1 -0
  64. package/dist/engines/ralphy.js +10 -0
  65. package/dist/engines/ralphy.js.map +1 -0
  66. package/dist/engines/stub.d.ts +2 -0
  67. package/dist/engines/stub.js +17 -0
  68. package/dist/engines/stub.js.map +1 -0
  69. package/dist/engines/types.d.ts +21 -0
  70. package/dist/engines/types.js +2 -0
  71. package/dist/engines/types.js.map +1 -0
  72. package/dist/errors.d.ts +12 -0
  73. package/dist/errors.js +13 -0
  74. package/dist/errors.js.map +1 -0
  75. package/dist/git/worktrees.d.ts +11 -0
  76. package/dist/git/worktrees.js +63 -0
  77. package/dist/git/worktrees.js.map +1 -0
  78. package/dist/index.d.ts +2 -0
  79. package/dist/index.js +2 -0
  80. package/dist/index.js.map +1 -0
  81. package/dist/locks.d.ts +10 -0
  82. package/dist/locks.js +23 -0
  83. package/dist/locks.js.map +1 -0
  84. package/dist/orchestrator.d.ts +17 -0
  85. package/dist/orchestrator.js +99 -0
  86. package/dist/orchestrator.js.map +1 -0
  87. package/dist/permissions.d.ts +5 -0
  88. package/dist/permissions.js +19 -0
  89. package/dist/permissions.js.map +1 -0
  90. package/dist/phases/execute.d.ts +2 -0
  91. package/dist/phases/execute.js +78 -0
  92. package/dist/phases/execute.js.map +1 -0
  93. package/dist/phases/explore.d.ts +1 -0
  94. package/dist/phases/explore.js +5 -0
  95. package/dist/phases/explore.js.map +1 -0
  96. package/dist/phases/index.d.ts +10 -0
  97. package/dist/phases/index.js +10 -0
  98. package/dist/phases/index.js.map +1 -0
  99. package/dist/phases/intake.d.ts +2 -0
  100. package/dist/phases/intake.js +67 -0
  101. package/dist/phases/intake.js.map +1 -0
  102. package/dist/phases/planning.d.ts +2 -0
  103. package/dist/phases/planning.js +8 -0
  104. package/dist/phases/planning.js.map +1 -0
  105. package/dist/phases/post.d.ts +2 -0
  106. package/dist/phases/post.js +21 -0
  107. package/dist/phases/post.js.map +1 -0
  108. package/dist/phases/scaffold.d.ts +2 -0
  109. package/dist/phases/scaffold.js +6 -0
  110. package/dist/phases/scaffold.js.map +1 -0
  111. package/dist/phases/steering.d.ts +2 -0
  112. package/dist/phases/steering.js +10 -0
  113. package/dist/phases/steering.js.map +1 -0
  114. package/dist/phases/sync.d.ts +2 -0
  115. package/dist/phases/sync.js +25 -0
  116. package/dist/phases/sync.js.map +1 -0
  117. package/dist/phases/types.d.ts +22 -0
  118. package/dist/phases/types.js +2 -0
  119. package/dist/phases/types.js.map +1 -0
  120. package/dist/phases/verify.d.ts +2 -0
  121. package/dist/phases/verify.js +8 -0
  122. package/dist/phases/verify.js.map +1 -0
  123. package/dist/planning/bmad.d.ts +3 -0
  124. package/dist/planning/bmad.js +20 -0
  125. package/dist/planning/bmad.js.map +1 -0
  126. package/dist/planning/index.d.ts +2 -0
  127. package/dist/planning/index.js +37 -0
  128. package/dist/planning/index.js.map +1 -0
  129. package/dist/planning/validate.d.ts +7 -0
  130. package/dist/planning/validate.js +20 -0
  131. package/dist/planning/validate.js.map +1 -0
  132. package/dist/pr/create.d.ts +2 -0
  133. package/dist/pr/create.js +65 -0
  134. package/dist/pr/create.js.map +1 -0
  135. package/dist/quality/gates.d.ts +12 -0
  136. package/dist/quality/gates.js +54 -0
  137. package/dist/quality/gates.js.map +1 -0
  138. package/dist/release.d.ts +3 -0
  139. package/dist/release.js +88 -0
  140. package/dist/release.js.map +1 -0
  141. package/dist/specs/archive.d.ts +1 -0
  142. package/dist/specs/archive.js +12 -0
  143. package/dist/specs/archive.js.map +1 -0
  144. package/dist/specs/changes.d.ts +7 -0
  145. package/dist/specs/changes.js +20 -0
  146. package/dist/specs/changes.js.map +1 -0
  147. package/dist/specs/delta.d.ts +1 -0
  148. package/dist/specs/delta.js +8 -0
  149. package/dist/specs/delta.js.map +1 -0
  150. package/dist/specs/generate.d.ts +1 -0
  151. package/dist/specs/generate.js +8 -0
  152. package/dist/specs/generate.js.map +1 -0
  153. package/dist/specs/index.d.ts +3 -0
  154. package/dist/specs/index.js +4 -0
  155. package/dist/specs/index.js.map +1 -0
  156. package/dist/specs/merge-summary.d.ts +2 -0
  157. package/dist/specs/merge-summary.js +19 -0
  158. package/dist/specs/merge-summary.js.map +1 -0
  159. package/dist/state.d.ts +12 -0
  160. package/dist/state.js +20 -0
  161. package/dist/state.js.map +1 -0
  162. package/dist/steering/index.d.ts +2 -0
  163. package/dist/steering/index.js +115 -0
  164. package/dist/steering/index.js.map +1 -0
  165. package/dist/swarm/claude-teams.d.ts +1 -0
  166. package/dist/swarm/claude-teams.js +8 -0
  167. package/dist/swarm/claude-teams.js.map +1 -0
  168. package/dist/swarm/codex-sdk.d.ts +1 -0
  169. package/dist/swarm/codex-sdk.js +8 -0
  170. package/dist/swarm/codex-sdk.js.map +1 -0
  171. package/dist/swarm/detector.d.ts +3 -0
  172. package/dist/swarm/detector.js +16 -0
  173. package/dist/swarm/detector.js.map +1 -0
  174. package/dist/swarm/index.d.ts +5 -0
  175. package/dist/swarm/index.js +5 -0
  176. package/dist/swarm/index.js.map +1 -0
  177. package/dist/swarm/kimi-parl.d.ts +1 -0
  178. package/dist/swarm/kimi-parl.js +8 -0
  179. package/dist/swarm/kimi-parl.js.map +1 -0
  180. package/dist/swarm/native.d.ts +14 -0
  181. package/dist/swarm/native.js +112 -0
  182. package/dist/swarm/native.js.map +1 -0
  183. package/dist/swarm/parse.d.ts +5 -0
  184. package/dist/swarm/parse.js +20 -0
  185. package/dist/swarm/parse.js.map +1 -0
  186. package/dist/swarm/types.d.ts +5 -0
  187. package/dist/swarm/types.js +2 -0
  188. package/dist/swarm/types.js.map +1 -0
  189. package/dist/tasks/output.d.ts +7 -0
  190. package/dist/tasks/output.js +15 -0
  191. package/dist/tasks/output.js.map +1 -0
  192. package/dist/utils/exec.d.ts +18 -0
  193. package/dist/utils/exec.js +52 -0
  194. package/dist/utils/exec.js.map +1 -0
  195. package/dist/utils/failures.d.ts +2 -0
  196. package/dist/utils/failures.js +22 -0
  197. package/dist/utils/failures.js.map +1 -0
  198. package/dist/utils/logging.d.ts +1 -0
  199. package/dist/utils/logging.js +5 -0
  200. package/dist/utils/logging.js.map +1 -0
  201. package/dist/utils/resume.d.ts +1 -0
  202. package/dist/utils/resume.js +14 -0
  203. package/dist/utils/resume.js.map +1 -0
  204. package/dist/utils/retry.d.ts +1 -0
  205. package/dist/utils/retry.js +19 -0
  206. package/dist/utils/retry.js.map +1 -0
  207. package/package.json +81 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 hxp-pxh
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,468 @@
1
+ # BeMadRalphy
2
+
3
+ **Be**(ads) + (B)**Mad** + **Ralphy** + [OpenSpec](https://github.com/Fission-AI/OpenSpec) — four tools, one pipeline, zero gaps. **CLI-only.**
4
+
5
+ > End-to-end automated coding: idea in → planning → task graph → swarm-aware execution → living specs → deployment.
6
+
7
+ [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE)
8
+
9
+ ## Status
10
+
11
+ BeMadRalphy runs end-to-end locally with real external CLI integrations.
12
+
13
+ Current implementation includes:
14
+
15
+ - `idea.md`/`plan.md` intake with `.bemadralphy/intake.yaml` output
16
+ - BMAD bootstrap (`bmad install`) and generated planning artifacts under `_bmad-output/`
17
+ - Steering file generation (AGENTS.md, CLAUDE.md, Cursor/Windsurf/Cline/Kiro rules)
18
+ - `tasks.md` generation plus Beads sync (`bd init`, `bd create`, `bd ready`, `bd close`, `bd update`)
19
+ - Per-phase state persistence in `.bemadralphy/state.yaml`
20
+ - Engine execution through explicit CLI contracts for all supported engines
21
+ - OpenSpec lifecycle integration (`openspec init`, `openspec validate`, `openspec archive`)
22
+
23
+ ---
24
+
25
+ ## Start Here
26
+
27
+ - First local run guide: [`docs/getting-started.md`](docs/getting-started.md)
28
+ - Contributor/developer setup: [`docs/onboarding.md`](docs/onboarding.md)
29
+ - Architecture and flow details: [`docs/architecture.md`](docs/architecture.md)
30
+
31
+ ---
32
+
33
+ ## What is BeMadRalphy?
34
+
35
+ BeMadRalphy is a CLI orchestrator that merges:
36
+
37
+ - **[BMAD-METHOD](https://github.com/bmad-code-org/BMAD-METHOD)** — Agile AI-driven planning (product briefs, PRDs, architecture, epics & stories)
38
+ - **[Beads](https://github.com/steveyegge/beads)** — Git-backed graph issue tracker and persistent AI memory
39
+ - **[Ralphy](https://github.com/michaelshimeles/ralphy)** — Autonomous AI coding loop with multi-engine support ([site](https://ralphy.goshen.fyi/))
40
+ - **[OpenSpec](https://github.com/Fission-AI/OpenSpec)** — Living specifications and delta-based change tracking
41
+
42
+ Into a single, seamless pipeline that takes you from a rough idea to a deployed, documented, and tested codebase — with minimal human intervention.
43
+
44
+ ---
45
+
46
+ ## The 9-Phase Pipeline
47
+
48
+ ```mermaid
49
+ flowchart TD
50
+ subgraph explore [Phase 0: Explore]
51
+ ExploreCmd[bemadralphy explore]
52
+ ExploreReport[Exploration report]
53
+ end
54
+ subgraph intake [Phase 1: Idea Intake]
55
+ IdeaMD[idea.md]
56
+ DetectMode{Greenfield or brownfield?}
57
+ IntakeYAML[intake.yaml]
58
+ end
59
+ subgraph planning [Phase 2: Planning]
60
+ Brief[Product brief]
61
+ PRD[PRD]
62
+ Arch[Architecture]
63
+ Stories[Epics and stories]
64
+ end
65
+ subgraph steer [Phase 3: Agent Steering]
66
+ AllFiles[14+ steering files]
67
+ end
68
+ subgraph scaffold [Phase 4: Scaffolding]
69
+ GitInit[git init + monorepo]
70
+ PkgJson[package.json]
71
+ end
72
+ subgraph tasks [Phase 5: Task Sync]
73
+ Beads[(Beads graph)]
74
+ TasksMD[tasks.md]
75
+ end
76
+ subgraph exec [Phase 6: Execution]
77
+ Detect{Swarm capable?}
78
+ NativeSwarm[Native swarm]
79
+ ProcessParallel[Process parallel]
80
+ end
81
+ subgraph verify [Phase 7: Verification]
82
+ Completeness[Completeness]
83
+ Correctness[Correctness]
84
+ Coherence[Coherence]
85
+ end
86
+ subgraph post [Phase 8: Post-Execution]
87
+ CodeReview[Code review]
88
+ Docs[Documentation]
89
+ Deploy[Deployment]
90
+ end
91
+ ExploreCmd --> ExploreReport --> IdeaMD
92
+ IdeaMD --> DetectMode --> IntakeYAML
93
+ IntakeYAML --> Brief --> PRD --> Arch --> Stories
94
+ Stories --> AllFiles --> GitInit --> PkgJson
95
+ PkgJson --> Beads --> TasksMD
96
+ TasksMD --> Detect
97
+ Detect -->|yes| NativeSwarm
98
+ Detect -->|no| ProcessParallel
99
+ NativeSwarm --> Completeness
100
+ ProcessParallel --> Completeness
101
+ Completeness --> Correctness --> Coherence
102
+ Coherence --> CodeReview --> Docs --> Deploy
103
+ ```
104
+
105
+ | Phase | What happens |
106
+ | --------------------- | ---------------------------------------------------------------------------------------------------------------------- |
107
+ | **0. Explore** | Optional. Investigate codebase (brownfield) or problem domain (greenfield) before committing to a plan. |
108
+ | **1. Idea Intake** | Read `idea.md`, detect greenfield vs brownfield, classify project type, ask remaining questions, output `intake.yaml`. |
109
+ | **2. Planning** | Greenfield: product brief → PRD → architecture → stories. Brownfield: proposal → spec deltas → design → tasks. |
110
+ | **3. Agent Steering** | Generate 14+ steering files for every IDE/agent (Cursor, Claude, Copilot, Windsurf, Cline, Kiro, etc.). |
111
+ | **4. Scaffolding** | `git init`, monorepo structure, `package.json`, `.gitignore`, `.env`, test/lint/CI configs. |
112
+ | **5. Task Sync** | Convert stories to Beads issues (`bd create`, `bd dep add`). Generate `tasks.md`. Cost estimate. |
113
+ | **6. Execution** | Swarm-aware Beads-driven loop. Native swarm for Claude/Kimi/Codex; process-level parallelism for others. |
114
+ | **7. Verification** | Semantic check: completeness, correctness, coherence. Fix-up tasks fed back to Beads if needed. |
115
+ | **8. Post-Execution** | Code review, full docs suite, living specs, deployment, release management, final summary. |
116
+
117
+ ---
118
+
119
+ ## AI Engine Support
120
+
121
+ - `claude` (native swarm): `ralphy --claude --max-iterations 1 <task>`
122
+ - `kimi` (native swarm): `kimi <task>`
123
+ - `codex` (native swarm): `ralphy --codex --max-iterations 1 <task>`
124
+ - `cursor`: `ralphy --cursor --max-iterations 1 <task>`
125
+ - `opencode`: `ralphy --opencode --max-iterations 1 <task>`
126
+ - `qwen`: `ralphy --qwen --max-iterations 1 <task>`
127
+ - `copilot`: `ralphy --copilot --max-iterations 1 <task>`
128
+ - `gemini`: `gemini <task>`
129
+ - `ralphy`: `ralphy --max-iterations 1 <task>`
130
+
131
+ ---
132
+
133
+ ## Autonomy Modes
134
+
135
+ | Mode | Description |
136
+ | ------------------------------------ | ------------------------------------------------------------------------------------------------ |
137
+ | **Full Autonomous** (`--mode auto`) | Zero pauses after Q&A. Everything runs unattended. |
138
+ | **Hybrid** (`--mode hybrid`) | Planning gates only (after brief, PRD, architecture, stories). Execution is autonomous. Default. |
139
+ | **Supervised** (`--mode supervised`) | Planning gates + execution milestones (after scaffolding, each epic, before deployment). |
140
+
141
+ ---
142
+
143
+ ## CLI Commands
144
+
145
+ ```bash
146
+ # Initialize a new project
147
+ npx bemadralphy init
148
+
149
+ # Notes:
150
+ # - Creates .bemadralphy/, openspec/, and _bmad-output/
151
+ # - Initializes `bd` and `openspec`
152
+ # - Fails fast if required CLIs are missing
153
+
154
+ # Run the full pipeline
155
+ npx bemadralphy run
156
+
157
+ # Run with specific options
158
+ npx bemadralphy run --mode auto --engine claude --max-parallel 5 --budget 50
159
+
160
+ # Explore before planning (optional)
161
+ npx bemadralphy explore "How should I structure authentication?"
162
+
163
+ # Check pipeline status
164
+ npx bemadralphy status
165
+ ```
166
+
167
+ ---
168
+
169
+ ## The `idea.md` File
170
+
171
+ BeMadRalphy starts with an `idea.md` file in your project root. It can be as simple or detailed as you want. The current scaffolding writes intake results to `.bemadralphy/intake.yaml`.
172
+
173
+ ### Minimal example
174
+
175
+ ```markdown
176
+ I want to build a SaaS dashboard for tracking fitness goals.
177
+ ```
178
+
179
+ ### Detailed example with YAML front-matter
180
+
181
+ ```yaml
182
+ ---
183
+ project_type: full-stack
184
+ stack:
185
+ frontend: Next.js
186
+ backend: Hono
187
+ language: TypeScript
188
+ runtime: bun
189
+ monorepo: true
190
+ database: Postgres
191
+ auth: Clerk
192
+ tests: Vitest
193
+ deployment: Vercel
194
+ ---
195
+
196
+ A SaaS dashboard for tracking fitness goals. Users can log workouts,
197
+ track progress over time, set goals, and get AI-powered recommendations.
198
+
199
+ Key features:
200
+ - User authentication with social login
201
+ - Workout logging with exercise library
202
+ - Progress charts and analytics
203
+ - Goal setting and tracking
204
+ - AI coach for personalized recommendations
205
+ ```
206
+
207
+ BeMadRalphy extracts what you've already decided and only asks about the rest.
208
+
209
+ ---
210
+
211
+ ## Greenfield vs Brownfield
212
+
213
+ | Mode | When | What happens |
214
+ | -------------- | -------------------------- | ------------------------------------------------------------------------------------ |
215
+ | **Greenfield** | No existing codebase | Full pipeline: idea → PRD → architecture → stories → build from scratch |
216
+ | **Brownfield** | Existing codebase detected | Analyze codebase, generate proposal + spec deltas, skip scaffolding, execute changes |
217
+
218
+ Brownfield is auto-detected (looks for `package.json`, `src/`, etc.) or forced with `--brownfield`.
219
+
220
+ ---
221
+
222
+ ## Living Specs (OpenSpec-compatible)
223
+
224
+ After the initial build, BeMadRalphy generates living specifications in `openspec/specs/`:
225
+
226
+ ```text
227
+ openspec/
228
+ ├── specs/
229
+ │ ├── auth/spec.md
230
+ │ ├── workouts/spec.md
231
+ │ └── goals/spec.md
232
+ ├── changes/
233
+ │ └── archive/
234
+ ```
235
+
236
+ For subsequent brownfield changes, new requirements are expressed as **delta specs** (ADDED/MODIFIED/REMOVED) against the current specs. On completion, deltas merge into the main specs.
237
+
238
+ ---
239
+
240
+ ## Target Project Structure (after scaffolding)
241
+
242
+ ```text
243
+ your-project/
244
+ ├── .bemadralphy/ # State, cost log, failures log, intake.yaml
245
+ │ ├── state.yaml
246
+ │ ├── cost.log
247
+ │ └── failures.log
248
+ ├── .beads/ # Beads task graph
249
+ │ └── issues.jsonl
250
+ ├── _bmad/ # BMAD playbooks (read-only)
251
+ ├── _bmad-output/ # Planning artifacts
252
+ │ ├── product-brief.md
253
+ │ ├── prd.md
254
+ │ ├── architecture.md
255
+ │ └── stories/
256
+ ├── openspec/ # Living specs
257
+ │ └── specs/
258
+ ├── docs/
259
+ │ ├── adr/ # Architecture Decision Records
260
+ │ ├── onboarding.md
261
+ │ └── runbook.md
262
+ ├── src/ # Your application code
263
+ ├── tests/
264
+ ├── .github/
265
+ │ ├── workflows/
266
+ │ ├── ISSUE_TEMPLATE/
267
+ │ └── pull_request_template.md
268
+ ├── AGENTS.md # Universal agent steering
269
+ ├── CLAUDE.md # Claude-specific steering
270
+ ├── .cursorrules # Cursor-specific steering
271
+ ├── idea.md # Your original idea
272
+ ├── .bemadralphy/intake.yaml # Processed intake
273
+ ├── tasks.md # Human-readable task list
274
+ ├── package.json
275
+ └── README.md
276
+ ```
277
+
278
+ ---
279
+
280
+ ## Configuration (planned)
281
+
282
+ ### `.bemadralphy/state.yaml`
283
+
284
+ Tracks pipeline state for resumability:
285
+
286
+ ```yaml
287
+ phase: execution
288
+ mode: hybrid
289
+ engine: claude
290
+ last_gate: architecture
291
+ tasks_completed: 12
292
+ tasks_total: 24
293
+ cost_usd: 3.47
294
+ ```
295
+
296
+ ### Flags
297
+
298
+ | Flag | Description |
299
+ | --------------------------------- | --------------------------------------- |
300
+ | `--mode auto\|hybrid\|supervised` | Autonomy mode |
301
+ | `--engine <name>` | AI engine to use |
302
+ | `--planning-engine <name>` | Override engine for planning phase only |
303
+ | `--max-parallel N` | Max parallel tasks (default: 3) |
304
+ | `--budget N` | Cost cap in USD |
305
+ | `--brownfield` | Force brownfield mode |
306
+ | `--swarm native\|process\|off` | Override swarm detection |
307
+ | `--create-pr` | Create PRs for each task |
308
+
309
+ ---
310
+
311
+ ## Installation
312
+
313
+ ### Quick Install (Recommended)
314
+
315
+ ```bash
316
+ # npm
317
+ npm install -g bemadralphy
318
+
319
+ # pnpm
320
+ pnpm add -g bemadralphy
321
+
322
+ # bun
323
+ bun add -g bemadralphy
324
+
325
+ # yarn
326
+ yarn global add bemadralphy
327
+
328
+ # or use the install script
329
+ curl -fsSL https://raw.githubusercontent.com/hxp-pxh/BeMadRalphy/main/install.sh | bash
330
+ ```
331
+
332
+ ### Docker
333
+
334
+ ```bash
335
+ # Pull from GitHub Container Registry
336
+ docker pull ghcr.io/hxp-pxh/bemadralphy:latest
337
+
338
+ # Run
339
+ docker run -v $(pwd):/workspace ghcr.io/hxp-pxh/bemadralphy init
340
+ ```
341
+
342
+ For detailed first-run setup, see [`docs/getting-started.md`](docs/getting-started.md).
343
+
344
+ ### Install required external CLIs
345
+
346
+ ```bash
347
+ # Ralphy
348
+ sudo npm install -g ralphy-cli
349
+
350
+ # BMAD
351
+ sudo npm install -g bmad-method
352
+
353
+ # Beads
354
+ sudo npm install -g @beads/bd
355
+
356
+ # OpenSpec
357
+ sudo npm install -g @fission-ai/openspec
358
+ ```
359
+
360
+ Verify:
361
+
362
+ ```bash
363
+ ralphy --version
364
+ bmad --version
365
+ bd --version
366
+ openspec --version
367
+ ```
368
+
369
+ ### Install BeMadRalphy dependencies
370
+
371
+ ```bash
372
+ npm install
373
+ npm run build
374
+ node dist/cli.js --help
375
+ ```
376
+
377
+ ### Prerequisites
378
+
379
+ - Node.js 18+ or Bun 1.0+
380
+ - Git
381
+ - Ralphy CLI (`ralphy`) for execution fallback and parallel orchestration
382
+ - BMAD CLI (`bmad`)
383
+ - Beads CLI (`bd`)
384
+ - OpenSpec CLI (`openspec`)
385
+
386
+ ## Fail-Fast Behavior
387
+
388
+ `init` and `run` are strict by design for local-product reliability:
389
+
390
+ - Missing required CLIs fail immediately with actionable errors.
391
+ - Planning fails if BMAD command fails or required artifacts are missing.
392
+ - Sync fails if stories cannot be parsed or Beads writes fail.
393
+ - Execute fails for unknown/unavailable engines.
394
+ - Verify/Post fail if OpenSpec commands fail.
395
+
396
+ Typical recovery flow:
397
+
398
+ ```bash
399
+ # 1) Verify toolchain
400
+ ralphy --version && bmad --version && bd --version && openspec --version
401
+
402
+ # 2) Re-run setup and checks
403
+ npm install
404
+ npm run verify
405
+ node dist/cli.js init
406
+
407
+ # 3) Run pipeline
408
+ node dist/cli.js run --mode auto --engine ralphy
409
+ ```
410
+
411
+ ---
412
+
413
+ ## Quick Start
414
+
415
+ ```bash
416
+ # 1. Create a new directory
417
+ mkdir my-awesome-app && cd my-awesome-app
418
+
419
+ # 2. Initialize BeMadRalphy
420
+ npx bemadralphy init
421
+
422
+ # 3. Write your idea
423
+ echo "A todo app with real-time sync and offline support" > idea.md
424
+
425
+ # 4. Run the pipeline
426
+ npx bemadralphy run
427
+ ```
428
+
429
+ For full expected outputs and fail-fast troubleshooting, see [`docs/getting-started.md`](docs/getting-started.md).
430
+
431
+ That's it. BeMadRalphy will:
432
+
433
+ 1. Ask clarifying questions about your stack preferences
434
+ 2. Generate a full PRD and architecture
435
+ 3. Create all the steering files for your AI agents
436
+ 4. Scaffold the project
437
+ 5. Execute all tasks with tests
438
+ 6. Verify the implementation
439
+ 7. Generate documentation and deploy
440
+
441
+ ---
442
+
443
+ ## Contributing
444
+
445
+ See [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines on:
446
+
447
+ - Fork/clone workflow
448
+ - Branch naming conventions
449
+ - Commit message format
450
+ - PR process
451
+ - Code standards
452
+
453
+ ---
454
+
455
+ ## License
456
+
457
+ [MIT](LICENSE) — Copyright (c) 2026 hxp-pxh
458
+
459
+ ---
460
+
461
+ ## Acknowledgments
462
+
463
+ BeMadRalphy builds on the shoulders of giants:
464
+
465
+ - [BMAD-METHOD](https://github.com/bmad-code-org/BMAD-METHOD) — The planning framework
466
+ - [Beads](https://github.com/steveyegge/beads) — The task graph and memory layer
467
+ - [Ralphy](https://github.com/michaelshimeles/ralphy) — The execution loop inspiration ([site](https://ralphy.goshen.fyi/))
468
+ - [OpenSpec](https://github.com/Fission-AI/OpenSpec) — The living spec model
@@ -0,0 +1,5 @@
1
+ export type ParsedTask = {
2
+ id: string;
3
+ title: string;
4
+ };
5
+ export declare function storiesToBeads(storyPaths: string[]): Promise<ParsedTask[]>;
@@ -0,0 +1,16 @@
1
+ import { readFile } from 'node:fs/promises';
2
+ export async function storiesToBeads(storyPaths) {
3
+ const tasks = [];
4
+ let counter = 1;
5
+ for (const storyPath of storyPaths) {
6
+ const contents = await readFile(storyPath, 'utf-8');
7
+ const lines = contents.split(/\r?\n/);
8
+ for (const line of lines) {
9
+ if (line.startsWith('### ')) {
10
+ tasks.push({ id: `bd-${counter++}`, title: line.replace(/^###\s+/, '') });
11
+ }
12
+ }
13
+ }
14
+ return tasks;
15
+ }
16
+ //# sourceMappingURL=adapter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"adapter.js","sourceRoot":"","sources":["../../src/beads/adapter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAO5C,MAAM,CAAC,KAAK,UAAU,cAAc,CAAC,UAAoB;IACvD,MAAM,KAAK,GAAiB,EAAE,CAAC;IAC/B,IAAI,OAAO,GAAG,CAAC,CAAC;IAEhB,KAAK,MAAM,SAAS,IAAI,UAAU,EAAE,CAAC;QACnC,MAAM,QAAQ,GAAG,MAAM,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;QACpD,MAAM,KAAK,GAAG,QAAQ,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;QACtC,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;YACzB,IAAI,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,EAAE,CAAC;gBAC5B,KAAK,CAAC,IAAI,CAAC,EAAE,EAAE,EAAE,MAAM,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,EAAE,CAAC,EAAE,CAAC,CAAC;YAC5E,CAAC;QACH,CAAC;IACH,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC"}
@@ -0,0 +1,3 @@
1
+ export { storiesToBeads } from './adapter.js';
2
+ export { renderTasksMarkdown } from './tasks-md.js';
3
+ export { BeadsWriter } from './writer.js';
@@ -0,0 +1,4 @@
1
+ export { storiesToBeads } from './adapter.js';
2
+ export { renderTasksMarkdown } from './tasks-md.js';
3
+ export { BeadsWriter } from './writer.js';
4
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/beads/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AACpD,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC"}
@@ -0,0 +1,2 @@
1
+ import type { TaskSummary } from './tasks-md.js';
2
+ export declare function parseTasksMarkdown(contents: string): TaskSummary[];
@@ -0,0 +1,12 @@
1
+ export function parseTasksMarkdown(contents) {
2
+ const lines = contents.split(/\r?\n/).filter((line) => line.startsWith('|'));
3
+ const rows = lines
4
+ .map((line) => line.split('|').map((part) => part.trim()))
5
+ .filter((parts) => parts.length >= 4 && parts[1] !== 'ID' && parts[1] !== '---');
6
+ return rows.map((parts) => ({
7
+ id: parts[1],
8
+ title: parts[2],
9
+ status: parts[3],
10
+ }));
11
+ }
12
+ //# sourceMappingURL=parse-tasks.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parse-tasks.js","sourceRoot":"","sources":["../../src/beads/parse-tasks.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,kBAAkB,CAAC,QAAgB;IACjD,MAAM,KAAK,GAAG,QAAQ,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC;IAC7E,MAAM,IAAI,GAAG,KAAK;SACf,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC;SACzD,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,MAAM,IAAI,CAAC,IAAI,KAAK,CAAC,CAAC,CAAC,KAAK,IAAI,IAAI,KAAK,CAAC,CAAC,CAAC,KAAK,KAAK,CAAC,CAAC;IACnF,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;QAC1B,EAAE,EAAE,KAAK,CAAC,CAAC,CAAC;QACZ,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC;QACf,MAAM,EAAE,KAAK,CAAC,CAAC,CAAC;KACjB,CAAC,CAAC,CAAC;AACN,CAAC"}
@@ -0,0 +1,6 @@
1
+ export type TaskSummary = {
2
+ id: string;
3
+ title: string;
4
+ status: string;
5
+ };
6
+ export declare function renderTasksMarkdown(tasks: TaskSummary[]): string;
@@ -0,0 +1,8 @@
1
+ export function renderTasksMarkdown(tasks) {
2
+ const lines = ['# Tasks', '', '| ID | Title | Status |', '| --- | --- | --- |'];
3
+ for (const task of tasks) {
4
+ lines.push(`| ${task.id} | ${task.title} | ${task.status} |`);
5
+ }
6
+ return lines.join('\n');
7
+ }
8
+ //# sourceMappingURL=tasks-md.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tasks-md.js","sourceRoot":"","sources":["../../src/beads/tasks-md.ts"],"names":[],"mappings":"AAMA,MAAM,UAAU,mBAAmB,CAAC,KAAoB;IACtD,MAAM,KAAK,GAAG,CAAC,SAAS,EAAE,EAAE,EAAE,yBAAyB,EAAE,qBAAqB,CAAC,CAAC;IAChF,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,KAAK,CAAC,IAAI,CAAC,KAAK,IAAI,CAAC,EAAE,MAAM,IAAI,CAAC,KAAK,MAAM,IAAI,CAAC,MAAM,IAAI,CAAC,CAAC;IAChE,CAAC;IACD,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC"}
@@ -0,0 +1,12 @@
1
+ export declare class BeadsWriter {
2
+ private queue;
3
+ private availablePromise;
4
+ private cwd;
5
+ constructor(projectRoot: string);
6
+ isAvailable(): Promise<boolean>;
7
+ init(): Promise<void>;
8
+ create(title: string, body: string): Promise<string>;
9
+ update(id: string, body: string): Promise<void>;
10
+ close(id: string): Promise<void>;
11
+ private enqueue;
12
+ }
@@ -0,0 +1,60 @@
1
+ import { commandExists, runCommand } from '../utils/exec.js';
2
+ import { logInfo } from '../utils/logging.js';
3
+ export class BeadsWriter {
4
+ queue = Promise.resolve();
5
+ availablePromise;
6
+ cwd;
7
+ constructor(projectRoot) {
8
+ this.cwd = projectRoot;
9
+ this.availablePromise = commandExists('bd');
10
+ }
11
+ async isAvailable() {
12
+ return this.availablePromise;
13
+ }
14
+ async init() {
15
+ await this.enqueue(async () => {
16
+ if (!(await this.isAvailable())) {
17
+ logInfo('BeadsWriter: bd not available; skipping init');
18
+ return;
19
+ }
20
+ await runCommand('bd', ['init'], this.cwd);
21
+ });
22
+ }
23
+ async create(title, body) {
24
+ return this.enqueue(async () => {
25
+ if (!(await this.isAvailable())) {
26
+ throw new Error('BeadsWriter.create: bd not available');
27
+ }
28
+ const { stdout } = await runCommand('bd', ['create', title, '--body', body], this.cwd);
29
+ const id = stdout.trim();
30
+ if (!id) {
31
+ throw new Error('BeadsWriter.create: bd did not return an issue id');
32
+ }
33
+ return id;
34
+ });
35
+ }
36
+ async update(id, body) {
37
+ await this.enqueue(async () => {
38
+ if (!(await this.isAvailable())) {
39
+ logInfo('BeadsWriter.update: bd not available; skipping');
40
+ return;
41
+ }
42
+ await runCommand('bd', ['update', id, '--body', body], this.cwd);
43
+ });
44
+ }
45
+ async close(id) {
46
+ await this.enqueue(async () => {
47
+ if (!(await this.isAvailable())) {
48
+ logInfo('BeadsWriter.close: bd not available; skipping');
49
+ return;
50
+ }
51
+ await runCommand('bd', ['close', id], this.cwd);
52
+ });
53
+ }
54
+ enqueue(fn) {
55
+ const next = this.queue.then(fn, fn);
56
+ this.queue = next.then(() => undefined, () => undefined);
57
+ return next;
58
+ }
59
+ }
60
+ //# sourceMappingURL=writer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"writer.js","sourceRoot":"","sources":["../../src/beads/writer.ts"],"names":[],"mappings":"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"}
package/dist/cli.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ export {};