@fermindi/pwn-cli 0.9.5 → 0.9.6
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/package.json +1 -1
- package/src/services/batch-service.js +10 -23
package/package.json
CHANGED
|
@@ -50,16 +50,10 @@ export async function createTaskBranch(taskId, cwd = process.cwd()) {
|
|
|
50
50
|
await checkoutBranch(branch, cwd, { stash: true });
|
|
51
51
|
await execAsync(`git reset --hard ${baseRef}`, { cwd });
|
|
52
52
|
} else {
|
|
53
|
-
// Stash
|
|
54
|
-
|
|
55
|
-
try {
|
|
56
|
-
const { stdout } = await execAsync('git stash --include-untracked', { cwd });
|
|
57
|
-
didStash = !stdout.includes('No local changes');
|
|
58
|
-
} catch {}
|
|
53
|
+
// Stash + drop to unblock checkout -b (metadata files re-created by runner)
|
|
54
|
+
try { await execAsync('git stash --include-untracked', { cwd }); } catch {}
|
|
59
55
|
await execAsync(`git checkout -b ${branch}`, { cwd });
|
|
60
|
-
|
|
61
|
-
try { await execAsync('git stash pop', { cwd }); } catch {}
|
|
62
|
-
}
|
|
56
|
+
try { await execAsync('git stash drop', { cwd }); } catch {}
|
|
63
57
|
}
|
|
64
58
|
return branch;
|
|
65
59
|
}
|
|
@@ -73,25 +67,18 @@ export async function createTaskBranch(taskId, cwd = process.cwd()) {
|
|
|
73
67
|
* @param {{ force?: boolean, stash?: boolean }} options
|
|
74
68
|
*/
|
|
75
69
|
export async function checkoutBranch(branch, cwd = process.cwd(), { force = false, stash = false } = {}) {
|
|
76
|
-
let didStash = false;
|
|
77
70
|
if (stash) {
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
} catch {}
|
|
71
|
+
// Stash only to unblock checkout, then drop — these are runner
|
|
72
|
+
// metadata files (.ai/batch/tasks/*.json) that get re-created by
|
|
73
|
+
// saveTaskFile, so restoring them causes merge conflicts for no gain.
|
|
74
|
+
try { await execAsync('git stash --include-untracked', { cwd }); } catch {}
|
|
82
75
|
}
|
|
83
76
|
|
|
84
77
|
const flag = force ? ' --force' : '';
|
|
85
|
-
|
|
86
|
-
await execAsync(`git checkout${flag} ${branch}`, { cwd });
|
|
87
|
-
} catch (err) {
|
|
88
|
-
// If checkout failed, drop stash so it doesn't pile up
|
|
89
|
-
if (didStash) { try { await execAsync('git stash drop', { cwd }); } catch {} }
|
|
90
|
-
throw err;
|
|
91
|
-
}
|
|
78
|
+
await execAsync(`git checkout${flag} ${branch}`, { cwd });
|
|
92
79
|
|
|
93
|
-
if (
|
|
94
|
-
try { await execAsync('git stash
|
|
80
|
+
if (stash) {
|
|
81
|
+
try { await execAsync('git stash drop', { cwd }); } catch {}
|
|
95
82
|
}
|
|
96
83
|
}
|
|
97
84
|
|