claude-ralph 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Argile-AI contributors
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,390 @@
1
+ <div align="center">
2
+
3
+ # 🤖 Ralph + 🧠 Claude
4
+
5
+ <img src="assets/ralph-wiggum.png" alt="Ralph" width="120" />
6
+ <img src="assets/plus.png" alt="+" width="50" />
7
+ <img src="assets/claude-code-logo.jpg" alt="Claude Code" width="120" />
8
+
9
+ **Autonomous AI Agent Loop for Claude Code**
10
+
11
+ [![Version](https://img.shields.io/badge/version-1.0.0-blue.svg)](https://github.com/anthropics/ralph/releases)
12
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
13
+ [![Node](https://img.shields.io/badge/node-%3E%3D18-green.svg)](https://nodejs.org/)
14
+ [![Claude Code](https://img.shields.io/badge/Claude%20Code-compatible-purple.svg)](https://claude.ai/code)
15
+
16
+ *Run Claude Code repeatedly until all PRD items are complete. Each iteration is a fresh instance with clean context.*
17
+
18
+ Based on [Geoffrey Huntley's Ralph pattern](https://ghuntley.com/ralph/) 🎩
19
+
20
+ </div>
21
+
22
+ ---
23
+
24
+ ## 🤔 Why Ralph CLI over the official Claude Code plugin?
25
+
26
+ | Feature | Ralph CLI | Claude Code Built-in |
27
+ |---------|-----------|---------------------|
28
+ | **Context Management** | ✅ Fresh context each iteration | ❌ Context accumulates and degrades |
29
+ | **Memory Persistence** | ✅ Git + `progress.txt` + `prd.json` | ❌ Lost between sessions |
30
+ | **Multi-repo Support** | ✅ Native support for monorepos | ❌ Single repo at a time |
31
+ | **Quality Gates** | ✅ Automated checks between stories | ❌ Manual verification |
32
+ | **Progress Tracking** | ✅ Structured PRD with status | ❌ No built-in tracking |
33
+ | **Branch Management** | ✅ Auto-create, fork, checkout | ❌ Manual git operations |
34
+ | **Iteration Control** | ✅ Configurable max iterations | ❌ No automatic limits |
35
+
36
+ **The key insight:** Claude Code's context window fills up over long sessions, degrading output quality. Ralph solves this by spawning **fresh instances** for each story, using files as persistent memory instead of relying on in-context state.
37
+
38
+ > 💡 *"The 'Ralph' pattern is about context hygiene. Each iteration starts clean, with only the essential context loaded from files."*
39
+
40
+ ---
41
+
42
+ ## 📑 Table of Contents
43
+
44
+ - [🤔 Why Ralph CLI?](#-why-ralph-cli-over-the-official-claude-code-plugin)
45
+ - [🚀 How It Works](#-how-it-works)
46
+ - [📦 Installation](#-installation)
47
+ - [⚡ Quick Start](#-quick-start)
48
+ - [💻 CLI Commands](#-cli-commands)
49
+ - [📋 Prerequisites](#-prerequisites)
50
+ - [⚙️ Configuration Reference](#️-configuration-reference)
51
+ - [📝 Story Guidelines](#-story-guidelines)
52
+ - [🔀 Branch Forking](#-branch-forking)
53
+ - [📁 Archiving](#-archiving)
54
+ - [🛠️ Development](#️-development)
55
+ - [📚 References](#-references)
56
+ - [📄 License](#-license)
57
+
58
+ ---
59
+
60
+ ## 🚀 How It Works
61
+
62
+ ```
63
+ ┌─────────────────────────────────────────────────────────────┐
64
+ │ 🔄 Ralph Workflow │
65
+ ├─────────────────────────────────────────────────────────────┤
66
+ │ │
67
+ │ 1. ralph init 🎯 Initialize configuration │
68
+ │ ↓ │
69
+ │ 2. ralph plan <feature> 📝 Generate a structured plan │
70
+ │ ↓ │
71
+ │ 3. ralph prd 🔧 Convert plan to prd.json │
72
+ │ ↓ │
73
+ │ 4. ralph run 🤖 Execute stories autonomously │
74
+ │ ↓ │
75
+ │ 5. Commits + PRD ✅ Each story committed │
76
+ │ │
77
+ └─────────────────────────────────────────────────────────────┘
78
+ ```
79
+
80
+ ---
81
+
82
+ ## 📦 Installation
83
+
84
+ ```bash
85
+ npm install -g claude-ralph
86
+ ```
87
+
88
+ Or use npx without installing:
89
+
90
+ ```bash
91
+ npx claude-ralph <command>
92
+ ```
93
+
94
+ ---
95
+
96
+ ## ⚡ Quick Start
97
+
98
+ ### 1️⃣ Initialize Ralph in Your Project
99
+
100
+ ```bash
101
+ cd your-project
102
+ ralph init
103
+ ```
104
+
105
+ This creates `ralph.config.json` with your project settings.
106
+
107
+ ### 2️⃣ Configure Your Project
108
+
109
+ Edit `ralph.config.json`:
110
+
111
+ ```json
112
+ {
113
+ "project": "MyProject",
114
+ "description": "My awesome project",
115
+ "repositories": {
116
+ "backend": {
117
+ "path": "./backend",
118
+ "checks": ["pytest", "mypy ."]
119
+ },
120
+ "frontend": {
121
+ "path": "./frontend",
122
+ "checks": ["npm run build", "npm run lint"]
123
+ }
124
+ }
125
+ }
126
+ ```
127
+
128
+ **Single repository?** Just use one entry:
129
+
130
+ ```json
131
+ {
132
+ "project": "MyProject",
133
+ "repositories": {
134
+ "main": {
135
+ "path": ".",
136
+ "checks": ["npm run build", "npm test"]
137
+ }
138
+ }
139
+ }
140
+ ```
141
+
142
+ ### 3️⃣ Generate a Plan
143
+
144
+ ```bash
145
+ ralph plan "Add user authentication with OAuth support"
146
+ ```
147
+
148
+ Claude will:
149
+ 1. 🤔 Ask 3-5 clarifying questions
150
+ 2. 📄 Generate `plan.md` with structured user stories
151
+ 3. ✅ Ask for validation
152
+
153
+ ### 4️⃣ Convert to PRD
154
+
155
+ Review and edit `plan.md` if needed, then:
156
+
157
+ ```bash
158
+ ralph prd
159
+ ```
160
+
161
+ This converts the plan to `prd.json`.
162
+
163
+ ### 5️⃣ Run Ralph
164
+
165
+ ```bash
166
+ ralph run
167
+ ```
168
+
169
+ Ralph will:
170
+ 1. 🎯 Pick the highest priority story with `passes: false`
171
+ 2. 📂 Navigate to the correct repository
172
+ 3. 🌿 Create/checkout the feature branch
173
+ 4. 💻 Implement the story
174
+ 5. 🧪 Run quality checks
175
+ 6. ✅ Commit if checks pass
176
+ 7. 🔄 Update `prd.json` and repeat
177
+
178
+ ### 6️⃣ Check Status
179
+
180
+ ```bash
181
+ ralph status
182
+ ralph status --verbose
183
+ ```
184
+
185
+ ---
186
+
187
+ ## 💻 CLI Commands
188
+
189
+ | Command | Description |
190
+ |---------|-------------|
191
+ | `ralph init` | 🎯 Initialize Ralph configuration |
192
+ | `ralph plan <feature>` | 📝 Generate a structured implementation plan |
193
+ | `ralph prd` | 🔧 Convert `plan.md` to `prd.json` |
194
+ | `ralph run` | 🤖 Run the autonomous agent loop |
195
+ | `ralph status` | 📊 Show current progress and status |
196
+
197
+ ### `ralph init`
198
+
199
+ Initialize Ralph configuration in the current directory.
200
+
201
+ ```bash
202
+ ralph init
203
+ ralph init --force # Overwrite existing config
204
+ ```
205
+
206
+ ### `ralph plan <feature>`
207
+
208
+ Generate a structured implementation plan.
209
+
210
+ ```bash
211
+ ralph plan "Add a notification system with email and push support"
212
+ ralph plan "Refactor the auth module" --output custom-plan.md
213
+ ```
214
+
215
+ ### `ralph prd`
216
+
217
+ Convert `plan.md` to `prd.json`.
218
+
219
+ ```bash
220
+ ralph prd
221
+ ralph prd --input custom-plan.md --output custom-prd.json
222
+ ```
223
+
224
+ ### `ralph run`
225
+
226
+ Run the autonomous agent loop.
227
+
228
+ ```bash
229
+ ralph run
230
+ ralph run --max-iterations 10 # Limit iterations
231
+ ```
232
+
233
+ ### `ralph status`
234
+
235
+ Show current progress and status.
236
+
237
+ ```bash
238
+ ralph status
239
+ ralph status --verbose # Show detailed information
240
+ ```
241
+
242
+ ---
243
+
244
+ ## 📋 Prerequisites
245
+
246
+ - 🧠 [Claude Code CLI](https://docs.anthropic.com/en/docs/claude-code) installed and authenticated
247
+ - 📦 Node.js 18 or later
248
+
249
+ ---
250
+
251
+ ## ⚙️ Configuration Reference
252
+
253
+ ### ralph.config.json
254
+
255
+ ```json
256
+ {
257
+ "$schema": "https://raw.githubusercontent.com/anthropics/ralph/main/schema/ralph.config.schema.json",
258
+ "version": "1.0",
259
+ "project": "MyProject",
260
+ "description": "Optional project description",
261
+ "repositories": {
262
+ "repo-key": {
263
+ "path": "./relative/path",
264
+ "defaultBranch": "main",
265
+ "checks": [
266
+ "command1",
267
+ "command2"
268
+ ]
269
+ }
270
+ },
271
+ "agent": {
272
+ "maxIterations": 50,
273
+ "timeout": 600
274
+ }
275
+ }
276
+ ```
277
+
278
+ Configuration can also be stored in:
279
+ - `.ralphrc`
280
+ - `.ralphrc.json`
281
+ - `.ralphrc.yaml`
282
+ - `package.json` under the `"ralph"` key
283
+
284
+ ### prd.json
285
+
286
+ ```json
287
+ {
288
+ "project": "Feature Name",
289
+ "description": "What this feature does",
290
+ "repositories": {
291
+ "backend": { "branchName": "feature/my-feature" },
292
+ "frontend": { "branchName": "feature/my-feature" }
293
+ },
294
+ "userStories": [
295
+ {
296
+ "id": "US-001",
297
+ "title": "Add user model",
298
+ "repo": "backend",
299
+ "description": "As a developer, I need a user model...",
300
+ "acceptanceCriteria": [
301
+ "User model created with email, password fields",
302
+ "Migration generated",
303
+ "Tests pass"
304
+ ],
305
+ "priority": 1,
306
+ "passes": false,
307
+ "fork": false,
308
+ "notes": ""
309
+ }
310
+ ]
311
+ }
312
+ ```
313
+
314
+ ---
315
+
316
+ ## 📝 Story Guidelines
317
+
318
+ ### 📏 Size
319
+ - Each story must be completable in **ONE** Claude Code iteration
320
+ - If it can't be described in 2-3 sentences, split it
321
+ - One story = One focused change in ONE repository
322
+
323
+ ### 📊 Order
324
+ 1. 🗄️ Database/schema changes first
325
+ 2. ⚙️ API/backend logic second
326
+ 3. 🎨 Frontend components third
327
+ 4. 🔗 Integration/polish last
328
+
329
+ ### ✅ Acceptance Criteria
330
+ - Must be objectively verifiable
331
+ - Backend stories: Include "Tests pass"
332
+ - Frontend stories: Include "Build passes" AND "Verify in browser"
333
+
334
+ ---
335
+
336
+ ## 🔀 Branch Forking
337
+
338
+ For significant direction changes, use `fork: true` in a story:
339
+
340
+ ```json
341
+ {
342
+ "id": "US-005",
343
+ "title": "Refactor auth system",
344
+ "fork": true,
345
+ "passes": false
346
+ }
347
+ ```
348
+
349
+ Ralph will create a new branch (e.g., `feature/auth-2`) from the current one.
350
+
351
+ ---
352
+
353
+ ## 📁 Archiving
354
+
355
+ Ralph automatically archives previous runs when you start a new project. Archives are saved in `archive/YYYY-MM-DD-project-name/`.
356
+
357
+ ---
358
+
359
+ ## 🛠️ Development
360
+
361
+ To build from source:
362
+
363
+ ```bash
364
+ git clone https://github.com/anthropics/ralph.git
365
+ cd ralph
366
+ npm install
367
+ npm run build
368
+ npm link # Makes 'ralph' command available globally
369
+ ```
370
+
371
+ ---
372
+
373
+ ## 📚 References
374
+
375
+ - 🎩 [Geoffrey Huntley's Ralph article](https://ghuntley.com/ralph/)
376
+ - 🧠 [Claude Code documentation](https://docs.anthropic.com/en/docs/claude-code)
377
+
378
+ ---
379
+
380
+ ## 📄 License
381
+
382
+ MIT License - see [LICENSE](LICENSE)
383
+
384
+ ---
385
+
386
+ <div align="center">
387
+
388
+ Made with 💜 by the community
389
+
390
+ </div>
package/dist/cli.d.ts ADDED
@@ -0,0 +1,2 @@
1
+
2
+ export { }