@colbymchenry/codegraph-darwin-arm64 0.9.3 → 0.9.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (208) hide show
  1. package/lib/dist/bin/codegraph.d.ts +3 -0
  2. package/lib/dist/bin/codegraph.d.ts.map +1 -1
  3. package/lib/dist/bin/codegraph.js +250 -0
  4. package/lib/dist/bin/codegraph.js.map +1 -1
  5. package/lib/dist/context/index.d.ts +13 -0
  6. package/lib/dist/context/index.d.ts.map +1 -1
  7. package/lib/dist/context/index.js +120 -1
  8. package/lib/dist/context/index.js.map +1 -1
  9. package/lib/dist/db/index.d.ts +18 -0
  10. package/lib/dist/db/index.d.ts.map +1 -1
  11. package/lib/dist/db/index.js +31 -0
  12. package/lib/dist/db/index.js.map +1 -1
  13. package/lib/dist/db/queries.d.ts +16 -0
  14. package/lib/dist/db/queries.d.ts.map +1 -1
  15. package/lib/dist/db/queries.js +80 -27
  16. package/lib/dist/db/queries.js.map +1 -1
  17. package/lib/dist/extraction/grammars.d.ts +6 -0
  18. package/lib/dist/extraction/grammars.d.ts.map +1 -1
  19. package/lib/dist/extraction/grammars.js +31 -1
  20. package/lib/dist/extraction/grammars.js.map +1 -1
  21. package/lib/dist/extraction/index.d.ts +15 -2
  22. package/lib/dist/extraction/index.d.ts.map +1 -1
  23. package/lib/dist/extraction/index.js +170 -78
  24. package/lib/dist/extraction/index.js.map +1 -1
  25. package/lib/dist/extraction/languages/index.d.ts.map +1 -1
  26. package/lib/dist/extraction/languages/index.js +2 -0
  27. package/lib/dist/extraction/languages/index.js.map +1 -1
  28. package/lib/dist/extraction/languages/objc.d.ts +3 -0
  29. package/lib/dist/extraction/languages/objc.d.ts.map +1 -0
  30. package/lib/dist/extraction/languages/objc.js +133 -0
  31. package/lib/dist/extraction/languages/objc.js.map +1 -0
  32. package/lib/dist/extraction/tree-sitter-types.d.ts +4 -0
  33. package/lib/dist/extraction/tree-sitter-types.d.ts.map +1 -1
  34. package/lib/dist/extraction/tree-sitter.d.ts.map +1 -1
  35. package/lib/dist/extraction/tree-sitter.js +155 -9
  36. package/lib/dist/extraction/tree-sitter.js.map +1 -1
  37. package/lib/dist/extraction/wasm-runtime-flags.d.ts +12 -0
  38. package/lib/dist/extraction/wasm-runtime-flags.d.ts.map +1 -1
  39. package/lib/dist/extraction/wasm-runtime-flags.js +14 -2
  40. package/lib/dist/extraction/wasm-runtime-flags.js.map +1 -1
  41. package/lib/dist/graph/traversal.d.ts.map +1 -1
  42. package/lib/dist/graph/traversal.js +71 -36
  43. package/lib/dist/graph/traversal.js.map +1 -1
  44. package/lib/dist/index.d.ts +21 -2
  45. package/lib/dist/index.d.ts.map +1 -1
  46. package/lib/dist/index.js +42 -0
  47. package/lib/dist/index.js.map +1 -1
  48. package/lib/dist/installer/instructions-template.d.ts +2 -2
  49. package/lib/dist/installer/instructions-template.d.ts.map +1 -1
  50. package/lib/dist/installer/instructions-template.js +3 -2
  51. package/lib/dist/installer/instructions-template.js.map +1 -1
  52. package/lib/dist/mcp/daemon-paths.d.ts +46 -0
  53. package/lib/dist/mcp/daemon-paths.d.ts.map +1 -0
  54. package/lib/dist/mcp/daemon-paths.js +125 -0
  55. package/lib/dist/mcp/daemon-paths.js.map +1 -0
  56. package/lib/dist/mcp/daemon.d.ts +161 -0
  57. package/lib/dist/mcp/daemon.d.ts.map +1 -0
  58. package/lib/dist/mcp/daemon.js +403 -0
  59. package/lib/dist/mcp/daemon.js.map +1 -0
  60. package/lib/dist/mcp/engine.d.ts +100 -0
  61. package/lib/dist/mcp/engine.d.ts.map +1 -0
  62. package/lib/dist/mcp/engine.js +291 -0
  63. package/lib/dist/mcp/engine.js.map +1 -0
  64. package/lib/dist/mcp/index.d.ts +67 -52
  65. package/lib/dist/mcp/index.d.ts.map +1 -1
  66. package/lib/dist/mcp/index.js +347 -330
  67. package/lib/dist/mcp/index.js.map +1 -1
  68. package/lib/dist/mcp/proxy.d.ts +46 -0
  69. package/lib/dist/mcp/proxy.d.ts.map +1 -0
  70. package/lib/dist/mcp/proxy.js +276 -0
  71. package/lib/dist/mcp/proxy.js.map +1 -0
  72. package/lib/dist/mcp/server-instructions.d.ts +1 -1
  73. package/lib/dist/mcp/server-instructions.d.ts.map +1 -1
  74. package/lib/dist/mcp/server-instructions.js +3 -1
  75. package/lib/dist/mcp/server-instructions.js.map +1 -1
  76. package/lib/dist/mcp/session.d.ts +67 -0
  77. package/lib/dist/mcp/session.d.ts.map +1 -0
  78. package/lib/dist/mcp/session.js +276 -0
  79. package/lib/dist/mcp/session.js.map +1 -0
  80. package/lib/dist/mcp/tools.d.ts +130 -2
  81. package/lib/dist/mcp/tools.d.ts.map +1 -1
  82. package/lib/dist/mcp/tools.js +902 -37
  83. package/lib/dist/mcp/tools.js.map +1 -1
  84. package/lib/dist/mcp/transport.d.ts +111 -29
  85. package/lib/dist/mcp/transport.d.ts.map +1 -1
  86. package/lib/dist/mcp/transport.js +181 -71
  87. package/lib/dist/mcp/transport.js.map +1 -1
  88. package/lib/dist/mcp/version.d.ts +19 -0
  89. package/lib/dist/mcp/version.d.ts.map +1 -0
  90. package/lib/dist/mcp/version.js +71 -0
  91. package/lib/dist/mcp/version.js.map +1 -0
  92. package/lib/dist/resolution/callback-synthesizer.d.ts +10 -0
  93. package/lib/dist/resolution/callback-synthesizer.d.ts.map +1 -0
  94. package/lib/dist/resolution/callback-synthesizer.js +847 -0
  95. package/lib/dist/resolution/callback-synthesizer.js.map +1 -0
  96. package/lib/dist/resolution/frameworks/csharp.d.ts.map +1 -1
  97. package/lib/dist/resolution/frameworks/csharp.js +36 -8
  98. package/lib/dist/resolution/frameworks/csharp.js.map +1 -1
  99. package/lib/dist/resolution/frameworks/drupal.d.ts.map +1 -1
  100. package/lib/dist/resolution/frameworks/drupal.js +44 -12
  101. package/lib/dist/resolution/frameworks/drupal.js.map +1 -1
  102. package/lib/dist/resolution/frameworks/expo-modules.d.ts +3 -0
  103. package/lib/dist/resolution/frameworks/expo-modules.d.ts.map +1 -0
  104. package/lib/dist/resolution/frameworks/expo-modules.js +143 -0
  105. package/lib/dist/resolution/frameworks/expo-modules.js.map +1 -0
  106. package/lib/dist/resolution/frameworks/express.d.ts.map +1 -1
  107. package/lib/dist/resolution/frameworks/express.js +102 -19
  108. package/lib/dist/resolution/frameworks/express.js.map +1 -1
  109. package/lib/dist/resolution/frameworks/fabric.d.ts +3 -0
  110. package/lib/dist/resolution/frameworks/fabric.d.ts.map +1 -0
  111. package/lib/dist/resolution/frameworks/fabric.js +354 -0
  112. package/lib/dist/resolution/frameworks/fabric.js.map +1 -0
  113. package/lib/dist/resolution/frameworks/go.d.ts.map +1 -1
  114. package/lib/dist/resolution/frameworks/go.js +6 -3
  115. package/lib/dist/resolution/frameworks/go.js.map +1 -1
  116. package/lib/dist/resolution/frameworks/index.d.ts +5 -0
  117. package/lib/dist/resolution/frameworks/index.d.ts.map +1 -1
  118. package/lib/dist/resolution/frameworks/index.js +25 -1
  119. package/lib/dist/resolution/frameworks/index.js.map +1 -1
  120. package/lib/dist/resolution/frameworks/java.d.ts.map +1 -1
  121. package/lib/dist/resolution/frameworks/java.js +70 -12
  122. package/lib/dist/resolution/frameworks/java.js.map +1 -1
  123. package/lib/dist/resolution/frameworks/laravel.d.ts.map +1 -1
  124. package/lib/dist/resolution/frameworks/laravel.js +17 -8
  125. package/lib/dist/resolution/frameworks/laravel.js.map +1 -1
  126. package/lib/dist/resolution/frameworks/play.d.ts +19 -0
  127. package/lib/dist/resolution/frameworks/play.d.ts.map +1 -0
  128. package/lib/dist/resolution/frameworks/play.js +111 -0
  129. package/lib/dist/resolution/frameworks/play.js.map +1 -0
  130. package/lib/dist/resolution/frameworks/python.d.ts.map +1 -1
  131. package/lib/dist/resolution/frameworks/python.js +134 -16
  132. package/lib/dist/resolution/frameworks/python.js.map +1 -1
  133. package/lib/dist/resolution/frameworks/react-native.d.ts +3 -0
  134. package/lib/dist/resolution/frameworks/react-native.d.ts.map +1 -0
  135. package/lib/dist/resolution/frameworks/react-native.js +360 -0
  136. package/lib/dist/resolution/frameworks/react-native.js.map +1 -0
  137. package/lib/dist/resolution/frameworks/react.d.ts.map +1 -1
  138. package/lib/dist/resolution/frameworks/react.js +96 -3
  139. package/lib/dist/resolution/frameworks/react.js.map +1 -1
  140. package/lib/dist/resolution/frameworks/ruby.d.ts.map +1 -1
  141. package/lib/dist/resolution/frameworks/ruby.js +106 -2
  142. package/lib/dist/resolution/frameworks/ruby.js.map +1 -1
  143. package/lib/dist/resolution/frameworks/rust.d.ts.map +1 -1
  144. package/lib/dist/resolution/frameworks/rust.js +102 -5
  145. package/lib/dist/resolution/frameworks/rust.js.map +1 -1
  146. package/lib/dist/resolution/frameworks/swift-objc.d.ts +37 -0
  147. package/lib/dist/resolution/frameworks/swift-objc.d.ts.map +1 -0
  148. package/lib/dist/resolution/frameworks/swift-objc.js +252 -0
  149. package/lib/dist/resolution/frameworks/swift-objc.js.map +1 -0
  150. package/lib/dist/resolution/frameworks/swift.d.ts.map +1 -1
  151. package/lib/dist/resolution/frameworks/swift.js +30 -6
  152. package/lib/dist/resolution/frameworks/swift.js.map +1 -1
  153. package/lib/dist/resolution/import-resolver.d.ts.map +1 -1
  154. package/lib/dist/resolution/import-resolver.js +1 -0
  155. package/lib/dist/resolution/import-resolver.js.map +1 -1
  156. package/lib/dist/resolution/index.d.ts.map +1 -1
  157. package/lib/dist/resolution/index.js +61 -9
  158. package/lib/dist/resolution/index.js.map +1 -1
  159. package/lib/dist/resolution/lru-cache.d.ts +24 -0
  160. package/lib/dist/resolution/lru-cache.d.ts.map +1 -0
  161. package/lib/dist/resolution/lru-cache.js +62 -0
  162. package/lib/dist/resolution/lru-cache.js.map +1 -0
  163. package/lib/dist/resolution/swift-objc-bridge.d.ts +134 -0
  164. package/lib/dist/resolution/swift-objc-bridge.d.ts.map +1 -0
  165. package/lib/dist/resolution/swift-objc-bridge.js +256 -0
  166. package/lib/dist/resolution/swift-objc-bridge.js.map +1 -0
  167. package/lib/dist/resolution/types.d.ts +8 -0
  168. package/lib/dist/resolution/types.d.ts.map +1 -1
  169. package/lib/dist/sync/index.d.ts +3 -1
  170. package/lib/dist/sync/index.d.ts.map +1 -1
  171. package/lib/dist/sync/index.js +7 -1
  172. package/lib/dist/sync/index.js.map +1 -1
  173. package/lib/dist/sync/watcher.d.ts +109 -7
  174. package/lib/dist/sync/watcher.d.ts.map +1 -1
  175. package/lib/dist/sync/watcher.js +215 -33
  176. package/lib/dist/sync/watcher.js.map +1 -1
  177. package/lib/dist/sync/worktree.d.ts +54 -0
  178. package/lib/dist/sync/worktree.d.ts.map +1 -0
  179. package/lib/dist/sync/worktree.js +136 -0
  180. package/lib/dist/sync/worktree.js.map +1 -0
  181. package/lib/dist/types.d.ts +1 -1
  182. package/lib/dist/types.d.ts.map +1 -1
  183. package/lib/dist/types.js +1 -0
  184. package/lib/dist/types.js.map +1 -1
  185. package/lib/dist/utils.js +1 -1
  186. package/lib/node_modules/.package-lock.json +29 -1
  187. package/lib/node_modules/chokidar/LICENSE +21 -0
  188. package/lib/node_modules/chokidar/README.md +305 -0
  189. package/lib/node_modules/chokidar/esm/handler.d.ts +90 -0
  190. package/lib/node_modules/chokidar/esm/handler.js +629 -0
  191. package/lib/node_modules/chokidar/esm/index.d.ts +215 -0
  192. package/lib/node_modules/chokidar/esm/index.js +798 -0
  193. package/lib/node_modules/chokidar/esm/package.json +1 -0
  194. package/lib/node_modules/chokidar/handler.d.ts +90 -0
  195. package/lib/node_modules/chokidar/handler.js +635 -0
  196. package/lib/node_modules/chokidar/index.d.ts +215 -0
  197. package/lib/node_modules/chokidar/index.js +804 -0
  198. package/lib/node_modules/chokidar/package.json +69 -0
  199. package/lib/node_modules/readdirp/LICENSE +21 -0
  200. package/lib/node_modules/readdirp/README.md +120 -0
  201. package/lib/node_modules/readdirp/esm/index.d.ts +108 -0
  202. package/lib/node_modules/readdirp/esm/index.js +257 -0
  203. package/lib/node_modules/readdirp/esm/package.json +1 -0
  204. package/lib/node_modules/readdirp/index.d.ts +108 -0
  205. package/lib/node_modules/readdirp/index.js +263 -0
  206. package/lib/node_modules/readdirp/package.json +70 -0
  207. package/lib/package.json +2 -1
  208. package/package.json +1 -1
@@ -0,0 +1,54 @@
1
+ /**
2
+ * Git Worktree Awareness
3
+ *
4
+ * A CodeGraph index lives in a `.codegraph/` directory and is resolved by
5
+ * walking up parent directories to the nearest one (see
6
+ * `findNearestCodeGraphRoot`). That walk is unaware of git worktrees: when a
7
+ * worktree is created *inside* the main checkout (e.g. some tools place them
8
+ * under `.gitignore`d paths like `.claude/worktrees/<name>/`), a command run
9
+ * from the worktree walks up and silently resolves the MAIN checkout's index.
10
+ *
11
+ * Every query then returns results from the main tree's code — usually a
12
+ * different branch — rather than the worktree the user is actually editing.
13
+ * Symbols added or changed only in the worktree are invisible. This module
14
+ * detects that "borrowed index" situation so callers can warn about it.
15
+ *
16
+ * Detection is best-effort: when git is unavailable or the path isn't a repo,
17
+ * it reports "no mismatch" and callers carry on unchanged.
18
+ */
19
+ /**
20
+ * Absolute, symlink-resolved toplevel of the git working tree that `dir`
21
+ * belongs to, or null when `dir` isn't inside a git repo (or git is missing).
22
+ *
23
+ * `git rev-parse --show-toplevel` returns the per-worktree root: the main
24
+ * checkout and each linked worktree report their own distinct directory, which
25
+ * is exactly the distinction this module relies on.
26
+ */
27
+ export declare function gitWorktreeRoot(dir: string): string | null;
28
+ export interface WorktreeIndexMismatch {
29
+ /** The git working tree the command was run from. */
30
+ worktreeRoot: string;
31
+ /** The (different) working tree whose `.codegraph` index is being used. */
32
+ indexRoot: string;
33
+ }
34
+ /**
35
+ * Detect when `startPath` lives in one git working tree but the resolved
36
+ * CodeGraph index (`indexRoot`) belongs to a *different* working tree.
37
+ *
38
+ * Returns null — meaning "nothing to warn about" — when:
39
+ * - `startPath` isn't in a git repo (or git is unavailable),
40
+ * - the index already lives in `startPath`'s own working tree, or
41
+ * - `indexRoot` isn't itself a working-tree root (an unrelated parent dir
42
+ * that merely happens to contain a `.codegraph/`), which keeps non-git
43
+ * and monorepo-subdir layouts from producing false warnings.
44
+ */
45
+ export declare function detectWorktreeIndexMismatch(startPath: string, indexRoot: string): WorktreeIndexMismatch | null;
46
+ /** One-line-per-fact warning describing a detected mismatch. */
47
+ export declare function worktreeMismatchWarning(m: WorktreeIndexMismatch): string;
48
+ /**
49
+ * Compact, single-line variant for prefixing a tool's result. Read tools
50
+ * return their answer inline, so the heads-up has to ride on the same payload
51
+ * the agent is already reading — a multi-line block would bury the result.
52
+ */
53
+ export declare function worktreeMismatchNotice(m: WorktreeIndexMismatch): string;
54
+ //# sourceMappingURL=worktree.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"worktree.d.ts","sourceRoot":"","sources":["../../src/sync/worktree.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAMH;;;;;;;GAOG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAW1D;AAED,MAAM,WAAW,qBAAqB;IACpC,qDAAqD;IACrD,YAAY,EAAE,MAAM,CAAC;IACrB,2EAA2E;IAC3E,SAAS,EAAE,MAAM,CAAC;CACnB;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,2BAA2B,CACzC,SAAS,EAAE,MAAM,EACjB,SAAS,EAAE,MAAM,GAChB,qBAAqB,GAAG,IAAI,CAa9B;AAED,gEAAgE;AAChE,wBAAgB,uBAAuB,CAAC,CAAC,EAAE,qBAAqB,GAAG,MAAM,CASxE;AAED;;;;GAIG;AACH,wBAAgB,sBAAsB,CAAC,CAAC,EAAE,qBAAqB,GAAG,MAAM,CAOvE"}
@@ -0,0 +1,136 @@
1
+ "use strict";
2
+ /**
3
+ * Git Worktree Awareness
4
+ *
5
+ * A CodeGraph index lives in a `.codegraph/` directory and is resolved by
6
+ * walking up parent directories to the nearest one (see
7
+ * `findNearestCodeGraphRoot`). That walk is unaware of git worktrees: when a
8
+ * worktree is created *inside* the main checkout (e.g. some tools place them
9
+ * under `.gitignore`d paths like `.claude/worktrees/<name>/`), a command run
10
+ * from the worktree walks up and silently resolves the MAIN checkout's index.
11
+ *
12
+ * Every query then returns results from the main tree's code — usually a
13
+ * different branch — rather than the worktree the user is actually editing.
14
+ * Symbols added or changed only in the worktree are invisible. This module
15
+ * detects that "borrowed index" situation so callers can warn about it.
16
+ *
17
+ * Detection is best-effort: when git is unavailable or the path isn't a repo,
18
+ * it reports "no mismatch" and callers carry on unchanged.
19
+ */
20
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
21
+ if (k2 === undefined) k2 = k;
22
+ var desc = Object.getOwnPropertyDescriptor(m, k);
23
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
24
+ desc = { enumerable: true, get: function() { return m[k]; } };
25
+ }
26
+ Object.defineProperty(o, k2, desc);
27
+ }) : (function(o, m, k, k2) {
28
+ if (k2 === undefined) k2 = k;
29
+ o[k2] = m[k];
30
+ }));
31
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
32
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
33
+ }) : function(o, v) {
34
+ o["default"] = v;
35
+ });
36
+ var __importStar = (this && this.__importStar) || (function () {
37
+ var ownKeys = function(o) {
38
+ ownKeys = Object.getOwnPropertyNames || function (o) {
39
+ var ar = [];
40
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
41
+ return ar;
42
+ };
43
+ return ownKeys(o);
44
+ };
45
+ return function (mod) {
46
+ if (mod && mod.__esModule) return mod;
47
+ var result = {};
48
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
49
+ __setModuleDefault(result, mod);
50
+ return result;
51
+ };
52
+ })();
53
+ Object.defineProperty(exports, "__esModule", { value: true });
54
+ exports.gitWorktreeRoot = gitWorktreeRoot;
55
+ exports.detectWorktreeIndexMismatch = detectWorktreeIndexMismatch;
56
+ exports.worktreeMismatchWarning = worktreeMismatchWarning;
57
+ exports.worktreeMismatchNotice = worktreeMismatchNotice;
58
+ const fs = __importStar(require("fs"));
59
+ const path = __importStar(require("path"));
60
+ const child_process_1 = require("child_process");
61
+ /**
62
+ * Absolute, symlink-resolved toplevel of the git working tree that `dir`
63
+ * belongs to, or null when `dir` isn't inside a git repo (or git is missing).
64
+ *
65
+ * `git rev-parse --show-toplevel` returns the per-worktree root: the main
66
+ * checkout and each linked worktree report their own distinct directory, which
67
+ * is exactly the distinction this module relies on.
68
+ */
69
+ function gitWorktreeRoot(dir) {
70
+ try {
71
+ const out = (0, child_process_1.execFileSync)('git', ['rev-parse', '--show-toplevel'], {
72
+ cwd: dir,
73
+ encoding: 'utf8',
74
+ stdio: ['ignore', 'pipe', 'ignore'],
75
+ }).trim();
76
+ return out ? realpath(out) : null;
77
+ }
78
+ catch {
79
+ return null;
80
+ }
81
+ }
82
+ /**
83
+ * Detect when `startPath` lives in one git working tree but the resolved
84
+ * CodeGraph index (`indexRoot`) belongs to a *different* working tree.
85
+ *
86
+ * Returns null — meaning "nothing to warn about" — when:
87
+ * - `startPath` isn't in a git repo (or git is unavailable),
88
+ * - the index already lives in `startPath`'s own working tree, or
89
+ * - `indexRoot` isn't itself a working-tree root (an unrelated parent dir
90
+ * that merely happens to contain a `.codegraph/`), which keeps non-git
91
+ * and monorepo-subdir layouts from producing false warnings.
92
+ */
93
+ function detectWorktreeIndexMismatch(startPath, indexRoot) {
94
+ const worktreeRoot = gitWorktreeRoot(startPath);
95
+ if (!worktreeRoot)
96
+ return null;
97
+ const resolvedIndexRoot = realpath(indexRoot);
98
+ if (worktreeRoot === resolvedIndexRoot)
99
+ return null;
100
+ // Only flag it when the index root is itself a real working-tree root. This
101
+ // distinguishes "borrowed another worktree's index" from "index sits in a
102
+ // plain ancestor directory", and avoids warning outside git entirely.
103
+ if (gitWorktreeRoot(resolvedIndexRoot) !== resolvedIndexRoot)
104
+ return null;
105
+ return { worktreeRoot, indexRoot: resolvedIndexRoot };
106
+ }
107
+ /** One-line-per-fact warning describing a detected mismatch. */
108
+ function worktreeMismatchWarning(m) {
109
+ return (`This CodeGraph index belongs to a different git working tree.\n` +
110
+ ` Running in: ${m.worktreeRoot}\n` +
111
+ ` Index from: ${m.indexRoot}\n` +
112
+ `Results reflect that tree's code (often a different branch), not this worktree — ` +
113
+ `symbols changed only here are missing. Run "codegraph init -i" in this worktree ` +
114
+ `for a worktree-local index.`);
115
+ }
116
+ /**
117
+ * Compact, single-line variant for prefixing a tool's result. Read tools
118
+ * return their answer inline, so the heads-up has to ride on the same payload
119
+ * the agent is already reading — a multi-line block would bury the result.
120
+ */
121
+ function worktreeMismatchNotice(m) {
122
+ return (`⚠ CodeGraph results below come from a different git worktree (${m.indexRoot}), ` +
123
+ `not where you're working (${m.worktreeRoot}) — they may reflect another branch, ` +
124
+ `and symbols changed only here are missing. Run "codegraph init -i" here for a ` +
125
+ `worktree-local index.`);
126
+ }
127
+ /** Resolve symlinks where possible so tmp/realpath quirks don't break equality. */
128
+ function realpath(p) {
129
+ try {
130
+ return fs.realpathSync(path.resolve(p));
131
+ }
132
+ catch {
133
+ return path.resolve(p);
134
+ }
135
+ }
136
+ //# sourceMappingURL=worktree.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"worktree.js","sourceRoot":"","sources":["../../src/sync/worktree.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;GAiBG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAcH,0CAWC;AAoBD,kEAgBC;AAGD,0DASC;AAOD,wDAOC;AArFD,uCAAyB;AACzB,2CAA6B;AAC7B,iDAA6C;AAE7C;;;;;;;GAOG;AACH,SAAgB,eAAe,CAAC,GAAW;IACzC,IAAI,CAAC;QACH,MAAM,GAAG,GAAG,IAAA,4BAAY,EAAC,KAAK,EAAE,CAAC,WAAW,EAAE,iBAAiB,CAAC,EAAE;YAChE,GAAG,EAAE,GAAG;YACR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zB,IAAI,CAAC;QACH,OAAO,EAAE,CAAC,YAAY,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC;IAC1C,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;IACzB,CAAC;AACH,CAAC"}
@@ -20,7 +20,7 @@ export type EdgeKind = 'contains' | 'calls' | 'imports' | 'exports' | 'extends'
20
20
  * Supported programming languages. See NODE_KINDS for why this is a
21
21
  * runtime-iterable const array.
22
22
  */
23
- export declare const LANGUAGES: readonly ["typescript", "javascript", "tsx", "jsx", "python", "go", "rust", "java", "c", "cpp", "csharp", "php", "ruby", "swift", "kotlin", "dart", "svelte", "vue", "liquid", "pascal", "scala", "lua", "luau", "yaml", "twig", "unknown"];
23
+ export declare const LANGUAGES: readonly ["typescript", "javascript", "tsx", "jsx", "python", "go", "rust", "java", "c", "cpp", "csharp", "php", "ruby", "swift", "kotlin", "dart", "svelte", "vue", "liquid", "pascal", "scala", "lua", "luau", "objc", "yaml", "twig", "unknown"];
24
24
  export type Language = (typeof LANGUAGES)[number];
25
25
  /**
26
26
  * A node in the knowledge graph representing a code symbol
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAMH;;;;;;GAMG;AACH,eAAO,MAAM,UAAU,8PAuBb,CAAC;AAEX,MAAM,MAAM,QAAQ,GAAG,CAAC,OAAO,UAAU,CAAC,CAAC,MAAM,CAAC,CAAC;AAEnD;;GAEG;AACH,MAAM,MAAM,QAAQ,GAChB,UAAU,GACV,OAAO,GACP,SAAS,GACT,SAAS,GACT,SAAS,GACT,YAAY,GACZ,YAAY,GACZ,SAAS,GACT,SAAS,GACT,cAAc,GACd,WAAW,GACX,WAAW,CAAC;AAEhB;;;GAGG;AACH,eAAO,MAAM,SAAS,6OA2BZ,CAAC;AAEX,MAAM,MAAM,QAAQ,GAAG,CAA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AS,EAAE,MAAM,CAAC;QAClB,8BAA8B;QAC9B,SAAS,EAAE,MAAM,CAAC;QAClB,qCAAqC;QACrC,cAAc,EAAE,MAAM,CAAC;QACvB,sCAAsC;QACtC,aAAa,EAAE,MAAM,CAAC;KACvB,CAAC;CACH;AAED;;GAEG;AACH,MAAM,WAAW,0BAA0B;IACzC,qDAAqD;IACrD,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB,yCAAyC;IACzC,cAAc,CAAC,EAAE,MAAM,CAAC;IAExB,4CAA4C;IAC5C,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB,uDAAuD;IACvD,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB,wCAAwC;IACxC,SAAS,CAAC,EAAE,QAAQ,EAAE,CAAC;IAEvB,4BAA4B;IAC5B,SAAS,CAAC,EAAE,QAAQ,EAAE,CAAC;CACxB"}
package/lib/dist/types.js CHANGED
@@ -68,6 +68,7 @@ exports.LANGUAGES = [
68
68
  'scala',
69
69
  'lua',
70
70
  'luau',
71
+ 'objc',
71
72
  'yaml',
72
73
  'twig',
73
74
  'unknown',
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAEH,gFAAgF;AAChF,cAAc;AACd,gFAAgF;AAEhF;;;;;;GAMG;AACU,QAAA,UAAU,GAAG;IACxB,MAAM;IACN,QAAQ;IACR,OAAO;IACP,QAAQ;IACR,WAAW;IACX,OAAO;IACP,UAAU;IACV,UAAU;IACV,QAAQ;IACR,UAAU;IACV,OAAO;IACP,UAAU;IACV,UAAU;IACV,MAAM;IACN,aAAa;IACb,YAAY;IACZ,WAAW;IACX,WAAW;IACX,QAAQ;IACR,QAAQ;IACR,OAAO;IACP,WAAW;CACH,CAAC;AAqBX;;;GAGG;AACU,QAAA,SAAS,GAAG;IACvB,YAAY;IACZ,YAAY;IACZ,KAAK;IACL,KAAK;IACL,QAAQ;IACR,IAAI;IACJ,MAAM;IACN,MAAM;IACN,GAAG;IACH,KAAK;IACL,QAAQ;IACR,KAAK;IACL,MAAM;IACN,OAAO;IACP,QAAQ;IACR,MAAM;IACN,QAAQ;IACR,KAAK;IACL,QAAQ;IACR,QAAQ;IACR,OAAO;IACP,KAAK;IACL,MAAM;IACN,MAAM;IACN,MAAM;IACN,SAAS;CACD,CAAC"}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAEH,gFAAgF;AAChF,cAAc;AACd,gFAAgF;AAEhF;;;;;;GAMG;AACU,QAAA,UAAU,GAAG;IACxB,MAAM;IACN,QAAQ;IACR,OAAO;IACP,QAAQ;IACR,WAAW;IACX,OAAO;IACP,UAAU;IACV,UAAU;IACV,QAAQ;IACR,UAAU;IACV,OAAO;IACP,UAAU;IACV,UAAU;IACV,MAAM;IACN,aAAa;IACb,YAAY;IACZ,WAAW;IACX,WAAW;IACX,QAAQ;IACR,QAAQ;IACR,OAAO;IACP,WAAW;CACH,CAAC;AAqBX;;;GAGG;AACU,QAAA,SAAS,GAAG;IACvB,YAAY;IACZ,YAAY;IACZ,KAAK;IACL,KAAK;IACL,QAAQ;IACR,IAAI;IACJ,MAAM;IACN,MAAM;IACN,GAAG;IACH,KAAK;IACL,QAAQ;IACR,KAAK;IACL,MAAM;IACN,OAAO;IACP,QAAQ;IACR,MAAM;IACN,QAAQ;IACR,KAAK;IACL,QAAQ;IACR,QAAQ;IACR,OAAO;IACP,KAAK;IACL,MAAM;IACN,MAAM;IACN,MAAM;IACN,MAAM;IACN,SAAS;CACD,CAAC"}
package/lib/dist/utils.js CHANGED
@@ -88,7 +88,7 @@ const path = __importStar(require("path"));
88
88
  const SENSITIVE_PATHS = new Set([
89
89
  '/', '/etc', '/usr', '/bin', '/sbin', '/var', '/tmp', '/dev', '/proc', '/sys',
90
90
  '/root', '/boot', '/lib', '/lib64', '/opt',
91
- 'C:\\', 'C:\\Windows', 'C:\\Windows\\System32',
91
+ 'c:\\', 'c:\\windows', 'c:\\windows\\system32',
92
92
  ]);
93
93
  /**
94
94
  * Validate that a resolved file path stays within the project root.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@colbymchenry/codegraph",
3
- "version": "0.9.3",
3
+ "version": "0.9.4",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
@@ -32,6 +32,21 @@
32
32
  "node": ">= 20.12.0"
33
33
  }
34
34
  },
35
+ "node_modules/chokidar": {
36
+ "version": "4.0.3",
37
+ "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-4.0.3.tgz",
38
+ "integrity": "sha512-Qgzu8kfBvo+cA4962jnP1KkS6Dop5NS6g7R5LFYJr4b8Ub94PPQXUksCw9PvXoeXPRRddRNC5C1JQUR2SMGtnA==",
39
+ "license": "MIT",
40
+ "dependencies": {
41
+ "readdirp": "^4.0.1"
42
+ },
43
+ "engines": {
44
+ "node": ">= 14.16.0"
45
+ },
46
+ "funding": {
47
+ "url": "https://paulmillr.com/funding/"
48
+ }
49
+ },
35
50
  "node_modules/commander": {
36
51
  "version": "14.0.3",
37
52
  "resolved": "https://registry.npmjs.org/commander/-/commander-14.0.3.tgz",
@@ -92,6 +107,19 @@
92
107
  "url": "https://github.com/sponsors/jonschlinkert"
93
108
  }
94
109
  },
110
+ "node_modules/readdirp": {
111
+ "version": "4.1.2",
112
+ "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-4.1.2.tgz",
113
+ "integrity": "sha512-GDhwkLfywWL2s6vEjyhri+eXmfH6j1L7JE27WhqLeYzoh/A3DBaYGEj2H/HFZCn/kMfim73FXxEJTw06WtxQwg==",
114
+ "license": "MIT",
115
+ "engines": {
116
+ "node": ">= 14.18.0"
117
+ },
118
+ "funding": {
119
+ "type": "individual",
120
+ "url": "https://paulmillr.com/funding/"
121
+ }
122
+ },
95
123
  "node_modules/sisteransi": {
96
124
  "version": "1.0.5",
97
125
  "resolved": "https://registry.npmjs.org/sisteransi/-/sisteransi-1.0.5.tgz",
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2012 Paul Miller (https://paulmillr.com), Elan Shanker
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the “Software”), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
@@ -0,0 +1,305 @@
1
+ # Chokidar [![Weekly downloads](https://img.shields.io/npm/dw/chokidar.svg)](https://github.com/paulmillr/chokidar)
2
+
3
+ > Minimal and efficient cross-platform file watching library
4
+
5
+ ## Why?
6
+
7
+ There are many reasons to prefer Chokidar to raw fs.watch / fs.watchFile in 2024:
8
+
9
+ - Events are properly reported
10
+ - macOS events report filenames
11
+ - events are not reported twice
12
+ - changes are reported as add / change / unlink instead of useless `rename`
13
+ - Atomic writes are supported, using `atomic` option
14
+ - Some file editors use them
15
+ - Chunked writes are supported, using `awaitWriteFinish` option
16
+ - Large files are commonly written in chunks
17
+ - File / dir filtering is supported
18
+ - Symbolic links are supported
19
+ - Recursive watching is always supported, instead of partial when using raw events
20
+ - Includes a way to limit recursion depth
21
+
22
+ Chokidar relies on the Node.js core `fs` module, but when using
23
+ `fs.watch` and `fs.watchFile` for watching, it normalizes the events it
24
+ receives, often checking for truth by getting file stats and/or dir contents.
25
+ The `fs.watch`-based implementation is the default, which
26
+ avoids polling and keeps CPU usage down. Be advised that chokidar will initiate
27
+ watchers recursively for everything within scope of the paths that have been
28
+ specified, so be judicious about not wasting system resources by watching much
29
+ more than needed. For some cases, `fs.watchFile`, which utilizes polling and uses more resources, is used.
30
+
31
+ Made for [Brunch](https://brunch.io/) in 2012,
32
+ it is now used in [~30 million repositories](https://www.npmjs.com/browse/depended/chokidar) and
33
+ has proven itself in production environments.
34
+
35
+ **Sep 2024 update:** v4 is out! It decreases dependency count from 13 to 1, removes
36
+ support for globs, adds support for ESM / Common.js modules, and bumps minimum node.js version from v8 to v14.
37
+ Check out [upgrading](#upgrading).
38
+
39
+ ## Getting started
40
+
41
+ Install with npm:
42
+
43
+ ```sh
44
+ npm install chokidar
45
+ ```
46
+
47
+ Use it in your code:
48
+
49
+ ```javascript
50
+ import chokidar from 'chokidar';
51
+
52
+ // One-liner for current directory
53
+ chokidar.watch('.').on('all', (event, path) => {
54
+ console.log(event, path);
55
+ });
56
+
57
+
58
+ // Extended options
59
+ // ----------------
60
+
61
+ // Initialize watcher.
62
+ const watcher = chokidar.watch('file, dir, or array', {
63
+ ignored: (path, stats) => stats?.isFile() && !path.endsWith('.js'), // only watch js files
64
+ persistent: true
65
+ });
66
+
67
+ // Something to use when events are received.
68
+ const log = console.log.bind(console);
69
+ // Add event listeners.
70
+ watcher
71
+ .on('add', path => log(`File ${path} has been added`))
72
+ .on('change', path => log(`File ${path} has been changed`))
73
+ .on('unlink', path => log(`File ${path} has been removed`));
74
+
75
+ // More possible events.
76
+ watcher
77
+ .on('addDir', path => log(`Directory ${path} has been added`))
78
+ .on('unlinkDir', path => log(`Directory ${path} has been removed`))
79
+ .on('error', error => log(`Watcher error: ${error}`))
80
+ .on('ready', () => log('Initial scan complete. Ready for changes'))
81
+ .on('raw', (event, path, details) => { // internal
82
+ log('Raw event info:', event, path, details);
83
+ });
84
+
85
+ // 'add', 'addDir' and 'change' events also receive stat() results as second
86
+ // argument when available: https://nodejs.org/api/fs.html#fs_class_fs_stats
87
+ watcher.on('change', (path, stats) => {
88
+ if (stats) console.log(`File ${path} changed size to ${stats.size}`);
89
+ });
90
+
91
+ // Watch new files.
92
+ watcher.add('new-file');
93
+ watcher.add(['new-file-2', 'new-file-3']);
94
+
95
+ // Get list of actual paths being watched on the filesystem
96
+ let watchedPaths = watcher.getWatched();
97
+
98
+ // Un-watch some files.
99
+ await watcher.unwatch('new-file');
100
+
101
+ // Stop watching. The method is async!
102
+ await watcher.close().then(() => console.log('closed'));
103
+
104
+ // Full list of options. See below for descriptions.
105
+ // Do not use this example!
106
+ chokidar.watch('file', {
107
+ persistent: true,
108
+
109
+ // ignore .txt files
110
+ ignored: (file) => file.endsWith('.txt'),
111
+ // watch only .txt files
112
+ // ignored: (file, _stats) => _stats?.isFile() && !file.endsWith('.txt'),
113
+
114
+ awaitWriteFinish: true, // emit single event when chunked writes are completed
115
+ atomic: true, // emit proper events when "atomic writes" (mv _tmp file) are used
116
+
117
+ // The options also allow specifying custom intervals in ms
118
+ // awaitWriteFinish: {
119
+ // stabilityThreshold: 2000,
120
+ // pollInterval: 100
121
+ // },
122
+ // atomic: 100,
123
+
124
+ interval: 100,
125
+ binaryInterval: 300,
126
+
127
+ cwd: '.',
128
+ depth: 99,
129
+
130
+ followSymlinks: true,
131
+ ignoreInitial: false,
132
+ ignorePermissionErrors: false,
133
+ usePolling: false,
134
+ alwaysStat: false,
135
+ });
136
+
137
+ ```
138
+
139
+ `chokidar.watch(paths, [options])`
140
+
141
+ * `paths` (string or array of strings). Paths to files, dirs to be watched
142
+ recursively.
143
+ * `options` (object) Options object as defined below:
144
+
145
+ #### Persistence
146
+
147
+ * `persistent` (default: `true`). Indicates whether the process
148
+ should continue to run as long as files are being watched.
149
+
150
+ #### Path filtering
151
+
152
+ * `ignored` function, regex, or path. Defines files/paths to be ignored.
153
+ The whole relative or absolute path is tested, not just filename. If a function with two arguments
154
+ is provided, it gets called twice per path - once with a single argument (the path), second
155
+ time with two arguments (the path and the
156
+ [`fs.Stats`](https://nodejs.org/api/fs.html#fs_class_fs_stats)
157
+ object of that path).
158
+ * `ignoreInitial` (default: `false`). If set to `false` then `add`/`addDir` events are also emitted for matching paths while
159
+ instantiating the watching as chokidar discovers these file paths (before the `ready` event).
160
+ * `followSymlinks` (default: `true`). When `false`, only the
161
+ symlinks themselves will be watched for changes instead of following
162
+ the link references and bubbling events through the link's path.
163
+ * `cwd` (no default). The base directory from which watch `paths` are to be
164
+ derived. Paths emitted with events will be relative to this.
165
+
166
+ #### Performance
167
+
168
+ * `usePolling` (default: `false`).
169
+ Whether to use fs.watchFile (backed by polling), or fs.watch. If polling
170
+ leads to high CPU utilization, consider setting this to `false`. It is
171
+ typically necessary to **set this to `true` to successfully watch files over
172
+ a network**, and it may be necessary to successfully watch files in other
173
+ non-standard situations. Setting to `true` explicitly on MacOS overrides the
174
+ `useFsEvents` default. You may also set the CHOKIDAR_USEPOLLING env variable
175
+ to true (1) or false (0) in order to override this option.
176
+ * _Polling-specific settings_ (effective when `usePolling: true`)
177
+ * `interval` (default: `100`). Interval of file system polling, in milliseconds. You may also
178
+ set the CHOKIDAR_INTERVAL env variable to override this option.
179
+ * `binaryInterval` (default: `300`). Interval of file system
180
+ polling for binary files.
181
+ ([see list of binary extensions](https://github.com/sindresorhus/binary-extensions/blob/master/binary-extensions.json))
182
+ * `alwaysStat` (default: `false`). If relying upon the
183
+ [`fs.Stats`](https://nodejs.org/api/fs.html#fs_class_fs_stats)
184
+ object that may get passed with `add`, `addDir`, and `change` events, set
185
+ this to `true` to ensure it is provided even in cases where it wasn't
186
+ already available from the underlying watch events.
187
+ * `depth` (default: `undefined`). If set, limits how many levels of
188
+ subdirectories will be traversed.
189
+ * `awaitWriteFinish` (default: `false`).
190
+ By default, the `add` event will fire when a file first appears on disk, before
191
+ the entire file has been written. Furthermore, in some cases some `change`
192
+ events will be emitted while the file is being written. In some cases,
193
+ especially when watching for large files there will be a need to wait for the
194
+ write operation to finish before responding to a file creation or modification.
195
+ Setting `awaitWriteFinish` to `true` (or a truthy value) will poll file size,
196
+ holding its `add` and `change` events until the size does not change for a
197
+ configurable amount of time. The appropriate duration setting is heavily
198
+ dependent on the OS and hardware. For accurate detection this parameter should
199
+ be relatively high, making file watching much less responsive.
200
+ Use with caution.
201
+ * *`options.awaitWriteFinish` can be set to an object in order to adjust
202
+ timing params:*
203
+ * `awaitWriteFinish.stabilityThreshold` (default: 2000). Amount of time in
204
+ milliseconds for a file size to remain constant before emitting its event.
205
+ * `awaitWriteFinish.pollInterval` (default: 100). File size polling interval, in milliseconds.
206
+
207
+ #### Errors
208
+
209
+ * `ignorePermissionErrors` (default: `false`). Indicates whether to watch files
210
+ that don't have read permissions if possible. If watching fails due to `EPERM`
211
+ or `EACCES` with this set to `true`, the errors will be suppressed silently.
212
+ * `atomic` (default: `true` if `useFsEvents` and `usePolling` are `false`).
213
+ Automatically filters out artifacts that occur when using editors that use
214
+ "atomic writes" instead of writing directly to the source file. If a file is
215
+ re-added within 100 ms of being deleted, Chokidar emits a `change` event
216
+ rather than `unlink` then `add`. If the default of 100 ms does not work well
217
+ for you, you can override it by setting `atomic` to a custom value, in
218
+ milliseconds.
219
+
220
+ ### Methods & Events
221
+
222
+ `chokidar.watch()` produces an instance of `FSWatcher`. Methods of `FSWatcher`:
223
+
224
+ * `.add(path / paths)`: Add files, directories for tracking.
225
+ Takes an array of strings or just one string.
226
+ * `.on(event, callback)`: Listen for an FS event.
227
+ Available events: `add`, `addDir`, `change`, `unlink`, `unlinkDir`, `ready`,
228
+ `raw`, `error`.
229
+ Additionally `all` is available which gets emitted with the underlying event
230
+ name and path for every event other than `ready`, `raw`, and `error`. `raw` is internal, use it carefully.
231
+ * `.unwatch(path / paths)`: Stop watching files or directories.
232
+ Takes an array of strings or just one string.
233
+ * `.close()`: **async** Removes all listeners from watched files. Asynchronous, returns Promise. Use with `await` to ensure bugs don't happen.
234
+ * `.getWatched()`: Returns an object representing all the paths on the file
235
+ system being watched by this `FSWatcher` instance. The object's keys are all the
236
+ directories (using absolute paths unless the `cwd` option was used), and the
237
+ values are arrays of the names of the items contained in each directory.
238
+
239
+ ### CLI
240
+
241
+ Check out third party [chokidar-cli](https://github.com/open-cli-tools/chokidar-cli),
242
+ which allows to execute a command on each change, or get a stdio stream of change events.
243
+
244
+ ## Troubleshooting
245
+
246
+ Sometimes, Chokidar runs out of file handles, causing `EMFILE` and `ENOSP` errors:
247
+
248
+ * `bash: cannot set terminal process group (-1): Inappropriate ioctl for device bash: no job control in this shell`
249
+ * `Error: watch /home/ ENOSPC`
250
+
251
+ There are two things that can cause it.
252
+
253
+ 1. Exhausted file handles for generic fs operations
254
+ - Can be solved by using [graceful-fs](https://www.npmjs.com/package/graceful-fs),
255
+ which can monkey-patch native `fs` module used by chokidar: `let fs = require('fs'); let grfs = require('graceful-fs'); grfs.gracefulify(fs);`
256
+ - Can also be solved by tuning OS: `echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p`.
257
+ 2. Exhausted file handles for `fs.watch`
258
+ - Can't seem to be solved by graceful-fs or OS tuning
259
+ - It's possible to start using `usePolling: true`, which will switch backend to resource-intensive `fs.watchFile`
260
+
261
+ All fsevents-related issues (`WARN optional dep failed`, `fsevents is not a constructor`) are solved by upgrading to v4+.
262
+
263
+ ## Changelog
264
+
265
+ - **v4 (Sep 2024):** remove glob support and bundled fsevents. Decrease dependency count from 13 to 1. Rewrite in typescript. Bumps minimum node.js requirement to v14+
266
+ - **v3 (Apr 2019):** massive CPU & RAM consumption improvements; reduces deps / package size by a factor of 17x and bumps Node.js requirement to v8.16+.
267
+ - **v2 (Dec 2017):** globs are now posix-style-only. Tons of bugfixes.
268
+ - **v1 (Apr 2015):** glob support, symlink support, tons of bugfixes. Node 0.8+ is supported
269
+ - **v0.1 (Apr 2012):** Initial release, extracted from [Brunch](https://github.com/brunch/brunch/blob/9847a065aea300da99bd0753f90354cde9de1261/src/helpers.coffee#L66)
270
+
271
+ ### Upgrading
272
+
273
+ If you've used globs before and want do replicate the functionality with v4:
274
+
275
+ ```js
276
+ // v3
277
+ chok.watch('**/*.js');
278
+ chok.watch("./directory/**/*");
279
+
280
+ // v4
281
+ chok.watch('.', {
282
+ ignored: (path, stats) => stats?.isFile() && !path.endsWith('.js'), // only watch js files
283
+ });
284
+ chok.watch('./directory');
285
+
286
+ // other way
287
+ import { glob } from 'node:fs/promises';
288
+ const watcher = watch(await Array.fromAsync(glob('**/*.js')));
289
+
290
+ // unwatching
291
+ // v3
292
+ chok.unwatch('**/*.js');
293
+ // v4
294
+ chok.unwatch(await glob('**/*.js'));
295
+ ```
296
+
297
+ ## Also
298
+
299
+ Why was chokidar named this way? What's the meaning behind it?
300
+
301
+ >Chowkidar is a transliteration of a Hindi word meaning 'watchman, gatekeeper', चौकीदार. This ultimately comes from Sanskrit _ चतुष्क_ (crossway, quadrangle, consisting-of-four). This word is also used in other languages like Urdu as (چوکیدار) which is widely used in Pakistan and India.
302
+
303
+ ## License
304
+
305
+ MIT (c) Paul Miller (<https://paulmillr.com>), see [LICENSE](LICENSE) file.