pushwork 2.0.0-preview.4 → 2.0.0-preview.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 (122) hide show
  1. package/dist/branches.d.ts +2 -1
  2. package/dist/branches.d.ts.map +1 -1
  3. package/dist/branches.js +23 -4
  4. package/dist/branches.js.map +1 -1
  5. package/dist/checkpoints.d.ts +41 -0
  6. package/dist/checkpoints.d.ts.map +1 -0
  7. package/dist/checkpoints.js +210 -0
  8. package/dist/checkpoints.js.map +1 -0
  9. package/dist/stash.d.ts +2 -0
  10. package/dist/stash.d.ts.map +1 -1
  11. package/dist/stash.js +1 -0
  12. package/dist/stash.js.map +1 -1
  13. package/package.json +2 -2
  14. package/dist/cli/commands.d.ts +0 -71
  15. package/dist/cli/commands.d.ts.map +0 -1
  16. package/dist/cli/commands.js +0 -794
  17. package/dist/cli/commands.js.map +0 -1
  18. package/dist/cli/index.d.ts +0 -2
  19. package/dist/cli/index.d.ts.map +0 -1
  20. package/dist/cli/index.js +0 -19
  21. package/dist/cli/index.js.map +0 -1
  22. package/dist/commands.d.ts +0 -58
  23. package/dist/commands.d.ts.map +0 -1
  24. package/dist/commands.js +0 -975
  25. package/dist/commands.js.map +0 -1
  26. package/dist/config/index.d.ts +0 -71
  27. package/dist/config/index.d.ts.map +0 -1
  28. package/dist/config/index.js +0 -314
  29. package/dist/config/index.js.map +0 -1
  30. package/dist/core/change-detection.d.ts +0 -80
  31. package/dist/core/change-detection.d.ts.map +0 -1
  32. package/dist/core/change-detection.js +0 -560
  33. package/dist/core/change-detection.js.map +0 -1
  34. package/dist/core/config.d.ts +0 -81
  35. package/dist/core/config.d.ts.map +0 -1
  36. package/dist/core/config.js +0 -304
  37. package/dist/core/config.js.map +0 -1
  38. package/dist/core/index.d.ts +0 -6
  39. package/dist/core/index.d.ts.map +0 -1
  40. package/dist/core/index.js +0 -22
  41. package/dist/core/index.js.map +0 -1
  42. package/dist/core/move-detection.d.ts +0 -34
  43. package/dist/core/move-detection.d.ts.map +0 -1
  44. package/dist/core/move-detection.js +0 -128
  45. package/dist/core/move-detection.js.map +0 -1
  46. package/dist/core/snapshot.d.ts +0 -105
  47. package/dist/core/snapshot.d.ts.map +0 -1
  48. package/dist/core/snapshot.js +0 -254
  49. package/dist/core/snapshot.js.map +0 -1
  50. package/dist/core/sync-engine.d.ts +0 -177
  51. package/dist/core/sync-engine.d.ts.map +0 -1
  52. package/dist/core/sync-engine.js +0 -1471
  53. package/dist/core/sync-engine.js.map +0 -1
  54. package/dist/types/config.d.ts +0 -102
  55. package/dist/types/config.d.ts.map +0 -1
  56. package/dist/types/config.js +0 -10
  57. package/dist/types/config.js.map +0 -1
  58. package/dist/types/documents.d.ts +0 -88
  59. package/dist/types/documents.d.ts.map +0 -1
  60. package/dist/types/documents.js +0 -23
  61. package/dist/types/documents.js.map +0 -1
  62. package/dist/types/index.d.ts +0 -4
  63. package/dist/types/index.d.ts.map +0 -1
  64. package/dist/types/index.js +0 -20
  65. package/dist/types/index.js.map +0 -1
  66. package/dist/types/snapshot.d.ts +0 -64
  67. package/dist/types/snapshot.d.ts.map +0 -1
  68. package/dist/types/snapshot.js +0 -3
  69. package/dist/types/snapshot.js.map +0 -1
  70. package/dist/utils/content-similarity.d.ts +0 -53
  71. package/dist/utils/content-similarity.d.ts.map +0 -1
  72. package/dist/utils/content-similarity.js +0 -155
  73. package/dist/utils/content-similarity.js.map +0 -1
  74. package/dist/utils/content.d.ts +0 -10
  75. package/dist/utils/content.d.ts.map +0 -1
  76. package/dist/utils/content.js +0 -35
  77. package/dist/utils/content.js.map +0 -1
  78. package/dist/utils/directory.d.ts +0 -24
  79. package/dist/utils/directory.d.ts.map +0 -1
  80. package/dist/utils/directory.js +0 -56
  81. package/dist/utils/directory.js.map +0 -1
  82. package/dist/utils/fs.d.ts +0 -74
  83. package/dist/utils/fs.d.ts.map +0 -1
  84. package/dist/utils/fs.js +0 -298
  85. package/dist/utils/fs.js.map +0 -1
  86. package/dist/utils/index.d.ts +0 -5
  87. package/dist/utils/index.d.ts.map +0 -1
  88. package/dist/utils/index.js +0 -21
  89. package/dist/utils/index.js.map +0 -1
  90. package/dist/utils/mime-types.d.ts +0 -13
  91. package/dist/utils/mime-types.d.ts.map +0 -1
  92. package/dist/utils/mime-types.js +0 -247
  93. package/dist/utils/mime-types.js.map +0 -1
  94. package/dist/utils/network-sync.d.ts +0 -30
  95. package/dist/utils/network-sync.d.ts.map +0 -1
  96. package/dist/utils/network-sync.js +0 -391
  97. package/dist/utils/network-sync.js.map +0 -1
  98. package/dist/utils/node-polyfills.d.ts +0 -9
  99. package/dist/utils/node-polyfills.d.ts.map +0 -1
  100. package/dist/utils/node-polyfills.js +0 -9
  101. package/dist/utils/node-polyfills.js.map +0 -1
  102. package/dist/utils/output.d.ts +0 -129
  103. package/dist/utils/output.d.ts.map +0 -1
  104. package/dist/utils/output.js +0 -375
  105. package/dist/utils/output.js.map +0 -1
  106. package/dist/utils/repo-factory.d.ts +0 -15
  107. package/dist/utils/repo-factory.d.ts.map +0 -1
  108. package/dist/utils/repo-factory.js +0 -156
  109. package/dist/utils/repo-factory.js.map +0 -1
  110. package/dist/utils/string-similarity.d.ts +0 -14
  111. package/dist/utils/string-similarity.d.ts.map +0 -1
  112. package/dist/utils/string-similarity.js +0 -43
  113. package/dist/utils/string-similarity.js.map +0 -1
  114. package/dist/utils/text-diff.d.ts +0 -37
  115. package/dist/utils/text-diff.d.ts.map +0 -1
  116. package/dist/utils/text-diff.js +0 -131
  117. package/dist/utils/text-diff.js.map +0 -1
  118. package/dist/utils/trace.d.ts +0 -19
  119. package/dist/utils/trace.d.ts.map +0 -1
  120. package/dist/utils/trace.js +0 -68
  121. package/dist/utils/trace.js.map +0 -1
  122. package/patches/@automerge__automerge-repo@2.6.0-subduction.15.patch +0 -26
@@ -1,560 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || (function () {
19
- var ownKeys = function(o) {
20
- ownKeys = Object.getOwnPropertyNames || function (o) {
21
- var ar = [];
22
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
- return ar;
24
- };
25
- return ownKeys(o);
26
- };
27
- return function (mod) {
28
- if (mod && mod.__esModule) return mod;
29
- var result = {};
30
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
- __setModuleDefault(result, mod);
32
- return result;
33
- };
34
- })();
35
- Object.defineProperty(exports, "__esModule", { value: true });
36
- exports.ChangeDetector = void 0;
37
- const A = __importStar(require("@automerge/automerge"));
38
- const types_1 = require("../types");
39
- const utils_1 = require("../utils");
40
- const content_1 = require("../utils/content");
41
- const output_1 = require("../utils/output");
42
- const isDebug = !!process.env.DEBUG;
43
- function debug(...args) {
44
- if (isDebug)
45
- console.error("[pushwork:change-detection]", ...args);
46
- }
47
- /**
48
- * Change detection engine
49
- */
50
- class ChangeDetector {
51
- constructor(repo, rootPath, excludePatterns = [], artifactDirectories = []) {
52
- this.repo = repo;
53
- this.rootPath = rootPath;
54
- this.excludePatterns = excludePatterns;
55
- this.artifactDirectories = artifactDirectories;
56
- }
57
- /**
58
- * Check if a file path is inside an artifact directory.
59
- * Artifact files use RawString and are always replaced wholesale,
60
- * so we can skip expensive remote content reads for them.
61
- */
62
- isArtifactPath(filePath) {
63
- return this.artifactDirectories.some(dir => filePath === dir || filePath.startsWith(dir + "/"));
64
- }
65
- /**
66
- * Detect all changes between local filesystem and snapshot
67
- */
68
- async detectChanges(snapshot, excludePaths) {
69
- const changes = [];
70
- // Get current filesystem state
71
- const currentFiles = await this.getCurrentFilesystemState();
72
- // Check for local changes (new, modified, deleted files)
73
- const localChanges = await this.detectLocalChanges(snapshot, currentFiles);
74
- changes.push(...localChanges);
75
- // Check for remote changes (changes in Automerge documents)
76
- const remoteChanges = await this.detectRemoteChanges(snapshot);
77
- changes.push(...remoteChanges);
78
- // Check for new remote documents not in snapshot (critical for clone scenarios)
79
- const newRemoteDocuments = await this.detectNewRemoteDocuments(snapshot, excludePaths);
80
- changes.push(...newRemoteDocuments);
81
- return changes;
82
- }
83
- /**
84
- * Detect changes in local filesystem compared to snapshot
85
- */
86
- async detectLocalChanges(snapshot, currentFiles) {
87
- const changes = [];
88
- // Check for new and modified files in parallel for better performance
89
- await Promise.all(Array.from(currentFiles.entries()).map(async ([relativePath, fileInfo]) => {
90
- const snapshotEntry = snapshot.files.get(relativePath);
91
- if (!snapshotEntry) {
92
- // New file
93
- changes.push({
94
- path: relativePath,
95
- changeType: types_1.ChangeType.LOCAL_ONLY,
96
- fileType: fileInfo.type,
97
- localContent: fileInfo.content,
98
- remoteContent: null,
99
- });
100
- }
101
- else if (this.isArtifactPath(relativePath)) {
102
- // Artifact files are always replaced wholesale (RawString).
103
- // Skip remote doc content reads — compare local hash against
104
- // stored hash to detect local changes, and check heads for remote.
105
- const localHash = (0, content_1.contentHash)(fileInfo.content);
106
- const localChanged = snapshotEntry.contentHash
107
- ? localHash !== snapshotEntry.contentHash
108
- : true; // No stored hash = first sync with hash support, assume changed
109
- const remoteHead = await this.getCurrentRemoteHead(snapshotEntry.url);
110
- const remoteChanged = !A.equals(remoteHead, snapshotEntry.head);
111
- if (localChanged || remoteChanged) {
112
- changes.push({
113
- path: relativePath,
114
- changeType: localChanged && remoteChanged
115
- ? types_1.ChangeType.BOTH_CHANGED
116
- : localChanged
117
- ? types_1.ChangeType.LOCAL_ONLY
118
- : types_1.ChangeType.REMOTE_ONLY,
119
- fileType: fileInfo.type,
120
- localContent: fileInfo.content,
121
- remoteContent: null,
122
- localHead: snapshotEntry.head,
123
- remoteHead,
124
- });
125
- }
126
- }
127
- else {
128
- // Check if content changed
129
- const lastKnownContent = await this.getContentAtHead(snapshotEntry.url, snapshotEntry.head);
130
- const contentChanged = !(0, content_1.isContentEqual)(fileInfo.content, lastKnownContent);
131
- if (contentChanged) {
132
- // Check remote state too
133
- const currentRemoteContent = await this.getCurrentRemoteContent(snapshotEntry.url);
134
- const remoteChanged = !(0, content_1.isContentEqual)(lastKnownContent, currentRemoteContent);
135
- const changeType = remoteChanged
136
- ? types_1.ChangeType.BOTH_CHANGED
137
- : types_1.ChangeType.LOCAL_ONLY;
138
- const remoteHead = await this.getCurrentRemoteHead(snapshotEntry.url);
139
- changes.push({
140
- path: relativePath,
141
- changeType,
142
- fileType: fileInfo.type,
143
- localContent: fileInfo.content,
144
- remoteContent: currentRemoteContent,
145
- localHead: snapshotEntry.head,
146
- remoteHead,
147
- });
148
- }
149
- }
150
- }));
151
- // Check for deleted files in parallel
152
- await Promise.all(Array.from(snapshot.files.entries())
153
- .filter(([relativePath]) => !currentFiles.has(relativePath))
154
- .map(async ([relativePath, snapshotEntry]) => {
155
- if (this.isArtifactPath(relativePath)) {
156
- // Artifact deletion: skip remote content read
157
- const remoteHead = await this.getCurrentRemoteHead(snapshotEntry.url);
158
- const remoteChanged = !A.equals(remoteHead, snapshotEntry.head);
159
- changes.push({
160
- path: relativePath,
161
- changeType: remoteChanged
162
- ? types_1.ChangeType.BOTH_CHANGED
163
- : types_1.ChangeType.LOCAL_ONLY,
164
- fileType: types_1.FileType.TEXT,
165
- localContent: null,
166
- remoteContent: null,
167
- localHead: snapshotEntry.head,
168
- remoteHead,
169
- });
170
- return;
171
- }
172
- // File was deleted locally
173
- const currentRemoteContent = await this.getCurrentRemoteContent(snapshotEntry.url);
174
- const lastKnownContent = await this.getContentAtHead(snapshotEntry.url, snapshotEntry.head);
175
- const remoteChanged = !(0, content_1.isContentEqual)(lastKnownContent, currentRemoteContent);
176
- const changeType = remoteChanged
177
- ? types_1.ChangeType.BOTH_CHANGED
178
- : types_1.ChangeType.LOCAL_ONLY;
179
- changes.push({
180
- path: relativePath,
181
- changeType,
182
- fileType: types_1.FileType.TEXT, // Will be determined from document
183
- localContent: null,
184
- remoteContent: currentRemoteContent,
185
- localHead: snapshotEntry.head,
186
- remoteHead: await this.getCurrentRemoteHead(snapshotEntry.url),
187
- });
188
- }));
189
- return changes;
190
- }
191
- /**
192
- * Detect changes in remote Automerge documents compared to snapshot
193
- */
194
- async detectRemoteChanges(snapshot) {
195
- const changes = [];
196
- await Promise.all(Array.from(snapshot.files.entries()).map(async ([relativePath, snapshotEntry]) => {
197
- // Find the file's current entry in the remote directory hierarchy
198
- const remoteEntry = await this.findInRemoteDirectory(snapshot.rootDirectoryUrl, relativePath);
199
- if (!remoteEntry) {
200
- // File was removed from remote directory listing
201
- const localContent = await this.getLocalContent(relativePath);
202
- // Only report as deleted if local file still exists
203
- // (if local file is also deleted, detectLocalChanges handles it)
204
- if (localContent !== null) {
205
- changes.push({
206
- path: relativePath,
207
- changeType: types_1.ChangeType.REMOTE_ONLY,
208
- fileType: types_1.FileType.TEXT,
209
- localContent,
210
- remoteContent: null, // File deleted remotely
211
- localHead: snapshotEntry.head,
212
- remoteHead: snapshotEntry.head,
213
- });
214
- }
215
- return;
216
- }
217
- // Check if the document was replaced entirely (new URL).
218
- // This happens when a peer replaces an artifact file, fixes a
219
- // legacy immutable string, or recreates a failed document.
220
- // The old snapshot URL is now orphaned — read from the new one.
221
- const urlReplaced = (0, utils_1.getPlainUrl)(remoteEntry.url) !== (0, utils_1.getPlainUrl)(snapshotEntry.url);
222
- const remoteUrl = urlReplaced ? remoteEntry.url : snapshotEntry.url;
223
- const currentRemoteHead = await this.getCurrentRemoteHead(remoteUrl);
224
- if (urlReplaced || !A.equals(currentRemoteHead, snapshotEntry.head)) {
225
- if (this.isArtifactPath(relativePath)) {
226
- // Artifact: skip content reads, just report head change
227
- const localContent = await this.getLocalContent(relativePath);
228
- changes.push({
229
- path: relativePath,
230
- changeType: localContent !== null
231
- ? types_1.ChangeType.BOTH_CHANGED
232
- : types_1.ChangeType.REMOTE_ONLY,
233
- fileType: types_1.FileType.TEXT,
234
- localContent,
235
- remoteContent: null,
236
- localHead: snapshotEntry.head,
237
- remoteHead: currentRemoteHead,
238
- ...(urlReplaced ? { remoteUrl: remoteEntry.url } : {}),
239
- });
240
- return;
241
- }
242
- // Remote document has changed
243
- const currentRemoteContent = await this.getCurrentRemoteContent(remoteUrl);
244
- const localContent = await this.getLocalContent(relativePath);
245
- const lastKnownContent = urlReplaced
246
- ? null // Can't diff against old doc when URL changed
247
- : await this.getContentAtHead(snapshotEntry.url, snapshotEntry.head);
248
- const localChanged = localContent && lastKnownContent
249
- ? !(0, content_1.isContentEqual)(localContent, lastKnownContent)
250
- : localContent !== null;
251
- const changeType = localChanged
252
- ? types_1.ChangeType.BOTH_CHANGED
253
- : types_1.ChangeType.REMOTE_ONLY;
254
- changes.push({
255
- path: relativePath,
256
- changeType,
257
- fileType: await this.getFileTypeFromContent(currentRemoteContent),
258
- localContent,
259
- remoteContent: currentRemoteContent,
260
- localHead: snapshotEntry.head,
261
- remoteHead: currentRemoteHead,
262
- ...(urlReplaced ? { remoteUrl: remoteEntry.url } : {}),
263
- });
264
- }
265
- }));
266
- return changes;
267
- }
268
- /**
269
- * Detect new remote documents from directory hierarchy that aren't in snapshot
270
- * This is critical for clone scenarios where local snapshot is empty
271
- */
272
- async detectNewRemoteDocuments(snapshot, excludePaths) {
273
- const changes = [];
274
- // If no root directory URL, nothing to discover
275
- if (!snapshot.rootDirectoryUrl) {
276
- return changes;
277
- }
278
- try {
279
- // Recursively traverse the directory hierarchy
280
- await this.discoverRemoteDocumentsRecursive(snapshot.rootDirectoryUrl, "", snapshot, changes, excludePaths);
281
- }
282
- catch (error) {
283
- output_1.out.taskLine(`Failed to discover remote documents: ${error}`, true);
284
- }
285
- return changes;
286
- }
287
- /**
288
- * Recursively discover remote documents in directory hierarchy
289
- */
290
- async discoverRemoteDocumentsRecursive(directoryUrl, currentPath, snapshot, changes, excludePaths) {
291
- try {
292
- // Find and wait for document to be available (retries on "unavailable")
293
- const plainUrl = (0, utils_1.getPlainUrl)(directoryUrl);
294
- const result = await this.findDocument(plainUrl);
295
- if (!result) {
296
- return;
297
- }
298
- const dirDoc = result.doc;
299
- // Process each entry in the directory
300
- for (const entry of dirDoc.docs) {
301
- const entryPath = currentPath
302
- ? `${currentPath}/${entry.name}`
303
- : entry.name;
304
- if (entry.type === "file") {
305
- // Skip files that were deliberately deleted during this sync cycle
306
- if (excludePaths?.has(entryPath)) {
307
- debug(`skipping deleted path during re-detection: ${entryPath}`);
308
- continue;
309
- }
310
- // Check if this file is already tracked in the snapshot
311
- const existingEntry = snapshot.files.get(entryPath);
312
- if (!existingEntry) {
313
- // This is a remote file not in our snapshot
314
- const localContent = await this.getLocalContent(entryPath);
315
- const remoteContent = await this.getCurrentRemoteContent(entry.url);
316
- const remoteHead = await this.getCurrentRemoteHead(entry.url);
317
- if (localContent != null && remoteContent == null) {
318
- // File exists both locally and remotely but not in snapshot
319
- changes.push({
320
- path: entryPath,
321
- changeType: types_1.ChangeType.BOTH_CHANGED,
322
- fileType: await this.getFileTypeFromContent(remoteContent),
323
- localContent,
324
- remoteContent,
325
- remoteHead,
326
- });
327
- }
328
- else if (localContent !== null && remoteContent === null) {
329
- // File exists locally but not remotely (shouldn't happen in this flow)
330
- changes.push({
331
- path: entryPath,
332
- changeType: types_1.ChangeType.LOCAL_ONLY,
333
- fileType: await this.getFileTypeFromContent(localContent),
334
- localContent,
335
- remoteContent: null,
336
- });
337
- }
338
- else if (localContent === null && remoteContent !== null) {
339
- // File exists remotely but not locally - this is what we need for clone!
340
- changes.push({
341
- path: entryPath,
342
- changeType: types_1.ChangeType.REMOTE_ONLY,
343
- fileType: await this.getFileTypeFromContent(remoteContent),
344
- localContent: null,
345
- remoteContent,
346
- remoteHead,
347
- });
348
- }
349
- // Only ignore if neither local nor remote content exists (ghost entry)
350
- }
351
- else if ((0, utils_1.getPlainUrl)(entry.url) !== (0, utils_1.getPlainUrl)(existingEntry.url)) {
352
- // HACK: URL replacement detection bolted onto the "discover new docs" walk.
353
- //
354
- // A peer can replace a document entirely (creating a new URL) rather than mutating
355
- // the existing one. This happens in several cases in updateRemoteFile(): artifact
356
- // paths are always replaced; non-artifact docs with legacy immutable string content
357
- // are also replaced; and recreateFailedDocuments() replaces docs that timed out
358
- // during network sync. The two normal remote-change scans both miss this:
359
- // - detectRemoteChanges() is snapshot-centric: it checks the old (now orphaned)
360
- // doc's heads, which haven't changed, so it reports no change.
361
- // - The "new doc" branch above is directory-centric: it skips paths already in
362
- // the snapshot, assuming they're handled by detectRemoteChanges().
363
- //
364
- // A cleaner fix would be to have detectRemoteChanges() also verify that the
365
- // directory still points to the same URL for each snapshot entry, treating a
366
- // mismatch as a first-class URL-replacement change rather than a special case here.
367
- const localContent = await this.getLocalContent(entryPath);
368
- const remoteContent = await this.getCurrentRemoteContent(entry.url);
369
- const remoteHead = await this.getCurrentRemoteHead(entry.url);
370
- if (remoteContent !== null) {
371
- changes.push({
372
- path: entryPath,
373
- changeType: localContent !== null
374
- ? types_1.ChangeType.BOTH_CHANGED
375
- : types_1.ChangeType.REMOTE_ONLY,
376
- fileType: await this.getFileTypeFromContent(remoteContent),
377
- localContent: localContent ?? null,
378
- remoteContent,
379
- remoteHead,
380
- remoteUrl: entry.url,
381
- });
382
- }
383
- }
384
- }
385
- else if (entry.type === "folder") {
386
- // Recursively process subdirectory
387
- await this.discoverRemoteDocumentsRecursive(entry.url, entryPath, snapshot, changes, excludePaths);
388
- }
389
- }
390
- }
391
- catch (error) {
392
- output_1.out.taskLine(`Failed to process directory: ${error}`, true);
393
- }
394
- }
395
- /**
396
- * Get current filesystem state as a map
397
- */
398
- async getCurrentFilesystemState() {
399
- const fileMap = new Map();
400
- try {
401
- const entries = await (0, utils_1.listDirectory)(this.rootPath, true, this.excludePatterns);
402
- const fileEntries = entries.filter(entry => entry.type !== types_1.FileType.DIRECTORY);
403
- await Promise.all(fileEntries.map(async (entry) => {
404
- const relativePath = (0, utils_1.getRelativePath)(this.rootPath, entry.path);
405
- const content = await (0, utils_1.readFileContent)(entry.path);
406
- fileMap.set(relativePath, { content, type: entry.type });
407
- }));
408
- }
409
- catch (error) {
410
- output_1.out.taskLine(`Failed to scan filesystem: ${error}`, true);
411
- // Log more details about the error
412
- if (error instanceof Error) {
413
- output_1.out.taskLine(`Error details: ${error.message}`, true);
414
- if (error.stack) {
415
- output_1.out.taskLine(`Stack: ${error.stack}`, true);
416
- }
417
- }
418
- }
419
- return fileMap;
420
- }
421
- /**
422
- * Get local file content if it exists
423
- */
424
- async getLocalContent(relativePath) {
425
- try {
426
- const fullPath = (0, utils_1.joinAndNormalizePath)(this.rootPath, relativePath);
427
- return await (0, utils_1.readFileContent)(fullPath);
428
- }
429
- catch {
430
- return null;
431
- }
432
- }
433
- /**
434
- * Get content from Automerge document at specific head
435
- */
436
- async getContentAtHead(url, heads) {
437
- try {
438
- // Strip heads for current document state
439
- const plainUrl = (0, utils_1.getPlainUrl)(url);
440
- const handle = await this.repo.find(plainUrl);
441
- const doc = await handle.view(heads).doc();
442
- const content = doc?.content;
443
- return (0, utils_1.readDocContent)(content);
444
- }
445
- catch {
446
- return null;
447
- }
448
- }
449
- /**
450
- * Get current content from Automerge document
451
- */
452
- async getCurrentRemoteContent(url) {
453
- try {
454
- const plainUrl = (0, utils_1.getPlainUrl)(url);
455
- const result = await this.findDocument(plainUrl);
456
- if (!result)
457
- return null;
458
- const content = result.doc.content;
459
- return (0, utils_1.readDocContent)(content);
460
- }
461
- catch (error) {
462
- output_1.out.taskLine(`Failed to get remote content: ${error}`, true);
463
- return null;
464
- }
465
- }
466
- /**
467
- * Find and wait for a document to be available, with retry logic.
468
- * repo.find() rejects with "unavailable" if the server doesn't have the
469
- * document yet, and doc() throws if the handle isn't ready. We retry
470
- * both with backoff since the document may just not have propagated yet.
471
- */
472
- async findDocument(url, options = {}) {
473
- const { maxRetries = 5, retryDelayMs = 500 } = options;
474
- for (let attempt = 0; attempt < maxRetries; attempt++) {
475
- try {
476
- const handle = await this.repo.find(url);
477
- const doc = handle.doc();
478
- return { handle, doc };
479
- }
480
- catch {
481
- // Document may be unavailable — retry after a delay
482
- if (attempt < maxRetries - 1) {
483
- await new Promise(r => setTimeout(r, retryDelayMs * (attempt + 1)));
484
- }
485
- }
486
- }
487
- return undefined;
488
- }
489
- /**
490
- * Get current head of Automerge document
491
- */
492
- async getCurrentRemoteHead(url) {
493
- try {
494
- const plainUrl = (0, utils_1.getPlainUrl)(url);
495
- const result = await this.findDocument(plainUrl, {
496
- maxRetries: 3,
497
- retryDelayMs: 200,
498
- });
499
- if (!result)
500
- return [];
501
- return result.handle.heads();
502
- }
503
- catch {
504
- return [];
505
- }
506
- }
507
- /**
508
- * Determine file type from content
509
- */
510
- async getFileTypeFromContent(content) {
511
- if (content == null)
512
- return types_1.FileType.TEXT;
513
- if (content instanceof Uint8Array) {
514
- return types_1.FileType.BINARY;
515
- }
516
- else {
517
- return types_1.FileType.TEXT;
518
- }
519
- }
520
- /**
521
- * Classify change type for a path
522
- */
523
- async classifyChange(relativePath, snapshot) {
524
- const snapshotEntry = snapshot.files.get(relativePath);
525
- const localContent = await this.getLocalContent(relativePath);
526
- if (!snapshotEntry) {
527
- // New file
528
- return types_1.ChangeType.LOCAL_ONLY;
529
- }
530
- const lastKnownContent = await this.getContentAtHead(snapshotEntry.url, snapshotEntry.head);
531
- const currentRemoteContent = await this.getCurrentRemoteContent(snapshotEntry.url);
532
- const localChanged = localContent
533
- ? !(0, content_1.isContentEqual)(localContent, lastKnownContent)
534
- : true;
535
- const remoteChanged = !(0, content_1.isContentEqual)(lastKnownContent, currentRemoteContent);
536
- if (!localChanged && !remoteChanged) {
537
- return types_1.ChangeType.NO_CHANGE;
538
- }
539
- else if (localChanged && !remoteChanged) {
540
- return types_1.ChangeType.LOCAL_ONLY;
541
- }
542
- else if (!localChanged && remoteChanged) {
543
- return types_1.ChangeType.REMOTE_ONLY;
544
- }
545
- else {
546
- return types_1.ChangeType.BOTH_CHANGED;
547
- }
548
- }
549
- /**
550
- * Find a file's entry in the remote directory hierarchy.
551
- * Returns the entry (with name, type, url) or null if not found.
552
- */
553
- async findInRemoteDirectory(rootDirectoryUrl, filePath) {
554
- if (!rootDirectoryUrl)
555
- return null;
556
- return (0, utils_1.findFileInDirectoryHierarchy)(this.repo, rootDirectoryUrl, filePath);
557
- }
558
- }
559
- exports.ChangeDetector = ChangeDetector;
560
- //# sourceMappingURL=change-detection.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"change-detection.js","sourceRoot":"","sources":["../../src/core/change-detection.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAMA,wDAAyC;AACzC,oCAOiB;AACjB,oCAQiB;AACjB,8CAA4D;AAC5D,4CAAmC;AAEnC,MAAM,OAAO,GAAG,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAA;AACnC,SAAS,KAAK,CAAC,GAAG,IAAW;IAC5B,IAAI,OAAO;QAAE,OAAO,CAAC,KAAK,CAAC,6BAA6B,EAAE,GAAG,IAAI,CAAC,CAAA;AACnE,CAAC;AAED;;GAEG;AACH,MAAa,cAAc;IAC1B,YACS,IAAU,EACV,QAAgB,EAChB,kBAA4B,EAAE,EAC9B,sBAAgC,EAAE;QAHlC,SAAI,GAAJ,IAAI,CAAM;QACV,aAAQ,GAAR,QAAQ,CAAQ;QAChB,oBAAe,GAAf,eAAe,CAAe;QAC9B,wBAAmB,GAAnB,mBAAmB,CAAe;IACxC,CAAC;IAEJ;;;;OAIG;IACK,cAAc,CAAC,QAAgB;QAC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AC3C,OAAO,kBAAU,CAAC,UAAU,CAAA;QAC7B,CAAC;aAAM,IAAI,CAAC,YAAY,IAAI,aAAa,EAAE,CAAC;YAC3C,OAAO,kBAAU,CAAC,WAAW,CAAA;QAC9B,CAAC;aAAM,CAAC;YACP,OAAO,kBAAU,CAAC,YAAY,CAAA;QAC/B,CAAC;IACF,CAAC;IAED;;;OAGG;IACK,KAAK,CAAC,qBAAqB,CAClC,gBAA0C,EAC1C,QAAgB;QAEhB,IAAI,CAAC,gBAAgB;YAAE,OAAO,IAAI,CAAA;QAClC,OAAO,IAAA,oCAA4B,EAClC,IAAI,CAAC,IAAI,EACT,gBAAgB,EAChB,QAAQ,CACR,CAAA;IACF,CAAC;CACD;AApqBD,wCAoqBC"}
@@ -1,81 +0,0 @@
1
- import { GlobalConfig, DirectoryConfig } from "../types";
2
- /**
3
- * Configuration manager for pushwork
4
- */
5
- export declare class ConfigManager {
6
- private workingDir?;
7
- private static readonly GLOBAL_CONFIG_DIR;
8
- private static readonly CONFIG_FILENAME;
9
- static readonly CONFIG_DIR = ".pushwork";
10
- constructor(workingDir?: string | undefined);
11
- /**
12
- * Get global configuration path
13
- */
14
- private getGlobalConfigPath;
15
- /**
16
- * Get local configuration path
17
- */
18
- private getLocalConfigPath;
19
- /**
20
- * Load global configuration
21
- */
22
- loadGlobal(): Promise<GlobalConfig | null>;
23
- /**
24
- * Save global configuration
25
- */
26
- saveGlobal(config: GlobalConfig): Promise<void>;
27
- /**
28
- * Load local/directory configuration
29
- */
30
- load(): Promise<DirectoryConfig | null>;
31
- /**
32
- * Save local/directory configuration
33
- */
34
- save(config: DirectoryConfig): Promise<void>;
35
- private getDefaultGlobalConfig;
36
- /**
37
- * Get default configuration
38
- */
39
- getDefaultDirectoryConfig(): DirectoryConfig;
40
- /**
41
- * Get merged configuration (global + local)
42
- */
43
- getMerged(): Promise<DirectoryConfig>;
44
- /**
45
- * Initialize with CLI option overrides
46
- * Creates a new config with defaults + CLI overrides and saves it
47
- */
48
- initializeWithOverrides(overrides?: Partial<DirectoryConfig>): Promise<DirectoryConfig>;
49
- /**
50
- * Merge two configuration objects
51
- */
52
- private mergeConfigs;
53
- /**
54
- * Create default global configuration
55
- */
56
- createDefaultGlobal(): Promise<void>;
57
- /**
58
- * Check if global configuration exists
59
- */
60
- globalConfigExists(): Promise<boolean>;
61
- /**
62
- * Check if local configuration exists
63
- */
64
- localConfigExists(): Promise<boolean>;
65
- /**
66
- * Get configuration value by path (e.g., 'sync.move_detection_threshold')
67
- */
68
- getValue(keyPath: string): Promise<any>;
69
- /**
70
- * Set configuration value by path
71
- */
72
- setValue(keyPath: string, value: any): Promise<void>;
73
- /**
74
- * Validate configuration
75
- */
76
- validate(config: DirectoryConfig): {
77
- valid: boolean;
78
- errors: string[];
79
- };
80
- }
81
- //# sourceMappingURL=config.d.ts.map