openralph 0.0.4 → 1.0.13
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 +13 -2
- package/bin/ralph +27 -9
- package/package.json +6 -9
- package/postinstall.mjs +0 -145
package/README.md
CHANGED
|
@@ -97,15 +97,23 @@ ralph init --from plan.md # convert unstructured plan to PRD JSON
|
|
|
97
97
|
### Init Subcommand
|
|
98
98
|
|
|
99
99
|
```bash
|
|
100
|
-
ralph init # create template PRD and
|
|
100
|
+
ralph init # create template PRD, prompt, plugin, and AGENTS.md
|
|
101
101
|
ralph init --from plan.md # convert markdown plan to PRD JSON
|
|
102
102
|
ralph init --force # overwrite existing files
|
|
103
103
|
```
|
|
104
104
|
|
|
105
|
+
The `init` command creates:
|
|
106
|
+
- `prd.json` - PRD plan file (wrapped format with metadata)
|
|
107
|
+
- `progress.txt` - Progress log
|
|
108
|
+
- `.ralph-prompt.md` - Prompt template
|
|
109
|
+
- `.opencode/plugin/ralph-write-guardrail.ts` - Write guardrail plugin
|
|
110
|
+
- `AGENTS.md` - Project configuration for AI agents (never overwritten)
|
|
111
|
+
- `.gitignore` entries - Adds Ralph runtime files to .gitignore
|
|
112
|
+
|
|
105
113
|
| Option | Description |
|
|
106
114
|
|--------|-------------|
|
|
107
115
|
| `--from` | Source plan or notes to convert into PRD JSON |
|
|
108
|
-
| `--force` | Overwrite existing files |
|
|
116
|
+
| `--force` | Overwrite existing files (except AGENTS.md) |
|
|
109
117
|
|
|
110
118
|
**Default prompt:**
|
|
111
119
|
```
|
|
@@ -150,6 +158,8 @@ Ralph supports multiple adapters for running the AI agent:
|
|
|
150
158
|
| `.ralph-lock` | Prevents multiple instances |
|
|
151
159
|
| `.ralph-done` | Agent creates this when all tasks complete |
|
|
152
160
|
| `.ralph-pause` | Created by `p` key to pause loop |
|
|
161
|
+
| `.opencode/plugin/ralph-write-guardrail.ts` | Protects files from AI modification |
|
|
162
|
+
| `AGENTS.md` | Project configuration for AI agents |
|
|
153
163
|
|
|
154
164
|
**Generated file markers:** Files created by `ralph init` include markers so `ralph --reset` can identify and remove them safely without touching user-created files:
|
|
155
165
|
- `prd.json`: Wrapped with `{ metadata: { generated: true, ... }, items: [...] }`
|
|
@@ -243,6 +253,7 @@ Ralph writes operational learnings here. Future iterations read it.
|
|
|
243
253
|
| `:` | Steering mode (send message to agent) |
|
|
244
254
|
| `t` | Launch terminal with attach command |
|
|
245
255
|
| `Shift+T` | Toggle tasks panel |
|
|
256
|
+
| `Shift+C` | Toggle completed tasks / Copy attach command |
|
|
246
257
|
| `o` | Toggle Details/Output view |
|
|
247
258
|
| `d` | Toggle progress dashboard |
|
|
248
259
|
| `?` | Show help overlay |
|
package/bin/ralph
CHANGED
|
@@ -8,6 +8,7 @@ import { fileURLToPath } from "node:url";
|
|
|
8
8
|
|
|
9
9
|
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
10
10
|
const require = createRequire(import.meta.url);
|
|
11
|
+
const projectRoot = path.resolve(__dirname, "..");
|
|
11
12
|
|
|
12
13
|
const platformMap = {
|
|
13
14
|
darwin: "darwin",
|
|
@@ -26,18 +27,35 @@ const packageName = `openralph-${platform}-${arch}`;
|
|
|
26
27
|
const binaryName = platform === "windows" ? "ralph.exe" : "ralph";
|
|
27
28
|
|
|
28
29
|
let binaryPath;
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
30
|
+
|
|
31
|
+
// First, check for locally built binary in dist/ directory
|
|
32
|
+
const localBinaryPath = path.join(projectRoot, "dist", packageName, "bin", binaryName);
|
|
33
|
+
if (fs.existsSync(localBinaryPath)) {
|
|
34
|
+
binaryPath = localBinaryPath;
|
|
35
|
+
} else {
|
|
36
|
+
// Fall back to npm package resolution for installed packages
|
|
37
|
+
try {
|
|
38
|
+
const packageJsonPath = require.resolve(`${packageName}/package.json`);
|
|
39
|
+
const packageDir = path.dirname(packageJsonPath);
|
|
40
|
+
binaryPath = path.join(packageDir, "bin", binaryName);
|
|
41
|
+
} catch (error) {
|
|
42
|
+
// No local build and no npm package found
|
|
43
|
+
console.error(`Error: No ralph binary found for ${platform}-${arch}.`);
|
|
44
|
+
console.error("");
|
|
45
|
+
console.error("To fix this, run:");
|
|
46
|
+
console.error(" bun run build:single # Build for current platform");
|
|
47
|
+
console.error("");
|
|
48
|
+
console.error("Or install globally:");
|
|
49
|
+
console.error(" bun install -g openralph");
|
|
50
|
+
process.exit(1);
|
|
51
|
+
}
|
|
37
52
|
}
|
|
38
53
|
|
|
39
54
|
if (!fs.existsSync(binaryPath)) {
|
|
40
|
-
console.error(`Binary not found at ${binaryPath}`);
|
|
55
|
+
console.error(`Error: Binary not found at ${binaryPath}`);
|
|
56
|
+
console.error("");
|
|
57
|
+
console.error("To fix this, run:");
|
|
58
|
+
console.error(" bun run build:single # Rebuild for current platform");
|
|
41
59
|
process.exit(1);
|
|
42
60
|
}
|
|
43
61
|
|
package/package.json
CHANGED
|
@@ -1,19 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "openralph",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "1.0.13",
|
|
4
4
|
"description": "Ralph Driven Development using OpenCode SDK and OpenTUI",
|
|
5
5
|
"bin": {
|
|
6
6
|
"ralph": "./bin/ralph"
|
|
7
7
|
},
|
|
8
|
-
"scripts": {
|
|
9
|
-
"postinstall": "node ./postinstall.mjs"
|
|
10
|
-
},
|
|
11
8
|
"optionalDependencies": {
|
|
12
|
-
"openralph-darwin-arm64": "
|
|
13
|
-
"openralph-darwin-x64": "
|
|
14
|
-
"openralph-linux-arm64": "
|
|
15
|
-
"openralph-linux-x64": "
|
|
16
|
-
"openralph-windows-x64": "
|
|
9
|
+
"openralph-darwin-arm64": "1.0.13",
|
|
10
|
+
"openralph-darwin-x64": "1.0.13",
|
|
11
|
+
"openralph-linux-arm64": "1.0.13",
|
|
12
|
+
"openralph-linux-x64": "1.0.13",
|
|
13
|
+
"openralph-windows-x64": "1.0.13"
|
|
17
14
|
},
|
|
18
15
|
"repository": {
|
|
19
16
|
"type": "git",
|
package/postinstall.mjs
DELETED
|
@@ -1,145 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
/**
|
|
3
|
-
* Postinstall script for openralph
|
|
4
|
-
*
|
|
5
|
-
* This script runs after `bun install -g openralph` and symlinks the
|
|
6
|
-
* platform-specific binary to the bin directory.
|
|
7
|
-
*
|
|
8
|
-
* On Windows, npm handles the .exe directly so we skip symlinking.
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
import fs from "fs";
|
|
12
|
-
import path from "path";
|
|
13
|
-
import os from "os";
|
|
14
|
-
import { fileURLToPath } from "url";
|
|
15
|
-
import { createRequire } from "module";
|
|
16
|
-
|
|
17
|
-
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
18
|
-
const require = createRequire(import.meta.url);
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* Detect the current platform and architecture
|
|
22
|
-
*/
|
|
23
|
-
function detectPlatformAndArch() {
|
|
24
|
-
let platform;
|
|
25
|
-
switch (os.platform()) {
|
|
26
|
-
case "darwin":
|
|
27
|
-
platform = "darwin";
|
|
28
|
-
break;
|
|
29
|
-
case "linux":
|
|
30
|
-
platform = "linux";
|
|
31
|
-
break;
|
|
32
|
-
case "win32":
|
|
33
|
-
platform = "windows";
|
|
34
|
-
break;
|
|
35
|
-
default:
|
|
36
|
-
platform = os.platform();
|
|
37
|
-
break;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
let arch;
|
|
41
|
-
switch (os.arch()) {
|
|
42
|
-
case "x64":
|
|
43
|
-
arch = "x64";
|
|
44
|
-
break;
|
|
45
|
-
case "arm64":
|
|
46
|
-
arch = "arm64";
|
|
47
|
-
break;
|
|
48
|
-
default:
|
|
49
|
-
arch = os.arch();
|
|
50
|
-
break;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
return { platform, arch };
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
/**
|
|
57
|
-
* Find the platform-specific binary package
|
|
58
|
-
*/
|
|
59
|
-
function findBinary() {
|
|
60
|
-
const { platform, arch } = detectPlatformAndArch();
|
|
61
|
-
const packageName = `openralph-${platform}-${arch}`;
|
|
62
|
-
const binaryName = platform === "windows" ? "ralph.exe" : "ralph";
|
|
63
|
-
|
|
64
|
-
try {
|
|
65
|
-
// Use require.resolve to find the package
|
|
66
|
-
const packageJsonPath = require.resolve(`${packageName}/package.json`);
|
|
67
|
-
const packageDir = path.dirname(packageJsonPath);
|
|
68
|
-
const binaryPath = path.join(packageDir, "bin", binaryName);
|
|
69
|
-
|
|
70
|
-
if (!fs.existsSync(binaryPath)) {
|
|
71
|
-
throw new Error(`Binary not found at ${binaryPath}`);
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
return { binaryPath, binaryName, packageName };
|
|
75
|
-
} catch (error) {
|
|
76
|
-
throw new Error(`Could not find package ${packageName}: ${error.message}`);
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
/**
|
|
81
|
-
* Prepare the bin directory and return paths
|
|
82
|
-
*/
|
|
83
|
-
function prepareBinDirectory(binaryName) {
|
|
84
|
-
const binDir = path.join(__dirname, "bin");
|
|
85
|
-
const targetPath = path.join(binDir, binaryName);
|
|
86
|
-
|
|
87
|
-
// Ensure bin directory exists
|
|
88
|
-
if (!fs.existsSync(binDir)) {
|
|
89
|
-
fs.mkdirSync(binDir, { recursive: true });
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
// Remove existing binary/symlink if it exists
|
|
93
|
-
if (fs.existsSync(targetPath)) {
|
|
94
|
-
fs.unlinkSync(targetPath);
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
return { binDir, targetPath };
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
/**
|
|
101
|
-
* Create symlink to the platform binary
|
|
102
|
-
*/
|
|
103
|
-
function symlinkBinary(sourcePath, binaryName) {
|
|
104
|
-
const { targetPath } = prepareBinDirectory(binaryName);
|
|
105
|
-
|
|
106
|
-
fs.symlinkSync(sourcePath, targetPath);
|
|
107
|
-
console.log(`ralph binary symlinked: ${targetPath} -> ${sourcePath}`);
|
|
108
|
-
|
|
109
|
-
// Verify the file exists after operation
|
|
110
|
-
if (!fs.existsSync(targetPath)) {
|
|
111
|
-
throw new Error(`Failed to symlink binary to ${targetPath}`);
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
/**
|
|
116
|
-
* Main function
|
|
117
|
-
*/
|
|
118
|
-
async function main() {
|
|
119
|
-
try {
|
|
120
|
-
// On Windows, npm handles the .exe directly via the bin field
|
|
121
|
-
// No postinstall symlinking needed
|
|
122
|
-
if (os.platform() === "win32") {
|
|
123
|
-
console.log(
|
|
124
|
-
"Windows detected: binary setup not needed (using packaged .exe)"
|
|
125
|
-
);
|
|
126
|
-
return;
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
const { binaryPath, binaryName, packageName } = findBinary();
|
|
130
|
-
console.log(`Found ${packageName} at ${binaryPath}`);
|
|
131
|
-
symlinkBinary(binaryPath, binaryName);
|
|
132
|
-
} catch (error) {
|
|
133
|
-
console.error("Failed to setup ralph binary:", error.message);
|
|
134
|
-
// Don't fail the install - the JS launcher will handle finding the binary
|
|
135
|
-
process.exit(0);
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
try {
|
|
140
|
-
main();
|
|
141
|
-
} catch (error) {
|
|
142
|
-
console.error("Postinstall script error:", error.message);
|
|
143
|
-
// Exit gracefully - don't break npm install
|
|
144
|
-
process.exit(0);
|
|
145
|
-
}
|