@ghl-ai/aw 0.1.36-beta.110 → 0.1.36-beta.111
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/git.mjs +14 -9
- package/package.json +1 -1
package/git.mjs
CHANGED
|
@@ -311,21 +311,26 @@ export async function fetchAndMerge(awHome, { silent = true } = {}) {
|
|
|
311
311
|
} catch { /* local commits exist — not a fast-forward */ }
|
|
312
312
|
|
|
313
313
|
if (canFF) {
|
|
314
|
-
//
|
|
315
|
-
//
|
|
316
|
-
//
|
|
317
|
-
let
|
|
314
|
+
// Stash staged/unstaged changes to tracked files before reset --hard so
|
|
315
|
+
// they are not lost. Untracked files (e.g. newly created skills not yet
|
|
316
|
+
// staged) are untouched by reset --hard and need no stashing.
|
|
317
|
+
let stashed = false;
|
|
318
318
|
try {
|
|
319
|
-
const { stdout
|
|
320
|
-
|
|
321
|
-
} catch { /*
|
|
322
|
-
|
|
323
|
-
if (hasLocalChanges) return { updated: false, conflicts };
|
|
319
|
+
const { stdout } = await exec(`git -C "${awHome}" stash push -m "aw: pre-sync stash"`);
|
|
320
|
+
stashed = !stdout.includes('No local changes to save');
|
|
321
|
+
} catch { /* nothing to stash */ }
|
|
324
322
|
|
|
325
323
|
const { stdout: headBefore } = await exec(`git -C "${awHome}" rev-parse HEAD`);
|
|
326
324
|
await exec(`git -C "${awHome}" reset --hard origin/${REGISTRY_BASE_BRANCH}`);
|
|
327
325
|
const { stdout: headAfter } = await exec(`git -C "${awHome}" rev-parse HEAD`);
|
|
328
326
|
updated = headBefore.trim() !== headAfter.trim();
|
|
327
|
+
|
|
328
|
+
if (stashed) {
|
|
329
|
+
try {
|
|
330
|
+
await exec(`git -C "${awHome}" stash pop`);
|
|
331
|
+
} catch { /* conflict between stash and remote — leave markers for user */ }
|
|
332
|
+
}
|
|
333
|
+
|
|
329
334
|
return { updated, conflicts };
|
|
330
335
|
}
|
|
331
336
|
|