@litmers/cursorflow-orchestrator 0.1.30 → 0.1.34
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 +144 -52
- package/commands/cursorflow-add.md +159 -0
- package/commands/cursorflow-monitor.md +23 -2
- package/commands/cursorflow-new.md +87 -0
- package/dist/cli/add.d.ts +7 -0
- package/dist/cli/add.js +377 -0
- package/dist/cli/add.js.map +1 -0
- package/dist/cli/clean.js +1 -0
- package/dist/cli/clean.js.map +1 -1
- package/dist/cli/config.d.ts +7 -0
- package/dist/cli/config.js +181 -0
- package/dist/cli/config.js.map +1 -0
- package/dist/cli/index.js +34 -30
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/logs.js +7 -33
- package/dist/cli/logs.js.map +1 -1
- package/dist/cli/monitor.js +51 -62
- package/dist/cli/monitor.js.map +1 -1
- package/dist/cli/new.d.ts +7 -0
- package/dist/cli/new.js +232 -0
- package/dist/cli/new.js.map +1 -0
- package/dist/cli/prepare.js +95 -193
- package/dist/cli/prepare.js.map +1 -1
- package/dist/cli/resume.js +11 -47
- package/dist/cli/resume.js.map +1 -1
- package/dist/cli/run.js +27 -22
- package/dist/cli/run.js.map +1 -1
- package/dist/cli/tasks.js +1 -2
- package/dist/cli/tasks.js.map +1 -1
- package/dist/core/failure-policy.d.ts +9 -0
- package/dist/core/failure-policy.js +9 -0
- package/dist/core/failure-policy.js.map +1 -1
- package/dist/core/orchestrator.d.ts +20 -6
- package/dist/core/orchestrator.js +217 -331
- package/dist/core/orchestrator.js.map +1 -1
- package/dist/core/runner/agent.d.ts +27 -0
- package/dist/core/runner/agent.js +294 -0
- package/dist/core/runner/agent.js.map +1 -0
- package/dist/core/runner/index.d.ts +5 -0
- package/dist/core/runner/index.js +22 -0
- package/dist/core/runner/index.js.map +1 -0
- package/dist/core/runner/pipeline.d.ts +9 -0
- package/dist/core/runner/pipeline.js +539 -0
- package/dist/core/runner/pipeline.js.map +1 -0
- package/dist/core/runner/prompt.d.ts +25 -0
- package/dist/core/runner/prompt.js +175 -0
- package/dist/core/runner/prompt.js.map +1 -0
- package/dist/core/runner/task.d.ts +26 -0
- package/dist/core/runner/task.js +283 -0
- package/dist/core/runner/task.js.map +1 -0
- package/dist/core/runner/utils.d.ts +37 -0
- package/dist/core/runner/utils.js +161 -0
- package/dist/core/runner/utils.js.map +1 -0
- package/dist/core/runner.d.ts +2 -96
- package/dist/core/runner.js +11 -1136
- package/dist/core/runner.js.map +1 -1
- package/dist/core/stall-detection.d.ts +326 -0
- package/dist/core/stall-detection.js +781 -0
- package/dist/core/stall-detection.js.map +1 -0
- package/dist/types/config.d.ts +6 -6
- package/dist/types/flow.d.ts +84 -0
- package/dist/types/flow.js +10 -0
- package/dist/types/flow.js.map +1 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.js +3 -3
- package/dist/types/index.js.map +1 -1
- package/dist/types/lane.d.ts +0 -2
- package/dist/types/logging.d.ts +5 -1
- package/dist/types/task.d.ts +7 -11
- package/dist/utils/config.js +7 -15
- package/dist/utils/config.js.map +1 -1
- package/dist/utils/dependency.d.ts +36 -1
- package/dist/utils/dependency.js +256 -1
- package/dist/utils/dependency.js.map +1 -1
- package/dist/utils/enhanced-logger.d.ts +45 -82
- package/dist/utils/enhanced-logger.js +238 -844
- package/dist/utils/enhanced-logger.js.map +1 -1
- package/dist/utils/git.d.ts +29 -0
- package/dist/utils/git.js +115 -5
- package/dist/utils/git.js.map +1 -1
- package/dist/utils/state.js +0 -2
- package/dist/utils/state.js.map +1 -1
- package/dist/utils/task-service.d.ts +2 -2
- package/dist/utils/task-service.js +40 -31
- package/dist/utils/task-service.js.map +1 -1
- package/package.json +4 -3
- package/src/cli/add.ts +397 -0
- package/src/cli/clean.ts +1 -0
- package/src/cli/config.ts +177 -0
- package/src/cli/index.ts +36 -32
- package/src/cli/logs.ts +7 -31
- package/src/cli/monitor.ts +55 -71
- package/src/cli/new.ts +235 -0
- package/src/cli/prepare.ts +98 -205
- package/src/cli/resume.ts +13 -56
- package/src/cli/run.ts +311 -306
- package/src/cli/tasks.ts +1 -2
- package/src/core/failure-policy.ts +9 -0
- package/src/core/orchestrator.ts +281 -375
- package/src/core/runner/agent.ts +314 -0
- package/src/core/runner/index.ts +6 -0
- package/src/core/runner/pipeline.ts +567 -0
- package/src/core/runner/prompt.ts +174 -0
- package/src/core/runner/task.ts +320 -0
- package/src/core/runner/utils.ts +142 -0
- package/src/core/runner.ts +8 -1347
- package/src/core/stall-detection.ts +936 -0
- package/src/types/config.ts +6 -6
- package/src/types/flow.ts +91 -0
- package/src/types/index.ts +15 -3
- package/src/types/lane.ts +0 -2
- package/src/types/logging.ts +5 -1
- package/src/types/task.ts +7 -11
- package/src/utils/config.ts +8 -16
- package/src/utils/dependency.ts +311 -2
- package/src/utils/enhanced-logger.ts +263 -927
- package/src/utils/git.ts +145 -5
- package/src/utils/state.ts +0 -2
- package/src/utils/task-service.ts +48 -40
- package/commands/cursorflow-review.md +0 -56
- package/commands/cursorflow-runs.md +0 -59
- package/dist/cli/runs.d.ts +0 -5
- package/dist/cli/runs.js +0 -214
- package/dist/cli/runs.js.map +0 -1
- package/dist/core/reviewer.d.ts +0 -66
- package/dist/core/reviewer.js +0 -265
- package/dist/core/reviewer.js.map +0 -1
- package/src/cli/runs.ts +0 -212
- package/src/core/reviewer.ts +0 -285
package/dist/core/reviewer.d.ts
DELETED
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Reviewer - Code review agent
|
|
3
|
-
*
|
|
4
|
-
* Adapted from reviewer-agent.js
|
|
5
|
-
*/
|
|
6
|
-
import { ReviewResult, TaskResult, RunnerConfig, AgentSendResult } from '../utils/types';
|
|
7
|
-
/**
|
|
8
|
-
* Build review prompt
|
|
9
|
-
*/
|
|
10
|
-
export declare function buildReviewPrompt({ taskName, taskBranch, acceptanceCriteria }: {
|
|
11
|
-
taskName: string;
|
|
12
|
-
taskBranch: string;
|
|
13
|
-
acceptanceCriteria?: string[];
|
|
14
|
-
}): string;
|
|
15
|
-
/**
|
|
16
|
-
* Parse review result
|
|
17
|
-
*/
|
|
18
|
-
export declare function parseReviewResult(text: string): ReviewResult;
|
|
19
|
-
/**
|
|
20
|
-
* Build feedback prompt
|
|
21
|
-
*/
|
|
22
|
-
export declare function buildFeedbackPrompt(review: ReviewResult): string;
|
|
23
|
-
/**
|
|
24
|
-
* Review task
|
|
25
|
-
*/
|
|
26
|
-
export declare function reviewTask({ taskResult, worktreeDir, runDir, config, model, cursorAgentSend, cursorAgentCreateChat }: {
|
|
27
|
-
taskResult: TaskResult;
|
|
28
|
-
worktreeDir: string;
|
|
29
|
-
runDir: string;
|
|
30
|
-
config: RunnerConfig;
|
|
31
|
-
model?: string;
|
|
32
|
-
cursorAgentSend: (options: {
|
|
33
|
-
workspaceDir: string;
|
|
34
|
-
chatId: string;
|
|
35
|
-
prompt: string;
|
|
36
|
-
model?: string;
|
|
37
|
-
outputFormat?: 'stream-json' | 'json' | 'plain';
|
|
38
|
-
taskName?: string;
|
|
39
|
-
}) => Promise<AgentSendResult>;
|
|
40
|
-
cursorAgentCreateChat: () => string;
|
|
41
|
-
}): Promise<ReviewResult>;
|
|
42
|
-
/**
|
|
43
|
-
* Review loop with feedback
|
|
44
|
-
*/
|
|
45
|
-
export declare function runReviewLoop({ taskResult, worktreeDir, runDir, config, workChatId, model, cursorAgentSend, cursorAgentCreateChat }: {
|
|
46
|
-
taskResult: TaskResult;
|
|
47
|
-
worktreeDir: string;
|
|
48
|
-
runDir: string;
|
|
49
|
-
config: RunnerConfig;
|
|
50
|
-
workChatId: string;
|
|
51
|
-
model?: string;
|
|
52
|
-
cursorAgentSend: (options: {
|
|
53
|
-
workspaceDir: string;
|
|
54
|
-
chatId: string;
|
|
55
|
-
prompt: string;
|
|
56
|
-
model?: string;
|
|
57
|
-
outputFormat?: 'stream-json' | 'json' | 'plain';
|
|
58
|
-
taskName?: string;
|
|
59
|
-
}) => Promise<AgentSendResult>;
|
|
60
|
-
cursorAgentCreateChat: () => string;
|
|
61
|
-
}): Promise<{
|
|
62
|
-
approved: boolean;
|
|
63
|
-
review: ReviewResult;
|
|
64
|
-
iterations: number;
|
|
65
|
-
error?: string;
|
|
66
|
-
}>;
|
package/dist/core/reviewer.js
DELETED
|
@@ -1,265 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Reviewer - Code review agent
|
|
4
|
-
*
|
|
5
|
-
* Adapted from reviewer-agent.js
|
|
6
|
-
*/
|
|
7
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
8
|
-
if (k2 === undefined) k2 = k;
|
|
9
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
10
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
11
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
12
|
-
}
|
|
13
|
-
Object.defineProperty(o, k2, desc);
|
|
14
|
-
}) : (function(o, m, k, k2) {
|
|
15
|
-
if (k2 === undefined) k2 = k;
|
|
16
|
-
o[k2] = m[k];
|
|
17
|
-
}));
|
|
18
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
19
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
20
|
-
}) : function(o, v) {
|
|
21
|
-
o["default"] = v;
|
|
22
|
-
});
|
|
23
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
24
|
-
var ownKeys = function(o) {
|
|
25
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
26
|
-
var ar = [];
|
|
27
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
28
|
-
return ar;
|
|
29
|
-
};
|
|
30
|
-
return ownKeys(o);
|
|
31
|
-
};
|
|
32
|
-
return function (mod) {
|
|
33
|
-
if (mod && mod.__esModule) return mod;
|
|
34
|
-
var result = {};
|
|
35
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
36
|
-
__setModuleDefault(result, mod);
|
|
37
|
-
return result;
|
|
38
|
-
};
|
|
39
|
-
})();
|
|
40
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
41
|
-
exports.buildReviewPrompt = buildReviewPrompt;
|
|
42
|
-
exports.parseReviewResult = parseReviewResult;
|
|
43
|
-
exports.buildFeedbackPrompt = buildFeedbackPrompt;
|
|
44
|
-
exports.reviewTask = reviewTask;
|
|
45
|
-
exports.runReviewLoop = runReviewLoop;
|
|
46
|
-
const logger = __importStar(require("../utils/logger"));
|
|
47
|
-
const state_1 = require("../utils/state");
|
|
48
|
-
const path = __importStar(require("path"));
|
|
49
|
-
const events_1 = require("../utils/events");
|
|
50
|
-
/**
|
|
51
|
-
* Build review prompt
|
|
52
|
-
*/
|
|
53
|
-
function buildReviewPrompt({ taskName, taskBranch, acceptanceCriteria = [] }) {
|
|
54
|
-
const criteriaList = acceptanceCriteria.length > 0
|
|
55
|
-
? acceptanceCriteria.map((c, i) => `${i + 1}. ${c}`).join('\n')
|
|
56
|
-
: 'Work should be completed properly.';
|
|
57
|
-
return `# Code Review: ${taskName}
|
|
58
|
-
|
|
59
|
-
## Role
|
|
60
|
-
You are a senior code reviewer. Please review the results of this task.
|
|
61
|
-
|
|
62
|
-
## Task Details
|
|
63
|
-
- Name: ${taskName}
|
|
64
|
-
- Branch: ${taskBranch}
|
|
65
|
-
|
|
66
|
-
## Acceptance Criteria
|
|
67
|
-
${criteriaList}
|
|
68
|
-
|
|
69
|
-
## Review Checklist
|
|
70
|
-
1. **Build Success**: Does \`pnpm build\` complete without errors?
|
|
71
|
-
2. **Code Quality**: Are there no linting or TypeScript type errors?
|
|
72
|
-
3. **Completeness**: Are all acceptance criteria met?
|
|
73
|
-
4. **Bugs**: Are there any obvious bugs or logic errors?
|
|
74
|
-
5. **Commit Status**: Are changes properly committed and pushed?
|
|
75
|
-
|
|
76
|
-
## Output Format (MUST follow exactly)
|
|
77
|
-
\`\`\`json
|
|
78
|
-
{
|
|
79
|
-
"status": "approved" | "needs_changes",
|
|
80
|
-
"buildSuccess": true | false,
|
|
81
|
-
"issues": [
|
|
82
|
-
{
|
|
83
|
-
"severity": "critical" | "major" | "minor",
|
|
84
|
-
"description": "...",
|
|
85
|
-
"file": "...",
|
|
86
|
-
"suggestion": "..."
|
|
87
|
-
}
|
|
88
|
-
],
|
|
89
|
-
"suggestions": ["..."],
|
|
90
|
-
"summary": "One-line summary"
|
|
91
|
-
}
|
|
92
|
-
\`\`\`
|
|
93
|
-
|
|
94
|
-
IMPORTANT: You MUST respond in the exact JSON format above. "status" must be either "approved" or "needs_changes".
|
|
95
|
-
`;
|
|
96
|
-
}
|
|
97
|
-
/**
|
|
98
|
-
* Parse review result
|
|
99
|
-
*/
|
|
100
|
-
function parseReviewResult(text) {
|
|
101
|
-
const t = String(text || '');
|
|
102
|
-
// Try JSON block
|
|
103
|
-
const jsonMatch = t.match(/```json\n([\s\S]*?)\n```/);
|
|
104
|
-
if (jsonMatch) {
|
|
105
|
-
try {
|
|
106
|
-
const parsed = JSON.parse(jsonMatch[1]);
|
|
107
|
-
return {
|
|
108
|
-
status: parsed.status || 'needs_changes',
|
|
109
|
-
buildSuccess: parsed.buildSuccess !== false,
|
|
110
|
-
issues: Array.isArray(parsed.issues) ? parsed.issues : [],
|
|
111
|
-
suggestions: Array.isArray(parsed.suggestions) ? parsed.suggestions : [],
|
|
112
|
-
summary: parsed.summary || '',
|
|
113
|
-
raw: t,
|
|
114
|
-
};
|
|
115
|
-
}
|
|
116
|
-
catch (err) {
|
|
117
|
-
logger.warn(`JSON parse failed: ${err.message}`);
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
// Fallback parsing
|
|
121
|
-
const hasApproved = t.toLowerCase().includes('approved');
|
|
122
|
-
const hasIssues = t.toLowerCase().includes('needs_changes') ||
|
|
123
|
-
t.toLowerCase().includes('error') ||
|
|
124
|
-
t.toLowerCase().includes('failed');
|
|
125
|
-
return {
|
|
126
|
-
status: hasApproved && !hasIssues ? 'approved' : 'needs_changes',
|
|
127
|
-
buildSuccess: !t.toLowerCase().includes('build') || !t.toLowerCase().includes('fail'),
|
|
128
|
-
issues: hasIssues ? [{ severity: 'major', description: 'Parse failed, see logs' }] : [],
|
|
129
|
-
suggestions: [],
|
|
130
|
-
summary: 'Auto-parsed - check original response',
|
|
131
|
-
raw: t,
|
|
132
|
-
};
|
|
133
|
-
}
|
|
134
|
-
/**
|
|
135
|
-
* Build feedback prompt
|
|
136
|
-
*/
|
|
137
|
-
function buildFeedbackPrompt(review) {
|
|
138
|
-
const lines = [];
|
|
139
|
-
lines.push('# Code Review Feedback');
|
|
140
|
-
lines.push('');
|
|
141
|
-
lines.push('The reviewer found the following issues. Please fix them:');
|
|
142
|
-
lines.push('');
|
|
143
|
-
if (!review.buildSuccess) {
|
|
144
|
-
lines.push('## CRITICAL: Build Failed');
|
|
145
|
-
lines.push('- \`pnpm build\` failed. Fix build errors first.');
|
|
146
|
-
lines.push('');
|
|
147
|
-
}
|
|
148
|
-
for (const issue of review.issues || []) {
|
|
149
|
-
const severity = (issue.severity || 'major').toUpperCase();
|
|
150
|
-
lines.push(`## ${severity}: ${issue.description}`);
|
|
151
|
-
if (issue.file)
|
|
152
|
-
lines.push(`- File: ${issue.file}`);
|
|
153
|
-
if (issue.suggestion)
|
|
154
|
-
lines.push(`- Suggestion: ${issue.suggestion}`);
|
|
155
|
-
lines.push('');
|
|
156
|
-
}
|
|
157
|
-
if (review.suggestions && review.suggestions.length > 0) {
|
|
158
|
-
lines.push('## Additional Suggestions');
|
|
159
|
-
for (const s of review.suggestions) {
|
|
160
|
-
lines.push(`- ${s}`);
|
|
161
|
-
}
|
|
162
|
-
lines.push('');
|
|
163
|
-
}
|
|
164
|
-
lines.push('## Requirements');
|
|
165
|
-
lines.push('1. Fix all issues listed above');
|
|
166
|
-
lines.push('2. Ensure \`pnpm build\` succeeds');
|
|
167
|
-
lines.push('3. Commit and push your changes');
|
|
168
|
-
lines.push('');
|
|
169
|
-
lines.push('**Let me know when fixes are complete.**');
|
|
170
|
-
return lines.join('\n');
|
|
171
|
-
}
|
|
172
|
-
/**
|
|
173
|
-
* Review task
|
|
174
|
-
*/
|
|
175
|
-
async function reviewTask({ taskResult, worktreeDir, runDir, config, model, cursorAgentSend, cursorAgentCreateChat }) {
|
|
176
|
-
const reviewPrompt = buildReviewPrompt({
|
|
177
|
-
taskName: taskResult.taskName,
|
|
178
|
-
taskBranch: taskResult.taskBranch,
|
|
179
|
-
acceptanceCriteria: taskResult.acceptanceCriteria || config.acceptanceCriteria || [],
|
|
180
|
-
});
|
|
181
|
-
logger.info(`Reviewing: ${taskResult.taskName}`);
|
|
182
|
-
events_1.events.emit('review.started', {
|
|
183
|
-
taskName: taskResult.taskName,
|
|
184
|
-
taskBranch: taskResult.taskBranch,
|
|
185
|
-
});
|
|
186
|
-
const reviewChatId = cursorAgentCreateChat();
|
|
187
|
-
const reviewModel = model || config.reviewModel || config.model || 'sonnet-4.5';
|
|
188
|
-
const reviewResult = await cursorAgentSend({
|
|
189
|
-
workspaceDir: worktreeDir,
|
|
190
|
-
chatId: reviewChatId,
|
|
191
|
-
prompt: reviewPrompt,
|
|
192
|
-
model: reviewModel,
|
|
193
|
-
outputFormat: config.agentOutputFormat,
|
|
194
|
-
taskName: `review:${taskResult.taskName}`,
|
|
195
|
-
});
|
|
196
|
-
const review = parseReviewResult(reviewResult.resultText || '');
|
|
197
|
-
// Log review
|
|
198
|
-
const convoPath = path.join(runDir, 'conversation.jsonl');
|
|
199
|
-
(0, state_1.appendLog)(convoPath, (0, state_1.createConversationEntry)('reviewer', reviewResult.resultText || 'No result', {
|
|
200
|
-
task: taskResult.taskName,
|
|
201
|
-
model: reviewModel,
|
|
202
|
-
}));
|
|
203
|
-
logger.info(`Review result: ${review.status} (${review.issues?.length || 0} issues)`);
|
|
204
|
-
events_1.events.emit('review.completed', {
|
|
205
|
-
taskName: taskResult.taskName,
|
|
206
|
-
status: review.status,
|
|
207
|
-
issueCount: review.issues?.length || 0,
|
|
208
|
-
summary: review.summary,
|
|
209
|
-
});
|
|
210
|
-
return review;
|
|
211
|
-
}
|
|
212
|
-
/**
|
|
213
|
-
* Review loop with feedback
|
|
214
|
-
*/
|
|
215
|
-
async function runReviewLoop({ taskResult, worktreeDir, runDir, config, workChatId, model, cursorAgentSend, cursorAgentCreateChat }) {
|
|
216
|
-
const maxIterations = config.maxReviewIterations || 3;
|
|
217
|
-
let iteration = 0;
|
|
218
|
-
let currentReview = null;
|
|
219
|
-
while (iteration < maxIterations) {
|
|
220
|
-
currentReview = await reviewTask({
|
|
221
|
-
taskResult,
|
|
222
|
-
worktreeDir,
|
|
223
|
-
runDir,
|
|
224
|
-
config,
|
|
225
|
-
model,
|
|
226
|
-
cursorAgentSend,
|
|
227
|
-
cursorAgentCreateChat,
|
|
228
|
-
});
|
|
229
|
-
if (currentReview.status === 'approved') {
|
|
230
|
-
logger.success(`Review passed: ${taskResult.taskName} (iteration ${iteration + 1})`);
|
|
231
|
-
events_1.events.emit('review.approved', {
|
|
232
|
-
taskName: taskResult.taskName,
|
|
233
|
-
iterations: iteration + 1,
|
|
234
|
-
});
|
|
235
|
-
return { approved: true, review: currentReview, iterations: iteration + 1 };
|
|
236
|
-
}
|
|
237
|
-
iteration++;
|
|
238
|
-
if (iteration >= maxIterations) {
|
|
239
|
-
logger.warn(`Max review iterations (${maxIterations}) reached: ${taskResult.taskName}`);
|
|
240
|
-
events_1.events.emit('review.rejected', {
|
|
241
|
-
taskName: taskResult.taskName,
|
|
242
|
-
reason: 'Max iterations reached',
|
|
243
|
-
iterations: iteration,
|
|
244
|
-
});
|
|
245
|
-
break;
|
|
246
|
-
}
|
|
247
|
-
// Send feedback
|
|
248
|
-
logger.info(`Sending feedback (iteration ${iteration}/${maxIterations})`);
|
|
249
|
-
const feedbackPrompt = buildFeedbackPrompt(currentReview);
|
|
250
|
-
const fixResult = await cursorAgentSend({
|
|
251
|
-
workspaceDir: worktreeDir,
|
|
252
|
-
chatId: workChatId,
|
|
253
|
-
prompt: feedbackPrompt,
|
|
254
|
-
model: config.model,
|
|
255
|
-
outputFormat: config.agentOutputFormat,
|
|
256
|
-
taskName: taskResult.taskName,
|
|
257
|
-
});
|
|
258
|
-
if (!fixResult.ok) {
|
|
259
|
-
logger.error(`Feedback application failed: ${fixResult.error}`);
|
|
260
|
-
return { approved: false, review: currentReview, iterations: iteration, error: fixResult.error };
|
|
261
|
-
}
|
|
262
|
-
}
|
|
263
|
-
return { approved: false, review: currentReview, iterations: iteration };
|
|
264
|
-
}
|
|
265
|
-
//# sourceMappingURL=reviewer.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"reviewer.js","sourceRoot":"","sources":["../../src/core/reviewer.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAWH,8CA4CC;AAKD,8CAmCC;AAKD,kDAqCC;AAKD,gCA4DC;AAKD,sCAyEC;AAtRD,wDAA0C;AAC1C,0CAAoE;AACpE,2CAA6B;AAE7B,4CAAyC;AAEzC;;GAEG;AACH,SAAgB,iBAAiB,CAAC,EAAE,QAAQ,EAAE,UAAU,EAAE,kBAAkB,GAAG,EAAE,EAA2E;IAC1J,MAAM,YAAY,GAAG,kBAAkB,CAAC,MAAM,GAAG,CAAC;QAChD,CAAC,CAAC,kBAAkB,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC;QAC/D,CAAC,CAAC,oCAAoC,CAAC;IAEzC,OAAO,kBAAkB,QAAQ;;;;;;UAMzB,QAAQ;YACN,UAAU;;;EAGpB,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4Bb,CAAC;A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AE,CAAC,CAAC;YACxF,eAAM,CAAC,IAAI,CAAC,iBAAiB,EAAE;gBAC7B,QAAQ,EAAE,UAAU,CAAC,QAAQ;gBAC7B,MAAM,EAAE,wBAAwB;gBAChC,UAAU,EAAE,SAAS;aACtB,CAAC,CAAC;YACH,MAAM;QACR,CAAC;QAED,gBAAgB;QAChB,MAAM,CAAC,IAAI,CAAC,+BAA+B,SAAS,IAAI,aAAa,GAAG,CAAC,CAAC;QAC1E,MAAM,cAAc,GAAG,mBAAmB,CAAC,aAAa,CAAC,CAAC;QAE1D,MAAM,SAAS,GAAG,MAAM,eAAe,CAAC;YACtC,YAAY,EAAE,WAAW;YACzB,MAAM,EAAE,UAAU;YAClB,MAAM,EAAE,cAAc;YACtB,KAAK,EAAE,MAAM,CAAC,KAAK;YACnB,YAAY,EAAE,MAAM,CAAC,iBAAiB;YACtC,QAAQ,EAAE,UAAU,CAAC,QAAQ;SAC9B,CAAC,CAAC;QAEH,IAAI,CAAC,SAAS,CAAC,EAAE,EAAE,CAAC;YAClB,MAAM,CAAC,KAAK,CAAC,gCAAgC,SAAS,CAAC,KAAK,EAAE,CAAC,CAAC;YAChE,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,EAAE,aAAa,EAAE,UAAU,EAAE,SAAS,EAAE,KAAK,EAAE,SAAS,CAAC,KAAK,EAAE,CAAC;QACnG,CAAC;IACH,CAAC;IAED,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,EAAE,aAAc,EAAE,UAAU,EAAE,SAAS,EAAE,CAAC;AAC5E,CAAC"}
|
package/src/cli/runs.ts
DELETED
|
@@ -1,212 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* CursorFlow runs command - List and view run details
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
import * as fs from 'fs';
|
|
6
|
-
import * as path from 'path';
|
|
7
|
-
import * as logger from '../utils/logger';
|
|
8
|
-
import { loadConfig, getLogsDir } from '../utils/config';
|
|
9
|
-
import { RunService } from '../utils/run-service';
|
|
10
|
-
import { RunStatus, RunInfo } from '../utils/types';
|
|
11
|
-
import { safeJoin } from '../utils/path';
|
|
12
|
-
|
|
13
|
-
interface RunsOptions {
|
|
14
|
-
status?: RunStatus;
|
|
15
|
-
json: boolean;
|
|
16
|
-
help: boolean;
|
|
17
|
-
runId?: string;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
function printHelp(): void {
|
|
21
|
-
console.log(`
|
|
22
|
-
Usage: cursorflow runs [run-id] [options]
|
|
23
|
-
|
|
24
|
-
List all runs or view details of a specific run.
|
|
25
|
-
|
|
26
|
-
Options:
|
|
27
|
-
[run-id] View details of a specific run
|
|
28
|
-
--running Filter to show only running runs
|
|
29
|
-
--status <status> Filter by status: running, completed, failed, partial, pending
|
|
30
|
-
--json Output in JSON format
|
|
31
|
-
--help, -h Show help
|
|
32
|
-
|
|
33
|
-
Examples:
|
|
34
|
-
cursorflow runs # List all runs
|
|
35
|
-
cursorflow runs --running # List only running runs
|
|
36
|
-
cursorflow runs run-123 # View details of run-123
|
|
37
|
-
`);
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
function parseArgs(args: string[]): RunsOptions {
|
|
41
|
-
const statusIdx = args.indexOf('--status');
|
|
42
|
-
const running = args.includes('--running');
|
|
43
|
-
|
|
44
|
-
// Find run ID (first non-option argument)
|
|
45
|
-
const runId = args.find((arg, i) => {
|
|
46
|
-
if (arg.startsWith('--') || arg.startsWith('-')) return false;
|
|
47
|
-
// Skip values for options
|
|
48
|
-
const prevArg = args[i - 1];
|
|
49
|
-
if (prevArg && ['--status'].includes(prevArg)) {
|
|
50
|
-
return false;
|
|
51
|
-
}
|
|
52
|
-
return true;
|
|
53
|
-
});
|
|
54
|
-
|
|
55
|
-
return {
|
|
56
|
-
runId,
|
|
57
|
-
status: running ? 'running' : (statusIdx >= 0 ? args[statusIdx + 1] as RunStatus : undefined),
|
|
58
|
-
json: args.includes('--json'),
|
|
59
|
-
help: args.includes('--help') || args.includes('-h'),
|
|
60
|
-
};
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
/**
|
|
64
|
-
* Format duration in a human-readable way
|
|
65
|
-
*/
|
|
66
|
-
function formatDuration(ms: number): string {
|
|
67
|
-
if (ms < 1000) return `${ms}ms`;
|
|
68
|
-
const seconds = Math.floor(ms / 1000);
|
|
69
|
-
if (seconds < 60) return `${seconds}s`;
|
|
70
|
-
const minutes = Math.floor(seconds / 60);
|
|
71
|
-
const remainingSeconds = seconds % 60;
|
|
72
|
-
if (minutes < 60) return `${minutes}m ${remainingSeconds}s`;
|
|
73
|
-
const hours = Math.floor(minutes / 60);
|
|
74
|
-
const remainingMinutes = minutes % 60;
|
|
75
|
-
return `${hours}h ${remainingMinutes}m`;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
/**
|
|
79
|
-
* Get status color and emoji
|
|
80
|
-
*/
|
|
81
|
-
function getStatusDisplay(status: RunStatus): string {
|
|
82
|
-
switch (status) {
|
|
83
|
-
case 'running':
|
|
84
|
-
return `${logger.COLORS.blue}🔄 running${logger.COLORS.reset}`;
|
|
85
|
-
case 'completed':
|
|
86
|
-
return `${logger.COLORS.green}✅ done ${logger.COLORS.reset}`;
|
|
87
|
-
case 'failed':
|
|
88
|
-
return `${logger.COLORS.red}❌ failed ${logger.COLORS.reset}`;
|
|
89
|
-
case 'partial':
|
|
90
|
-
return `${logger.COLORS.yellow}⚠️ partial${logger.COLORS.reset}`;
|
|
91
|
-
case 'pending':
|
|
92
|
-
return `${logger.COLORS.gray}⏳ pending${logger.COLORS.reset}`;
|
|
93
|
-
default:
|
|
94
|
-
return status;
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
/**
|
|
99
|
-
* Display list of runs
|
|
100
|
-
*/
|
|
101
|
-
function displayRunList(runs: RunInfo[]): void {
|
|
102
|
-
if (runs.length === 0) {
|
|
103
|
-
console.log('No runs found.');
|
|
104
|
-
return;
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
console.log(` Run ID Task Status Lanes Duration`);
|
|
108
|
-
console.log(`${logger.COLORS.cyan}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${logger.COLORS.reset}`);
|
|
109
|
-
|
|
110
|
-
for (const run of runs) {
|
|
111
|
-
const isRunning = run.status === 'running';
|
|
112
|
-
const prefix = isRunning ? `${logger.COLORS.blue} ▶${logger.COLORS.reset}` : ' ';
|
|
113
|
-
|
|
114
|
-
const id = run.id.padEnd(20);
|
|
115
|
-
const task = (run.taskName || 'unnamed').substring(0, 15).padEnd(15);
|
|
116
|
-
const status = getStatusDisplay(run.status);
|
|
117
|
-
|
|
118
|
-
const completedLanes = run.lanes.filter(l => l.status === 'completed').length;
|
|
119
|
-
const totalLanes = run.lanes.length;
|
|
120
|
-
const lanes = `${completedLanes}/${totalLanes}`.padEnd(10);
|
|
121
|
-
|
|
122
|
-
const duration = formatDuration(run.duration);
|
|
123
|
-
|
|
124
|
-
console.log(`${prefix} ${id} ${task} ${status} ${lanes} ${duration}`);
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
/**
|
|
129
|
-
* Display detailed information for a single run
|
|
130
|
-
*/
|
|
131
|
-
function displayRunDetail(run: RunInfo): void {
|
|
132
|
-
logger.section(`Run Details: ${run.id}`);
|
|
133
|
-
|
|
134
|
-
console.log(`${logger.COLORS.bold}Task:${logger.COLORS.reset} ${run.taskName}`);
|
|
135
|
-
console.log(`${logger.COLORS.bold}Status:${logger.COLORS.reset} ${getStatusDisplay(run.status)}`);
|
|
136
|
-
console.log(`${logger.COLORS.bold}Start Time:${logger.COLORS.reset} ${new Date(run.startTime).toLocaleString()}`);
|
|
137
|
-
console.log(`${logger.COLORS.bold}Duration:${logger.COLORS.reset} ${formatDuration(run.duration)}`);
|
|
138
|
-
console.log(`${logger.COLORS.bold}Path:${logger.COLORS.reset} ${run.path}`);
|
|
139
|
-
|
|
140
|
-
console.log(`\n${logger.COLORS.bold}Lanes:${logger.COLORS.reset}`);
|
|
141
|
-
for (const lane of run.lanes) {
|
|
142
|
-
const statusColor = lane.status === 'completed' ? logger.COLORS.green :
|
|
143
|
-
lane.status === 'failed' ? logger.COLORS.red :
|
|
144
|
-
lane.status === 'running' ? logger.COLORS.blue : logger.COLORS.reset;
|
|
145
|
-
|
|
146
|
-
console.log(` - ${lane.name.padEnd(20)} [${statusColor}${lane.status.toUpperCase()}${logger.COLORS.reset}] Task ${lane.currentTask}/${lane.totalTasks} (PID: ${lane.pid || 'N/A'})`);
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
if (run.branches.length > 0) {
|
|
150
|
-
console.log(`\n${logger.COLORS.bold}Branches:${logger.COLORS.reset}`);
|
|
151
|
-
for (const branch of run.branches) {
|
|
152
|
-
console.log(` - ${branch}`);
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
if (run.worktrees.length > 0) {
|
|
157
|
-
console.log(`\n${logger.COLORS.bold}Worktrees:${logger.COLORS.reset}`);
|
|
158
|
-
for (const wt of run.worktrees) {
|
|
159
|
-
console.log(` - ${wt}`);
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
console.log(`\nView logs: ${logger.COLORS.cyan}cursorflow logs ${run.id} --all${logger.COLORS.reset}`);
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
async function runs(args: string[]): Promise<void> {
|
|
167
|
-
const options = parseArgs(args);
|
|
168
|
-
|
|
169
|
-
if (options.help) {
|
|
170
|
-
printHelp();
|
|
171
|
-
return;
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
const config = loadConfig();
|
|
175
|
-
const logsDir = getLogsDir(config);
|
|
176
|
-
const runsDir = safeJoin(logsDir, 'runs');
|
|
177
|
-
|
|
178
|
-
if (!fs.existsSync(runsDir)) {
|
|
179
|
-
if (options.json) {
|
|
180
|
-
console.log('[]');
|
|
181
|
-
} else {
|
|
182
|
-
console.log('No runs found. (Runs directory does not exist)');
|
|
183
|
-
}
|
|
184
|
-
return;
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
const runService = new RunService(runsDir);
|
|
188
|
-
|
|
189
|
-
if (options.runId) {
|
|
190
|
-
const run = runService.getRunInfo(options.runId);
|
|
191
|
-
if (!run) {
|
|
192
|
-
throw new Error(`Run not found: ${options.runId}`);
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
if (options.json) {
|
|
196
|
-
console.log(JSON.stringify(run, null, 2));
|
|
197
|
-
} else {
|
|
198
|
-
displayRunDetail(run);
|
|
199
|
-
}
|
|
200
|
-
return;
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
const runsList = runService.listRuns({ status: options.status });
|
|
204
|
-
|
|
205
|
-
if (options.json) {
|
|
206
|
-
console.log(JSON.stringify(runsList, null, 2));
|
|
207
|
-
} else {
|
|
208
|
-
displayRunList(runsList);
|
|
209
|
-
}
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
export = runs;
|