@caseyharalson/orrery 0.7.1 → 0.7.2
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.
|
@@ -85,31 +85,23 @@ ${getFormatInstructions()}
|
|
|
85
85
|
- Complete each step fully before starting the next
|
|
86
86
|
- Output clean JSON to stdout—no extra text or markdown wrapping`;
|
|
87
87
|
|
|
88
|
-
const REVIEW_PROMPT = `You are a Review Agent.
|
|
88
|
+
const REVIEW_PROMPT = `You are a Review Agent. Review the completed plan step.
|
|
89
89
|
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
Step context:
|
|
93
|
-
{stepContext}
|
|
94
|
-
|
|
95
|
-
Modified files:
|
|
96
|
-
{files}
|
|
97
|
-
|
|
98
|
-
Diff:
|
|
99
|
-
{diff}
|
|
90
|
+
Plan file: {planFile}
|
|
91
|
+
Step to review: {stepIds}
|
|
100
92
|
|
|
101
|
-
##
|
|
93
|
+
## Workflow
|
|
102
94
|
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
95
|
+
1. Read the plan file to understand the step's description, requirements, and acceptance criteria
|
|
96
|
+
2. Run \`git diff\` to see all uncommitted changes
|
|
97
|
+
3. Read modified files for full context if needed
|
|
98
|
+
4. Evaluate if changes correctly implement the requirements
|
|
107
99
|
|
|
108
|
-
## Output Format (JSON
|
|
100
|
+
## Output Format (JSON)
|
|
109
101
|
|
|
110
102
|
{"status":"approved","summary":"..."}
|
|
111
103
|
OR
|
|
112
|
-
{"status":"
|
|
104
|
+
{"status":"needs_changes","feedback":[{"comment":"...","file":"...","severity":"blocking|suggestion"}]}`;
|
|
113
105
|
|
|
114
106
|
module.exports = {
|
|
115
107
|
// Agent configurations (keyed by agent name)
|
|
@@ -49,8 +49,7 @@ const {
|
|
|
49
49
|
commit,
|
|
50
50
|
createPullRequest,
|
|
51
51
|
deriveBranchName,
|
|
52
|
-
hasUncommittedChanges
|
|
53
|
-
getUncommittedDiff
|
|
52
|
+
hasUncommittedChanges
|
|
54
53
|
} = require("../utils/git");
|
|
55
54
|
|
|
56
55
|
const config = require("./config");
|
|
@@ -832,8 +831,6 @@ async function waitForAgentCompletion(
|
|
|
832
831
|
// Parse results from stdout
|
|
833
832
|
let parsedResults = parseAgentResults(result.stdout);
|
|
834
833
|
|
|
835
|
-
const planForReview = loadPlan(planFile);
|
|
836
|
-
|
|
837
834
|
// Build updates for each step
|
|
838
835
|
const updates = [];
|
|
839
836
|
const reports = [];
|
|
@@ -855,48 +852,19 @@ async function waitForAgentCompletion(
|
|
|
855
852
|
if (config.review.enabled && stepResult.status === "complete") {
|
|
856
853
|
const maxIterations = resolveReviewMaxIterations();
|
|
857
854
|
if (maxIterations > 0) {
|
|
858
|
-
const stepData =
|
|
859
|
-
(planForReview.steps || []).find((step) => step.id === stepId) ||
|
|
860
|
-
null;
|
|
861
|
-
const stepContext = stepData
|
|
862
|
-
? {
|
|
863
|
-
id: stepData.id,
|
|
864
|
-
description: stepData.description,
|
|
865
|
-
context: stepData.context,
|
|
866
|
-
requirements: stepData.requirements,
|
|
867
|
-
criteria: stepData.criteria,
|
|
868
|
-
files: stepData.files,
|
|
869
|
-
risk_notes: stepData.risk_notes
|
|
870
|
-
}
|
|
871
|
-
: `Step ${stepId} context not found.`;
|
|
872
|
-
|
|
873
855
|
let approved = false;
|
|
874
856
|
let currentResult = stepResult;
|
|
875
857
|
|
|
876
858
|
for (let iteration = 1; iteration <= maxIterations; iteration++) {
|
|
877
|
-
const files =
|
|
878
|
-
Array.isArray(currentResult.artifacts) &&
|
|
879
|
-
currentResult.artifacts.length > 0
|
|
880
|
-
? currentResult.artifacts
|
|
881
|
-
: stepData && Array.isArray(stepData.files)
|
|
882
|
-
? stepData.files
|
|
883
|
-
: [];
|
|
884
|
-
const diff = getUncommittedDiff(REPO_ROOT, files);
|
|
885
|
-
|
|
886
859
|
console.log(
|
|
887
860
|
`Review iteration ${iteration}/${maxIterations} for step ${stepId}`
|
|
888
861
|
);
|
|
889
862
|
const reviewResult = await invokeReviewAgent(
|
|
890
863
|
config,
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
diff,
|
|
864
|
+
tempPlanFile,
|
|
865
|
+
[stepId],
|
|
894
866
|
REPO_ROOT,
|
|
895
|
-
{
|
|
896
|
-
planFile,
|
|
897
|
-
stepId,
|
|
898
|
-
stepIds: [stepId]
|
|
899
|
-
}
|
|
867
|
+
{ stepId }
|
|
900
868
|
);
|
|
901
869
|
|
|
902
870
|
if (reviewResult.error) {
|
|
@@ -1,57 +1,13 @@
|
|
|
1
1
|
const { invokeAgentWithFailover } = require("./agent-invoker");
|
|
2
2
|
|
|
3
|
-
function
|
|
4
|
-
if (stepContext === undefined || stepContext === null) {
|
|
5
|
-
return "(no step context provided)";
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
if (typeof stepContext === "string") {
|
|
9
|
-
const trimmed = stepContext.trim();
|
|
10
|
-
return trimmed.length > 0 ? trimmed : "(no step context provided)";
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
try {
|
|
14
|
-
return JSON.stringify(stepContext, null, 2);
|
|
15
|
-
} catch {
|
|
16
|
-
return String(stepContext);
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
function formatFiles(files) {
|
|
21
|
-
if (!files) {
|
|
22
|
-
return "(no files provided)";
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
if (Array.isArray(files)) {
|
|
26
|
-
if (files.length === 0) {
|
|
27
|
-
return "(no files provided)";
|
|
28
|
-
}
|
|
29
|
-
return files.map((file) => `- ${file}`).join("\n");
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
const trimmed = String(files).trim();
|
|
33
|
-
return trimmed.length > 0 ? trimmed : "(no files provided)";
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
function ensureFullFileInstruction(prompt) {
|
|
37
|
-
const fullFileRegex = /full file|full files|full contents/i;
|
|
38
|
-
if (fullFileRegex.test(prompt)) {
|
|
39
|
-
return prompt;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
const instruction =
|
|
43
|
-
"Read the full contents of each modified file for context, not only the diff.";
|
|
44
|
-
return `${prompt}\n\n## Required Context\n${instruction}`;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
function buildReviewPrompt(template, stepContext, files, diff) {
|
|
3
|
+
function buildReviewPrompt(template, planFile, stepIds) {
|
|
48
4
|
const basePrompt = String(template || "");
|
|
49
|
-
const
|
|
50
|
-
.
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
5
|
+
const stepIdsStr = Array.isArray(stepIds)
|
|
6
|
+
? stepIds.join(", ")
|
|
7
|
+
: String(stepIds);
|
|
8
|
+
return basePrompt
|
|
9
|
+
.replace("{planFile}", planFile || "")
|
|
10
|
+
.replace("{stepIds}", stepIdsStr);
|
|
55
11
|
}
|
|
56
12
|
|
|
57
13
|
function buildReviewConfig(config, prompt) {
|
|
@@ -268,9 +224,8 @@ function parseReviewResults(stdout) {
|
|
|
268
224
|
|
|
269
225
|
async function invokeReviewAgent(
|
|
270
226
|
config,
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
diff,
|
|
227
|
+
planFile,
|
|
228
|
+
stepIds,
|
|
274
229
|
repoRoot,
|
|
275
230
|
options = {}
|
|
276
231
|
) {
|
|
@@ -278,19 +233,14 @@ async function invokeReviewAgent(
|
|
|
278
233
|
(config && config.review && config.review.prompt) ||
|
|
279
234
|
config.REVIEW_PROMPT ||
|
|
280
235
|
"";
|
|
281
|
-
const
|
|
236
|
+
const normalizedStepIds = Array.isArray(stepIds) ? stepIds : [stepIds];
|
|
237
|
+
const prompt = buildReviewPrompt(promptTemplate, planFile, normalizedStepIds);
|
|
282
238
|
const reviewConfig = buildReviewConfig(config, prompt);
|
|
283
|
-
const planFile = options.planFile || options.planPath || "review";
|
|
284
|
-
const stepIds = options.stepIds
|
|
285
|
-
? options.stepIds
|
|
286
|
-
: options.stepId
|
|
287
|
-
? [options.stepId]
|
|
288
|
-
: ["review"];
|
|
289
239
|
|
|
290
240
|
const handle = invokeAgentWithFailover(
|
|
291
241
|
reviewConfig,
|
|
292
242
|
planFile,
|
|
293
|
-
|
|
243
|
+
normalizedStepIds,
|
|
294
244
|
repoRoot,
|
|
295
245
|
options
|
|
296
246
|
);
|