pushwork 2.0.0-preview.2 → 2.0.0-preview.4

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 (131) hide show
  1. package/dist/cli/commands.d.ts +71 -0
  2. package/dist/cli/commands.d.ts.map +1 -0
  3. package/dist/cli/commands.js +794 -0
  4. package/dist/cli/commands.js.map +1 -0
  5. package/dist/cli/index.d.ts +2 -0
  6. package/dist/cli/index.d.ts.map +1 -0
  7. package/dist/cli/index.js +19 -0
  8. package/dist/cli/index.js.map +1 -0
  9. package/dist/cli.js +63 -103
  10. package/dist/cli.js.map +1 -1
  11. package/dist/commands.d.ts +58 -0
  12. package/dist/commands.d.ts.map +1 -0
  13. package/dist/commands.js +975 -0
  14. package/dist/commands.js.map +1 -0
  15. package/dist/config/index.d.ts +71 -0
  16. package/dist/config/index.d.ts.map +1 -0
  17. package/dist/config/index.js +314 -0
  18. package/dist/config/index.js.map +1 -0
  19. package/dist/config.d.ts +1 -2
  20. package/dist/config.d.ts.map +1 -1
  21. package/dist/config.js +1 -2
  22. package/dist/config.js.map +1 -1
  23. package/dist/core/change-detection.d.ts +80 -0
  24. package/dist/core/change-detection.d.ts.map +1 -0
  25. package/dist/core/change-detection.js +560 -0
  26. package/dist/core/change-detection.js.map +1 -0
  27. package/dist/core/config.d.ts +81 -0
  28. package/dist/core/config.d.ts.map +1 -0
  29. package/dist/core/config.js +304 -0
  30. package/dist/core/config.js.map +1 -0
  31. package/dist/core/index.d.ts +6 -0
  32. package/dist/core/index.d.ts.map +1 -0
  33. package/dist/core/index.js +22 -0
  34. package/dist/core/index.js.map +1 -0
  35. package/dist/core/move-detection.d.ts +34 -0
  36. package/dist/core/move-detection.d.ts.map +1 -0
  37. package/dist/core/move-detection.js +128 -0
  38. package/dist/core/move-detection.js.map +1 -0
  39. package/dist/core/snapshot.d.ts +105 -0
  40. package/dist/core/snapshot.d.ts.map +1 -0
  41. package/dist/core/snapshot.js +254 -0
  42. package/dist/core/snapshot.js.map +1 -0
  43. package/dist/core/sync-engine.d.ts +177 -0
  44. package/dist/core/sync-engine.d.ts.map +1 -0
  45. package/dist/core/sync-engine.js +1471 -0
  46. package/dist/core/sync-engine.js.map +1 -0
  47. package/dist/index.d.ts +3 -4
  48. package/dist/index.d.ts.map +1 -1
  49. package/dist/index.js +4 -14
  50. package/dist/index.js.map +1 -1
  51. package/dist/pushwork.d.ts +36 -68
  52. package/dist/pushwork.d.ts.map +1 -1
  53. package/dist/pushwork.js +233 -569
  54. package/dist/pushwork.js.map +1 -1
  55. package/dist/snarf.d.ts +21 -0
  56. package/dist/snarf.d.ts.map +1 -0
  57. package/dist/snarf.js +117 -0
  58. package/dist/snarf.js.map +1 -0
  59. package/dist/stash.d.ts +0 -2
  60. package/dist/stash.d.ts.map +1 -1
  61. package/dist/stash.js +0 -1
  62. package/dist/stash.js.map +1 -1
  63. package/dist/types/config.d.ts +102 -0
  64. package/dist/types/config.d.ts.map +1 -0
  65. package/dist/types/config.js +10 -0
  66. package/dist/types/config.js.map +1 -0
  67. package/dist/types/documents.d.ts +88 -0
  68. package/dist/types/documents.d.ts.map +1 -0
  69. package/dist/types/documents.js +23 -0
  70. package/dist/types/documents.js.map +1 -0
  71. package/dist/types/index.d.ts +4 -0
  72. package/dist/types/index.d.ts.map +1 -0
  73. package/dist/types/index.js +20 -0
  74. package/dist/types/index.js.map +1 -0
  75. package/dist/types/snapshot.d.ts +64 -0
  76. package/dist/types/snapshot.d.ts.map +1 -0
  77. package/dist/types/snapshot.js +3 -0
  78. package/dist/types/snapshot.js.map +1 -0
  79. package/dist/utils/content-similarity.d.ts +53 -0
  80. package/dist/utils/content-similarity.d.ts.map +1 -0
  81. package/dist/utils/content-similarity.js +155 -0
  82. package/dist/utils/content-similarity.js.map +1 -0
  83. package/dist/utils/content.d.ts +10 -0
  84. package/dist/utils/content.d.ts.map +1 -0
  85. package/dist/utils/content.js +35 -0
  86. package/dist/utils/content.js.map +1 -0
  87. package/dist/utils/directory.d.ts +24 -0
  88. package/dist/utils/directory.d.ts.map +1 -0
  89. package/dist/utils/directory.js +56 -0
  90. package/dist/utils/directory.js.map +1 -0
  91. package/dist/utils/fs.d.ts +74 -0
  92. package/dist/utils/fs.d.ts.map +1 -0
  93. package/dist/utils/fs.js +298 -0
  94. package/dist/utils/fs.js.map +1 -0
  95. package/dist/utils/index.d.ts +5 -0
  96. package/dist/utils/index.d.ts.map +1 -0
  97. package/dist/utils/index.js +21 -0
  98. package/dist/utils/index.js.map +1 -0
  99. package/dist/utils/mime-types.d.ts +13 -0
  100. package/dist/utils/mime-types.d.ts.map +1 -0
  101. package/dist/utils/mime-types.js +247 -0
  102. package/dist/utils/mime-types.js.map +1 -0
  103. package/dist/utils/network-sync.d.ts +30 -0
  104. package/dist/utils/network-sync.d.ts.map +1 -0
  105. package/dist/utils/network-sync.js +391 -0
  106. package/dist/utils/network-sync.js.map +1 -0
  107. package/dist/utils/node-polyfills.d.ts +9 -0
  108. package/dist/utils/node-polyfills.d.ts.map +1 -0
  109. package/dist/utils/node-polyfills.js +9 -0
  110. package/dist/utils/node-polyfills.js.map +1 -0
  111. package/dist/utils/output.d.ts +129 -0
  112. package/dist/utils/output.d.ts.map +1 -0
  113. package/dist/utils/output.js +375 -0
  114. package/dist/utils/output.js.map +1 -0
  115. package/dist/utils/repo-factory.d.ts +15 -0
  116. package/dist/utils/repo-factory.d.ts.map +1 -0
  117. package/dist/utils/repo-factory.js +156 -0
  118. package/dist/utils/repo-factory.js.map +1 -0
  119. package/dist/utils/string-similarity.d.ts +14 -0
  120. package/dist/utils/string-similarity.d.ts.map +1 -0
  121. package/dist/utils/string-similarity.js +43 -0
  122. package/dist/utils/string-similarity.js.map +1 -0
  123. package/dist/utils/text-diff.d.ts +37 -0
  124. package/dist/utils/text-diff.d.ts.map +1 -0
  125. package/dist/utils/text-diff.js +131 -0
  126. package/dist/utils/text-diff.js.map +1 -0
  127. package/dist/utils/trace.d.ts +19 -0
  128. package/dist/utils/trace.d.ts.map +1 -0
  129. package/dist/utils/trace.js +68 -0
  130. package/dist/utils/trace.js.map +1 -0
  131. package/package.json +1 -1
@@ -0,0 +1,64 @@
1
+ import { AutomergeUrl, UrlHeads } from "@automerge/automerge-repo";
2
+ /**
3
+ * Tracked file entry in the sync snapshot
4
+ */
5
+ export interface SnapshotFileEntry {
6
+ path: string;
7
+ url: AutomergeUrl;
8
+ head: UrlHeads;
9
+ extension: string;
10
+ mimeType: string;
11
+ contentHash?: string;
12
+ }
13
+ /**
14
+ * Tracked directory entry in the sync snapshot
15
+ */
16
+ export interface SnapshotDirectoryEntry {
17
+ path: string;
18
+ url: AutomergeUrl;
19
+ head: UrlHeads;
20
+ entries: string[];
21
+ }
22
+ /**
23
+ * Sync snapshot for local state management
24
+ */
25
+ export interface SyncSnapshot {
26
+ timestamp: number;
27
+ rootPath: string;
28
+ rootDirectoryUrl?: AutomergeUrl;
29
+ files: Map<string, SnapshotFileEntry>;
30
+ directories: Map<string, SnapshotDirectoryEntry>;
31
+ }
32
+ /**
33
+ * Serializable version of sync snapshot for storage
34
+ */
35
+ export interface SerializableSyncSnapshot {
36
+ timestamp: number;
37
+ rootPath: string;
38
+ rootDirectoryUrl?: AutomergeUrl;
39
+ files: Array<[string, SnapshotFileEntry]>;
40
+ directories: Array<[string, SnapshotDirectoryEntry]>;
41
+ }
42
+ /**
43
+ * Sync operation result
44
+ */
45
+ export interface SyncResult {
46
+ success: boolean;
47
+ filesChanged: number;
48
+ directoriesChanged: number;
49
+ errors: SyncError[];
50
+ warnings: string[];
51
+ timings?: {
52
+ [key: string]: number;
53
+ };
54
+ }
55
+ /**
56
+ * Sync error details
57
+ */
58
+ export interface SyncError {
59
+ path: string;
60
+ operation: string;
61
+ error: Error;
62
+ recoverable: boolean;
63
+ }
64
+ //# sourceMappingURL=snapshot.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"snapshot.d.ts","sourceRoot":"","sources":["../../src/types/snapshot.ts"],"names":[],"mappings":"AAAA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O,CAAC,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,CAAC;CACrC;AAED;;GAEG;AACH,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,KAAK,CAAC;IACb,WAAW,EAAE,OAAO,CAAC;CACtB"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=snapshot.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"snapshot.js","sourceRoot":"","sources":["../../src/types/snapshot.ts"],"names":[],"mappings":""}
@@ -0,0 +1,53 @@
1
+ /**
2
+ * Content similarity calculation for move detection
3
+ */
4
+ export declare class ContentSimilarity {
5
+ private static readonly CHUNK_SIZE;
6
+ private static readonly AUTO_THRESHOLD;
7
+ private static readonly PROMPT_THRESHOLD;
8
+ /**
9
+ * Calculate similarity between two content pieces
10
+ */
11
+ static calculateSimilarity(content1: string | Uint8Array, content2: string | Uint8Array): Promise<number>;
12
+ /**
13
+ * Check if two content pieces are identical
14
+ */
15
+ private static areIdentical;
16
+ /**
17
+ * Calculate similarity for small files using full content
18
+ */
19
+ private static calculateFullSimilarity;
20
+ /**
21
+ * Calculate similarity for large files using sampling
22
+ */
23
+ private static calculateSampledSimilarity;
24
+ /**
25
+ * Get representative samples from content
26
+ */
27
+ private static getSamples;
28
+ /**
29
+ * Calculate Levenshtein similarity (0-1 scale)
30
+ */
31
+ private static levenshteinSimilarity;
32
+ /**
33
+ * Calculate Levenshtein distance
34
+ */
35
+ private static levenshteinDistance;
36
+ /**
37
+ * Convert buffer to string for comparison
38
+ */
39
+ private static bufferToString;
40
+ /**
41
+ * Determine confidence level based on similarity score
42
+ */
43
+ static getConfidenceLevel(similarity: number): "auto" | "prompt" | "low";
44
+ /**
45
+ * Should auto-apply move based on similarity
46
+ */
47
+ static shouldAutoApply(similarity: number): boolean;
48
+ /**
49
+ * Should prompt user for move confirmation
50
+ */
51
+ static shouldPromptUser(similarity: number): boolean;
52
+ }
53
+ //# sourceMappingURL=content-similarity.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"content-similarity.d.ts","sourceRoot":"","sources":["../../src/utils/content-similarity.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,qBAAa,iBAAiB;IAC5B,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,UAAU,CAAQ;IAC1C,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,cAAc,CAAO;IAC7C,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,gBAAgB,CAAO;IAE/C;;OAEG;WACU,mBAAmB,CAC9B,QAAQ,EAAE,MAAM,GAAG,UAAU,EAC7B,QAAQ,EAAE,MAAM,GAAG,UAAU,GAC5B,OAAO,CAAC,MAAM,CAAC;IA0BlB;;OAEG;mBACkB,YAAY;IASjC;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,uBAAuB;IAYtC;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,0BAA0B;IAkBzC;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,UAAU;IAwBzB;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,qBAAqB;IAUpC;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,mBAAmB;IAsBlC;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,cAAc;IAO7B;;OAEG;IACH,MAAM,CAAC,kBAAkB,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,GAAG,QAAQ,GAAG,KAAK;IAUxE;;OAEG;IACH,MAAM,CAAC,eAAe,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO;IAInD;;OAEG;IACH,MAAM,CAAC,gBAAgB,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO;CAKrD"}
@@ -0,0 +1,155 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ContentSimilarity = void 0;
4
+ const fs_1 = require("./fs");
5
+ /**
6
+ * Content similarity calculation for move detection
7
+ */
8
+ class ContentSimilarity {
9
+ /**
10
+ * Calculate similarity between two content pieces
11
+ */
12
+ static async calculateSimilarity(content1, content2) {
13
+ // Quick early exit for identical content
14
+ if (await this.areIdentical(content1, content2)) {
15
+ return 1.0;
16
+ }
17
+ // Size-based quick rejection
18
+ const size1 = typeof content1 === "string" ? content1.length : content1.length;
19
+ const size2 = typeof content2 === "string" ? content2.length : content2.length;
20
+ const sizeDiff = Math.abs(size1 - size2) / Math.max(size1, size2);
21
+ if (sizeDiff > 0.5) {
22
+ return 0.0; // Too different in size
23
+ }
24
+ // For small files, use full content comparison
25
+ if (size1 < this.CHUNK_SIZE * 4 && size2 < this.CHUNK_SIZE * 4) {
26
+ return this.calculateFullSimilarity(content1, content2);
27
+ }
28
+ // For large files, use sampling
29
+ return this.calculateSampledSimilarity(content1, content2);
30
+ }
31
+ /**
32
+ * Check if two content pieces are identical
33
+ */
34
+ static async areIdentical(content1, content2) {
35
+ const hash1 = await (0, fs_1.calculateContentHash)(content1);
36
+ const hash2 = await (0, fs_1.calculateContentHash)(content2);
37
+ return hash1 === hash2;
38
+ }
39
+ /**
40
+ * Calculate similarity for small files using full content
41
+ */
42
+ static calculateFullSimilarity(content1, content2) {
43
+ const str1 = typeof content1 === "string" ? content1 : this.bufferToString(content1);
44
+ const str2 = typeof content2 === "string" ? content2 : this.bufferToString(content2);
45
+ return this.levenshteinSimilarity(str1, str2);
46
+ }
47
+ /**
48
+ * Calculate similarity for large files using sampling
49
+ */
50
+ static calculateSampledSimilarity(content1, content2) {
51
+ const samples1 = this.getSamples(content1);
52
+ const samples2 = this.getSamples(content2);
53
+ let totalSimilarity = 0;
54
+ let comparisons = 0;
55
+ for (let i = 0; i < Math.min(samples1.length, samples2.length); i++) {
56
+ totalSimilarity += this.levenshteinSimilarity(samples1[i], samples2[i]);
57
+ comparisons++;
58
+ }
59
+ return comparisons > 0 ? totalSimilarity / comparisons : 0;
60
+ }
61
+ /**
62
+ * Get representative samples from content
63
+ */
64
+ static getSamples(content) {
65
+ const str = typeof content === "string" ? content : this.bufferToString(content);
66
+ const length = str.length;
67
+ const samples = [];
68
+ if (length <= this.CHUNK_SIZE) {
69
+ samples.push(str);
70
+ return samples;
71
+ }
72
+ // Beginning
73
+ samples.push(str.slice(0, this.CHUNK_SIZE));
74
+ // Middle
75
+ const midStart = Math.floor(length / 2) - Math.floor(this.CHUNK_SIZE / 2);
76
+ samples.push(str.slice(midStart, midStart + this.CHUNK_SIZE));
77
+ // End
78
+ samples.push(str.slice(-this.CHUNK_SIZE));
79
+ return samples;
80
+ }
81
+ /**
82
+ * Calculate Levenshtein similarity (0-1 scale)
83
+ */
84
+ static levenshteinSimilarity(str1, str2) {
85
+ if (str1 === str2)
86
+ return 1.0;
87
+ if (str1.length === 0 || str2.length === 0)
88
+ return 0.0;
89
+ const distance = this.levenshteinDistance(str1, str2);
90
+ const maxLength = Math.max(str1.length, str2.length);
91
+ return 1 - distance / maxLength;
92
+ }
93
+ /**
94
+ * Calculate Levenshtein distance
95
+ */
96
+ static levenshteinDistance(str1, str2) {
97
+ const matrix = Array(str2.length + 1)
98
+ .fill(null)
99
+ .map(() => Array(str1.length + 1).fill(null));
100
+ for (let i = 0; i <= str1.length; i++)
101
+ matrix[0][i] = i;
102
+ for (let j = 0; j <= str2.length; j++)
103
+ matrix[j][0] = j;
104
+ for (let j = 1; j <= str2.length; j++) {
105
+ for (let i = 1; i <= str1.length; i++) {
106
+ const indicator = str1[i - 1] === str2[j - 1] ? 0 : 1;
107
+ matrix[j][i] = Math.min(matrix[j][i - 1] + 1, // deletion
108
+ matrix[j - 1][i] + 1, // insertion
109
+ matrix[j - 1][i - 1] + indicator // substitution
110
+ );
111
+ }
112
+ }
113
+ return matrix[str2.length][str1.length];
114
+ }
115
+ /**
116
+ * Convert buffer to string for comparison
117
+ */
118
+ static bufferToString(buffer) {
119
+ // For binary content, use hex representation for comparison
120
+ return Array.from(buffer)
121
+ .map((b) => b.toString(16).padStart(2, "0"))
122
+ .join("");
123
+ }
124
+ /**
125
+ * Determine confidence level based on similarity score
126
+ */
127
+ static getConfidenceLevel(similarity) {
128
+ if (similarity >= this.AUTO_THRESHOLD) {
129
+ return "auto";
130
+ }
131
+ else if (similarity >= this.PROMPT_THRESHOLD) {
132
+ return "prompt";
133
+ }
134
+ else {
135
+ return "low";
136
+ }
137
+ }
138
+ /**
139
+ * Should auto-apply move based on similarity
140
+ */
141
+ static shouldAutoApply(similarity) {
142
+ return similarity >= this.AUTO_THRESHOLD;
143
+ }
144
+ /**
145
+ * Should prompt user for move confirmation
146
+ */
147
+ static shouldPromptUser(similarity) {
148
+ return (similarity >= this.PROMPT_THRESHOLD && similarity < this.AUTO_THRESHOLD);
149
+ }
150
+ }
151
+ exports.ContentSimilarity = ContentSimilarity;
152
+ ContentSimilarity.CHUNK_SIZE = 1024; // 1KB chunks for sampling
153
+ ContentSimilarity.AUTO_THRESHOLD = 0.8;
154
+ ContentSimilarity.PROMPT_THRESHOLD = 0.5;
155
+ //# sourceMappingURL=content-similarity.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"content-similarity.js","sourceRoot":"","sources":["../../src/utils/content-similarity.ts"],"names":[],"mappings":";;;AAAA,6BAA4C;AAE5C;;GAEG;AACH,MAAa,iBAAiB;IAK5B;;OAEG;IACH,MAAM,CAAC,KAAK,CAAC,mBAAmB,CAC9B,QAA6B,EAC7B,QAA6B;QAE7B,yCAAyC;QACzC,IAAI,MAAM,IAAI,CAAC,YAAY,CAAC,QAAQ,EAAE,QAAQ,CAAC,EAAE,CAAC;YAChD,OAAO,GAAG,CAAC;QACb,CAAC;QAED,6BAA6B;QAC7B,MAAM,KAAK,GACT,OAAO,QAAQ,KAAK,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC;QACnE,MAAM,KAAK,GACT,OAAO,QAAQ,KAAK,QA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,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC;aACtB,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;aAC3C,IAAI,CAAC,EAAE,CAAC,CAAC;IACd,CAAC;IAED;;OAEG;IACH,MAAM,CAAC,kBAAkB,CAAC,UAAkB;QAC1C,IAAI,UAAU,IAAI,IAAI,CAAC,cAAc,EAAE,CAAC;YACtC,OAAO,MAAM,CAAC;QAChB,CAAC;aAAM,IAAI,UAAU,IAAI,IAAI,CAAC,gBAAgB,EAAE,CAAC;YAC/C,OAAO,QAAQ,CAAC;QAClB,CAAC;aAAM,CAAC;YACN,OAAO,KAAK,CAAC;QACf,CAAC;IACH,CAAC;IAED;;OAEG;IACH,MAAM,CAAC,eAAe,CAAC,UAAkB;QACvC,OAAO,UAAU,IAAI,IAAI,CAAC,cAAc,CAAC;IAC3C,CAAC;IAED;;OAEG;IACH,MAAM,CAAC,gBAAgB,CAAC,UAAkB;QACxC,OAAO,CACL,UAAU,IAAI,IAAI,CAAC,gBAAgB,IAAI,UAAU,GAAG,IAAI,CAAC,cAAc,CACxE,CAAC;IACJ,CAAC;;AA3LH,8CA4LC;AA3LyB,4BAAU,GAAG,IAAI,CAAC,CAAC,0BAA0B;AAC7C,gCAAc,GAAG,GAAG,CAAC;AACrB,kCAAgB,GAAG,GAAG,CAAC"}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Compute a SHA-256 hash of file content.
3
+ * Used to detect local changes for artifact files without reading remote docs.
4
+ */
5
+ export declare function contentHash(content: string | Uint8Array): string;
6
+ /**
7
+ * Compare two content pieces for equality
8
+ */
9
+ export declare function isContentEqual(content1: string | Uint8Array | null, content2: string | Uint8Array | null): boolean;
10
+ //# sourceMappingURL=content.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"content.d.ts","sourceRoot":"","sources":["../../src/utils/content.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,wBAAgB,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,UAAU,GAAG,MAAM,CAEhE;AAED;;GAEG;AACH,wBAAgB,cAAc,CAC5B,QAAQ,EAAE,MAAM,GAAG,UAAU,GAAG,IAAI,EACpC,QAAQ,EAAE,MAAM,GAAG,UAAU,GAAG,IAAI,GACnC,OAAO,CAiBT"}
@@ -0,0 +1,35 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.contentHash = contentHash;
4
+ exports.isContentEqual = isContentEqual;
5
+ const crypto_1 = require("crypto");
6
+ /**
7
+ * Compute a SHA-256 hash of file content.
8
+ * Used to detect local changes for artifact files without reading remote docs.
9
+ */
10
+ function contentHash(content) {
11
+ return (0, crypto_1.createHash)("sha256").update(content).digest("hex");
12
+ }
13
+ /**
14
+ * Compare two content pieces for equality
15
+ */
16
+ function isContentEqual(content1, content2) {
17
+ if (content1 === content2)
18
+ return true;
19
+ if (content1 == null || content2 == null)
20
+ return false;
21
+ if (typeof content1 !== typeof content2)
22
+ return false;
23
+ if (typeof content1 === "string") {
24
+ return content1 === content2;
25
+ }
26
+ else {
27
+ // Compare Uint8Array using native Buffer.equals() for better performance
28
+ const buf1 = content1;
29
+ const buf2 = content2;
30
+ if (buf1.length !== buf2.length)
31
+ return false;
32
+ return Buffer.from(buf1).equals(Buffer.from(buf2));
33
+ }
34
+ }
35
+ //# sourceMappingURL=content.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"content.js","sourceRoot":"","sources":["../../src/utils/content.ts"],"names":[],"mappings":";;AAMA,kCAEC;AAKD,wCAoBC;AAjCD,mCAAoC;AAEpC;;;GAGG;AACH,SAAgB,WAAW,CAAC,OAA4B;IACtD,OAAO,IAAA,mBAAU,EAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AAC5D,CAAC;AAED;;GAEG;AACH,SAAgB,cAAc,CAC5B,QAAoC,EACpC,QAAoC;IAEpC,IAAI,QAAQ,KAAK,QAAQ;QAAE,OAAO,IAAI,CAAC;IACvC,IAAI,QAAQ,IAAI,IAAI,IAAI,QAAQ,IAAI,IAAI;QAAE,OAAO,KAAK,CAAC;IAEvD,IAAI,OAAO,QAAQ,KAAK,OAAO,QAAQ;QAAE,OAAO,KAAK,CAAC;IAEtD,IAAI,OAAO,QAAQ,KAAK,QAAQ,EAAE,CAAC;QACjC,OAAO,QAAQ,KAAK,QAAQ,CAAC;IAC/B,CAAC;SAAM,CAAC;QACN,yEAAyE;QACzE,MAAM,IAAI,GAAG,QAAsB,CAAC;QACpC,MAAM,IAAI,GAAG,QAAsB,CAAC;QAEpC,IAAI,IAAI,CAAC,MAAM,KAAK,IAAI,CAAC,MAAM;YAAE,OAAO,KAAK,CAAC;QAE9C,OAAO,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;IACrD,CAAC;AACH,CAAC"}
@@ -0,0 +1,24 @@
1
+ import { AutomergeUrl, Repo } from "@automerge/automerge-repo";
2
+ /**
3
+ * Get a plain URL (without heads) from any URL.
4
+ * Versioned URLs with heads return view handles, which show a frozen point in time.
5
+ * For internal navigation, we always want to see the CURRENT state of documents.
6
+ */
7
+ export declare function getPlainUrl(url: AutomergeUrl): AutomergeUrl;
8
+ /**
9
+ * Find a file in the directory hierarchy by path.
10
+ *
11
+ * IMPORTANT: This function strips heads from all URLs before navigation.
12
+ * This ensures we always see the CURRENT state of directories, not a frozen
13
+ * point-in-time view. This is critical because:
14
+ * 1. Directory documents store versioned URLs for subdirectories
15
+ * 2. These URLs may have been captured when the subdirectory was empty
16
+ * 3. Using versioned URLs would make files appear to not exist
17
+ * 4. This would trigger false "remote deletion" detection
18
+ */
19
+ export declare function findFileInDirectoryHierarchy(repo: Repo, directoryUrl: AutomergeUrl, filePath: string): Promise<{
20
+ name: string;
21
+ type: string;
22
+ url: AutomergeUrl;
23
+ } | null>;
24
+ //# sourceMappingURL=directory.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"directory.d.ts","sourceRoot":"","sources":["../../src/utils/directory.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EACZ,IAAI,EAGL,MAAM,2BAA2B,CAAC;AAGnC;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,GAAG,EAAE,YAAY,GAAG,YAAY,CAG3D;AAED;;;;;;;;;;GAUG;AACH,wBAAsB,4BAA4B,CAChD,IAAI,EAAE,IAAI,EACV,YAAY,EAAE,YAAY,EAC1B,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,YAAY,CAAA;CAAE,GAAG,IAAI,CAAC,CAuCnE"}
@@ -0,0 +1,56 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getPlainUrl = getPlainUrl;
4
+ exports.findFileInDirectoryHierarchy = findFileInDirectoryHierarchy;
5
+ const automerge_repo_1 = require("@automerge/automerge-repo");
6
+ /**
7
+ * Get a plain URL (without heads) from any URL.
8
+ * Versioned URLs with heads return view handles, which show a frozen point in time.
9
+ * For internal navigation, we always want to see the CURRENT state of documents.
10
+ */
11
+ function getPlainUrl(url) {
12
+ const { documentId } = (0, automerge_repo_1.parseAutomergeUrl)(url);
13
+ return (0, automerge_repo_1.stringifyAutomergeUrl)({ documentId });
14
+ }
15
+ /**
16
+ * Find a file in the directory hierarchy by path.
17
+ *
18
+ * IMPORTANT: This function strips heads from all URLs before navigation.
19
+ * This ensures we always see the CURRENT state of directories, not a frozen
20
+ * point-in-time view. This is critical because:
21
+ * 1. Directory documents store versioned URLs for subdirectories
22
+ * 2. These URLs may have been captured when the subdirectory was empty
23
+ * 3. Using versioned URLs would make files appear to not exist
24
+ * 4. This would trigger false "remote deletion" detection
25
+ */
26
+ async function findFileInDirectoryHierarchy(repo, directoryUrl, filePath) {
27
+ try {
28
+ const pathParts = filePath.split("/");
29
+ let currentDirUrl = getPlainUrl(directoryUrl);
30
+ // Navigate through directories to find the parent directory
31
+ for (let i = 0; i < pathParts.length - 1; i++) {
32
+ const dirName = pathParts[i];
33
+ const dirHandle = await repo.find(currentDirUrl);
34
+ const dirDoc = await dirHandle.doc();
35
+ if (!dirDoc)
36
+ return null;
37
+ const subDirEntry = dirDoc.docs.find((entry) => entry.name === dirName && entry.type === "folder");
38
+ if (!subDirEntry)
39
+ return null;
40
+ currentDirUrl = getPlainUrl(subDirEntry.url);
41
+ }
42
+ // Now look for the file in the final directory
43
+ const fileName = pathParts[pathParts.length - 1];
44
+ const finalDirHandle = await repo.find(currentDirUrl);
45
+ const finalDirDoc = await finalDirHandle.doc();
46
+ if (!finalDirDoc)
47
+ return null;
48
+ const fileEntry = finalDirDoc.docs.find((entry) => entry.name === fileName && entry.type === "file");
49
+ return fileEntry || null;
50
+ }
51
+ catch (error) {
52
+ // Failed to find file in hierarchy
53
+ return null;
54
+ }
55
+ }
56
+ //# sourceMappingURL=directory.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"directory.js","sourceRoot":"","sources":["../../src/utils/directory.ts"],"names":[],"mappings":";;AAaA,kCAGC;AAaD,oEA2CC;AAxED,8DAKmC;AAGnC;;;;GAIG;AACH,SAAgB,WAAW,CAAC,GAAiB;IAC3C,MAAM,EAAE,UAAU,EAAE,GAAG,IAAA,kCAAiB,EAAC,GAAG,CAAC,CAAC;IAC9C,OAAO,IAAA,sCAAqB,EAAC,EAAE,UAAU,EAAE,CAAC,CAAC;AAC/C,CAAC;AAED;;;;;;;;;;GAUG;AACI,KAAK,UAAU,4BAA4B,CAChD,IAAU,EACV,YAA0B,EAC1B,QAAgB;IAEhB,IAAI,CAAC;QACH,MAAM,SAAS,GAAG,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAA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AO,KAAK,EAAE,CAAC;QACf,mCAAmC;QACnC,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC"}
@@ -0,0 +1,74 @@
1
+ import { FileSystemEntry } from "../types";
2
+ /**
3
+ * Check if a path exists
4
+ */
5
+ export declare function pathExists(filePath: string): Promise<boolean>;
6
+ /**
7
+ * Get file system entry metadata
8
+ */
9
+ export declare function getFileSystemEntry(filePath: string): Promise<FileSystemEntry | null>;
10
+ /**
11
+ * Determine if a file is text or binary
12
+ */
13
+ export declare function isTextFile(filePath: string): Promise<boolean>;
14
+ /**
15
+ * Read file content as string or buffer
16
+ */
17
+ export declare function readFileContent(filePath: string): Promise<string | Uint8Array>;
18
+ /**
19
+ * Write file content from string or buffer
20
+ */
21
+ export declare function writeFileContent(filePath: string, content: string | Uint8Array): Promise<void>;
22
+ /**
23
+ * Ensure directory exists, creating it if necessary
24
+ */
25
+ export declare function ensureDirectoryExists(dirPath: string): Promise<void>;
26
+ /**
27
+ * Remove file or directory
28
+ */
29
+ export declare function removePath(filePath: string): Promise<void>;
30
+ /**
31
+ * List directory contents with metadata
32
+ */
33
+ export declare function listDirectory(dirPath: string, recursive?: boolean, excludePatterns?: string[]): Promise<FileSystemEntry[]>;
34
+ /**
35
+ * Copy file with metadata preservation
36
+ */
37
+ export declare function copyFile(sourcePath: string, destPath: string): Promise<void>;
38
+ /**
39
+ * Move/rename file or directory
40
+ */
41
+ export declare function movePath(sourcePath: string, destPath: string): Promise<void>;
42
+ /**
43
+ * Calculate content hash for change detection
44
+ */
45
+ export declare function calculateContentHash(content: string | Uint8Array): Promise<string>;
46
+ /**
47
+ * Get MIME type for file
48
+ */
49
+ export declare function getMimeType(filePath: string): string;
50
+ /**
51
+ * Get file extension
52
+ */
53
+ export declare function getFileExtension(filePath: string): string;
54
+ /**
55
+ * Normalize path separators for cross-platform compatibility
56
+ * Converts all path separators to forward slashes for consistent storage
57
+ */
58
+ export declare function normalizePath(filePath: string): string;
59
+ /**
60
+ * Join paths and normalize separators for cross-platform compatibility
61
+ * Use this instead of string concatenation to ensure proper path handling on Windows
62
+ */
63
+ export declare function joinAndNormalizePath(...paths: string[]): string;
64
+ /**
65
+ * Get relative path from base directory
66
+ */
67
+ export declare function getRelativePath(basePath: string, filePath: string): string;
68
+ /**
69
+ * Format a path as a relative path with proper prefix
70
+ * Ensures paths like "src" become "./src" for clarity
71
+ * Leaves absolute paths and paths already starting with . or .. unchanged
72
+ */
73
+ export declare function formatRelativePath(filePath: string): string;
74
+ //# sourceMappingURL=fs.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fs.d.ts","sourceRoot":"","sources":["../../src/utils/fs.ts"],"names":[],"mappings":"AAMA,OAAO,EAAC,eAAe,EAAW,MAAM,UAAU,CAAA;AAGlD;;GAEG;AACH,wBAAsB,UAAU,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAOnE;AAED;;GAEG;AACH,wBAAsB,kBAAkB,CACvC,QAAQ,EAAE,MAAM,GACd,OAAO,CAAC,eAAe,GAAG,IAAI,CAAC,CAmBjC;AAED;;GAEG;AACH,wBAAsB,UAAU,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAwBnE;AAED;;GAEG;AACH,wBAAsB,eAAe,CACpC,QAAQ,EAAE,MAAM,GACd,OAAO,CAAC,MAAM,GAAG,UAAU,CAAC,CAS9B;AAED;;GAEG;AACH,wBAAsB,gBAAgB,CACrC,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,MAAM,GAAG,UAAU,GAC1B,OAAO,CAAC,IAAI,CAAC,CAQf;AAED;;GAEG;AACH,wBAAsB,qBAAqB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAQ1E;AAED;;GAEG;AACH,wBAAsB,UAAU,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAahE;AAsBD;;GAEG;AACH,wBAAsB,aAAa,CA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