@fermindi/pwn-cli 0.9.1 → 0.9.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.
package/package.json
CHANGED
|
@@ -42,6 +42,13 @@ export async function createTaskBranch(taskId, cwd = process.cwd()) {
|
|
|
42
42
|
// Branch doesn't exist
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
+
// Stash untracked files (task metadata etc.) that block checkout
|
|
46
|
+
let stashed = false;
|
|
47
|
+
try {
|
|
48
|
+
const { stdout: stashOut } = await execAsync('git stash --include-untracked', { cwd });
|
|
49
|
+
stashed = !stashOut.includes('No local changes');
|
|
50
|
+
} catch {}
|
|
51
|
+
|
|
45
52
|
if (exists) {
|
|
46
53
|
// Rerun — checkout and reset to current HEAD
|
|
47
54
|
// so we don't carry stale/dirty state from previous attempt
|
|
@@ -52,6 +59,11 @@ export async function createTaskBranch(taskId, cwd = process.cwd()) {
|
|
|
52
59
|
} else {
|
|
53
60
|
await execAsync(`git checkout -b ${branch}`, { cwd });
|
|
54
61
|
}
|
|
62
|
+
|
|
63
|
+
// Restore stashed files on the new branch
|
|
64
|
+
if (stashed) {
|
|
65
|
+
try { await execAsync('git stash pop', { cwd }); } catch {}
|
|
66
|
+
}
|
|
55
67
|
return branch;
|
|
56
68
|
}
|
|
57
69
|
|