@herbcaudill/ralph 0.4.1 → 0.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.
Files changed (46) hide show
  1. package/dist/cli.d.ts.map +1 -1
  2. package/dist/cli.js +32 -0
  3. package/dist/cli.js.map +1 -1
  4. package/dist/components/App.d.ts.map +1 -1
  5. package/dist/components/App.js +2 -5
  6. package/dist/components/App.js.map +1 -1
  7. package/dist/components/EventDisplay.d.ts +9 -1
  8. package/dist/components/EventDisplay.d.ts.map +1 -1
  9. package/dist/components/EventDisplay.js +109 -56
  10. package/dist/components/EventDisplay.js.map +1 -1
  11. package/dist/components/EventDisplay.replay.test.js +31 -3
  12. package/dist/components/EventDisplay.replay.test.js.map +1 -1
  13. package/dist/components/EventDisplay.test.js +107 -11
  14. package/dist/components/EventDisplay.test.js.map +1 -1
  15. package/dist/components/Header.d.ts +2 -1
  16. package/dist/components/Header.d.ts.map +1 -1
  17. package/dist/components/Header.js +2 -2
  18. package/dist/components/Header.js.map +1 -1
  19. package/dist/components/IterationRunner.d.ts +3 -1
  20. package/dist/components/IterationRunner.d.ts.map +1 -1
  21. package/dist/components/IterationRunner.js +99 -184
  22. package/dist/components/IterationRunner.js.map +1 -1
  23. package/dist/components/ReplayLog.d.ts +3 -1
  24. package/dist/components/ReplayLog.d.ts.map +1 -1
  25. package/dist/components/ReplayLog.js +2 -2
  26. package/dist/components/ReplayLog.js.map +1 -1
  27. package/dist/index.d.ts +0 -1
  28. package/dist/index.d.ts.map +1 -1
  29. package/dist/index.js +0 -1
  30. package/dist/index.js.map +1 -1
  31. package/dist/lib/addTodo.d.ts +10 -0
  32. package/dist/lib/addTodo.d.ts.map +1 -0
  33. package/dist/lib/addTodo.js +55 -0
  34. package/dist/lib/addTodo.js.map +1 -0
  35. package/dist/lib/cleanupAllWorktrees.d.ts.map +1 -1
  36. package/dist/lib/cleanupAllWorktrees.js +2 -4
  37. package/dist/lib/cleanupAllWorktrees.js.map +1 -1
  38. package/dist/lib/createWorktree.d.ts.map +1 -1
  39. package/dist/lib/createWorktree.js +2 -3
  40. package/dist/lib/createWorktree.js.map +1 -1
  41. package/dist/lib/types.d.ts +5 -0
  42. package/dist/lib/types.d.ts.map +1 -1
  43. package/dist/lib/types.js +10 -0
  44. package/dist/lib/types.js.map +1 -1
  45. package/package.json +14 -15
  46. package/templates/prompt.md +1 -11
@@ -1,9 +1,8 @@
1
1
  import { execSync } from "child_process";
2
2
  import { mkdirSync } from "fs";
3
- import { tmpdir } from "os";
4
3
  import { join } from "path";
5
4
  import { randomUUID } from "crypto";
6
- import { execOptions } from "./types.js";
5
+ import { execOptions, getWorktreesDir } from "./types.js";
7
6
  /**
8
7
  * Create a new git worktree for an iteration
9
8
  */
@@ -11,7 +10,7 @@ export function createWorktree(repoRoot) {
11
10
  const guid = randomUUID();
12
11
  const shortId = guid.slice(-6);
13
12
  const branch = `ralph-${shortId}`;
14
- const worktreesDir = join(tmpdir(), "ralph-worktrees");
13
+ const worktreesDir = getWorktreesDir(repoRoot);
15
14
  const worktreePath = join(worktreesDir, shortId);
16
15
  try {
17
16
  // Ensure worktrees directory exists
@@ -1 +1 @@
1
- {"version":3,"file":"createWorktree.js","sourceRoot":"","sources":["../../src/lib/createWorktree.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AACxC,OAAO,EAAE,SAAS,EAAE,MAAM,IAAI,CAAA;AAC9B,OAAO,EAAE,MAAM,EAAE,MAAM,IAAI,CAAA;AAC3B,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAA;AAC3B,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAA;AACnC,OAAO,EAAgB,WAAW,EAAE,MAAM,YAAY,CAAA;AAEtD;;GAEG;AACH,MAAM,UAAU,cAAc,CAAC,QAAgB;IAC7C,MAAM,IAAI,GAAG,UAAU,EAAE,CAAA;IACzB,MAAM,OAAO,GAAG,IAAI,CAAC,K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,eAAe,CAAC,QAAQ,CAAC,CAAA;IAC9C,MAAM,YAAY,GAAG,IAAI,CAAC,YAAY,EAAE,OAAO,CAAC,CAAA;IAEhD,IAAI,CAAC;QACH,oCAAoC;QACpC,SAAS,CAAC,YAAY,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAA;QAE5C,oDAAoD;QACpD,QAAQ,CAAC,uBAAuB,MAAM,KAAK,YAAY,GAAG,EAAE;YAC1D,GAAG,WAAW;YACd,GAAG,EAAE,QAAQ;SACd,CAAC,CAAA;QAEF,OAAO;YACL,IAAI,EAAE,YAAY;YAClB,MAAM;YACN,IAAI;SACL,CAAA;IACH,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,IAAI,KAAK,CAAC,8BAA8B,KAAK,EAAE,CAAC,CAAA;IACxD,CAAC;AACH,CAAC"}
@@ -5,4 +5,9 @@ export interface WorktreeInfo {
5
5
  guid: string;
6
6
  }
7
7
  export declare const execOptions: ExecSyncOptions;
8
+ /**
9
+ * Get the worktrees directory for a given repo root.
10
+ * Creates a sibling directory named `<repo-name>-worktrees`.
11
+ */
12
+ export declare function getWorktreesDir(repoRoot: string): string;
8
13
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/lib/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAA;AAE/C,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAA;IACZ,MAAM,EAAE,MAAM,CAAA;IACd,IAAI,EAAE,MAAM,CAAA;CACb;AAED,eAAO,MAAM,WAAW,EAAE,eAGzB,CAAA"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/lib/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAA;AAG/C,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAA;IACZ,MAAM,EAAE,MAAM,CAAA;IACd,IAAI,EAAE,MAAM,CAAA;CACb;AAED,eAAO,MAAM,WAAW,EAAE,eAGzB,CAAA;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAIxD"}
package/dist/lib/types.js CHANGED
@@ -1,5 +1,15 @@
1
+ import { basename, dirname, join } from "path";
1
2
  export const execOptions = {
2
3
  stdio: "pipe",
3
4
  encoding: "utf-8",
4
5
  };
6
+ /**
7
+ * Get the worktrees directory for a given repo root.
8
+ * Creates a sibling directory named `<repo-name>-worktrees`.
9
+ */
10
+ export function getWorktreesDir(repoRoot) {
11
+ const repoName = basename(repoRoot);
12
+ const parentDir = dirname(repoRoot);
13
+ return join(parentDir, `${repoName}-worktrees`);
14
+ }
5
15
  //# sourceMappingURL=types.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/lib/types.ts"],"names":[],"mappings":"AAQA,MAAM,CAAC,MAAM,WAAW,GAAoB;IAC1C,KAAK,EAAE,MAAM;IACb,QAAQ,EAAE,OAAO;CAClB,CAAA"}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/lib/types.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAA;AAQ9C,MAAM,CAAC,MAAM,WAAW,GAAoB;IAC1C,KAAK,EAAE,MAAM;IACb,QAAQ,EAAE,OAAO;CAClB,CAAA;AAED;;;GAGG;AACH,MAAM,UAAU,eAAe,CAAC,QAAgB;IAC9C,MAAM,QAAQ,GAAG,QAAQ,CAAC,QAAQ,CAAC,CAAA;IACnC,MAAM,SAAS,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAA;IACnC,OAAO,IAAI,CAAC,SAAS,EAAE,GAAG,QAAQ,YAAY,CAAC,CAAA;AACjD,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@herbcaudill/ralph",
3
- "version": "0.4.1",
3
+ "version": "0.5.1",
4
4
  "description": "Autonomous AI iteration engine for Claude CLI",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -13,18 +13,6 @@
13
13
  "bin",
14
14
  "templates"
15
15
  ],
16
- "scripts": {
17
- "build": "tsc",
18
- "dev": "tsc --watch",
19
- "ralph": "tsx src/index.ts",
20
- "test": "vitest run",
21
- "test:unit": "pnpm test --exclude test/e2e/**",
22
- "test:e2e": "pnpm test --config vitest.e2e.config.ts",
23
- "test:watch": "vitest --watch",
24
- "test:ui": "vitest --ui",
25
- "format": "prettier --write .",
26
- "prepublishOnly": "pnpm build"
27
- },
28
16
  "keywords": [
29
17
  "claude",
30
18
  "ai",
@@ -42,7 +30,6 @@
42
30
  "dependencies": {
43
31
  "chalk": "^5.6.2",
44
32
  "commander": "^14.0.2",
45
- "execa": "^9.6.1",
46
33
  "ink": "^6.6.0",
47
34
  "ink-big-text": "^2.0.0",
48
35
  "ink-gradient": "^3.0.0",
@@ -54,6 +41,7 @@
54
41
  "@types/node": "^24.10.1",
55
42
  "@types/react": "^19.2.8",
56
43
  "@vitest/ui": "^4.0.17",
44
+ "execa": "^9.6.1",
57
45
  "ink-testing-library": "^4.0.0",
58
46
  "prettier": "^3.5.3",
59
47
  "tsx": "^4.21.0",
@@ -62,5 +50,16 @@
62
50
  },
63
51
  "engines": {
64
52
  "node": ">=18.0.0"
53
+ },
54
+ "scripts": {
55
+ "build": "tsc",
56
+ "dev": "tsc --watch",
57
+ "ralph": "tsx src/index.ts",
58
+ "test": "vitest",
59
+ "test:unit": "vitest --exclude test/e2e/**",
60
+ "test:e2e": "vitest --config vitest.e2e.config.ts",
61
+ "test:watch": "vitest --watch",
62
+ "test:ui": "vitest --ui",
63
+ "format": "prettier --write ."
65
64
  }
66
- }
65
+ }
@@ -1,9 +1,3 @@
1
- ## Context
2
-
3
- You are working in a git worktree. Each iteration runs in an isolated worktree branch, and your changes will be automatically merged back to the main branch when this iteration completes.
4
-
5
- ## Workflow
6
-
7
1
  Before doing anything, check that the project builds successfully. Run your project's build/typecheck commands and tests.
8
2
 
9
3
  If there are build errors or test failures: YOUR ONLY TASK IS TO FIX THEM.
@@ -21,8 +15,4 @@ When you complete a task, before committing:
21
15
  - Update the todo list by checking off the completed task and moving it to the "Done" section
22
16
  - Append your progress to the @.ralph/progress.md file. Use this to leave a note for the next person working in the codebase
23
17
 
24
- Make one git commit for this task.
25
-
26
- If merge conflicts occur when your changes are merged back to main, resolve them in the next iteration. The merge process happens automatically after each iteration completes.
27
-
28
- If, while implementing the task, you notice the todo list is complete, output <promise>COMPLETE</promise> and exit.
18
+ Make one git commit for this task. If, while implementing the task, you notice the todo list is complete, output <promise>COMPLETE</promise> and exit.