@cmmd-center/forge 0.13.6 → 0.13.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 (78) hide show
  1. package/dist/{BunHttpServer-DKvSpNd1.cjs → BunHttpServer-C7-1JJ7b.cjs} +4 -4
  2. package/dist/{BunHttpServer-CDh4Vioe.mjs → BunHttpServer-CVPGkizx.mjs} +4 -4
  3. package/dist/{BunServices-D6PAheqS.mjs → BunServices-CPrZSIfE.mjs} +2 -2
  4. package/dist/{BunServices-DDh7Whyx.cjs → BunServices-Dl-3897e.cjs} +2 -2
  5. package/dist/{Cache-BVilO50s.mjs → Cache-C9cwdCDt.mjs} +2 -2
  6. package/dist/{Cache-DCF22Dfk.cjs → Cache-Cf3ARNaS.cjs} +2 -2
  7. package/dist/{HttpServer-ClsGgAq1.mjs → HttpServer-COaBeM7-.mjs} +2 -2
  8. package/dist/{HttpServer-D1gSU7NX.cjs → HttpServer-CggZzScj.cjs} +3 -3
  9. package/dist/{NodeHttpServer-Dfc7nSMq.cjs → NodeHttpServer-Bi339XFk.cjs} +5 -5
  10. package/dist/{NodeHttpServer-DT0TF8s4.mjs → NodeHttpServer-UQnvZnmu.mjs} +5 -5
  11. package/dist/{NodePTY-loxi8Vku.mjs → NodePTY-B1u6RHXk.mjs} +2 -2
  12. package/dist/{NodePTY-S4tPEwZc.cjs → NodePTY-UOaRyQsj.cjs} +2 -2
  13. package/dist/{NodeServices-Cb0rXFb2.cjs → NodeServices-CKFIZVu5.cjs} +2 -2
  14. package/dist/{NodeServices-DE8jhdcU.cjs → NodeServices-R0BZsZ72.cjs} +1 -1
  15. package/dist/{NodeServices-BahzLhbo.mjs → NodeServices-z1Ac4lEO.mjs} +2 -2
  16. package/dist/{NodeSqliteClient-DqFjB3u_.mjs → NodeSqliteClient-BrzqdOsF.mjs} +4 -4
  17. package/dist/{NodeSqliteClient-qjBWAOGq.cjs → NodeSqliteClient-CyJvo9y9.cjs} +4 -4
  18. package/dist/{NodeTerminal-rYbifme7.cjs → NodeTerminal-B89MobLp.cjs} +2 -2
  19. package/dist/{NodeTerminal-BPw7bktz.mjs → NodeTerminal-pYVVRTiD.mjs} +2 -2
  20. package/dist/{Path-CGCc_dDx.cjs → Path-BunGrE8F.cjs} +72 -1
  21. package/dist/{Path-C851t6sC.mjs → Path-evOm-H0Q.mjs} +61 -2
  22. package/dist/{SqlError-CzB6p9lL.cjs → SqlError-1wIMjXAf.cjs} +2 -2
  23. package/dist/{SqlError-3aqibZrj.mjs → SqlError-CezTFGvr.mjs} +2 -2
  24. package/dist/{SqliteClient-DTWCGkrj.mjs → SqliteClient-D3Yd3ZHn.mjs} +3 -3
  25. package/dist/{SqliteClient-Cq1peWN1.cjs → SqliteClient-bo7iui1t.cjs} +3 -3
  26. package/dist/bin.cjs +4875 -3961
  27. package/dist/bin.mjs +4422 -3514
  28. package/dist/client/assets/{CanvasPanel-BwSV27Ct.js → CanvasPanel-z0F-jdf1.js} +2 -2
  29. package/dist/client/assets/{CompositeItem-CZk3X-ud.js → CompositeItem-P9UVXCKv.js} +2 -2
  30. package/dist/client/assets/DiffPanel-CBfeDIH3.js +64 -0
  31. package/dist/client/assets/{DiffPanel.logic-D-SDgBF9.js → DiffPanel.logic-CZdlskWf.js} +2 -2
  32. package/dist/client/assets/DiffPanelShell-BnSbIo9A.js +2532 -0
  33. package/dist/client/assets/{DiffWorkerPoolProvider-BO_xUE3R.js → DiffWorkerPoolProvider-DC4SN57K.js} +9 -9
  34. package/dist/client/assets/{PullRequestCodePanel-CW4RK1Oa.js → PullRequestCodePanel-DwjjRPkc.js} +3 -3
  35. package/dist/client/assets/Virtualizer-ClYwoP30.js +2 -0
  36. package/dist/client/assets/{canvasStateStore-5DH2Z-PG.js → canvasStateStore-CdQxd2aO.js} +2 -2
  37. package/dist/client/assets/cmmdAuthRedirect-Bp1uQaQ9.js +2 -0
  38. package/dist/client/assets/index-BE83u7Db.css +1 -0
  39. package/dist/client/assets/index-CZhTqk2p.js +153 -0
  40. package/dist/client/assets/{popover-Dxp_1Sz0.js → popover-CUSlb3eK.js} +2 -2
  41. package/dist/client/assets/src-BL-mOkT1.js +3 -0
  42. package/dist/client/assets/{toggle-B-GE6jq_.js → toggle-BREV66nT.js} +2 -2
  43. package/dist/client/index.html +11 -11
  44. package/dist/forge-build.json +1 -1
  45. package/dist/node_modules/@ff-labs/fff-bin-linux-x64-gnu/libfff_c.so +0 -0
  46. package/dist/node_modules/@ff-labs/fff-bin-linux-x64-gnu/package.json +27 -0
  47. package/dist/node_modules/@ff-labs/fff-node/.bun-tag-689ffe3747e13d19 +0 -0
  48. package/dist/node_modules/@ff-labs/fff-node/README.md +126 -0
  49. package/dist/node_modules/@ff-labs/fff-node/dist/src/binary.d.ts +22 -0
  50. package/dist/node_modules/@ff-labs/fff-node/dist/src/binary.js +144 -0
  51. package/dist/node_modules/@ff-labs/fff-node/dist/src/fff-api.d.ts +581 -0
  52. package/dist/node_modules/@ff-labs/fff-node/dist/src/fff-api.js +24 -0
  53. package/dist/node_modules/@ff-labs/fff-node/dist/src/ffi.d.ts +137 -0
  54. package/dist/node_modules/@ff-labs/fff-node/dist/src/ffi.js +1191 -0
  55. package/dist/node_modules/@ff-labs/fff-node/dist/src/finder.d.ts +353 -0
  56. package/dist/node_modules/@ff-labs/fff-node/dist/src/finder.js +488 -0
  57. package/dist/node_modules/@ff-labs/fff-node/dist/src/index.d.ts +47 -0
  58. package/dist/node_modules/@ff-labs/fff-node/dist/src/index.js +47 -0
  59. package/dist/node_modules/@ff-labs/fff-node/dist/src/platform.d.ts +27 -0
  60. package/dist/node_modules/@ff-labs/fff-node/dist/src/platform.js +120 -0
  61. package/dist/node_modules/@ff-labs/fff-node/package.json +76 -0
  62. package/dist/node_modules/@yuuang/ffi-rs-linux-x64-gnu/README.md +794 -0
  63. package/dist/node_modules/@yuuang/ffi-rs-linux-x64-gnu/ffi-rs.linux-x64-gnu.node +0 -0
  64. package/dist/node_modules/@yuuang/ffi-rs-linux-x64-gnu/package.json +21 -0
  65. package/dist/node_modules/ffi-rs/LICENSE +21 -0
  66. package/dist/node_modules/ffi-rs/README.md +794 -0
  67. package/dist/node_modules/ffi-rs/index.d.ts +222 -0
  68. package/dist/node_modules/ffi-rs/index.js +380 -0
  69. package/dist/node_modules/ffi-rs/package.json +76 -0
  70. package/dist/{open-FIgTDosf.mjs → open-D8mGyWmt.mjs} +3 -3
  71. package/package.json +2 -1
  72. package/dist/client/assets/DiffPanel-ixzJ8GwW.js +0 -64
  73. package/dist/client/assets/DiffPanelShell-Dz5Wvcvi.js +0 -2532
  74. package/dist/client/assets/cmmdAuthRedirect-D68LO-sw.js +0 -2
  75. package/dist/client/assets/diffTargetResolution-WqxwJEax.js +0 -2
  76. package/dist/client/assets/index-DivaIsZ4.css +0 -1
  77. package/dist/client/assets/index-UXWCtM6c.js +0 -153
  78. package/dist/client/assets/src-n5cTLVWV.js +0 -3
@@ -0,0 +1,353 @@
1
+ /**
2
+ * FileFinder - High-level API for the fff file finder
3
+ *
4
+ * This class provides a type-safe, ergonomic API for file finding operations.
5
+ * Each instance owns an independent native file picker that can be created
6
+ * and destroyed independently. Multiple instances can coexist.
7
+ *
8
+ * All methods return Result types for explicit error handling.
9
+ */
10
+ import type { DirSearchOptions, DirSearchResult, FileFinderApi, GlobOptions, GrepOptions, GrepResult, HealthCheck, InitOptions, MixedSearchResult, MultiGrepOptions, Result, ScanProgress, SearchOptions, SearchResult } from "./fff-api.js";
11
+ /**
12
+ * FileFinder - Fast file finder with fuzzy search
13
+ *
14
+ * Each instance is backed by an independent native file picker. Create as many
15
+ * as you need and destroy them when done.
16
+ *
17
+ * @example
18
+ *
19
+ * ```ts
20
+ * import { FileFinder } from "@ff-labs/fff-node";
21
+ *
22
+ * // Create an instance
23
+ * const finder = FileFinder.create({ basePath: "/path/to/project" });
24
+ * if (!finder.ok) {
25
+ * console.error(finder.error);
26
+ * process.exit(1);
27
+ * }
28
+ *
29
+ * // Wait for initial scan
30
+ * await finder.value.waitForScan(5000);
31
+ *
32
+ * // Search for files
33
+ * const search = finder.value.search("main.ts");
34
+ * if (search.ok) {
35
+ * for (const item of search.value.items) {
36
+ * console.log(item.relativePath);
37
+ * }
38
+ * }
39
+ *
40
+ * // Cleanup
41
+ * finder.value.destroy();
42
+ * ```
43
+ */
44
+ export declare class FileFinder implements FileFinderApi {
45
+ private handle;
46
+ private constructor();
47
+ /**
48
+ * Create a new file finder instance.
49
+ *
50
+ * @param options - Initialization options
51
+ * @returns Result containing the new FileFinder instance or an error
52
+ *
53
+ * @example
54
+ * ```typescript
55
+ * // Basic initialization
56
+ * const finder = FileFinder.create({ basePath: "/path/to/project" });
57
+ *
58
+ * // With custom database paths
59
+ * const finder = FileFinder.create({
60
+ * basePath: "/path/to/project",
61
+ * frecencyDbPath: "/custom/frecency.mdb",
62
+ * historyDbPath: "/custom/history.mdb",
63
+ * });
64
+ * ```
65
+ */
66
+ static create(options: InitOptions): Result<FileFinder>;
67
+ /**
68
+ * Destroy and clean up all resources.
69
+ *
70
+ * Call this when you're done using the file finder to free memory
71
+ * and stop background file watching. After calling this, the instance
72
+ * must not be used again.
73
+ */
74
+ destroy(): void;
75
+ /**
76
+ * Check if this instance has been destroyed.
77
+ */
78
+ get isDestroyed(): boolean;
79
+ /**
80
+ * Guard that returns an error if the instance has been destroyed.
81
+ */
82
+ private ensureAlive;
83
+ /**
84
+ * Search for files matching the query.
85
+ *
86
+ * The query supports fuzzy matching and special syntax:
87
+ * - `foo bar` - Match files containing "foo" and "bar"
88
+ * - `src/` - Match files in src directory
89
+ * - `file.ts:42` - Match file.ts with line 42
90
+ * - `file.ts:42:10` - Match file.ts with line 42, column 10
91
+ *
92
+ * @param query - Search query string
93
+ * @param options - Search options
94
+ * @returns Search results with matched files and scores
95
+ *
96
+ * @example
97
+ * ```typescript
98
+ * const result = finder.search("main.ts", { pageSize: 10 });
99
+ * if (result.ok) {
100
+ * console.log(`Found ${result.value.totalMatched} files`);
101
+ * for (const item of result.value.items) {
102
+ * console.log(item.relativePath);
103
+ * }
104
+ * }
105
+ * ```
106
+ */
107
+ fileSearch(query: string, options?: SearchOptions): Result<SearchResult>;
108
+ /**
109
+ * Filters files using glob wildcard expression.
110
+ *
111
+ * The pattern is applied as a single pass SIMD optimized prefiltering
112
+ * without any fuzzy matching involved. Faster and 100% compatible to npm `glob`.
113
+ *
114
+ * @param pattern - Glob pattern (required, non-empty)
115
+ * @param options - Glob search options (pagination, max threads, current file)
116
+ * @returns Search results with files matching the glob
117
+ *
118
+ * @example
119
+ * ```typescript
120
+ * const result = finder.glob("**\/*.rs", { pageSize: 100 });
121
+ * if (result.ok) {
122
+ * for (const item of result.value.items) {
123
+ * console.log(item.relativePath);
124
+ * }
125
+ * }
126
+ * ```
127
+ */
128
+ glob(pattern: string, options?: GlobOptions): Result<SearchResult>;
129
+ /**
130
+ * Search for directories matching the query.
131
+ *
132
+ * @param query - Search query string
133
+ * @param options - Directory search options
134
+ * @returns Search results with matched directories and scores
135
+ *
136
+ * @example
137
+ * ```typescript
138
+ * const result = finder.directorySearch("src/comp", { pageSize: 10 });
139
+ * if (result.ok) {
140
+ * console.log(`Found ${result.value.totalMatched} directories`);
141
+ * for (const item of result.value.items) {
142
+ * console.log(item.relativePath);
143
+ * }
144
+ * }
145
+ * ```
146
+ */
147
+ directorySearch(query: string, options?: DirSearchOptions): Result<DirSearchResult>;
148
+ /**
149
+ * Search for files and directories matching the query (mixed results).
150
+ *
151
+ * Results are interleaved by total score in descending order, mixing
152
+ * both file and directory items.
153
+ *
154
+ * @param query - Search query string
155
+ * @param options - Search options
156
+ * @returns Mixed search results with files and directories interleaved by score
157
+ *
158
+ * @example
159
+ * ```typescript
160
+ * const result = finder.mixedSearch("main", { pageSize: 20 });
161
+ * if (result.ok) {
162
+ * for (const entry of result.value.items) {
163
+ * if (entry.type === "file") {
164
+ * console.log(`File: ${entry.item.relativePath}`);
165
+ * } else {
166
+ * console.log(`Dir: ${entry.item.relativePath}`);
167
+ * }
168
+ * }
169
+ * }
170
+ * ```
171
+ */
172
+ mixedSearch(query: string, options?: SearchOptions): Result<MixedSearchResult>;
173
+ /**
174
+ * Search file contents (live grep).
175
+ *
176
+ * Searches through the contents of indexed files using the specified mode:
177
+ * - `"plain"` (default): SIMD-accelerated literal text matching
178
+ * - `"regex"`: Regular expression matching
179
+ * - `"fuzzy"`: Smith-Waterman fuzzy matching per line
180
+ *
181
+ * Supports pagination for large result sets. The result includes a `nextCursor`
182
+ * that can be passed back to fetch the next page.
183
+ *
184
+ * The query also supports constraint syntax:
185
+ * - `*.ts pattern` - Only search in TypeScript files
186
+ * - `src/ pattern` - Only search in the src directory
187
+ *
188
+ * @param query - Search query string
189
+ * @param options - Grep options (mode, pagination, limits)
190
+ * @returns Grep results with matched lines and file metadata
191
+ *
192
+ * @example
193
+ * ```typescript
194
+ * // First page
195
+ * const result = finder.grep("TODO", { mode: "plain" });
196
+ * if (result.ok) {
197
+ * for (const match of result.value.items) {
198
+ * console.log(`${match.relativePath}:${match.lineNumber}: ${match.lineContent}`);
199
+ * }
200
+ * // Fetch next page
201
+ * if (result.value.nextCursor) {
202
+ * const page2 = finder.grep("TODO", {
203
+ * cursor: result.value.nextCursor,
204
+ * });
205
+ * }
206
+ * }
207
+ * ```
208
+ */
209
+ grep(query: string, options?: GrepOptions): Result<GrepResult>;
210
+ /**
211
+ * Multi-pattern OR search using Aho-Corasick.
212
+ *
213
+ * Searches for lines matching ANY of the provided patterns using
214
+ * SIMD-accelerated multi-needle matching. Faster than regex alternation
215
+ * for literal text searches.
216
+ *
217
+ * Supports pagination. The result includes a `nextCursor` that can be
218
+ * passed back to fetch the next page.
219
+ *
220
+ * @param options - Multi-grep options including patterns and optional constraints
221
+ * @returns Grep results with matched lines and file metadata
222
+ *
223
+ * @example
224
+ * ```typescript
225
+ * const result = finder.multiGrep({
226
+ * patterns: ["VideoFrame", "video_frame", "PreloadedImage"],
227
+ * });
228
+ * if (result.ok) {
229
+ * for (const match of result.value.items) {
230
+ * console.log(`${match.relativePath}:${match.lineNumber}: ${match.lineContent}`);
231
+ * }
232
+ * }
233
+ * ```
234
+ */
235
+ multiGrep(options: MultiGrepOptions): Result<GrepResult>;
236
+ /**
237
+ * Trigger a rescan of the indexed directory.
238
+ *
239
+ * This is useful after major file system changes that the
240
+ * background watcher might have missed.
241
+ */
242
+ scanFiles(): Result<void>;
243
+ /**
244
+ * Check if a scan is currently in progress.
245
+ */
246
+ isScanning(): boolean;
247
+ /**
248
+ * Get the base path of the file picker (the root directory being indexed).
249
+ */
250
+ getBasePath(): Result<string | null>;
251
+ /**
252
+ * Get the current scan progress.
253
+ */
254
+ getScanProgress(): Result<ScanProgress>;
255
+ /**
256
+ * Wait for the initial file scan to complete.
257
+ * Non-blocking: polls `isScanning` and yields to the event loop between checks.
258
+ *
259
+ * @param timeoutMs - Maximum time to wait in milliseconds (default: 5000)
260
+ * @returns true if scan completed, false if timed out
261
+ *
262
+ * @example
263
+ * ```typescript
264
+ * const finder = FileFinder.create({ basePath: "/path/to/project" });
265
+ * if (finder.ok) {
266
+ * const completed = await finder.value.waitForScan(10000);
267
+ * if (!completed.ok || !completed.value) {
268
+ * console.warn("Scan did not complete in time");
269
+ * }
270
+ * }
271
+ * ```
272
+ */
273
+ waitForScan(timeoutMs?: number): Promise<Result<boolean>>;
274
+ /**
275
+ * Wait for the initial file scan to complete, blocking the calling thread.
276
+ *
277
+ * Backed by the native `fff_wait_for_scan` call. Prefer {@link waitForScan}
278
+ * unless you specifically need synchronous blocking behaviour.
279
+ *
280
+ * @param timeoutMs - Maximum time to wait in milliseconds (default: 5000)
281
+ * @returns true if scan completed, false if timed out
282
+ */
283
+ waitForScanBlocking(timeoutMs?: number): Result<boolean>;
284
+ /**
285
+ * Wait until the index is fully ready: the scan has finished and the warmup
286
+ * (content indexing / bigram) phase has completed.
287
+ *
288
+ * Non-blocking: polls `getScanProgress` and yields to the event loop.
289
+ *
290
+ * @param timeoutMs - Maximum time to wait in milliseconds (default: 5000)
291
+ * @returns true if the index became ready, false if timed out
292
+ */
293
+ waitForIndexReady(timeoutMs?: number): Promise<Result<boolean>>;
294
+ /**
295
+ * Change the indexed directory to a new path.
296
+ *
297
+ * This stops the current file watcher and starts indexing the new directory.
298
+ *
299
+ * @param newPath - New directory path to index
300
+ */
301
+ reindex(newPath: string): Result<void>;
302
+ /**
303
+ * Refresh the git status cache.
304
+ *
305
+ * @returns Number of files with updated git status
306
+ */
307
+ refreshGitStatus(): Result<number>;
308
+ /**
309
+ * Track query completion for smart suggestions.
310
+ *
311
+ * Call this when a user selects a file from search results.
312
+ * This helps improve future search rankings for similar queries.
313
+ *
314
+ * @param query - The search query that was used
315
+ * @param selectedFilePath - The file path that was selected
316
+ */
317
+ trackQuery(query: string, selectedFilePath: string): Result<boolean>;
318
+ /**
319
+ * Get a historical query by offset.
320
+ *
321
+ * @param offset - Offset from most recent (0 = most recent)
322
+ * @returns The historical query string, or null if not found
323
+ */
324
+ getHistoricalQuery(offset: number): Result<string | null>;
325
+ /**
326
+ * Get health check information.
327
+ *
328
+ * Useful for debugging and verifying the file finder is working correctly.
329
+ *
330
+ * @param testPath - Optional path to test git repository detection
331
+ */
332
+ healthCheck(testPath?: string): Result<HealthCheck>;
333
+ /**
334
+ * Check if the native library is available.
335
+ */
336
+ static isAvailable(): boolean;
337
+ /**
338
+ * Ensure the native library is loaded.
339
+ *
340
+ * Loads the native library from the platform-specific npm package
341
+ * or a local dev build. Throws if the binary is not found.
342
+ */
343
+ static ensureLoaded(): void;
344
+ /**
345
+ * Get a health check without requiring an instance.
346
+ *
347
+ * Returns limited info (version + git only, no picker/frecency/query data).
348
+ *
349
+ * @param testPath - Optional path to test git repository detection
350
+ */
351
+ static healthCheckStatic(testPath?: string): Result<HealthCheck>;
352
+ }
353
+ //# sourceMappingURL=finder.d.ts.map