@herbcaudill/ralph 0.5.1 → 0.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.
Files changed (42) hide show
  1. package/README.md +3 -14
  2. package/dist/cli.js +1 -1
  3. package/dist/components/App.d.ts.map +1 -1
  4. package/dist/components/App.js +2 -5
  5. package/dist/components/App.js.map +1 -1
  6. package/dist/components/EventDisplay.d.ts +2 -3
  7. package/dist/components/EventDisplay.d.ts.map +1 -1
  8. package/dist/components/EventDisplay.js +128 -63
  9. package/dist/components/EventDisplay.js.map +1 -1
  10. package/dist/components/EventDisplay.replay.test.js +49 -67
  11. package/dist/components/EventDisplay.replay.test.js.map +1 -1
  12. package/dist/components/EventDisplay.test.js +11 -11
  13. package/dist/components/EventDisplay.test.js.map +1 -1
  14. package/dist/components/FullScreenLayout.d.ts +14 -0
  15. package/dist/components/FullScreenLayout.d.ts.map +1 -0
  16. package/dist/components/FullScreenLayout.js +30 -0
  17. package/dist/components/FullScreenLayout.js.map +1 -0
  18. package/dist/components/Header.d.ts.map +1 -1
  19. package/dist/components/Header.js +1 -1
  20. package/dist/components/Header.js.map +1 -1
  21. package/dist/components/InitRalph.js +1 -1
  22. package/dist/components/InitRalph.js.map +1 -1
  23. package/dist/components/IterationRunner.d.ts.map +1 -1
  24. package/dist/components/IterationRunner.js +260 -93
  25. package/dist/components/IterationRunner.js.map +1 -1
  26. package/dist/components/IterationRunner.test.js +6 -6
  27. package/dist/components/IterationRunner.test.js.map +1 -1
  28. package/dist/components/ReplayLog.d.ts +1 -3
  29. package/dist/components/ReplayLog.d.ts.map +1 -1
  30. package/dist/components/ReplayLog.js +8 -9
  31. package/dist/components/ReplayLog.js.map +1 -1
  32. package/dist/lib/formatContentBlock.d.ts +10 -0
  33. package/dist/lib/formatContentBlock.d.ts.map +1 -0
  34. package/dist/lib/formatContentBlock.js +60 -0
  35. package/dist/lib/formatContentBlock.js.map +1 -0
  36. package/dist/lib/useTerminalSize.d.ts +5 -0
  37. package/dist/lib/useTerminalSize.d.ts.map +1 -0
  38. package/dist/lib/useTerminalSize.js +21 -0
  39. package/dist/lib/useTerminalSize.js.map +1 -0
  40. package/package.json +6 -3
  41. package/templates/prompt.md +0 -1
  42. package/templates/progress.md +0 -11
@@ -0,0 +1,60 @@
1
+ import chalk from "chalk";
2
+ /**
3
+ * Format a text string with markdown-style formatting (bold and inline code)
4
+ */
5
+ const formatText = (content) => {
6
+ let result = "";
7
+ let i = 0;
8
+ let inBold = false;
9
+ let inCode = false;
10
+ while (i < content.length) {
11
+ if (content[i] === "*" && content[i + 1] === "*") {
12
+ inBold = !inBold;
13
+ i += 2;
14
+ }
15
+ else if (content[i] === "`") {
16
+ inCode = !inCode;
17
+ i++;
18
+ }
19
+ else {
20
+ let char = content[i];
21
+ if (inCode) {
22
+ char = chalk.yellow(char);
23
+ }
24
+ else if (inBold) {
25
+ char = chalk.bold(char);
26
+ }
27
+ result += char;
28
+ i++;
29
+ }
30
+ }
31
+ return result;
32
+ };
33
+ /**
34
+ * Format a tool use block as a string
35
+ */
36
+ const formatToolUse = (name, arg) => {
37
+ const formattedName = chalk.blue(name);
38
+ if (arg) {
39
+ return ` ${formattedName} ${chalk.dim(arg)}`;
40
+ }
41
+ return ` ${formattedName}`;
42
+ };
43
+ /**
44
+ * Convert a content block to formatted string lines
45
+ */
46
+ export const formatContentBlock = (block) => {
47
+ if (block.type === "text") {
48
+ const formatted = formatText(block.content);
49
+ // Split into lines, preserving empty lines for paragraph breaks
50
+ return formatted.split("\n");
51
+ }
52
+ return [formatToolUse(block.name, block.arg)];
53
+ };
54
+ /**
55
+ * Format an iteration header
56
+ */
57
+ export const formatIterationHeader = (iteration) => {
58
+ return chalk.cyan.bold(`─── Iteration ${iteration} ───`);
59
+ };
60
+ //# sourceMappingURL=formatContentBlock.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"formatContentBlock.js","sourceRoot":"","sources":["../../src/lib/formatContentBlock.ts"],"names":[],"mappings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AG,CAAC,EAAE,CAAA;IAC/C,CAAC;IACD,OAAO,KAAK,aAAa,EAAE,CAAA;AAC7B,CAAC,CAAA;AAED;;GAEG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,KAAmB,EAAY,EAAE;IAClE,IAAI,KAAK,CAAC,IAAI,KAAK,MAAM,EAAE,CAAC;QAC1B,MAAM,SAAS,GAAG,UAAU,CAAC,KAAK,CAAC,OAAO,CAAC,CAAA;QAC3C,gEAAgE;QAChE,OAAO,SAAS,CAAC,KAAK,CAAC,IAAI,CAAC,CAAA;IAC9B,CAAC;IAED,OAAO,CAAC,aAAa,CAAC,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC,CAAA;AAC/C,CAAC,CAAA;AAED;;GAEG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,SAAiB,EAAU,EAAE;IACjE,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,iBAAiB,SAAS,MAAM,CAAC,CAAA;AAC1D,CAAC,CAAA"}
@@ -0,0 +1,5 @@
1
+ export declare const useTerminalSize: () => {
2
+ columns: number;
3
+ rows: number;
4
+ };
5
+ //# sourceMappingURL=useTerminalSize.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useTerminalSize.d.ts","sourceRoot":"","sources":["../../src/lib/useTerminalSize.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,eAAe;;;CAuB3B,CAAA"}
@@ -0,0 +1,21 @@
1
+ import { useState, useEffect } from "react";
2
+ import { useStdout } from "ink";
3
+ export const useTerminalSize = () => {
4
+ const { stdout } = useStdout();
5
+ const getSize = () => ({
6
+ columns: stdout?.columns ?? 80,
7
+ rows: stdout?.rows ?? 24,
8
+ });
9
+ const [size, setSize] = useState(getSize);
10
+ useEffect(() => {
11
+ const handleResize = () => {
12
+ setSize(getSize());
13
+ };
14
+ stdout?.on("resize", handleResize);
15
+ return () => {
16
+ stdout?.off("resize", handleResize);
17
+ };
18
+ }, [stdout]);
19
+ return size;
20
+ };
21
+ //# sourceMappingURL=useTerminalSize.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useTerminalSize.js","sourceRoot":"","sources":["../../src/lib/useTerminalSize.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAC3C,OAAO,EAAE,SAAS,EAAE,MAAM,KAAK,CAAA;AAE/B,MAAM,CAAC,MAAM,eAAe,GAAG,GAAG,EAAE;IAClC,MAAM,EAAE,MAAM,EAAE,GAAG,SAAS,EAAE,CAAA;IAE9B,MAAM,OAAO,GAAG,GAAG,EAAE,CAAC,CAAC;QACrB,OAAO,EAAE,MAAM,EAAE,OAAO,IAAI,EAAE;QAC9B,IAAI,EAAE,MAAM,EAAE,IAAI,IAAI,EAAE;KACzB,CAAC,CAAA;IAEF,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,QAAQ,CAAC,OAAO,CAAC,CAAA;IAEzC,SAAS,CAAC,GAAG,EAAE;QACb,MAAM,YAAY,GAAG,GAAG,EAAE;YACxB,OAAO,CAAC,OAAO,EAAE,CAAC,CAAA;QACpB,CAAC,CAAA;QAED,MAAM,EAAE,EAAE,CAAC,QAAQ,EAAE,YAAY,CAAC,CAAA;QAElC,OAAO,GAAG,EAAE;YACV,MAAM,EAAE,GAAG,CAAC,QAAQ,EAAE,YAAY,CAAC,CAAA;QACrC,CAAC,CAAA;IACH,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC,CAAA;IAEZ,OAAO,IAAI,CAAA;AACb,CAAC,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@herbcaudill/ralph",
3
- "version": "0.5.1",
3
+ "version": "0.6.0",
4
4
  "description": "Autonomous AI iteration engine for Claude CLI",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -28,6 +28,7 @@
28
28
  "url": "https://github.com/HerbCaudill/ralph.git"
29
29
  },
30
30
  "dependencies": {
31
+ "@anthropic-ai/claude-agent-sdk": "^0.2.7",
31
32
  "chalk": "^5.6.2",
32
33
  "commander": "^14.0.2",
33
34
  "ink": "^6.6.0",
@@ -35,6 +36,7 @@
35
36
  "ink-gradient": "^3.0.0",
36
37
  "ink-select-input": "^6.2.0",
37
38
  "ink-spinner": "^5.0.0",
39
+ "ink-text-input": "^6.0.0",
38
40
  "react": "^19.2.3"
39
41
  },
40
42
  "devDependencies": {
@@ -54,9 +56,10 @@
54
56
  "scripts": {
55
57
  "build": "tsc",
56
58
  "dev": "tsc --watch",
59
+ "typecheck": "tsc --noEmit",
57
60
  "ralph": "tsx src/index.ts",
58
- "test": "vitest",
59
- "test:unit": "vitest --exclude test/e2e/**",
61
+ "test:all": "pnpm typecheck && pnpm test",
62
+ "test": "vitest --exclude test/e2e/** run",
60
63
  "test:e2e": "vitest --config vitest.e2e.config.ts",
61
64
  "test:watch": "vitest --watch",
62
65
  "test:ui": "vitest --ui",
@@ -13,6 +13,5 @@ When you complete a task, before committing:
13
13
  - Check that the project builds successfully and tests pass
14
14
  - Where applicable, add tests to validate your changes and confirm that they pass
15
15
  - Update the todo list by checking off the completed task and moving it to the "Done" section
16
- - Append your progress to the @.ralph/progress.md file. Use this to leave a note for the next person working in the codebase
17
16
 
18
17
  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.
@@ -1,11 +0,0 @@
1
- # Progress Log
2
-
3
- This file tracks completed tasks and changes made to the codebase during ralph iterations.
4
-
5
- Each entry should include:
6
-
7
- - What was changed
8
- - Why it was changed
9
- - Any important notes for future work
10
-
11
- ---