@sureshsankaran/ralph-wiggum 0.2.1 → 0.3.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/README.md +71 -0
- package/package.json +5 -19
- package/src/index.ts +767 -0
- package/tsconfig.json +14 -0
- package/dist/index.d.ts +0 -68
- package/dist/index.js +0 -620
package/README.md
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
# Ralph Wiggum Plugin for OpenCode
|
|
2
|
+
|
|
3
|
+
Implements the Ralph Wiggum technique for iterative, self-referential AI development loops.
|
|
4
|
+
|
|
5
|
+
Based on: https://github.com/anthropics/claude-code/tree/main/plugins/ralph-wiggum
|
|
6
|
+
|
|
7
|
+
## Usage
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
ralph-loop "Your task here" --max 8 --promise "DONE"
|
|
11
|
+
ralph-loop "Your task here" --max 8 --promise "DONE" --state-file /custom/path.json
|
|
12
|
+
ralph-loop "Your task here" --no-state # Disable state file
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## How It Works
|
|
16
|
+
|
|
17
|
+
The loop will:
|
|
18
|
+
|
|
19
|
+
1. Execute the prompt
|
|
20
|
+
2. Continue iterating until max iterations OR completion promise is found
|
|
21
|
+
3. Feed the SAME original prompt back each iteration
|
|
22
|
+
4. Show iteration count in system message
|
|
23
|
+
5. Write state to `~/.config/opencode/state/ralph-wiggum.json` (or custom path) for verification
|
|
24
|
+
|
|
25
|
+
## Review System
|
|
26
|
+
|
|
27
|
+
The plugin includes a review system with three phases:
|
|
28
|
+
|
|
29
|
+
- **working**: Initial phase where the task is executed
|
|
30
|
+
- **review**: After completion, changes are reviewed for quality
|
|
31
|
+
- **fix**: If issues are found, fixes are applied before re-review
|
|
32
|
+
|
|
33
|
+
## State File
|
|
34
|
+
|
|
35
|
+
The state file includes:
|
|
36
|
+
|
|
37
|
+
- `sessionID`: Current session identifier
|
|
38
|
+
- `active`: Whether the loop is running
|
|
39
|
+
- `prompt`: The original prompt
|
|
40
|
+
- `iterations`: Current iteration count
|
|
41
|
+
- `max`: Maximum iterations allowed
|
|
42
|
+
- `status`: Current status (`running`, `completed`, `cancelled`, `max_reached`, `approved`, `max_reviews_reached`)
|
|
43
|
+
- `phase`: Current phase (`working`, `review`, `fix`)
|
|
44
|
+
- `reviewCount`: Number of review cycles
|
|
45
|
+
- `maxReviews`: Maximum review cycles allowed (default: 5)
|
|
46
|
+
|
|
47
|
+
## Environment Variables
|
|
48
|
+
|
|
49
|
+
### OPENCODE_SKIP_LOCAL_RALPH
|
|
50
|
+
|
|
51
|
+
Set this environment variable to skip loading the local plugin version. This is useful when:
|
|
52
|
+
|
|
53
|
+
- You have the plugin symlinked locally for development
|
|
54
|
+
- But want to use a global plugin version on certain machines
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
# Add to ~/.zshrc or ~/.bashrc
|
|
58
|
+
export OPENCODE_SKIP_LOCAL_RALPH=1
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
When set, the local plugin will be skipped, allowing the global plugin to take precedence.
|
|
62
|
+
|
|
63
|
+
## Development
|
|
64
|
+
|
|
65
|
+
When developing this plugin locally, you can symlink it into your project's `.opencode/plugins/` directory:
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
ln -s ../../../../ralph-wiggum/src/index.ts .opencode/plugins/ralph-wiggum.ts
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
This allows changes to the plugin source to be immediately available without copying files.
|
package/package.json
CHANGED
|
@@ -1,19 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sureshsankaran/ralph-wiggum",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "Ralph Wiggum plugin for OpenCode - iterative, self-referential AI development loops",
|
|
5
5
|
"type": "module",
|
|
6
|
-
"main": "
|
|
7
|
-
"types": "
|
|
8
|
-
"exports": {
|
|
9
|
-
".": {
|
|
10
|
-
"import": "./dist/index.js",
|
|
11
|
-
"types": "./dist/index.d.ts"
|
|
12
|
-
}
|
|
13
|
-
},
|
|
14
|
-
"files": [
|
|
15
|
-
"dist"
|
|
16
|
-
],
|
|
6
|
+
"main": "src/index.ts",
|
|
7
|
+
"types": "src/index.ts",
|
|
17
8
|
"keywords": [
|
|
18
9
|
"opencode",
|
|
19
10
|
"plugin",
|
|
@@ -30,16 +21,11 @@
|
|
|
30
21
|
"directory": "packages/ralph-wiggum"
|
|
31
22
|
},
|
|
32
23
|
"scripts": {
|
|
33
|
-
"typecheck": "tsc --noEmit"
|
|
34
|
-
"build": "tsc"
|
|
24
|
+
"typecheck": "tsc --noEmit"
|
|
35
25
|
},
|
|
36
26
|
"dependencies": {},
|
|
37
27
|
"devDependencies": {
|
|
38
28
|
"typescript": "^5.8.3",
|
|
39
|
-
"@types/node": "^20.0.0"
|
|
40
|
-
"@types/bun": "^1.1.0"
|
|
41
|
-
},
|
|
42
|
-
"peerDependencies": {
|
|
43
|
-
"bun": ">=1.0.0"
|
|
29
|
+
"@types/node": "^20.0.0"
|
|
44
30
|
}
|
|
45
31
|
}
|