ai-sdlc 0.1.0-alpha.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/LICENSE +21 -0
- package/README.md +847 -0
- package/dist/agents/implementation.d.ts +11 -0
- package/dist/agents/implementation.d.ts.map +1 -0
- package/dist/agents/implementation.js +123 -0
- package/dist/agents/implementation.js.map +1 -0
- package/dist/agents/index.d.ts +7 -0
- package/dist/agents/index.d.ts.map +1 -0
- package/dist/agents/index.js +8 -0
- package/dist/agents/index.js.map +1 -0
- package/dist/agents/planning.d.ts +9 -0
- package/dist/agents/planning.d.ts.map +1 -0
- package/dist/agents/planning.js +84 -0
- package/dist/agents/planning.js.map +1 -0
- package/dist/agents/refinement.d.ts +10 -0
- package/dist/agents/refinement.d.ts.map +1 -0
- package/dist/agents/refinement.js +98 -0
- package/dist/agents/refinement.js.map +1 -0
- package/dist/agents/research.d.ts +16 -0
- package/dist/agents/research.d.ts.map +1 -0
- package/dist/agents/research.js +141 -0
- package/dist/agents/research.js.map +1 -0
- package/dist/agents/review.d.ts +24 -0
- package/dist/agents/review.d.ts.map +1 -0
- package/dist/agents/review.js +740 -0
- package/dist/agents/review.js.map +1 -0
- package/dist/agents/rework.d.ts +17 -0
- package/dist/agents/rework.d.ts.map +1 -0
- package/dist/agents/rework.js +139 -0
- package/dist/agents/rework.js.map +1 -0
- package/dist/agents/state-assessor.d.ts +21 -0
- package/dist/agents/state-assessor.d.ts.map +1 -0
- package/dist/agents/state-assessor.js +29 -0
- package/dist/agents/state-assessor.js.map +1 -0
- package/dist/cli/commands.d.ts +87 -0
- package/dist/cli/commands.d.ts.map +1 -0
- package/dist/cli/commands.js +1183 -0
- package/dist/cli/commands.js.map +1 -0
- package/dist/cli/formatting.d.ts +68 -0
- package/dist/cli/formatting.d.ts.map +1 -0
- package/dist/cli/formatting.js +194 -0
- package/dist/cli/formatting.js.map +1 -0
- package/dist/cli/runner.d.ts +57 -0
- package/dist/cli/runner.d.ts.map +1 -0
- package/dist/cli/runner.js +272 -0
- package/dist/cli/runner.js.map +1 -0
- package/dist/cli/story-utils.d.ts +19 -0
- package/dist/cli/story-utils.d.ts.map +1 -0
- package/dist/cli/story-utils.js +44 -0
- package/dist/cli/story-utils.js.map +1 -0
- package/dist/cli/table-renderer.d.ts +22 -0
- package/dist/cli/table-renderer.d.ts.map +1 -0
- package/dist/cli/table-renderer.js +159 -0
- package/dist/cli/table-renderer.js.map +1 -0
- package/dist/core/auth.d.ts +39 -0
- package/dist/core/auth.d.ts.map +1 -0
- package/dist/core/auth.js +128 -0
- package/dist/core/auth.js.map +1 -0
- package/dist/core/client.d.ts +73 -0
- package/dist/core/client.d.ts.map +1 -0
- package/dist/core/client.js +140 -0
- package/dist/core/client.js.map +1 -0
- package/dist/core/config.d.ts +48 -0
- package/dist/core/config.d.ts.map +1 -0
- package/dist/core/config.js +330 -0
- package/dist/core/config.js.map +1 -0
- package/dist/core/kanban.d.ts +34 -0
- package/dist/core/kanban.d.ts.map +1 -0
- package/dist/core/kanban.js +253 -0
- package/dist/core/kanban.js.map +1 -0
- package/dist/core/story.d.ts +91 -0
- package/dist/core/story.d.ts.map +1 -0
- package/dist/core/story.js +349 -0
- package/dist/core/story.js.map +1 -0
- package/dist/core/theme.d.ts +17 -0
- package/dist/core/theme.d.ts.map +1 -0
- package/dist/core/theme.js +136 -0
- package/dist/core/theme.js.map +1 -0
- package/dist/core/workflow-state.d.ts +56 -0
- package/dist/core/workflow-state.d.ts.map +1 -0
- package/dist/core/workflow-state.js +162 -0
- package/dist/core/workflow-state.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +103 -0
- package/dist/index.js.map +1 -0
- package/dist/types/index.d.ts +228 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +38 -0
- package/dist/types/index.js.map +1 -0
- package/dist/types/workflow-state.d.ts +54 -0
- package/dist/types/workflow-state.d.ts.map +1 -0
- package/dist/types/workflow-state.js +5 -0
- package/dist/types/workflow-state.js.map +1 -0
- package/package.json +71 -0
- package/templates/story.md +35 -0
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { AgentProgressCallback } from '../core/client.js';
|
|
2
|
+
import { AgentResult } from '../types/index.js';
|
|
3
|
+
import { AgentOptions } from './research.js';
|
|
4
|
+
export type { AgentProgressCallback };
|
|
5
|
+
/**
|
|
6
|
+
* Implementation Agent
|
|
7
|
+
*
|
|
8
|
+
* Executes the implementation plan, creating code changes and tests.
|
|
9
|
+
*/
|
|
10
|
+
export declare function runImplementationAgent(storyPath: string, sdlcRoot: string, options?: AgentOptions): Promise<AgentResult>;
|
|
11
|
+
//# sourceMappingURL=implementation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"implementation.d.ts","sourceRoot":"","sources":["../../src/agents/implementation.ts"],"names":[],"mappings":"AAGA,OAAO,EAAiB,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AACzE,OAAO,EAAS,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACvD,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAG7C,YAAY,EAAE,qBAAqB,EAAE,CAAC;AAgBtC;;;;GAIG;AACH,wBAAsB,sBAAsB,CAC1C,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,MAAM,EAChB,OAAO,GAAE,YAAiB,GACzB,OAAO,CAAC,WAAW,CAAC,CA4GtB"}
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import { execSync } from 'child_process';
|
|
2
|
+
import path from 'path';
|
|
3
|
+
import { parseStory, writeStory, moveStory, updateStoryField } from '../core/story.js';
|
|
4
|
+
import { runAgentQuery } from '../core/client.js';
|
|
5
|
+
const IMPLEMENTATION_SYSTEM_PROMPT = `You are a senior software engineer implementing features based on a detailed plan. Your job is to execute each phase of the implementation plan.
|
|
6
|
+
|
|
7
|
+
When implementing:
|
|
8
|
+
1. Follow the plan step by step
|
|
9
|
+
2. Write clean, maintainable code
|
|
10
|
+
3. Follow existing patterns in the codebase
|
|
11
|
+
4. Write tests alongside implementation (TDD when possible)
|
|
12
|
+
5. Update the plan checkboxes as you complete tasks
|
|
13
|
+
6. Do NOT create temporary files, shell scripts, or documentation files - keep all notes in the story file
|
|
14
|
+
7. Follow the Testing Pyramid: prioritize unit tests (colocated with source, e.g., src/foo.test.ts), then integration tests (in tests/integration/)
|
|
15
|
+
8. Do NOT commit changes - that happens in the review phase
|
|
16
|
+
|
|
17
|
+
You have access to tools for reading and writing files, running commands, and searching the codebase.`;
|
|
18
|
+
/**
|
|
19
|
+
* Implementation Agent
|
|
20
|
+
*
|
|
21
|
+
* Executes the implementation plan, creating code changes and tests.
|
|
22
|
+
*/
|
|
23
|
+
export async function runImplementationAgent(storyPath, sdlcRoot, options = {}) {
|
|
24
|
+
let story = parseStory(storyPath);
|
|
25
|
+
let currentStoryPath = storyPath;
|
|
26
|
+
const changesMade = [];
|
|
27
|
+
const workingDir = path.dirname(sdlcRoot);
|
|
28
|
+
try {
|
|
29
|
+
// Create a feature branch for this story
|
|
30
|
+
const branchName = `agentic-sdlc/${story.slug}`;
|
|
31
|
+
try {
|
|
32
|
+
// Check if we're in a git repo
|
|
33
|
+
execSync('git rev-parse --git-dir', { cwd: workingDir, stdio: 'pipe' });
|
|
34
|
+
// Create and checkout branch (or checkout if exists)
|
|
35
|
+
try {
|
|
36
|
+
execSync(`git checkout -b ${branchName}`, { cwd: workingDir, stdio: 'pipe' });
|
|
37
|
+
changesMade.push(`Created branch: ${branchName}`);
|
|
38
|
+
}
|
|
39
|
+
catch {
|
|
40
|
+
// Branch might already exist
|
|
41
|
+
try {
|
|
42
|
+
execSync(`git checkout ${branchName}`, { cwd: workingDir, stdio: 'pipe' });
|
|
43
|
+
changesMade.push(`Checked out existing branch: ${branchName}`);
|
|
44
|
+
}
|
|
45
|
+
catch {
|
|
46
|
+
// Not a git repo or other error, continue without branching
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
// Update story with branch info
|
|
50
|
+
updateStoryField(story, 'branch', branchName);
|
|
51
|
+
}
|
|
52
|
+
catch {
|
|
53
|
+
// Not a git repo, continue without branching
|
|
54
|
+
changesMade.push('No git repo detected, skipping branch creation');
|
|
55
|
+
}
|
|
56
|
+
// Move story to in-progress if not already there
|
|
57
|
+
if (story.frontmatter.status !== 'in-progress') {
|
|
58
|
+
story = moveStory(story, 'in-progress', sdlcRoot);
|
|
59
|
+
currentStoryPath = story.path;
|
|
60
|
+
changesMade.push('Moved story to in-progress/');
|
|
61
|
+
}
|
|
62
|
+
let prompt = `Implement this story based on the plan:
|
|
63
|
+
|
|
64
|
+
Title: ${story.frontmatter.title}
|
|
65
|
+
|
|
66
|
+
Story content:
|
|
67
|
+
${story.content}`;
|
|
68
|
+
if (options.reworkContext) {
|
|
69
|
+
prompt += `
|
|
70
|
+
|
|
71
|
+
---
|
|
72
|
+
${options.reworkContext}
|
|
73
|
+
---
|
|
74
|
+
|
|
75
|
+
IMPORTANT: This is a refinement iteration. The previous implementation did not pass review.
|
|
76
|
+
You MUST fix all the issues listed above. Pay special attention to blocker and critical
|
|
77
|
+
severity issues - these must be resolved. Review the specific feedback and make targeted fixes.`;
|
|
78
|
+
}
|
|
79
|
+
prompt += `
|
|
80
|
+
|
|
81
|
+
Execute the implementation plan. For each task:
|
|
82
|
+
1. Read relevant existing files
|
|
83
|
+
2. Make necessary code changes
|
|
84
|
+
3. Write tests if applicable
|
|
85
|
+
4. Verify the changes work
|
|
86
|
+
|
|
87
|
+
Use the available tools to read files, write code, and run commands as needed.`;
|
|
88
|
+
const implementationResult = await runAgentQuery({
|
|
89
|
+
prompt,
|
|
90
|
+
systemPrompt: IMPLEMENTATION_SYSTEM_PROMPT,
|
|
91
|
+
workingDirectory: workingDir,
|
|
92
|
+
onProgress: options.onProgress,
|
|
93
|
+
});
|
|
94
|
+
// Add implementation notes to the story
|
|
95
|
+
const implementationNotes = `
|
|
96
|
+
### Implementation Notes (${new Date().toISOString().split('T')[0]})
|
|
97
|
+
|
|
98
|
+
${implementationResult}
|
|
99
|
+
`;
|
|
100
|
+
// Append to story content
|
|
101
|
+
const updatedStory = parseStory(currentStoryPath);
|
|
102
|
+
updatedStory.content += '\n\n' + implementationNotes;
|
|
103
|
+
writeStory(updatedStory);
|
|
104
|
+
changesMade.push('Added implementation notes');
|
|
105
|
+
// Mark implementation as complete
|
|
106
|
+
updateStoryField(updatedStory, 'implementation_complete', true);
|
|
107
|
+
changesMade.push('Marked implementation_complete: true');
|
|
108
|
+
return {
|
|
109
|
+
success: true,
|
|
110
|
+
story: parseStory(currentStoryPath),
|
|
111
|
+
changesMade,
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
catch (error) {
|
|
115
|
+
return {
|
|
116
|
+
success: false,
|
|
117
|
+
story,
|
|
118
|
+
changesMade,
|
|
119
|
+
error: error instanceof Error ? error.message : String(error),
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
//# sourceMappingURL=implementation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"implementation.js","sourceRoot":"","sources":["../../src/agents/implementation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACvF,OAAO,EAAE,aAAa,EAAyB,MAAM,mBAAmB,CAAC;AAOzE,MAAM,4BAA4B,GAAG;;;;;;;;;;;;sGAYiE,CAAC;AAEvG;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,sBAAsB,CAC1C,SAAiB,EACjB,QAAgB,EAChB,UAAwB,EAAE;IAE1B,IAAI,KAAK,GAAG,UAAU,CAAC,SAAS,CAAC,CAAC;IAClC,IAAI,gBAAgB,GAAG,SAAS,CAAC;IACjC,MAA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AAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC;SAC9D,CAAC;IACJ,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { runRefinementAgent } from './refinement.js';
|
|
2
|
+
export { runResearchAgent, AgentOptions } from './research.js';
|
|
3
|
+
export { runPlanningAgent } from './planning.js';
|
|
4
|
+
export { runImplementationAgent } from './implementation.js';
|
|
5
|
+
export { runReviewAgent, createPullRequest } from './review.js';
|
|
6
|
+
export { runReworkAgent, determineTargetPhase, packageReworkContext } from './rework.js';
|
|
7
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/agents/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AACrD,OAAO,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC/D,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAC7D,OAAO,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAChE,OAAO,EAAE,cAAc,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
// Agent exports
|
|
2
|
+
export { runRefinementAgent } from './refinement.js';
|
|
3
|
+
export { runResearchAgent } from './research.js';
|
|
4
|
+
export { runPlanningAgent } from './planning.js';
|
|
5
|
+
export { runImplementationAgent } from './implementation.js';
|
|
6
|
+
export { runReviewAgent, createPullRequest } from './review.js';
|
|
7
|
+
export { runReworkAgent, determineTargetPhase, packageReworkContext } from './rework.js';
|
|
8
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/agents/index.ts"],"names":[],"mappings":"AAAA,gBAAgB;AAChB,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AACrD,OAAO,EAAE,gBAAgB,EAAgB,MAAM,eAAe,CAAC;AAC/D,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAC7D,OAAO,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAChE,OAAO,EAAE,cAAc,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { AgentResult } from '../types/index.js';
|
|
2
|
+
import { AgentOptions } from './research.js';
|
|
3
|
+
/**
|
|
4
|
+
* Planning Agent
|
|
5
|
+
*
|
|
6
|
+
* Creates a step-by-step implementation plan from the research findings.
|
|
7
|
+
*/
|
|
8
|
+
export declare function runPlanningAgent(storyPath: string, sdlcRoot: string, options?: AgentOptions): Promise<AgentResult>;
|
|
9
|
+
//# sourceMappingURL=planning.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"planning.d.ts","sourceRoot":"","sources":["../../src/agents/planning.ts"],"names":[],"mappings":"AAEA,OAAO,EAAS,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEvD,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAa7C;;;;GAIG;AACH,wBAAsB,gBAAgB,CACpC,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,MAAM,EAChB,OAAO,GAAE,YAAiB,GACzB,OAAO,CAAC,WAAW,CAAC,CAsEtB"}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { parseStory, appendToSection, updateStoryField } from '../core/story.js';
|
|
2
|
+
import { runAgentQuery } from '../core/client.js';
|
|
3
|
+
import path from 'path';
|
|
4
|
+
const PLANNING_SYSTEM_PROMPT = `You are a technical planning specialist. Your job is to create detailed, step-by-step implementation plans for user stories.
|
|
5
|
+
|
|
6
|
+
When creating a plan, you should:
|
|
7
|
+
1. Break the work into phases (setup, implementation, testing, etc.)
|
|
8
|
+
2. Create specific, actionable tasks within each phase
|
|
9
|
+
3. Use checkbox format for tracking progress
|
|
10
|
+
4. Consider test-driven development (write tests first)
|
|
11
|
+
5. Include verification steps
|
|
12
|
+
|
|
13
|
+
Output your plan in markdown format with checkboxes. Each task should be small enough to complete in one focused session.`;
|
|
14
|
+
/**
|
|
15
|
+
* Planning Agent
|
|
16
|
+
*
|
|
17
|
+
* Creates a step-by-step implementation plan from the research findings.
|
|
18
|
+
*/
|
|
19
|
+
export async function runPlanningAgent(storyPath, sdlcRoot, options = {}) {
|
|
20
|
+
const story = parseStory(storyPath);
|
|
21
|
+
const changesMade = [];
|
|
22
|
+
try {
|
|
23
|
+
let prompt = `Please create an implementation plan for this story:
|
|
24
|
+
|
|
25
|
+
Title: ${story.frontmatter.title}
|
|
26
|
+
|
|
27
|
+
Story content:
|
|
28
|
+
${story.content}`;
|
|
29
|
+
if (options.reworkContext) {
|
|
30
|
+
prompt += `
|
|
31
|
+
|
|
32
|
+
---
|
|
33
|
+
${options.reworkContext}
|
|
34
|
+
---
|
|
35
|
+
|
|
36
|
+
IMPORTANT: This is a refinement iteration. The previous implementation did not pass review.
|
|
37
|
+
Your plan MUST specifically address all the issues listed above. Include explicit tasks
|
|
38
|
+
to fix each identified problem. Do not repeat the same approach that failed.`;
|
|
39
|
+
}
|
|
40
|
+
prompt += `
|
|
41
|
+
|
|
42
|
+
Create a detailed implementation plan including:
|
|
43
|
+
1. Phases (e.g., Setup, Implementation, Testing, Verification)
|
|
44
|
+
2. Specific tasks within each phase (as checkboxes)
|
|
45
|
+
3. Files to create or modify
|
|
46
|
+
4. Tests to write
|
|
47
|
+
5. Verification steps
|
|
48
|
+
|
|
49
|
+
Format the plan with markdown checkboxes like:
|
|
50
|
+
### Phase 1: Setup
|
|
51
|
+
- [ ] Task 1
|
|
52
|
+
- [ ] Task 2
|
|
53
|
+
|
|
54
|
+
### Phase 2: Implementation
|
|
55
|
+
- [ ] Task 3
|
|
56
|
+
...`;
|
|
57
|
+
const planContent = await runAgentQuery({
|
|
58
|
+
prompt,
|
|
59
|
+
systemPrompt: PLANNING_SYSTEM_PROMPT,
|
|
60
|
+
workingDirectory: path.dirname(sdlcRoot),
|
|
61
|
+
onProgress: options.onProgress,
|
|
62
|
+
});
|
|
63
|
+
// Append plan to the story
|
|
64
|
+
appendToSection(story, 'Implementation Plan', planContent);
|
|
65
|
+
changesMade.push('Added implementation plan');
|
|
66
|
+
// Mark plan as complete
|
|
67
|
+
updateStoryField(story, 'plan_complete', true);
|
|
68
|
+
changesMade.push('Marked plan_complete: true');
|
|
69
|
+
return {
|
|
70
|
+
success: true,
|
|
71
|
+
story: parseStory(storyPath), // Re-read to get updated content
|
|
72
|
+
changesMade,
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
catch (error) {
|
|
76
|
+
return {
|
|
77
|
+
success: false,
|
|
78
|
+
story,
|
|
79
|
+
changesMade,
|
|
80
|
+
error: error instanceof Error ? error.message : String(error),
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
//# sourceMappingURL=planning.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"planning.js","sourceRoot":"","sources":["../../src/agents/planning.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAc,eAAe,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAC7F,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAElD,OAAO,IAAI,MAAM,MAAM,CAAC;AAGxB,MAAM,sBAAsB,GAAG;;;;;;;;;0HAS2F,CAAC;AAE3H;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,gBAAgB,CACpC,SAAiB,EACjB,QA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 +1,10 @@
|
|
|
1
|
+
import { AgentResult } from '../types/index.js';
|
|
2
|
+
import { AgentOptions } from './research.js';
|
|
3
|
+
/**
|
|
4
|
+
* Refinement Agent
|
|
5
|
+
*
|
|
6
|
+
* Takes a raw backlog item and transforms it into a well-defined,
|
|
7
|
+
* ready-to-implement user story.
|
|
8
|
+
*/
|
|
9
|
+
export declare function runRefinementAgent(storyPath: string, sdlcRoot: string, options?: AgentOptions): Promise<AgentResult>;
|
|
10
|
+
//# sourceMappingURL=refinement.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"refinement.d.ts","sourceRoot":"","sources":["../../src/agents/refinement.ts"],"names":[],"mappings":"AAEA,OAAO,EAAS,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEvD,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAiB7C;;;;;GAKG;AACH,wBAAsB,kBAAkB,CACtC,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,MAAM,EAChB,OAAO,GAAE,YAAiB,GACzB,OAAO,CAAC,WAAW,CAAC,CAsEtB"}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { parseStory, writeStory, moveStory } from '../core/story.js';
|
|
2
|
+
import { runAgentQuery } from '../core/client.js';
|
|
3
|
+
import path from 'path';
|
|
4
|
+
const REFINEMENT_SYSTEM_PROMPT = `You are a product refinement specialist. Your job is to take raw story ideas from the backlog and transform them into well-defined, actionable user stories.
|
|
5
|
+
|
|
6
|
+
When refining a story, you should:
|
|
7
|
+
1. Clarify the user story format: "As a [user type], I want [goal], so that [benefit]"
|
|
8
|
+
2. Add specific, testable acceptance criteria
|
|
9
|
+
3. Identify edge cases and constraints
|
|
10
|
+
4. Suggest an effort estimate (small/medium/large)
|
|
11
|
+
5. Add relevant labels
|
|
12
|
+
|
|
13
|
+
Output your refined story content in markdown format. Be concise but thorough.
|
|
14
|
+
|
|
15
|
+
At the end of your response, include:
|
|
16
|
+
- effort: small|medium|large
|
|
17
|
+
- labels: comma-separated list`;
|
|
18
|
+
/**
|
|
19
|
+
* Refinement Agent
|
|
20
|
+
*
|
|
21
|
+
* Takes a raw backlog item and transforms it into a well-defined,
|
|
22
|
+
* ready-to-implement user story.
|
|
23
|
+
*/
|
|
24
|
+
export async function runRefinementAgent(storyPath, sdlcRoot, options = {}) {
|
|
25
|
+
const story = parseStory(storyPath);
|
|
26
|
+
const changesMade = [];
|
|
27
|
+
try {
|
|
28
|
+
const prompt = `Please refine this story:
|
|
29
|
+
|
|
30
|
+
Title: ${story.frontmatter.title}
|
|
31
|
+
|
|
32
|
+
Current content:
|
|
33
|
+
${story.content}
|
|
34
|
+
|
|
35
|
+
Provide the refined story content including:
|
|
36
|
+
1. A clear user story summary
|
|
37
|
+
2. Detailed acceptance criteria (as checkboxes)
|
|
38
|
+
3. Any constraints or edge cases to consider
|
|
39
|
+
4. Suggested effort estimate (small/medium/large)
|
|
40
|
+
5. Suggested labels (comma-separated)
|
|
41
|
+
|
|
42
|
+
Format your response as markdown that will replace the story content.`;
|
|
43
|
+
const refinedContent = await runAgentQuery({
|
|
44
|
+
prompt,
|
|
45
|
+
systemPrompt: REFINEMENT_SYSTEM_PROMPT,
|
|
46
|
+
workingDirectory: path.dirname(sdlcRoot),
|
|
47
|
+
onProgress: options.onProgress,
|
|
48
|
+
});
|
|
49
|
+
// Parse effort estimate from the response
|
|
50
|
+
const effortMatch = refinedContent.match(/effort[:\s]*(small|medium|large)/i);
|
|
51
|
+
if (effortMatch) {
|
|
52
|
+
story.frontmatter.estimated_effort = effortMatch[1].toLowerCase();
|
|
53
|
+
changesMade.push(`Set effort estimate: ${story.frontmatter.estimated_effort}`);
|
|
54
|
+
}
|
|
55
|
+
// Parse labels from the response
|
|
56
|
+
const labelsMatch = refinedContent.match(/labels?[:\s]*([a-z0-9,\s-]+)/i);
|
|
57
|
+
if (labelsMatch) {
|
|
58
|
+
const newLabels = labelsMatch[1].split(',').map(l => l.trim().toLowerCase()).filter(Boolean);
|
|
59
|
+
story.frontmatter.labels = [...new Set([...story.frontmatter.labels, ...newLabels])];
|
|
60
|
+
changesMade.push(`Added labels: ${newLabels.join(', ')}`);
|
|
61
|
+
}
|
|
62
|
+
// Update the story content (clean up the parsed metadata)
|
|
63
|
+
story.content = cleanRefinedContent(refinedContent);
|
|
64
|
+
changesMade.push('Refined story content');
|
|
65
|
+
// Update timestamp
|
|
66
|
+
story.frontmatter.updated = new Date().toISOString().split('T')[0];
|
|
67
|
+
// Write the story
|
|
68
|
+
writeStory(story);
|
|
69
|
+
// Move to ready folder
|
|
70
|
+
const movedStory = moveStory(story, 'ready', sdlcRoot);
|
|
71
|
+
changesMade.push('Moved story to ready/');
|
|
72
|
+
return {
|
|
73
|
+
success: true,
|
|
74
|
+
story: movedStory,
|
|
75
|
+
changesMade,
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
catch (error) {
|
|
79
|
+
return {
|
|
80
|
+
success: false,
|
|
81
|
+
story,
|
|
82
|
+
changesMade,
|
|
83
|
+
error: error instanceof Error ? error.message : String(error),
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Clean up the refined content by removing metadata lines
|
|
89
|
+
*/
|
|
90
|
+
function cleanRefinedContent(content) {
|
|
91
|
+
// Remove effort and label lines that we've parsed
|
|
92
|
+
return content
|
|
93
|
+
.replace(/^effort[:\s]*(small|medium|large)\s*$/gim, '')
|
|
94
|
+
.replace(/^labels?[:\s]*[a-z0-9,\s-]+\s*$/gim, '')
|
|
95
|
+
.replace(/\n{3,}/g, '\n\n')
|
|
96
|
+
.trim();
|
|
97
|
+
}
|
|
98
|
+
//# sourceMappingURL=refinement.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"refinement.js","sourceRoot":"","sources":["../../src/agents/refinement.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,kBAA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,EAAE,EAAE,CAAC;SACvD,OAAO,CAAC,oCAAoC,EAAE,EAAE,CAAC;SACjD,OAAO,CAAC,SAAS,EAAE,MAAM,CAAC;SAC1B,IAAI,EAAE,CAAC;AACZ,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { AgentProgressCallback } from '../core/client.js';
|
|
2
|
+
import { AgentResult } from '../types/index.js';
|
|
3
|
+
export interface AgentOptions {
|
|
4
|
+
/** Context from a previous review failure - must address these issues */
|
|
5
|
+
reworkContext?: string;
|
|
6
|
+
/** Callback for real-time progress updates from agent execution */
|
|
7
|
+
onProgress?: AgentProgressCallback;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Research Agent
|
|
11
|
+
*
|
|
12
|
+
* Researches how to implement a story by analyzing the codebase
|
|
13
|
+
* and gathering relevant information.
|
|
14
|
+
*/
|
|
15
|
+
export declare function runResearchAgent(storyPath: string, sdlcRoot: string, options?: AgentOptions): Promise<AgentResult>;
|
|
16
|
+
//# sourceMappingURL=research.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"research.d.ts","sourceRoot":"","sources":["../../src/agents/research.ts"],"names":[],"mappings":"AAIA,OAAO,EAAiB,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AACzE,OAAO,EAAS,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAavD,MAAM,WAAW,YAAY;IAC3B,yEAAyE;IACzE,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,mEAAmE;IACnE,UAAU,CAAC,EAAE,qBAAqB,CAAC;CACpC;AAED;;;;;GAKG;AACH,wBAAsB,gBAAgB,CACpC,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,MAAM,EAChB,OAAO,GAAE,YAAiB,GACzB,OAAO,CAAC,WAAW,CAAC,CAsEtB"}
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
import fs from 'fs';
|
|
2
|
+
import path from 'path';
|
|
3
|
+
import { glob } from 'glob';
|
|
4
|
+
import { parseStory, appendToSection, updateStoryField } from '../core/story.js';
|
|
5
|
+
import { runAgentQuery } from '../core/client.js';
|
|
6
|
+
const RESEARCH_SYSTEM_PROMPT = `You are a technical research specialist. Your job is to research how to implement a user story by analyzing the existing codebase and external best practices.
|
|
7
|
+
|
|
8
|
+
When researching a story, you should:
|
|
9
|
+
1. Identify relevant existing code patterns in the codebase
|
|
10
|
+
2. Suggest which files/modules need to be modified
|
|
11
|
+
3. Research external best practices if applicable
|
|
12
|
+
4. Identify potential challenges or risks
|
|
13
|
+
5. Note any dependencies or prerequisites
|
|
14
|
+
|
|
15
|
+
Output your research findings in markdown format. Be specific about file paths and code patterns.`;
|
|
16
|
+
/**
|
|
17
|
+
* Research Agent
|
|
18
|
+
*
|
|
19
|
+
* Researches how to implement a story by analyzing the codebase
|
|
20
|
+
* and gathering relevant information.
|
|
21
|
+
*/
|
|
22
|
+
export async function runResearchAgent(storyPath, sdlcRoot, options = {}) {
|
|
23
|
+
const story = parseStory(storyPath);
|
|
24
|
+
const changesMade = [];
|
|
25
|
+
try {
|
|
26
|
+
// Gather codebase context
|
|
27
|
+
const codebaseContext = await gatherCodebaseContext(sdlcRoot);
|
|
28
|
+
// Build the prompt, including rework context if this is a refinement iteration
|
|
29
|
+
let prompt = `Please research how to implement this story:
|
|
30
|
+
|
|
31
|
+
Title: ${story.frontmatter.title}
|
|
32
|
+
|
|
33
|
+
Story content:
|
|
34
|
+
${story.content}
|
|
35
|
+
|
|
36
|
+
Codebase context:
|
|
37
|
+
${codebaseContext}`;
|
|
38
|
+
if (options.reworkContext) {
|
|
39
|
+
prompt += `
|
|
40
|
+
|
|
41
|
+
---
|
|
42
|
+
${options.reworkContext}
|
|
43
|
+
---
|
|
44
|
+
|
|
45
|
+
IMPORTANT: This is a refinement iteration. The previous implementation did not pass review.
|
|
46
|
+
You MUST address all the issues listed above in your research. Focus on finding solutions
|
|
47
|
+
to the specific problems identified by reviewers.`;
|
|
48
|
+
}
|
|
49
|
+
prompt += `
|
|
50
|
+
|
|
51
|
+
Provide research findings including:
|
|
52
|
+
1. Relevant existing patterns and code to reference
|
|
53
|
+
2. Files/modules that likely need modification
|
|
54
|
+
3. External resources or best practices to follow
|
|
55
|
+
4. Potential challenges or risks
|
|
56
|
+
5. Any dependencies or prerequisites
|
|
57
|
+
|
|
58
|
+
Format your response as markdown for the Research section of the story.`;
|
|
59
|
+
const researchContent = await runAgentQuery({
|
|
60
|
+
prompt,
|
|
61
|
+
systemPrompt: RESEARCH_SYSTEM_PROMPT,
|
|
62
|
+
workingDirectory: path.dirname(sdlcRoot),
|
|
63
|
+
onProgress: options.onProgress,
|
|
64
|
+
});
|
|
65
|
+
// Append research to the story
|
|
66
|
+
appendToSection(story, 'Research', researchContent);
|
|
67
|
+
changesMade.push('Added research findings');
|
|
68
|
+
// Mark research as complete
|
|
69
|
+
updateStoryField(story, 'research_complete', true);
|
|
70
|
+
changesMade.push('Marked research_complete: true');
|
|
71
|
+
return {
|
|
72
|
+
success: true,
|
|
73
|
+
story: parseStory(storyPath), // Re-read to get updated content
|
|
74
|
+
changesMade,
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
catch (error) {
|
|
78
|
+
return {
|
|
79
|
+
success: false,
|
|
80
|
+
story,
|
|
81
|
+
changesMade,
|
|
82
|
+
error: error instanceof Error ? error.message : String(error),
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Gather context about the codebase for research
|
|
88
|
+
*/
|
|
89
|
+
async function gatherCodebaseContext(sdlcRoot) {
|
|
90
|
+
const workingDir = path.dirname(sdlcRoot);
|
|
91
|
+
const context = [];
|
|
92
|
+
// Check for common project files
|
|
93
|
+
const projectFiles = [
|
|
94
|
+
'package.json',
|
|
95
|
+
'tsconfig.json',
|
|
96
|
+
'pyproject.toml',
|
|
97
|
+
'Cargo.toml',
|
|
98
|
+
'go.mod',
|
|
99
|
+
];
|
|
100
|
+
for (const file of projectFiles) {
|
|
101
|
+
const filePath = path.join(workingDir, file);
|
|
102
|
+
if (fs.existsSync(filePath)) {
|
|
103
|
+
try {
|
|
104
|
+
const content = fs.readFileSync(filePath, 'utf-8');
|
|
105
|
+
context.push(`=== ${file} ===\n${content.substring(0, 1000)}`);
|
|
106
|
+
}
|
|
107
|
+
catch {
|
|
108
|
+
// Ignore read errors
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
// Get directory structure (top level)
|
|
113
|
+
try {
|
|
114
|
+
const entries = fs.readdirSync(workingDir, { withFileTypes: true });
|
|
115
|
+
const dirs = entries
|
|
116
|
+
.filter(e => e.isDirectory() && !e.name.startsWith('.') && e.name !== 'node_modules')
|
|
117
|
+
.map(e => e.name);
|
|
118
|
+
const files = entries
|
|
119
|
+
.filter(e => e.isFile() && !e.name.startsWith('.'))
|
|
120
|
+
.map(e => e.name);
|
|
121
|
+
context.push(`=== Directory Structure ===\nDirectories: ${dirs.join(', ')}\nFiles: ${files.join(', ')}`);
|
|
122
|
+
}
|
|
123
|
+
catch {
|
|
124
|
+
// Ignore errors
|
|
125
|
+
}
|
|
126
|
+
// Look for source files
|
|
127
|
+
try {
|
|
128
|
+
const sourceFiles = await glob('src/**/*.{ts,js,py,go,rs}', {
|
|
129
|
+
cwd: workingDir,
|
|
130
|
+
ignore: ['node_modules/**', 'dist/**', 'build/**'],
|
|
131
|
+
});
|
|
132
|
+
if (sourceFiles.length > 0) {
|
|
133
|
+
context.push(`=== Source Files ===\n${sourceFiles.slice(0, 20).join('\n')}`);
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
catch {
|
|
137
|
+
// Ignore glob errors
|
|
138
|
+
}
|
|
139
|
+
return context.join('\n\n') || 'No codebase context available.';
|
|
140
|
+
}
|
|
141
|
+
//# sourceMappingURL=research.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"research.js","sourceRoot":"","sources":["../../src/agents/research.ts"],"names":[],"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,MAAM,CAAC;QACP,qBAAqB;IACvB,CAAC;IAED,OAAO,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,gCAAgC,CAAC;AAClE,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { AgentResult, ReviewResult } from '../types/index.js';
|
|
2
|
+
/**
|
|
3
|
+
* Progress callback for verification steps
|
|
4
|
+
*/
|
|
5
|
+
export type VerificationProgressCallback = (phase: 'build' | 'test', status: 'starting' | 'running' | 'passed' | 'failed', message?: string) => void;
|
|
6
|
+
/**
|
|
7
|
+
* Options for running the review agent
|
|
8
|
+
*/
|
|
9
|
+
export interface ReviewAgentOptions {
|
|
10
|
+
/** Callback for verification progress updates */
|
|
11
|
+
onVerificationProgress?: VerificationProgressCallback;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Review Agent
|
|
15
|
+
*
|
|
16
|
+
* Orchestrates code review, security review, and PO acceptance.
|
|
17
|
+
* Now returns structured ReviewResult with pass/fail and issues.
|
|
18
|
+
*/
|
|
19
|
+
export declare function runReviewAgent(storyPath: string, sdlcRoot: string, options?: ReviewAgentOptions): Promise<ReviewResult>;
|
|
20
|
+
/**
|
|
21
|
+
* Create a pull request for the completed story
|
|
22
|
+
*/
|
|
23
|
+
export declare function createPullRequest(storyPath: string, sdlcRoot: string): Promise<AgentResult>;
|
|
24
|
+
//# sourceMappingURL=review.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"review.d.ts","sourceRoot":"","sources":["../../src/agents/review.ts"],"names":[],"mappings":"AAOA,OAAO,EAAS,WAAW,EAAE,YAAY,EAA2F,MAAM,mBAAmB,CAAC;AA8H9J;;GAEG;AACH,MAAM,MAAM,4BAA4B,GAAG,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,EAAE,MAAM,EAAE,UAAU,GAAG,SAAS,GAAG,QAAQ,GAAG,QAAQ,EAAE,OAAO,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;AAsVrJ;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,iDAAiD;IACjD,sBAAsB,CAAC,EAAE,4BAA4B,CAAC;CACvD;AAED;;;;;GAKG;AACH,wBAAsB,cAAc,CAClC,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,MAAM,EAChB,OAAO,CAAC,EAAE,kBAAkB,GAC3B,OAAO,CAAC,YAAY,CAAC,CA4OvB;AAgCD;;GAEG;AACH,wBAAsB,iBAAiB,CACrC,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,WAAW,CAAC,CAgItB"}
|