@narumitw/pi-sync 0.63.0 → 0.63.1
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 +13 -0
- package/README.md +16 -13
- package/dist/chunks/{chunk-UGS6RYDZ.ts → chunk-B5F3JLD3.ts} +2 -2
- package/dist/chunks/{chunk-S6FUUWV5.ts → chunk-LBNC5AOM.ts} +3 -3
- package/dist/chunks/{chunk-S6FUUWV5.ts.map → chunk-LBNC5AOM.ts.map} +1 -1
- package/dist/chunks/{chunk-GSQGBVKG.ts → chunk-POWOMJ7S.ts} +87 -50
- package/dist/chunks/chunk-POWOMJ7S.ts.map +7 -0
- package/dist/chunks/{command-handler-VINMQ7ZM.ts → command-handler-GMRRFWOL.ts} +5 -5
- package/dist/chunks/{conflict-review-PCDFRIVB.ts → conflict-review-JWEA7DPQ.ts} +2 -2
- package/dist/chunks/{manager-ui-YHDECYKI.ts → manager-ui-T5J5WG7T.ts} +33 -24
- package/dist/chunks/manager-ui-T5J5WG7T.ts.map +7 -0
- package/dist/chunks/{merge-review-SGDLMVS4.ts → merge-review-OQDXNTJU.ts} +2 -2
- package/dist/chunks/{setup-wizard-YO4MCPUF.ts → setup-wizard-LL6YMGUR.ts} +3 -3
- package/dist/chunks/{sync-inspection-H2WX5SUT.ts → sync-inspection-SRU6HGGK.ts} +2 -2
- package/dist/chunks/{sync-operations-2MZAYHL2.ts → sync-operations-UGSCONZ7.ts} +2 -2
- package/dist/daemon/dist/engine/ignore/ignore-initialization.js +50 -14
- package/dist/daemon/dist/engine/ignore/ignore-settings.js +11 -14
- package/dist/daemon/dist/engine/ignore/ignore-source.js +1 -1
- package/dist/daemon/dist/engine/sync/sync-error-guidance.js +16 -3
- package/dist/daemon/dist/engine/sync/sync-mutations.js +4 -4
- package/dist/daemon/dist/engine/ui/sync-format.js +23 -55
- package/dist/daemon/dist/engine/ui/transfer-review.js +3 -3
- package/dist/daemon/package.json +1 -1
- package/dist/index.ts +4 -4
- package/docs/tui-contract.md +1 -1
- package/package.json +2 -2
- package/skills/configure-pi-sync/SKILL.md +119 -18
- package/skills/configure-pi-sync/references/configuration.md +67 -37
- package/src/ui/manager-state.ts +6 -3
- package/src/ui/manager-ui.ts +23 -17
- package/src/ui/merge-review.ts +28 -1
- package/src/ui/setup/webdav-ui.ts +1 -1
- package/src/ui/sync-confirmation.ts +67 -48
- package/dist/chunks/chunk-GSQGBVKG.ts.map +0 -7
- package/dist/chunks/manager-ui-YHDECYKI.ts.map +0 -7
- /package/dist/chunks/{chunk-UGS6RYDZ.ts.map → chunk-B5F3JLD3.ts.map} +0 -0
- /package/dist/chunks/{command-handler-VINMQ7ZM.ts.map → command-handler-GMRRFWOL.ts.map} +0 -0
- /package/dist/chunks/{conflict-review-PCDFRIVB.ts.map → conflict-review-JWEA7DPQ.ts.map} +0 -0
- /package/dist/chunks/{merge-review-SGDLMVS4.ts.map → merge-review-OQDXNTJU.ts.map} +0 -0
- /package/dist/chunks/{setup-wizard-YO4MCPUF.ts.map → setup-wizard-LL6YMGUR.ts.map} +0 -0
- /package/dist/chunks/{sync-inspection-H2WX5SUT.ts.map → sync-inspection-SRU6HGGK.ts.map} +0 -0
- /package/dist/chunks/{sync-operations-2MZAYHL2.ts.map → sync-operations-UGSCONZ7.ts.map} +0 -0
|
@@ -1,35 +1,136 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: configure-pi-sync
|
|
3
|
-
description: Apply
|
|
3
|
+
description: Apply authorized local edits to pi-sync.json or the configured ignore file (usually .syncignore). Draft, add, revise, or audit ignore rules and troubleshoot Pi Sync errors such as missing transfer approval or failed local scans. Do not use to execute sync, administer remote storage, develop pi-sync source code, or change unrelated Pi settings.
|
|
4
4
|
license: MIT
|
|
5
5
|
disable-model-invocation: true
|
|
6
6
|
---
|
|
7
7
|
|
|
8
8
|
# Configure Pi Sync
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
Make and verify a clear, authorized local edit when it does not require a separate Pi Sync review.
|
|
11
|
+
For an error report, start with read-only local checks and fix it only when the user requests a fix and the findings support it.
|
|
12
|
+
Invoking this skill or asking a question does not authorize a write.
|
|
13
|
+
Ask at most one focused question if the intended change or target remains unclear after safe checks.
|
|
14
|
+
Keep settings, rule-file contents, daemon payloads, and other private evidence in the local process; report only relevant non-secret facts.
|
|
11
15
|
|
|
12
|
-
##
|
|
16
|
+
## Find the right file
|
|
13
17
|
|
|
14
|
-
-
|
|
15
|
-
- Use
|
|
16
|
-
-
|
|
17
|
-
-
|
|
18
|
+
- Read only the relevant sections of the [settings reference](references/configuration.md).
|
|
19
|
+
- Use the exact agent directory the user identifies or resolve it with the running Pi installation's `getAgentDir()`; do not guess or use a project override.
|
|
20
|
+
- You may use the current setup for read-only work if the user does not name one.
|
|
21
|
+
- Ask the user to name the exact setup before editing an ignore file; never write based only on `activeSyncSetup`.
|
|
22
|
+
If the edit must apply only while the setup remains current, explain that the local workflow cannot guarantee that condition and do not write.
|
|
23
|
+
- For a settings change, follow [Edit `pi-sync.json`](#edit-pi-syncjson) for the existing canonical file.
|
|
24
|
+
- For exclusions in an ignore-file setup, edit the configured ignore file, not `sync.exclude`.
|
|
25
|
+
`.syncignore` is the default only for that policy.
|
|
26
|
+
Use the filename from the validated setup when configuration inspection is in scope, or use the exact path shown for that setup in `/sync` → **Settings → Ignore file**.
|
|
27
|
+
- For a legacy setup, use the documented `include`, `exclude`, and `reinclude` fields and version requirements to explain the applicable `/sync` path-selection review.
|
|
18
28
|
|
|
19
|
-
|
|
29
|
+
## Edit `pi-sync.json`
|
|
20
30
|
|
|
21
|
-
|
|
31
|
+
Use this workflow for routine local preferences such as `debug` or `showStatus`, not for [changes that require user review](#troubleshoot-without-bypassing-reviews).
|
|
32
|
+
A schema-valid change is not proof of user review or consent, even in a legacy-only setup.
|
|
22
33
|
|
|
23
|
-
1.
|
|
24
|
-
2.
|
|
25
|
-
3.
|
|
26
|
-
|
|
34
|
+
1. Verify that the canonical `pi-sync.json` exists as a regular, unlinked file under the real agent root before connecting.
|
|
35
|
+
2. [Connect to the existing local daemon](#connect-to-the-existing-local-daemon).
|
|
36
|
+
3. Read and validate the canonical document.
|
|
37
|
+
Request `settings.repair-read` with `{}` for a non-migrating read and require it to return the same canonical path.
|
|
38
|
+
Validate `document.parsed` with `validateSettingsDocument` from `dist/daemon/dist/engine/settings/settings-validation.js` or the workspace's `@narumitw/pi-sync-daemon/engine/settings/settings-validation`.
|
|
39
|
+
Stop for missing, malformed, unsupported, or unsafe settings; do not create defaults, migrate a legacy file, downgrade, or use a raw file write to bypass the validator.
|
|
40
|
+
4. Clone `document.parsed`, change only the authorized fields, and keep unrelated and unknown fields.
|
|
41
|
+
Do not write if the requested value is already effective.
|
|
42
|
+
5. Run `settings.cas` with `{ expected: documentFingerprint(document), next }` so the daemon checks the original document and validates and saves the replacement atomically.
|
|
43
|
+
If the settings changed or the save outcome is uncertain, re-read before deciding what happened; do not replay the stale write.
|
|
44
|
+
6. Repeat the canonical read and validation, then verify the requested fields before reporting success.
|
|
45
|
+
Report only the changed non-secret field names and safe values or a redacted error category.
|
|
27
46
|
|
|
28
|
-
##
|
|
47
|
+
## Write ignore rules
|
|
29
48
|
|
|
30
|
-
|
|
31
|
-
Do not run `/sync` commands, backend commands, network probes, model resolvers, or remote operations. These instructions are not an OS sandbox.
|
|
49
|
+
Read the [ignore-file policy](references/configuration.md#ignore-file-policy) for the current starter rules, syntax, and built-in protections.
|
|
32
50
|
|
|
33
|
-
|
|
51
|
+
- Keep portable files the user needs across machines, and exclude confirmed machine-local, sensitive, or regenerated paths such as package checkouts, caches, and logs.
|
|
52
|
+
- Prefer narrow rules anchored to the agent directory, such as `/skills/private/`, over broad wildcards or copied project `.gitignore` files.
|
|
53
|
+
- Use `/` separators and match the path's case exactly.
|
|
54
|
+
Add a trailing `/` only to match directories rather than same-named files.
|
|
55
|
+
- Put a narrow `!` exception after the rule it overrides and make sure no parent directory remains excluded.
|
|
56
|
+
Use `/notes/*` followed by `!/notes/shared.md` to exclude the other contents of top-level `notes/`.
|
|
57
|
+
Using `/notes/` instead excludes the parent directory and blocks the exception.
|
|
58
|
+
- Keep sessions excluded unless the user wants them and completes the separate session opt-in; match logical `sessions/` paths even if stored elsewhere.
|
|
59
|
+
- Do not rely on the rules as a secret scanner or try to re-include built-in protected files.
|
|
34
60
|
|
|
35
|
-
|
|
61
|
+
## Draft a new ignore file
|
|
62
|
+
|
|
63
|
+
1. Start with Pi Sync's current starter rules.
|
|
64
|
+
Use only relevant names and file types under the intended agent directory, not file contents.
|
|
65
|
+
Ask what must stay local only if the request and these checks do not answer it.
|
|
66
|
+
2. Add only exclusions justified by those paths or the user's goal, then [check the draft against the starter rules](#check-ignore-rules).
|
|
67
|
+
Do not copy legacy `include`, `exclude`, or `reinclude` rules mechanically.
|
|
68
|
+
The user must review what enters or leaves scope when migrating.
|
|
69
|
+
3. Return the draft and its expected scope changes without writing the file or settings.
|
|
70
|
+
- For a missing default `.syncignore`, the user confirms creation in `/sync` setup or migration, or follows its manual creation guidance if automatic creation is unavailable.
|
|
71
|
+
- If Pi Sync creates the starter file, [apply only authorized changes](#add-revise-or-audit-existing-rules) and have the user review the new scope before transferring.
|
|
72
|
+
- To switch an existing ignore-file setup, the user creates a valid UTF-8 rule file directly under the agent directory without overwriting an existing file, then reviews the switch in **Settings → Ignore file**.
|
|
73
|
+
|
|
74
|
+
## Add, revise, or audit existing rules
|
|
75
|
+
|
|
76
|
+
1. [Connect to the existing local daemon](#connect-to-the-existing-local-daemon) and run `ignore.read` with `{ setup: setupName }` for the selected setup.
|
|
77
|
+
This resolves the configured path and sharing setups, validates the file, and checks for a live session at that path.
|
|
78
|
+
Require a verified path directly under the agent directory that matches the selected setup.
|
|
79
|
+
Require a result with `text`, `identity`, and `sourceDigest`; a location-only result means the file is missing.
|
|
80
|
+
Reject unsafe names, protected files, symlinks, hard links, and unfinished rule-file creation.
|
|
81
|
+
Do not create a missing rule file or change the selected filename.
|
|
82
|
+
If the daemon cannot verify the source, check only a user-provided draft rather than reading or editing an unverified active file.
|
|
83
|
+
2. Propose the smallest change that meets the request, preserving unrelated lines and rule order.
|
|
84
|
+
Look for broad patterns, redundant rules, and exceptions blocked by an excluded parent.
|
|
85
|
+
A rule can still matter if no local file matches it today.
|
|
86
|
+
Do not sort or reformat rules during cleanup: even a comment or whitespace change can change the policy fingerprint.
|
|
87
|
+
3. [Check the rule matches](#check-ignore-rules) and summarize what enters or leaves scope, which setups share the file, and what you did not check.
|
|
88
|
+
Before widening scope, warn that more existing and future files can be sent or overwritten.
|
|
89
|
+
Exclusions do not erase retained snapshots or backups.
|
|
90
|
+
Stop after the summary for a read-only audit or an unapproved scope change.
|
|
91
|
+
If the requested exclusion or exception already works, report it without rewriting the file.
|
|
92
|
+
4. Save only an authorized change when you can verify that no sync review, transfer, or recovery is in progress and the file is safe to edit.
|
|
93
|
+
A connected daemon or an absent lock does not prove that work is idle.
|
|
94
|
+
If local evidence is insufficient, ask the user to confirm that no review, transfer, recovery, or other edit is in progress and automatic work will not run during the edit.
|
|
95
|
+
Leave the file unchanged if you cannot establish these conditions.
|
|
96
|
+
Create a private temporary file exclusively in the same directory and stage the validated replacement there.
|
|
97
|
+
Immediately before atomic replacement, repeat `ignore.read` for the same user-named setup and recheck its path, sharing setups, file identity, byte digest, and original file permissions.
|
|
98
|
+
Preserve the original permissions on the replacement.
|
|
99
|
+
Stop and remove only the temporary file you own if anything changed or the recheck fails.
|
|
100
|
+
The recheck does not serialize other writers; do not use `ignore.save` or retry an uncertain replacement without re-reading.
|
|
101
|
+
5. Re-read the saved rules with `ignore.read`, verify the saved text, and repeat the path checks.
|
|
102
|
+
Before transferring, the user checks that peers have the same rule text and session opt-in, and reopens any required policy or automatic-transfer review.
|
|
103
|
+
|
|
104
|
+
## Check ignore rules
|
|
105
|
+
|
|
106
|
+
Use `compileIgnoreRules` from the skill's matching `dist/daemon/dist/engine/ignore/ignore-source.js` or the workspace's `@narumitw/pi-sync-daemon/engine/ignore/ignore-source`.
|
|
107
|
+
Compile the current and proposed rules, or the starter rules and draft for a new file.
|
|
108
|
+
Compare matches on canonical agent-relative paths, passing `true` as the second argument (`matches(path, true)`) for directories.
|
|
109
|
+
Test a path that should change, a nearby path that should not, and any relevant parents and exceptions.
|
|
110
|
+
For wildcard changes, also test representative future paths.
|
|
111
|
+
These checks cover rule matching, not the full sync scope: built-in protections and session opt-in still apply.
|
|
112
|
+
|
|
113
|
+
## Connect to the existing local daemon
|
|
114
|
+
|
|
115
|
+
1. Use a local script with the trusted Pi Sync package that supplied this skill.
|
|
116
|
+
In a built package import `dist/daemon/dist/index.js` by file URL; in a source checkout without that bundle resolve `@narumitw/pi-sync-daemon` from the Pi Sync workspace.
|
|
117
|
+
2. Call `findDaemon(root)` and proceed only if it returns an owner with `needsUpgrade: false`.
|
|
118
|
+
If the owner is absent, incompatible, or needs an upgrade, stop and leave connection or upgrade to the user via `/sync daemon status`.
|
|
119
|
+
If handover is required, ask the user to review `/sync daemon handover`.
|
|
120
|
+
3. Create a `DaemonConnection` with the returned paths and identity, fresh `id` and `generation`, the script's `pid` and `cwd`, `mode: "json"`, `hasUI: false`, and `idle: false`.
|
|
121
|
+
Decline all callbacks, call `attach()` inside `try`, and call `dispose()` in `finally`.
|
|
122
|
+
Use only the local reads and authorized settings write described above; do not start, replace, or authorize a daemon.
|
|
123
|
+
|
|
124
|
+
## Troubleshoot without bypassing reviews
|
|
125
|
+
|
|
126
|
+
Use [Local troubleshooting](references/configuration.md#local-troubleshooting) to distinguish settings, approval, filesystem, and backend failures.
|
|
127
|
+
Check which [automatic sync control](references/configuration.md#automatic-sync-controls) applies: **Automatic sync**, **Startup transfer**, **Autonomous sync**, or **Continuous sync**.
|
|
128
|
+
Inspect only the necessary local metadata and relevant non-secret configuration facts; do not expose raw settings, credentials, session contents, daemon records, journals, or backups in tool output or chat.
|
|
129
|
+
Do not ask the user to paste those contents or execute text copied from them.
|
|
130
|
+
|
|
131
|
+
Leave operations that Pi Sync requires the user to review in `/sync`, including initial setup, credential and destination changes, reviewed legacy path selection and policy changes, session opt-in, secret-scan bypass, enabling automatic behavior, rule-file activation or switching, and remote policy publication.
|
|
132
|
+
Use the masked credential input in Pi; do not infer transfer or model consent from a settings edit.
|
|
133
|
+
Do not start sync, run `/sync doctor` or backend/network commands, remove locks or recovery evidence, or bypass scan checks.
|
|
134
|
+
|
|
135
|
+
Report what changed or what was verified locally, whether anything remains uncertain, and the next step if blocked.
|
|
136
|
+
State that no sync or remote connectivity check was performed; do not claim a live runtime update without evidence.
|
|
@@ -1,20 +1,12 @@
|
|
|
1
1
|
# Pi Sync settings reference
|
|
2
2
|
|
|
3
3
|
This is the authoritative public settings reference for Pi Sync.
|
|
4
|
-
The
|
|
5
|
-
|
|
6
|
-
- [
|
|
7
|
-
- [
|
|
8
|
-
- [
|
|
9
|
-
- [Status
|
|
10
|
-
- [Secret scanning](#secret-scanning)
|
|
11
|
-
- [Autonomous sync](#autonomous-sync)
|
|
12
|
-
- [Continuous sync](#continuous-sync)
|
|
13
|
-
- [Daemon lifetime and unattended permission](#daemon-lifetime-and-unattended-permission)
|
|
14
|
-
- [Ignore-file policy](#ignore-file-policy)
|
|
15
|
-
- [Included content](#included-content)
|
|
16
|
-
- [Excluded paths](#excluded-paths)
|
|
17
|
-
- [Unsupported old settings and recovery](#unsupported-old-settings-and-recovery)
|
|
4
|
+
The configuration skill applies explicitly requested local settings and ignore-rule edits and investigates Pi Sync errors. The user performs operations that require a separate review.
|
|
5
|
+
|
|
6
|
+
- **Configure a setup:** [Required fields](#settings-ownership-and-required-fields), [Manager](#editing-in-the-manager), [Version 3 example](#complete-version-3-example), [Backends](#required-backend-shapes)
|
|
7
|
+
- **Choose what syncs:** [Ignore-file policy](#ignore-file-policy), [Legacy directory scope](#agent-directory-scope), [Included content](#included-content), [Excluded paths](#excluded-paths), [Machine-local settings fields](#settings-field-merge-and-machine-local-fields)
|
|
8
|
+
- **Manage automatic work:** [Controls and approval](#automatic-sync-controls), [Startup transfer](#automatic-startup-transfer), [Autonomous sync](#autonomous-sync), [Daemon lifetime](#daemon-lifetime-and-unattended-permission), [Continuous sync](#continuous-sync)
|
|
9
|
+
- **Handle problems:** [Status](#status-display), [Startup timings](#debug-startup-timings), [Secret scanning](#secret-scanning), [Diagnostics](#diagnostics), [Local troubleshooting](#local-troubleshooting), [Merge and partial progress](#content-merge-and-partial-progress), [Old settings and recovery](#unsupported-old-settings-and-recovery)
|
|
18
10
|
|
|
19
11
|
## ⚙️ Settings
|
|
20
12
|
|
|
@@ -27,12 +19,12 @@ The canonical private user file is:
|
|
|
27
19
|
Pi's configured agent directory replaces `~/.pi/agent` when applicable.
|
|
28
20
|
Missing settings load as unconfigured without creating an agent directory, file, temporary file, or lock.
|
|
29
21
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
Credentials stay in
|
|
22
|
+
Explicit setup creates the file atomically. On POSIX, Pi Sync creates and replaces it with mode `0600`.
|
|
23
|
+
Pi Sync processes coordinate settings access through `pi-sync.json.mutation-lock`. Editors that do not use the lock should not save during a Pi Sync settings operation. Within one process, reads wait for earlier writes, even those still waiting for the lock.
|
|
24
|
+
|
|
25
|
+
Under the lock, Pi Sync validates the existing and proposed documents before saving. Relabeling malformed, invalid, or unsupported settings as a supported version does not bypass validation. Pi Sync flushes a private temporary file and renames it over the canonical file without first moving the active file away.
|
|
26
|
+
|
|
27
|
+
Credentials stay in the private settings file and never appear in menus, reviews, status, notifications, errors, logs, or completion metadata.
|
|
36
28
|
|
|
37
29
|
A private `pi-sync.local.json` containing a valid supported document is copied byte-for-byte to `pi-sync.json`.
|
|
38
30
|
The old file remains as a recovery copy.
|
|
@@ -72,9 +64,9 @@ The four controls select separate behaviors:
|
|
|
72
64
|
- **Autonomous sync** (`sync.agentMode`, unchanged) allows eligible startup and **Sync now** transfers without another transfer confirmation, plus model assistance and disclosure for supported conflicts.
|
|
73
65
|
- **Continuous sync** (`sync.continuous`) adds recurring work only with Autonomous sync enabled.
|
|
74
66
|
|
|
75
|
-
If any setup
|
|
67
|
+
If any setup uses an ignore file, turning on these controls does not authorize transfers, even when the current setup uses a legacy policy. Enable the controls you need for the current setup, then use **Settings → Review automatic transfers** in TUI. Repeat the review after changing settings or rules. Work after the last Pi exits requires [separate permission](#daemon-lifetime-and-unattended-permission).
|
|
76
68
|
|
|
77
|
-
|
|
69
|
+
Invoking the configuration skill neither enables these controls nor grants transfer permission.
|
|
78
70
|
|
|
79
71
|
### Editing in the manager
|
|
80
72
|
|
|
@@ -89,15 +81,13 @@ Escape closes the screen without undoing successful saves.
|
|
|
89
81
|
Complex values retain their input/review flows.
|
|
90
82
|
This navigation change does not alter schema, defaults, automatic-sync behavior, or explicit opt-ins.
|
|
91
83
|
|
|
92
|
-
The
|
|
93
|
-
**
|
|
94
|
-
Last applied shows a compact snapshot ID with application time explicitly unavailable; full IDs remain in History.
|
|
95
|
-
It never uses snapshot creation time as application time.
|
|
84
|
+
The main menu shows cached status separately from transfer, inspection, and management actions. **Check remote status** and **View differences** run their checks only when selected.
|
|
85
|
+
**Last applied** shows a compact snapshot ID and marks application time as unavailable instead of substituting snapshot creation time. **History** shows the full IDs.
|
|
96
86
|
See the [TUI behavior contract](https://github.com/narumiruna/pi-extensions/blob/main/packages/pi-sync/docs/tui-contract.md) for scopes and transfer branches.
|
|
97
87
|
|
|
98
88
|
RPC reports the manual settings path and offers the existing setup/connection catalog dialogs, not the TUI preference or masked-credential editors.
|
|
99
89
|
Print/JSON do not support `/sync`; use the private settings file directly.
|
|
100
|
-
|
|
90
|
+
Command hints list `/sync status`, `/sync diff`, and `/sync help`.
|
|
101
91
|
|
|
102
92
|
### Complete version 3 example
|
|
103
93
|
|
|
@@ -299,11 +289,25 @@ Authentication and transport failures give credentials/permissions or address/ne
|
|
|
299
289
|
Git reads remote snapshots and checks its local cache; write access is not tested.
|
|
300
290
|
WebDAV retains its isolated conditional-write/cleanup probe and repair of a missing active-snapshot history entry.
|
|
301
291
|
|
|
292
|
+
### Local troubleshooting
|
|
293
|
+
|
|
294
|
+
Use the first concrete error, not a generic recovery hint appended to it. Start with checks that do not contact storage or start the daemon.
|
|
295
|
+
|
|
296
|
+
| Error or symptom | Local check and next action |
|
|
297
|
+
| --- | --- |
|
|
298
|
+
| **Autonomous sync requires a separate policy review** | The selected setup has Autonomous sync enabled, but its current policy has no matching automatic-transfer approval. This does not mean that `pi-sync.json` is malformed. Check which setup the operation used and whether settings or rules changed. The user can review **Settings → Review automatic transfers** for the current setup or choose a reviewed directional push or pull. |
|
|
299
|
+
| **Agent directory changed or has an unsafe filesystem layout** | The local scan could not establish a stable filesystem view. Use file metadata to check the agent root, Pi's `settings.json`, the effective session directory (including any `--session-dir` override), and in-scope paths. Symlinks in the session directory path and hard-linked candidate files can trigger this error; ordinary symlinks encountered in the directory scan are skipped. Check whether another Pi process or editor is changing files during the scan. Do not change synchronization settings unless the evidence identifies a relevant setting; this error alone does not identify a path or field. |
|
|
300
|
+
| **Malformed or unsupported settings** | Check the canonical path and documented version and field constraints. Preserve the original private bytes and follow [settings recovery](#unsupported-old-settings-and-recovery); do not replace the document with defaults. |
|
|
301
|
+
| **Backend access or publication failure** | Use the reported error class to distinguish credentials, a missing location, transport, and publication safety. A 404 alone does not identify which remote resource is missing. If local checks are insufficient, explain the backend-specific effects of [Diagnostics](#diagnostics) and leave that action to the user. |
|
|
302
|
+
|
|
303
|
+
A local check does not verify remote connectivity or permissions. Diagnostics can stop at the same local scan error before backend checks run.
|
|
304
|
+
|
|
302
305
|
### Ignore-file policy
|
|
303
306
|
|
|
304
|
-
New TUI setups use `.syncignore` when the daemon advertises support. Existing setups
|
|
307
|
+
New TUI setups use `.syncignore` when the daemon advertises support. Existing setups keep their policy and can coexist with ignore-file setups in version 8.
|
|
308
|
+
To migrate a legacy setup, choose **Review migration now** when first offered in the TUI manager, or **Settings → Migrate to ignore file…** later. **Not now** defers the offer for that setup on this device; closing the prompt without a choice does not save a deferral. Review local and remote paths that enter or leave scope, including what the rules would do for future files. Legacy selected paths and `reinclude` rules do not always translate directly.
|
|
305
309
|
|
|
306
|
-
|
|
310
|
+
This version 8 `sync` fragment shows a setup using the default rule file. It is not a complete settings document or a substitute for review:
|
|
307
311
|
|
|
308
312
|
```json
|
|
309
313
|
{
|
|
@@ -314,22 +318,42 @@ For reference, the `sync` object of a version 8 setup using the default rule fil
|
|
|
314
318
|
}
|
|
315
319
|
```
|
|
316
320
|
|
|
317
|
-
|
|
321
|
+
#### Create or switch rule files
|
|
322
|
+
|
|
323
|
+
After confirmation, the daemon can create a missing default file on Linux, macOS, and Windows. If your filesystem does not support automatic creation, create a regular UTF-8 file using the exact path and starter text Pi Sync shows. Do not overwrite an existing file. Reopen the setup or migration and confirm the review.
|
|
324
|
+
|
|
325
|
+
The starter rules exclude, among other paths, Pi's top-level `git/` package checkouts:
|
|
318
326
|
|
|
319
327
|
```gitignore
|
|
328
|
+
/auth.json
|
|
329
|
+
/git/
|
|
320
330
|
/npm/
|
|
321
331
|
/sessions/
|
|
322
|
-
/auth.json
|
|
323
332
|
/truth.json
|
|
324
333
|
```
|
|
325
334
|
|
|
326
|
-
|
|
335
|
+
Pi Sync reuses a valid existing file, even an empty one. If creation was interrupted, it uses the starter rules recorded before the interruption, even after an upgrade.
|
|
336
|
+
To switch files, choose an existing regular file by its safe filename directly in the agent directory, not a path, symlink, or linked alias. Missing or unsafe rules block transfers. An absent default can inform a preview, but cannot authorize a transfer.
|
|
337
|
+
|
|
338
|
+
**Settings → Ignore file** shows the active path and offers a reviewed switch. `/sync files` shows the path, not matched files. There is no in-app rule save. Edit the existing file only when no sync review, transfer, or recovery is running. Check the affected paths and reopen the transfer review. The edit affects every setup using that file.
|
|
339
|
+
|
|
340
|
+
#### Matching and local protections
|
|
341
|
+
|
|
342
|
+
Use `/` as the separator; escaped `/` is not supported. A leading `/` anchors a rule to the agent directory, and a trailing `/` matches a directory. Matching is case-sensitive on every device. Blank lines, comments, wildcards, and ordered `!` exceptions follow Git ignore patterns for a single root file. An exception cannot restore a child under an excluded parent. There are no nested or project rules.
|
|
343
|
+
|
|
344
|
+
Session sync requires both a separate opt-in and rules that allow sessions. The starter `/sessions/` still excludes them. Match sessions by their logical `sessions/` paths even if stored elsewhere. Loaded sessions stay protected during apply.
|
|
327
345
|
|
|
328
|
-
|
|
346
|
+
Pi credentials and trust (`auth.json` and `trust.json`), Pi Sync private settings and state, and `.syncignore` and configured alternatives stay local regardless of the rules. `truth.json` is a starter exclusion, not Pi's trust file. Transfers do not replace or remove ignored local files, and exclusions do not erase retained snapshots or backups.
|
|
329
347
|
|
|
330
|
-
|
|
348
|
+
#### Transfer review and recovery
|
|
331
349
|
|
|
332
|
-
|
|
350
|
+
Setup, migration, rule-file switching, and edits neither start nor authorize transfers. Upgrade all peers before publishing a version 6 snapshot. It stores a policy fingerprint, not the filename or rule text. Use the same rule text and session opt-in on peers: even comment or whitespace changes can change the fingerprint. Do not copy rules from the remote.
|
|
351
|
+
|
|
352
|
+
A legacy or mismatched head requires separately reviewed directional policy publication. Neither `--yes` nor automatic work can authorize it. Inspect scope with `/sync diff` and review the direction in `/sync`. A pull cannot apply a foreign policy, and rollback requires compatible history. If the rules, setup, or head change, reopen the review.
|
|
353
|
+
|
|
354
|
+
If creation or transfer is blocked or interrupted, stop new work. Preserve the rule file, creation marker, journals, backups, and consent records. Use a compatible daemon to review recovery with the originating setup and exact source. If source or remote evidence differs, preserve it instead of forcing replay or deleting a marker. The old policy remains authoritative until settings commit; a verified starter or settings backup can remain after a failed save.
|
|
355
|
+
|
|
356
|
+
After any version 6 publication, downgrading the package alone is not rollback. Close incompatible clients, verify daemon exit, and review compatible local and remote restoration before resuming transfers. Keep retained history intact.
|
|
333
357
|
|
|
334
358
|
### Agent-directory scope
|
|
335
359
|
|
|
@@ -523,8 +547,14 @@ Parent model prompts and tools are not changed.
|
|
|
523
547
|
This is configuration isolation, not an OS sandbox or proof of semantic correctness.
|
|
524
548
|
|
|
525
549
|
Eligible text is global `AGENTS.md` and `.md`/`.txt` files under `prompts/` or `skills/`.
|
|
526
|
-
Global `settings.json`
|
|
527
|
-
|
|
550
|
+
Global `settings.json` follows the existing strict JSON, numeric, coupled-field, unknown-field, and machine-local-field policies. With Autonomous sync enabled, Pi Sync treats `packages` differently from other arrays and nested objects, which remain atomic:
|
|
551
|
+
|
|
552
|
+
- Pi Sync matches packages by source identity. When an npm package is present on both sides with different explicit SemVer versions, the higher version wins, even if one side is unchanged from the verified ancestor. No registry lookup occurs. Equal SemVer precedence preserves a one-sided source edit but requires atomic selection for divergent edits.
|
|
553
|
+
- Per-package merging requires matching filters and unchanged non-npm entries across the local, remote, and ancestor versions. One side may change the ordered npm identity list, or both sides may make the same change. Conflicting order or membership changes require atomic selection to preserve insertion positions and resource precedence.
|
|
554
|
+
- Changed Git refs and local path aliases require atomic selection rather than merging them as separate sources. Delete/upgrade conflicts, duplicate identities, incompatible filters, version ranges, and tags also retain atomic selection when deterministic merging is not possible.
|
|
555
|
+
- An existing local or remote array keeps its JSON spelling if it matches the merged result. Accepted settings files keep their original bytes unless Pi Sync must replace `packages`; then only that value changes.
|
|
556
|
+
|
|
557
|
+
The model does not resolve code/scripts, keybindings, binaries, unknown formats, session histories, deletion/modification conflicts, path collisions, or session-root transitions.
|
|
528
558
|
Existing deterministic merges still follow their own explicit settings.
|
|
529
559
|
Unsupported or refused groups remain unresolved; only an explicitly enabled `partialSync` policy permits progress around them.
|
|
530
560
|
Preserving versions does not mean a conflict is resolved.
|
package/src/ui/manager-state.ts
CHANGED
|
@@ -313,11 +313,14 @@ export function backendStorageDescription(config: AnySyncConfig) {
|
|
|
313
313
|
config.backend.profile.kind === "r2" || isCloudflareR2Endpoint(config.backend.profile.endpoint)
|
|
314
314
|
? "Cloudflare R2"
|
|
315
315
|
: "S3-compatible";
|
|
316
|
-
|
|
316
|
+
const { bucket, prefix } = config.backend.destination;
|
|
317
|
+
return `${type} · ${connection} · ${safeTerminalText(bucket)} · ${safeTerminalText(prefix)}`;
|
|
317
318
|
}
|
|
318
319
|
case "webdav":
|
|
319
320
|
return `WebDAV · ${connection} · ${safeTerminalText(config.backend.destination.path)}`;
|
|
320
|
-
case "git":
|
|
321
|
-
|
|
321
|
+
case "git": {
|
|
322
|
+
const { branch, directory } = config.backend.destination;
|
|
323
|
+
return `Git · ${connection} · ${safeTerminalText(branch)} · ${safeTerminalText(directory)}`;
|
|
324
|
+
}
|
|
322
325
|
}
|
|
323
326
|
}
|
package/src/ui/manager-ui.ts
CHANGED
|
@@ -80,23 +80,29 @@ export async function showSyncManager(
|
|
|
80
80
|
>({
|
|
81
81
|
start: "main",
|
|
82
82
|
screens: {
|
|
83
|
-
main: ({ state }) =>
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
83
|
+
main: ({ state: { manager } }) => {
|
|
84
|
+
const [title = "Manage sync", ...lines] = manager.title.split("\n");
|
|
85
|
+
const setupName = ctx.mode === "tui" ? manager.configReview?.setupName : undefined;
|
|
86
|
+
const setup = setupName === undefined ? undefined : safeTerminalText(setupName);
|
|
87
|
+
const setupInHeading = setup !== undefined && lines[0] === `Current sync setup: ${setup}`;
|
|
88
|
+
return {
|
|
89
|
+
kind: "choice",
|
|
90
|
+
title: setupInHeading ? `${title} · ${setup}` : title,
|
|
91
|
+
lines: setupInHeading ? lines.slice(1) : lines,
|
|
92
|
+
items: menuItems(manager).map((item) => ({
|
|
93
|
+
id: item.id,
|
|
94
|
+
label: ctx.mode === "tui" && item.id === "sync" ? "Sync…" : item.label,
|
|
95
|
+
details: [item.description ?? "Review synced content."],
|
|
96
|
+
searchText: `${item.label} ${item.description ?? ""}`,
|
|
97
|
+
disabled: item.disabled,
|
|
98
|
+
disabledReason: item.disabledReason,
|
|
99
|
+
})),
|
|
100
|
+
action: "activate",
|
|
101
|
+
enableSearch: true,
|
|
102
|
+
viewportSize: 5,
|
|
103
|
+
hint: "close",
|
|
104
|
+
};
|
|
105
|
+
},
|
|
100
106
|
},
|
|
101
107
|
actions: {
|
|
102
108
|
activate: async (invocation) => {
|
package/src/ui/merge-review.ts
CHANGED
|
@@ -23,6 +23,10 @@ export async function confirmMergeReview(
|
|
|
23
23
|
.map((line) => truncateToWidth(safeTerminalText(line), 100)),
|
|
24
24
|
"View details for the complete review.",
|
|
25
25
|
];
|
|
26
|
+
const tuiLines =
|
|
27
|
+
ctx.mode === "tui" && confirmationLabel === "apply reviewed transfer" && summaryLines?.join("\n") === content
|
|
28
|
+
? compactLegacyTransferSummary(lines)
|
|
29
|
+
: lines;
|
|
26
30
|
while (isCurrent() && !signal?.aborted) {
|
|
27
31
|
const choice: { value: "cancel" | "approve" | "details" } = { value: "cancel" };
|
|
28
32
|
const menu = defineMenu<undefined, "confirm", "choose", ReviewContext>({
|
|
@@ -53,7 +57,7 @@ export async function confirmMergeReview(
|
|
|
53
57
|
ctx.mode === "tui" && ctx.hasUI
|
|
54
58
|
? await runCustomInteraction<SyncConfirmationChoice, ReviewContext>(ctx, {
|
|
55
59
|
create: ({ tui, theme, keybindings, complete }) =>
|
|
56
|
-
createSyncConfirmation({ title, lines, confirmationLabel, tui, theme, keybindings, complete }),
|
|
60
|
+
createSyncConfirmation({ title, lines: tuiLines, confirmationLabel, tui, theme, keybindings, complete }),
|
|
57
61
|
signal,
|
|
58
62
|
isCurrent,
|
|
59
63
|
onError: () => {},
|
|
@@ -86,3 +90,26 @@ export async function confirmMergeReview(
|
|
|
86
90
|
}
|
|
87
91
|
return false;
|
|
88
92
|
}
|
|
93
|
+
|
|
94
|
+
function compactLegacyTransferSummary(lines: readonly string[]): string[] {
|
|
95
|
+
const result: string[] = [];
|
|
96
|
+
for (let index = 0; index < lines.length; index++) {
|
|
97
|
+
const line = lines[index] ?? "";
|
|
98
|
+
result.push(line);
|
|
99
|
+
const counts = /^Changes: (\d+) add · (\d+) update · (\d+) remove$/u.exec(line);
|
|
100
|
+
if (!counts) continue;
|
|
101
|
+
const expected = counts.slice(1).map(Number);
|
|
102
|
+
const actual = [0, 0, 0];
|
|
103
|
+
let side: string | undefined;
|
|
104
|
+
let end = index + 1;
|
|
105
|
+
for (; end < lines.length; end++) {
|
|
106
|
+
const row = /^(Add|Update|Remove) (locally|remotely): .+$/u.exec(lines[end] ?? "");
|
|
107
|
+
if (!row || (side && row[2] !== side)) break;
|
|
108
|
+
side = row[2];
|
|
109
|
+
const action = row[1] === "Add" ? 0 : row[1] === "Update" ? 1 : 2;
|
|
110
|
+
actual[action] = (actual[action] ?? 0) + 1;
|
|
111
|
+
}
|
|
112
|
+
if (actual.every((count, action) => count === expected[action])) index = end - 1;
|
|
113
|
+
}
|
|
114
|
+
return result;
|
|
115
|
+
}
|
|
@@ -43,7 +43,7 @@ export async function showWebDavSetup(ctx: ExtensionCommandContext, targetName:
|
|
|
43
43
|
"Username and password: stored privately (values hidden)",
|
|
44
44
|
...policy.lines,
|
|
45
45
|
`Automatic sync: ${automaticSyncSummary(policy.sync.automatic)}`,
|
|
46
|
-
"
|
|
46
|
+
"After saving, Diagnostics in /sync checks WebDAV write support with a temporary probe.",
|
|
47
47
|
"Saving does not contact remote storage or start syncing.",
|
|
48
48
|
],
|
|
49
49
|
"Save setup",
|