vralphy 0.0.1 → 0.0.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 (2) hide show
  1. package/README.md +401 -0
  2. package/package.json +12 -3
package/README.md ADDED
@@ -0,0 +1,401 @@
1
+ # vralphy
2
+
3
+ CLI tool implementing the **Ralph Playbook** methodology with engine flexibility (Claude/OpenCode), model selection, and autonomous development loops.
4
+
5
+ ## What is the Ralph Methodology?
6
+
7
+ Ralph is an **autonomous AI development methodology** where an AI agent:
8
+
9
+ 1. **Plans** - Studies specs, analyzes codebase, creates implementation plans
10
+ 2. **Builds** - Implements features using parallel subagents, runs tests, commits changes
11
+ 3. **Loops** - Repeats until all tasks complete or iteration limit reached
12
+
13
+ The methodology emphasizes:
14
+ - **Parallel execution** - 500+ subagents for searches/reads, specialized agents for reasoning
15
+ - **Autonomous operation** - Agent makes decisions, runs tests, commits without human intervention
16
+ - **Specification-driven** - Work defined in `specs/*.md` files
17
+ - **Operational context** - Lightweight `AGENTS.md` keeps build/test commands accessible
18
+ - **Incremental progress** - `IMPLEMENTATION_PLAN.md` tracks remaining work across loops
19
+
20
+ ## Installation
21
+
22
+ ```bash
23
+ npm install -g vralphy
24
+ ```
25
+
26
+ Or use directly with npx:
27
+
28
+ ```bash
29
+ npx vralphy init
30
+ ```
31
+
32
+ ## Quick Start
33
+
34
+ 1. **Initialize a project:**
35
+ ```bash
36
+ cd your-project
37
+ vralphy init
38
+ ```
39
+
40
+ This creates:
41
+ - `specs/` - Feature specifications directory
42
+ - `AGENTS.md` - Operational guide (build/test commands)
43
+ - `PROMPT_plan.md` - Planning mode prompt
44
+ - `PROMPT_build.md` - Build mode prompt
45
+ - `PROMPT_spec.md` - Spec creation prompt
46
+ - `loop.sh` - Bash orchestration script
47
+ - `IMPLEMENTATION_PLAN.md` - Task tracking
48
+
49
+ 2. **Create specifications:**
50
+ ```bash
51
+ vralphy spec authentication
52
+ ```
53
+
54
+ Interactive conversation to define requirements, saves to `specs/authentication.md`
55
+
56
+ 3. **Run planning phase:**
57
+ ```bash
58
+ vralphy plan 3
59
+ ```
60
+
61
+ Agent analyzes specs and codebase, creates/updates `IMPLEMENTATION_PLAN.md`
62
+
63
+ 4. **Run build phase:**
64
+ ```bash
65
+ vralphy build 10
66
+ ```
67
+
68
+ Agent autonomously implements features, runs tests, commits changes
69
+
70
+ ## Commands
71
+
72
+ ### Core Commands
73
+
74
+ ```bash
75
+ vralphy build [iterations] # Build mode (default: unlimited)
76
+ vralphy plan [iterations] # Plan mode
77
+ vralphy spec [topic] # Interactive spec creation
78
+ vralphy init # Initialize project
79
+ ```
80
+
81
+ ### Utility Commands
82
+
83
+ ```bash
84
+ vralphy engines # List available engines (claude/opencode)
85
+ vralphy skills # List loaded skills
86
+ vralphy agents # List available agents
87
+ ```
88
+
89
+ ### Global Flags
90
+
91
+ ```bash
92
+ --engine <engine> # claude or opencode (default: claude)
93
+ --model <model> # Primary model: opus, sonnet, haiku (default: opus)
94
+ --executor <model> # Executor model for subagents (default: sonnet)
95
+ --skills <path> # Skills directory (default: auto-detect)
96
+ --agents <path> # Agents directory (default: auto-detect)
97
+ --config <path> # Config file (default: vralphy.config.json)
98
+ --verbose # Verbose output
99
+ --dry-run # Show what would execute without running
100
+ ```
101
+
102
+ ## How It Works
103
+
104
+ ### 1. Project Structure
105
+
106
+ ```
107
+ your-project/
108
+ ├── specs/ # Feature specifications
109
+ │ ├── authentication.md
110
+ │ └── api-endpoints.md
111
+ ├── AGENTS.md # Operational guide (~60 lines max)
112
+ ├── IMPLEMENTATION_PLAN.md # Current task list
113
+ ├── PROMPT_plan.md # Planning prompt template
114
+ ├── PROMPT_build.md # Build prompt template
115
+ └── loop.sh # Orchestration script
116
+ ```
117
+
118
+ ### 2. The Loop
119
+
120
+ **Planning Phase** (`vralphy plan`):
121
+ - Studies all `specs/*.md` files with parallel subagents
122
+ - Analyzes existing codebase
123
+ - Compares implementation against specs
124
+ - Creates/updates `IMPLEMENTATION_PLAN.md` with prioritized tasks
125
+ - **Does NOT write code**
126
+
127
+ **Build Phase** (`vralphy build`):
128
+ - Reads `IMPLEMENTATION_PLAN.md` and picks highest priority task
129
+ - Searches codebase to understand current state
130
+ - Implements functionality using parallel subagents
131
+ - Runs tests after changes
132
+ - Updates `IMPLEMENTATION_PLAN.md` with findings
133
+ - Commits and pushes changes
134
+ - Repeats until done or iteration limit reached
135
+
136
+ **Spec Phase** (`vralphy spec`):
137
+ - Interactive requirement gathering (Claude only)
138
+ - Agent asks clarifying questions using `AskUserQuestion`
139
+ - Generates comprehensive spec document
140
+ - Saves to `specs/<topic>.md`
141
+
142
+ ### 3. Engine Abstraction
143
+
144
+ vralphy supports multiple AI engines:
145
+
146
+ **Claude Engine** (default):
147
+ ```bash
148
+ vralphy --engine claude --model opus build
149
+ ```
150
+
151
+ **OpenCode Engine**:
152
+ ```bash
153
+ vralphy --engine opencode build
154
+ ```
155
+
156
+ Engines auto-detected on startup. Install `claude` or `opencode` CLI tools.
157
+
158
+ ### 4. Model Selection
159
+
160
+ Two-tier model system:
161
+
162
+ - **Primary (Thinking)**: Complex reasoning, orchestration (default: opus)
163
+ - **Executor (Subagents)**: Parallel tasks, file operations (default: sonnet)
164
+
165
+ Model aliases:
166
+ - `opus` → claude-opus-4-5-20251101
167
+ - `sonnet` → claude-sonnet-4-20250514
168
+ - `haiku` → claude-haiku-3-5
169
+
170
+ ```bash
171
+ vralphy --model opus --executor sonnet build
172
+ ```
173
+
174
+ ### 5. Skills & Agents
175
+
176
+ **Skills** are domain-specific knowledge loaded into prompts:
177
+
178
+ ```markdown
179
+ <!-- .claude/skills/react-patterns.md -->
180
+ ---
181
+ name: react-patterns
182
+ description: React best practices
183
+ triggers:
184
+ - "React component"
185
+ - "useState"
186
+ ---
187
+
188
+ # React Patterns
189
+ [knowledge content]
190
+ ```
191
+
192
+ **Agents** are specialized subagents that can be spawned:
193
+
194
+ ```markdown
195
+ <!-- agents/code-reviewer.md -->
196
+ ---
197
+ name: code-reviewer
198
+ description: Reviews code for bugs
199
+ model: sonnet
200
+ ---
201
+
202
+ You are a code review specialist...
203
+ ```
204
+
205
+ List available skills/agents:
206
+ ```bash
207
+ vralphy skills
208
+ vralphy agents
209
+ ```
210
+
211
+ ## Configuration
212
+
213
+ Three ways to configure (priority order):
214
+
215
+ ### 1. CLI Flags
216
+ ```bash
217
+ vralphy --engine claude --model opus --executor sonnet build
218
+ ```
219
+
220
+ ### 2. Environment Variables
221
+ ```bash
222
+ export VRALPHY_ENGINE=claude
223
+ export VRALPHY_MODEL=opus
224
+ export VRALPHY_EXECUTOR=sonnet
225
+ vralphy build
226
+ ```
227
+
228
+ ### 3. Config File
229
+ ```json
230
+ {
231
+ "engine": "claude",
232
+ "model": "opus",
233
+ "executor": "sonnet",
234
+ "skillsDir": ".claude/skills",
235
+ "agentsDir": "agents"
236
+ }
237
+ ```
238
+
239
+ Save as `vralphy.config.json` in project root.
240
+
241
+ ## Examples
242
+
243
+ ### Example 1: New Feature
244
+
245
+ ```bash
246
+ # Define the feature
247
+ vralphy spec user-authentication
248
+
249
+ # Plan implementation
250
+ vralphy plan 2
251
+
252
+ # Build it
253
+ vralphy build 20
254
+
255
+ # Check progress
256
+ cat IMPLEMENTATION_PLAN.md
257
+ ```
258
+
259
+ ### Example 2: Existing Project
260
+
261
+ ```bash
262
+ # Initialize (detects package.json, extracts commands)
263
+ vralphy init
264
+
265
+ # Create specs for missing features
266
+ vralphy spec api-rate-limiting
267
+ vralphy spec error-handling
268
+
269
+ # Run planning
270
+ vralphy plan 5
271
+
272
+ # Execute build loop
273
+ vralphy build
274
+ ```
275
+
276
+ ### Example 3: Using loop.sh (Direct)
277
+
278
+ ```bash
279
+ # Plan mode: 3 iterations
280
+ ./loop.sh plan 3
281
+
282
+ # Build mode: 10 iterations
283
+ ./loop.sh 10
284
+
285
+ # Build mode: unlimited
286
+ ./loop.sh
287
+ ```
288
+
289
+ ### Example 4: Dry Run
290
+
291
+ ```bash
292
+ # See what would execute without running
293
+ vralphy --dry-run build 1
294
+
295
+ # Shows the prompt that would be sent to the engine
296
+ ```
297
+
298
+ ## Why vralphy?
299
+
300
+ ### Traditional Development
301
+ - Human writes spec → human codes → human tests → human debugs → repeat
302
+
303
+ ### With Ralph + vralphy
304
+ - Human writes spec → vralphy plans → vralphy codes → vralphy tests → vralphy commits → repeat
305
+
306
+ You focus on **what to build** (specs), vralphy handles **how to build it**.
307
+
308
+ ## Best Practices
309
+
310
+ ### 1. Keep AGENTS.md Lean
311
+ - **Max ~60 lines**
312
+ - Only operational commands (build, test, lint)
313
+ - No verbose explanations or history
314
+ - Status updates belong in `IMPLEMENTATION_PLAN.md`
315
+
316
+ ### 2. Write Clear Specs
317
+ - One feature per spec file
318
+ - Include acceptance criteria
319
+ - List edge cases
320
+ - Document dependencies
321
+
322
+ ### 3. Start with Planning
323
+ - Always run `vralphy plan` before `vralphy build`
324
+ - Review `IMPLEMENTATION_PLAN.md` before executing
325
+ - Adjust iterations based on task complexity
326
+
327
+ ### 4. Use Dry Run
328
+ - Test prompts with `--dry-run` first
329
+ - Verify model selection is appropriate
330
+ - Check that skills/agents load correctly
331
+
332
+ ### 5. Iteration Management
333
+ - Start with small iteration counts (5-10)
334
+ - Monitor progress via commits
335
+ - Increase as you gain confidence
336
+
337
+ ## Troubleshooting
338
+
339
+ ### "Access token expired"
340
+ ```bash
341
+ npm login
342
+ # or set token in ~/.npmrc:
343
+ echo "//registry.npmjs.org/:_authToken=npm_YOUR_TOKEN" > ~/.npmrc
344
+ ```
345
+
346
+ ### "No engines found"
347
+ Install Claude or OpenCode CLI:
348
+ ```bash
349
+ npm install -g @anthropic-ai/claude-code
350
+ # or
351
+ npm install -g opencode
352
+ ```
353
+
354
+ ### "Skills not loading"
355
+ Check directory structure:
356
+ ```bash
357
+ vralphy --verbose skills
358
+ # Shows search path and loaded skills
359
+ ```
360
+
361
+ ### Loop stuck
362
+ - Check `IMPLEMENTATION_PLAN.md` for circular tasks
363
+ - Review recent commits for issues
364
+ - Reduce iteration count and debug manually
365
+
366
+ ## Development
367
+
368
+ ```bash
369
+ git clone https://github.com/yourusername/vralphy.git
370
+ cd vralphy
371
+ npm install
372
+ npm run build
373
+ npm test
374
+ ```
375
+
376
+ Run locally:
377
+ ```bash
378
+ ./bin/vralphy.js --help
379
+ ```
380
+
381
+ ## Contributing
382
+
383
+ vralphy was built **by Ralph** (autonomous AI) using its own methodology. Contributions should follow the same pattern:
384
+
385
+ 1. Create spec in `specs/`
386
+ 2. Run planning phase
387
+ 3. Run build phase
388
+ 4. Submit PR with generated code
389
+
390
+ ## License
391
+
392
+ MIT
393
+
394
+ ## Links
395
+
396
+ - [npm package](https://www.npmjs.com/package/vralphy)
397
+ - [Ralph Methodology](https://ralphloop.com) _(placeholder - add real link if exists)_
398
+
399
+ ---
400
+
401
+ **Built with ❤️ by AI, for developers who want AI to do the heavy lifting.**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vralphy",
3
- "version": "0.0.1",
3
+ "version": "0.0.2",
4
4
  "description": "CLI tool implementing the Ralph Playbook methodology with engine flexibility",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -9,7 +9,8 @@
9
9
  },
10
10
  "files": [
11
11
  "dist",
12
- "bin"
12
+ "bin",
13
+ "README.md"
13
14
  ],
14
15
  "scripts": {
15
16
  "build": "tsc",
@@ -27,8 +28,16 @@
27
28
  "ralph",
28
29
  "methodology"
29
30
  ],
30
- "author": "",
31
+ "author": "Vadim Comanescu",
31
32
  "license": "MIT",
33
+ "repository": {
34
+ "type": "git",
35
+ "url": "git+https://github.com/vadimcomanescu/vralphy.git"
36
+ },
37
+ "homepage": "https://github.com/vadimcomanescu/vralphy#readme",
38
+ "bugs": {
39
+ "url": "https://github.com/vadimcomanescu/vralphy/issues"
40
+ },
32
41
  "devDependencies": {
33
42
  "@eslint/js": "^9.39.2",
34
43
  "@types/node": "^20.10.0",