xab 8.0.0 → 9.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +49 -12
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -774,26 +774,41 @@ async function reviewAppliedDiff(worktreePath, packet, onProgress) {
|
|
|
774
774
|
normal: "Be thorough but reasonable. Reject clear issues, accept minor style differences.",
|
|
775
775
|
lenient: "Focus on correctness and safety. Accept reasonable adaptations even if imperfect."
|
|
776
776
|
};
|
|
777
|
-
const prompt = `You are reviewing a curated merge.
|
|
777
|
+
const prompt = `You are reviewing a curated merge commit. Codex adapted a source commit from "${packet.sourceBranch}" and applied it to this worktree (based on "${packet.targetBranch}").
|
|
778
778
|
|
|
779
|
-
|
|
780
|
-
Summary: ${packet.analysis.summary}
|
|
781
|
-
Decision: alreadyInTarget=${packet.analysis.alreadyInTarget}
|
|
782
|
-
Strategy: ${packet.analysis.applicationStrategy}
|
|
783
|
-
Affected components: ${packet.analysis.affectedComponents.join(", ")}
|
|
779
|
+
Your job: review the NEW commit Codex created. Verify it is correct, clean, and faithful to the source commit's intent while respecting the target's architecture.
|
|
784
780
|
|
|
785
|
-
## Source commit
|
|
781
|
+
## Source commit (what was being backmerged)
|
|
786
782
|
Hash: ${packet.commitHash}
|
|
787
783
|
Message: ${packet.commitMessage}
|
|
784
|
+
Branch: ${packet.sourceBranch}
|
|
785
|
+
|
|
786
|
+
### Original source diff:
|
|
787
|
+
\`\`\`diff
|
|
788
|
+
${packet.sourcePatch.slice(0, 15000)}
|
|
789
|
+
\`\`\`
|
|
790
|
+
|
|
791
|
+
## Codex's analysis
|
|
792
|
+
Summary: ${packet.analysis.summary}
|
|
793
|
+
Already in target: ${packet.analysis.alreadyInTarget}
|
|
794
|
+
Strategy used: ${packet.analysis.applicationStrategy}
|
|
795
|
+
Components: ${packet.analysis.affectedComponents.join(", ")}
|
|
796
|
+
|
|
797
|
+
## Codex's applied commit (what you are reviewing)
|
|
798
|
+
${packet.newCommitHash ? `Commit: ${packet.newCommitHash} (in this worktree)
|
|
799
|
+
Run \`git show ${packet.newCommitHash.slice(0, 8)}\` to inspect it.` : `Run \`git show HEAD\` to inspect it.`}
|
|
788
800
|
|
|
789
|
-
|
|
801
|
+
### Applied diff:
|
|
790
802
|
\`\`\`diff
|
|
791
803
|
${packet.appliedDiff.slice(0, 30000)}
|
|
792
804
|
\`\`\`
|
|
793
805
|
|
|
794
|
-
|
|
806
|
+
### Diff stat:
|
|
795
807
|
${packet.appliedDiffStat}
|
|
796
808
|
|
|
809
|
+
## Key question: does the applied commit correctly adapt the source commit's intent?
|
|
810
|
+
Compare the source diff with the applied diff. The applied commit should capture the same behavior/fix but adapted for the target branch's codebase structure.
|
|
811
|
+
|
|
797
812
|
${packet.repoContext ? `## Repository context
|
|
798
813
|
${packet.repoContext}
|
|
799
814
|
` : ""}
|
|
@@ -904,15 +919,22 @@ Your objections will be sent back to the apply agent for fixing, so be specific
|
|
|
904
919
|
}
|
|
905
920
|
}
|
|
906
921
|
if (message.type === "result") {
|
|
907
|
-
|
|
908
|
-
|
|
922
|
+
const msg = message;
|
|
923
|
+
if (msg.structured_output) {
|
|
924
|
+
resultText = typeof msg.structured_output === "string" ? msg.structured_output : JSON.stringify(msg.structured_output);
|
|
925
|
+
} else if (msg.result) {
|
|
926
|
+
resultText = msg.result;
|
|
909
927
|
}
|
|
910
928
|
break;
|
|
911
929
|
}
|
|
912
930
|
}
|
|
913
931
|
if (!resultText) {
|
|
932
|
+
if (onProgress)
|
|
933
|
+
onProgress("review", "WARNING: no structured_output or result in review response");
|
|
914
934
|
return { approved: false, issues: ["Review produced no output"], summary: "Review failed", confidence: "low" };
|
|
915
935
|
}
|
|
936
|
+
if (onProgress)
|
|
937
|
+
onProgress("review", `got ${resultText.length} chars of review output`);
|
|
916
938
|
try {
|
|
917
939
|
return JSON.parse(resultText);
|
|
918
940
|
} catch {
|
|
@@ -1712,6 +1734,7 @@ async function processOneCommit(o) {
|
|
|
1712
1734
|
packet = {
|
|
1713
1735
|
commitHash: commit.hash,
|
|
1714
1736
|
commitMessage: commit.message,
|
|
1737
|
+
newCommitHash: validation.newCommitHash ?? undefined,
|
|
1715
1738
|
sourceBranch: o.sourceRef,
|
|
1716
1739
|
targetBranch: o.targetRef,
|
|
1717
1740
|
analysis,
|
|
@@ -1975,7 +1998,21 @@ async function runBatch(opts) {
|
|
|
1975
1998
|
onProgress(phase, msg) {
|
|
1976
1999
|
if (jsonl)
|
|
1977
2000
|
emitJsonl({ event: "progress", phase, msg });
|
|
1978
|
-
|
|
2001
|
+
let icon;
|
|
2002
|
+
switch (phase) {
|
|
2003
|
+
case "analyze":
|
|
2004
|
+
icon = chalk.blue("\u25C6");
|
|
2005
|
+
break;
|
|
2006
|
+
case "apply":
|
|
2007
|
+
icon = chalk.green("\u25B8");
|
|
2008
|
+
break;
|
|
2009
|
+
case "review":
|
|
2010
|
+
icon = chalk.magenta("\u25CF");
|
|
2011
|
+
break;
|
|
2012
|
+
default:
|
|
2013
|
+
icon = chalk.dim("\xB7");
|
|
2014
|
+
break;
|
|
2015
|
+
}
|
|
1979
2016
|
log(` ${ts()} ${icon} ${chalk.dim(msg)}`);
|
|
1980
2017
|
},
|
|
1981
2018
|
onLog(msg, color) {
|