dino-spec 10.10.0 → 11.3.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.
- package/README.md +9 -2
- package/dist/core/ralph/index.d.ts +18 -0
- package/dist/core/ralph/index.d.ts.map +1 -0
- package/dist/core/ralph/index.js +19 -0
- package/dist/core/ralph/index.js.map +1 -0
- package/dist/core/ralph/progress-tracker.d.ts +63 -0
- package/dist/core/ralph/progress-tracker.d.ts.map +1 -0
- package/dist/core/ralph/progress-tracker.js +339 -0
- package/dist/core/ralph/progress-tracker.js.map +1 -0
- package/dist/core/ralph/sub-agent-spawner.d.ts +68 -0
- package/dist/core/ralph/sub-agent-spawner.d.ts.map +1 -0
- package/dist/core/ralph/sub-agent-spawner.js +241 -0
- package/dist/core/ralph/sub-agent-spawner.js.map +1 -0
- package/dist/core/ralph/types.d.ts +185 -0
- package/dist/core/ralph/types.d.ts.map +1 -0
- package/dist/core/ralph/types.js +21 -0
- package/dist/core/ralph/types.js.map +1 -0
- package/dist/core/spec-analyzer/index.d.ts +34 -1
- package/dist/core/spec-analyzer/index.d.ts.map +1 -1
- package/dist/core/spec-analyzer/index.js +55 -1
- package/dist/core/spec-analyzer/index.js.map +1 -1
- package/dist/hooks/post-edit.d.ts +5 -1
- package/dist/hooks/post-edit.d.ts.map +1 -1
- package/dist/hooks/post-edit.js +59 -1
- package/dist/hooks/post-edit.js.map +1 -1
- package/dist/hooks/user-prompt-submit.d.ts +2 -1
- package/dist/hooks/user-prompt-submit.d.ts.map +1 -1
- package/dist/hooks/user-prompt-submit.js +32 -3
- package/dist/hooks/user-prompt-submit.js.map +1 -1
- package/dist/mcp/tool-tiers.d.ts +2 -2
- package/dist/mcp/tool-tiers.d.ts.map +1 -1
- package/dist/mcp/tool-tiers.js +7 -2
- package/dist/mcp/tool-tiers.js.map +1 -1
- package/dist/mcp/tools/index.d.ts +4 -2
- package/dist/mcp/tools/index.d.ts.map +1 -1
- package/dist/mcp/tools/index.js +8 -2
- package/dist/mcp/tools/index.js.map +1 -1
- package/dist/mcp/tools/ralph.d.ts +78 -0
- package/dist/mcp/tools/ralph.d.ts.map +1 -0
- package/dist/mcp/tools/ralph.js +569 -0
- package/dist/mcp/tools/ralph.js.map +1 -0
- package/dist/skills/index.d.ts.map +1 -1
- package/dist/skills/index.js +74 -1
- package/dist/skills/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -10,13 +10,20 @@
|
|
|
10
10
|
<__|-|__|
|
|
11
11
|
```
|
|
12
12
|
|
|
13
|
-
**dino-spec** brings structured, context-aware development to [Claude Code](https://claude.ai/code). It automatically maintains session state, provides
|
|
13
|
+
**dino-spec** brings structured, context-aware development to [Claude Code](https://claude.ai/code). It automatically maintains session state, provides 54 MCP tools, and enables intelligent context retrieval with real-time statusline display.
|
|
14
14
|
|
|
15
15
|
> **v10.0.0 Breaking Change**: The `dino mcp-serve` command has been removed. Use `dino mcp serve` instead.
|
|
16
16
|
|
|
17
17
|
## Features
|
|
18
18
|
|
|
19
|
-
- **MCP Integration** -
|
|
19
|
+
- **MCP Integration** - 54 tools + 29 resources auto-configured during init
|
|
20
|
+
- **Ralph Loop** (v11.2.0) - Fresh-context iterative execution for large-scale development
|
|
21
|
+
- **Story-Based PRD** - Define multi-story features with acceptance criteria
|
|
22
|
+
- **Fresh Context** - Each iteration gets clean context (no history accumulation)
|
|
23
|
+
- **Git Checkpoints** - Automatic checkpoints for rollback capability
|
|
24
|
+
- **Learning Propagation** - Insights from failed iterations inform future attempts
|
|
25
|
+
- **Max 10 iterations** - Hard limit with max 2 attempts per story
|
|
26
|
+
- MCP tools: `dino_ralph_init`, `dino_ralph_iterate`, `dino_ralph_status`, `dino_ralph_learn`
|
|
20
27
|
- **MCP Tool Aggressive Filtering** (v10.3.0) - Phase-based tool context reduction (~50-70% savings)
|
|
21
28
|
- **Phase Filtering** - Only load tools relevant to current workflow phase
|
|
22
29
|
- **Description Modes** - Minimal/standard/full verbosity control
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Ralph Loop Module - v11.1.0
|
|
3
|
+
*
|
|
4
|
+
* Fresh-context iterative execution for large-scale development work.
|
|
5
|
+
* Based on Geoffrey Huntley's Ralph Loop pattern (mid-2025).
|
|
6
|
+
*
|
|
7
|
+
* Key features:
|
|
8
|
+
* - Story-based PRD execution
|
|
9
|
+
* - Fresh context per iteration (no history accumulation)
|
|
10
|
+
* - Git checkpoints for code persistence
|
|
11
|
+
* - Learning extraction and propagation
|
|
12
|
+
* - Max 10 iterations, max 2 per story
|
|
13
|
+
*/
|
|
14
|
+
export type { RalphStory, RalphStoryStatus, RalphPRD, RalphIteration, RalphIterationStatus, RalphProgress, RalphProgressStatus, RalphSubAgentContext, RalphConfig, RalphEvent, RalphEventType, RalphResult, } from './types.js';
|
|
15
|
+
export { DEFAULT_RALPH_CONFIG } from './types.js';
|
|
16
|
+
export { initProgress, loadProgress, saveProgress, startIteration, completeIteration, failIteration, markStoryComplete, markStoryFailed, getNextStory, getStory, formatProgressMarkdown, parseProgressMarkdown, getProgressSummary, } from './progress-tracker.js';
|
|
17
|
+
export { buildSubAgentContext, formatContextForHandoff, estimateContextTokens, buildCheckpointCommand, buildCheckpointTagCommand, buildStoryCommitCommand, buildRollbackCommand, extractLearningsFromResult, didTestsPass, parseTestFailures, buildTaskToolPrompt, buildTaskCreateInput, } from './sub-agent-spawner.js';
|
|
18
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/core/ralph/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAGH,YAAY,EACV,UAAU,EACV,gBAAgB,EAChB,QAAQ,EACR,cAAc,EACd,oBAAoB,EACpB,aAAa,EACb,mBAAmB,EACnB,oBAAoB,EACpB,WAAW,EACX,UAAU,EACV,cAAc,EACd,WAAW,GACZ,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAGlD,OAAO,EACL,YAAY,EACZ,YAAY,EACZ,YAAY,EACZ,cAAc,EACd,iBAAiB,EACjB,aAAa,EACb,iBAAiB,EACjB,eAAe,EACf,YAAY,EACZ,QAAQ,EACR,sBAAsB,EACtB,qBAAqB,EACrB,kBAAkB,GACnB,MAAM,uBAAuB,CAAC;AAG/B,OAAO,EACL,oBAAoB,EACpB,uBAAuB,EACvB,qBAAqB,EACrB,sBAAsB,EACtB,yBAAyB,EACzB,uBAAuB,EACvB,oBAAoB,EACpB,0BAA0B,EAC1B,YAAY,EACZ,iBAAiB,EACjB,mBAAmB,EACnB,oBAAoB,GACrB,MAAM,wBAAwB,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Ralph Loop Module - v11.1.0
|
|
3
|
+
*
|
|
4
|
+
* Fresh-context iterative execution for large-scale development work.
|
|
5
|
+
* Based on Geoffrey Huntley's Ralph Loop pattern (mid-2025).
|
|
6
|
+
*
|
|
7
|
+
* Key features:
|
|
8
|
+
* - Story-based PRD execution
|
|
9
|
+
* - Fresh context per iteration (no history accumulation)
|
|
10
|
+
* - Git checkpoints for code persistence
|
|
11
|
+
* - Learning extraction and propagation
|
|
12
|
+
* - Max 10 iterations, max 2 per story
|
|
13
|
+
*/
|
|
14
|
+
export { DEFAULT_RALPH_CONFIG } from './types.js';
|
|
15
|
+
// Progress Tracker
|
|
16
|
+
export { initProgress, loadProgress, saveProgress, startIteration, completeIteration, failIteration, markStoryComplete, markStoryFailed, getNextStory, getStory, formatProgressMarkdown, parseProgressMarkdown, getProgressSummary, } from './progress-tracker.js';
|
|
17
|
+
// Sub-Agent Spawner
|
|
18
|
+
export { buildSubAgentContext, formatContextForHandoff, estimateContextTokens, buildCheckpointCommand, buildCheckpointTagCommand, buildStoryCommitCommand, buildRollbackCommand, extractLearningsFromResult, didTestsPass, parseTestFailures, buildTaskToolPrompt, buildTaskCreateInput, } from './sub-agent-spawner.js';
|
|
19
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/core/ralph/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAkBH,OAAO,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAElD,mBAAmB;AACnB,OAAO,EACL,YAAY,EACZ,YAAY,EACZ,YAAY,EACZ,cAAc,EACd,iBAAiB,EACjB,aAAa,EACb,iBAAiB,EACjB,eAAe,EACf,YAAY,EACZ,QAAQ,EACR,sBAAsB,EACtB,qBAAqB,EACrB,kBAAkB,GACnB,MAAM,uBAAuB,CAAC;AAE/B,oBAAoB;AACpB,OAAO,EACL,oBAAoB,EACpB,uBAAuB,EACvB,qBAAqB,EACrB,sBAAsB,EACtB,yBAAyB,EACzB,uBAAuB,EACvB,oBAAoB,EACpB,0BAA0B,EAC1B,YAAY,EACZ,iBAAiB,EACjB,mBAAmB,EACnB,oBAAoB,GACrB,MAAM,wBAAwB,CAAC"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Ralph Progress Tracker - v11.1.0
|
|
3
|
+
*
|
|
4
|
+
* Manages Ralph Loop progress with `.dino/ralph-progress.md` persistence:
|
|
5
|
+
* - Initialize progress from PRD
|
|
6
|
+
* - Track iteration state
|
|
7
|
+
* - Record learnings
|
|
8
|
+
* - Persist to human-readable markdown
|
|
9
|
+
*/
|
|
10
|
+
import type { RalphPRD, RalphProgress, RalphStory, RalphIteration, RalphConfig } from './types.js';
|
|
11
|
+
/**
|
|
12
|
+
* Initialize progress from a PRD
|
|
13
|
+
*/
|
|
14
|
+
export declare function initProgress(prd: RalphPRD, config?: RalphConfig): RalphProgress;
|
|
15
|
+
/**
|
|
16
|
+
* Load progress from file
|
|
17
|
+
*/
|
|
18
|
+
export declare function loadProgress(projectDir: string): Promise<RalphProgress | null>;
|
|
19
|
+
/**
|
|
20
|
+
* Save progress to file
|
|
21
|
+
*/
|
|
22
|
+
export declare function saveProgress(projectDir: string, progress: RalphProgress): Promise<void>;
|
|
23
|
+
/**
|
|
24
|
+
* Start a new iteration
|
|
25
|
+
*/
|
|
26
|
+
export declare function startIteration(progress: RalphProgress, storyId: string, checkpointCommit: string): RalphIteration;
|
|
27
|
+
/**
|
|
28
|
+
* Complete an iteration
|
|
29
|
+
*/
|
|
30
|
+
export declare function completeIteration(progress: RalphProgress, iterationNumber: number, learnings: string[], testsPassed: boolean): void;
|
|
31
|
+
/**
|
|
32
|
+
* Mark iteration as failed with error
|
|
33
|
+
*/
|
|
34
|
+
export declare function failIteration(progress: RalphProgress, iterationNumber: number, error: string, learnings?: string[]): void;
|
|
35
|
+
/**
|
|
36
|
+
* Mark a story as complete
|
|
37
|
+
*/
|
|
38
|
+
export declare function markStoryComplete(progress: RalphProgress, storyId: string): void;
|
|
39
|
+
/**
|
|
40
|
+
* Mark a story as failed
|
|
41
|
+
*/
|
|
42
|
+
export declare function markStoryFailed(progress: RalphProgress, storyId: string): void;
|
|
43
|
+
/**
|
|
44
|
+
* Get next story to work on
|
|
45
|
+
*/
|
|
46
|
+
export declare function getNextStory(progress: RalphProgress, config?: RalphConfig): RalphStory | null;
|
|
47
|
+
/**
|
|
48
|
+
* Get story by ID
|
|
49
|
+
*/
|
|
50
|
+
export declare function getStory(progress: RalphProgress, storyId: string): RalphStory | null;
|
|
51
|
+
/**
|
|
52
|
+
* Format progress as markdown
|
|
53
|
+
*/
|
|
54
|
+
export declare function formatProgressMarkdown(progress: RalphProgress): string;
|
|
55
|
+
/**
|
|
56
|
+
* Parse progress from markdown
|
|
57
|
+
*/
|
|
58
|
+
export declare function parseProgressMarkdown(content: string): RalphProgress | null;
|
|
59
|
+
/**
|
|
60
|
+
* Get progress summary
|
|
61
|
+
*/
|
|
62
|
+
export declare function getProgressSummary(progress: RalphProgress): string;
|
|
63
|
+
//# sourceMappingURL=progress-tracker.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"progress-tracker.d.ts","sourceRoot":"","sources":["../../../src/core/ralph/progress-tracker.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAIH,OAAO,KAAK,EACV,QAAQ,EACR,aAAa,EACb,UAAU,EACV,cAAc,EACd,WAAW,EACZ,MAAM,YAAY,CAAC;AAcpB;;GAEG;AACH,wBAAgB,YAAY,CAC1B,GAAG,EAAE,QAAQ,EACb,MAAM,GAAE,WAAkC,GACzC,aAAa,CAiBf;AAaD;;GAEG;AACH,wBAAsB,YAAY,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,GAAG,IAAI,CAAC,CASpF;AAED;;GAEG;AACH,wBAAsB,YAAY,CAChC,UAAU,EAAE,MAAM,EAClB,QAAQ,EAAE,aAAa,GACtB,OAAO,CAAC,IAAI,CAAC,CAIf;AAMD;;GAEG;AACH,wBAAgB,cAAc,CAC5B,QAAQ,EAAE,aAAa,EACvB,OAAO,EAAE,MAAM,EACf,gBAAgB,EAAE,MAAM,GACvB,cAAc,CAyBhB;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAC/B,QAAQ,EAAE,aAAa,EACvB,eAAe,EAAE,MAAM,EACvB,SAAS,EAAE,MAAM,EAAE,EACnB,WAAW,EAAE,OAAO,GACnB,IAAI,CAmBN;AAED;;GAEG;AACH,wBAAgB,aAAa,CAC3B,QAAQ,EAAE,aAAa,EACvB,eAAe,EAAE,MAAM,EACvB,KAAK,EAAE,MAAM,EACb,SAAS,GAAE,MAAM,EAAO,GACvB,IAAI,CAcN;AAMD;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,aAAa,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI,CAehF;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,QAAQ,EAAE,aAAa,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI,CAO9E;AAED;;GAEG;AACH,wBAAgB,YAAY,CAC1B,QAAQ,EAAE,aAAa,EACvB,MAAM,GAAE,WAAkC,GACzC,UAAU,GAAG,IAAI,CAuBnB;AAED;;GAEG;AACH,wBAAgB,QAAQ,CAAC,QAAQ,EAAE,aAAa,EAAE,OAAO,EAAE,MAAM,GAAG,UAAU,GAAG,IAAI,CAEpF;AAMD;;GAEG;AACH,wBAAgB,sBAAsB,CAAC,QAAQ,EAAE,aAAa,GAAG,MAAM,CAuFtE;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,MAAM,GAAG,aAAa,GAAG,IAAI,CAa3E;AAuCD;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,aAAa,GAAG,MAAM,CAMlE"}
|
|
@@ -0,0 +1,339 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Ralph Progress Tracker - v11.1.0
|
|
3
|
+
*
|
|
4
|
+
* Manages Ralph Loop progress with `.dino/ralph-progress.md` persistence:
|
|
5
|
+
* - Initialize progress from PRD
|
|
6
|
+
* - Track iteration state
|
|
7
|
+
* - Record learnings
|
|
8
|
+
* - Persist to human-readable markdown
|
|
9
|
+
*/
|
|
10
|
+
import { join } from 'path';
|
|
11
|
+
import { FileSystem } from '../../utils/file-system.js';
|
|
12
|
+
import { DEFAULT_RALPH_CONFIG } from './types.js';
|
|
13
|
+
// =============================================================================
|
|
14
|
+
// Constants
|
|
15
|
+
// =============================================================================
|
|
16
|
+
const PROGRESS_FILE = 'ralph-progress.md';
|
|
17
|
+
const DINO_DIR = '.dino';
|
|
18
|
+
// =============================================================================
|
|
19
|
+
// Progress Initialization
|
|
20
|
+
// =============================================================================
|
|
21
|
+
/**
|
|
22
|
+
* Initialize progress from a PRD
|
|
23
|
+
*/
|
|
24
|
+
export function initProgress(prd, config = DEFAULT_RALPH_CONFIG) {
|
|
25
|
+
return {
|
|
26
|
+
prdTitle: prd.title,
|
|
27
|
+
currentIteration: 0,
|
|
28
|
+
maxIterations: config.maxIterations,
|
|
29
|
+
currentStoryId: null,
|
|
30
|
+
stories: prd.stories.map(story => ({
|
|
31
|
+
...story,
|
|
32
|
+
status: 'pending',
|
|
33
|
+
iterations: 0,
|
|
34
|
+
learnings: [],
|
|
35
|
+
})),
|
|
36
|
+
iterations: [],
|
|
37
|
+
learnings: [],
|
|
38
|
+
startedAt: new Date().toISOString(),
|
|
39
|
+
status: 'initializing',
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
// =============================================================================
|
|
43
|
+
// Progress Persistence
|
|
44
|
+
// =============================================================================
|
|
45
|
+
/**
|
|
46
|
+
* Get path to progress file
|
|
47
|
+
*/
|
|
48
|
+
function getProgressPath(projectDir) {
|
|
49
|
+
return join(projectDir, DINO_DIR, PROGRESS_FILE);
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Load progress from file
|
|
53
|
+
*/
|
|
54
|
+
export async function loadProgress(projectDir) {
|
|
55
|
+
const progressPath = getProgressPath(projectDir);
|
|
56
|
+
const content = await FileSystem.readFileSafe(progressPath);
|
|
57
|
+
if (!content) {
|
|
58
|
+
return null;
|
|
59
|
+
}
|
|
60
|
+
return parseProgressMarkdown(content);
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Save progress to file
|
|
64
|
+
*/
|
|
65
|
+
export async function saveProgress(projectDir, progress) {
|
|
66
|
+
const progressPath = getProgressPath(projectDir);
|
|
67
|
+
const content = formatProgressMarkdown(progress);
|
|
68
|
+
await FileSystem.writeFile(progressPath, content);
|
|
69
|
+
}
|
|
70
|
+
// =============================================================================
|
|
71
|
+
// Iteration Management
|
|
72
|
+
// =============================================================================
|
|
73
|
+
/**
|
|
74
|
+
* Start a new iteration
|
|
75
|
+
*/
|
|
76
|
+
export function startIteration(progress, storyId, checkpointCommit) {
|
|
77
|
+
const iteration = {
|
|
78
|
+
number: progress.currentIteration + 1,
|
|
79
|
+
storyId,
|
|
80
|
+
checkpointCommit,
|
|
81
|
+
startedAt: new Date().toISOString(),
|
|
82
|
+
status: 'running',
|
|
83
|
+
learnings: [],
|
|
84
|
+
testsPassed: false,
|
|
85
|
+
};
|
|
86
|
+
// Update progress state
|
|
87
|
+
progress.currentIteration = iteration.number;
|
|
88
|
+
progress.currentStoryId = storyId;
|
|
89
|
+
progress.status = 'iterating';
|
|
90
|
+
progress.iterations.push(iteration);
|
|
91
|
+
// Update story state
|
|
92
|
+
const story = progress.stories.find(s => s.id === storyId);
|
|
93
|
+
if (story) {
|
|
94
|
+
story.status = 'in_progress';
|
|
95
|
+
story.iterations++;
|
|
96
|
+
}
|
|
97
|
+
return iteration;
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Complete an iteration
|
|
101
|
+
*/
|
|
102
|
+
export function completeIteration(progress, iterationNumber, learnings, testsPassed) {
|
|
103
|
+
const iteration = progress.iterations.find(i => i.number === iterationNumber);
|
|
104
|
+
if (!iteration) {
|
|
105
|
+
throw new Error(`Iteration ${iterationNumber} not found`);
|
|
106
|
+
}
|
|
107
|
+
iteration.completedAt = new Date().toISOString();
|
|
108
|
+
iteration.status = testsPassed ? 'completed' : 'failed';
|
|
109
|
+
iteration.learnings = learnings;
|
|
110
|
+
iteration.testsPassed = testsPassed;
|
|
111
|
+
// Accumulate learnings
|
|
112
|
+
progress.learnings.push(...learnings);
|
|
113
|
+
// Also add to story learnings
|
|
114
|
+
const story = progress.stories.find(s => s.id === iteration.storyId);
|
|
115
|
+
if (story) {
|
|
116
|
+
story.learnings.push(...learnings);
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Mark iteration as failed with error
|
|
121
|
+
*/
|
|
122
|
+
export function failIteration(progress, iterationNumber, error, learnings = []) {
|
|
123
|
+
const iteration = progress.iterations.find(i => i.number === iterationNumber);
|
|
124
|
+
if (!iteration) {
|
|
125
|
+
throw new Error(`Iteration ${iterationNumber} not found`);
|
|
126
|
+
}
|
|
127
|
+
iteration.completedAt = new Date().toISOString();
|
|
128
|
+
iteration.status = 'failed';
|
|
129
|
+
iteration.error = error;
|
|
130
|
+
iteration.learnings = learnings;
|
|
131
|
+
iteration.testsPassed = false;
|
|
132
|
+
// Accumulate learnings
|
|
133
|
+
progress.learnings.push(...learnings);
|
|
134
|
+
}
|
|
135
|
+
// =============================================================================
|
|
136
|
+
// Story Management
|
|
137
|
+
// =============================================================================
|
|
138
|
+
/**
|
|
139
|
+
* Mark a story as complete
|
|
140
|
+
*/
|
|
141
|
+
export function markStoryComplete(progress, storyId) {
|
|
142
|
+
const story = progress.stories.find(s => s.id === storyId);
|
|
143
|
+
if (!story) {
|
|
144
|
+
throw new Error(`Story ${storyId} not found`);
|
|
145
|
+
}
|
|
146
|
+
story.status = 'completed';
|
|
147
|
+
// Check if all stories are complete
|
|
148
|
+
const allComplete = progress.stories.every(s => s.status === 'completed');
|
|
149
|
+
if (allComplete) {
|
|
150
|
+
progress.status = 'completed';
|
|
151
|
+
progress.completedAt = new Date().toISOString();
|
|
152
|
+
progress.currentStoryId = null;
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* Mark a story as failed
|
|
157
|
+
*/
|
|
158
|
+
export function markStoryFailed(progress, storyId) {
|
|
159
|
+
const story = progress.stories.find(s => s.id === storyId);
|
|
160
|
+
if (!story) {
|
|
161
|
+
throw new Error(`Story ${storyId} not found`);
|
|
162
|
+
}
|
|
163
|
+
story.status = 'failed';
|
|
164
|
+
}
|
|
165
|
+
/**
|
|
166
|
+
* Get next story to work on
|
|
167
|
+
*/
|
|
168
|
+
export function getNextStory(progress, config = DEFAULT_RALPH_CONFIG) {
|
|
169
|
+
// First, check if we've hit max iterations
|
|
170
|
+
if (progress.currentIteration >= progress.maxIterations) {
|
|
171
|
+
progress.status = 'max_iterations_reached';
|
|
172
|
+
return null;
|
|
173
|
+
}
|
|
174
|
+
// Find first pending story
|
|
175
|
+
const pendingStory = progress.stories.find(s => s.status === 'pending');
|
|
176
|
+
if (pendingStory) {
|
|
177
|
+
return pendingStory;
|
|
178
|
+
}
|
|
179
|
+
// Check for in-progress story that can retry
|
|
180
|
+
const inProgressStory = progress.stories.find(s => s.status === 'in_progress' && s.iterations < config.maxIterationsPerStory);
|
|
181
|
+
if (inProgressStory) {
|
|
182
|
+
return inProgressStory;
|
|
183
|
+
}
|
|
184
|
+
// No more stories available
|
|
185
|
+
return null;
|
|
186
|
+
}
|
|
187
|
+
/**
|
|
188
|
+
* Get story by ID
|
|
189
|
+
*/
|
|
190
|
+
export function getStory(progress, storyId) {
|
|
191
|
+
return progress.stories.find(s => s.id === storyId) || null;
|
|
192
|
+
}
|
|
193
|
+
// =============================================================================
|
|
194
|
+
// Markdown Formatting
|
|
195
|
+
// =============================================================================
|
|
196
|
+
/**
|
|
197
|
+
* Format progress as markdown
|
|
198
|
+
*/
|
|
199
|
+
export function formatProgressMarkdown(progress) {
|
|
200
|
+
const lines = [];
|
|
201
|
+
// Header
|
|
202
|
+
lines.push(`# Ralph Loop Progress`);
|
|
203
|
+
lines.push('');
|
|
204
|
+
lines.push(`**PRD:** ${progress.prdTitle}`);
|
|
205
|
+
lines.push(`**Status:** ${progress.status}`);
|
|
206
|
+
lines.push(`**Started:** ${progress.startedAt}`);
|
|
207
|
+
if (progress.completedAt) {
|
|
208
|
+
lines.push(`**Completed:** ${progress.completedAt}`);
|
|
209
|
+
}
|
|
210
|
+
lines.push(`**Iteration:** ${progress.currentIteration}/${progress.maxIterations}`);
|
|
211
|
+
lines.push('');
|
|
212
|
+
// Stories section
|
|
213
|
+
lines.push('## Stories');
|
|
214
|
+
lines.push('');
|
|
215
|
+
for (const story of progress.stories) {
|
|
216
|
+
const statusEmoji = getStatusEmoji(story.status);
|
|
217
|
+
lines.push(`### ${statusEmoji} ${story.title} (${story.id})`);
|
|
218
|
+
lines.push('');
|
|
219
|
+
lines.push(`- **Status:** ${story.status}`);
|
|
220
|
+
lines.push(`- **Iterations:** ${story.iterations}`);
|
|
221
|
+
lines.push(`- **Files:** ${story.files.join(', ')}`);
|
|
222
|
+
lines.push(`- **Test:** \`${story.testCommand}\``);
|
|
223
|
+
lines.push('');
|
|
224
|
+
lines.push('**Acceptance Criteria:**');
|
|
225
|
+
for (const criterion of story.acceptanceCriteria) {
|
|
226
|
+
const check = story.status === 'completed' ? '[x]' : '[ ]';
|
|
227
|
+
lines.push(`- ${check} ${criterion}`);
|
|
228
|
+
}
|
|
229
|
+
if (story.learnings.length > 0) {
|
|
230
|
+
lines.push('');
|
|
231
|
+
lines.push('**Learnings:**');
|
|
232
|
+
for (const learning of story.learnings) {
|
|
233
|
+
lines.push(`- ${learning}`);
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
lines.push('');
|
|
237
|
+
}
|
|
238
|
+
// Iterations section
|
|
239
|
+
if (progress.iterations.length > 0) {
|
|
240
|
+
lines.push('## Iterations');
|
|
241
|
+
lines.push('');
|
|
242
|
+
lines.push('| # | Story | Status | Tests | Checkpoint |');
|
|
243
|
+
lines.push('|---|-------|--------|-------|------------|');
|
|
244
|
+
for (const iter of progress.iterations) {
|
|
245
|
+
const statusEmoji = getIterationStatusEmoji(iter.status);
|
|
246
|
+
const testsEmoji = iter.testsPassed ? '✅' : '❌';
|
|
247
|
+
lines.push(`| ${iter.number} | ${iter.storyId} | ${statusEmoji} ${iter.status} | ${testsEmoji} | \`${iter.checkpointCommit.substring(0, 7)}\` |`);
|
|
248
|
+
}
|
|
249
|
+
lines.push('');
|
|
250
|
+
}
|
|
251
|
+
// Accumulated learnings
|
|
252
|
+
if (progress.learnings.length > 0) {
|
|
253
|
+
lines.push('## Accumulated Learnings');
|
|
254
|
+
lines.push('');
|
|
255
|
+
for (const learning of progress.learnings) {
|
|
256
|
+
lines.push(`- ${learning}`);
|
|
257
|
+
}
|
|
258
|
+
lines.push('');
|
|
259
|
+
}
|
|
260
|
+
// Metadata (for parsing)
|
|
261
|
+
lines.push('---');
|
|
262
|
+
lines.push('');
|
|
263
|
+
lines.push('<!-- RALPH_METADATA');
|
|
264
|
+
lines.push(JSON.stringify({
|
|
265
|
+
prdTitle: progress.prdTitle,
|
|
266
|
+
currentIteration: progress.currentIteration,
|
|
267
|
+
maxIterations: progress.maxIterations,
|
|
268
|
+
currentStoryId: progress.currentStoryId,
|
|
269
|
+
status: progress.status,
|
|
270
|
+
startedAt: progress.startedAt,
|
|
271
|
+
completedAt: progress.completedAt,
|
|
272
|
+
stories: progress.stories,
|
|
273
|
+
iterations: progress.iterations,
|
|
274
|
+
learnings: progress.learnings,
|
|
275
|
+
}, null, 2));
|
|
276
|
+
lines.push('-->');
|
|
277
|
+
return lines.join('\n');
|
|
278
|
+
}
|
|
279
|
+
/**
|
|
280
|
+
* Parse progress from markdown
|
|
281
|
+
*/
|
|
282
|
+
export function parseProgressMarkdown(content) {
|
|
283
|
+
// Extract JSON metadata from comment
|
|
284
|
+
const metadataMatch = content.match(/<!-- RALPH_METADATA\n([\s\S]*?)\n-->/);
|
|
285
|
+
if (!metadataMatch) {
|
|
286
|
+
return null;
|
|
287
|
+
}
|
|
288
|
+
try {
|
|
289
|
+
const metadata = JSON.parse(metadataMatch[1]);
|
|
290
|
+
return metadata;
|
|
291
|
+
}
|
|
292
|
+
catch {
|
|
293
|
+
return null;
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
// =============================================================================
|
|
297
|
+
// Helper Functions
|
|
298
|
+
// =============================================================================
|
|
299
|
+
/**
|
|
300
|
+
* Get emoji for story status
|
|
301
|
+
*/
|
|
302
|
+
function getStatusEmoji(status) {
|
|
303
|
+
switch (status) {
|
|
304
|
+
case 'completed':
|
|
305
|
+
return '✅';
|
|
306
|
+
case 'in_progress':
|
|
307
|
+
return '🔄';
|
|
308
|
+
case 'failed':
|
|
309
|
+
return '❌';
|
|
310
|
+
case 'pending':
|
|
311
|
+
default:
|
|
312
|
+
return '⏳';
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
/**
|
|
316
|
+
* Get emoji for iteration status
|
|
317
|
+
*/
|
|
318
|
+
function getIterationStatusEmoji(status) {
|
|
319
|
+
switch (status) {
|
|
320
|
+
case 'completed':
|
|
321
|
+
return '✅';
|
|
322
|
+
case 'running':
|
|
323
|
+
return '🔄';
|
|
324
|
+
case 'failed':
|
|
325
|
+
return '❌';
|
|
326
|
+
default:
|
|
327
|
+
return '⏳';
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
/**
|
|
331
|
+
* Get progress summary
|
|
332
|
+
*/
|
|
333
|
+
export function getProgressSummary(progress) {
|
|
334
|
+
const completedStories = progress.stories.filter(s => s.status === 'completed').length;
|
|
335
|
+
const totalStories = progress.stories.length;
|
|
336
|
+
const percentage = Math.round((completedStories / totalStories) * 100);
|
|
337
|
+
return `${completedStories}/${totalStories} stories (${percentage}%), iteration ${progress.currentIteration}/${progress.maxIterations}`;
|
|
338
|
+
}
|
|
339
|
+
//# sourceMappingURL=progress-tracker.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"progress-tracker.js","sourceRoot":"","sources":["../../../src/core/ralph/progress-tracker.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC5B,OAAO,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AAQxD,OAAO,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAElD,gFAAgF;AAChF,YAAY;AACZ,gFAAgF;AAEhF,MAAM,aAAa,GAAG,mBAAmB,CAAC;AAC1C,MAAM,QAAQ,GAAG,OAAO,CAAC;AAEzB,gFAAgF;AAChF,0BAA0B;AAC1B,gFAAgF;AAEhF;;GAEG;AACH,MAAM,UAAU,YAAY,CAC1B,GAAa,EACb,SAAsB,oBAAoB;IAE1C,OAAO;QACL,QAAQ,EAAE,GAAG,CAAC,KAAK;QACnB,gBAAgB,EAAE,CAAC;QACnB,aAAa,EAAE,MAAM,CAAC,aAAa;QACnC,cAAc,EAAE,IAAI;QACpB,OAAO,EAAE,GAAG,CAAC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BAAiB,QAAQ,CAAC,gBAAgB,IAAI,QAAQ,CAAC,aAAa,EAAE,CAAC;AAC1I,CAAC"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Ralph Sub-Agent Spawner - v11.1.0
|
|
3
|
+
*
|
|
4
|
+
* Handles sub-agent spawning with fresh context:
|
|
5
|
+
* - Build compressed context for handoff (~2K tokens)
|
|
6
|
+
* - Create git checkpoints
|
|
7
|
+
* - Extract learnings from results
|
|
8
|
+
* - Commit story completions
|
|
9
|
+
*/
|
|
10
|
+
import type { RalphStory, RalphProgress, RalphSubAgentContext, RalphConfig } from './types.js';
|
|
11
|
+
/**
|
|
12
|
+
* Build sub-agent context for a story
|
|
13
|
+
* Keeps context compressed to ~2K tokens
|
|
14
|
+
*/
|
|
15
|
+
export declare function buildSubAgentContext(story: RalphStory, progress: RalphProgress, config?: RalphConfig): RalphSubAgentContext;
|
|
16
|
+
/**
|
|
17
|
+
* Format context for handoff as prompt text
|
|
18
|
+
* Target: ~2K tokens
|
|
19
|
+
*/
|
|
20
|
+
export declare function formatContextForHandoff(context: RalphSubAgentContext): string;
|
|
21
|
+
/**
|
|
22
|
+
* Estimate token count for context
|
|
23
|
+
*/
|
|
24
|
+
export declare function estimateContextTokens(context: RalphSubAgentContext): number;
|
|
25
|
+
/**
|
|
26
|
+
* Build git checkpoint command
|
|
27
|
+
* Creates a checkpoint commit before iteration starts
|
|
28
|
+
*/
|
|
29
|
+
export declare function buildCheckpointCommand(iterationNumber: number, config?: RalphConfig): string;
|
|
30
|
+
/**
|
|
31
|
+
* Build git checkpoint tag command
|
|
32
|
+
*/
|
|
33
|
+
export declare function buildCheckpointTagCommand(iterationNumber: number, config?: RalphConfig): string;
|
|
34
|
+
/**
|
|
35
|
+
* Build story completion commit command
|
|
36
|
+
*/
|
|
37
|
+
export declare function buildStoryCommitCommand(storyId: string): string;
|
|
38
|
+
/**
|
|
39
|
+
* Build rollback command to checkpoint
|
|
40
|
+
*/
|
|
41
|
+
export declare function buildRollbackCommand(iterationNumber: number, config?: RalphConfig): string;
|
|
42
|
+
/**
|
|
43
|
+
* Extract learnings from sub-agent result
|
|
44
|
+
* Looks for patterns in the output that indicate what was learned
|
|
45
|
+
*/
|
|
46
|
+
export declare function extractLearningsFromResult(result: string): string[];
|
|
47
|
+
/**
|
|
48
|
+
* Check if result indicates tests passed
|
|
49
|
+
*/
|
|
50
|
+
export declare function didTestsPass(result: string): boolean;
|
|
51
|
+
/**
|
|
52
|
+
* Parse test output for specific failures
|
|
53
|
+
*/
|
|
54
|
+
export declare function parseTestFailures(result: string): string[];
|
|
55
|
+
/**
|
|
56
|
+
* Build Task tool prompt for spawning sub-agent
|
|
57
|
+
* This creates the prompt that will be passed to Claude's Task tool
|
|
58
|
+
*/
|
|
59
|
+
export declare function buildTaskToolPrompt(context: RalphSubAgentContext): string;
|
|
60
|
+
/**
|
|
61
|
+
* Build TaskCreate input for tracking ralph story
|
|
62
|
+
*/
|
|
63
|
+
export declare function buildTaskCreateInput(story: RalphStory): {
|
|
64
|
+
subject: string;
|
|
65
|
+
description: string;
|
|
66
|
+
activeForm: string;
|
|
67
|
+
};
|
|
68
|
+
//# sourceMappingURL=sub-agent-spawner.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sub-agent-spawner.d.ts","sourceRoot":"","sources":["../../../src/core/ralph/sub-agent-spawner.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EACV,UAAU,EACV,aAAa,EACb,oBAAoB,EACpB,WAAW,EACZ,MAAM,YAAY,CAAC;AAOpB;;;GAGG;AACH,wBAAgB,oBAAoB,CAClC,KAAK,EAAE,UAAU,EACjB,QAAQ,EAAE,aAAa,EACvB,MAAM,GAAE,WAAkC,GACzC,oBAAoB,CAqBtB;AAED;;;GAGG;AACH,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,oBAAoB,GAAG,MAAM,CA6C7E;AAED;;GAEG;AAC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