@hustle-together/api-dev-tools 3.12.3 → 4.5.1
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/.claude/adr-requests/.gitkeep +10 -0
- package/.claude/agents/adr-researcher.md +109 -0
- package/.claude/agents/visual-analyzer.md +183 -0
- package/.claude/api-dev-state.json +7 -463
- package/.claude/documentation-audit.json +114 -0
- package/.claude/registry.json +289 -0
- package/.claude/settings.json +45 -1
- package/.claude/workflow-logs/None.json +49 -0
- package/.claude/workflow-logs/session-20251230-143727.json +106 -0
- package/.skills/adr-deep-research/SKILL.md +351 -0
- package/.skills/api-create/SKILL.md +116 -17
- package/.skills/api-research/SKILL.md +130 -0
- package/.skills/docs-sync/SKILL.md +260 -0
- package/.skills/docs-update/SKILL.md +205 -0
- package/.skills/hustle-brand/SKILL.md +368 -0
- package/.skills/hustle-build/SKILL.md +786 -0
- package/.skills/hustle-build-review/SKILL.md +518 -0
- package/.skills/parallel-spawn/SKILL.md +212 -0
- package/.skills/ralph-continue/SKILL.md +151 -0
- package/.skills/ralph-loop/SKILL.md +341 -0
- package/.skills/ralph-status/SKILL.md +87 -0
- package/.skills/refactor/SKILL.md +59 -0
- package/.skills/shadcn/SKILL.md +522 -0
- package/.skills/test-all/SKILL.md +210 -0
- package/.skills/test-builds/SKILL.md +208 -0
- package/.skills/test-debug/SKILL.md +212 -0
- package/.skills/test-e2e/SKILL.md +168 -0
- package/.skills/test-review/SKILL.md +707 -0
- package/.skills/test-unit/SKILL.md +143 -0
- package/.skills/test-visual/SKILL.md +301 -0
- package/.skills/token-report/SKILL.md +132 -0
- package/CHANGELOG.md +575 -0
- package/README.md +426 -56
- package/bin/cli.js +1538 -88
- package/commands/hustle-api-create.md +22 -0
- package/commands/hustle-build.md +259 -0
- package/commands/hustle-combine.md +81 -2
- package/commands/hustle-ui-create-page.md +84 -2
- package/commands/hustle-ui-create.md +82 -2
- package/hooks/__pycache__/api-workflow-check.cpython-314.pyc +0 -0
- package/hooks/__pycache__/auto-answer.cpython-314.pyc +0 -0
- package/hooks/__pycache__/cache-research.cpython-314.pyc +0 -0
- package/hooks/__pycache__/check-api-routes.cpython-314.pyc +0 -0
- package/hooks/__pycache__/check-playwright-setup.cpython-314.pyc +0 -0
- package/hooks/__pycache__/check-storybook-setup.cpython-314.pyc +0 -0
- package/hooks/__pycache__/check-update.cpython-314.pyc +0 -0
- package/hooks/__pycache__/completion-promise-detector.cpython-314.pyc +0 -0
- package/hooks/__pycache__/context-capacity-warning.cpython-314.pyc +0 -0
- package/hooks/__pycache__/detect-interruption.cpython-314.pyc +0 -0
- package/hooks/__pycache__/docs-update-check.cpython-314.pyc +0 -0
- package/hooks/__pycache__/enforce-a11y-audit.cpython-314.pyc +0 -0
- package/hooks/__pycache__/enforce-brand-guide.cpython-314.pyc +0 -0
- package/hooks/__pycache__/enforce-component-type-confirm.cpython-314.pyc +0 -0
- package/hooks/__pycache__/enforce-deep-research.cpython-314.pyc +0 -0
- package/hooks/__pycache__/enforce-disambiguation.cpython-314.pyc +0 -0
- package/hooks/__pycache__/enforce-documentation.cpython-314.pyc +0 -0
- package/hooks/__pycache__/enforce-dry-run.cpython-314.pyc +0 -0
- package/hooks/__pycache__/enforce-environment.cpython-314.pyc +0 -0
- package/hooks/__pycache__/enforce-external-research.cpython-314.pyc +0 -0
- package/hooks/__pycache__/enforce-freshness.cpython-314.pyc +0 -0
- package/hooks/__pycache__/enforce-interview.cpython-314.pyc +0 -0
- package/hooks/__pycache__/enforce-page-components.cpython-314.pyc +0 -0
- package/hooks/__pycache__/enforce-page-data-schema.cpython-314.pyc +0 -0
- package/hooks/__pycache__/enforce-questions-sourced.cpython-314.pyc +0 -0
- package/hooks/__pycache__/enforce-refactor.cpython-314.pyc +0 -0
- package/hooks/__pycache__/enforce-research.cpython-314.pyc +0 -0
- package/hooks/__pycache__/enforce-schema-from-interview.cpython-314.pyc +0 -0
- package/hooks/__pycache__/enforce-schema.cpython-314.pyc +0 -0
- package/hooks/__pycache__/enforce-scope.cpython-314.pyc +0 -0
- package/hooks/__pycache__/enforce-tdd-red.cpython-314.pyc +0 -0
- package/hooks/__pycache__/enforce-ui-disambiguation.cpython-314.pyc +0 -0
- package/hooks/__pycache__/enforce-ui-interview.cpython-314.pyc +0 -0
- package/hooks/__pycache__/enforce-verify.cpython-314.pyc +0 -0
- package/hooks/__pycache__/generate-adr-options.cpython-314.pyc +0 -0
- package/hooks/__pycache__/generate-manifest-entry.cpython-314.pyc +0 -0
- package/hooks/__pycache__/hook_utils.cpython-314.pyc +0 -0
- package/hooks/__pycache__/notify-input-needed.cpython-314.pyc +0 -0
- package/hooks/__pycache__/notify-phase-complete.cpython-314.pyc +0 -0
- package/hooks/__pycache__/ntfy-on-question.cpython-314.pyc +0 -0
- package/hooks/__pycache__/orchestrator-completion.cpython-314.pyc +0 -0
- package/hooks/__pycache__/orchestrator-handoff.cpython-314.pyc +0 -0
- package/hooks/__pycache__/orchestrator-session-startup.cpython-314.pyc +0 -0
- package/hooks/__pycache__/parallel-orchestrator.cpython-314.pyc +0 -0
- package/hooks/__pycache__/periodic-reground.cpython-314.pyc +0 -0
- package/hooks/__pycache__/project-document-prompt.cpython-314.pyc +0 -0
- package/hooks/__pycache__/remote-question-proxy.cpython-314.pyc +0 -0
- package/hooks/__pycache__/remote-question-server.cpython-314.pyc +0 -0
- package/hooks/__pycache__/run-code-review.cpython-314.pyc +0 -0
- package/hooks/__pycache__/run-visual-qa.cpython-314.pyc +0 -0
- package/hooks/__pycache__/session-logger.cpython-314.pyc +0 -0
- package/hooks/__pycache__/session-startup.cpython-314.pyc +0 -0
- package/hooks/__pycache__/track-scope-coverage.cpython-314.pyc +0 -0
- package/hooks/__pycache__/track-token-usage.cpython-314.pyc +0 -0
- package/hooks/__pycache__/track-tool-use.cpython-314.pyc +0 -0
- package/hooks/__pycache__/update-adr-decision.cpython-314.pyc +0 -0
- package/hooks/__pycache__/update-api-showcase.cpython-314.pyc +0 -0
- package/hooks/__pycache__/update-registry.cpython-314.pyc +0 -0
- package/hooks/__pycache__/update-ui-showcase.cpython-314.pyc +0 -0
- package/hooks/__pycache__/verify-after-green.cpython-314.pyc +0 -0
- package/hooks/__pycache__/verify-implementation.cpython-314.pyc +0 -0
- package/hooks/api-workflow-check.py +34 -0
- package/hooks/auto-answer.py +305 -0
- package/hooks/check-update.py +132 -0
- package/hooks/completion-promise-detector.py +293 -0
- package/hooks/context-capacity-warning.py +171 -0
- package/hooks/docs-update-check.py +120 -0
- package/hooks/enforce-dry-run.py +134 -0
- package/hooks/enforce-external-research.py +25 -0
- package/hooks/enforce-interview.py +20 -0
- package/hooks/generate-adr-options.py +282 -0
- package/hooks/hook_utils.py +609 -0
- package/hooks/lib/__pycache__/__init__.cpython-314.pyc +0 -0
- package/hooks/lib/__pycache__/greptile.cpython-314.pyc +0 -0
- package/hooks/lib/__pycache__/ntfy.cpython-314.pyc +0 -0
- package/hooks/ntfy-on-question.py +240 -0
- package/hooks/orchestrator-completion.py +313 -0
- package/hooks/orchestrator-handoff.py +267 -0
- package/hooks/orchestrator-session-startup.py +146 -0
- package/hooks/parallel-orchestrator.py +451 -0
- package/hooks/periodic-reground.py +270 -67
- package/hooks/project-document-prompt.py +302 -0
- package/hooks/remote-question-proxy.py +284 -0
- package/hooks/remote-question-server.py +1224 -0
- package/hooks/run-code-review.py +176 -29
- package/hooks/run-visual-qa.py +338 -0
- package/hooks/session-logger.py +27 -1
- package/hooks/session-startup.py +113 -0
- package/hooks/update-adr-decision.py +236 -0
- package/hooks/update-api-showcase.py +13 -1
- package/hooks/update-testing-checklist.py +195 -0
- package/hooks/update-ui-showcase.py +13 -1
- package/package.json +7 -3
- package/scripts/extract-schema-docs.cjs +322 -0
- package/templates/.skills/hustle-interview/SKILL.md +174 -0
- package/templates/CLAUDE-SECTION.md +89 -64
- package/templates/adr-viewer/_components/ADRViewer.tsx +326 -0
- package/templates/api-dev-state.json +33 -1
- package/templates/api-showcase/_components/APIModal.tsx +100 -8
- package/templates/api-showcase/_components/APIShowcase.tsx +36 -4
- package/templates/api-showcase/_components/APITester.tsx +367 -58
- package/templates/brand-page/page.tsx +645 -0
- package/templates/component/Component.visual.spec.ts +30 -24
- package/templates/docs/page.tsx +230 -0
- package/templates/eslint-plugin-zod-schema/index.js +446 -0
- package/templates/eslint-plugin-zod-schema/package.json +26 -0
- package/templates/github-workflows/security.yml +274 -0
- package/templates/hustle-build-defaults.json +136 -0
- package/templates/hustle-dev-dashboard/page.tsx +365 -0
- package/templates/page/page.e2e.test.ts +30 -26
- package/templates/performance-budgets.json +63 -5
- package/templates/playwright-report/page.tsx +258 -0
- package/templates/registry.json +279 -3
- package/templates/review-dashboard/page.tsx +510 -0
- package/templates/settings.json +155 -7
- package/templates/test-results/page.tsx +237 -0
- package/templates/typedoc.json +19 -0
- package/templates/ui-showcase/_components/UIShowcase.tsx +48 -1
- package/templates/ui-showcase/_components/VisualTestingDashboard.tsx +579 -0
- package/templates/ui-showcase/page.tsx +1 -1
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: ralph-continue
|
|
3
|
+
description: Continue or resume a paused Ralph Wiggum autonomous loop from its last state
|
|
4
|
+
license: MIT
|
|
5
|
+
compatibility: Requires Claude Code with hook_utils.py
|
|
6
|
+
metadata:
|
|
7
|
+
version: "4.5.0"
|
|
8
|
+
category: "workflow"
|
|
9
|
+
tags: ['ralph', 'autonomous', 'loop', 'resume', 'continue']
|
|
10
|
+
author: "Hustle Together"
|
|
11
|
+
allowed-tools: Read Write Task
|
|
12
|
+
model: sonnet
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
# Ralph Continue
|
|
16
|
+
|
|
17
|
+
Resume a paused or interrupted Ralph Wiggum autonomous loop.
|
|
18
|
+
|
|
19
|
+
## Usage
|
|
20
|
+
|
|
21
|
+
```
|
|
22
|
+
/ralph-continue # Continue current workflow
|
|
23
|
+
/ralph-continue [workflow-id] # Resume specific workflow by ID
|
|
24
|
+
/ralph-continue --list # List resumable workflows
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## What It Does
|
|
28
|
+
|
|
29
|
+
1. **Clear Active Promise** - Removes any pending completion promise so the loop continues
|
|
30
|
+
2. **Reset Iteration Counter** - Optionally reset phase iterations if stuck
|
|
31
|
+
3. **Resume From Last State** - Pick up where the workflow left off
|
|
32
|
+
4. **Restore Archived Workflows** - Can restore from workflow-logs if session ended
|
|
33
|
+
|
|
34
|
+
## Examples
|
|
35
|
+
|
|
36
|
+
### Continue After Promise Detection
|
|
37
|
+
|
|
38
|
+
When a `<promise>DONE</promise>` was detected but you want to keep going:
|
|
39
|
+
|
|
40
|
+
```
|
|
41
|
+
/ralph-continue
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
This clears the active promise and lets the autonomous loop continue.
|
|
45
|
+
|
|
46
|
+
### Resume Interrupted Session
|
|
47
|
+
|
|
48
|
+
If your session ended mid-workflow:
|
|
49
|
+
|
|
50
|
+
```
|
|
51
|
+
/ralph-continue session-20251230-143022
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
This restores the workflow state from the archived log.
|
|
55
|
+
|
|
56
|
+
### List Available Workflows
|
|
57
|
+
|
|
58
|
+
```
|
|
59
|
+
/ralph-continue --list
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
Output:
|
|
63
|
+
```
|
|
64
|
+
┌─────────────────────────────────────────────────────────────────┐
|
|
65
|
+
│ RESUMABLE WORKFLOWS │
|
|
66
|
+
├─────────────────────────────────────────────────────────────────┤
|
|
67
|
+
│ │
|
|
68
|
+
│ Active: │
|
|
69
|
+
│ └─ session-20251230-150000 (user-api) - tdd_green phase │
|
|
70
|
+
│ │
|
|
71
|
+
│ Archived: │
|
|
72
|
+
│ └─ session-20251230-143022 - last activity: 14:45:00 │
|
|
73
|
+
│ └─ session-20251229-091500 - last activity: 09:30:00 (stale) │
|
|
74
|
+
│ │
|
|
75
|
+
└─────────────────────────────────────────────────────────────────┘
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
## Implementation
|
|
79
|
+
|
|
80
|
+
<claude-commands-template>
|
|
81
|
+
When /ralph-continue is invoked:
|
|
82
|
+
|
|
83
|
+
### Without Arguments (Continue Current)
|
|
84
|
+
|
|
85
|
+
1. Load completion-promises.json:
|
|
86
|
+
```python
|
|
87
|
+
promise_state = load_promise_state()
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
2. Clear active promise:
|
|
91
|
+
```python
|
|
92
|
+
promise_state['active_promise'] = None
|
|
93
|
+
save_promise_state(promise_state)
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
3. Load api-dev-state.json and find current phase
|
|
97
|
+
|
|
98
|
+
4. Output continuation message:
|
|
99
|
+
```
|
|
100
|
+
✓ Cleared active promise
|
|
101
|
+
✓ Continuing from phase: {current_phase}
|
|
102
|
+
✓ Iteration {current} / {max}
|
|
103
|
+
|
|
104
|
+
The autonomous loop will now continue.
|
|
105
|
+
Output <promise>DONE</promise> when complete.
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
5. If in autonomous mode, re-invoke the current phase skill
|
|
109
|
+
|
|
110
|
+
### With Workflow ID (Resume Specific)
|
|
111
|
+
|
|
112
|
+
1. Use hook_utils.handle_resume(workflow_id):
|
|
113
|
+
```python
|
|
114
|
+
from hook_utils import handle_resume
|
|
115
|
+
state, message = handle_resume(workflow_id)
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
2. If state found:
|
|
119
|
+
- Display what phase will resume
|
|
120
|
+
- Ask user to confirm
|
|
121
|
+
- If confirmed, re-invoke the workflow
|
|
122
|
+
|
|
123
|
+
3. If not found:
|
|
124
|
+
- Show error and list available workflows
|
|
125
|
+
|
|
126
|
+
### With --list Flag
|
|
127
|
+
|
|
128
|
+
1. Use hook_utils.list_resumable_workflows():
|
|
129
|
+
```python
|
|
130
|
+
from hook_utils import list_resumable_workflows
|
|
131
|
+
workflows = list_resumable_workflows()
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
2. Display formatted list as shown above
|
|
135
|
+
|
|
136
|
+
### Reset Iterations (Optional Flag)
|
|
137
|
+
|
|
138
|
+
If `--reset-iterations` is passed:
|
|
139
|
+
```python
|
|
140
|
+
from hook_utils import reset_phase_iterations
|
|
141
|
+
reset_phase_iterations()
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
This clears all iteration counters, useful if max-iterations was hit.
|
|
145
|
+
</claude-commands-template>
|
|
146
|
+
|
|
147
|
+
## Related Commands
|
|
148
|
+
|
|
149
|
+
- `/ralph-status` - Check current loop status
|
|
150
|
+
- `/api-create --resume [id]` - Resume with full workflow context
|
|
151
|
+
- `/hustle-build --resume [id]` - Resume build workflow
|
|
@@ -0,0 +1,341 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: ralph-loop
|
|
3
|
+
description: Start an autonomous loop with completion promise detection (Ralph Wiggum pattern)
|
|
4
|
+
license: MIT
|
|
5
|
+
compatibility: Requires Claude Code with completion-promise-detector hook
|
|
6
|
+
metadata:
|
|
7
|
+
version: "1.0.0"
|
|
8
|
+
category: "autonomous"
|
|
9
|
+
tags: ["ralph-wiggum", "autonomous", "loop", "continuous"]
|
|
10
|
+
author: "Hustle Together"
|
|
11
|
+
references:
|
|
12
|
+
- https://ghuntley.com/ralph/
|
|
13
|
+
- docs/CLAUDE_CODE_BEST_PRACTICES.md
|
|
14
|
+
allowed-tools: Bash Read Write Edit Grep Glob Task TodoWrite AskUserQuestion
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
# Ralph Wiggum Autonomous Loop
|
|
18
|
+
|
|
19
|
+
Start a self-terminating autonomous loop. The agent works continuously until it outputs a completion promise signal, then gracefully stops.
|
|
20
|
+
|
|
21
|
+
## Usage
|
|
22
|
+
|
|
23
|
+
```
|
|
24
|
+
/ralph-loop [task description]
|
|
25
|
+
/ralph-loop --promise [CUSTOM] [task description]
|
|
26
|
+
/ralph-loop --max [N] [task description]
|
|
27
|
+
/ralph-continue
|
|
28
|
+
/ralph-status
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## Arguments
|
|
32
|
+
|
|
33
|
+
- `$ARGUMENTS` - The task to complete autonomously
|
|
34
|
+
- `--promise [WORD]` - Custom completion word (default: DONE)
|
|
35
|
+
- `--max [N]` - Maximum iterations before forced stop (safety net)
|
|
36
|
+
|
|
37
|
+
## How It Works
|
|
38
|
+
|
|
39
|
+
```
|
|
40
|
+
┌─────────────────────────────────────────────────────────────────┐
|
|
41
|
+
│ RALPH WIGGUM PATTERN │
|
|
42
|
+
├─────────────────────────────────────────────────────────────────┤
|
|
43
|
+
│ │
|
|
44
|
+
│ ┌──────────────────────────────────────────────────────────┐ │
|
|
45
|
+
│ │ AUTONOMOUS LOOP │ │
|
|
46
|
+
│ │ │ │
|
|
47
|
+
│ │ 1. Agent works on task │ │
|
|
48
|
+
│ │ 2. Agent self-evaluates progress │ │
|
|
49
|
+
│ │ 3. If done → Output <promise>DONE</promise> │ │
|
|
50
|
+
│ │ 4. If not done → Continue working │ │
|
|
51
|
+
│ │ 5. Hook detects promise → Graceful termination │ │
|
|
52
|
+
│ │ │ │
|
|
53
|
+
│ └──────────────────────────────────────────────────────────┘ │
|
|
54
|
+
│ │ │
|
|
55
|
+
│ ▼ │
|
|
56
|
+
│ ┌──────────────────────────────────────────────────────────┐ │
|
|
57
|
+
│ │ COMPLETION PROMISE DETECTOR │ │
|
|
58
|
+
│ │ │ │
|
|
59
|
+
│ │ Monitors all tool outputs for: │ │
|
|
60
|
+
│ │ - <promise>DONE</promise> │ │
|
|
61
|
+
│ │ - <promise>FIXED</promise> │ │
|
|
62
|
+
│ │ - <promise>COMPLETE</promise> │ │
|
|
63
|
+
│ │ - Custom promises via --promise flag │ │
|
|
64
|
+
│ │ │ │
|
|
65
|
+
│ └──────────────────────────────────────────────────────────┘ │
|
|
66
|
+
│ │
|
|
67
|
+
└─────────────────────────────────────────────────────────────────┘
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
## Built-in Completion Promises
|
|
71
|
+
|
|
72
|
+
| Promise | Use Case |
|
|
73
|
+
|---------|----------|
|
|
74
|
+
| `DONE` / `COMPLETE` / `FINISHED` | General task completion |
|
|
75
|
+
| `FIXED` / `RESOLVED` / `SOLVED` | Bug fixing |
|
|
76
|
+
| `REFACTORED` / `CLEANED` / `IMPROVED` | Code improvement |
|
|
77
|
+
| `TESTED` / `VERIFIED` / `VALIDATED` | Testing tasks |
|
|
78
|
+
| `DEPLOYED` / `SHIPPED` / `RELEASED` | Deployment tasks |
|
|
79
|
+
|
|
80
|
+
## Phase 1: Parse Arguments
|
|
81
|
+
|
|
82
|
+
Extract from `$ARGUMENTS`:
|
|
83
|
+
|
|
84
|
+
1. **Task Description** - What to accomplish
|
|
85
|
+
2. **Custom Promise** - If `--promise` specified
|
|
86
|
+
3. **Max Iterations** - If `--max` specified
|
|
87
|
+
|
|
88
|
+
## Phase 2: Initialize Loop
|
|
89
|
+
|
|
90
|
+
1. **Create Todo List:**
|
|
91
|
+
- Main task objective
|
|
92
|
+
- Sub-tasks as identified
|
|
93
|
+
|
|
94
|
+
2. **Set Loop Parameters:**
|
|
95
|
+
```json
|
|
96
|
+
{
|
|
97
|
+
"task": "[description]",
|
|
98
|
+
"completion_promise": "DONE",
|
|
99
|
+
"max_iterations": null,
|
|
100
|
+
"started_at": "[timestamp]",
|
|
101
|
+
"iteration": 0
|
|
102
|
+
}
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
3. **Output Initialization:**
|
|
106
|
+
```
|
|
107
|
+
═══════════════════════════════════════════════════════════════
|
|
108
|
+
RALPH WIGGUM LOOP STARTED
|
|
109
|
+
═══════════════════════════════════════════════════════════════
|
|
110
|
+
|
|
111
|
+
Task: [description]
|
|
112
|
+
Completion Signal: <promise>DONE</promise>
|
|
113
|
+
Max Iterations: [N or unlimited]
|
|
114
|
+
|
|
115
|
+
The loop will continue until you output the completion signal.
|
|
116
|
+
Use /ralph-status to check progress.
|
|
117
|
+
Use /ralph-continue to override a detected promise.
|
|
118
|
+
═══════════════════════════════════════════════════════════════
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
## Phase 3: Execute Loop
|
|
122
|
+
|
|
123
|
+
Work on the task using this pattern:
|
|
124
|
+
|
|
125
|
+
```markdown
|
|
126
|
+
## Iteration [N]
|
|
127
|
+
|
|
128
|
+
### Current State
|
|
129
|
+
- What has been done
|
|
130
|
+
- What remains
|
|
131
|
+
|
|
132
|
+
### This Iteration
|
|
133
|
+
1. [Action 1]
|
|
134
|
+
2. [Action 2]
|
|
135
|
+
3. [Action 3]
|
|
136
|
+
|
|
137
|
+
### Self-Evaluation
|
|
138
|
+
- [ ] Task requirement 1 met?
|
|
139
|
+
- [ ] Task requirement 2 met?
|
|
140
|
+
- [ ] All tests passing?
|
|
141
|
+
- [ ] Code review clean?
|
|
142
|
+
|
|
143
|
+
### Decision
|
|
144
|
+
If ALL requirements met:
|
|
145
|
+
→ Output: <promise>DONE</promise>
|
|
146
|
+
Else:
|
|
147
|
+
→ Continue to next iteration
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
## Phase 4: Completion
|
|
151
|
+
|
|
152
|
+
When outputting a completion promise:
|
|
153
|
+
|
|
154
|
+
```markdown
|
|
155
|
+
## Task Complete
|
|
156
|
+
|
|
157
|
+
### Summary
|
|
158
|
+
- What was accomplished
|
|
159
|
+
- Files changed
|
|
160
|
+
- Tests status
|
|
161
|
+
|
|
162
|
+
### Verification
|
|
163
|
+
- [x] Requirement 1
|
|
164
|
+
- [x] Requirement 2
|
|
165
|
+
- [x] All tests pass
|
|
166
|
+
|
|
167
|
+
<promise>DONE</promise>
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
The hook will detect this and allow graceful termination.
|
|
171
|
+
|
|
172
|
+
---
|
|
173
|
+
|
|
174
|
+
## Example Prompts
|
|
175
|
+
|
|
176
|
+
### Feature Development
|
|
177
|
+
```
|
|
178
|
+
/ralph-loop "Implement user authentication with JWT tokens
|
|
179
|
+
|
|
180
|
+
Requirements:
|
|
181
|
+
- Login endpoint at /api/auth/login
|
|
182
|
+
- Register endpoint at /api/auth/register
|
|
183
|
+
- JWT token generation and validation
|
|
184
|
+
- Password hashing with bcrypt
|
|
185
|
+
- All tests passing
|
|
186
|
+
|
|
187
|
+
Output <promise>DONE</promise> when all requirements met and tests pass."
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
### Bug Fixing
|
|
191
|
+
```
|
|
192
|
+
/ralph-loop --promise FIXED "Fix the memory leak in the WebSocket handler
|
|
193
|
+
|
|
194
|
+
Steps:
|
|
195
|
+
1. Identify the leak source
|
|
196
|
+
2. Implement fix
|
|
197
|
+
3. Add regression test
|
|
198
|
+
4. Verify with memory profiler
|
|
199
|
+
|
|
200
|
+
Output <promise>FIXED</promise> when the leak is resolved."
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
### Refactoring
|
|
204
|
+
```
|
|
205
|
+
/ralph-loop --max 25 "Refactor the payment module to use the new API client
|
|
206
|
+
|
|
207
|
+
Checklist:
|
|
208
|
+
- [ ] Update all API calls
|
|
209
|
+
- [ ] Maintain backward compatibility
|
|
210
|
+
- [ ] Update tests
|
|
211
|
+
- [ ] Update documentation
|
|
212
|
+
|
|
213
|
+
Output <promise>REFACTORED</promise> when complete."
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
---
|
|
217
|
+
|
|
218
|
+
## Commands
|
|
219
|
+
|
|
220
|
+
### /ralph-continue
|
|
221
|
+
|
|
222
|
+
Override a detected promise and continue the loop:
|
|
223
|
+
|
|
224
|
+
```
|
|
225
|
+
/ralph-continue
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
Use when:
|
|
229
|
+
- Promise was output prematurely
|
|
230
|
+
- More work needed despite signal
|
|
231
|
+
- Testing the loop behavior
|
|
232
|
+
|
|
233
|
+
### /ralph-status
|
|
234
|
+
|
|
235
|
+
Check current loop status:
|
|
236
|
+
|
|
237
|
+
```
|
|
238
|
+
/ralph-status
|
|
239
|
+
```
|
|
240
|
+
|
|
241
|
+
Shows:
|
|
242
|
+
- Active promise (if any)
|
|
243
|
+
- Recent promise history
|
|
244
|
+
- Current iteration count
|
|
245
|
+
|
|
246
|
+
---
|
|
247
|
+
|
|
248
|
+
## Best Practices
|
|
249
|
+
|
|
250
|
+
### 1. Clear Requirements
|
|
251
|
+
|
|
252
|
+
Always specify clear, verifiable requirements:
|
|
253
|
+
|
|
254
|
+
```markdown
|
|
255
|
+
Requirements:
|
|
256
|
+
- [ ] Feature X implemented
|
|
257
|
+
- [ ] Unit tests with >80% coverage
|
|
258
|
+
- [ ] E2E test for happy path
|
|
259
|
+
- [ ] No TypeScript errors
|
|
260
|
+
- [ ] ESLint passing
|
|
261
|
+
```
|
|
262
|
+
|
|
263
|
+
### 2. Self-Evaluation Checkpoints
|
|
264
|
+
|
|
265
|
+
Include explicit checkpoints in your prompt:
|
|
266
|
+
|
|
267
|
+
```markdown
|
|
268
|
+
Before outputting DONE, verify:
|
|
269
|
+
1. All requirements in the list above are checked
|
|
270
|
+
2. `pnpm test` passes
|
|
271
|
+
3. `pnpm lint` passes
|
|
272
|
+
4. `pnpm build` succeeds
|
|
273
|
+
```
|
|
274
|
+
|
|
275
|
+
### 3. Use Max Iterations as Safety Net
|
|
276
|
+
|
|
277
|
+
Always set a reasonable max for complex tasks:
|
|
278
|
+
|
|
279
|
+
```
|
|
280
|
+
/ralph-loop --max 50 "Complex refactoring task..."
|
|
281
|
+
```
|
|
282
|
+
|
|
283
|
+
### 4. Combine with Test Skills
|
|
284
|
+
|
|
285
|
+
```
|
|
286
|
+
/ralph-loop "Implement feature X
|
|
287
|
+
|
|
288
|
+
After implementation, run:
|
|
289
|
+
- /test-unit
|
|
290
|
+
- /test-e2e
|
|
291
|
+
|
|
292
|
+
Only output <promise>DONE</promise> when ALL tests pass."
|
|
293
|
+
```
|
|
294
|
+
|
|
295
|
+
---
|
|
296
|
+
|
|
297
|
+
## Integration with Hustle Build
|
|
298
|
+
|
|
299
|
+
The `/hustle-build --auto` mode uses Ralph Wiggum internally:
|
|
300
|
+
|
|
301
|
+
```
|
|
302
|
+
/hustle-build --auto --max-iterations 10 "Build a photo gallery"
|
|
303
|
+
```
|
|
304
|
+
|
|
305
|
+
This:
|
|
306
|
+
1. Starts autonomous build loop
|
|
307
|
+
2. Uses completion promise detection
|
|
308
|
+
3. Falls back to max-iterations if needed
|
|
309
|
+
|
|
310
|
+
---
|
|
311
|
+
|
|
312
|
+
## Troubleshooting
|
|
313
|
+
|
|
314
|
+
### Promise Not Detected
|
|
315
|
+
|
|
316
|
+
Ensure exact format: `<promise>DONE</promise>`
|
|
317
|
+
- Must have angle brackets
|
|
318
|
+
- Must be uppercase
|
|
319
|
+
- No extra whitespace inside tags
|
|
320
|
+
|
|
321
|
+
### Loop Won't Stop
|
|
322
|
+
|
|
323
|
+
Check:
|
|
324
|
+
1. `/ralph-status` - Is promise active?
|
|
325
|
+
2. Hook enabled in settings?
|
|
326
|
+
3. Try `/ralph-continue` then manually stop
|
|
327
|
+
|
|
328
|
+
### Infinite Loop
|
|
329
|
+
|
|
330
|
+
Safety measures:
|
|
331
|
+
1. Use `--max [N]` flag
|
|
332
|
+
2. Context window will eventually fill
|
|
333
|
+
3. Manual Ctrl+C always works
|
|
334
|
+
|
|
335
|
+
---
|
|
336
|
+
|
|
337
|
+
## See Also
|
|
338
|
+
|
|
339
|
+
- [Completion Promise Detector Hook](../../hooks/completion-promise-detector.py)
|
|
340
|
+
- [CLAUDE_CODE_BEST_PRACTICES.md](../../docs/CLAUDE_CODE_BEST_PRACTICES.md) - Ralph Wiggum section
|
|
341
|
+
- [/hustle-build skill](../hustle-build/SKILL.md) - Uses this pattern internally
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: ralph-status
|
|
3
|
+
description: Show current Ralph Wiggum loop status - phase, iteration count, elapsed time, and promises emitted
|
|
4
|
+
license: MIT
|
|
5
|
+
compatibility: Requires Claude Code with hook_utils.py
|
|
6
|
+
metadata:
|
|
7
|
+
version: "4.5.0"
|
|
8
|
+
category: "workflow"
|
|
9
|
+
tags: ['ralph', 'autonomous', 'loop', 'status']
|
|
10
|
+
author: "Hustle Together"
|
|
11
|
+
allowed-tools: Read
|
|
12
|
+
model: haiku
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
# Ralph Status
|
|
16
|
+
|
|
17
|
+
Show the current status of autonomous Ralph Wiggum loops.
|
|
18
|
+
|
|
19
|
+
## Usage
|
|
20
|
+
|
|
21
|
+
```
|
|
22
|
+
/ralph-status
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## What It Shows
|
|
26
|
+
|
|
27
|
+
1. **Current Phase** - Which workflow phase is active
|
|
28
|
+
2. **Iteration Count** - How many iterations in current phase
|
|
29
|
+
3. **Max Iterations** - The limit before safety cutoff
|
|
30
|
+
4. **Active Promise** - Any completion promise waiting to be fulfilled
|
|
31
|
+
5. **Recent History** - Last 5 promise detections
|
|
32
|
+
6. **Elapsed Time** - How long the current session has been running
|
|
33
|
+
|
|
34
|
+
## Output Format
|
|
35
|
+
|
|
36
|
+
```
|
|
37
|
+
┌─────────────────────────────────────────────────────────────────┐
|
|
38
|
+
│ RALPH WIGGUM STATUS │
|
|
39
|
+
├─────────────────────────────────────────────────────────────────┤
|
|
40
|
+
│ │
|
|
41
|
+
│ Workflow ID: session-20251230-143022 │
|
|
42
|
+
│ Current Phase: tdd_green │
|
|
43
|
+
│ Iteration: 7 / 25 (max) │
|
|
44
|
+
│ Active Promise: None │
|
|
45
|
+
│ Elapsed: 12m 34s │
|
|
46
|
+
│ │
|
|
47
|
+
│ Recent Promises: │
|
|
48
|
+
│ └─ DONE via Write at 14:28:15 │
|
|
49
|
+
│ └─ TESTED via Bash at 14:25:42 │
|
|
50
|
+
│ │
|
|
51
|
+
│ Phase Iterations: │
|
|
52
|
+
│ └─ tdd_red: 3 │
|
|
53
|
+
│ └─ tdd_green: 7 │
|
|
54
|
+
│ │
|
|
55
|
+
└─────────────────────────────────────────────────────────────────┘
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
## Implementation
|
|
59
|
+
|
|
60
|
+
<claude-commands-template>
|
|
61
|
+
When /ralph-status is invoked:
|
|
62
|
+
|
|
63
|
+
1. Read the workflow state files:
|
|
64
|
+
- `.claude/api-dev-state.json` - Main workflow state
|
|
65
|
+
- `.claude/completion-promises.json` - Ralph loop state
|
|
66
|
+
|
|
67
|
+
2. Extract and display:
|
|
68
|
+
- workflow_id from state
|
|
69
|
+
- Current phase from state.phases (find "in_progress")
|
|
70
|
+
- phase_iterations from state
|
|
71
|
+
- active_promise from completion-promises.json
|
|
72
|
+
- history from completion-promises.json (last 5)
|
|
73
|
+
|
|
74
|
+
3. Calculate elapsed time:
|
|
75
|
+
- Read workflow log from `.claude/workflow-logs/{workflow_id}.json`
|
|
76
|
+
- Get started_at timestamp
|
|
77
|
+
- Calculate difference from now
|
|
78
|
+
|
|
79
|
+
4. Format output as shown above
|
|
80
|
+
|
|
81
|
+
5. If no active workflow:
|
|
82
|
+
```
|
|
83
|
+
No active workflow. Start one with:
|
|
84
|
+
- /api-create [endpoint]
|
|
85
|
+
- /hustle-build [prompt]
|
|
86
|
+
```
|
|
87
|
+
</claude-commands-template>
|
|
@@ -150,3 +150,62 @@ This phase is **not part of the regular TDD workflow** and must only be applied
|
|
|
150
150
|
- Testing notes
|
|
151
151
|
- Document expected behavior and edge cases
|
|
152
152
|
- Include real-world output examples
|
|
153
|
+
|
|
154
|
+
## Autonomous Loop Completion (Ralph Wiggum Pattern)
|
|
155
|
+
|
|
156
|
+
When running in autonomous mode (`--auto` flag or `/ralph-loop`), this skill supports
|
|
157
|
+
self-terminating loops for iterative refactoring cycles.
|
|
158
|
+
|
|
159
|
+
### Promise Signal
|
|
160
|
+
|
|
161
|
+
After completing refactoring and verifying tests still pass, output:
|
|
162
|
+
|
|
163
|
+
```
|
|
164
|
+
<promise>REFACTORED</promise>
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
This signal is detected by the `completion-promise-detector.py` hook, which:
|
|
168
|
+
1. Records the promise in `.claude/completion-promises.json`
|
|
169
|
+
2. Allows graceful workflow termination
|
|
170
|
+
3. Prevents infinite refactoring loops
|
|
171
|
+
|
|
172
|
+
### When to Output the Promise
|
|
173
|
+
|
|
174
|
+
Output `<promise>REFACTORED</promise>` when:
|
|
175
|
+
- All identified refactoring opportunities have been addressed
|
|
176
|
+
- Tests are still passing (verify with `pnpm test`)
|
|
177
|
+
- No additional cleanup is needed
|
|
178
|
+
- Code meets project quality standards
|
|
179
|
+
|
|
180
|
+
### Iterative Refactor Loop
|
|
181
|
+
|
|
182
|
+
```
|
|
183
|
+
┌─────────────────────────────────────────────────────────────────┐
|
|
184
|
+
│ REFACTOR LOOP (Ralph Wiggum) │
|
|
185
|
+
├─────────────────────────────────────────────────────────────────┤
|
|
186
|
+
│ │
|
|
187
|
+
│ 1. Identify refactoring opportunities │
|
|
188
|
+
│ └─ Code smells, duplication, complexity │
|
|
189
|
+
│ │
|
|
190
|
+
│ 2. Apply refactoring │
|
|
191
|
+
│ └─ Run tests → Failing? → Fix before continuing │
|
|
192
|
+
│ │
|
|
193
|
+
│ 3. Review result │
|
|
194
|
+
│ └─ More opportunities? → Loop back to step 1 │
|
|
195
|
+
│ │
|
|
196
|
+
│ 4. All clean? │
|
|
197
|
+
│ └─ Output: <promise>REFACTORED</promise> │
|
|
198
|
+
│ └─ Hook detects → Workflow terminates gracefully │
|
|
199
|
+
│ │
|
|
200
|
+
└─────────────────────────────────────────────────────────────────┘
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
**Credit:** Ralph Wiggum pattern by [Geoffrey Huntley](https://ghuntley.com/ralph/)
|
|
204
|
+
|
|
205
|
+
## See Also
|
|
206
|
+
|
|
207
|
+
- `/red` - Write failing tests
|
|
208
|
+
- `/green` - Minimal implementation
|
|
209
|
+
- `/cycle` - Full TDD cycle
|
|
210
|
+
- `/ralph-loop` - Autonomous loop execution
|
|
211
|
+
- [docs/AUTONOMOUS_LOOPS.md](../../docs/AUTONOMOUS_LOOPS.md) - Pattern documentation
|