@narumitw/pi-sync 0.70.4 → 0.70.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @narumitw/pi-sync
2
2
 
3
+ ## 0.70.5
4
+
5
+ ### Patch Changes
6
+
7
+ - 6e50a48: Offer a read-only comparison or an explicitly confirmed Force pull or Force push when a directional transfer would discard destination changes, including on first sync. Make the initial source choices easier to find from the first-sync difference review.
8
+
3
9
  ## 0.70.4
4
10
 
5
11
  ### Patch Changes
package/README.md CHANGED
@@ -86,9 +86,11 @@ Remote status: Not checked
86
86
  Last applied snapshot: Never synced
87
87
  ```
88
88
 
89
- Use **Sync…** (**Sync now** in RPC) to merge both ways. **Push to remote** uses this device's version for managed files; **Pull from remote** uses the remote version. After daemon handover, choosing either action transfers without another confirmation if it will not discard a destination change since the last accepted sync. This includes protecting local edits when only this device changed. Use **View differences** first if you want to review all changes, including additions and deletions. If the destination has conflicting content but no accepted baseline, use **Sync…** for first-sync review.
89
+ Use **Sync…** (**Sync now** in RPC) to merge both ways. **Push to remote** uses this device's version for managed files; **Pull from remote** uses the remote version. After daemon handover, these two actions transfer without another confirmation if they will not discard destination changes.
90
90
 
91
- If a transfer stops before writing because it would discard a destination change, choose **Review Force push…** or **Review Force pull…**. Review the exact changes before confirming; cancellation is the default. A stale preview cannot authorize a write, and unrelated errors do not offer Force. Push preserves the previous remote version in **History**; Pull creates a local backup before applying changes. See [Recover excluded files from History](#recover-excluded-files-from-history) for files the current rules no longer select.
91
+ If either action would discard destination changes, including on first sync, choose **Review differences** to compare without transferring, or **Force pull…** / **Force push…** to review the exact changes and confirm replacement. Pull backs up local files before applying. Push preserves the previous remote version in **History**; see [Recover excluded files from History](#recover-excluded-files-from-history) for files the current rules no longer select.
92
+
93
+ A stale preview cannot authorize a write, and unrelated errors do not offer Force.
92
94
 
93
95
  Selecting a direction does not authorize background transfers or model use. If a file-queue release cannot be confirmed, Pi Sync [recovers the original job when it can](./docs/daemon-migration.md#recover-from-uncertain-daemon-cleanup). It never repeats a known commit, guesses when the write outcome is unknown, or reuses a Force approval for another attempt. For a pending journal from the retired ignore-file policy, follow the [manual recovery guide](./skills/configure-pi-sync/references/configuration.md#retired-ignore-file-policy).
94
96
 
@@ -158,7 +160,7 @@ Then choose one reviewed direction:
158
160
  It applies the [secret-scan setting](./skills/configure-pi-sync/references/configuration.md#secret-scanning), shows the exact remote publication effect, re-reads a changed remote head, and asks again if the reviewed plan changed.
159
161
  - **Use remote content and replace local…** uses the existing forced-pull path.
160
162
  It shows exact local writes and deletions, protects the live session, and creates a local backup before applying.
161
- - First sync uses **Use local as initial source…** and **Use remote as initial source…** labels.
163
+ - On first sync, select **Choose initial source** from the difference review to return to **Use local as initial source…** and **Use remote as initial source…**. This does not start a transfer.
162
164
  An empty remote offers **Push local content…** only.
163
165
 
164
166
  Cancelling a preparation or confirmation returns to conflict resolution with no side effects.
@@ -58,6 +58,7 @@ async function showSyncResolution(ctx, initialDecision, runRoute, sessionSignal)
58
58
  content: state.review,
59
59
  format: { kind: "text" },
60
60
  viewportSize: "adaptive",
61
+ ...state.kind.startsWith("first-sync-") ? { confirm: { id: "initial-source", label: "Choose initial source", action: "back" } } : {},
61
62
  hint: "back"
62
63
  })
63
64
  },
@@ -208,4 +209,4 @@ async function dispatchManagerResult(ctx, initialResult, origin, runRoute, signa
208
209
  export {
209
210
  dispatchManagerResult
210
211
  };
211
- //# sourceMappingURL=chunk-V4IGBXBA.ts.map
212
+ //# sourceMappingURL=chunk-LSIUAXE4.ts.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/ui/sync-resolution-ui.ts", "../../src/ui/manager-result-dispatcher.ts"],
4
+ "sourcesContent": ["import type { ExtensionContext } from \"@earendil-works/pi-coding-agent\";\nimport { defineMenu, runMenu } from \"@narumitw/pi-tui-kit\";\nimport { loadConfig, syncConfigReviewIdentity } from \"../settings/config.js\";\nimport type { SyncDecision, SyncResolutionDirection } from \"../sync/sync-decision.js\";\nimport { errorMessage } from \"../sync/sync-errors.js\";\nimport { type RunRoute, type RunRouteResult, runCancellableOperation } from \"./cancellable-operation.js\";\nimport { safeTerminalText } from \"./terminal-text.js\";\n\nexport type SyncResolutionResult =\n | { kind: \"resolved\"; direction: SyncResolutionDirection }\n | {\n kind: \"route-result\";\n result: RunRouteResult;\n route: SyncResolutionDirection;\n }\n | { kind: \"back\" }\n | { kind: \"closed\" }\n | { kind: \"stale\" };\n\nexport async function showSyncResolution(\n ctx: ExtensionContext,\n initialDecision: SyncDecision,\n runRoute: RunRoute,\n sessionSignal?: AbortSignal,\n): Promise<SyncResolutionResult> {\n type Screen = \"resolve\" | \"review\";\n type Action = \"push\" | \"pull\" | \"back\";\n let currentDecision = initialDecision;\n let resolvedDirection: SyncResolutionDirection | undefined;\n let chainedResult: { result: RunRouteResult; route: SyncResolutionDirection } | undefined;\n const menu = defineMenu<SyncDecision, Screen, Action, ExtensionContext>({\n start: \"resolve\",\n screens: {\n resolve: ({ state }) => ({\n kind: \"actions\",\n title: resolutionTitle(state),\n lines: resolutionLines(state),\n items: [\n { id: \"review\", label: \"Review differences (recommended)\", to: \"review\" },\n ...(state.directions.includes(\"push\")\n ? [\n {\n id: \"push\",\n label: pushLabel(state),\n description: \"Review an exact push before replacing the remote version.\",\n action: \"push\" as const,\n },\n ]\n : []),\n ...(state.directions.includes(\"pull\")\n ? [\n {\n id: \"pull\",\n label: pullLabel(state),\n description: \"Review exact local changes and create a backup before applying.\",\n action: \"pull\" as const,\n },\n ]\n : []),\n { id: \"back\", label: \"Back\", action: \"back\" },\n ],\n hint: \"back\",\n }),\n review: ({ state }) => ({\n kind: \"review\",\n title: `Review differences \u00B7 ${safeTerminalText(state.setupName)}`,\n content: state.review,\n format: { kind: \"text\" },\n viewportSize: \"adaptive\",\n ...(state.kind.startsWith(\"first-sync-\")\n ? { confirm: { id: \"initial-source\", label: \"Choose initial source\", action: \"back\" as const } }\n : {}),\n hint: \"back\",\n }),\n },\n actions: {\n push: ({ state, signal }) => resolveDirection(\"push\", state, signal),\n pull: ({ state, signal }) => resolveDirection(\"pull\", state, signal),\n back: async () => ({ kind: \"back\" }),\n },\n });\n\n async function resolveDirection(\n direction: SyncResolutionDirection,\n decision: SyncDecision,\n actionSignal: AbortSignal,\n ) {\n const signal = sessionSignal ? AbortSignal.any([sessionSignal, actionSignal]) : actionSignal;\n const config = await loadConfig(decision.setupName);\n if (signal.aborted) return { kind: \"close\" as const };\n if (syncConfigReviewIdentity(config) !== decision.configIdentity) {\n throw new Error(\n `Sync setup \u201C${safeTerminalText(decision.setupName)}\u201D changed while conflict resolution was open; return to the sync manager and retry.`,\n );\n }\n const result = await runCancellableOperation(\n ctx,\n direction === \"push\" ? \"Preparing local-wins push preview\u2026\" : \"Preparing remote-wins pull preview\u2026\",\n `${direction} --force`,\n runRoute,\n {\n commitAware: true,\n cancelledMessage:\n direction === \"push\"\n ? \"Push preparation cancelled; no remote files were changed.\"\n : \"Pull check cancelled; no local files were changed.\",\n target: decision.setupName,\n signal,\n },\n );\n if (result.kind === \"decision-required\") {\n currentDecision = result.decision;\n return { kind: \"stay\" as const };\n }\n if (result.kind === \"remote-selection-required\") {\n chainedResult = { result, route: direction };\n return { kind: \"close\" as const };\n }\n if (result.kind === \"completed\") {\n if (result.outcome === \"cancelled\") return { kind: \"stay\" as const };\n resolvedDirection = direction;\n return { kind: \"close\" as const };\n }\n return result.kind === \"closed\" ? { kind: \"close\" as const } : { kind: \"stay\" as const };\n }\n\n const result = await runMenu(ctx, menu, {\n getState: () => currentDecision,\n signal: sessionSignal,\n isCurrent: () => !sessionSignal?.aborted,\n onError: (_menuCtx, error) => ctx.ui.notify(errorMessage(error), \"error\"),\n });\n if (sessionSignal?.aborted || result.kind === \"stale\") return { kind: \"stale\" };\n if (chainedResult) return { kind: \"route-result\", ...chainedResult };\n if (resolvedDirection) return { kind: \"resolved\", direction: resolvedDirection };\n if (result.kind === \"closed\") {\n return result.reason === \"back\" ? { kind: \"back\" } : { kind: \"closed\" };\n }\n return { kind: \"closed\" };\n}\n\nfunction resolutionTitle(decision: SyncDecision) {\n return decision.kind === \"remote-empty\" ? \"Remote is empty\" : \"Resolve sync conflict\";\n}\n\nfunction resolutionLines(decision: SyncDecision) {\n return [\n `Sync setup: ${safeTerminalText(decision.setupName)}`,\n ...causeSummary(decision),\n \"No files have been changed by this failed operation.\",\n ];\n}\n\nfunction causeSummary(decision: SyncDecision) {\n if (decision.kind === \"first-sync-settings-diverged\") {\n return [\"This machine and the remote have different Pi settings on first sync.\"];\n }\n if (decision.kind === \"first-sync-sessions-diverged\") {\n return [\"Pi settings match, but local and remote sessions differ on first sync.\"];\n }\n if (decision.kind === \"remote-empty\") return [\"The remote storage location has no snapshot.\"];\n return [\n ...(decision.causes.localChanged ? [\"Local content changed since the last sync.\"] : []),\n ...(decision.causes.remoteChanged ? [\"Remote content changed since the last sync.\"] : []),\n ...(decision.causes.policyChanged ? [\"Included content changed since the last sync.\"] : []),\n ];\n}\n\nfunction pushLabel(decision: SyncDecision) {\n if (decision.kind === \"remote-empty\") return \"Push local content\u2026\";\n if (decision.kind.startsWith(\"first-sync-\")) return \"Use local as initial source\u2026\";\n return \"Keep local content and replace remote\u2026\";\n}\n\nfunction pullLabel(decision: SyncDecision) {\n return decision.kind.startsWith(\"first-sync-\")\n ? \"Use remote as initial source\u2026\"\n : \"Use remote content and replace local\u2026\";\n}\n", "import type { ExtensionContext } from \"@earendil-works/pi-coding-agent\";\nimport type { CancellableOperationResult, RunRoute, RunRouteResult } from \"./cancellable-operation.js\";\nimport { type RemoteSelectionOrigin, showRemoteSelectionReview } from \"./remote-selection-ui.js\";\nimport { showSyncResolution } from \"./sync-resolution-ui.js\";\n\nconst MAX_DECISION_TRANSITIONS = 32;\n\nexport interface ManagerResultDisposition {\n kind: \"close\" | \"stay\";\n appliedRoute?: \"sync\" | \"pull\" | \"push\";\n}\n\nexport interface ManagerResultOptions {\n cancelLabel?: string;\n onSelectionResolved?: () => void;\n withStateAccess?: <T>(task: () => Promise<T>) => Promise<T>;\n}\n\nexport async function dispatchManagerResult(\n ctx: ExtensionContext,\n initialResult: CancellableOperationResult,\n origin: Exclude<RemoteSelectionOrigin, \"settings\">,\n runRoute: RunRoute,\n signal?: AbortSignal,\n options: ManagerResultOptions = {},\n): Promise<ManagerResultDisposition> {\n let result: CancellableOperationResult | RunRouteResult = initialResult;\n let currentRoute: \"sync\" | \"pull\" | \"push\" = origin;\n let resolving = false;\n\n for (let transition = 0; transition < MAX_DECISION_TRANSITIONS; transition += 1) {\n if (signal?.aborted) return { kind: \"close\" };\n if (result.kind === \"remote-selection-required\") {\n resolving = true;\n const resolution = await showRemoteSelectionReview(ctx, result.decision.setupName, signal, undefined, {\n decision: result.decision,\n origin: currentRoute,\n runRoute,\n cancelLabel: options.cancelLabel,\n onSelectionResolved: options.onSelectionResolved,\n withStateAccess: options.withStateAccess,\n });\n if (resolution.kind === \"route-result\") {\n result = resolution.result;\n currentRoute = resolution.route;\n continue;\n }\n return resolution.kind === \"closed\" || resolution.kind === \"stale\" ? { kind: \"close\" } : { kind: \"stay\" };\n }\n if (result.kind === \"decision-required\") {\n resolving = true;\n const resolution = await showSyncResolution(ctx, result.decision, runRoute, signal);\n if (resolution.kind === \"route-result\") {\n result = resolution.result;\n currentRoute = resolution.route;\n continue;\n }\n if (resolution.kind === \"resolved\") {\n return { kind: \"close\", appliedRoute: resolution.direction };\n }\n return resolution.kind === \"closed\" || resolution.kind === \"stale\" ? { kind: \"close\" } : { kind: \"stay\" };\n }\n if (result.kind === \"closed\") return { kind: \"close\" };\n if (result.kind === \"completed\") {\n const appliedRoute = result.outcome === \"applied\" ? currentRoute : undefined;\n if (resolving || (origin === \"pull\" && result.outcome === \"applied\")) {\n return { kind: \"close\", ...(appliedRoute ? { appliedRoute } : {}) };\n }\n return { kind: \"stay\", ...(appliedRoute ? { appliedRoute } : {}) };\n }\n return { kind: \"stay\" };\n }\n\n ctx.ui.notify(\n \"Sync resolution stopped after too many state changes. Start /sync again to review fresh state.\",\n \"warning\",\n );\n return { kind: \"stay\" };\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;AACA,SAAS,YAAY,eAAe;AAkBpC,eAAsB,mBACpB,KACA,iBACA,UACA,eAC+B;AAG/B,MAAI,kBAAkB;AACtB,MAAI;AACJ,MAAI;AACJ,QAAM,OAAO,WAA2D;AAAA,IACtE,OAAO;AAAA,IACP,SAAS;AAAA,MACP,SAAS,CAAC,EAAE,MAAM,OAAO;AAAA,QACvB,MAAM;AAAA,QACN,OAAO,gBAAgB,KAAK;AAAA,QAC5B,OAAO,gBAAgB,KAAK;AAAA,QAC5B,OAAO;AAAA,UACL,EAAE,IAAI,UAAU,OAAO,oCAAoC,IAAI,SAAS;AAAA,UACxE,GAAI,MAAM,WAAW,SAAS,MAAM,IAChC;AAAA,YACE;AAAA,cACE,IAAI;AAAA,cACJ,OAAO,UAAU,KAAK;AAAA,cACtB,aAAa;AAAA,cACb,QAAQ;AAAA,YACV;AAAA,UACF,IACA,CAAC;AAAA,UACL,GAAI,MAAM,WAAW,SAAS,MAAM,IAChC;AAAA,YACE;AAAA,cACE,IAAI;AAAA,cACJ,OAAO,UAAU,KAAK;AAAA,cACtB,aAAa;AAAA,cACb,QAAQ;AAAA,YACV;AAAA,UACF,IACA,CAAC;AAAA,UACL,EAAE,IAAI,QAAQ,OAAO,QAAQ,QAAQ,OAAO;AAAA,QAC9C;AAAA,QACA,MAAM;AAAA,MACR;AAAA,MACA,QAAQ,CAAC,EAAE,MAAM,OAAO;AAAA,QACtB,MAAM;AAAA,QACN,OAAO,2BAAwB,iBAAiB,MAAM,SAAS,CAAC;AAAA,QAChE,SAAS,MAAM;AAAA,QACf,QAAQ,EAAE,MAAM,OAAO;AAAA,QACvB,cAAc;AAAA,QACd,GAAI,MAAM,KAAK,WAAW,aAAa,IACnC,EAAE,SAAS,EAAE,IAAI,kBAAkB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O,EAAE,MAAM,SAAS,cAAc,WAAW,UAAU;AAAA,MAC7D;AACA,aAAO,WAAW,SAAS,YAAY,WAAW,SAAS,UAAU,EAAE,MAAM,QAAQ,IAAI,EAAE,MAAM,OAAO;AAAA,IAC1G;AACA,QAAI,OAAO,SAAS,SAAU,QAAO,EAAE,MAAM,QAAQ;AACrD,QAAI,OAAO,SAAS,aAAa;AAC/B,YAAM,eAAe,OAAO,YAAY,YAAY,eAAe;AACnE,UAAI,aAAc,WAAW,UAAU,OAAO,YAAY,WAAY;AACpE,eAAO,EAAE,MAAM,SAAS,GAAI,eAAe,EAAE,aAAa,IAAI,CAAC,EAAG;AAAA,MACpE;AACA,aAAO,EAAE,MAAM,QAAQ,GAAI,eAAe,EAAE,aAAa,IAAI,CAAC,EAAG;AAAA,IACnE;AACA,WAAO,EAAE,MAAM,OAAO;AAAA,EACxB;AAEA,MAAI,GAAG;AAAA,IACL;AAAA,IACA;AAAA,EACF;AACA,SAAO,EAAE,MAAM,OAAO;AACxB;",
6
+ "names": ["result"]
7
+ }
@@ -407,7 +407,7 @@ async function handleCommand(rawArgs, ctx, sessionSignal, loaders, attention, on
407
407
  if (!rawArgs.trim()) {
408
408
  attention.expand();
409
409
  try {
410
- const { showSyncManager } = await import("./manager-ui-RQSZLMJ5.ts");
410
+ const { showSyncManager } = await import("./manager-ui-HW3ZAEVK.ts");
411
411
  if (sessionSignal.aborted) return;
412
412
  await showSyncManager(ctx, run, sessionSignal, {
413
413
  needsDaemonRecovery,
@@ -510,7 +510,7 @@ function directSelectionOrigin(rawArgs) {
510
510
  async function resolveSelectionAttention(ctx, attention, signal, loaders, options = {}) {
511
511
  const current = attention.current();
512
512
  if (!current || signal.aborted) return;
513
- const { dispatchManagerResult } = await import("./manager-result-dispatcher-YXSDLTLV.ts");
513
+ const { dispatchManagerResult } = await import("./manager-result-dispatcher-75FS46JP.ts");
514
514
  if (signal.aborted || attention.current() !== current) return;
515
515
  await dispatchManagerResult(
516
516
  ctx,
@@ -541,4 +541,4 @@ export {
541
541
  handleCommand,
542
542
  resolveSelectionAttention
543
543
  };
544
- //# sourceMappingURL=command-handler-4XHK5PVX.ts.map
544
+ //# sourceMappingURL=command-handler-PT2KVTLD.ts.map
@@ -2,7 +2,7 @@
2
2
  // @ts-nocheck -- generated JavaScript uses a .ts extension for Pi's Jiti loader.
3
3
  import {
4
4
  dispatchManagerResult
5
- } from "./chunk-V4IGBXBA.ts";
5
+ } from "./chunk-LSIUAXE4.ts";
6
6
  import "./chunk-7NQ7SFZK.ts";
7
7
  import "./chunk-UMPA5S7X.ts";
8
8
  import "./chunk-ZWP6HAYV.ts";
@@ -17,4 +17,4 @@ import "./chunk-AMJRUXFT.ts";
17
17
  export {
18
18
  dispatchManagerResult
19
19
  };
20
- //# sourceMappingURL=manager-result-dispatcher-YXSDLTLV.ts.map
20
+ //# sourceMappingURL=manager-result-dispatcher-75FS46JP.ts.map
@@ -22,7 +22,7 @@ import {
22
22
  } from "./chunk-JPTI4HFC.ts";
23
23
  import {
24
24
  dispatchManagerResult
25
- } from "./chunk-V4IGBXBA.ts";
25
+ } from "./chunk-LSIUAXE4.ts";
26
26
  import "./chunk-7NQ7SFZK.ts";
27
27
  import {
28
28
  SETUP_SWITCH_ACTION_OPTIONS,
@@ -1900,7 +1900,19 @@ async function showSyncManager(ctx, runRoute, sessionSignal, options = {}) {
1900
1900
  let result = await run("reject-conflicts");
1901
1901
  if (signal.aborted || !isCurrent()) return { kind: "close" };
1902
1902
  if (result.kind === "destination-conflict") {
1903
- const choice = await showDirectionalConflict(menuContext, direction, review.setupName, signal, isCurrent);
1903
+ const choice = await showDirectionalConflict(
1904
+ menuContext,
1905
+ direction,
1906
+ review.setupName,
1907
+ signal,
1908
+ isCurrent,
1909
+ async (diffSignal) => {
1910
+ if (!await matchesManagerReview(review.fingerprint, diffSignal)) {
1911
+ return { kind: diffSignal.aborted || !isCurrent() ? "close" : "back" };
1912
+ }
1913
+ return reviewDifferences(review, diffSignal);
1914
+ }
1915
+ );
1904
1916
  if (signal.aborted || !isCurrent() || choice === "close") return { kind: "close" };
1905
1917
  if (choice === "back") return { kind: "stay" };
1906
1918
  if (!await matchesManagerReview(review.fingerprint, signal))
@@ -2029,13 +2041,7 @@ async function showSyncManager(ctx, runRoute, sessionSignal, options = {}) {
2029
2041
  });
2030
2042
  return { kind: result.kind === "closed" ? "close" : "stay" };
2031
2043
  },
2032
- diff: async ({ state, signal }) => {
2033
- const review = state.manager.configReview;
2034
- if (!review) return { kind: "stay" };
2035
- const intent = ctx.mode === "tui" ? { intent: "read-diff", fingerprint: review.fingerprint } : void 0;
2036
- const result = await runRoute("diff", signal, void 0, review.setupName, void 0, void 0, intent);
2037
- return { kind: signal.aborted || !isCurrent() || result?.kind === "closed" ? "close" : "stay" };
2038
- },
2044
+ diff: ({ state, signal }) => reviewDifferences(state.manager.configReview, signal),
2039
2045
  "daemon-recovery": async ({ signal }) => {
2040
2046
  await runRoute("daemon recover", signal);
2041
2047
  return { kind: "stay" };
@@ -2064,6 +2070,13 @@ async function showSyncManager(ctx, runRoute, sessionSignal, options = {}) {
2064
2070
  }
2065
2071
  }
2066
2072
  });
2073
+ async function reviewDifferences(review, signal) {
2074
+ if (signal.aborted || !isCurrent()) return { kind: "close" };
2075
+ if (!review) return { kind: "stay" };
2076
+ const intent = ctx.mode === "tui" ? { intent: "read-diff", fingerprint: review.fingerprint } : void 0;
2077
+ const result = await runRoute("diff", signal, void 0, review.setupName, void 0, void 0, intent);
2078
+ return { kind: signal.aborted || !isCurrent() || result?.kind === "closed" ? "close" : "stay" };
2079
+ }
2067
2080
  async function matchesManagerReview(fingerprint, signal, settings = false) {
2068
2081
  try {
2069
2082
  const config = await (settings ? loadSettingsConfig() : loadConfig());
@@ -2138,37 +2151,44 @@ async function showSyncManager(ctx, runRoute, sessionSignal, options = {}) {
2138
2151
  isCurrent
2139
2152
  });
2140
2153
  }
2141
- async function showDirectionalConflict(ctx, direction, setup, signal, isCurrent) {
2142
- let selected = false;
2154
+ async function showDirectionalConflict(ctx, direction, setup, signal, isCurrent, reviewDifferences) {
2155
+ const isPull = direction === "pull";
2156
+ let force = false;
2143
2157
  const menu = defineMenu5({
2144
2158
  start: "conflict",
2145
2159
  screens: {
2146
2160
  conflict: () => ({
2147
2161
  kind: "choice",
2148
- title: `${direction === "push" ? "Push" : "Pull"} stopped \xB7 ${safeTerminalText(setup)}`,
2162
+ title: `${isPull ? "Pull" : "Push"} stopped \xB7 ${safeTerminalText(setup)}`,
2149
2163
  lines: [
2150
- direction === "push" ? "Push would overwrite remote changes since the last accepted sync." : "Pull would overwrite local changes since the last accepted sync.",
2164
+ isPull ? "Pull would discard local differences." : "Push would discard remote differences.",
2151
2165
  "No content was written."
2152
2166
  ],
2153
2167
  items: [
2154
- { id: "back", label: "Back" },
2155
- { id: "review", label: `Review Force ${direction}\u2026` }
2168
+ { id: "diff", label: "Review differences", description: "Compare files without transferring." },
2169
+ {
2170
+ id: "force",
2171
+ label: `Force ${direction}\u2026`,
2172
+ description: `Review which ${isPull ? "local" : "remote"} files to replace or remove.`
2173
+ },
2174
+ { id: "back", label: "Back" }
2156
2175
  ],
2157
2176
  action: "choose",
2158
- initialItemId: "back",
2177
+ initialItemId: "diff",
2159
2178
  hint: ctx.mode === "rpc" ? "close" : "back"
2160
2179
  })
2161
2180
  },
2162
2181
  actions: {
2163
- choose: ({ itemId }) => {
2164
- selected = itemId === "review";
2182
+ choose: ({ itemId, signal: signal2 }) => {
2183
+ if (itemId === "diff") return reviewDifferences(signal2);
2184
+ force = itemId === "force";
2165
2185
  return { kind: "back" };
2166
2186
  }
2167
2187
  }
2168
2188
  });
2169
2189
  const result = await runMenu5(ctx, menu, { getState: () => void 0, signal, isCurrent });
2170
2190
  if (signal.aborted || !isCurrent() || result.kind !== "closed" || result.reason === "close") return "close";
2171
- return selected ? "review" : "back";
2191
+ return force ? "force" : "back";
2172
2192
  }
2173
2193
  function syncMainMenuItem(label) {
2174
2194
  const actions = {
@@ -2217,4 +2237,4 @@ function syncMainMenuItem(label) {
2217
2237
  export {
2218
2238
  showSyncManager
2219
2239
  };
2220
- //# sourceMappingURL=manager-ui-RQSZLMJ5.ts.map
2240
+ //# sourceMappingURL=manager-ui-HW3ZAEVK.ts.map