pushwork 1.0.5 → 1.0.7

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 (204) hide show
  1. package/README.md +87 -335
  2. package/dist/.pushwork/automerge/3P/Dm3ekE2pmjGnWvDaG3vSR7ww98/snapshot/aa2349c94955ea561f698720142f9d884a6872d9f82dc332d578c216beb0df0e +0 -0
  3. package/dist/.pushwork/automerge/st/orage-adapter-id +1 -0
  4. package/dist/.pushwork/config.json +15 -0
  5. package/dist/.pushwork/snapshot.json +7 -0
  6. package/dist/cli.js +208 -213
  7. package/dist/cli.js.map +1 -1
  8. package/dist/commands.d.ts +51 -0
  9. package/dist/commands.d.ts.map +1 -0
  10. package/dist/commands.js +799 -0
  11. package/dist/commands.js.map +1 -0
  12. package/dist/core/change-detection.d.ts +2 -23
  13. package/dist/core/change-detection.d.ts.map +1 -1
  14. package/dist/core/change-detection.js +73 -115
  15. package/dist/core/change-detection.js.map +1 -1
  16. package/dist/{config/index.d.ts → core/config.d.ts} +13 -3
  17. package/dist/core/config.d.ts.map +1 -0
  18. package/dist/{config/index.js → core/config.js} +55 -73
  19. package/dist/core/config.js.map +1 -0
  20. package/dist/core/index.d.ts +1 -0
  21. package/dist/core/index.d.ts.map +1 -1
  22. package/dist/core/index.js +1 -1
  23. package/dist/core/index.js.map +1 -1
  24. package/dist/core/move-detection.d.ts +4 -3
  25. package/dist/core/move-detection.d.ts.map +1 -1
  26. package/dist/core/move-detection.js +8 -7
  27. package/dist/core/move-detection.js.map +1 -1
  28. package/dist/core/snapshot.d.ts +0 -4
  29. package/dist/core/snapshot.d.ts.map +1 -1
  30. package/dist/core/snapshot.js +2 -11
  31. package/dist/core/snapshot.js.map +1 -1
  32. package/dist/core/sync-engine.d.ts +5 -11
  33. package/dist/core/sync-engine.d.ts.map +1 -1
  34. package/dist/core/sync-engine.js +211 -308
  35. package/dist/core/sync-engine.js.map +1 -1
  36. package/dist/index.d.ts +0 -1
  37. package/dist/index.d.ts.map +1 -1
  38. package/dist/index.js +0 -6
  39. package/dist/index.js.map +1 -1
  40. package/dist/types/config.d.ts +24 -88
  41. package/dist/types/config.d.ts.map +1 -1
  42. package/dist/types/config.js +6 -0
  43. package/dist/types/config.js.map +1 -1
  44. package/dist/types/documents.d.ts +15 -2
  45. package/dist/types/documents.d.ts.map +1 -1
  46. package/dist/types/documents.js.map +1 -1
  47. package/dist/types/index.d.ts.map +1 -1
  48. package/dist/types/index.js +0 -3
  49. package/dist/types/index.js.map +1 -1
  50. package/dist/types/snapshot.d.ts +0 -21
  51. package/dist/types/snapshot.d.ts.map +1 -1
  52. package/dist/types/snapshot.js +0 -14
  53. package/dist/types/snapshot.js.map +1 -1
  54. package/dist/utils/content.d.ts.map +1 -1
  55. package/dist/utils/content.js +2 -6
  56. package/dist/utils/content.js.map +1 -1
  57. package/dist/utils/directory.d.ts +10 -0
  58. package/dist/utils/directory.d.ts.map +1 -0
  59. package/dist/utils/directory.js +37 -0
  60. package/dist/utils/directory.js.map +1 -0
  61. package/dist/utils/fs.d.ts +15 -2
  62. package/dist/utils/fs.d.ts.map +1 -1
  63. package/dist/utils/fs.js +54 -20
  64. package/dist/utils/fs.js.map +1 -1
  65. package/dist/utils/index.d.ts +1 -0
  66. package/dist/utils/index.d.ts.map +1 -1
  67. package/dist/utils/index.js +1 -3
  68. package/dist/utils/index.js.map +1 -1
  69. package/dist/utils/mime-types.d.ts.map +1 -1
  70. package/dist/utils/mime-types.js +11 -4
  71. package/dist/utils/mime-types.js.map +1 -1
  72. package/dist/utils/network-sync.d.ts +0 -6
  73. package/dist/utils/network-sync.d.ts.map +1 -1
  74. package/dist/utils/network-sync.js +55 -99
  75. package/dist/utils/network-sync.js.map +1 -1
  76. package/dist/utils/output.d.ts +129 -0
  77. package/dist/utils/output.d.ts.map +1 -0
  78. package/dist/utils/output.js +375 -0
  79. package/dist/utils/output.js.map +1 -0
  80. package/dist/utils/repo-factory.d.ts +2 -6
  81. package/dist/utils/repo-factory.d.ts.map +1 -1
  82. package/dist/utils/repo-factory.js +8 -31
  83. package/dist/utils/repo-factory.js.map +1 -1
  84. package/dist/utils/string-similarity.js +2 -2
  85. package/dist/utils/string-similarity.js.map +1 -1
  86. package/dist/utils/trace.d.ts +19 -0
  87. package/dist/utils/trace.d.ts.map +1 -0
  88. package/dist/utils/trace.js +68 -0
  89. package/dist/utils/trace.js.map +1 -0
  90. package/package.json +11 -11
  91. package/src/cli.ts +276 -308
  92. package/src/commands.ts +988 -0
  93. package/src/core/change-detection.ts +182 -240
  94. package/src/{config/index.ts → core/config.ts} +65 -82
  95. package/src/core/index.ts +1 -1
  96. package/src/core/move-detection.ts +10 -8
  97. package/src/core/snapshot.ts +2 -12
  98. package/src/core/sync-engine.ts +237 -427
  99. package/src/index.ts +0 -10
  100. package/src/types/config.ts +28 -93
  101. package/src/types/documents.ts +16 -2
  102. package/src/types/index.ts +0 -5
  103. package/src/types/snapshot.ts +0 -23
  104. package/src/utils/content.ts +2 -6
  105. package/src/utils/directory.ts +50 -0
  106. package/src/utils/fs.ts +58 -23
  107. package/src/utils/index.ts +1 -5
  108. package/src/utils/mime-types.ts +12 -4
  109. package/src/utils/network-sync.ts +79 -137
  110. package/src/utils/output.ts +450 -0
  111. package/src/utils/repo-factory.ts +13 -44
  112. package/src/utils/string-similarity.ts +2 -2
  113. package/src/utils/trace.ts +70 -0
  114. package/test/integration/exclude-patterns.test.ts +6 -15
  115. package/test/integration/fuzzer.test.ts +308 -391
  116. package/test/integration/init-sync.test.ts +89 -0
  117. package/test/integration/sync-deletion.test.ts +2 -61
  118. package/test/integration/sync-flow.test.ts +4 -24
  119. package/test/jest.setup.ts +34 -0
  120. package/test/unit/deletion-behavior.test.ts +3 -14
  121. package/test/unit/enhanced-mime-detection.test.ts +0 -22
  122. package/test/unit/snapshot.test.ts +2 -29
  123. package/test/unit/sync-convergence.test.ts +3 -198
  124. package/test/unit/sync-timing.test.ts +0 -44
  125. package/test/unit/utils.test.ts +0 -2
  126. package/tsconfig.json +3 -3
  127. package/bench/filesystem.bench.ts +0 -78
  128. package/bench/hashing.bench.ts +0 -60
  129. package/bench/move-detection.bench.ts +0 -130
  130. package/bench/runner.ts +0 -49
  131. package/dist/browser/browser-sync-engine.d.ts +0 -64
  132. package/dist/browser/browser-sync-engine.d.ts.map +0 -1
  133. package/dist/browser/browser-sync-engine.js +0 -303
  134. package/dist/browser/browser-sync-engine.js.map +0 -1
  135. package/dist/browser/filesystem-adapter.d.ts +0 -84
  136. package/dist/browser/filesystem-adapter.d.ts.map +0 -1
  137. package/dist/browser/filesystem-adapter.js +0 -413
  138. package/dist/browser/filesystem-adapter.js.map +0 -1
  139. package/dist/browser/index.d.ts +0 -36
  140. package/dist/browser/index.d.ts.map +0 -1
  141. package/dist/browser/index.js +0 -90
  142. package/dist/browser/index.js.map +0 -1
  143. package/dist/browser/types.d.ts +0 -70
  144. package/dist/browser/types.d.ts.map +0 -1
  145. package/dist/browser/types.js +0 -6
  146. package/dist/browser/types.js.map +0 -1
  147. package/dist/cli/commands.d.ts +0 -67
  148. package/dist/cli/commands.d.ts.map +0 -1
  149. package/dist/cli/commands.js +0 -794
  150. package/dist/cli/commands.js.map +0 -1
  151. package/dist/cli/index.d.ts +0 -2
  152. package/dist/cli/index.d.ts.map +0 -1
  153. package/dist/cli/index.js +0 -19
  154. package/dist/cli/index.js.map +0 -1
  155. package/dist/cli/output.d.ts +0 -75
  156. package/dist/cli/output.d.ts.map +0 -1
  157. package/dist/cli/output.js +0 -182
  158. package/dist/cli/output.js.map +0 -1
  159. package/dist/config/index.d.ts.map +0 -1
  160. package/dist/config/index.js.map +0 -1
  161. package/dist/config/remote-manager.d.ts +0 -65
  162. package/dist/config/remote-manager.d.ts.map +0 -1
  163. package/dist/config/remote-manager.js +0 -243
  164. package/dist/config/remote-manager.js.map +0 -1
  165. package/dist/core/isomorphic-snapshot.d.ts +0 -58
  166. package/dist/core/isomorphic-snapshot.d.ts.map +0 -1
  167. package/dist/core/isomorphic-snapshot.js +0 -204
  168. package/dist/core/isomorphic-snapshot.js.map +0 -1
  169. package/dist/platform/browser-filesystem.d.ts +0 -26
  170. package/dist/platform/browser-filesystem.d.ts.map +0 -1
  171. package/dist/platform/browser-filesystem.js +0 -91
  172. package/dist/platform/browser-filesystem.js.map +0 -1
  173. package/dist/platform/filesystem.d.ts +0 -29
  174. package/dist/platform/filesystem.d.ts.map +0 -1
  175. package/dist/platform/filesystem.js +0 -65
  176. package/dist/platform/filesystem.js.map +0 -1
  177. package/dist/platform/node-filesystem.d.ts +0 -21
  178. package/dist/platform/node-filesystem.d.ts.map +0 -1
  179. package/dist/platform/node-filesystem.js +0 -93
  180. package/dist/platform/node-filesystem.js.map +0 -1
  181. package/dist/utils/content-similarity.d.ts +0 -53
  182. package/dist/utils/content-similarity.d.ts.map +0 -1
  183. package/dist/utils/content-similarity.js +0 -155
  184. package/dist/utils/content-similarity.js.map +0 -1
  185. package/dist/utils/fs-browser.d.ts +0 -57
  186. package/dist/utils/fs-browser.d.ts.map +0 -1
  187. package/dist/utils/fs-browser.js +0 -311
  188. package/dist/utils/fs-browser.js.map +0 -1
  189. package/dist/utils/fs-node.d.ts +0 -53
  190. package/dist/utils/fs-node.d.ts.map +0 -1
  191. package/dist/utils/fs-node.js +0 -220
  192. package/dist/utils/fs-node.js.map +0 -1
  193. package/dist/utils/isomorphic.d.ts +0 -29
  194. package/dist/utils/isomorphic.d.ts.map +0 -1
  195. package/dist/utils/isomorphic.js +0 -139
  196. package/dist/utils/isomorphic.js.map +0 -1
  197. package/dist/utils/pure.d.ts +0 -25
  198. package/dist/utils/pure.d.ts.map +0 -1
  199. package/dist/utils/pure.js +0 -112
  200. package/dist/utils/pure.js.map +0 -1
  201. package/src/cli/commands.ts +0 -1030
  202. package/src/cli/index.ts +0 -2
  203. package/src/cli/output.ts +0 -244
  204. package/test/README-TESTING-GAPS.md +0 -174
package/README.md CHANGED
@@ -1,27 +1,16 @@
1
1
  # Pushwork
2
2
 
3
- A bidirectional file synchronization system using Automerge CRDTs for conflict-free collaborative editing.
3
+ Bidirectional file synchronization using Automerge CRDTs for conflict-free collaborative editing.
4
4
 
5
- ## Overview
5
+ ## Features
6
6
 
7
- Pushwork enables real-time collaboration on directories and files using **Conflict-free Replicated Data Types (CRDTs)**. Unlike traditional sync tools that require manual conflict resolution, Pushwork automatically merges changes from multiple users while preserving everyone's work.
8
-
9
- ## Key Features
10
-
11
- - **Bidirectional Sync**: Keep local directories synchronized with remote Automerge repositories
12
- - **Conflict-Free**: Automatic conflict resolution using Automerge CRDTs - no merge conflicts ever
7
+ - **Conflict-Free Sync**: Automatic conflict resolution using Automerge CRDTs
13
8
  - **Real-time Collaboration**: Multiple users can edit the same files simultaneously
14
9
  - **Intelligent Move Detection**: Detects file renames and moves based on content similarity
15
- - **Incremental Sync**: Only synchronizes changed files for maximum efficiency
16
- - **Network Resilient**: Works offline and gracefully handles network interruptions
10
+ - **Offline Support**: Works offline and gracefully handles network interruptions
17
11
  - **Cross-Platform**: Runs on Windows, macOS, and Linux
18
- - **Rich CLI**: Full-featured command-line interface with comprehensive tooling
19
-
20
- ## Quick Start
21
12
 
22
- ### Installation
23
-
24
- Currently, install from source:
13
+ ## Installation
25
14
 
26
15
  ```bash
27
16
  pnpm install
@@ -29,214 +18,89 @@ pnpm run build
29
18
  pnpm link --global
30
19
  ```
31
20
 
32
- Make sure that pnpm is in your PATH. E.g. in your .zshrc or .bashrc, add:
33
-
34
- ```bash
35
- export PNPM_HOME="/Users/username/Library/pnpm" # wherever you have pnpm installed
36
- export PATH="$PATH:$PNPM_HOME"
37
- ```
21
+ Requires: Node.js 18+, pnpm 8.15.0+
38
22
 
39
- Note: you can also run this from NPX.
40
-
41
- ### Basic Usage
42
-
43
- 1. **Initialize a new repository:**
23
+ ## Quick Start
44
24
 
45
25
  ```bash
26
+ # Initialize a directory
46
27
  pushwork init ./my-project
47
- ```
48
28
 
49
- 2. **Clone an existing repository:**
50
-
51
- ```bash
52
- pushwork clone <automerge-url> ./cloned-project
53
- ```
29
+ # Clone an existing repository
30
+ pushwork clone <automerge-url> ./project
54
31
 
55
- 3. **Sync changes:**
56
-
57
- ```bash
32
+ # Sync changes
58
33
  pushwork sync
59
- ```
60
-
61
- 4. **Check status:**
62
34
 
63
- ```bash
35
+ # Check status
64
36
  pushwork status
65
- ```
66
-
67
- ## Commands
68
-
69
- ### `init <path> [options]`
70
-
71
- Initialize sync in a directory, creating a new Automerge repository.
72
-
73
- ```bash
74
- # Initialize with default sync server
75
- pushwork init ./my-project
76
-
77
- # Initialize with custom sync server
78
- pushwork init ./my-project \
79
- --sync-server ws://localhost:3030 \
80
- --sync-server-storage-id your-storage-id
81
- ```
82
-
83
- **Options:**
84
-
85
- - `--sync-server <url>`: Custom sync server URL (requires storage-id)
86
- - `--sync-server-storage-id <id>`: Custom sync server storage ID (requires server)
87
-
88
- ### `clone <url> <path> [options]`
89
-
90
- Clone an existing synced directory from an Automerge URL.
91
-
92
- ```bash
93
- # Clone from default sync server
94
- pushwork clone automerge:abc123... ./cloned-project
95
-
96
- # Clone with custom sync server
97
- pushwork clone automerge:abc123... ./cloned-project \
98
- --sync-server ws://localhost:3030 \
99
- --sync-server-storage-id your-storage-id
100
37
 
101
- # Force overwrite existing directory
102
- pushwork clone automerge:abc123... ./existing-dir --force
103
- ```
104
-
105
- **Options:**
106
-
107
- - `--force`: Overwrite existing directory
108
- - `--sync-server <url>`: Custom sync server URL
109
- - `--sync-server-storage-id <id>`: Custom sync server storage ID
110
-
111
- ### `sync [options]`
112
-
113
- Run bidirectional synchronization between local files and remote repository.
114
-
115
- ```bash
116
- # Preview changes without applying them
117
- pushwork sync --dry-run
118
-
119
- # Apply all changes
120
- pushwork sync
121
-
122
- # Verbose output
123
- pushwork sync --verbose
124
- ```
125
-
126
- **Options:**
127
-
128
- - `--dry-run`: Preview changes without applying them
129
- - `--verbose`: Show detailed progress information
130
-
131
- ### `diff [path] [options]`
132
-
133
- Show differences between local and remote state.
134
-
135
- ```bash
136
- # Show all changes
137
- pushwork diff
138
-
139
- # Show changes for specific path
140
- pushwork diff src/
141
-
142
- # Show only changed file names
143
- pushwork diff --name-only
144
-
145
- # Use external diff tool
146
- pushwork diff --tool meld
38
+ # Get shareable URL
39
+ pushwork url
147
40
  ```
148
41
 
149
- **Options:**
42
+ ## Commands
150
43
 
151
- - `--tool <tool>`: Use external diff tool (meld, vimdiff, etc.)
152
- - `--name-only`: Show only changed file names
44
+ ### Core Commands
153
45
 
154
- ### `status`
46
+ **`init [path]`** - Initialize sync in a directory
155
47
 
156
- Show current sync status and repository information.
48
+ - `--sync-server <url>` - Custom sync server URL
49
+ - `--sync-server-storage-id <id>` - Custom storage ID
50
+ - `--debug` - Export performance flame graphs
157
51
 
158
- ```bash
159
- pushwork status
160
- ```
52
+ **`clone <url> <path>`** - Clone an existing synced directory
161
53
 
162
- ### `log [path] [options]`
54
+ - `--force` - Overwrite existing directory
55
+ - `--sync-server <url>` - Custom sync server URL
56
+ - `--sync-server-storage-id <id>` - Custom storage ID
163
57
 
164
- Show sync history for the repository or specific files.
58
+ **`sync [path]`** - Run bidirectional synchronization
165
59
 
166
- ```bash
167
- # Show repository history
168
- pushwork log
60
+ - `--dry-run` - Preview changes without applying
61
+ - `--verbose` - Show detailed progress
62
+ - `--debug` - Export performance flame graphs
169
63
 
170
- # Compact one-line format
171
- pushwork log --oneline
64
+ **`status [path]`** - Show sync status and repository info
172
65
 
173
- # History for specific path
174
- pushwork log src/important-file.txt
175
- ```
66
+ - `--verbose` - Show detailed status including all tracked files
176
67
 
177
- **Options:**
68
+ **`commit [path]`** - Commit local changes without network sync
178
69
 
179
- - `--oneline`: Compact one-line per sync format
180
- - `--since <date>`: Show syncs since date
181
- - `--limit <n>`: Limit number of syncs shown (default: 10)
70
+ - `--dry-run` - Preview what would be committed
71
+ - `--debug` - Export performance flame graphs
182
72
 
183
- ### `url [path]`
73
+ ### Utility Commands
184
74
 
185
- Show the Automerge root URL for sharing with others.
75
+ **`diff [path]`** - Show differences between local and remote
186
76
 
187
- ```bash
188
- # Get URL for current directory
189
- pushwork url
77
+ - `--name-only` - Show only changed file names
190
78
 
191
- # Get URL for specific directory
192
- pushwork url ./my-project
193
- ```
194
-
195
- ### `commit [path] [options]`
79
+ **`url [path]`** - Show the Automerge root URL for sharing
196
80
 
197
- Commit local changes without network sync (useful for offline work).
81
+ **`ls [path]`** - List tracked files
198
82
 
199
- ```bash
200
- # Commit all changes
201
- pushwork commit
83
+ - `--long` - Show Automerge URLs
202
84
 
203
- # Preview what would be committed
204
- pushwork commit --dry-run
85
+ **`config [path]`** - View or edit configuration
205
86
 
206
- # Commit specific directory
207
- pushwork commit ./src
208
- ```
87
+ - `--list` - Show full configuration
88
+ - `--get <key>` - Get specific config value (dot notation)
209
89
 
210
- **Options:**
90
+ **`rm [path]`** - Remove local pushwork data
211
91
 
212
- - `--dry-run`: Show what would be committed without applying changes
92
+ **`watch [path]`** - Watch directory, build, and sync automatically
213
93
 
214
- ### `checkout <sync-id> [path] [options]`
94
+ - `--script <command>` - Build script (default: "pnpm build")
95
+ - `--dir <dir>` - Directory to watch (default: "src")
96
+ - `--verbose` - Show build output
215
97
 
216
- Restore directory to state from previous sync (not yet implemented).
98
+ **`log [path]`** - Show sync history _(experimental, limited functionality)_
217
99
 
218
- ```bash
219
- # Restore entire directory
220
- pushwork checkout sync-123
221
-
222
- # Force checkout even with uncommitted changes
223
- pushwork checkout sync-123 --force
224
- ```
100
+ **`checkout <sync-id> [path]`** - Restore to previous sync _(not yet implemented)_
225
101
 
226
102
  ## Configuration
227
103
 
228
- ### Default Configuration
229
-
230
- Pushwork uses sensible defaults:
231
-
232
- - **Sync Server**: `wss://sync3.automerge.org`
233
- - **Storage ID**: `3760df37-a4c6-4f66-9ecd-732039a9385d`
234
- - **Excluded Patterns**: `.git`, `node_modules`, `*.tmp`, `.pushwork`
235
- - **Large File Threshold**: 100MB
236
- - **Move Detection Threshold**: 80% similarity
237
-
238
- ### Directory Configuration
239
-
240
104
  Configuration is stored in `.pushwork/config.json`:
241
105
 
242
106
  ```json
@@ -262,36 +126,23 @@ Configuration is stored in `.pushwork/config.json`:
262
126
 
263
127
  ## How It Works
264
128
 
265
- ### CRDT-Based Conflict Resolution
266
-
267
- Pushwork uses **Automerge CRDTs** to automatically resolve conflicts:
268
-
269
- - **Text Files**: Character-level merging preserves all changes
270
- - **Binary Files**: Last-writer-wins with automatic convergence
271
- - **Directory Structure**: Additive merging supports simultaneous file creation
272
- - **File Moves**: Intelligent detection prevents data loss during renames
273
-
274
- ### Two-Phase Sync Process
129
+ Pushwork uses Automerge CRDTs for automatic conflict resolution:
275
130
 
276
- 1. **Push Phase**: Apply local changes to Automerge documents
277
- 2. **Pull Phase**: Apply remote changes to local filesystem
278
- 3. **Convergence**: All repositories eventually reach identical state
131
+ - **Text files**: Character-level merging preserves all changes
132
+ - **Binary files**: Last-writer-wins with automatic convergence
133
+ - **Directories**: Additive merging supports simultaneous file creation
279
134
 
280
- ### Change Detection
135
+ Sync process:
281
136
 
282
- - **Content-Based**: Uses Automerge document heads, not timestamps
283
- - **Efficient**: Only processes actually changed files
284
- - **Reliable**: Works across time zones and file system differences
285
- - **Resumable**: Interrupted syncs can be safely resumed
137
+ 1. **Push**: Apply local changes to Automerge documents
138
+ 2. **Pull**: Apply remote changes to local filesystem
139
+ 3. **Convergence**: All repositories reach identical state
286
140
 
287
- ### Move Detection Algorithm
141
+ State tracking:
288
142
 
289
- - Compares content similarity between deleted and created files
290
- - **Auto-apply**: Moves with >80% similarity (configurable)
291
- - **User prompt**: Moves with 50-80% similarity (configurable)
292
- - **Ignore**: Moves with <50% similarity
293
-
294
- ## Architecture
143
+ - `.pushwork/snapshot.json` - Tracks sync state and file mappings
144
+ - `.pushwork/config.json` - Configuration settings
145
+ - Content-based change detection using Automerge document heads
295
146
 
296
147
  ### Document Schema
297
148
 
@@ -303,7 +154,10 @@ Pushwork uses **Automerge CRDTs** to automatically resolve conflicts:
303
154
  name: string;
304
155
  extension: string;
305
156
  mimeType: string;
306
- content: Text | Uint8Array;
157
+ content: ImmutableString | Uint8Array;
158
+ metadata: {
159
+ permissions: number;
160
+ };
307
161
  }
308
162
  ```
309
163
 
@@ -317,153 +171,51 @@ Pushwork uses **Automerge CRDTs** to automatically resolve conflicts:
317
171
  type: "file" | "folder";
318
172
  url: AutomergeUrl;
319
173
  }>;
174
+ lastSyncAt?: number;
320
175
  }
321
176
  ```
322
177
 
323
- ### Local State Management
324
-
325
- - **Snapshot File**: `.pushwork/snapshot.json` tracks sync state
326
- - **Path Mapping**: Links filesystem paths to Automerge document URLs
327
- - **Head Tracking**: Enables efficient change detection
328
- - **Configuration**: `.pushwork/config.json` stores sync settings
329
-
330
- ### Network Architecture
331
-
332
- - **Sync Server**: Handles real-time synchronization between clients
333
- - **Storage ID**: Isolates different collaboration groups
334
- - **WebSocket Connection**: Provides real-time updates
335
- - **Graceful Degradation**: Works offline with manual sync
178
+ ## Development
336
179
 
337
- ## Testing
338
-
339
- ### Running Tests
340
-
341
- ```bash
342
- # Build the project
343
- npm run build
344
-
345
- # Run unit tests
346
- npm test
347
-
348
- # Run integration tests
349
- ./test/run-tests.sh
350
-
351
- # Test conflict resolution
352
- ./test/integration/conflict-resolution-test.sh
353
-
354
- # Test clone functionality
355
- ./test/integration/clone-test.sh
356
- ```
357
-
358
- ### Test Coverage
359
-
360
- - **Unit Tests**: Core functionality and utilities
361
- - **Integration Tests**: End-to-end sync scenarios
362
- - **Conflict Resolution**: CRDT merging behavior
363
- - **Clone Operations**: Repository sharing workflows
364
-
365
- ## 🛠️ Development
366
-
367
- ### Prerequisites
368
-
369
- - Node.js 18+
370
- - TypeScript 5+
371
- - pnpm (recommended) or npm
372
-
373
- ### Development Setup
180
+ ### Setup
374
181
 
375
182
  ```bash
376
183
  git clone <repository-url>
377
184
  cd pushwork
378
- npm install
379
- npm run build
380
-
381
- # Development mode
382
- npm run dev
383
-
384
- # Watch mode for testing
385
- npm run test:watch
185
+ pnpm install
186
+ pnpm run build
187
+ pnpm run dev # Watch mode
188
+ pnpm test # Run tests
189
+ pnpm run test:watch # Watch mode for tests
386
190
  ```
387
191
 
388
192
  ### Project Structure
389
193
 
390
194
  ```
391
195
  src/
392
- ├── cli/ # Command-line interface
393
- ├── core/ # Core sync engine
394
- ├── config/ # Configuration management
395
- ├── types/ # TypeScript type definitions
396
- └── utils/ # Shared utilities
397
-
398
- test/
399
- ├── unit/ # Unit tests
400
- └── integration/ # Integration tests
196
+ ├── cli/ # Command-line interface
197
+ ├── core/ # Core sync engine
198
+ ├── config/ # Configuration management
199
+ ├── tracing/ # Performance tracing
200
+ ├── types/ # TypeScript type definitions
201
+ └── utils/ # Shared utilities
401
202
  ```
402
203
 
403
- ## Real-World Collaboration Example
204
+ ### Testing
404
205
 
405
206
  ```bash
406
- # Alice initializes a project
407
- alice$ pushwork init ./shared-docs
408
- alice$ echo "Hello World" > shared-docs/readme.txt
409
- alice$ pushwork sync
410
- alice$ pushwork url
411
- # automerge:2V4w7zv8zkJYJxJsKaYhZ5NPjxA1
412
-
413
- # Bob clones Alice's project
414
- bob$ pushwork clone automerge:2V4w7zv8zkJYJxJsKaYhZ5NPjxA1 ./bobs-copy
415
-
416
- # Both edit the same file simultaneously
417
- alice$ echo "Alice's changes" >> shared-docs/readme.txt
418
- bob$ echo "Bob's changes" >> bobs-copy/readme.txt
419
-
420
- # Both sync - no conflicts!
421
- alice$ pushwork sync
422
- bob$ pushwork sync
423
- alice$ pushwork sync # Gets Bob's changes
424
-
425
- # Final result contains both changes merged automatically
426
- alice$ cat shared-docs/readme.txt
427
- Hello World
428
- Alice's changes
429
- Bob's changes
207
+ pnpm test # Unit tests
208
+ ./test/run-tests.sh # All integration tests
209
+ ./test/integration/conflict-resolution-test.sh # Specific test
430
210
  ```
431
211
 
432
- ## Troubleshooting
433
-
434
- ### Common Issues
435
-
436
- **WebSocket Connection Errors**: Usually safe to ignore during shutdown
437
-
438
- **"Directory not initialized"**: Run `pushwork init .` first
439
-
440
- **Network Sync Timeout**: Check internet connection and sync server status
441
-
442
- **File Permission Errors**: Ensure write access to target directory
443
-
444
- ### Debug Mode
212
+ ### Profiling
445
213
 
446
214
  ```bash
447
- # Enable verbose logging
448
- pushwork sync --verbose
449
-
450
- # Preview changes without applying
451
- pushwork sync --dry-run
452
-
453
- # Check repository status
454
- pushwork status
215
+ pushwork sync --debug # Export flame graphs
216
+ clinic flame --collect-only -- node --enable-source-maps --prof $(pnpm root -g)/pushwork/dist/cli.js sync
455
217
  ```
456
218
 
457
219
  ## License
458
220
 
459
- MIT License - see LICENSE file for details.
460
-
461
- ## Links
462
-
463
- - **Issues**: Report bugs and request features
464
- - **Documentation**: Additional guides and tutorials
465
- - **Automerge**: Learn more about CRDT technology
466
-
467
- ---
468
-
469
- ** Ready to collaborate conflict-free? Get started with `pushwork init`!**
221
+ MIT License
@@ -0,0 +1 @@
1
+ e43182b5-f406-4319-8bac-ee54d9dec4a9
@@ -0,0 +1,15 @@
1
+ {
2
+ "sync_enabled": true,
3
+ "sync_server": "wss://sync3.automerge.org",
4
+ "sync_server_storage_id": "3760df37-a4c6-4f66-9ecd-732039a9385d",
5
+ "exclude_patterns": [
6
+ ".git",
7
+ "node_modules",
8
+ "*.tmp",
9
+ ".pushwork",
10
+ ".DS_Store"
11
+ ],
12
+ "sync": {
13
+ "move_detection_threshold": 0.7
14
+ }
15
+ }
@@ -0,0 +1,7 @@
1
+ {
2
+ "timestamp": 1764206435572,
3
+ "rootPath": "C:\\Users\\pvh\\Dev\\pushwork\\dist",
4
+ "rootDirectoryUrl": "automerge:3PDm3ekE2pmjGnWvDaG3vSR7ww98",
5
+ "files": [],
6
+ "directories": []
7
+ }