@pageai/ralph-loop 1.6.0 → 1.8.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.
@@ -1,6 +1,44 @@
1
1
  # **Critical Steering Work**
2
2
 
3
- Go to the source code directory and install dependencies.
3
+ ## Ensure the sandbox is running correctly
4
4
 
5
- Check that Playwright is installed, then start the dev server and take a screenshot.
6
- Save the screenshot to the .agent/screenshots directory.
5
+ This sandbox runs emulated aarch64 Linux. Apply as needed:
6
+
7
+ - **Node >= 22 (if required):** Install nvm, persist to `/etc/sandbox-persistent.sh` with `unset NPM_CONFIG_PREFIX` before the nvm source line. Never add bash_completion to that file.
8
+
9
+ - **Native binary SIGILL crashes (npm):** `npm install` will produce broken arm64 binaries. Follow this exact sequence:
10
+
11
+ 1. Run `npm install --ignore-scripts` (prevents SIGILL during install)
12
+ 2. Fix **all** known native binaries — for each package below, run:
13
+ ```
14
+ cd /tmp && npm pack <pkg>@<version> && tar xzf <tarball> && cp package/<binary> <node_modules_path> && rm -rf package
15
+ ```
16
+ Known SIGILL packages (check versions in node_modules):
17
+ - `@esbuild/linux-arm64` → `bin/esbuild`
18
+ - `@rollup/rollup-linux-arm64-gnu` → `rollup.linux-arm64-gnu.node`
19
+ - `@tailwindcss/oxide-linux-arm64-gnu` → `tailwindcss-oxide.linux-arm64-gnu.node`
20
+ - `@unrs/resolver-binding-linux-arm64-gnu` → `resolver.linux-arm64-gnu.node`
21
+ - `lightningcss-linux-arm64-gnu` → `lightningcss.linux-arm64-gnu.node`
22
+ 3. **Verify each binary** before proceeding: `node -e "require('<pkg>')"` (for esbuild, use `node_modules/@esbuild/linux-arm64/bin/esbuild --version` instead since it's a standalone binary, not a requireable module)
23
+ 4. **Scan for corrupted files** — `--ignore-scripts` can produce JS files with null bytes:
24
+ ```
25
+ find node_modules -name '*.js' -size +50k | while read f; do
26
+ if od -c "$f" | grep -q '\\0'; then echo "CORRUPT: $f"; fi
27
+ done
28
+ ```
29
+ Fix: `rm -rf node_modules/<corrupt-pkg> && npm install --ignore-scripts`
30
+ Re-scan until clean. Only then start the dev server.
31
+
32
+ - **If using TanStack Start:** Check that `src/integrations/tanstack-query/root-provider.tsx` has a default export wrapping children with `QueryClientProvider`. The starter template ships without it, causing a 500 on load.
33
+
34
+ ## Main Tasks
35
+
36
+ Install dependencies (using the sequence above), then install Playwright system dependencies: `sudo npx playwright install-deps chromium 2>&1`. Allow up to 10 minutes for tasks to complete.
37
+
38
+ Then install the Playwright browser: `npx playwright install chromium`
39
+
40
+ Start the dev server and take a screenshot. Save it to the `.agent/screenshots` directory.
41
+
42
+ ---
43
+
44
+ After you finish this work, exit with message `Steering complete`.
package/.mcp.json CHANGED
@@ -6,7 +6,11 @@
6
6
  "args": [
7
7
  "-y",
8
8
  "@playwright/mcp@latest",
9
- "--headless"
9
+ "--headless",
10
+ "--no-sandbox",
11
+ "--install",
12
+ "--executable-path",
13
+ "/home/agent/.cache/ms-playwright/chromium-1208/chrome-linux/chrome"
10
14
  ],
11
15
  "env": {}
12
16
  },
package/README.md CHANGED
@@ -12,7 +12,7 @@ This is an implementation that actually works, containing a hackable script so y
12
12
  - [2️⃣ Step 2: Create a PRD + task list](#2️⃣-step-2-create-a-prd--task-list)
13
13
  - [3️⃣ Step 3: Set up the agent inside Docker sandbox](#3️⃣-step-3-set-up-the-agent-inside-docker-sandbox)
14
14
  - [4️⃣ Step 4: Run Ralph](#4️⃣-step-4-run-ralph)
15
- - [Run the loop](#run-the-loop)
15
+ - [Running the Ralph Loop with custom options](#running-the-ralph-loop-with-custom-options)
16
16
  - [(Optional) Adjusting to your language/framework](#optional-adjusting-to-your-languageframework)
17
17
  - [How It Works](#how-it-works)
18
18
  - [How Is This Different from Other Ralphs?](#how-is-this-different-from-other-ralphs)
@@ -115,7 +115,9 @@ And follow the instructions to log in into Claude Code.
115
115
  ./ralph.sh -n 50 # Run Ralph Loop with 50 iterations
116
116
  ```
117
117
 
118
- ## Run the loop
118
+ > ✍️ Note: the first iteration will be spent on ensuring the sandbox environment is set up correctly. Expect 5 minutes to complete.
119
+
120
+ ## Running the Ralph Loop with custom options
119
121
 
120
122
  ```bash
121
123
  # Run the agent loop (default: 10 iterations)
package/bin/cli.js CHANGED
@@ -12,6 +12,7 @@ const { execSync } = require('child_process');
12
12
  const display = require('./lib/display');
13
13
  const { copyFile, copyDir, mergeDir, exists, ensureDir } = require('./lib/copy');
14
14
  const { isGitRepo, initGitRepo } = require('./lib/git');
15
+ const { isShadcnProject, installAllComponents } = require('./lib/shadcn');
15
16
 
16
17
  const PACKAGE_ROOT = path.resolve(__dirname, '..');
17
18
  const TARGET_DIR = process.cwd();
@@ -151,15 +152,6 @@ async function main() {
151
152
 
152
153
  display.printLocation(TARGET_DIR);
153
154
 
154
- // Initialize git repository if not present
155
- if (!isGitRepo(TARGET_DIR)) {
156
- try {
157
- initGitRepo(TARGET_DIR);
158
- } catch {
159
- // Non-critical — continue setup even if git init fails
160
- }
161
- }
162
-
163
155
  // Copy individual files
164
156
  display.printStep('📄', 'Core files');
165
157
  for (const file of FILES_TO_COPY) {
@@ -343,6 +335,34 @@ async function main() {
343
335
  }
344
336
  }
345
337
 
338
+ // Final setup steps (git init, shadcn install)
339
+ const appDirPath = path.join(TARGET_DIR, appDir);
340
+ const needsGit = !isGitRepo(TARGET_DIR);
341
+ const needsShadcn = isShadcnProject(appDirPath);
342
+
343
+ if (needsGit || needsShadcn) {
344
+ const s = clack.spinner();
345
+ s.start('Finishing up...');
346
+
347
+ if (needsGit) {
348
+ try {
349
+ initGitRepo(TARGET_DIR);
350
+ } catch {
351
+ // Non-critical — continue setup even if git init fails
352
+ }
353
+ }
354
+
355
+ if (needsShadcn) {
356
+ try {
357
+ installAllComponents(appDirPath);
358
+ } catch {
359
+ // Non-critical — continue setup even if shadcn install fails
360
+ }
361
+ }
362
+
363
+ s.stop('Done');
364
+ }
365
+
346
366
  // Success message
347
367
  display.showComplete();
348
368
  clack.outro('Happy looping!');
@@ -0,0 +1,44 @@
1
+ /**
2
+ * shadcn/ui module for Ralph Loop CLI
3
+ * Detects shadcn config and installs all components
4
+ */
5
+
6
+ const fs = require('fs');
7
+ const path = require('path');
8
+ const { execSync } = require('child_process');
9
+ const { exists } = require('./copy');
10
+
11
+ const SHADCN_SCHEMA = 'https://ui.shadcn.com/schema.json';
12
+
13
+ /**
14
+ * Checks if a directory has a shadcn components.json with the expected schema
15
+ * @param {string} dir - Directory path to check
16
+ * @returns {boolean}
17
+ */
18
+ function isShadcnProject(dir) {
19
+ const configPath = path.join(dir, 'components.json');
20
+ if (!exists(configPath)) return false;
21
+
22
+ try {
23
+ const config = JSON.parse(fs.readFileSync(configPath, 'utf8'));
24
+ return config.$schema === SHADCN_SCHEMA;
25
+ } catch {
26
+ return false;
27
+ }
28
+ }
29
+
30
+ /**
31
+ * Installs all shadcn/ui components in the given directory
32
+ * @param {string} dir - Directory path to run the install in
33
+ */
34
+ function installAllComponents(dir) {
35
+ execSync('npx shadcn@latest add --all --yes 2>&1', {
36
+ cwd: dir,
37
+ stdio: 'pipe',
38
+ });
39
+ }
40
+
41
+ module.exports = {
42
+ isShadcnProject,
43
+ installAllComponents,
44
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pageai/ralph-loop",
3
- "version": "1.6.0",
3
+ "version": "1.8.0",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -14,6 +14,7 @@ export default defineConfig({
14
14
  use: {
15
15
  baseURL: 'http://localhost:3000',
16
16
  trace: 'on-first-retry',
17
+ viewport: { width: 1366, height: 768 },
17
18
  },
18
19
 
19
20