@lisang233/pi-sync 0.2.2 → 0.2.3
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/operations.ts +15 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lisang233/pi-sync",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.3",
|
|
4
4
|
"description": "Personal Pi extension that syncs Pi configuration through Git with background auto-sync and git-style fetch/merge conflict handling.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
package/src/operations.ts
CHANGED
|
@@ -31,8 +31,10 @@ import {
|
|
|
31
31
|
resetHard,
|
|
32
32
|
stageAll,
|
|
33
33
|
} from "./git.js";
|
|
34
|
+
import { agentDir } from "./paths.js";
|
|
34
35
|
import { classifyState, type StateClassify, syncIndicatorText } from "./status.js";
|
|
35
36
|
import {
|
|
37
|
+
agentTarget,
|
|
36
38
|
collectAgentFiles,
|
|
37
39
|
copyMirrorToAgent,
|
|
38
40
|
graftAgentIntoMirror,
|
|
@@ -227,7 +229,7 @@ export async function pull(
|
|
|
227
229
|
// ignore
|
|
228
230
|
}
|
|
229
231
|
const conflictList = conflicts.length > 0 ? ` (${conflicts.join(", ")})` : "";
|
|
230
|
-
const message = `Merge conflict in ${conflicts.length} file(s)${conflictList}. Local configuration was preserved. Resolve with /sync merge --ours, /sync merge --theirs, or /sync mergetool. Then run /sync merge. (remote ${shortId(
|
|
232
|
+
const message = `Merge conflict in ${conflicts.length} file(s)${conflictList}. Local configuration in ${agentDir()} was preserved. Resolve with /sync merge --ours, /sync merge --theirs, or /sync mergetool. Then run /sync merge. (remote ${shortId(
|
|
231
233
|
remoteRevision,
|
|
232
234
|
)})`;
|
|
233
235
|
ctx.ui.notify(message, "warning");
|
|
@@ -403,9 +405,19 @@ export async function merge(
|
|
|
403
405
|
if (errors.length > 0) {
|
|
404
406
|
const errorDetails = errors
|
|
405
407
|
.slice(0, 5)
|
|
406
|
-
.map((e) => ` - ${e.path}${e.line ? `:${e.line}` : ""}: ${e.reason}`)
|
|
408
|
+
.map((e) => ` - ${agentTarget(e.path)}${e.line ? `:${e.line}` : ""}: ${e.reason}`)
|
|
407
409
|
.join("\n");
|
|
408
|
-
const message =
|
|
410
|
+
const message = [
|
|
411
|
+
`Cannot complete merge: ${errors.length} unresolved issue(s) detected.`,
|
|
412
|
+
errorDetails,
|
|
413
|
+
"",
|
|
414
|
+
`To resolve manually, edit files in: ${agentDir()}`,
|
|
415
|
+
"Or choose a resolution strategy:",
|
|
416
|
+
" /sync merge --ours (keep local configuration)",
|
|
417
|
+
" /sync merge --theirs (use remote configuration)",
|
|
418
|
+
" /sync mergetool (open 3-way merge tool)",
|
|
419
|
+
" /sync merge --abort (discard merge and restore)",
|
|
420
|
+
].join("\n");
|
|
409
421
|
ctx.ui.notify(message, "error");
|
|
410
422
|
return { pushed: false, pulled: false, merged: false, message };
|
|
411
423
|
}
|