vibe-and-thrive 1.0.0 → 1.4.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 (55) hide show
  1. package/.claude/commands/explain.md +4 -0
  2. package/.claude/commands/idea.md +346 -0
  3. package/.claude/commands/my-dna.md +122 -0
  4. package/.claude/commands/prd.md +265 -0
  5. package/.claude/commands/review.md +40 -9
  6. package/.claude/commands/styleguide.md +4 -0
  7. package/.claude/commands/tour.md +291 -0
  8. package/.claude/commands/vibe-check.md +4 -0
  9. package/.claude/commands/vibe-help.md +45 -0
  10. package/.claude/commands/vibe-list.md +202 -0
  11. package/.claude/settings.local.json +11 -0
  12. package/.pre-commit-hooks.yaml +9 -0
  13. package/README.md +92 -133
  14. package/bin/postinstall.sh +211 -0
  15. package/bin/ralph-setup.sh +264 -0
  16. package/bin/ralph.sh +120 -0
  17. package/bin/vibe-and-thrive.sh +103 -0
  18. package/bin/vibe.sh +57 -0
  19. package/dist/hooks/check-hardcoded-ai-models.d.ts +10 -0
  20. package/dist/hooks/check-hardcoded-ai-models.d.ts.map +1 -0
  21. package/dist/hooks/check-hardcoded-ai-models.js +102 -0
  22. package/dist/hooks/check-hardcoded-ai-models.js.map +1 -0
  23. package/dist/hooks/index.d.ts +2 -1
  24. package/dist/hooks/index.d.ts.map +1 -1
  25. package/dist/hooks/index.js +4 -1
  26. package/dist/hooks/index.js.map +1 -1
  27. package/lib/ralph/api.sh +200 -0
  28. package/lib/ralph/init.sh +223 -0
  29. package/lib/ralph/loop.sh +395 -0
  30. package/lib/ralph/playwright.sh +192 -0
  31. package/lib/ralph/prd.sh +278 -0
  32. package/lib/ralph/signs.sh +151 -0
  33. package/lib/ralph/utils.sh +287 -0
  34. package/lib/ralph/verify.sh +813 -0
  35. package/lib/wizard/feature-tour.sh +155 -0
  36. package/lib/wizard/quick-setup.sh +239 -0
  37. package/lib/wizard/tutorial.sh +159 -0
  38. package/lib/wizard/ui.sh +136 -0
  39. package/package.json +20 -4
  40. package/skills/browser-verify/SKILL.md +135 -0
  41. package/skills/browser-verify/verify.ts +442 -0
  42. package/templates/PROMPT.md +182 -0
  43. package/templates/config/fullstack.json +86 -0
  44. package/templates/config/go.json +81 -0
  45. package/templates/config/minimal.json +76 -0
  46. package/templates/config/node.json +81 -0
  47. package/templates/config/python.json +81 -0
  48. package/templates/config/rust.json +81 -0
  49. package/templates/signs.json +25 -0
  50. package/.claude/commands/add-tests.md +0 -240
  51. package/.claude/commands/e2e-scaffold.md +0 -212
  52. package/.claude/commands/fix-types.md +0 -238
  53. package/.claude/commands/refactor.md +0 -184
  54. package/.claude/commands/security-check.md +0 -223
  55. package/.claude/commands/tdd-feature.md +0 -227
@@ -1,3 +1,7 @@
1
+ ---
2
+ description: Explain what code does line by line so you can understand and learn from it.
3
+ ---
4
+
1
5
  # Explain Code
2
6
 
3
7
  Explain what code does, line by line, so you can understand and learn from it.
@@ -0,0 +1,346 @@
1
+ ---
2
+ description: Brainstorm a feature idea, then generate PRDs for Ralph autonomous execution.
3
+ ---
4
+
5
+ # /idea - From Brainstorm to PRD
6
+
7
+ You are helping the user go from a rough idea to executable PRDs for Ralph.
8
+
9
+ **CRITICAL: This command does NOT write code. It produces documentation files only.**
10
+
11
+ ## User Input
12
+
13
+ ```text
14
+ $ARGUMENTS
15
+ ```
16
+
17
+ ## Workflow
18
+
19
+ ### Step 1: Start Brainstorming
20
+
21
+ If `$ARGUMENTS` is empty, ask: "What feature or idea would you like to brainstorm?"
22
+
23
+ If `$ARGUMENTS` has content, acknowledge it and proceed.
24
+
25
+ Say: "Let's brainstorm this idea. I'll help you think it through, then we'll create documentation for Ralph to execute."
26
+
27
+ ### Step 2: Explore and Ask Questions
28
+
29
+ Help the user flesh out the idea through conversation:
30
+
31
+ 1. **Understand the goal** - What problem does this solve? Who benefits?
32
+ 2. **Explore the codebase** - Use Glob/Grep/Read to understand what exists and what patterns to follow
33
+ 3. **Ask clarifying questions** - Up to 5 questions about:
34
+ - Scope boundaries (what's in/out)
35
+ - User experience (what does the user see/do)
36
+ - Edge cases (what could go wrong)
37
+ - Dependencies (what does this touch)
38
+ - Security/permissions (who can do what)
39
+ - Scale (how many users/items/requests?)
40
+
41
+ ### Step 3: Summarize Before Writing
42
+
43
+ When you have enough information, summarize what you've learned:
44
+
45
+ Say: "Here's what I understand about the feature:
46
+
47
+ **Problem:** [summary]
48
+ **Solution:** [summary]
49
+ **Key decisions:** [list]
50
+
51
+ Ready to write this to `docs/ideas/{feature-name}.md`? Say **'yes'** or tell me what to adjust."
52
+
53
+ **STOP and wait for user confirmation before writing any files.**
54
+
55
+ ### Step 4: Write the Idea File
56
+
57
+ Once the user confirms, write the idea file:
58
+
59
+ 1. Create the directory if needed:
60
+ ```bash
61
+ mkdir -p docs/ideas
62
+ ```
63
+
64
+ 2. Write to `docs/ideas/{feature-name}.md` with this structure:
65
+ ```markdown
66
+ # {Feature Name}
67
+
68
+ ## Problem
69
+ What problem does this solve?
70
+
71
+ ## Solution
72
+ High-level description of the solution.
73
+
74
+ ## User Stories
75
+ - As a [user], I want to [action] so that [benefit]
76
+ - ...
77
+
78
+ ## Scope
79
+ ### In Scope
80
+ - ...
81
+
82
+ ### Out of Scope
83
+ - ...
84
+
85
+ ## Architecture
86
+ ### Directory Structure
87
+ - Where new files should go (be specific: `src/components/forms/`, not just `src/`)
88
+
89
+ ### Patterns to Follow
90
+ - Existing components/utilities to reuse
91
+ - Naming conventions
92
+
93
+ ### Do NOT Create
94
+ - List things that already exist (avoid duplication)
95
+
96
+ ## Technical Notes
97
+ - Dependencies
98
+ - Security considerations
99
+
100
+ ## Open Questions
101
+ - Any unresolved decisions
102
+ ```
103
+
104
+ 3. Open the file for review:
105
+ ```bash
106
+ open -a TextEdit docs/ideas/{feature-name}.md
107
+ ```
108
+
109
+ 4. Say: "I've written the idea to `docs/ideas/{feature-name}.md` and opened it in TextEdit.
110
+
111
+ Review it and let me know:
112
+ - **'approved'** - Ready to split into PRDs
113
+ - **'edit [changes]'** - Tell me what to change
114
+ - Or make edits in the file and say **'done'**"
115
+
116
+ **STOP and wait for user response. Do not proceed until they say 'approved' or 'done'.**
117
+
118
+ ### Step 5: Split into PRDs
119
+
120
+ **Only proceed here after user explicitly approves the idea file.**
121
+
122
+ Say: "Now I'll split this into executable PRDs for Ralph. Each story will be small enough to complete in one session."
123
+
124
+ Break the idea into small, executable PRDs following the JSON structure below.
125
+
126
+ ### Step 6: Write PRD
127
+
128
+ 1. Ensure .ralph directory exists:
129
+ ```bash
130
+ mkdir -p .ralph
131
+ ```
132
+
133
+ 2. Write to `.ralph/prd.json`
134
+
135
+ 3. Say: "I've created the PRD with {N} stories in `.ralph/prd.json`.
136
+
137
+ Review and let me know:
138
+ - **'approved'** - Ready for `npx ralph run`
139
+ - **'edit [changes]'** - Tell me what to change"
140
+
141
+ **STOP and wait for user response. Do not proceed until they approve.**
142
+
143
+ ### Step 7: Final Instructions
144
+
145
+ Once the user approves the PRD, say:
146
+
147
+ "Ready for autonomous development!
148
+
149
+ **Idea:** `docs/ideas/{feature-name}.md`
150
+ **PRD:** `.ralph/prd.json` ({N} stories)
151
+
152
+ Run:
153
+ ```bash
154
+ npx ralph run
155
+ ```
156
+
157
+ **DO NOT start implementing code. The user will run `npx ralph run` separately.**
158
+
159
+ ---
160
+
161
+ ## PRD JSON Structure
162
+
163
+ ```json
164
+ {
165
+ "feature": {
166
+ "name": "Feature Name",
167
+ "ideaFile": "docs/ideas/{feature-name}.md",
168
+ "branch": "feature/{feature-name}",
169
+ "status": "pending"
170
+ },
171
+ "metadata": {
172
+ "createdAt": "ISO timestamp",
173
+ "estimatedStories": 5,
174
+ "complexity": "low|medium|high"
175
+ },
176
+ "stories": [
177
+ {
178
+ "id": "TASK-001",
179
+ "type": "frontend|backend",
180
+ "title": "Short description",
181
+ "passes": false,
182
+
183
+ "files": {
184
+ "create": ["paths to new files"],
185
+ "modify": ["paths to existing files"],
186
+ "reuse": ["existing files to import from"]
187
+ },
188
+
189
+ "acceptanceCriteria": [
190
+ "What it should do"
191
+ ],
192
+
193
+ "errorHandling": [
194
+ "What happens when things fail"
195
+ ],
196
+
197
+ "testSteps": [
198
+ "MUST be executable shell commands - see examples below"
199
+ ],
200
+
201
+ "dependsOn": [],
202
+
203
+ "notes": ""
204
+ }
205
+ ]
206
+ }
207
+ ```
208
+
209
+ ### Frontend stories also need:
210
+ - `testUrl` - URL to test
211
+ - `loadingState` - What shows during async operations
212
+ - `a11y` - Accessibility requirements
213
+ - `mobile` - How it works on mobile
214
+
215
+ ### E2E Tests
216
+ Add `"e2e": true` to **any frontend story where users interact** with the feature:
217
+ - Forms, buttons, inputs, modals, wizards → e2e
218
+ - Real-time features, drag & drop, file uploads → e2e
219
+ - Multi-page flows, navigation → e2e
220
+ - Static display-only components (no interaction) → skip e2e
221
+
222
+ When `e2e: true`, the story should:
223
+ - Create a Playwright test file in `tests/e2e/{story-id}.spec.ts`
224
+ - Include the test in `testSteps`: `"npx playwright test tests/e2e/{story-id}.spec.ts"`
225
+ - **Skip in CI** (runs nightly instead): Add `test.skip(!!process.env.CI, 'Runs nightly');` at top of test
226
+
227
+ Don't ask - if users touch it, test it.
228
+
229
+ ### Backend stories also need:
230
+ - `apiEndpoints` - Endpoints to test
231
+ - `validation` - Input validation rules
232
+ - `auth` - Authentication requirements
233
+ - `scale` - Rate limiting, pagination (for list endpoints), caching
234
+
235
+ ---
236
+
237
+ ## Guidelines
238
+
239
+ ### Story Guidelines
240
+ - **Keep stories small** - Max 3-4 acceptance criteria per story, ~1000 tokens max description
241
+ - **Order by dependency** - Stories that depend on others come later
242
+ - **Max 10 stories** - If more, suggest splitting into phases
243
+ - **Define error handling** - Every story specifies what happens on failure
244
+ - **Notes field** - Claude fills this as it works (files created, decisions made, context for next story)
245
+
246
+ ### Context Size Limits
247
+ Each story must be completable in ONE Claude session without context overflow:
248
+ - **Max ~1000 tokens** for story description (title + criteria + error handling)
249
+ - **Max 3-4 files** created or modified per story
250
+ - If a story feels too big, split it
251
+
252
+ ### UI Stories Must Include Browser Verification
253
+ For frontend stories, acceptance criteria MUST include:
254
+ - "Page loads without console errors"
255
+ - "Required elements render" (specify which: header, form, button, etc.)
256
+ - "Works on mobile viewport (375px)"
257
+
258
+ These get verified by Playwright, not just code review.
259
+
260
+ ### Test Steps - CRITICAL
261
+ **Test steps MUST be executable shell commands.** Ralph runs them with bash.
262
+
263
+ ✅ **GOOD test steps (executable):**
264
+ ```json
265
+ "testSteps": [
266
+ "curl -s http://localhost:3000/api/health | jq -e '.status == \"ok\"'",
267
+ "curl -s -o /dev/null -w '%{http_code}' http://localhost:8000/api/users | grep 200",
268
+ "test -f frontend/src/components/Button.tsx",
269
+ "grep -q 'export function Button' frontend/src/components/Button.tsx",
270
+ "cd frontend && npx tsc --noEmit",
271
+ "docker compose exec -T web python manage.py test app.tests.TestUserAPI",
272
+ "npx playwright test tests/e2e/dashboard.spec.ts",
273
+ "npx playwright test --grep 'login flow'",
274
+ "cd frontend && npm test -- --testPathPattern=Button.test.tsx"
275
+ ]
276
+ ```
277
+
278
+ **For UI/visual verification, use Playwright tests:**
279
+ ```json
280
+ "testSteps": [
281
+ "npx playwright test tests/e2e/chat-panel.spec.ts"
282
+ ]
283
+ ```
284
+
285
+ The Playwright test file can check:
286
+ - Element visibility and positioning
287
+ - Console errors (no errors in DevTools)
288
+ - Network requests completing
289
+ - Visual layout (screenshots, viewport checks)
290
+ - Accessibility (axe-core integration)
291
+
292
+ ❌ **BAD test steps (not executable - will fail):**
293
+ ```json
294
+ "testSteps": [
295
+ "Visit http://localhost:3000/dashboard",
296
+ "User can see the dashboard",
297
+ "Click the submit button",
298
+ "Form validates correctly",
299
+ "Chat panel renders in top 60%",
300
+ "Check DevTools for errors"
301
+ ]
302
+ ```
303
+
304
+ **If a step can't be automated**, leave it out of testSteps and put it in acceptanceCriteria instead. Ralph will verify acceptanceCriteria via code review, not by running commands.
305
+
306
+ ### Architecture Guidelines
307
+ - **Domain-driven directories** - Group by feature (`src/contact/`) not type (`src/components/`)
308
+ - **Max 300 lines per file** - Split large files
309
+ - **Reuse over recreate** - Check for existing utilities first
310
+ - **Explicit file paths** - Every story specifies exactly which files
311
+
312
+ ---
313
+
314
+ ## Error Handling
315
+
316
+ - If user provides no arguments, ask what they want to brainstorm
317
+ - If user abandons mid-flow, the idea file is still saved for later
318
+
319
+ ### If PRD Already Exists
320
+
321
+ Before writing to `.ralph/prd.json`, check if it exists:
322
+
323
+ ```bash
324
+ cat .ralph/prd.json 2>/dev/null | jq '{stories: .stories | length, completed: [.stories[] | select(.passes == true)] | length}'
325
+ ```
326
+
327
+ If it exists, say:
328
+ "📋 `.ralph/prd.json` already exists with {N} stories ({M} completed, {P} pending).
329
+
330
+ Options:
331
+ - **'append'** - Add new stories to existing PRD (recommended)
332
+ - **'overwrite'** - Replace entirely
333
+ - **'cancel'** - Stop here"
334
+
335
+ **STOP and wait for user choice.**
336
+
337
+ If **'append'**:
338
+ - Find highest existing story number (ignore prefix - could be US-019 or TASK-019)
339
+ - **Always use TASK- prefix** for new stories (e.g., if highest is US-019 or TASK-019, new stories start at TASK-020)
340
+ - Read existing PRD, add new stories to the `stories` array
341
+ - Update `metadata.estimatedStories` count
342
+ - Write back to `.ralph/prd.json`
343
+
344
+ If **'overwrite'**:
345
+ - Archive first: `mkdir -p .ralph/archive && mv .ralph/prd.json .ralph/archive/prd-$(date +%Y%m%d-%H%M%S).json`
346
+ - Write new PRD
@@ -0,0 +1,122 @@
1
+ ---
2
+ description: Set up your personal DNA - how you like to work and communicate with Claude.
3
+ ---
4
+
5
+ # My DNA - Personal Style Setup
6
+
7
+ You are helping the user define their DNA - their personal voice and project values. This makes Claude's output match their style.
8
+
9
+ This updates `CLAUDE.md` in the project root with their values and style.
10
+
11
+ ## Step 1: Introduction
12
+
13
+ Say: "Let's set up your DNA so I can match your style and values in this project.
14
+
15
+ Your values shape everything - how we communicate, what we prioritize, and what the product feels like. A few quick questions."
16
+
17
+ ## Step 2: Ask About Core Values
18
+
19
+ Use AskUserQuestion:
20
+
21
+ **Question:** "What values should guide this project? Pick any that resonate."
22
+ **Header:** "Core values"
23
+ **multiSelect:** true
24
+ **Options:**
25
+ - **Respect / Kindness** - "Treat people well, in code and communication"
26
+ - **Simplicity / Clarity** - "Avoid jargon, make things understandable"
27
+ - **Sustainability** - "Build things that last, think long-term"
28
+
29
+ ## Step 3: Ask About Their Voice
30
+
31
+ Use AskUserQuestion:
32
+
33
+ **Question:** "How would you describe your writing style?"
34
+ **Header:** "Your voice"
35
+ **Options:**
36
+ - **Casual & direct** - "I write like I talk, no fluff"
37
+ - **Friendly & warm** - "Approachable, conversational"
38
+ - **Professional & clear** - "Polished but not stiff"
39
+ - **Minimal & precise** - "Say less, mean more"
40
+
41
+ ## Step 4: Ask About Project Priority
42
+
43
+ Use AskUserQuestion:
44
+
45
+ **Question:** "What matters most for this project right now?"
46
+ **Header:** "Priority"
47
+ **Options:**
48
+ - **Ship it** - "Get it working and out the door"
49
+ - **Make it solid** - "Quality and reliability first"
50
+ - **Make it beautiful** - "Design and UX matter most"
51
+ - **Make it scale** - "Building for growth"
52
+
53
+ ## Step 5: Ask About Audience
54
+
55
+ Use AskUserQuestion:
56
+
57
+ **Question:** "Who's this for?"
58
+ **Header:** "Audience"
59
+ **Options:**
60
+ - **Developers** - "Technical users who get it"
61
+ - **Everyone** - "Non-technical users, needs to be simple"
62
+ - **Business users** - "Professional, but not coders"
63
+ - **Just me** - "Personal project, I'm the user"
64
+
65
+ ## Step 6: Ask About Product Tone
66
+
67
+ Use AskUserQuestion:
68
+
69
+ **Question:** "What vibe should the product have?"
70
+ **Header:** "Product tone"
71
+ **Options:**
72
+ - **Friendly** - "Warm, approachable, maybe playful"
73
+ - **Professional** - "Clean, trustworthy, serious"
74
+ - **Minimal** - "Say less, let the product speak"
75
+ - **Bold** - "Confident, opinionated, distinctive"
76
+
77
+ ## Step 7: Optional Writing Sample
78
+
79
+ Ask:
80
+
81
+ "Optional: Paste a writing sample so I can match your voice. Could be anything - an email, a doc, a tweet. Or just say 'skip'."
82
+
83
+ If they provide a sample, note the patterns and include it. If they skip, move on.
84
+
85
+ ## Step 8: Update CLAUDE.md
86
+
87
+ Add a DNA section to `CLAUDE.md` in the project root. If CLAUDE.md exists, append. If not, create it.
88
+
89
+ Use a marker `<!-- my-dna -->` to identify the section. If marker exists, replace that section.
90
+
91
+ ```markdown
92
+ <!-- my-dna -->
93
+ ## DNA
94
+
95
+ ### Core Values
96
+ - [List their selected values]
97
+
98
+ ### Voice
99
+ [Their style + any notes from writing sample]
100
+
101
+ ### Project
102
+ - **Priority:** [ship it / solid / beautiful / scale]
103
+ - **Audience:** [developers / everyone / business / just me]
104
+ - **Tone:** [friendly / professional / minimal / bold]
105
+ ```
106
+
107
+ ## Step 9: Confirm
108
+
109
+ Say:
110
+
111
+ "Done! Added DNA to `CLAUDE.md`.
112
+
113
+ **Your style:** [One sentence summary, e.g., "Casual and direct, shipping fast for developers with a friendly vibe."]
114
+
115
+ I'll match this in code, docs, and commits. Run `/my-dna` again anytime to update."
116
+
117
+ ## Notes
118
+
119
+ - Keep it short - 5 questions max
120
+ - No scanning, just ask
121
+ - If DNA section exists in CLAUDE.md (marker: `<!-- my-dna -->`), replace it
122
+ - The goal is to make Claude's output match their style and values