ai-sdlc 0.2.0 → 0.3.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/README.md +19 -6
- package/dist/agents/implementation.d.ts +30 -1
- package/dist/agents/implementation.d.ts.map +1 -1
- package/dist/agents/implementation.js +172 -17
- package/dist/agents/implementation.js.map +1 -1
- package/dist/agents/index.d.ts +2 -0
- package/dist/agents/index.d.ts.map +1 -1
- package/dist/agents/index.js +2 -0
- package/dist/agents/index.js.map +1 -1
- package/dist/agents/orchestrator.d.ts +61 -0
- package/dist/agents/orchestrator.d.ts.map +1 -0
- package/dist/agents/orchestrator.js +443 -0
- package/dist/agents/orchestrator.js.map +1 -0
- package/dist/agents/planning.d.ts +1 -1
- package/dist/agents/planning.d.ts.map +1 -1
- package/dist/agents/planning.js +33 -1
- package/dist/agents/planning.js.map +1 -1
- package/dist/agents/review.d.ts +50 -1
- package/dist/agents/review.d.ts.map +1 -1
- package/dist/agents/review.js +389 -44
- package/dist/agents/review.js.map +1 -1
- package/dist/agents/rework.d.ts.map +1 -1
- package/dist/agents/rework.js +3 -1
- package/dist/agents/rework.js.map +1 -1
- package/dist/agents/single-task.d.ts +41 -0
- package/dist/agents/single-task.d.ts.map +1 -0
- package/dist/agents/single-task.js +357 -0
- package/dist/agents/single-task.js.map +1 -0
- package/dist/agents/verification.d.ts.map +1 -1
- package/dist/agents/verification.js +26 -12
- package/dist/agents/verification.js.map +1 -1
- package/dist/cli/batch-processor.d.ts +64 -0
- package/dist/cli/batch-processor.d.ts.map +1 -0
- package/dist/cli/batch-processor.js +85 -0
- package/dist/cli/batch-processor.js.map +1 -0
- package/dist/cli/batch-validator.d.ts +80 -0
- package/dist/cli/batch-validator.d.ts.map +1 -0
- package/dist/cli/batch-validator.js +121 -0
- package/dist/cli/batch-validator.js.map +1 -0
- package/dist/cli/commands.d.ts +8 -0
- package/dist/cli/commands.d.ts.map +1 -1
- package/dist/cli/commands.js +777 -48
- package/dist/cli/commands.js.map +1 -1
- package/dist/cli/daemon.d.ts.map +1 -1
- package/dist/cli/daemon.js +5 -0
- package/dist/cli/daemon.js.map +1 -1
- package/dist/cli/runner.d.ts.map +1 -1
- package/dist/cli/runner.js +20 -9
- package/dist/cli/runner.js.map +1 -1
- package/dist/core/client.d.ts +19 -1
- package/dist/core/client.d.ts.map +1 -1
- package/dist/core/client.js +191 -5
- package/dist/core/client.js.map +1 -1
- package/dist/core/config.d.ts +9 -1
- package/dist/core/config.d.ts.map +1 -1
- package/dist/core/config.js +51 -2
- package/dist/core/config.js.map +1 -1
- package/dist/core/index.d.ts +2 -0
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js +2 -0
- package/dist/core/index.js.map +1 -1
- package/dist/core/llm-utils.d.ts +103 -0
- package/dist/core/llm-utils.d.ts.map +1 -0
- package/dist/core/llm-utils.js +368 -0
- package/dist/core/llm-utils.js.map +1 -0
- package/dist/core/process-manager.d.ts +15 -0
- package/dist/core/process-manager.d.ts.map +1 -0
- package/dist/core/process-manager.js +132 -0
- package/dist/core/process-manager.js.map +1 -0
- package/dist/core/story.d.ts +35 -1
- package/dist/core/story.d.ts.map +1 -1
- package/dist/core/story.js +107 -1
- package/dist/core/story.js.map +1 -1
- package/dist/core/task-parser.d.ts +59 -0
- package/dist/core/task-parser.d.ts.map +1 -0
- package/dist/core/task-parser.js +235 -0
- package/dist/core/task-parser.js.map +1 -0
- package/dist/core/task-progress.d.ts +92 -0
- package/dist/core/task-progress.d.ts.map +1 -0
- package/dist/core/task-progress.js +280 -0
- package/dist/core/task-progress.js.map +1 -0
- package/dist/core/worktree.d.ts +111 -2
- package/dist/core/worktree.d.ts.map +1 -1
- package/dist/core/worktree.js +310 -2
- package/dist/core/worktree.js.map +1 -1
- package/dist/index.js +11 -0
- package/dist/index.js.map +1 -1
- package/dist/services/error-classifier.d.ts +119 -0
- package/dist/services/error-classifier.d.ts.map +1 -0
- package/dist/services/error-classifier.js +182 -0
- package/dist/services/error-classifier.js.map +1 -0
- package/dist/types/index.d.ts +230 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js.map +1 -1
- package/package.json +3 -2
- package/templates/story.md +5 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"orchestrator.d.ts","sourceRoot":"","sources":["../../src/agents/orchestrator.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAKH,OAAO,EACL,kBAAkB,EAClB,YAAY,EAEZ,eAAe,EACf,mBAAmB,EACnB,kBAAkB,EAElB,WAAW,EAEZ,MAAM,mBAAmB,CAAC;AAuB3B;;;;;;;;;;GAUG;AACH,wBAAgB,gBAAgB,CAC9B,IAAI,EAAE,kBAAkB,EACxB,YAAY,EAAE,MAAM,EACpB,gBAAgB,EAAE,MAAM,GACvB,WAAW,CA2Eb;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,eAAe,EACvB,YAAY,EAAE,MAAM,EACpB,UAAU,EAAE,MAAM,GACjB,SAAS,GAAG,aAAa,GAAG,eAAe,CA8E7C;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,WAAW,CACzB,KAAK,EAAE,kBAAkB,EAAE,EAC3B,QAAQ,EAAE,YAAY,EAAE,GACvB,kBAAkB,GAAG,IAAI,CAkD3B;AAqED;;;;;;;;;;;;;GAaG;AACH,wBAAsB,6BAA6B,CACjD,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,MAAM,EAChB,OAAO,CAAC,EAAE,mBAAmB,GAC5B,OAAO,CAAC,kBAAkB,CAAC,CAkM7B"}
|
|
@@ -0,0 +1,443 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Sequential Task Orchestrator
|
|
3
|
+
*
|
|
4
|
+
* Orchestrates implementation by running each task as an isolated agent,
|
|
5
|
+
* preventing context window exhaustion and enabling intelligent retry/recovery.
|
|
6
|
+
*/
|
|
7
|
+
import { spawnSync } from 'child_process';
|
|
8
|
+
import fs from 'fs';
|
|
9
|
+
import path from 'path';
|
|
10
|
+
import { parseImplementationTasks } from '../core/task-parser.js';
|
|
11
|
+
import { getTaskProgress, updateTaskProgress, initializeTaskProgress, readStoryFile, } from '../core/task-progress.js';
|
|
12
|
+
import { runSingleTaskAgent } from './single-task.js';
|
|
13
|
+
import { getLogger } from '../core/logger.js';
|
|
14
|
+
const logger = getLogger();
|
|
15
|
+
/**
|
|
16
|
+
* Default orchestrator options
|
|
17
|
+
*/
|
|
18
|
+
const DEFAULT_OPTIONS = {
|
|
19
|
+
maxRetriesPerTask: 2,
|
|
20
|
+
commitAfterEachTask: true,
|
|
21
|
+
stopOnFirstFailure: true,
|
|
22
|
+
dryRun: false,
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* Build minimal context for a single task
|
|
26
|
+
*
|
|
27
|
+
* Extracts relevant acceptance criteria, existing file contents, and project conventions.
|
|
28
|
+
* Truncates if context exceeds reasonable size (~2000 chars for projectPatterns).
|
|
29
|
+
*
|
|
30
|
+
* @param task - Task to build context for
|
|
31
|
+
* @param storyContent - Full story content
|
|
32
|
+
* @param workingDirectory - Working directory for task execution
|
|
33
|
+
* @returns Minimal task context
|
|
34
|
+
*/
|
|
35
|
+
export function buildTaskContext(task, storyContent, workingDirectory) {
|
|
36
|
+
// Extract acceptance criteria section
|
|
37
|
+
const acceptanceCriteria = [];
|
|
38
|
+
const acMatch = storyContent.match(/##\s+Acceptance\s+Criteria\s*\n([\s\S]*?)(?=\n##|$)/i);
|
|
39
|
+
if (acMatch) {
|
|
40
|
+
const acSection = acMatch[1];
|
|
41
|
+
const lines = acSection.split('\n');
|
|
42
|
+
for (const line of lines) {
|
|
43
|
+
const trimmed = line.trim();
|
|
44
|
+
if (trimmed.startsWith('-') || trimmed.startsWith('*')) {
|
|
45
|
+
// Remove checkbox and bullet
|
|
46
|
+
const criterion = trimmed.replace(/^[-*]\s+\[[ x]\]\s*/, '').replace(/^[-*]\s+/, '');
|
|
47
|
+
if (criterion) {
|
|
48
|
+
acceptanceCriteria.push(criterion);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
// Filter acceptance criteria to only those relevant to task files
|
|
54
|
+
const taskFiles = task.files || [];
|
|
55
|
+
const relevantCriteria = acceptanceCriteria.filter((criterion) => {
|
|
56
|
+
// Include if criterion mentions any task file
|
|
57
|
+
return taskFiles.some((file) => {
|
|
58
|
+
const fileName = path.basename(file);
|
|
59
|
+
const fileBaseName = fileName.replace(/\.(ts|tsx|js|jsx)$/, '');
|
|
60
|
+
return (criterion.includes(file) ||
|
|
61
|
+
criterion.includes(fileName) ||
|
|
62
|
+
criterion.includes(fileBaseName));
|
|
63
|
+
});
|
|
64
|
+
});
|
|
65
|
+
// If no specific matches, include first 3 criteria as general context
|
|
66
|
+
const finalCriteria = relevantCriteria.length > 0 ? relevantCriteria : acceptanceCriteria.slice(0, 3);
|
|
67
|
+
// Read existing files
|
|
68
|
+
const existingFiles = [];
|
|
69
|
+
for (const file of taskFiles) {
|
|
70
|
+
const filePath = path.join(workingDirectory, file);
|
|
71
|
+
if (fs.existsSync(filePath)) {
|
|
72
|
+
try {
|
|
73
|
+
const content = fs.readFileSync(filePath, 'utf-8');
|
|
74
|
+
existingFiles.push({ path: file, content });
|
|
75
|
+
}
|
|
76
|
+
catch (error) {
|
|
77
|
+
logger.warn('orchestrator', `Failed to read file ${file}: ${error.message}`);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
// Extract project conventions (brief summary)
|
|
82
|
+
let projectPatterns = '';
|
|
83
|
+
const conventionsMatch = storyContent.match(/##\s+(Technical\s+Specification|Project\s+Conventions)\s*\n([\s\S]*?)(?=\n##|$)/i);
|
|
84
|
+
if (conventionsMatch) {
|
|
85
|
+
projectPatterns = conventionsMatch[2].trim();
|
|
86
|
+
}
|
|
87
|
+
// Truncate if too long
|
|
88
|
+
const MAX_PATTERN_LENGTH = 2000;
|
|
89
|
+
if (projectPatterns.length > MAX_PATTERN_LENGTH) {
|
|
90
|
+
projectPatterns =
|
|
91
|
+
projectPatterns.substring(0, MAX_PATTERN_LENGTH) + '\n\n[... truncated for length]';
|
|
92
|
+
}
|
|
93
|
+
return {
|
|
94
|
+
task,
|
|
95
|
+
acceptanceCriteria: finalCriteria,
|
|
96
|
+
existingFiles,
|
|
97
|
+
projectPatterns,
|
|
98
|
+
workingDirectory,
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Evaluate task result and categorize failure type
|
|
103
|
+
*
|
|
104
|
+
* Returns:
|
|
105
|
+
* - 'success': Task completed successfully
|
|
106
|
+
* - 'recoverable': Failure that can be retried (timeout, transient error, verification failed)
|
|
107
|
+
* - 'unrecoverable': Failure that should stop orchestration (deps not met, impossible task, max retries)
|
|
108
|
+
*
|
|
109
|
+
* @param result - Result from single-task agent execution
|
|
110
|
+
* @param attemptCount - Number of attempts made so far (including this one)
|
|
111
|
+
* @param maxRetries - Maximum retry attempts allowed
|
|
112
|
+
* @returns Failure category
|
|
113
|
+
*/
|
|
114
|
+
export function evaluateTaskResult(result, attemptCount, maxRetries) {
|
|
115
|
+
if (result.success) {
|
|
116
|
+
return 'success';
|
|
117
|
+
}
|
|
118
|
+
const error = result.error || '';
|
|
119
|
+
const lowerError = error.toLowerCase();
|
|
120
|
+
// Check if max retries exceeded (becomes unrecoverable)
|
|
121
|
+
if (attemptCount > maxRetries) {
|
|
122
|
+
logger.warn('orchestrator', `Task ${result.task.id} exceeded max retries (${maxRetries})`);
|
|
123
|
+
return 'unrecoverable';
|
|
124
|
+
}
|
|
125
|
+
// Unrecoverable: Dependencies not met
|
|
126
|
+
if (lowerError.includes('dependency') ||
|
|
127
|
+
lowerError.includes('depends on') ||
|
|
128
|
+
lowerError.includes('prerequisite')) {
|
|
129
|
+
return 'unrecoverable';
|
|
130
|
+
}
|
|
131
|
+
// Unrecoverable: Impossible task or design flaw
|
|
132
|
+
if (lowerError.includes('impossible') ||
|
|
133
|
+
lowerError.includes('cannot be done') ||
|
|
134
|
+
lowerError.includes('design flaw')) {
|
|
135
|
+
return 'unrecoverable';
|
|
136
|
+
}
|
|
137
|
+
// Unrecoverable: Files outside scope modified
|
|
138
|
+
if (result.scopeViolation && result.scopeViolation.length > 0) {
|
|
139
|
+
logger.warn('orchestrator', `Task ${result.task.id} modified files outside scope: ${result.scopeViolation.join(', ')}`);
|
|
140
|
+
return 'unrecoverable';
|
|
141
|
+
}
|
|
142
|
+
// Recoverable: Timeout
|
|
143
|
+
if (lowerError.includes('timeout') || lowerError.includes('timed out')) {
|
|
144
|
+
return 'recoverable';
|
|
145
|
+
}
|
|
146
|
+
// Recoverable: Transient API error
|
|
147
|
+
if (lowerError.includes('rate limit') ||
|
|
148
|
+
lowerError.includes('network') ||
|
|
149
|
+
lowerError.includes('connection') ||
|
|
150
|
+
lowerError.includes('api error')) {
|
|
151
|
+
return 'recoverable';
|
|
152
|
+
}
|
|
153
|
+
// Recoverable: Verification failed (tests/lint/build)
|
|
154
|
+
if (!result.verificationPassed ||
|
|
155
|
+
lowerError.includes('test') ||
|
|
156
|
+
lowerError.includes('lint') ||
|
|
157
|
+
lowerError.includes('build')) {
|
|
158
|
+
return 'recoverable';
|
|
159
|
+
}
|
|
160
|
+
// Recoverable: Unclear requirements (agent needs clarification)
|
|
161
|
+
if (lowerError.includes('unclear') ||
|
|
162
|
+
lowerError.includes('need') ||
|
|
163
|
+
lowerError.includes('missing file') ||
|
|
164
|
+
result.missingDependencies) {
|
|
165
|
+
return 'recoverable';
|
|
166
|
+
}
|
|
167
|
+
// Default to recoverable for unknown errors (give it a chance to retry)
|
|
168
|
+
return 'recoverable';
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* Get next task to execute based on dependencies and progress
|
|
172
|
+
*
|
|
173
|
+
* Returns task with status 'pending' or 'in_progress' whose dependencies are all completed.
|
|
174
|
+
* Detects circular dependencies and throws error.
|
|
175
|
+
*
|
|
176
|
+
* @param tasks - All tasks from implementation plan
|
|
177
|
+
* @param progress - Current task progress
|
|
178
|
+
* @returns Next eligible task or null if none available
|
|
179
|
+
* @throws Error if circular dependency detected
|
|
180
|
+
*/
|
|
181
|
+
export function getNextTask(tasks, progress) {
|
|
182
|
+
// Build progress map for quick lookup
|
|
183
|
+
const progressMap = new Map();
|
|
184
|
+
for (const p of progress) {
|
|
185
|
+
progressMap.set(p.taskId, p.status);
|
|
186
|
+
}
|
|
187
|
+
// Find tasks eligible for execution
|
|
188
|
+
const eligibleTasks = tasks.filter((task) => {
|
|
189
|
+
const status = progressMap.get(task.id);
|
|
190
|
+
// Only consider pending or in_progress tasks
|
|
191
|
+
if (status !== 'pending' && status !== 'in_progress') {
|
|
192
|
+
return false;
|
|
193
|
+
}
|
|
194
|
+
// Check if all dependencies are completed
|
|
195
|
+
const deps = task.dependencies || [];
|
|
196
|
+
const allDepsCompleted = deps.every((depId) => progressMap.get(depId) === 'completed');
|
|
197
|
+
return allDepsCompleted;
|
|
198
|
+
});
|
|
199
|
+
// Prioritize in_progress tasks (resume interrupted work)
|
|
200
|
+
const inProgressTask = eligibleTasks.find((task) => progressMap.get(task.id) === 'in_progress');
|
|
201
|
+
if (inProgressTask) {
|
|
202
|
+
return inProgressTask;
|
|
203
|
+
}
|
|
204
|
+
// Return first pending task
|
|
205
|
+
const pendingTask = eligibleTasks.find((task) => progressMap.get(task.id) === 'pending');
|
|
206
|
+
if (pendingTask) {
|
|
207
|
+
return pendingTask;
|
|
208
|
+
}
|
|
209
|
+
// No eligible tasks - check for circular dependencies
|
|
210
|
+
const incompleteTasks = tasks.filter((task) => {
|
|
211
|
+
const status = progressMap.get(task.id);
|
|
212
|
+
return status !== 'completed' && status !== 'failed';
|
|
213
|
+
});
|
|
214
|
+
if (incompleteTasks.length > 0) {
|
|
215
|
+
// We have incomplete tasks but none are eligible - likely circular dependency
|
|
216
|
+
const taskIds = incompleteTasks.map((t) => t.id).join(', ');
|
|
217
|
+
throw new Error(`Circular dependency detected: tasks [${taskIds}] cannot be executed due to unmet dependencies`);
|
|
218
|
+
}
|
|
219
|
+
return null;
|
|
220
|
+
}
|
|
221
|
+
/**
|
|
222
|
+
* Commit task completion to git
|
|
223
|
+
*
|
|
224
|
+
* Stages modified files, creates commit with standard message format.
|
|
225
|
+
* Verifies no files outside task scope were modified.
|
|
226
|
+
*
|
|
227
|
+
* @param task - Task that was completed
|
|
228
|
+
* @param filesChanged - Files modified by task
|
|
229
|
+
* @param storyId - Story ID for commit message
|
|
230
|
+
* @param workingDir - Working directory
|
|
231
|
+
* @throws Error if git operations fail
|
|
232
|
+
*/
|
|
233
|
+
async function commitTaskCompletion(task, filesChanged, storyId, workingDir) {
|
|
234
|
+
if (filesChanged.length === 0) {
|
|
235
|
+
logger.warn('orchestrator', `Task ${task.id} completed but no files changed, skipping commit`);
|
|
236
|
+
return;
|
|
237
|
+
}
|
|
238
|
+
// Validate file paths
|
|
239
|
+
const declaredFiles = task.files || [];
|
|
240
|
+
const violations = filesChanged.filter((f) => !declaredFiles.includes(f));
|
|
241
|
+
if (violations.length > 0) {
|
|
242
|
+
throw new Error(`Task ${task.id} modified files outside declared scope: ${violations.join(', ')}`);
|
|
243
|
+
}
|
|
244
|
+
// Stage files using safe git invocation
|
|
245
|
+
const addResult = spawnSync('git', ['add', ...filesChanged], {
|
|
246
|
+
cwd: workingDir,
|
|
247
|
+
encoding: 'utf8',
|
|
248
|
+
});
|
|
249
|
+
if (addResult.error) {
|
|
250
|
+
throw new Error(`Failed to stage files: ${addResult.error.message}`);
|
|
251
|
+
}
|
|
252
|
+
if (addResult.status !== 0) {
|
|
253
|
+
const stderr = addResult.stderr || addResult.stdout || '';
|
|
254
|
+
throw new Error(`Failed to stage files: ${stderr}`);
|
|
255
|
+
}
|
|
256
|
+
// Create commit
|
|
257
|
+
const commitMessage = `feat(${storyId}): Complete task ${task.id} - ${task.description}`;
|
|
258
|
+
const commitResult = spawnSync('git', ['commit', '-m', commitMessage], {
|
|
259
|
+
cwd: workingDir,
|
|
260
|
+
encoding: 'utf8',
|
|
261
|
+
});
|
|
262
|
+
if (commitResult.error) {
|
|
263
|
+
throw new Error(`Failed to commit: ${commitResult.error.message}`);
|
|
264
|
+
}
|
|
265
|
+
if (commitResult.status !== 0) {
|
|
266
|
+
const stderr = commitResult.stderr || commitResult.stdout || '';
|
|
267
|
+
throw new Error(`Failed to commit: ${stderr}`);
|
|
268
|
+
}
|
|
269
|
+
logger.info('orchestrator', `Committed task ${task.id}: ${commitMessage}`);
|
|
270
|
+
}
|
|
271
|
+
/**
|
|
272
|
+
* Run implementation orchestrator
|
|
273
|
+
*
|
|
274
|
+
* Main orchestration loop:
|
|
275
|
+
* 1. Parse tasks from plan
|
|
276
|
+
* 2. Load/initialize progress
|
|
277
|
+
* 3. Loop: get next task → run agent → evaluate → commit → repeat
|
|
278
|
+
* 4. Return summary result
|
|
279
|
+
*
|
|
280
|
+
* @param storyPath - Absolute path to story.md file
|
|
281
|
+
* @param sdlcRoot - SDLC root directory
|
|
282
|
+
* @param options - Orchestrator options
|
|
283
|
+
* @returns Orchestration result summary
|
|
284
|
+
*/
|
|
285
|
+
export async function runImplementationOrchestrator(storyPath, sdlcRoot, options) {
|
|
286
|
+
const opts = { ...DEFAULT_OPTIONS, ...options };
|
|
287
|
+
const workingDir = path.dirname(storyPath);
|
|
288
|
+
logger.info('orchestrator', 'Starting implementation orchestration', {
|
|
289
|
+
storyPath,
|
|
290
|
+
options: opts,
|
|
291
|
+
});
|
|
292
|
+
// Parse tasks from plan
|
|
293
|
+
const storyContent = await readStoryFile(storyPath);
|
|
294
|
+
const tasks = parseImplementationTasks(storyContent);
|
|
295
|
+
if (tasks.length === 0) {
|
|
296
|
+
logger.warn('orchestrator', 'No tasks found in implementation plan');
|
|
297
|
+
return {
|
|
298
|
+
success: true,
|
|
299
|
+
tasksCompleted: 0,
|
|
300
|
+
tasksFailed: 0,
|
|
301
|
+
tasksRemaining: 0,
|
|
302
|
+
failedTasks: [],
|
|
303
|
+
totalAgentInvocations: 0,
|
|
304
|
+
};
|
|
305
|
+
}
|
|
306
|
+
logger.info('orchestrator', `Found ${tasks.length} tasks in plan`);
|
|
307
|
+
// Load or initialize progress
|
|
308
|
+
let progress = await getTaskProgress(storyPath);
|
|
309
|
+
if (progress.length === 0) {
|
|
310
|
+
logger.info('orchestrator', 'Initializing task progress tracking');
|
|
311
|
+
await initializeTaskProgress(storyPath, tasks.map((t) => t.id));
|
|
312
|
+
progress = await getTaskProgress(storyPath);
|
|
313
|
+
}
|
|
314
|
+
// Extract story ID from path
|
|
315
|
+
const storyId = path.basename(path.dirname(storyPath));
|
|
316
|
+
// Track statistics
|
|
317
|
+
// Count already-completed tasks from previous runs
|
|
318
|
+
const alreadyCompleted = progress.filter((p) => p.status === 'completed').length;
|
|
319
|
+
const alreadyFailed = progress.filter((p) => p.status === 'failed').length;
|
|
320
|
+
let tasksCompleted = alreadyCompleted;
|
|
321
|
+
let tasksFailed = alreadyFailed;
|
|
322
|
+
let totalAgentInvocations = 0;
|
|
323
|
+
const failedTasks = [];
|
|
324
|
+
const retryCount = new Map();
|
|
325
|
+
// Main orchestration loop
|
|
326
|
+
while (true) {
|
|
327
|
+
// Get next eligible task
|
|
328
|
+
let nextTask;
|
|
329
|
+
try {
|
|
330
|
+
nextTask = getNextTask(tasks, progress);
|
|
331
|
+
}
|
|
332
|
+
catch (error) {
|
|
333
|
+
// Circular dependency or other fatal error
|
|
334
|
+
logger.error('orchestrator', 'Failed to get next task', { error: error.message });
|
|
335
|
+
return {
|
|
336
|
+
success: false,
|
|
337
|
+
tasksCompleted,
|
|
338
|
+
tasksFailed: tasks.length - tasksCompleted,
|
|
339
|
+
tasksRemaining: tasks.length - tasksCompleted - tasksFailed,
|
|
340
|
+
failedTasks,
|
|
341
|
+
totalAgentInvocations,
|
|
342
|
+
};
|
|
343
|
+
}
|
|
344
|
+
if (!nextTask) {
|
|
345
|
+
// No more eligible tasks
|
|
346
|
+
break;
|
|
347
|
+
}
|
|
348
|
+
logger.info('orchestrator', `Executing task ${nextTask.id}: ${nextTask.description}`);
|
|
349
|
+
// Mark task in progress
|
|
350
|
+
await updateTaskProgress(storyPath, nextTask.id, 'in_progress');
|
|
351
|
+
// Build task context
|
|
352
|
+
const taskContext = buildTaskContext(nextTask, storyContent, workingDir);
|
|
353
|
+
// Execute task agent (or simulate in dry run)
|
|
354
|
+
let result;
|
|
355
|
+
if (opts.dryRun) {
|
|
356
|
+
logger.info('orchestrator', `[DRY RUN] Would execute task ${nextTask.id}`);
|
|
357
|
+
result = {
|
|
358
|
+
success: true,
|
|
359
|
+
task: nextTask,
|
|
360
|
+
filesChanged: nextTask.files || [],
|
|
361
|
+
verificationPassed: true,
|
|
362
|
+
};
|
|
363
|
+
}
|
|
364
|
+
else {
|
|
365
|
+
result = await runSingleTaskAgent(taskContext);
|
|
366
|
+
}
|
|
367
|
+
totalAgentInvocations++;
|
|
368
|
+
const attempts = (retryCount.get(nextTask.id) || 0) + 1;
|
|
369
|
+
retryCount.set(nextTask.id, attempts);
|
|
370
|
+
// Evaluate result
|
|
371
|
+
const evaluation = evaluateTaskResult(result, attempts, opts.maxRetriesPerTask);
|
|
372
|
+
if (evaluation === 'success') {
|
|
373
|
+
// Task succeeded
|
|
374
|
+
await updateTaskProgress(storyPath, nextTask.id, 'completed');
|
|
375
|
+
tasksCompleted++;
|
|
376
|
+
// Commit if enabled
|
|
377
|
+
if (opts.commitAfterEachTask && !opts.dryRun) {
|
|
378
|
+
try {
|
|
379
|
+
await commitTaskCompletion(nextTask, result.filesChanged, storyId, workingDir);
|
|
380
|
+
}
|
|
381
|
+
catch (error) {
|
|
382
|
+
logger.error('orchestrator', `Failed to commit task ${nextTask.id}`, {
|
|
383
|
+
error: error.message,
|
|
384
|
+
});
|
|
385
|
+
// Continue despite commit failure
|
|
386
|
+
}
|
|
387
|
+
}
|
|
388
|
+
logger.info('orchestrator', `Task ${nextTask.id} completed successfully`);
|
|
389
|
+
}
|
|
390
|
+
else if (evaluation === 'recoverable') {
|
|
391
|
+
// Recoverable failure - retry if under max attempts
|
|
392
|
+
if (attempts <= opts.maxRetriesPerTask) {
|
|
393
|
+
logger.warn('orchestrator', `Task ${nextTask.id} failed (recoverable), will retry (attempt ${attempts}/${opts.maxRetriesPerTask})`);
|
|
394
|
+
// Keep status as 'in_progress' to retry
|
|
395
|
+
}
|
|
396
|
+
else {
|
|
397
|
+
// Max retries exceeded
|
|
398
|
+
await updateTaskProgress(storyPath, nextTask.id, 'failed', result.error || 'Max retries exceeded');
|
|
399
|
+
tasksFailed++;
|
|
400
|
+
failedTasks.push({
|
|
401
|
+
taskId: nextTask.id,
|
|
402
|
+
error: result.error || 'Max retries exceeded',
|
|
403
|
+
attempts,
|
|
404
|
+
});
|
|
405
|
+
logger.error('orchestrator', `Task ${nextTask.id} failed after ${attempts} attempts`);
|
|
406
|
+
if (opts.stopOnFirstFailure) {
|
|
407
|
+
logger.error('orchestrator', 'Stopping orchestration due to unrecoverable failure');
|
|
408
|
+
break;
|
|
409
|
+
}
|
|
410
|
+
}
|
|
411
|
+
}
|
|
412
|
+
else {
|
|
413
|
+
// Unrecoverable failure
|
|
414
|
+
await updateTaskProgress(storyPath, nextTask.id, 'failed', result.error || 'Unrecoverable failure');
|
|
415
|
+
tasksFailed++;
|
|
416
|
+
failedTasks.push({
|
|
417
|
+
taskId: nextTask.id,
|
|
418
|
+
error: result.error || 'Unrecoverable failure',
|
|
419
|
+
attempts,
|
|
420
|
+
});
|
|
421
|
+
logger.error('orchestrator', `Task ${nextTask.id} failed (unrecoverable)`);
|
|
422
|
+
if (opts.stopOnFirstFailure) {
|
|
423
|
+
logger.error('orchestrator', 'Stopping orchestration due to unrecoverable failure');
|
|
424
|
+
break;
|
|
425
|
+
}
|
|
426
|
+
}
|
|
427
|
+
// Reload progress for next iteration
|
|
428
|
+
progress = await getTaskProgress(storyPath);
|
|
429
|
+
}
|
|
430
|
+
// Calculate remaining tasks
|
|
431
|
+
const tasksRemaining = tasks.length - tasksCompleted - tasksFailed;
|
|
432
|
+
const result = {
|
|
433
|
+
success: tasksFailed === 0 && tasksRemaining === 0,
|
|
434
|
+
tasksCompleted,
|
|
435
|
+
tasksFailed,
|
|
436
|
+
tasksRemaining,
|
|
437
|
+
failedTasks,
|
|
438
|
+
totalAgentInvocations,
|
|
439
|
+
};
|
|
440
|
+
logger.info('orchestrator', 'Orchestration complete', result);
|
|
441
|
+
return result;
|
|
442
|
+
}
|
|
443
|
+
//# sourceMappingURL=orchestrator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"orchestrator.js","sourceRoot":"","sources":["../../src/agents/orchestrator.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC1C,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,IAAI,MAAM,MAAM,CAAC;AAYxB,OAAO,EAAE,wBAAwB,EAAE,MAAM,wBAAwB,CAAC;AAClE,OAAO,EACL,eAAe,EACf,kBAAkB,EAClB,sBAAsB,EACtB,aAAa,GACd,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AACtD,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAE9C,MAAM,MAAM,GAAG,SAAS,EAAE,CAAC;AAE3B;;GAEG;AACH,MAAM,eAAe,GAAkC;IACrD,iBAAiB,EAAE,CAAC;IACpB,mBAAmB,EAAE,IAAI;IACzB,kBAAkB,EAAE,IAAI;IACxB,MAAM,EAAE,KAAK;CACd,CAAC;AAEF;;;;;;;;;;GAUG;AACH,MAAM,UAAU,gBAAgB,CAC9B,IAAwB,EACxB,YAAoB,EACpB,gBAAwB;IAExB,sCAAsC;IACtC,MAAM,kBAAkB,GAAa,EAAE,CAAC;IACxC,MAAM,OAAO,GAAG,YAAY,CAAC,KAAK,CAAC,sDAAsD,CAAC,CAAC;IAC3F,IAAI,OAAO,EAAE,CAAC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,EACX,QAAQ,EACR,MAAM,CAAC,KAAK,IAAI,uBAAuB,CACxC,CAAC;YACF,WAAW,EAAE,CAAC;YACd,WAAW,CAAC,IAAI,CAAC;gBACf,MAAM,EAAE,QAAQ,CAAC,EAAE;gBACnB,KAAK,EAAE,MAAM,CAAC,KAAK,IAAI,uBAAuB;gBAC9C,QAAQ;aACT,CAAC,CAAC;YAEH,MAAM,CAAC,KAAK,CAAC,cAAc,EAAE,QAAQ,QAAQ,CAAC,EAAE,yBAAyB,CAAC,CAAC;YAE3E,IAAI,IAAI,CAAC,kBAAkB,EAAE,CAAC;gBAC5B,MAAM,CAAC,KAAK,CAAC,cAAc,EAAE,qDAAqD,CAAC,CAAC;gBACpF,MAAM;YACR,CAAC;QACH,CAAC;QAED,qCAAqC;QACrC,QAAQ,GAAG,MAAM,eAAe,CAAC,SAAS,CAAC,CAAC;IAC9C,CAAC;IAED,4BAA4B;IAC5B,MAAM,cAAc,GAAG,KAAK,CAAC,MAAM,GAAG,cAAc,GAAG,WAAW,CAAC;IAEnE,MAAM,MAAM,GAAuB;QACjC,OAAO,EAAE,WAAW,KAAK,CAAC,IAAI,cAAc,KAAK,CAAC;QAClD,cAAc;QACd,WAAW;QACX,cAAc;QACd,WAAW;QACX,qBAAqB;KACtB,CAAC;IAEF,MAAM,CAAC,IAAI,CAAC,cAAc,EAAE,wBAAwB,EAAE,MAAM,CAAC,CAAC;IAE9D,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -3,7 +3,7 @@ import { AgentOptions } from './research.js';
|
|
|
3
3
|
/**
|
|
4
4
|
* System prompt for the planning agent
|
|
5
5
|
*/
|
|
6
|
-
export declare const PLANNING_SYSTEM_PROMPT = "You are a technical planning specialist. Your job is to create detailed, step-by-step implementation plans for user stories.\n\nWhen creating a plan, you should:\n1. Break the work into phases (setup, implementation, testing, etc.)\n2. Create specific, actionable tasks within each phase\n3. Use checkbox format for tracking progress\n4. Consider test-driven development (write tests first)\n5. Include verification steps\n\nOutput your plan in markdown format with checkboxes. Each task should be small enough to complete in one focused session.";
|
|
6
|
+
export declare const PLANNING_SYSTEM_PROMPT = "You are a technical planning specialist. Your job is to create detailed, step-by-step implementation plans for user stories.\n\nWhen creating a plan, you should:\n1. Break the work into phases (setup, implementation, testing, etc.)\n2. Create specific, actionable tasks within each phase\n3. Use checkbox format for tracking progress\n4. Consider test-driven development (write tests first)\n5. Include verification steps\n\nOutput your plan in markdown format with checkboxes. Each task should be small enough to complete in one focused session.\n\n## Task Format\n\nWhen creating implementation plans, output tasks using this structured format:\n\n## Implementation Tasks\n\n- [ ] **T1**: {clear, actionable task description}\n - Files: {comma-separated file paths in backticks}\n - Dependencies: {comma-separated task IDs or \"none\"}\n\nExample:\n- [ ] **T1**: Create authentication service\n - Files: `src/services/auth.ts`, `src/types/auth.ts`\n - Dependencies: none\n\n- [ ] **T2**: Add authentication middleware\n - Files: `src/middleware/auth.ts`\n - Dependencies: T1\n\n- [ ] **T3**: Implement login endpoint\n - Files: `src/routes/auth.ts`\n - Dependencies: T1, T2\n\nRules:\n- Use sequential task IDs: T1, T2, T3, etc.\n- Keep descriptions concise and actionable (start with a verb)\n- List all files that will be created or modified\n- Specify dependencies by task ID, or \"none\" if no dependencies\n- Files and Dependencies lines are optional but recommended for clarity\n- Tasks can have multiple dependencies (comma-separated)\n- Ensure no circular dependencies exist in the task graph";
|
|
7
7
|
/**
|
|
8
8
|
* TDD-specific planning instructions
|
|
9
9
|
* When TDD is enabled, this is appended to the planning prompt to ensure
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"planning.d.ts","sourceRoot":"","sources":["../../src/agents/planning.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEvD,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAE7C;;GAEG;AACH,eAAO,MAAM,sBAAsB,
|
|
1
|
+
{"version":3,"file":"planning.d.ts","sourceRoot":"","sources":["../../src/agents/planning.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEvD,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAE7C;;GAEG;AACH,eAAO,MAAM,sBAAsB,+kDAyCuB,CAAC;AAE3D;;;;GAIG;AACH,eAAO,MAAM,yBAAyB,+xCAyBuB,CAAC;AAE9D;;;;;;;GAOG;AACH,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,KAAK,EACZ,kBAAkB,EAAE,OAAO,EAC3B,aAAa,CAAC,EAAE,MAAM,GACrB,MAAM,CA+CR;AAED;;;;GAIG;AACH,wBAAsB,gBAAgB,CACpC,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,MAAM,EAChB,OAAO,GAAE,YAAiB,GACzB,OAAO,CAAC,WAAW,CAAC,CAmEtB"}
|
package/dist/agents/planning.js
CHANGED
|
@@ -14,7 +14,39 @@ When creating a plan, you should:
|
|
|
14
14
|
4. Consider test-driven development (write tests first)
|
|
15
15
|
5. Include verification steps
|
|
16
16
|
|
|
17
|
-
Output your plan in markdown format with checkboxes. Each task should be small enough to complete in one focused session
|
|
17
|
+
Output your plan in markdown format with checkboxes. Each task should be small enough to complete in one focused session.
|
|
18
|
+
|
|
19
|
+
## Task Format
|
|
20
|
+
|
|
21
|
+
When creating implementation plans, output tasks using this structured format:
|
|
22
|
+
|
|
23
|
+
## Implementation Tasks
|
|
24
|
+
|
|
25
|
+
- [ ] **T1**: {clear, actionable task description}
|
|
26
|
+
- Files: {comma-separated file paths in backticks}
|
|
27
|
+
- Dependencies: {comma-separated task IDs or "none"}
|
|
28
|
+
|
|
29
|
+
Example:
|
|
30
|
+
- [ ] **T1**: Create authentication service
|
|
31
|
+
- Files: \`src/services/auth.ts\`, \`src/types/auth.ts\`
|
|
32
|
+
- Dependencies: none
|
|
33
|
+
|
|
34
|
+
- [ ] **T2**: Add authentication middleware
|
|
35
|
+
- Files: \`src/middleware/auth.ts\`
|
|
36
|
+
- Dependencies: T1
|
|
37
|
+
|
|
38
|
+
- [ ] **T3**: Implement login endpoint
|
|
39
|
+
- Files: \`src/routes/auth.ts\`
|
|
40
|
+
- Dependencies: T1, T2
|
|
41
|
+
|
|
42
|
+
Rules:
|
|
43
|
+
- Use sequential task IDs: T1, T2, T3, etc.
|
|
44
|
+
- Keep descriptions concise and actionable (start with a verb)
|
|
45
|
+
- List all files that will be created or modified
|
|
46
|
+
- Specify dependencies by task ID, or "none" if no dependencies
|
|
47
|
+
- Files and Dependencies lines are optional but recommended for clarity
|
|
48
|
+
- Tasks can have multiple dependencies (comma-separated)
|
|
49
|
+
- Ensure no circular dependencies exist in the task graph`;
|
|
18
50
|
/**
|
|
19
51
|
* TDD-specific planning instructions
|
|
20
52
|
* When TDD is enabled, this is appended to the planning prompt to ensure
|
|
@@ -1 +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;AAClD,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAE9C,OAAO,IAAI,MAAM,MAAM,CAAC;AAGxB;;GAEG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG
|
|
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;AAClD,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAE9C,OAAO,IAAI,MAAM,MAAM,CAAC;AAGxB;;GAEG;AACH,MAAM,CAAC,MAAM,sBAAs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;YACL,OAAO,EAAE,IAAI;YACb,KAAK,EAAE,UAAU,CAAC,SAAS,CAAC,EAAE,iCAAiC;YAC/D,WAAW;SACZ,CAAC;IACJ,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,YAAY,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QAC5E,MAAM,CAAC,KAAK,CAAC,UAAU,EAAE,uBAAuB,EAAE;YAChD,OAAO,EAAE,KAAK,CAAC,WAAW,CAAC,EAAE;YAC7B,UAAU,EAAE,IAAI,CAAC,GAAG,EAAE,GAAG,SAAS;YAClC,KAAK,EAAE,YAAY;SACpB,CAAC,CAAC;QAEH,OAAO;YACL,OAAO,EAAE,KAAK;YACd,KAAK;YACL,WAAW;YACX,KAAK,EAAE,YAAY;SACpB,CAAC;IACJ,CAAC;AACH,CAAC"}
|
package/dist/agents/review.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Story, AgentResult, ReviewResult, ReviewIssue, TDDTestCycle } from '../types/index.js';
|
|
1
|
+
import { Story, AgentResult, ReviewResult, ReviewIssue, TDDTestCycle, ContentType } from '../types/index.js';
|
|
2
2
|
/**
|
|
3
3
|
* Validate TDD cycles for completeness
|
|
4
4
|
*
|
|
@@ -50,6 +50,55 @@ export declare function deriveIndividualPassFailFromPerspectives(issues: ReviewI
|
|
|
50
50
|
* @returns Array of source file paths that have changed, or ['unknown'] if git fails
|
|
51
51
|
*/
|
|
52
52
|
export declare function getSourceCodeChanges(workingDir: string): string[];
|
|
53
|
+
/**
|
|
54
|
+
* Get configuration file changes from git diff
|
|
55
|
+
*
|
|
56
|
+
* Detects changes to configuration files including:
|
|
57
|
+
* - .claude/ directory (Agent SDK skills, CLAUDE.md)
|
|
58
|
+
* - .github/ directory (workflows, actions, issue templates)
|
|
59
|
+
* - Root config files (tsconfig.json, package.json, .gitignore, vitest.config.ts, etc.)
|
|
60
|
+
*
|
|
61
|
+
* Uses spawnSync for security (prevents command injection).
|
|
62
|
+
*
|
|
63
|
+
* @param workingDir - Working directory to run git diff in
|
|
64
|
+
* @returns Array of configuration file paths that have changed, or ['unknown'] if git fails
|
|
65
|
+
*/
|
|
66
|
+
export declare function getConfigurationChanges(workingDir: string): string[];
|
|
67
|
+
/**
|
|
68
|
+
* Get documentation file changes from git diff
|
|
69
|
+
*
|
|
70
|
+
* Detects changes to documentation files including:
|
|
71
|
+
* - Markdown files (.md) anywhere in the project (excluding story files)
|
|
72
|
+
* - docs/ directory (any file type)
|
|
73
|
+
*
|
|
74
|
+
* Uses spawnSync for security (prevents command injection).
|
|
75
|
+
*
|
|
76
|
+
* @param workingDir - Working directory to run git diff in
|
|
77
|
+
* @returns Array of documentation file paths that have changed, or ['unknown'] if git fails
|
|
78
|
+
*/
|
|
79
|
+
export declare function getDocumentationChanges(workingDir: string): string[];
|
|
80
|
+
/**
|
|
81
|
+
* Determine the effective content type for validation
|
|
82
|
+
*
|
|
83
|
+
* Resolves the final content type based on story frontmatter fields:
|
|
84
|
+
* 1. If requires_source_changes === false, treat as 'configuration'
|
|
85
|
+
* 2. If requires_source_changes === true, treat as 'code'
|
|
86
|
+
* 3. Otherwise, use content_type field (default: 'code' for backward compatibility)
|
|
87
|
+
*
|
|
88
|
+
* @param story - Story with frontmatter to analyze
|
|
89
|
+
* @returns The effective content type to use for validation
|
|
90
|
+
*/
|
|
91
|
+
export declare function determineEffectiveContentType(story: Story): ContentType;
|
|
92
|
+
/**
|
|
93
|
+
* Check if test files exist in git diff
|
|
94
|
+
*
|
|
95
|
+
* Returns true if any test files have been modified/added, false otherwise.
|
|
96
|
+
* Uses spawnSync for security (prevents command injection).
|
|
97
|
+
*
|
|
98
|
+
* @param workingDir - Working directory to run git diff in
|
|
99
|
+
* @returns True if test files exist in changes, false otherwise
|
|
100
|
+
*/
|
|
101
|
+
export declare function hasTestFiles(workingDir: string): boolean;
|
|
53
102
|
/**
|
|
54
103
|
* Generate executive summary from review issues (1-3 sentences)
|
|
55
104
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"review.d.ts","sourceRoot":"","sources":["../../src/agents/review.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"review.d.ts","sourceRoot":"","sources":["../../src/agents/review.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,YAAY,EAAE,WAAW,EAA8E,YAAY,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAqHzL;;;;;;;;GAQG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,YAAY,EAAE,GAAG,MAAM,EAAE,CA0BlE;AAED;;;;;;;;GAQG;AACH,wBAAgB,iBAAiB,CAAC,UAAU,EAAE,MAAM,EAAE,GAAG,WAAW,EAAE,CAOrE;AAiBD;;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;AAyZrJ;;;;;;;;;;;GAWG;AACH,wBAAgB,wCAAwC,CAAC,MAAM,EAAE,WAAW,EAAE,GAAG;IAC/E,gBAAgB,EAAE,OAAO,CAAC;IAC1B,oBAAoB,EAAE,OAAO,CAAC;IAC9B,cAAc,EAAE,OAAO,CAAC;CACzB,CAsBA;AAsED;;;;;;;;GAQG;AACH,wBAAgB,oBAAoB,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,EAAE,CA2BjE;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,uBAAuB,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,EAAE,CAqDpE;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,uBAAuB,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,EAAE,CAgCpE;AAED;;;;;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