pushwork 2.0.0-preview.6 → 2.0.0-preview.8

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 (127) hide show
  1. package/dist/branches.d.ts +1 -2
  2. package/dist/branches.d.ts.map +1 -1
  3. package/dist/branches.js +4 -23
  4. package/dist/branches.js.map +1 -1
  5. package/dist/cli/commands.d.ts +71 -0
  6. package/dist/cli/commands.d.ts.map +1 -0
  7. package/dist/cli/commands.js +794 -0
  8. package/dist/cli/commands.js.map +1 -0
  9. package/dist/cli/index.d.ts +2 -0
  10. package/dist/cli/index.d.ts.map +1 -0
  11. package/dist/cli/index.js +19 -0
  12. package/dist/cli/index.js.map +1 -0
  13. package/dist/cli.js +56 -1
  14. package/dist/cli.js.map +1 -1
  15. package/dist/commands.d.ts +58 -0
  16. package/dist/commands.d.ts.map +1 -0
  17. package/dist/commands.js +975 -0
  18. package/dist/commands.js.map +1 -0
  19. package/dist/config/index.d.ts +71 -0
  20. package/dist/config/index.d.ts.map +1 -0
  21. package/dist/config/index.js +314 -0
  22. package/dist/config/index.js.map +1 -0
  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/pushwork.d.ts +4 -0
  48. package/dist/pushwork.d.ts.map +1 -1
  49. package/dist/pushwork.js +74 -2
  50. package/dist/pushwork.js.map +1 -1
  51. package/dist/stash.d.ts +0 -2
  52. package/dist/stash.d.ts.map +1 -1
  53. package/dist/stash.js +0 -1
  54. package/dist/stash.js.map +1 -1
  55. package/dist/types/config.d.ts +102 -0
  56. package/dist/types/config.d.ts.map +1 -0
  57. package/dist/types/config.js +10 -0
  58. package/dist/types/config.js.map +1 -0
  59. package/dist/types/documents.d.ts +88 -0
  60. package/dist/types/documents.d.ts.map +1 -0
  61. package/dist/types/documents.js +23 -0
  62. package/dist/types/documents.js.map +1 -0
  63. package/dist/types/index.d.ts +4 -0
  64. package/dist/types/index.d.ts.map +1 -0
  65. package/dist/types/index.js +20 -0
  66. package/dist/types/index.js.map +1 -0
  67. package/dist/types/snapshot.d.ts +64 -0
  68. package/dist/types/snapshot.d.ts.map +1 -0
  69. package/dist/types/snapshot.js +3 -0
  70. package/dist/types/snapshot.js.map +1 -0
  71. package/dist/utils/content-similarity.d.ts +53 -0
  72. package/dist/utils/content-similarity.d.ts.map +1 -0
  73. package/dist/utils/content-similarity.js +155 -0
  74. package/dist/utils/content-similarity.js.map +1 -0
  75. package/dist/utils/content.d.ts +10 -0
  76. package/dist/utils/content.d.ts.map +1 -0
  77. package/dist/utils/content.js +35 -0
  78. package/dist/utils/content.js.map +1 -0
  79. package/dist/utils/directory.d.ts +24 -0
  80. package/dist/utils/directory.d.ts.map +1 -0
  81. package/dist/utils/directory.js +56 -0
  82. package/dist/utils/directory.js.map +1 -0
  83. package/dist/utils/fs.d.ts +74 -0
  84. package/dist/utils/fs.d.ts.map +1 -0
  85. package/dist/utils/fs.js +298 -0
  86. package/dist/utils/fs.js.map +1 -0
  87. package/dist/utils/index.d.ts +5 -0
  88. package/dist/utils/index.d.ts.map +1 -0
  89. package/dist/utils/index.js +21 -0
  90. package/dist/utils/index.js.map +1 -0
  91. package/dist/utils/mime-types.d.ts +13 -0
  92. package/dist/utils/mime-types.d.ts.map +1 -0
  93. package/dist/utils/mime-types.js +247 -0
  94. package/dist/utils/mime-types.js.map +1 -0
  95. package/dist/utils/network-sync.d.ts +30 -0
  96. package/dist/utils/network-sync.d.ts.map +1 -0
  97. package/dist/utils/network-sync.js +391 -0
  98. package/dist/utils/network-sync.js.map +1 -0
  99. package/dist/utils/node-polyfills.d.ts +9 -0
  100. package/dist/utils/node-polyfills.d.ts.map +1 -0
  101. package/dist/utils/node-polyfills.js +9 -0
  102. package/dist/utils/node-polyfills.js.map +1 -0
  103. package/dist/utils/output.d.ts +129 -0
  104. package/dist/utils/output.d.ts.map +1 -0
  105. package/dist/utils/output.js +375 -0
  106. package/dist/utils/output.js.map +1 -0
  107. package/dist/utils/repo-factory.d.ts +15 -0
  108. package/dist/utils/repo-factory.d.ts.map +1 -0
  109. package/dist/utils/repo-factory.js +156 -0
  110. package/dist/utils/repo-factory.js.map +1 -0
  111. package/dist/utils/string-similarity.d.ts +14 -0
  112. package/dist/utils/string-similarity.d.ts.map +1 -0
  113. package/dist/utils/string-similarity.js +43 -0
  114. package/dist/utils/string-similarity.js.map +1 -0
  115. package/dist/utils/text-diff.d.ts +37 -0
  116. package/dist/utils/text-diff.d.ts.map +1 -0
  117. package/dist/utils/text-diff.js +131 -0
  118. package/dist/utils/text-diff.js.map +1 -0
  119. package/dist/utils/trace.d.ts +19 -0
  120. package/dist/utils/trace.d.ts.map +1 -0
  121. package/dist/utils/trace.js +68 -0
  122. package/dist/utils/trace.js.map +1 -0
  123. package/package.json +5 -5
  124. package/dist/checkpoints.d.ts +0 -41
  125. package/dist/checkpoints.d.ts.map +0 -1
  126. package/dist/checkpoints.js +0 -210
  127. package/dist/checkpoints.js.map +0 -1
@@ -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,CAClC,OAAO,EAAE,MAAM,EACf,SAAS,UAAQ,EACjB,eAAe,GAAE,MAAM,EAAO,GAC5B,OAAO,CAAC,eAAe,EAAE,CAAC,CAoC5B;AAED;;GAEG;AACH,wBAAsB,QAAQ,CAC7B,UAAU,EAAE,MAAM,EAClB,QAAQ,EAAE,MAAM,GACd,OAAO,CAAC,IAAI,CAAC,CAOf;AAED;;GAEG;AACH,wBAAsB,QAAQ,CAC7B,UAAU,EAAE,MAAM,EAClB,QAAQ,EAAE,MAAM,GACd,OAAO,CAAC,IAAI,CAAC,CAGf;AAED;;GAEG;AACH,wBAAsB,oBAAoB,CACzC,OAAO,EAAE,MAAM,GAAG,UAAU,GAC1B,OAAO,CAAC,MAAM,CAAC,CAIjB;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAEpD;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAGzD;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAEtD;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,GAAG,KAAK,EAAE,MAAM,EAAE,GAAG,MAAM,CAK/D;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAE1E;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAO3D"}
@@ -0,0 +1,298 @@
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.pathExists = pathExists;
37
+ exports.getFileSystemEntry = getFileSystemEntry;
38
+ exports.isTextFile = isTextFile;
39
+ exports.readFileContent = readFileContent;
40
+ exports.writeFileContent = writeFileContent;
41
+ exports.ensureDirectoryExists = ensureDirectoryExists;
42
+ exports.removePath = removePath;
43
+ exports.listDirectory = listDirectory;
44
+ exports.copyFile = copyFile;
45
+ exports.movePath = movePath;
46
+ exports.calculateContentHash = calculateContentHash;
47
+ exports.getMimeType = getMimeType;
48
+ exports.getFileExtension = getFileExtension;
49
+ exports.normalizePath = normalizePath;
50
+ exports.joinAndNormalizePath = joinAndNormalizePath;
51
+ exports.getRelativePath = getRelativePath;
52
+ exports.formatRelativePath = formatRelativePath;
53
+ const fs = __importStar(require("fs/promises"));
54
+ const path = __importStar(require("path"));
55
+ const crypto = __importStar(require("crypto"));
56
+ const glob_1 = require("glob");
57
+ const mimeTypes = __importStar(require("mime-types"));
58
+ const ignore = __importStar(require("ignore"));
59
+ const types_1 = require("../types");
60
+ const mime_types_1 = require("./mime-types");
61
+ /**
62
+ * Check if a path exists
63
+ */
64
+ async function pathExists(filePath) {
65
+ try {
66
+ await fs.access(filePath);
67
+ return true;
68
+ }
69
+ catch {
70
+ return false;
71
+ }
72
+ }
73
+ /**
74
+ * Get file system entry metadata
75
+ */
76
+ async function getFileSystemEntry(filePath) {
77
+ try {
78
+ const stats = await fs.stat(filePath);
79
+ const type = stats.isDirectory()
80
+ ? types_1.FileType.DIRECTORY
81
+ : (await (0, mime_types_1.isEnhancedTextFile)(filePath))
82
+ ? types_1.FileType.TEXT
83
+ : types_1.FileType.BINARY;
84
+ return {
85
+ path: filePath,
86
+ type,
87
+ size: stats.size,
88
+ mtime: stats.mtime,
89
+ permissions: stats.mode & parseInt("777", 8),
90
+ };
91
+ }
92
+ catch {
93
+ return null;
94
+ }
95
+ }
96
+ /**
97
+ * Determine if a file is text or binary
98
+ */
99
+ async function isTextFile(filePath) {
100
+ try {
101
+ const mimeType = mimeTypes.lookup(filePath);
102
+ if (mimeType) {
103
+ return (mimeType.startsWith("text/") ||
104
+ mimeType === "application/json" ||
105
+ mimeType === "application/xml" ||
106
+ mimeType.includes("javascript") ||
107
+ mimeType.includes("typescript"));
108
+ }
109
+ // Sample first 8KB to detect binary content
110
+ const handle = await fs.open(filePath, "r");
111
+ const buffer = Buffer.alloc(Math.min(8192, (await handle.stat()).size));
112
+ await handle.read(buffer, 0, buffer.length, 0);
113
+ await handle.close();
114
+ // Check for null bytes which indicate binary content
115
+ return !buffer.includes(0);
116
+ }
117
+ catch {
118
+ return false;
119
+ }
120
+ }
121
+ /**
122
+ * Read file content as string or buffer
123
+ */
124
+ async function readFileContent(filePath) {
125
+ const isText = await (0, mime_types_1.isEnhancedTextFile)(filePath);
126
+ if (isText) {
127
+ return await fs.readFile(filePath, "utf8");
128
+ }
129
+ else {
130
+ const buffer = await fs.readFile(filePath);
131
+ return new Uint8Array(buffer);
132
+ }
133
+ }
134
+ /**
135
+ * Write file content from string or buffer
136
+ */
137
+ async function writeFileContent(filePath, content) {
138
+ await ensureDirectoryExists(path.dirname(filePath));
139
+ if (typeof content === "string") {
140
+ await fs.writeFile(filePath, content, "utf8");
141
+ }
142
+ else {
143
+ await fs.writeFile(filePath, content);
144
+ }
145
+ }
146
+ /**
147
+ * Ensure directory exists, creating it if necessary
148
+ */
149
+ async function ensureDirectoryExists(dirPath) {
150
+ try {
151
+ await fs.mkdir(dirPath, { recursive: true });
152
+ }
153
+ catch (error) {
154
+ if (error.code !== "EEXIST") {
155
+ throw error;
156
+ }
157
+ }
158
+ }
159
+ /**
160
+ * Remove file or directory
161
+ */
162
+ async function removePath(filePath) {
163
+ try {
164
+ const stats = await fs.stat(filePath);
165
+ if (stats.isDirectory()) {
166
+ await fs.rm(filePath, { recursive: true });
167
+ }
168
+ else {
169
+ await fs.unlink(filePath);
170
+ }
171
+ }
172
+ catch (error) {
173
+ if (error.code !== "ENOENT") {
174
+ throw error;
175
+ }
176
+ }
177
+ }
178
+ /**
179
+ * Check if a path matches any of the exclude patterns using the ignore library
180
+ * Supports proper gitignore-style patterns (e.g., "node_modules", "*.tmp", ".git")
181
+ */
182
+ function isExcluded(filePath, basePath, excludePatterns) {
183
+ if (excludePatterns.length === 0)
184
+ return false;
185
+ const relativePath = path.relative(basePath, filePath);
186
+ // Use the ignore library which implements proper .gitignore semantics
187
+ // This is the same library used by ESLint and other major tools
188
+ const ig = ignore.default().add(excludePatterns);
189
+ return ig.ignores(relativePath);
190
+ }
191
+ /**
192
+ * List directory contents with metadata
193
+ */
194
+ async function listDirectory(dirPath, recursive = false, excludePatterns = []) {
195
+ const entries = [];
196
+ try {
197
+ // Construct pattern using path.join for proper cross-platform handling
198
+ const pattern = recursive
199
+ ? path.join(dirPath, "**/*")
200
+ : path.join(dirPath, "*");
201
+ // glob expects forward slashes, even on Windows
202
+ const normalizedPattern = pattern.replace(/\\/g, "/");
203
+ // Use glob to get all paths (with dot files)
204
+ // Note: We don't use glob's ignore option because it doesn't support gitignore semantics
205
+ const paths = await (0, glob_1.glob)(normalizedPattern, {
206
+ dot: true,
207
+ });
208
+ // Parallelize all stat calls for better performance
209
+ const allEntries = await Promise.all(paths.map(async (filePath) => {
210
+ // Filter using proper gitignore semantics from the ignore library
211
+ if (isExcluded(filePath, dirPath, excludePatterns)) {
212
+ return null;
213
+ }
214
+ return await getFileSystemEntry(filePath);
215
+ }));
216
+ // Filter out null entries (excluded files or files that couldn't be read)
217
+ entries.push(...allEntries.filter((e) => e !== null));
218
+ }
219
+ catch {
220
+ // Return empty array if directory doesn't exist or can't be read
221
+ }
222
+ return entries;
223
+ }
224
+ /**
225
+ * Copy file with metadata preservation
226
+ */
227
+ async function copyFile(sourcePath, destPath) {
228
+ await ensureDirectoryExists(path.dirname(destPath));
229
+ await fs.copyFile(sourcePath, destPath);
230
+ // Preserve file permissions
231
+ const stats = await fs.stat(sourcePath);
232
+ await fs.chmod(destPath, stats.mode);
233
+ }
234
+ /**
235
+ * Move/rename file or directory
236
+ */
237
+ async function movePath(sourcePath, destPath) {
238
+ await ensureDirectoryExists(path.dirname(destPath));
239
+ await fs.rename(sourcePath, destPath);
240
+ }
241
+ /**
242
+ * Calculate content hash for change detection
243
+ */
244
+ async function calculateContentHash(content) {
245
+ const hash = crypto.createHash("sha256");
246
+ hash.update(content);
247
+ return hash.digest("hex");
248
+ }
249
+ /**
250
+ * Get MIME type for file
251
+ */
252
+ function getMimeType(filePath) {
253
+ return mimeTypes.lookup(filePath) || "application/octet-stream";
254
+ }
255
+ /**
256
+ * Get file extension
257
+ */
258
+ function getFileExtension(filePath) {
259
+ const ext = path.extname(filePath);
260
+ return ext.startsWith(".") ? ext.slice(1) : ext;
261
+ }
262
+ /**
263
+ * Normalize path separators for cross-platform compatibility
264
+ * Converts all path separators to forward slashes for consistent storage
265
+ */
266
+ function normalizePath(filePath) {
267
+ return path.posix.normalize(filePath.replace(/\\/g, "/"));
268
+ }
269
+ /**
270
+ * Join paths and normalize separators for cross-platform compatibility
271
+ * Use this instead of string concatenation to ensure proper path handling on Windows
272
+ */
273
+ function joinAndNormalizePath(...paths) {
274
+ // Use path.join to properly handle path construction (handles Windows drive letters, etc.)
275
+ const joined = path.join(...paths);
276
+ // Then normalize to forward slashes for consistent storage/comparison
277
+ return normalizePath(joined);
278
+ }
279
+ /**
280
+ * Get relative path from base directory
281
+ */
282
+ function getRelativePath(basePath, filePath) {
283
+ return normalizePath(path.relative(basePath, filePath));
284
+ }
285
+ /**
286
+ * Format a path as a relative path with proper prefix
287
+ * Ensures paths like "src" become "./src" for clarity
288
+ * Leaves absolute paths and paths already starting with . or .. unchanged
289
+ */
290
+ function formatRelativePath(filePath) {
291
+ // Already starts with . or / - leave as-is
292
+ if (filePath.startsWith(".") || filePath.startsWith("/")) {
293
+ return filePath;
294
+ }
295
+ // Add ./ prefix for clarity
296
+ return `./${filePath}`;
297
+ }
298
+ //# sourceMappingURL=fs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fs.js","sourceRoot":"","sources":["../../src/utils/fs.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAYA,gCAOC;AAKD,gDAqBC;AAKD,gCAwBC;AAKD,0CAWC;AAKD,4CAWC;AAKD,sDAQC;AAKD,gCAaC;AAyBD,sCAwCC;AAKD,4BAUC;AAKD,4BAMC;AAKD,oDAMC;AAKD,kCAEC;AAKD,4CAGC;AAMD,sCAEC;AAMD,oDAKC;AAKD,0CAEC;AAOD,gDAOC;AAtSD,gDAAiC;AACjC,2CAA4B;AAC5B,+CAAgC;AAChC,+BAAyB;AACzB,sDAAuC;AACvC,+CAAgC;AAChC,oCAAkD;AAClD,6CAA+C;AAE/C;;GAEG;AACI,KAAK,UAAU,UAAU,CAAC,QAAgB;IAChD,IAAI,CAAC;QACJ,MAAM,EAAE,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAA;QACzB,OAAO,IAAI,CAAA;IACZ,CAAC;IAAC,MAAM,CAAC;QACR,OAAO,KAAK,CAAA;IACb,CAAC;AACF,CAAC;AAED;;GAEG;AACI,KAAK,UAAU,kBAAkB,CACvC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AAoB,CAAC,GAAG,KAAe;IACtD,2FAA2F;IAC3F,MAAM,MAAM,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC,CAAA;IAClC,sEAAsE;IACtE,OAAO,aAAa,CAAC,MAAM,CAAC,CAAA;AAC7B,CAAC;AAED;;GAEG;AACH,SAAgB,eAAe,CAAC,QAAgB,EAAE,QAAgB;IACjE,OAAO,aAAa,CAAC,IAAI,CAAC,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC,CAAA;AACxD,CAAC;AAED;;;;GAIG;AACH,SAAgB,kBAAkB,CAAC,QAAgB;IAClD,2CAA2C;IAC3C,IAAI,QAAQ,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,QAAQ,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;QAC1D,OAAO,QAAQ,CAAA;IAChB,CAAC;IACD,4BAA4B;IAC5B,OAAO,KAAK,QAAQ,EAAE,CAAA;AACvB,CAAC"}
@@ -0,0 +1,5 @@
1
+ export * from "./fs";
2
+ export * from "./mime-types";
3
+ export * from "./directory";
4
+ export * from "./text-diff";
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,MAAM,CAAA;AACpB,cAAc,cAAc,CAAA;AAC5B,cAAc,aAAa,CAAA;AAC3B,cAAc,aAAa,CAAA"}
@@ -0,0 +1,21 @@
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 __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./fs"), exports);
18
+ __exportStar(require("./mime-types"), exports);
19
+ __exportStar(require("./directory"), exports);
20
+ __exportStar(require("./text-diff"), exports);
21
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,uCAAoB;AACpB,+CAA4B;AAC5B,8CAA2B;AAC3B,8CAA2B"}
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Get enhanced MIME type for file with custom dev file support
3
+ */
4
+ export declare function getEnhancedMimeType(filePath: string): string;
5
+ /**
6
+ * Check if file extension should be forced to text type
7
+ */
8
+ export declare function shouldForceAsText(filePath: string): boolean;
9
+ /**
10
+ * Enhanced text file detection with developer file support
11
+ */
12
+ export declare function isEnhancedTextFile(filePath: string): Promise<boolean>;
13
+ //# sourceMappingURL=mime-types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mime-types.d.ts","sourceRoot":"","sources":["../../src/utils/mime-types.ts"],"names":[],"mappings":"AA2GA;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAuB5D;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAG3D;AAiBD;;GAEG;AACH,wBAAsB,kBAAkB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAmB3E"}