@pageai/ralph-loop 1.4.0 → 1.6.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.
@@ -2,4 +2,5 @@
2
2
 
3
3
  Go to the source code directory and install dependencies.
4
4
 
5
- Check that Playwright is running by starting the dev server and taking a screenshot. Save the screenshot to the .agent/screenshots directory.
5
+ Check that Playwright is installed, then start the dev server and take a screenshot.
6
+ Save the screenshot to the .agent/screenshots directory.
package/README.md CHANGED
@@ -41,12 +41,10 @@ This is an implementation that actually works, containing a hackable script so y
41
41
  I recommend using a CLI to bootstrap your project with the necessary tools and dependencies, e.g.:
42
42
 
43
43
  ```bash
44
- npx create-vite@latest src --template react-ts
45
- # or
46
- npx create-next-app@latest src
44
+ npx @tanstack/cli create lib --add-ons shadcn,eslint,form,tanstack-query --no-git
47
45
  ```
48
46
 
49
- > If you must start from a blank slate, which is not recommended, see [Starting from scratch](#starting-from-scratch).
47
+ > If you must start from a blank slate, which is not recommended, see [Starting from scratch](#starting-from-scratch). You can also go for a more barebone start by running `npx create-vite@latest src --template react-ts`
50
48
 
51
49
  ### 1️⃣ Step 1: Install Ralph
52
50
 
@@ -64,7 +62,7 @@ Open up Claude Code and prompt it with **your requirements**. Like so:
64
62
  ```
65
63
  Use the prd-creator skill to help me create a PRD and task list for the below requirements.
66
64
 
67
- An app is already set up with Next.js, Tailwind CSS and TypeScript.
65
+ An app is already set up with React, Tailwind CSS and TypeScript.
68
66
 
69
67
  Requirements:
70
68
 
@@ -353,14 +351,14 @@ import '@testing-library/jest-dom/vitest'
353
351
  import { vi } from 'vitest'
354
352
  import React from 'react'
355
353
 
356
- // Mock next/image
354
+ // If using Next.js, mock next/image
357
355
  vi.mock('next/image', () => ({
358
356
  default: ({ src, alt, ...props }: { src: string; alt: string }) => {
359
357
  return React.createElement('img', { src, alt, ...props })
360
358
  },
361
359
  }))
362
360
 
363
- // Mock next/link
361
+ // If using Next.js, mock next/link
364
362
  vi.mock('next/link', () => ({
365
363
  default: ({
366
364
  children,
@@ -383,7 +381,7 @@ Check the `ralph.sh` script around `# This is the main command loop.` for the ma
383
381
 
384
382
  Replace `docker sandbox run claude . --` with the your favorite CLI. Remember to also update the options after the `--`.
385
383
 
386
- ```
384
+ ```bash
387
385
  docker sandbox run codex . # for Codex CLI
388
386
  docker sandbox run gemini . # for Gemini CLI
389
387
  ```
@@ -395,7 +393,7 @@ See more in [Docker's docs](https://docs.docker.com/ai/sandboxes/migration/).
395
393
 
396
394
  For AI to actually verify its implementation and for the loop to work, you need a way to verify it.
397
395
 
398
- To that end, at the minimum you need an end-to-end test framework and a unit test framework.
396
+ To that end, at the minimum you'll need an end-to-end test framework and a unit test framework.
399
397
 
400
398
  For example, you can use the following commands to install Playwright and Vitest:
401
399
 
package/bin/cli.js CHANGED
@@ -11,10 +11,11 @@ const path = require('path');
11
11
  const { execSync } = require('child_process');
12
12
  const display = require('./lib/display');
13
13
  const { copyFile, copyDir, mergeDir, exists, ensureDir } = require('./lib/copy');
14
+ const { isGitRepo, initGitRepo } = require('./lib/git');
14
15
 
15
16
  const PACKAGE_ROOT = path.resolve(__dirname, '..');
16
17
  const TARGET_DIR = process.cwd();
17
- const DEFAULT_APP_DIR = 'src';
18
+ const DEFAULT_APP_DIR = 'lib';
18
19
 
19
20
  // Directories to ensure exist (created even if source doesn't exist)
20
21
  const DIRS_TO_ENSURE = [
@@ -104,7 +105,7 @@ async function main() {
104
105
 
105
106
  // Prompt 1 — App source directory
106
107
  const appDir = await clack.text({
107
- message: 'Where does your app source code live? (e.g. src, public, etc.)',
108
+ message: 'Where does your app source code live? (e.g. lib, app, src, public, etc.)',
108
109
  placeholder: DEFAULT_APP_DIR,
109
110
  defaultValue: DEFAULT_APP_DIR,
110
111
  });
@@ -150,6 +151,15 @@ async function main() {
150
151
 
151
152
  display.printLocation(TARGET_DIR);
152
153
 
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
+
153
163
  // Copy individual files
154
164
  display.printStep('📄', 'Core files');
155
165
  for (const file of FILES_TO_COPY) {
@@ -96,7 +96,7 @@ ${G} ✓ Ralph Loop setup complete!${R}
96
96
  ${D}═══════════════════════════════════════════════════════════${R}
97
97
 
98
98
  ${Y}Next steps:${R}
99
- ${C}1.${R} Review the copied files
99
+ ${C}1.${R} Log in to your CLI agent with ${G}docker sandbox run claude .${R}
100
100
  ${C}2.${R} Create a PRD using the ${G}prd-creator${R} skill
101
101
  ${C}3.${R} Run ${G}./ralph.sh${R} to start the loop
102
102
 
package/bin/lib/git.js ADDED
@@ -0,0 +1,30 @@
1
+ /**
2
+ * Git module for Ralph Loop CLI
3
+ * Handles git repository initialization in the target directory
4
+ */
5
+
6
+ const path = require('path');
7
+ const { execSync } = require('child_process');
8
+ const { exists } = require('./copy');
9
+
10
+ /**
11
+ * Checks if a directory is inside a git repository
12
+ * @param {string} dir - Directory path to check
13
+ * @returns {boolean}
14
+ */
15
+ function isGitRepo(dir) {
16
+ return exists(path.join(dir, '.git'));
17
+ }
18
+
19
+ /**
20
+ * Initializes a new git repository in the given directory
21
+ * @param {string} dir - Directory path to initialize
22
+ */
23
+ function initGitRepo(dir) {
24
+ execSync('git init', { cwd: dir, stdio: 'pipe' });
25
+ }
26
+
27
+ module.exports = {
28
+ isGitRepo,
29
+ initGitRepo,
30
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pageai/ralph-loop",
3
- "version": "1.4.0",
3
+ "version": "1.6.0",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },