@lisang233/pi-sync 0.2.4 → 0.2.5

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/operations.ts +13 -7
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lisang233/pi-sync",
3
- "version": "0.2.4",
3
+ "version": "0.2.5",
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
@@ -6,7 +6,7 @@ import type {
6
6
  ExtensionUIContext,
7
7
  } from "@earendil-works/pi-coding-agent";
8
8
  import type { SyncConfig } from "./config.js";
9
- import { shortId, stateDir } from "./config.js";
9
+ import { mirrorRepoDir, shortId, stateDir } from "./config.js";
10
10
  import { formatConfig } from "./config-ui.js";
11
11
  import { diffSummary, formatDiff } from "./diff.js";
12
12
  import {
@@ -33,7 +33,6 @@ import {
33
33
  import { agentDir } from "./paths.js";
34
34
  import { classifyState, type StateClassify, syncIndicatorText } from "./status.js";
35
35
  import {
36
- agentTarget,
37
36
  collectAgentFiles,
38
37
  copyMirrorToAgent,
39
38
  graftAgentIntoMirror,
@@ -228,9 +227,13 @@ export async function pull(
228
227
  // ignore
229
228
  }
230
229
  const conflictList = conflicts.length > 0 ? ` (${conflicts.join(", ")})` : "";
231
- const message = `Merge conflict in ${conflicts.length} file(s)${conflictList}. Local configuration in ${agentDir()} was preserved. Edit files or resolve with /sync merge --ours / --theirs. Then run /sync merge. (remote ${shortId(
232
- remoteRevision,
233
- )})`;
230
+ const message = [
231
+ `Merge conflict in ${conflicts.length} file(s)${conflictList}.`,
232
+ `Local configuration in ${agentDir()} was preserved clean and untouched.`,
233
+ `Conflict markers are in mirror: ${mirrorRepoDir()}`,
234
+ "Resolve with /sync merge --ours / --theirs, or edit the mirror file, then /sync merge.",
235
+ `(remote ${shortId(remoteRevision)})`,
236
+ ].join("\n");
234
237
  ctx.ui.notify(message, "warning");
235
238
  return { pushed: false, pulled: false, merged: false, message, conflicts };
236
239
  }
@@ -404,13 +407,16 @@ export async function merge(
404
407
  if (errors.length > 0) {
405
408
  const errorDetails = errors
406
409
  .slice(0, 5)
407
- .map((e) => ` - ${agentTarget(e.path)}${e.line ? `:${e.line}` : ""}: ${e.reason}`)
410
+ .map((e) => ` - ${mirrorTarget(e.path)}${e.line ? `:${e.line}` : ""}: ${e.reason}`)
408
411
  .join("\n");
409
412
  const message = [
410
413
  `Cannot complete merge: ${errors.length} unresolved issue(s) detected.`,
411
414
  errorDetails,
412
415
  "",
413
- `To resolve manually, edit files in: ${agentDir()}`,
416
+ `Conflicted file(s) with markers are in mirror:`,
417
+ ` ${mirrorRepoDir()}`,
418
+ "",
419
+ "To resolve manually, edit the file in mirror above (or edit your local file directly).",
414
420
  "Or choose a resolution strategy:",
415
421
  " /sync merge --ours (keep local configuration)",
416
422
  " /sync merge --theirs (use remote configuration)",