@herbcaudill/ralph 0.8.3 → 1.0.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.
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +26 -5
- package/dist/cli.js.map +1 -1
- package/dist/components/App.d.ts +6 -1
- package/dist/components/App.d.ts.map +1 -1
- package/dist/components/App.js +7 -3
- package/dist/components/App.js.map +1 -1
- package/dist/components/EnhancedTextInput.d.ts +8 -8
- package/dist/components/EnhancedTextInput.d.ts.map +1 -1
- package/dist/components/EnhancedTextInput.js +2 -36
- package/dist/components/EnhancedTextInput.js.map +1 -1
- package/dist/components/EnhancedTextInput.test.js +2 -10
- package/dist/components/EnhancedTextInput.test.js.map +1 -1
- package/dist/components/EventDisplay.d.ts +1 -1
- package/dist/components/EventDisplay.d.ts.map +1 -1
- package/dist/components/EventDisplay.js +3 -94
- package/dist/components/EventDisplay.js.map +1 -1
- package/dist/components/EventDisplay.replay.test.js +34 -68
- package/dist/components/EventDisplay.replay.test.js.map +1 -1
- package/dist/components/EventDisplay.test.js +30 -0
- package/dist/components/EventDisplay.test.js.map +1 -1
- package/dist/components/FullScreenLayout.d.ts +5 -4
- package/dist/components/FullScreenLayout.d.ts.map +1 -1
- package/dist/components/FullScreenLayout.js +2 -12
- package/dist/components/FullScreenLayout.js.map +1 -1
- package/dist/components/Header.d.ts +2 -1
- package/dist/components/Header.d.ts.map +1 -1
- package/dist/components/Header.js +8 -1
- package/dist/components/Header.js.map +1 -1
- package/dist/components/InitRalph.d.ts +6 -1
- package/dist/components/InitRalph.d.ts.map +1 -1
- package/dist/components/InitRalph.js +71 -89
- package/dist/components/InitRalph.js.map +1 -1
- package/dist/components/IterationRunner.d.ts +6 -13
- package/dist/components/IterationRunner.d.ts.map +1 -1
- package/dist/components/IterationRunner.js +84 -168
- package/dist/components/IterationRunner.js.map +1 -1
- package/dist/components/IterationRunner.test.d.ts +44 -0
- package/dist/components/IterationRunner.test.d.ts.map +1 -1
- package/dist/components/IterationRunner.test.js +66 -126
- package/dist/components/IterationRunner.test.js.map +1 -1
- package/dist/components/IterationRunner.types.d.ts +30 -0
- package/dist/components/IterationRunner.types.d.ts.map +1 -0
- package/dist/components/IterationRunner.types.js +2 -0
- package/dist/components/IterationRunner.types.js.map +1 -0
- package/dist/components/JsonOutput.d.ts +5 -6
- package/dist/components/JsonOutput.d.ts.map +1 -1
- package/dist/components/JsonOutput.js +57 -34
- package/dist/components/JsonOutput.js.map +1 -1
- package/dist/components/JsonOutput.test.d.ts +2 -0
- package/dist/components/JsonOutput.test.d.ts.map +1 -0
- package/dist/components/JsonOutput.test.js +39 -0
- package/dist/components/JsonOutput.test.js.map +1 -0
- package/dist/components/ReplayLog.d.ts +1 -1
- package/dist/components/ReplayLog.d.ts.map +1 -1
- package/dist/components/ReplayLog.js +9 -2
- package/dist/components/ReplayLog.js.map +1 -1
- package/dist/components/StreamingText.d.ts +4 -0
- package/dist/components/StreamingText.d.ts.map +1 -1
- package/dist/components/StreamingText.js +4 -3
- package/dist/components/StreamingText.js.map +1 -1
- package/dist/components/StreamingText.test.js +39 -0
- package/dist/components/StreamingText.test.js.map +1 -1
- package/dist/components/ToolUse.d.ts +8 -0
- package/dist/components/ToolUse.d.ts.map +1 -1
- package/dist/components/ToolUse.js +1 -0
- package/dist/components/ToolUse.js.map +1 -1
- package/dist/components/blocksToLines.d.ts +6 -0
- package/dist/components/blocksToLines.d.ts.map +1 -0
- package/dist/components/blocksToLines.js +15 -0
- package/dist/components/blocksToLines.js.map +1 -0
- package/dist/components/eventToBlocks.d.ts +7 -1
- package/dist/components/eventToBlocks.d.ts.map +1 -1
- package/dist/components/eventToBlocks.js +7 -1
- package/dist/components/eventToBlocks.js.map +1 -1
- package/dist/components/findNextWordBoundary.d.ts +10 -0
- package/dist/components/findNextWordBoundary.d.ts.map +1 -0
- package/dist/components/findNextWordBoundary.js +23 -0
- package/dist/components/findNextWordBoundary.js.map +1 -0
- package/dist/components/findPreviousWordBoundary.d.ts +10 -0
- package/dist/components/findPreviousWordBoundary.d.ts.map +1 -0
- package/dist/components/findPreviousWordBoundary.js +23 -0
- package/dist/components/findPreviousWordBoundary.js.map +1 -0
- package/dist/components/processEvents.d.ts +11 -0
- package/dist/components/processEvents.d.ts.map +1 -0
- package/dist/components/processEvents.js +87 -0
- package/dist/components/processEvents.js.map +1 -0
- package/dist/components/renderStaticItem.d.ts +7 -0
- package/dist/components/renderStaticItem.d.ts.map +1 -0
- package/dist/components/renderStaticItem.js +23 -0
- package/dist/components/renderStaticItem.js.map +1 -0
- package/dist/components/replay.d.ts +5 -0
- package/dist/components/replay.d.ts.map +1 -0
- package/dist/components/replay.js +49 -0
- package/dist/components/replay.js.map +1 -0
- package/dist/components/test-helpers/ControlledInput.d.ts +14 -0
- package/dist/components/test-helpers/ControlledInput.d.ts.map +1 -0
- package/dist/components/test-helpers/ControlledInput.js +15 -0
- package/dist/components/test-helpers/ControlledInput.js.map +1 -0
- package/dist/components/useContentHeight.d.ts +9 -0
- package/dist/components/useContentHeight.d.ts.map +1 -0
- package/dist/components/useContentHeight.js +16 -0
- package/dist/components/useContentHeight.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/dist/lib/MessageQueue.d.ts +18 -5
- package/dist/lib/MessageQueue.d.ts.map +1 -1
- package/dist/lib/MessageQueue.js +21 -14
- package/dist/lib/MessageQueue.js.map +1 -1
- package/dist/lib/StdinCommandHandler.d.ts +26 -20
- package/dist/lib/StdinCommandHandler.js +78 -85
- package/dist/lib/StdinCommandHandler.test.d.ts +2 -2
- package/dist/lib/StdinCommandHandler.test.js +92 -92
- package/dist/lib/WorktreeManager.d.ts +114 -0
- package/dist/lib/WorktreeManager.d.ts.map +1 -0
- package/dist/lib/WorktreeManager.js +350 -0
- package/dist/lib/WorktreeManager.js.map +1 -0
- package/dist/lib/WorktreeManager.test.d.ts +2 -0
- package/dist/lib/WorktreeManager.test.d.ts.map +1 -0
- package/dist/lib/WorktreeManager.test.js +261 -0
- package/dist/lib/WorktreeManager.test.js.map +1 -0
- package/dist/lib/addTodo.d.ts +5 -5
- package/dist/lib/addTodo.d.ts.map +1 -1
- package/dist/lib/addTodo.js +6 -20
- package/dist/lib/addTodo.js.map +1 -1
- package/dist/lib/beadsClient.d.ts +6 -12
- package/dist/lib/beadsClient.d.ts.map +1 -1
- package/dist/lib/beadsClient.js +3 -2
- package/dist/lib/beadsClient.js.map +1 -1
- package/dist/lib/captureBeadsSnapshot.d.ts +4 -0
- package/dist/lib/captureBeadsSnapshot.d.ts.map +1 -0
- package/dist/lib/captureBeadsSnapshot.js +24 -0
- package/dist/lib/captureBeadsSnapshot.js.map +1 -0
- package/dist/lib/captureStartupSnapshot.d.ts +10 -0
- package/dist/lib/captureStartupSnapshot.d.ts.map +1 -0
- package/dist/lib/captureStartupSnapshot.js +29 -0
- package/dist/lib/captureStartupSnapshot.js.map +1 -0
- package/dist/lib/captureTodoSnapshot.d.ts +4 -0
- package/dist/lib/captureTodoSnapshot.d.ts.map +1 -0
- package/dist/lib/captureTodoSnapshot.js +24 -0
- package/dist/lib/captureTodoSnapshot.js.map +1 -0
- package/dist/lib/copyTemplates.d.ts +22 -0
- package/dist/lib/copyTemplates.d.ts.map +1 -0
- package/dist/lib/copyTemplates.js +32 -0
- package/dist/lib/copyTemplates.js.map +1 -0
- package/dist/lib/createStdinCommandHandler.d.ts +28 -0
- package/dist/lib/createStdinCommandHandler.d.ts.map +1 -0
- package/dist/lib/createStdinCommandHandler.js +67 -0
- package/dist/lib/createStdinCommandHandler.js.map +1 -0
- package/dist/lib/createUserMessage.d.ts +6 -0
- package/dist/lib/createUserMessage.d.ts.map +1 -0
- package/dist/lib/createUserMessage.js +13 -0
- package/dist/lib/createUserMessage.js.map +1 -0
- package/dist/lib/debug.d.ts +17 -16
- package/dist/lib/debug.d.ts.map +1 -1
- package/dist/lib/debug.js +25 -15
- package/dist/lib/debug.js.map +1 -1
- package/dist/lib/findMaxLogNumber.d.ts +6 -0
- package/dist/lib/findMaxLogNumber.d.ts.map +1 -0
- package/dist/lib/findMaxLogNumber.js +26 -0
- package/dist/lib/findMaxLogNumber.js.map +1 -0
- package/dist/lib/findMaxLogNumber.test.d.ts +2 -0
- package/dist/lib/findMaxLogNumber.test.d.ts.map +1 -0
- package/dist/lib/findMaxLogNumber.test.js +39 -0
- package/dist/lib/findMaxLogNumber.test.js.map +1 -0
- package/dist/lib/formatContentBlock.d.ts +4 -8
- package/dist/lib/formatContentBlock.d.ts.map +1 -1
- package/dist/lib/formatContentBlock.js +7 -58
- package/dist/lib/formatContentBlock.js.map +1 -1
- package/dist/lib/formatIterationHeader.d.ts +5 -0
- package/dist/lib/formatIterationHeader.d.ts.map +1 -0
- package/dist/lib/formatIterationHeader.js +8 -0
- package/dist/lib/formatIterationHeader.js.map +1 -0
- package/dist/lib/formatText.d.ts +5 -0
- package/dist/lib/formatText.d.ts.map +1 -0
- package/dist/lib/formatText.js +33 -0
- package/dist/lib/formatText.js.map +1 -0
- package/dist/lib/formatToolUse.d.ts +7 -0
- package/dist/lib/formatToolUse.d.ts.map +1 -0
- package/dist/lib/formatToolUse.js +14 -0
- package/dist/lib/formatToolUse.js.map +1 -0
- package/dist/lib/formatUserMessage.d.ts +5 -0
- package/dist/lib/formatUserMessage.d.ts.map +1 -0
- package/dist/lib/formatUserMessage.js +8 -0
- package/dist/lib/formatUserMessage.js.map +1 -0
- package/dist/lib/getBaseCwd.d.ts +6 -0
- package/dist/lib/getBaseCwd.d.ts.map +1 -0
- package/dist/lib/getBaseCwd.js +6 -0
- package/dist/lib/getBaseCwd.js.map +1 -0
- package/dist/lib/getBeadsProgress.d.ts +8 -0
- package/dist/lib/getBeadsProgress.d.ts.map +1 -0
- package/dist/lib/getBeadsProgress.js +35 -0
- package/dist/lib/getBeadsProgress.js.map +1 -0
- package/dist/lib/getClaudeVersion.d.ts +4 -0
- package/dist/lib/getClaudeVersion.d.ts.map +1 -1
- package/dist/lib/getClaudeVersion.js +4 -0
- package/dist/lib/getClaudeVersion.js.map +1 -1
- package/dist/lib/getDefaultIterations.d.ts +6 -0
- package/dist/lib/getDefaultIterations.d.ts.map +1 -0
- package/dist/lib/getDefaultIterations.js +14 -0
- package/dist/lib/getDefaultIterations.js.map +1 -0
- package/dist/lib/getDefaultIterations.test.d.ts +2 -0
- package/dist/lib/getDefaultIterations.test.d.ts.map +1 -0
- package/dist/lib/getDefaultIterations.test.js +39 -0
- package/dist/lib/getDefaultIterations.test.js.map +1 -0
- package/dist/lib/getLatestLogFile.d.ts +6 -0
- package/dist/lib/getLatestLogFile.d.ts.map +1 -0
- package/dist/lib/getLatestLogFile.js +15 -0
- package/dist/lib/getLatestLogFile.js.map +1 -0
- package/dist/lib/getNextLogFile.d.ts +0 -5
- package/dist/lib/getNextLogFile.d.ts.map +1 -1
- package/dist/lib/getNextLogFile.js +2 -36
- package/dist/lib/getNextLogFile.js.map +1 -1
- package/dist/lib/getNextLogFile.test.js +2 -1
- package/dist/lib/getNextLogFile.test.js.map +1 -1
- package/dist/lib/getOpenIssueCount.d.ts +0 -5
- package/dist/lib/getOpenIssueCount.d.ts.map +1 -1
- package/dist/lib/getOpenIssueCount.js +0 -12
- package/dist/lib/getOpenIssueCount.js.map +1 -1
- package/dist/lib/getOpenIssueCount.test.js +1 -35
- package/dist/lib/getOpenIssueCount.test.js.map +1 -1
- package/dist/lib/getProgress.d.ts +6 -26
- package/dist/lib/getProgress.d.ts.map +1 -1
- package/dist/lib/getProgress.js +8 -109
- package/dist/lib/getProgress.js.map +1 -1
- package/dist/lib/getProgress.test.js +2 -1
- package/dist/lib/getProgress.test.js.map +1 -1
- package/dist/lib/getPromptContent.d.ts +8 -0
- package/dist/lib/getPromptContent.d.ts.map +1 -0
- package/dist/lib/getPromptContent.js +31 -0
- package/dist/lib/getPromptContent.js.map +1 -0
- package/dist/lib/getTerminalSize.d.ts +8 -0
- package/dist/lib/getTerminalSize.d.ts.map +1 -0
- package/dist/lib/getTerminalSize.js +10 -0
- package/dist/lib/getTerminalSize.js.map +1 -0
- package/dist/lib/getTodoProgress.d.ts +4 -0
- package/dist/lib/getTodoProgress.d.ts.map +1 -0
- package/dist/lib/getTodoProgress.js +22 -0
- package/dist/lib/getTodoProgress.js.map +1 -0
- package/dist/lib/insertTodo.d.ts +7 -0
- package/dist/lib/insertTodo.d.ts.map +1 -0
- package/dist/lib/insertTodo.js +22 -0
- package/dist/lib/insertTodo.js.map +1 -0
- package/dist/lib/outputEvent.d.ts +5 -0
- package/dist/lib/outputEvent.d.ts.map +1 -0
- package/dist/lib/outputEvent.js +7 -0
- package/dist/lib/outputEvent.js.map +1 -0
- package/dist/lib/parseStdinCommand.d.ts +25 -0
- package/dist/lib/parseStdinCommand.d.ts.map +1 -0
- package/dist/lib/parseStdinCommand.js +43 -0
- package/dist/lib/parseStdinCommand.js.map +1 -0
- package/dist/lib/parseStdinCommand.test.d.ts +2 -0
- package/dist/lib/parseStdinCommand.test.d.ts.map +1 -0
- package/dist/lib/parseStdinCommand.test.js +93 -0
- package/dist/lib/parseStdinCommand.test.js.map +1 -0
- package/dist/lib/parseTaskLifecycle.d.ts +18 -0
- package/dist/lib/parseTaskLifecycle.d.ts.map +1 -0
- package/dist/lib/parseTaskLifecycle.js +30 -0
- package/dist/lib/parseTaskLifecycle.js.map +1 -0
- package/dist/lib/parseTaskLifecycle.test.d.ts +2 -0
- package/dist/lib/parseTaskLifecycle.test.d.ts.map +1 -0
- package/dist/lib/parseTaskLifecycle.test.js +122 -0
- package/dist/lib/parseTaskLifecycle.test.js.map +1 -0
- package/dist/lib/parseWorktreeFromBranch.d.ts +13 -0
- package/dist/lib/parseWorktreeFromBranch.d.ts.map +1 -0
- package/dist/lib/parseWorktreeFromBranch.js +19 -0
- package/dist/lib/parseWorktreeFromBranch.js.map +1 -0
- package/dist/lib/processEvents.d.ts +12 -0
- package/dist/lib/processEvents.d.ts.map +1 -0
- package/dist/lib/processEvents.js +113 -0
- package/dist/lib/processEvents.js.map +1 -0
- package/dist/lib/rel.d.ts +7 -1
- package/dist/lib/rel.d.ts.map +1 -1
- package/dist/lib/rel.js +13 -4
- package/dist/lib/rel.js.map +1 -1
- package/dist/lib/rel.test.js +16 -1
- package/dist/lib/rel.test.js.map +1 -1
- package/dist/lib/sdkMessageToEvent.d.ts +6 -0
- package/dist/lib/sdkMessageToEvent.d.ts.map +1 -0
- package/dist/lib/sdkMessageToEvent.js +12 -0
- package/dist/lib/sdkMessageToEvent.js.map +1 -0
- package/dist/lib/shortenTempPaths.d.ts +7 -1
- package/dist/lib/shortenTempPaths.d.ts.map +1 -1
- package/dist/lib/shortenTempPaths.js +7 -2
- package/dist/lib/shortenTempPaths.js.map +1 -1
- package/dist/lib/types.d.ts +19 -0
- package/dist/lib/types.d.ts.map +1 -0
- package/dist/lib/types.js +2 -0
- package/dist/lib/types.js.map +1 -0
- package/dist/lib/useTerminalSize.d.ts +3 -2
- package/dist/lib/useTerminalSize.d.ts.map +1 -1
- package/dist/lib/useTerminalSize.js +4 -6
- package/dist/lib/useTerminalSize.js.map +1 -1
- package/package.json +4 -3
- package/templates/core-prompt.md +77 -0
- package/templates/skills/manage-tasks/SKILL.md +113 -0
- package/templates/workflow.md +46 -0
- package/templates/prompt-beads.md +0 -44
- package/templates/prompt-todos.md +0 -17
- package/templates/todo.md +0 -9
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getBaseCwd.d.ts","sourceRoot":"","sources":["../../src/lib/getBaseCwd.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,eAAO,MAAM,UAAU,cAA+C,CAAA"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Get the base working directory for relative path calculations.
|
|
3
|
+
* Respects RALPH_CWD environment variable if set, otherwise uses current working directory.
|
|
4
|
+
*/
|
|
5
|
+
export const getBaseCwd = () => process.env.RALPH_CWD ?? process.cwd();
|
|
6
|
+
//# sourceMappingURL=getBaseCwd.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getBaseCwd.js","sourceRoot":"","sources":["../../src/lib/getBaseCwd.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,GAAG,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,SAAS,IAAI,OAAO,CAAC,GAAG,EAAE,CAAA"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { ProgressData } from "./types.js";
|
|
2
|
+
/** Get progress for a beads workspace by counting issues created and closed since startup. */
|
|
3
|
+
export declare const getBeadsProgress: (
|
|
4
|
+
/** Initial count of open + in_progress issues */
|
|
5
|
+
initialCount: number,
|
|
6
|
+
/** RFC3339 timestamp for counting issues created after this time */
|
|
7
|
+
startupTimestamp: string) => ProgressData;
|
|
8
|
+
//# sourceMappingURL=getBeadsProgress.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getBeadsProgress.d.ts","sourceRoot":"","sources":["../../src/lib/getBeadsProgress.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAA;AAE9C,+FAA+F;AAC/F,eAAO,MAAM,gBAAgB;AAC3B,iDAAiD;AACjD,cAAc,MAAM;AACpB,oEAAoE;AACpE,kBAAkB,MAAM,KACvB,YAsCF,CAAA"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { execSync } from "child_process";
|
|
2
|
+
/** Get progress for a beads workspace by counting issues created and closed since startup. */
|
|
3
|
+
export const getBeadsProgress = (
|
|
4
|
+
/** Initial count of open + in_progress issues */
|
|
5
|
+
initialCount,
|
|
6
|
+
/** RFC3339 timestamp for counting issues created after this time */
|
|
7
|
+
startupTimestamp) => {
|
|
8
|
+
try {
|
|
9
|
+
// Count issues created since startup
|
|
10
|
+
const createdSinceStartup = parseInt(execSync(`bd count --created-after="${startupTimestamp}"`, {
|
|
11
|
+
encoding: "utf-8",
|
|
12
|
+
stdio: ["pipe", "pipe", "pipe"],
|
|
13
|
+
}).trim(), 10);
|
|
14
|
+
// Count current open + in_progress issues
|
|
15
|
+
const currentOpen = parseInt(execSync("bd count --status=open", {
|
|
16
|
+
encoding: "utf-8",
|
|
17
|
+
stdio: ["pipe", "pipe", "pipe"],
|
|
18
|
+
}).trim(), 10);
|
|
19
|
+
const currentInProgress = parseInt(execSync("bd count --status=in_progress", {
|
|
20
|
+
encoding: "utf-8",
|
|
21
|
+
stdio: ["pipe", "pipe", "pipe"],
|
|
22
|
+
}).trim(), 10);
|
|
23
|
+
const currentRemaining = currentOpen + currentInProgress;
|
|
24
|
+
// Total = initial open+in_progress + any new issues created
|
|
25
|
+
const total = initialCount + createdSinceStartup;
|
|
26
|
+
// Completed = total - remaining (accounts for issues closed by any means)
|
|
27
|
+
const completed = total - currentRemaining;
|
|
28
|
+
return { type: "beads", completed, total };
|
|
29
|
+
}
|
|
30
|
+
catch {
|
|
31
|
+
// If bd command fails, return no progress
|
|
32
|
+
return { type: "none", completed: 0, total: 0 };
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
//# sourceMappingURL=getBeadsProgress.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getBeadsProgress.js","sourceRoot":"","sources":["../../src/lib/getBeadsProgress.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AAGxC,+FAA+F;AAC/F,MAAM,CAAC,MAAM,gBAAgB,GAAG;AAC9B,iDAAiD;AACjD,YAAoB;AACpB,oEAAoE;AACpE,gBAAwB,EACV,EAAE;IAChB,IAAI,CAAC;QACH,qCAAqC;QACrC,MAAM,mBAAmB,GAAG,QAAQ,CAClC,QAAQ,CAAC,6BAA6B,gBAAgB,GAAG,EAAE;YACzD,QAAQ,EAAE,OAAO;YACjB,KAAK,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC;SAChC,CAAC,CAAC,IAAI,EAAE,EACT,EAAE,CACH,CAAA;QAED,0CAA0C;QAC1C,MAAM,WAAW,GAAG,QAAQ,CAC1B,QAAQ,CAAC,wBAAwB,EAAE;YACjC,QAAQ,EAAE,OAAO;YACjB,KAAK,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC;SAChC,CAAC,CAAC,IAAI,EAAE,EACT,EAAE,CACH,CAAA;QACD,MAAM,iBAAiB,GAAG,QAAQ,CAChC,QAAQ,CAAC,+BAA+B,EAAE;YACxC,QAAQ,EAAE,OAAO;YACjB,KAAK,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC;SAChC,CAAC,CAAC,IAAI,EAAE,EACT,EAAE,CACH,CAAA;QACD,MAAM,gBAAgB,GAAG,WAAW,GAAG,iBAAiB,CAAA;QAExD,4DAA4D;QAC5D,MAAM,KAAK,GAAG,YAAY,GAAG,mBAAmB,CAAA;QAChD,0EAA0E;QAC1E,MAAM,SAAS,GAAG,KAAK,GAAG,gBAAgB,CAAA;QAE1C,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,CAAA;IAC5C,CAAC;IAAC,MAAM,CAAC;QACP,0CAA0C;QAC1C,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,CAAA;IACjD,CAAC;AACH,CAAC,CAAA"}
|
|
@@ -1,2 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Get the installed Claude CLI version by executing `claude --version`.
|
|
3
|
+
* Returns the version string (e.g., "2.1.5") or "unknown" if unable to determine.
|
|
4
|
+
*/
|
|
1
5
|
export declare const getClaudeVersion: () => string;
|
|
2
6
|
//# sourceMappingURL=getClaudeVersion.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getClaudeVersion.d.ts","sourceRoot":"","sources":["../../src/lib/getClaudeVersion.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,gBAAgB,QAAO,MAcnC,CAAA"}
|
|
1
|
+
{"version":3,"file":"getClaudeVersion.d.ts","sourceRoot":"","sources":["../../src/lib/getClaudeVersion.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,eAAO,MAAM,gBAAgB,QAAO,MAcnC,CAAA"}
|
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
import { execSync } from "child_process";
|
|
2
|
+
/**
|
|
3
|
+
* Get the installed Claude CLI version by executing `claude --version`.
|
|
4
|
+
* Returns the version string (e.g., "2.1.5") or "unknown" if unable to determine.
|
|
5
|
+
*/
|
|
2
6
|
export const getClaudeVersion = () => {
|
|
3
7
|
try {
|
|
4
8
|
const output = execSync("claude --version", {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getClaudeVersion.js","sourceRoot":"","sources":["../../src/lib/getClaudeVersion.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AAExC,MAAM,CAAC,MAAM,gBAAgB,GAAG,GAAW,EAAE;IAC3C,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,QAAQ,CAAC,kBAAkB,EAAE;YAC1C,QAAQ,EAAE,OAAO;YACjB,KAAK,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC;SAChC,CAAC,CAAC,IAAI,EAAE,CAAA;QAET,uCAAuC;QACvC,6BAA6B;QAC7B,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC,WAAW,CAAC,CAAA;QACvC,OAAO,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAA;IACrC,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,SAAS,CAAA;IAClB,CAAC;AACH,CAAC,CAAA"}
|
|
1
|
+
{"version":3,"file":"getClaudeVersion.js","sourceRoot":"","sources":["../../src/lib/getClaudeVersion.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AAExC;;;GAGG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,GAAW,EAAE;IAC3C,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,QAAQ,CAAC,kBAAkB,EAAE;YAC1C,QAAQ,EAAE,OAAO;YACjB,KAAK,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC;SAChC,CAAC,CAAC,IAAI,EAAE,CAAA;QAET,uCAAuC;QACvC,6BAA6B;QAC7B,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC,WAAW,CAAC,CAAA;QACvC,OAAO,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAA;IACrC,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,SAAS,CAAA;IAClB,CAAC;AACH,CAAC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getDefaultIterations.d.ts","sourceRoot":"","sources":["../../src/lib/getDefaultIterations.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,eAAO,MAAM,oBAAoB,QAAO,MAOvC,CAAA"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { getOpenIssueCount } from "./getOpenIssueCount.js";
|
|
2
|
+
/**
|
|
3
|
+
* Calculate the default number of iterations based on open issues.
|
|
4
|
+
* Returns 120% of open issues, with a minimum of 10 and maximum of 100.
|
|
5
|
+
*/
|
|
6
|
+
export const getDefaultIterations = () => {
|
|
7
|
+
const openIssues = getOpenIssueCount();
|
|
8
|
+
if (openIssues === 0) {
|
|
9
|
+
return 10; // Fallback when no issues or bd not available
|
|
10
|
+
}
|
|
11
|
+
const calculated = Math.ceil(openIssues * 1.2);
|
|
12
|
+
return Math.max(10, Math.min(100, calculated));
|
|
13
|
+
};
|
|
14
|
+
//# sourceMappingURL=getDefaultIterations.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getDefaultIterations.js","sourceRoot":"","sources":["../../src/lib/getDefaultIterations.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAA;AAE1D;;;GAGG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,GAAW,EAAE;IAC/C,MAAM,UAAU,GAAG,iBAAiB,EAAE,CAAA;IACtC,IAAI,UAAU,KAAK,CAAC,EAAE,CAAC;QACrB,OAAO,EAAE,CAAA,CAAC,8CAA8C;IAC1D,CAAC;IACD,MAAM,UAAU,GAAG,IAAI,CAAC,IAAI,CAAC,UAAU,GAAG,GAAG,CAAC,CAAA;IAC9C,OAAO,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,UAAU,CAAC,CAAC,CAAA;AAChD,CAAC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getDefaultIterations.test.d.ts","sourceRoot":"","sources":["../../src/lib/getDefaultIterations.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { describe, it, expect, vi, beforeEach, afterEach } from "vitest";
|
|
2
|
+
import { getDefaultIterations } from "./getDefaultIterations.js";
|
|
3
|
+
import * as childProcess from "child_process";
|
|
4
|
+
vi.mock("child_process");
|
|
5
|
+
describe("getDefaultIterations", () => {
|
|
6
|
+
beforeEach(() => {
|
|
7
|
+
vi.resetAllMocks();
|
|
8
|
+
});
|
|
9
|
+
afterEach(() => {
|
|
10
|
+
vi.restoreAllMocks();
|
|
11
|
+
});
|
|
12
|
+
it("returns 120% of open issues (rounded up)", () => {
|
|
13
|
+
vi.mocked(childProcess.execSync).mockReturnValue(JSON.stringify(Array(10).fill({ id: "x" })));
|
|
14
|
+
expect(getDefaultIterations()).toBe(12); // 10 * 1.2 = 12
|
|
15
|
+
});
|
|
16
|
+
it("returns minimum of 10 when calculated value is lower", () => {
|
|
17
|
+
vi.mocked(childProcess.execSync).mockReturnValue(JSON.stringify(Array(5).fill({ id: "x" })));
|
|
18
|
+
expect(getDefaultIterations()).toBe(10); // 5 * 1.2 = 6, but min is 10
|
|
19
|
+
});
|
|
20
|
+
it("returns maximum of 100 when calculated value is higher", () => {
|
|
21
|
+
vi.mocked(childProcess.execSync).mockReturnValue(JSON.stringify(Array(100).fill({ id: "x" })));
|
|
22
|
+
expect(getDefaultIterations()).toBe(100); // 100 * 1.2 = 120, but max is 100
|
|
23
|
+
});
|
|
24
|
+
it("returns 10 when no open issues", () => {
|
|
25
|
+
vi.mocked(childProcess.execSync).mockReturnValue("[]");
|
|
26
|
+
expect(getDefaultIterations()).toBe(10);
|
|
27
|
+
});
|
|
28
|
+
it("returns 10 when bd command fails", () => {
|
|
29
|
+
vi.mocked(childProcess.execSync).mockImplementation(() => {
|
|
30
|
+
throw new Error("bd not found");
|
|
31
|
+
});
|
|
32
|
+
expect(getDefaultIterations()).toBe(10);
|
|
33
|
+
});
|
|
34
|
+
it("handles fractional calculations correctly", () => {
|
|
35
|
+
vi.mocked(childProcess.execSync).mockReturnValue(JSON.stringify(Array(15).fill({ id: "x" })));
|
|
36
|
+
expect(getDefaultIterations()).toBe(18); // 15 * 1.2 = 18
|
|
37
|
+
});
|
|
38
|
+
});
|
|
39
|
+
//# sourceMappingURL=getDefaultIterations.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getDefaultIterations.test.js","sourceRoot":"","sources":["../../src/lib/getDefaultIterations.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAA;AACxE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAA;AAChE,OAAO,KAAK,YAAY,MAAM,eAAe,CAAA;AAE7C,EAAE,CAAC,IAAI,CAAC,eAAe,CA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+
import { findMaxLogNumber } from "./findMaxLogNumber.js";
|
|
3
|
+
/**
|
|
4
|
+
* Get the path to the most recent (highest numbered) log file in the .ralph directory.
|
|
5
|
+
* Returns undefined if no event logs exist.
|
|
6
|
+
*/
|
|
7
|
+
export const getLatestLogFile = () => {
|
|
8
|
+
const maxNumber = findMaxLogNumber();
|
|
9
|
+
if (maxNumber === 0) {
|
|
10
|
+
return undefined;
|
|
11
|
+
}
|
|
12
|
+
const ralphDir = join(process.cwd(), ".ralph");
|
|
13
|
+
return join(ralphDir, `events-${maxNumber}.jsonl`);
|
|
14
|
+
};
|
|
15
|
+
//# sourceMappingURL=getLatestLogFile.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getLatestLogFile.js","sourceRoot":"","sources":["../../src/lib/getLatestLogFile.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAA;AAC3B,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAA;AAExD;;;GAGG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,GAAuB,EAAE;IACvD,MAAM,SAAS,GAAG,gBAAgB,EAAE,CAAA;IACpC,IAAI,SAAS,KAAK,CAAC,EAAE,CAAC;QACpB,OAAO,SAAS,CAAA;IAClB,CAAC;IAED,MAAM,QAAQ,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,QAAQ,CAAC,CAAA;IAC9C,OAAO,IAAI,CAAC,QAAQ,EAAE,UAAU,SAAS,QAAQ,CAAC,CAAA;AACpD,CAAC,CAAA"}
|
|
@@ -4,9 +4,4 @@
|
|
|
4
4
|
* Returns the path for the next available number (highest existing + 1).
|
|
5
5
|
*/
|
|
6
6
|
export declare const getNextLogFile: () => string;
|
|
7
|
-
/**
|
|
8
|
-
* Get the path to the most recent (highest numbered) log file in the .ralph directory.
|
|
9
|
-
* Returns undefined if no event logs exist.
|
|
10
|
-
*/
|
|
11
|
-
export declare const getLatestLogFile: () => string | undefined;
|
|
12
7
|
//# sourceMappingURL=getNextLogFile.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getNextLogFile.d.ts","sourceRoot":"","sources":["../../src/lib/getNextLogFile.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"getNextLogFile.d.ts","sourceRoot":"","sources":["../../src/lib/getNextLogFile.ts"],"names":[],"mappings":"AAIA;;;;GAIG;AACH,eAAO,MAAM,cAAc,QAAO,MAUjC,CAAA"}
|
|
@@ -1,28 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { existsSync, mkdirSync } from "fs";
|
|
2
2
|
import { join } from "path";
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Find the highest numbered event log file that exists in the .ralph directory.
|
|
6
|
-
* Returns 0 if no event logs exist.
|
|
7
|
-
*/
|
|
8
|
-
const findMaxLogNumber = () => {
|
|
9
|
-
const ralphDir = join(process.cwd(), ".ralph");
|
|
10
|
-
if (!existsSync(ralphDir)) {
|
|
11
|
-
return 0;
|
|
12
|
-
}
|
|
13
|
-
const files = readdirSync(ralphDir);
|
|
14
|
-
let maxNumber = 0;
|
|
15
|
-
for (const file of files) {
|
|
16
|
-
const match = file.match(EVENT_LOG_PATTERN);
|
|
17
|
-
if (match) {
|
|
18
|
-
const num = parseInt(match[1], 10);
|
|
19
|
-
if (num > maxNumber) {
|
|
20
|
-
maxNumber = num;
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
return maxNumber;
|
|
25
|
-
};
|
|
3
|
+
import { findMaxLogNumber } from "./findMaxLogNumber.js";
|
|
26
4
|
/**
|
|
27
5
|
* Get the path to the next sequential log file in the .ralph directory.
|
|
28
6
|
* Files are named events-1.jsonl, events-2.jsonl, etc.
|
|
@@ -37,16 +15,4 @@ export const getNextLogFile = () => {
|
|
|
37
15
|
const maxNumber = findMaxLogNumber();
|
|
38
16
|
return join(ralphDir, `events-${maxNumber + 1}.jsonl`);
|
|
39
17
|
};
|
|
40
|
-
/**
|
|
41
|
-
* Get the path to the most recent (highest numbered) log file in the .ralph directory.
|
|
42
|
-
* Returns undefined if no event logs exist.
|
|
43
|
-
*/
|
|
44
|
-
export const getLatestLogFile = () => {
|
|
45
|
-
const maxNumber = findMaxLogNumber();
|
|
46
|
-
if (maxNumber === 0) {
|
|
47
|
-
return undefined;
|
|
48
|
-
}
|
|
49
|
-
const ralphDir = join(process.cwd(), ".ralph");
|
|
50
|
-
return join(ralphDir, `events-${maxNumber}.jsonl`);
|
|
51
|
-
};
|
|
52
18
|
//# sourceMappingURL=getNextLogFile.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getNextLogFile.js","sourceRoot":"","sources":["../../src/lib/getNextLogFile.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"getNextLogFile.js","sourceRoot":"","sources":["../../src/lib/getNextLogFile.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,IAAI,CAAA;AAC1C,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAA;AAC3B,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAA;AAExD;;;;GAIG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,GAAW,EAAE;IACzC,MAAM,QAAQ,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,QAAQ,CAAC,CAAA;IAE9C,iCAAiC;IACjC,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAE,CAAC;QAC1B,SAAS,CAAC,QAAQ,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAA;IAC1C,CAAC;IAED,MAAM,SAAS,GAAG,gBAAgB,EAAE,CAAA;IACpC,OAAO,IAAI,CAAC,QAAQ,EAAE,UAAU,SAAS,GAAG,CAAC,QAAQ,CAAC,CAAA;AACxD,CAAC,CAAA"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { describe, it, expect, beforeEach, afterEach } from "vitest";
|
|
2
|
-
import { getNextLogFile
|
|
2
|
+
import { getNextLogFile } from "./getNextLogFile.js";
|
|
3
|
+
import { getLatestLogFile } from "./getLatestLogFile.js";
|
|
3
4
|
import { rmSync, existsSync } from "fs";
|
|
4
5
|
import { join } from "path";
|
|
5
6
|
describe("getNextLogFile", () => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getNextLogFile.test.js","sourceRoot":"","sources":["../../src/lib/getNextLogFile.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAA;AACpE,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"getNextLogFile.test.js","sourceRoot":"","sources":["../../src/lib/getNextLogFile.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAA;AACpE,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;AACpD,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAA;AACxD,OAAO,EAAa,MAAM,EAAiB,UAAU,EAAE,MAAM,IAAI,CAAA;AACjE,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAA;AAE3B,QAAQ,CAAC,gBAAgB,EAAE,GAAG,EAAE;IAC9B,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,aAAa,CAAC,CAAA;IAElD,UAAU,CAAC,GAAG,EAAE;QACd,uCAAuC;QACvC,IAAI,UAAU,CAAC,OAAO,CAAC,EAAE,CAAC;YACxB,MAAM,CAAC,OAAO,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,C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,SAAS,EAAE,CAAC;YACzB,kDAAkD;YAClD,MAAM,CAAC,IAAI,CAAC,CAAC,SAAS,CAAC,gBAAgB,CAAC,CAAA;QAC1C,CAAC;aAAM,CAAC;YACN,gDAAgD;YAChD,MAAM,WAAW,GAAG,MAAM,CAAC,KAAK,CAAC,sBAAsB,CAAC,CAAA;YACxD,MAAM,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC,sBAAsB,CAAC,CAAA;YACpD,MAAM,CAAC,WAAW,CAAC,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAA;YAClC,MAAM,CAAC,SAAS,CAAC,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAA;YAChC,IAAI,WAAW,IAAI,SAAS,EAAE,CAAC;gBAC7B,MAAM,SAAS,GAAG,QAAQ,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAA;gBAC9C,MAAM,OAAO,GAAG,QAAQ,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAA;gBAC1C,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,SAAS,GAAG,CAAC,CAAC,CAAA;YACrC,CAAC;QACH,CAAC;IACH,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA"}
|
|
@@ -3,9 +3,4 @@
|
|
|
3
3
|
* Returns 0 if beads is not available or there are no issues.
|
|
4
4
|
*/
|
|
5
5
|
export declare const getOpenIssueCount: () => number;
|
|
6
|
-
/**
|
|
7
|
-
* Calculate the default number of iterations based on open issues.
|
|
8
|
-
* Returns 120% of open issues, with a minimum of 10 and maximum of 100.
|
|
9
|
-
*/
|
|
10
|
-
export declare const getDefaultIterations: () => number;
|
|
11
6
|
//# sourceMappingURL=getOpenIssueCount.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getOpenIssueCount.d.ts","sourceRoot":"","sources":["../../src/lib/getOpenIssueCount.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,eAAO,MAAM,iBAAiB,QAAO,MAYpC,CAAA
|
|
1
|
+
{"version":3,"file":"getOpenIssueCount.d.ts","sourceRoot":"","sources":["../../src/lib/getOpenIssueCount.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,eAAO,MAAM,iBAAiB,QAAO,MAYpC,CAAA"}
|
|
@@ -16,16 +16,4 @@ export const getOpenIssueCount = () => {
|
|
|
16
16
|
return 0;
|
|
17
17
|
}
|
|
18
18
|
};
|
|
19
|
-
/**
|
|
20
|
-
* Calculate the default number of iterations based on open issues.
|
|
21
|
-
* Returns 120% of open issues, with a minimum of 10 and maximum of 100.
|
|
22
|
-
*/
|
|
23
|
-
export const getDefaultIterations = () => {
|
|
24
|
-
const openIssues = getOpenIssueCount();
|
|
25
|
-
if (openIssues === 0) {
|
|
26
|
-
return 10; // Fallback when no issues or bd not available
|
|
27
|
-
}
|
|
28
|
-
const calculated = Math.ceil(openIssues * 1.2);
|
|
29
|
-
return Math.max(10, Math.min(100, calculated));
|
|
30
|
-
};
|
|
31
19
|
//# sourceMappingURL=getOpenIssueCount.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getOpenIssueCount.js","sourceRoot":"","sources":["../../src/lib/getOpenIssueCount.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AAExC;;;GAGG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,GAAW,EAAE;IAC5C,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,QAAQ,CAAC,8BAA8B,EAAE;YACtD,QAAQ,EAAE,OAAO;YACjB,KAAK,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC;SAChC,CAAC,CAAC,IAAI,EAAE,CAAA;QAET,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAA;QACjC,OAAO,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAA;IAClD,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,CAAC,CAAA;IACV,CAAC;AACH,CAAC,CAAA
|
|
1
|
+
{"version":3,"file":"getOpenIssueCount.js","sourceRoot":"","sources":["../../src/lib/getOpenIssueCount.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AAExC;;;GAGG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,GAAW,EAAE;IAC5C,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,QAAQ,CAAC,8BAA8B,EAAE;YACtD,QAAQ,EAAE,OAAO;YACjB,KAAK,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC;SAChC,CAAC,CAAC,IAAI,EAAE,CAAA;QAET,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAA;QACjC,OAAO,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAA;IAClD,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,CAAC,CAAA;IACV,CAAC;AACH,CAAC,CAAA"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { describe, it, expect, vi, beforeEach, afterEach } from "vitest";
|
|
2
|
-
import { getOpenIssueCount
|
|
2
|
+
import { getOpenIssueCount } from "./getOpenIssueCount.js";
|
|
3
3
|
import * as childProcess from "child_process";
|
|
4
4
|
vi.mock("child_process");
|
|
5
5
|
describe("getOpenIssueCount", () => {
|
|
@@ -28,38 +28,4 @@ describe("getOpenIssueCount", () => {
|
|
|
28
28
|
expect(getOpenIssueCount()).toBe(0);
|
|
29
29
|
});
|
|
30
30
|
});
|
|
31
|
-
describe("getDefaultIterations", () => {
|
|
32
|
-
beforeEach(() => {
|
|
33
|
-
vi.resetAllMocks();
|
|
34
|
-
});
|
|
35
|
-
afterEach(() => {
|
|
36
|
-
vi.restoreAllMocks();
|
|
37
|
-
});
|
|
38
|
-
it("returns 120% of open issues (rounded up)", () => {
|
|
39
|
-
vi.mocked(childProcess.execSync).mockReturnValue(JSON.stringify(Array(10).fill({ id: "x" })));
|
|
40
|
-
expect(getDefaultIterations()).toBe(12); // 10 * 1.2 = 12
|
|
41
|
-
});
|
|
42
|
-
it("returns minimum of 10 when calculated value is lower", () => {
|
|
43
|
-
vi.mocked(childProcess.execSync).mockReturnValue(JSON.stringify(Array(5).fill({ id: "x" })));
|
|
44
|
-
expect(getDefaultIterations()).toBe(10); // 5 * 1.2 = 6, but min is 10
|
|
45
|
-
});
|
|
46
|
-
it("returns maximum of 100 when calculated value is higher", () => {
|
|
47
|
-
vi.mocked(childProcess.execSync).mockReturnValue(JSON.stringify(Array(100).fill({ id: "x" })));
|
|
48
|
-
expect(getDefaultIterations()).toBe(100); // 100 * 1.2 = 120, but max is 100
|
|
49
|
-
});
|
|
50
|
-
it("returns 10 when no open issues", () => {
|
|
51
|
-
vi.mocked(childProcess.execSync).mockReturnValue("[]");
|
|
52
|
-
expect(getDefaultIterations()).toBe(10);
|
|
53
|
-
});
|
|
54
|
-
it("returns 10 when bd command fails", () => {
|
|
55
|
-
vi.mocked(childProcess.execSync).mockImplementation(() => {
|
|
56
|
-
throw new Error("bd not found");
|
|
57
|
-
});
|
|
58
|
-
expect(getDefaultIterations()).toBe(10);
|
|
59
|
-
});
|
|
60
|
-
it("handles fractional calculations correctly", () => {
|
|
61
|
-
vi.mocked(childProcess.execSync).mockReturnValue(JSON.stringify(Array(15).fill({ id: "x" })));
|
|
62
|
-
expect(getDefaultIterations()).toBe(18); // 15 * 1.2 = 18
|
|
63
|
-
});
|
|
64
|
-
});
|
|
65
31
|
//# sourceMappingURL=getOpenIssueCount.test.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getOpenIssueCount.test.js","sourceRoot":"","sources":["../../src/lib/getOpenIssueCount.test.ts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GAAG,EAAE;YACvD,MAAM,IAAI,KAAK,CAAC,cAAc,CAAC,CAAA;QACjC,CAAC,CAAC,CAAA;QACF,MAAM,CAAC,iBAAiB,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;IACrC,CAAC,CAAC,CAAA;IAEF,EAAE,CAAC,uCAAuC,EAAE,GAAG,EAAE;QAC/C,EAAE,CAAC,MAAM,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC,eAAe,CAAC,UAAU,CAAC,CAAA;QAC5D,MAAM,CAAC,iBAAiB,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;IACrC,CAAC,CAAC,CAAA;IAEF,EAAE,CAAC,uCAAuC,EAAE,GAAG,EAAE;QAC/C,EAAE,CAAC,MAAM,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC,eAAe,CAAC,wBAAwB,CAAC,CAAA;QAC1E,MAAM,CAAC,iBAAiB,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;IACrC,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA"}
|
|
@@ -1,10 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
type: "beads" | "todo" | "none";
|
|
3
|
-
/** Number of issues/tasks completed since startup */
|
|
4
|
-
completed: number;
|
|
5
|
-
/** Total issues/tasks seen since startup (initial + created since) */
|
|
6
|
-
total: number;
|
|
7
|
-
};
|
|
1
|
+
import type { ProgressData } from "./types.js";
|
|
8
2
|
/**
|
|
9
3
|
* Get progress data from the workspace.
|
|
10
4
|
*
|
|
@@ -12,23 +6,9 @@ export type ProgressData = {
|
|
|
12
6
|
* issues closed and created since startup.
|
|
13
7
|
* For todo.md workspaces: completed = checked items, total = all items
|
|
14
8
|
*/
|
|
15
|
-
export declare const getProgress: (
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
timestamp: string;
|
|
21
|
-
/** Type of workspace (beads or todo) */
|
|
22
|
-
type: "beads" | "todo";
|
|
23
|
-
};
|
|
24
|
-
/**
|
|
25
|
-
* Capture a startup snapshot for beads workspaces.
|
|
26
|
-
* Call this once at startup to capture the baseline count and timestamp.
|
|
27
|
-
* Returns undefined if not a beads workspace.
|
|
28
|
-
*/
|
|
29
|
-
export declare const captureStartupSnapshot: () => StartupSnapshot | undefined;
|
|
30
|
-
/**
|
|
31
|
-
* @deprecated Use captureStartupSnapshot instead
|
|
32
|
-
*/
|
|
33
|
-
export declare const getInitialBeadsCount: () => number | undefined;
|
|
9
|
+
export declare const getProgress: (
|
|
10
|
+
/** Initial count of open + in_progress issues at startup */
|
|
11
|
+
initialCount: number,
|
|
12
|
+
/** RFC3339 timestamp for counting issues created after this time */
|
|
13
|
+
startupTimestamp: string) => ProgressData;
|
|
34
14
|
//# sourceMappingURL=getProgress.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getProgress.d.ts","sourceRoot":"","sources":["../../src/lib/getProgress.ts"],"names":[],"mappings":"AAIA,
|
|
1
|
+
{"version":3,"file":"getProgress.d.ts","sourceRoot":"","sources":["../../src/lib/getProgress.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAA;AAM9C;;;;;;GAMG;AACH,eAAO,MAAM,WAAW;AACtB,4DAA4D;AAC5D,cAAc,MAAM;AACpB,oEAAoE;AACpE,kBAAkB,MAAM,KACvB,YAYF,CAAA"}
|
package/dist/lib/getProgress.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { existsSync
|
|
1
|
+
import { existsSync } from "fs";
|
|
2
2
|
import { join } from "path";
|
|
3
|
-
import {
|
|
3
|
+
import { getBeadsProgress } from "./getBeadsProgress.js";
|
|
4
|
+
import { getTodoProgress } from "./getTodoProgress.js";
|
|
4
5
|
const beadsDir = join(process.cwd(), ".beads");
|
|
5
6
|
const ralphDir = join(process.cwd(), ".ralph");
|
|
6
7
|
const todoFile = join(ralphDir, "todo.md");
|
|
@@ -11,7 +12,11 @@ const todoFile = join(ralphDir, "todo.md");
|
|
|
11
12
|
* issues closed and created since startup.
|
|
12
13
|
* For todo.md workspaces: completed = checked items, total = all items
|
|
13
14
|
*/
|
|
14
|
-
export const getProgress = (
|
|
15
|
+
export const getProgress = (
|
|
16
|
+
/** Initial count of open + in_progress issues at startup */
|
|
17
|
+
initialCount,
|
|
18
|
+
/** RFC3339 timestamp for counting issues created after this time */
|
|
19
|
+
startupTimestamp) => {
|
|
15
20
|
// Check for beads workspace first
|
|
16
21
|
if (existsSync(beadsDir)) {
|
|
17
22
|
return getBeadsProgress(initialCount, startupTimestamp);
|
|
@@ -22,110 +27,4 @@ export const getProgress = (initialCount, startupTimestamp) => {
|
|
|
22
27
|
}
|
|
23
28
|
return { type: "none", completed: 0, total: 0 };
|
|
24
29
|
};
|
|
25
|
-
const getBeadsProgress = (initialCount, startupTimestamp) => {
|
|
26
|
-
try {
|
|
27
|
-
// Count issues created since startup
|
|
28
|
-
const createdSinceStartup = parseInt(execSync(`bd count --created-after="${startupTimestamp}"`, {
|
|
29
|
-
encoding: "utf-8",
|
|
30
|
-
stdio: ["pipe", "pipe", "pipe"],
|
|
31
|
-
}).trim(), 10);
|
|
32
|
-
// Count current open + in_progress issues
|
|
33
|
-
const currentOpen = parseInt(execSync("bd count --status=open", {
|
|
34
|
-
encoding: "utf-8",
|
|
35
|
-
stdio: ["pipe", "pipe", "pipe"],
|
|
36
|
-
}).trim(), 10);
|
|
37
|
-
const currentInProgress = parseInt(execSync("bd count --status=in_progress", {
|
|
38
|
-
encoding: "utf-8",
|
|
39
|
-
stdio: ["pipe", "pipe", "pipe"],
|
|
40
|
-
}).trim(), 10);
|
|
41
|
-
const currentRemaining = currentOpen + currentInProgress;
|
|
42
|
-
// Total = initial open+in_progress + any new issues created
|
|
43
|
-
const total = initialCount + createdSinceStartup;
|
|
44
|
-
// Completed = total - remaining (accounts for issues closed by any means)
|
|
45
|
-
const completed = total - currentRemaining;
|
|
46
|
-
return { type: "beads", completed, total };
|
|
47
|
-
}
|
|
48
|
-
catch {
|
|
49
|
-
// If bd command fails, return no progress
|
|
50
|
-
return { type: "none", completed: 0, total: 0 };
|
|
51
|
-
}
|
|
52
|
-
};
|
|
53
|
-
const getTodoProgress = () => {
|
|
54
|
-
try {
|
|
55
|
-
const content = readFileSync(todoFile, "utf-8");
|
|
56
|
-
// Count unchecked items: - [ ]
|
|
57
|
-
const uncheckedMatches = content.match(/- \[ \]/g);
|
|
58
|
-
const unchecked = uncheckedMatches ? uncheckedMatches.length : 0;
|
|
59
|
-
// Count checked items: - [x] or - [X]
|
|
60
|
-
const checkedMatches = content.match(/- \[[xX]\]/g);
|
|
61
|
-
const checked = checkedMatches ? checkedMatches.length : 0;
|
|
62
|
-
const total = unchecked + checked;
|
|
63
|
-
return { type: "todo", completed: checked, total };
|
|
64
|
-
}
|
|
65
|
-
catch {
|
|
66
|
-
return { type: "none", completed: 0, total: 0 };
|
|
67
|
-
}
|
|
68
|
-
};
|
|
69
|
-
/**
|
|
70
|
-
* Capture a startup snapshot for beads workspaces.
|
|
71
|
-
* Call this once at startup to capture the baseline count and timestamp.
|
|
72
|
-
* Returns undefined if not a beads workspace.
|
|
73
|
-
*/
|
|
74
|
-
export const captureStartupSnapshot = () => {
|
|
75
|
-
// Check for beads workspace
|
|
76
|
-
if (existsSync(beadsDir)) {
|
|
77
|
-
return captureBeadsSnapshot();
|
|
78
|
-
}
|
|
79
|
-
// Check for todo.md workspace
|
|
80
|
-
if (existsSync(todoFile)) {
|
|
81
|
-
return captureTodoSnapshot();
|
|
82
|
-
}
|
|
83
|
-
return undefined;
|
|
84
|
-
};
|
|
85
|
-
const captureBeadsSnapshot = () => {
|
|
86
|
-
try {
|
|
87
|
-
const timestamp = new Date().toISOString();
|
|
88
|
-
const openCount = parseInt(execSync("bd count --status=open", {
|
|
89
|
-
encoding: "utf-8",
|
|
90
|
-
stdio: ["pipe", "pipe", "pipe"],
|
|
91
|
-
}).trim(), 10);
|
|
92
|
-
const inProgressCount = parseInt(execSync("bd count --status=in_progress", {
|
|
93
|
-
encoding: "utf-8",
|
|
94
|
-
stdio: ["pipe", "pipe", "pipe"],
|
|
95
|
-
}).trim(), 10);
|
|
96
|
-
return {
|
|
97
|
-
initialCount: openCount + inProgressCount,
|
|
98
|
-
timestamp,
|
|
99
|
-
type: "beads",
|
|
100
|
-
};
|
|
101
|
-
}
|
|
102
|
-
catch {
|
|
103
|
-
return undefined;
|
|
104
|
-
}
|
|
105
|
-
};
|
|
106
|
-
const captureTodoSnapshot = () => {
|
|
107
|
-
try {
|
|
108
|
-
const content = readFileSync(todoFile, "utf-8");
|
|
109
|
-
// Count all items (checked + unchecked)
|
|
110
|
-
const uncheckedMatches = content.match(/- \[ \]/g);
|
|
111
|
-
const unchecked = uncheckedMatches ? uncheckedMatches.length : 0;
|
|
112
|
-
const checkedMatches = content.match(/- \[[xX]\]/g);
|
|
113
|
-
const checked = checkedMatches ? checkedMatches.length : 0;
|
|
114
|
-
return {
|
|
115
|
-
initialCount: unchecked + checked,
|
|
116
|
-
timestamp: new Date().toISOString(),
|
|
117
|
-
type: "todo",
|
|
118
|
-
};
|
|
119
|
-
}
|
|
120
|
-
catch {
|
|
121
|
-
return undefined;
|
|
122
|
-
}
|
|
123
|
-
};
|
|
124
|
-
/**
|
|
125
|
-
* @deprecated Use captureStartupSnapshot instead
|
|
126
|
-
*/
|
|
127
|
-
export const getInitialBeadsCount = () => {
|
|
128
|
-
const snapshot = captureStartupSnapshot();
|
|
129
|
-
return snapshot?.initialCount;
|
|
130
|
-
};
|
|
131
30
|
//# sourceMappingURL=getProgress.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getProgress.js","sourceRoot":"","sources":["../../src/lib/getProgress.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,
|
|
1
|
+
{"version":3,"file":"getProgress.js","sourceRoot":"","sources":["../../src/lib/getProgress.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,IAAI,CAAA;AAC/B,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAA;AAC3B,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAA;AACxD,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AAGtD,MAAM,QAAQ,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,QAAQ,CAAC,CAAA;AAC9C,MAAM,QAAQ,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,QAAQ,CAAC,CAAA;AAC9C,MAAM,QAAQ,GAAG,IAAI,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAA;AAE1C;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG;AACzB,4DAA4D;AAC5D,YAAoB;AACpB,oEAAoE;AACpE,gBAAwB,EACV,EAAE;IAChB,kCAAkC;IAClC,IAAI,UAAU,CAAC,QAAQ,CAAC,EAAE,CAAC;QACzB,OAAO,gBAAgB,CAAC,YAAY,EAAE,gBAAgB,CAAC,CAAA;IACzD,CAAC;IAED,oBAAoB;IACpB,IAAI,UAAU,CAAC,QAAQ,CAAC,EAAE,CAAC;QACzB,OAAO,eAAe,EAAE,CAAA;IAC1B,CAAC;IAED,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,CAAA;AACjD,CAAC,CAAA"}
|