@saluzi/codegraph 0.1.0 → 0.2.0

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 (246) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +885 -0
  3. package/package.json +42 -10
  4. package/scripts/add-lang/bench.sh +60 -0
  5. package/scripts/add-lang/check-grammar.mjs +75 -0
  6. package/scripts/add-lang/dump-ast.mjs +103 -0
  7. package/scripts/add-lang/verify-extraction.mjs +70 -0
  8. package/scripts/agent-eval/ab-adoption.sh +91 -0
  9. package/scripts/agent-eval/ab-hook.sh +86 -0
  10. package/scripts/agent-eval/ab-impl.sh +78 -0
  11. package/scripts/agent-eval/ab-new-vs-baseline.sh +102 -0
  12. package/scripts/agent-eval/ab-sufficiency.sh +78 -0
  13. package/scripts/agent-eval/arms-F.sh +21 -0
  14. package/scripts/agent-eval/arms-matrix.sh +37 -0
  15. package/scripts/agent-eval/audit.sh +68 -0
  16. package/scripts/agent-eval/bench-readme.sh +28 -0
  17. package/scripts/agent-eval/bench-why-repo.sh +22 -0
  18. package/scripts/agent-eval/block-read-hook.sh +19 -0
  19. package/scripts/agent-eval/hook-settings.json +15 -0
  20. package/scripts/agent-eval/itrun.sh +120 -0
  21. package/scripts/agent-eval/offload-eval-3arm.sh +72 -0
  22. package/scripts/agent-eval/offload-eval-cost.mjs +133 -0
  23. package/scripts/agent-eval/offload-eval-effort.mjs +108 -0
  24. package/scripts/agent-eval/offload-eval-frontload-matrix.sh +25 -0
  25. package/scripts/agent-eval/offload-eval-frontload.sh +47 -0
  26. package/scripts/agent-eval/offload-eval-ground-truth.json +18 -0
  27. package/scripts/agent-eval/offload-eval-hook.mjs +84 -0
  28. package/scripts/agent-eval/offload-eval-judge.mjs +103 -0
  29. package/scripts/agent-eval/offload-eval-matrix.sh +20 -0
  30. package/scripts/agent-eval/offload-eval-metrics.mjs +94 -0
  31. package/scripts/agent-eval/offload-eval-refs1.sh +50 -0
  32. package/scripts/agent-eval/offload-eval-setup.sh +24 -0
  33. package/scripts/agent-eval/offload-eval-styles.sh +72 -0
  34. package/scripts/agent-eval/offload-eval-summarize.mjs +68 -0
  35. package/scripts/agent-eval/offload-eval.md +76 -0
  36. package/scripts/agent-eval/parse-arms.mjs +116 -0
  37. package/scripts/agent-eval/parse-bench-readme.mjs +84 -0
  38. package/scripts/agent-eval/parse-run.mjs +45 -0
  39. package/scripts/agent-eval/parse-session.mjs +93 -0
  40. package/scripts/agent-eval/probe-context.mjs +21 -0
  41. package/scripts/agent-eval/probe-explore.mjs +40 -0
  42. package/scripts/agent-eval/probe-node.mjs +20 -0
  43. package/scripts/agent-eval/probe-sweep.mjs +119 -0
  44. package/scripts/agent-eval/probe-trace.mjs +20 -0
  45. package/scripts/agent-eval/redirect-read-hook.sh +38 -0
  46. package/scripts/agent-eval/repro-concurrent-explore.mjs +119 -0
  47. package/scripts/agent-eval/repro-daemon-clients.mjs +125 -0
  48. package/scripts/agent-eval/run-agent.sh +34 -0
  49. package/scripts/agent-eval/run-all.sh +75 -0
  50. package/scripts/agent-eval/run-arms.sh +56 -0
  51. package/scripts/agent-eval/seq-matrix.mjs +137 -0
  52. package/scripts/build-bundle.sh +123 -0
  53. package/scripts/extract-release-notes.mjs +130 -0
  54. package/scripts/local-install.sh +41 -0
  55. package/scripts/npm-sdk.js +75 -0
  56. package/scripts/npm-shim.js +275 -0
  57. package/scripts/pack-npm.sh +119 -0
  58. package/scripts/prepare-release.mjs +270 -0
  59. package/dist/bin/codegraph.d.ts +0 -25
  60. package/dist/bin/node-version-check.d.ts +0 -37
  61. package/dist/bin/uninstall.d.ts +0 -14
  62. package/dist/context/formatter.d.ts +0 -33
  63. package/dist/context/formatter.js +0 -244
  64. package/dist/context/index.d.ts +0 -117
  65. package/dist/context/index.js +0 -1050
  66. package/dist/db/index.d.ts +0 -101
  67. package/dist/db/index.js +0 -250
  68. package/dist/db/migrations.d.ts +0 -47
  69. package/dist/db/migrations.js +0 -131
  70. package/dist/db/queries.d.ts +0 -291
  71. package/dist/db/queries.js +0 -1349
  72. package/dist/db/schema.sql +0 -151
  73. package/dist/db/sqlite-adapter.d.ts +0 -49
  74. package/dist/db/sqlite-adapter.js +0 -141
  75. package/dist/directory.d.ts +0 -62
  76. package/dist/directory.js +0 -264
  77. package/dist/errors.d.ts +0 -149
  78. package/dist/errors.js +0 -219
  79. package/dist/extraction/dfm-extractor.d.ts +0 -31
  80. package/dist/extraction/dfm-extractor.js +0 -151
  81. package/dist/extraction/grammars.d.ts +0 -94
  82. package/dist/extraction/grammars.js +0 -357
  83. package/dist/extraction/index.d.ts +0 -148
  84. package/dist/extraction/index.js +0 -1286
  85. package/dist/extraction/languages/c-cpp.d.ts +0 -4
  86. package/dist/extraction/languages/c-cpp.js +0 -126
  87. package/dist/extraction/languages/csharp.d.ts +0 -3
  88. package/dist/extraction/languages/csharp.js +0 -72
  89. package/dist/extraction/languages/dart.d.ts +0 -3
  90. package/dist/extraction/languages/dart.js +0 -192
  91. package/dist/extraction/languages/go.d.ts +0 -3
  92. package/dist/extraction/languages/go.js +0 -58
  93. package/dist/extraction/languages/index.d.ts +0 -10
  94. package/dist/extraction/languages/index.js +0 -49
  95. package/dist/extraction/languages/java.d.ts +0 -3
  96. package/dist/extraction/languages/java.js +0 -64
  97. package/dist/extraction/languages/javascript.d.ts +0 -3
  98. package/dist/extraction/languages/javascript.js +0 -90
  99. package/dist/extraction/languages/kotlin.d.ts +0 -3
  100. package/dist/extraction/languages/kotlin.js +0 -253
  101. package/dist/extraction/languages/lua.d.ts +0 -3
  102. package/dist/extraction/languages/lua.js +0 -150
  103. package/dist/extraction/languages/luau.d.ts +0 -3
  104. package/dist/extraction/languages/luau.js +0 -37
  105. package/dist/extraction/languages/pascal.d.ts +0 -3
  106. package/dist/extraction/languages/pascal.js +0 -66
  107. package/dist/extraction/languages/php.d.ts +0 -3
  108. package/dist/extraction/languages/php.js +0 -107
  109. package/dist/extraction/languages/python.d.ts +0 -3
  110. package/dist/extraction/languages/python.js +0 -56
  111. package/dist/extraction/languages/ruby.d.ts +0 -3
  112. package/dist/extraction/languages/ruby.js +0 -114
  113. package/dist/extraction/languages/rust.d.ts +0 -3
  114. package/dist/extraction/languages/rust.js +0 -109
  115. package/dist/extraction/languages/scala.d.ts +0 -3
  116. package/dist/extraction/languages/scala.js +0 -139
  117. package/dist/extraction/languages/swift.d.ts +0 -3
  118. package/dist/extraction/languages/swift.js +0 -91
  119. package/dist/extraction/languages/typescript.d.ts +0 -3
  120. package/dist/extraction/languages/typescript.js +0 -129
  121. package/dist/extraction/liquid-extractor.d.ts +0 -52
  122. package/dist/extraction/liquid-extractor.js +0 -313
  123. package/dist/extraction/parse-worker.d.ts +0 -8
  124. package/dist/extraction/parse-worker.js +0 -94
  125. package/dist/extraction/svelte-extractor.d.ts +0 -56
  126. package/dist/extraction/svelte-extractor.js +0 -272
  127. package/dist/extraction/tree-sitter-helpers.d.ts +0 -39
  128. package/dist/extraction/tree-sitter-helpers.js +0 -103
  129. package/dist/extraction/tree-sitter-types.d.ts +0 -191
  130. package/dist/extraction/tree-sitter-types.js +0 -10
  131. package/dist/extraction/tree-sitter.d.ts +0 -238
  132. package/dist/extraction/tree-sitter.js +0 -2430
  133. package/dist/extraction/vue-extractor.d.ts +0 -36
  134. package/dist/extraction/vue-extractor.js +0 -163
  135. package/dist/extraction/wasm/tree-sitter-c.wasm +0 -0
  136. package/dist/extraction/wasm/tree-sitter-c_sharp.wasm +0 -0
  137. package/dist/extraction/wasm/tree-sitter-cpp.wasm +0 -0
  138. package/dist/extraction/wasm/tree-sitter-dart.wasm +0 -0
  139. package/dist/extraction/wasm/tree-sitter-go.wasm +0 -0
  140. package/dist/extraction/wasm/tree-sitter-java.wasm +0 -0
  141. package/dist/extraction/wasm/tree-sitter-javascript.wasm +0 -0
  142. package/dist/extraction/wasm/tree-sitter-kotlin.wasm +0 -0
  143. package/dist/extraction/wasm/tree-sitter-lua.wasm +0 -0
  144. package/dist/extraction/wasm/tree-sitter-luau.wasm +0 -0
  145. package/dist/extraction/wasm/tree-sitter-pascal.wasm +0 -0
  146. package/dist/extraction/wasm/tree-sitter-php.wasm +0 -0
  147. package/dist/extraction/wasm/tree-sitter-python.wasm +0 -0
  148. package/dist/extraction/wasm/tree-sitter-ruby.wasm +0 -0
  149. package/dist/extraction/wasm/tree-sitter-rust.wasm +0 -0
  150. package/dist/extraction/wasm/tree-sitter-scala.wasm +0 -0
  151. package/dist/extraction/wasm/tree-sitter-swift.wasm +0 -0
  152. package/dist/extraction/wasm/tree-sitter-tsx.wasm +0 -0
  153. package/dist/extraction/wasm/tree-sitter-typescript.wasm +0 -0
  154. package/dist/extraction/wasm-runtime-flags.d.ts +0 -46
  155. package/dist/extraction/wasm-runtime-flags.js +0 -105
  156. package/dist/graph/index.d.ts +0 -8
  157. package/dist/graph/index.js +0 -13
  158. package/dist/graph/queries.d.ts +0 -109
  159. package/dist/graph/queries.js +0 -366
  160. package/dist/graph/traversal.d.ts +0 -137
  161. package/dist/graph/traversal.js +0 -528
  162. package/dist/index.d.ts +0 -509
  163. package/dist/index.js +0 -800
  164. package/dist/installer/claude-md-template.d.ts +0 -19
  165. package/dist/installer/config-writer.d.ts +0 -29
  166. package/dist/installer/index.d.ts +0 -140
  167. package/dist/installer/instructions-template.d.ts +0 -30
  168. package/dist/installer/targets/claude.d.ts +0 -55
  169. package/dist/installer/targets/codex.d.ts +0 -18
  170. package/dist/installer/targets/cursor.d.ts +0 -35
  171. package/dist/installer/targets/hermes.d.ts +0 -18
  172. package/dist/installer/targets/opencode.d.ts +0 -30
  173. package/dist/installer/targets/registry.d.ts +0 -38
  174. package/dist/installer/targets/shared.d.ts +0 -92
  175. package/dist/installer/targets/toml.d.ts +0 -64
  176. package/dist/installer/targets/types.d.ts +0 -122
  177. package/dist/mcp/index.d.ts +0 -98
  178. package/dist/mcp/server-instructions.d.ts +0 -20
  179. package/dist/mcp/tools.d.ts +0 -269
  180. package/dist/mcp/transport.d.ts +0 -117
  181. package/dist/resolution/frameworks/cargo-workspace.d.ts +0 -20
  182. package/dist/resolution/frameworks/cargo-workspace.js +0 -225
  183. package/dist/resolution/frameworks/csharp.d.ts +0 -8
  184. package/dist/resolution/frameworks/csharp.js +0 -213
  185. package/dist/resolution/frameworks/drupal.d.ts +0 -51
  186. package/dist/resolution/frameworks/drupal.js +0 -335
  187. package/dist/resolution/frameworks/express.d.ts +0 -8
  188. package/dist/resolution/frameworks/express.js +0 -225
  189. package/dist/resolution/frameworks/go.d.ts +0 -8
  190. package/dist/resolution/frameworks/go.js +0 -158
  191. package/dist/resolution/frameworks/index.d.ts +0 -52
  192. package/dist/resolution/frameworks/index.js +0 -137
  193. package/dist/resolution/frameworks/java.d.ts +0 -8
  194. package/dist/resolution/frameworks/java.js +0 -177
  195. package/dist/resolution/frameworks/laravel.d.ts +0 -13
  196. package/dist/resolution/frameworks/laravel.js +0 -248
  197. package/dist/resolution/frameworks/nestjs.d.ts +0 -26
  198. package/dist/resolution/frameworks/nestjs.js +0 -374
  199. package/dist/resolution/frameworks/python.d.ts +0 -10
  200. package/dist/resolution/frameworks/python.js +0 -278
  201. package/dist/resolution/frameworks/react.d.ts +0 -8
  202. package/dist/resolution/frameworks/react.js +0 -272
  203. package/dist/resolution/frameworks/ruby.d.ts +0 -8
  204. package/dist/resolution/frameworks/ruby.js +0 -198
  205. package/dist/resolution/frameworks/rust.d.ts +0 -8
  206. package/dist/resolution/frameworks/rust.js +0 -207
  207. package/dist/resolution/frameworks/svelte.d.ts +0 -9
  208. package/dist/resolution/frameworks/svelte.js +0 -249
  209. package/dist/resolution/frameworks/swift.d.ts +0 -10
  210. package/dist/resolution/frameworks/swift.js +0 -376
  211. package/dist/resolution/frameworks/vue.d.ts +0 -9
  212. package/dist/resolution/frameworks/vue.js +0 -306
  213. package/dist/resolution/import-resolver.d.ts +0 -61
  214. package/dist/resolution/import-resolver.js +0 -663
  215. package/dist/resolution/index.d.ts +0 -118
  216. package/dist/resolution/index.js +0 -744
  217. package/dist/resolution/lru-cache.d.ts +0 -24
  218. package/dist/resolution/lru-cache.js +0 -62
  219. package/dist/resolution/name-matcher.d.ts +0 -50
  220. package/dist/resolution/name-matcher.js +0 -384
  221. package/dist/resolution/path-aliases.d.ts +0 -72
  222. package/dist/resolution/path-aliases.js +0 -238
  223. package/dist/resolution/strip-comments.d.ts +0 -40
  224. package/dist/resolution/strip-comments.js +0 -441
  225. package/dist/resolution/types.d.ts +0 -181
  226. package/dist/resolution/types.js +0 -8
  227. package/dist/search/query-parser.d.ts +0 -61
  228. package/dist/search/query-parser.js +0 -177
  229. package/dist/search/query-utils.d.ts +0 -59
  230. package/dist/search/query-utils.js +0 -383
  231. package/dist/sync/git-hooks.d.ts +0 -54
  232. package/dist/sync/git-hooks.js +0 -223
  233. package/dist/sync/index.d.ts +0 -25
  234. package/dist/sync/index.js +0 -28
  235. package/dist/sync/watch-policy.d.ts +0 -51
  236. package/dist/sync/watch-policy.js +0 -124
  237. package/dist/sync/watcher.d.ts +0 -83
  238. package/dist/sync/watcher.js +0 -192
  239. package/dist/types.d.ts +0 -433
  240. package/dist/types.js +0 -75
  241. package/dist/ui/glyphs.d.ts +0 -42
  242. package/dist/ui/shimmer-progress.d.ts +0 -11
  243. package/dist/ui/shimmer-worker.d.ts +0 -2
  244. package/dist/ui/types.d.ts +0 -20
  245. package/dist/utils.d.ts +0 -231
  246. package/dist/utils.js +0 -549
@@ -1,42 +0,0 @@
1
- /**
2
- * Glyph selection for CLI output.
3
- *
4
- * On Windows, console output is interpreted via the active output
5
- * codepage. PowerShell 5.1 and cmd.exe default to OEM codepages
6
- * (CP437, CP936, ...), so UTF-8 bytes written to the console render
7
- * as mojibake (see #168). The shimmer worker is hit hardest because
8
- * it uses `fs.writeSync(1, ...)` (raw bytes, no TTY-aware encoding
9
- * conversion) to keep animation smooth while the main thread is
10
- * blocked in SQLite. To stay readable everywhere, we fall back to
11
- * ASCII glyphs whenever the terminal is not known to handle UTF-8.
12
- *
13
- * Detection is intentionally simple:
14
- * - `CODEGRAPH_ASCII=1` -> ASCII (escape hatch for any terminal)
15
- * - `CODEGRAPH_UNICODE=1` -> Unicode (opt-in on Windows)
16
- * - Windows -> ASCII by default
17
- * - Linux kernel console (`TERM=linux`) -> ASCII
18
- * - Everything else -> Unicode
19
- */
20
- export declare function supportsUnicode(): boolean
21
- export interface Glyphs {
22
- ok: string
23
- err: string
24
- info: string
25
- warn: string
26
- spinner: string[]
27
- barFilled: string
28
- barEmpty: string
29
- rail: string
30
- phaseDone: string
31
- dash: string
32
- hLine: string
33
- treeBranch: string
34
- treeLast: string
35
- treePipe: string
36
- }
37
- export declare const UNICODE_GLYPHS: Glyphs
38
- export declare const ASCII_GLYPHS: Glyphs
39
- export declare function getGlyphs(): Glyphs
40
- /** Reset the cached glyph set. Test-only; production code should call `getGlyphs()`. */
41
- export declare function _resetGlyphsCache(): void
42
- //# sourceMappingURL=glyphs.d.ts.map
@@ -1,11 +0,0 @@
1
- export interface IndexProgress {
2
- phase: string
3
- current: number
4
- total: number
5
- }
6
- export interface ShimmerProgress {
7
- onProgress: (progress: IndexProgress) => void
8
- stop: () => Promise<void>
9
- }
10
- export declare function createShimmerProgress(): ShimmerProgress
11
- //# sourceMappingURL=shimmer-progress.d.ts.map
@@ -1,2 +0,0 @@
1
- export {}
2
- //# sourceMappingURL=shimmer-worker.d.ts.map
@@ -1,20 +0,0 @@
1
- /** Messages from main thread to worker */
2
- export type ShimmerWorkerMessage =
3
- | {
4
- type: 'update'
5
- phase: string
6
- phaseName: string
7
- percent: number
8
- count: number
9
- }
10
- | {
11
- type: 'finish-phase'
12
- }
13
- | {
14
- type: 'stop'
15
- }
16
- /** Messages from worker to main thread */
17
- export type ShimmerMainMessage = {
18
- type: 'stopped'
19
- }
20
- //# sourceMappingURL=types.d.ts.map
package/dist/utils.d.ts DELETED
@@ -1,231 +0,0 @@
1
- /**
2
- * CodeGraph Utilities
3
- *
4
- * Common utility functions for memory management, concurrency, batching,
5
- * and security validation.
6
- *
7
- * @module utils
8
- *
9
- * @example
10
- * ```typescript
11
- * import { Mutex, processInBatches, MemoryMonitor, validatePathWithinRoot } from 'codegraph';
12
- *
13
- * // Use mutex for concurrent safety
14
- * const mutex = new Mutex();
15
- * await mutex.withLock(async () => {
16
- * await performCriticalOperation();
17
- * });
18
- *
19
- * // Process items in batches to manage memory
20
- * const results = await processInBatches(items, 100, async (item) => {
21
- * return await processItem(item);
22
- * });
23
- *
24
- * // Monitor memory usage
25
- * const monitor = new MemoryMonitor(512, (usage) => {
26
- * console.warn(`Memory usage exceeded 512MB: ${usage / 1024 / 1024}MB`);
27
- * });
28
- * monitor.start();
29
- * ```
30
- */
31
- /**
32
- * Validate that a resolved file path stays within the project root.
33
- * Prevents path traversal attacks (e.g. node.filePath = "../../etc/passwd").
34
- *
35
- * @param projectRoot - The project root directory
36
- * @param filePath - The relative file path to validate
37
- * @returns The resolved absolute path, or null if it escapes the root
38
- */
39
- export declare function validatePathWithinRoot(
40
- projectRoot: string,
41
- filePath: string,
42
- ): string | null
43
- /**
44
- * Validate that a path is a safe project root directory.
45
- *
46
- * Rejects sensitive system directories and ensures the path is
47
- * a real, existing directory. Used at MCP and API entry points
48
- * to prevent arbitrary directory access.
49
- *
50
- * @param dirPath - The path to validate
51
- * @returns An error message if invalid, or null if valid
52
- */
53
- export declare function validateProjectPath(dirPath: string): string | null
54
- /**
55
- * Check if a file path resolves to a location within the given root directory.
56
- *
57
- * Prevents path traversal attacks by ensuring the resolved absolute path
58
- * starts with the resolved root path. Handles '..' sequences, symlink-like
59
- * relative paths, and platform-specific separators.
60
- *
61
- * @param filePath - The path to check (can be relative or absolute)
62
- * @param rootDir - The root directory that filePath must stay within
63
- * @returns true if filePath resolves to a location within rootDir
64
- */
65
- export declare function isPathWithinRoot(
66
- filePath: string,
67
- rootDir: string,
68
- ): boolean
69
- /**
70
- * Like isPathWithinRoot but also resolves symlinks via fs.realpathSync.
71
- *
72
- * This catches symlink escapes where the logical path appears to be within
73
- * root but the real path on disk points elsewhere. Falls back to logical
74
- * path checking if realpath resolution fails (e.g. broken symlink).
75
- */
76
- export declare function isPathWithinRootReal(
77
- filePath: string,
78
- rootDir: string,
79
- ): boolean
80
- /**
81
- * Safely parse JSON with a fallback value.
82
- * Prevents crashes from corrupted database metadata.
83
- */
84
- export declare function safeJsonParse<T>(value: string, fallback: T): T
85
- /**
86
- * Clamp a numeric value to a range.
87
- * Used to enforce sane limits on MCP tool inputs.
88
- */
89
- export declare function clamp(value: number, min: number, max: number): number
90
- /**
91
- * Normalize a file path to use forward slashes.
92
- * Fixes Windows backslash paths so glob matching works consistently.
93
- */
94
- export declare function normalizePath(filePath: string): string
95
- /**
96
- * Cross-process file lock using a lock file with PID tracking.
97
- *
98
- * Prevents multiple processes (e.g., git hooks, CLI, MCP server) from
99
- * writing to the same database simultaneously.
100
- */
101
- export declare class FileLock {
102
- private lockPath
103
- private held
104
- /** Locks older than this are considered stale regardless of PID status */
105
- private static readonly STALE_TIMEOUT_MS
106
- constructor(lockPath: string)
107
- /**
108
- * Acquire the lock. Throws if the lock is held by another live process.
109
- */
110
- acquire(): void
111
- /**
112
- * Release the lock
113
- */
114
- release(): void
115
- /**
116
- * Execute a function while holding the lock
117
- */
118
- withLock<T>(fn: () => T): T
119
- /**
120
- * Execute an async function while holding the lock
121
- */
122
- withLockAsync<T>(fn: () => Promise<T>): Promise<T>
123
- /**
124
- * Check if a process is still running
125
- */
126
- private isProcessAlive
127
- }
128
- /**
129
- * Process items in batches to manage memory
130
- *
131
- * @param items - Array of items to process
132
- * @param batchSize - Number of items per batch
133
- * @param processor - Function to process each item
134
- * @param onBatchComplete - Optional callback after each batch
135
- * @returns Array of results
136
- */
137
- export declare function processInBatches<T, R>(
138
- items: T[],
139
- batchSize: number,
140
- processor: (item: T, index: number) => Promise<R>,
141
- onBatchComplete?: (completed: number, total: number) => void,
142
- ): Promise<R[]>
143
- /**
144
- * Simple mutex lock for preventing concurrent operations
145
- */
146
- export declare class Mutex {
147
- private locked
148
- private waitQueue
149
- /**
150
- * Acquire the lock
151
- *
152
- * @returns A release function to call when done
153
- */
154
- acquire(): Promise<() => void>
155
- /**
156
- * Execute a function while holding the lock
157
- */
158
- withLock<T>(fn: () => Promise<T> | T): Promise<T>
159
- /**
160
- * Check if the lock is currently held
161
- */
162
- isLocked(): boolean
163
- }
164
- /**
165
- * Chunked file reader for large files
166
- *
167
- * Reads a file in chunks to avoid loading entire file into memory.
168
- */
169
- export declare function readFileInChunks(
170
- filePath: string,
171
- chunkSize?: number,
172
- ): AsyncGenerator<string, void, undefined>
173
- /**
174
- * Debounce a function
175
- *
176
- * @param fn - Function to debounce
177
- * @param delay - Delay in milliseconds
178
- * @returns Debounced function
179
- */
180
- export declare function debounce<T extends (...args: unknown[]) => unknown>(
181
- fn: T,
182
- delay: number,
183
- ): (...args: Parameters<T>) => void
184
- /**
185
- * Throttle a function
186
- *
187
- * @param fn - Function to throttle
188
- * @param limit - Minimum time between calls in milliseconds
189
- * @returns Throttled function
190
- */
191
- export declare function throttle<T extends (...args: unknown[]) => unknown>(
192
- fn: T,
193
- limit: number,
194
- ): (...args: Parameters<T>) => void
195
- /**
196
- * Estimate memory usage of an object (rough approximation)
197
- *
198
- * @param obj - Object to measure
199
- * @returns Approximate size in bytes
200
- */
201
- export declare function estimateSize(obj: unknown): number
202
- /**
203
- * Memory monitor for tracking usage during operations
204
- */
205
- export declare class MemoryMonitor {
206
- private checkInterval
207
- private peakUsage
208
- private threshold
209
- private onThresholdExceeded?
210
- constructor(
211
- thresholdMB?: number,
212
- onThresholdExceeded?: (usage: number) => void,
213
- )
214
- /**
215
- * Start monitoring memory usage
216
- */
217
- start(intervalMs?: number): void
218
- /**
219
- * Stop monitoring
220
- */
221
- stop(): void
222
- /**
223
- * Get peak memory usage in bytes
224
- */
225
- getPeakUsage(): number
226
- /**
227
- * Get current memory usage in bytes
228
- */
229
- getCurrentUsage(): number
230
- }
231
- //# sourceMappingURL=utils.d.ts.map