fix: restore triage skill files and keep sync non-destructive

This commit is contained in:
2026-05-15 03:30:48 +00:00
parent 46da713fa7
commit 7186098edf
11 changed files with 140 additions and 21 deletions
+2 -11
View File
@@ -66,9 +66,9 @@ export async function commitAndPush(workspace, repoDir, _spawnSync = spawnSync)
run(['config', 'user.name', 'AI Review Bot'], repoDir);
const existingSyncPaths = [];
const missingSyncPaths = [];
// Mirror sync files from workspace into the repo copy.
// Copy action skill files into the target repo. Existing files are overwritten;
// missing source files are ignored so we do not delete target repo content.
for (const relPath of SYNC_PATHS) {
const src = path.join(workspace, relPath);
const dest = path.join(repoDir, relPath);
@@ -76,21 +76,12 @@ export async function commitAndPush(workspace, repoDir, _spawnSync = spawnSync)
fs.mkdirSync(path.dirname(dest), { recursive: true });
fs.copyFileSync(src, dest);
existingSyncPaths.push(relPath);
continue;
}
if (fs.existsSync(dest)) {
fs.rmSync(dest, { force: true });
}
missingSyncPaths.push(relPath);
}
if (existingSyncPaths.length > 0) {
run(['add', ...existingSyncPaths], repoDir);
}
if (missingSyncPaths.length > 0) {
run(['rm', '--cached', '--ignore-unmatch', '--', ...missingSyncPaths], repoDir);
}
const status = run(['status', '--porcelain'], repoDir);
if (!status) {