feat: add snapshot-based none VCS mode

This commit is contained in:
liujing
2026-07-17 11:50:53 +08:00
parent 758c41a953
commit b756a10c35
11 changed files with 1336 additions and 121 deletions
+17 -5
View File
@@ -25,6 +25,7 @@ import type {
ExecutorStartOpts,
ProgressSidecar,
ReasonixSessionHandle,
VcsKind,
} from "./workflow-types.js";
import {
nowIso,
@@ -37,7 +38,17 @@ import {
// Safety prompt footer (appended to every executor instruction)
// ---------------------------------------------------------------------------
const SAFETY_CONSTRAINTS = `
function getSafetyConstraints(vcsKind?: VcsKind): string {
let vcsInspectCmd = "";
if (vcsKind === "svn") {
vcsInspectCmd = "Before exiting, inspect svn status and leave no artifacts outside the allowed scope.";
} else if (vcsKind === "none") {
vcsInspectCmd = "Before exiting, confirm that no temporary files or paths outside the allowed scope remain.";
} else {
vcsInspectCmd = "Before exiting, inspect git status --porcelain --untracked-files=all and leave no artifacts outside the allowed scope.";
}
return `
## CRITICAL CONSTRAINTS — DO NOT VIOLATE
- DO NOT run git commit, git push, or git reset under any circumstances.
@@ -49,10 +60,11 @@ const SAFETY_CONSTRAINTS = `
- Put all temporary files in an OS temporary directory outside the repository (for example, one created with mktemp).
- If you accidentally create a temporary repository file, remove only that artifact before exiting.
- SQLite cleanup must include the database and its -wal, -shm, and -journal sidecars.
- Before exiting, inspect git status --porcelain --untracked-files=all (or svn status) and leave no artifacts outside the allowed scope.
- ${vcsInspectCmd}
- You may read, edit, and test code, but never commit or push changes.
- If you encounter an error you cannot resolve, stop and report it clearly.
`.trimStart();
}
// ---------------------------------------------------------------------------
// Progress sidecar helpers
@@ -246,7 +258,7 @@ ${criteriaList}
After implementation, ensure these commands pass:
${cmdsText}
${SAFETY_CONSTRAINTS}`;
${getSafetyConstraints(opts.vcsKind)}`;
}
function buildFixPrompt(opts: ExecutorResumeOpts): string {
@@ -269,7 +281,7 @@ ${plan.scope.map((s) => ` - ${s}`).join("\n")}
After scope cleanup, run:
${plan.verificationCommands.map((cmd) => ` ${cmd.join(" ")}`).join("\n")}
${SAFETY_CONSTRAINTS}`;
${getSafetyConstraints(opts.vcsKind)}`;
}
return `# Fix Request: ${plan.title}
@@ -288,7 +300,7 @@ ${plan.scope.map((s) => ` - ${s}`).join("\n")}
After applying fixes, run:
${plan.verificationCommands.map((cmd) => ` ${cmd.join(" ")}`).join("\n")}
${SAFETY_CONSTRAINTS}`;
${getSafetyConstraints(opts.vcsKind)}`;
}
// ---------------------------------------------------------------------------