@colbymchenry/codegraph-darwin-x64 1.1.1 → 1.1.3

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 (88) hide show
  1. package/lib/dist/bin/codegraph.js +99 -59
  2. package/lib/dist/bin/codegraph.js.map +1 -1
  3. package/lib/dist/bin/command-supervision.d.ts +12 -0
  4. package/lib/dist/bin/command-supervision.d.ts.map +1 -0
  5. package/lib/dist/bin/command-supervision.js +76 -0
  6. package/lib/dist/bin/command-supervision.js.map +1 -0
  7. package/lib/dist/db/migrations.d.ts +1 -1
  8. package/lib/dist/db/migrations.d.ts.map +1 -1
  9. package/lib/dist/db/migrations.js +25 -1
  10. package/lib/dist/db/migrations.js.map +1 -1
  11. package/lib/dist/db/queries.d.ts.map +1 -1
  12. package/lib/dist/db/queries.js +10 -2
  13. package/lib/dist/db/queries.js.map +1 -1
  14. package/lib/dist/db/schema.sql +11 -0
  15. package/lib/dist/directory.d.ts +32 -0
  16. package/lib/dist/directory.d.ts.map +1 -1
  17. package/lib/dist/directory.js +83 -0
  18. package/lib/dist/directory.js.map +1 -1
  19. package/lib/dist/extraction/index.d.ts +13 -1
  20. package/lib/dist/extraction/index.d.ts.map +1 -1
  21. package/lib/dist/extraction/index.js +310 -218
  22. package/lib/dist/extraction/index.js.map +1 -1
  23. package/lib/dist/extraction/languages/c-cpp.d.ts +16 -0
  24. package/lib/dist/extraction/languages/c-cpp.d.ts.map +1 -1
  25. package/lib/dist/extraction/languages/c-cpp.js +33 -0
  26. package/lib/dist/extraction/languages/c-cpp.js.map +1 -1
  27. package/lib/dist/extraction/parse-pool.d.ts +126 -0
  28. package/lib/dist/extraction/parse-pool.d.ts.map +1 -0
  29. package/lib/dist/extraction/parse-pool.js +319 -0
  30. package/lib/dist/extraction/parse-pool.js.map +1 -0
  31. package/lib/dist/extraction/tree-sitter.d.ts +21 -0
  32. package/lib/dist/extraction/tree-sitter.d.ts.map +1 -1
  33. package/lib/dist/extraction/tree-sitter.js +106 -21
  34. package/lib/dist/extraction/tree-sitter.js.map +1 -1
  35. package/lib/dist/mcp/daemon-paths.d.ts +30 -3
  36. package/lib/dist/mcp/daemon-paths.d.ts.map +1 -1
  37. package/lib/dist/mcp/daemon-paths.js +50 -10
  38. package/lib/dist/mcp/daemon-paths.js.map +1 -1
  39. package/lib/dist/mcp/daemon-registry.d.ts.map +1 -1
  40. package/lib/dist/mcp/daemon-registry.js +7 -3
  41. package/lib/dist/mcp/daemon-registry.js.map +1 -1
  42. package/lib/dist/mcp/daemon.d.ts +48 -0
  43. package/lib/dist/mcp/daemon.d.ts.map +1 -1
  44. package/lib/dist/mcp/daemon.js +203 -32
  45. package/lib/dist/mcp/daemon.js.map +1 -1
  46. package/lib/dist/mcp/engine.d.ts +17 -0
  47. package/lib/dist/mcp/engine.d.ts.map +1 -1
  48. package/lib/dist/mcp/engine.js +73 -1
  49. package/lib/dist/mcp/engine.js.map +1 -1
  50. package/lib/dist/mcp/index.d.ts.map +1 -1
  51. package/lib/dist/mcp/index.js +25 -43
  52. package/lib/dist/mcp/index.js.map +1 -1
  53. package/lib/dist/mcp/ppid-watchdog.d.ts +18 -0
  54. package/lib/dist/mcp/ppid-watchdog.d.ts.map +1 -1
  55. package/lib/dist/mcp/ppid-watchdog.js +37 -0
  56. package/lib/dist/mcp/ppid-watchdog.js.map +1 -1
  57. package/lib/dist/mcp/query-pool.d.ts +94 -0
  58. package/lib/dist/mcp/query-pool.d.ts.map +1 -0
  59. package/lib/dist/mcp/query-pool.js +297 -0
  60. package/lib/dist/mcp/query-pool.js.map +1 -0
  61. package/lib/dist/mcp/query-worker.d.ts +24 -0
  62. package/lib/dist/mcp/query-worker.d.ts.map +1 -0
  63. package/lib/dist/mcp/query-worker.js +87 -0
  64. package/lib/dist/mcp/query-worker.js.map +1 -0
  65. package/lib/dist/mcp/tools.d.ts +57 -0
  66. package/lib/dist/mcp/tools.d.ts.map +1 -1
  67. package/lib/dist/mcp/tools.js +196 -40
  68. package/lib/dist/mcp/tools.js.map +1 -1
  69. package/lib/dist/project-config.d.ts +20 -0
  70. package/lib/dist/project-config.d.ts.map +1 -1
  71. package/lib/dist/project-config.js +42 -2
  72. package/lib/dist/project-config.js.map +1 -1
  73. package/lib/dist/resolution/c-fnptr-synthesizer.d.ts +0 -28
  74. package/lib/dist/resolution/c-fnptr-synthesizer.d.ts.map +1 -1
  75. package/lib/dist/resolution/c-fnptr-synthesizer.js +765 -79
  76. package/lib/dist/resolution/c-fnptr-synthesizer.js.map +1 -1
  77. package/lib/dist/resolution/name-matcher.d.ts.map +1 -1
  78. package/lib/dist/resolution/name-matcher.js +44 -0
  79. package/lib/dist/resolution/name-matcher.js.map +1 -1
  80. package/lib/dist/sync/worktree.d.ts +9 -0
  81. package/lib/dist/sync/worktree.d.ts.map +1 -1
  82. package/lib/dist/sync/worktree.js +40 -0
  83. package/lib/dist/sync/worktree.js.map +1 -1
  84. package/lib/dist/types.d.ts +6 -1
  85. package/lib/dist/types.d.ts.map +1 -1
  86. package/lib/node_modules/.package-lock.json +1 -1
  87. package/lib/package.json +1 -1
  88. package/package.json +1 -1
@@ -0,0 +1,319 @@
1
+ "use strict";
2
+ /**
3
+ * Parse worker pool — runs tree-sitter parsing across N worker threads so a full
4
+ * `codegraph index` uses every core instead of pinning one.
5
+ *
6
+ * Why this exists: `ExtractionOrchestrator.indexAll()` already reads files in
7
+ * parallel, but it parsed them through a SINGLE worker thread, so on an
8
+ * N-core machine indexing a large repo used one core and left the rest idle
9
+ * (issue #1015, the parse-time half of #320). Spreading the parse calls across a
10
+ * pool of workers — each its own tree-sitter WASM heap — restores multi-core
11
+ * throughput. SQLite storage stays on the main thread (it isn't thread-safe), so
12
+ * only the CPU-bound parse step is parallelised; results are stored as they
13
+ * arrive, in whatever order they finish.
14
+ *
15
+ * Design mirrors {@link ../mcp/query-pool} (idle-list dispatch, lazy growth,
16
+ * throttled cold-starts, crash recovery), with parse-specific behaviour:
17
+ * - per-worker recycle: WASM linear memory grows but never shrinks, so each
18
+ * worker is torn down and replaced after `recycleInterval` parses to reclaim
19
+ * its heap — the same reason the old single worker recycled.
20
+ * - reject, don't retry: a parse that crashes or times out its worker REJECTS
21
+ * (with a message the orchestrator's retry pass recognises) rather than being
22
+ * silently requeued — the orchestrator owns the smarter two-stage retry
23
+ * (fresh worker, then comment-stripped) on a clean WASM heap.
24
+ * - a size-1 pool reproduces the old single-worker path exactly, which is the
25
+ * conservative rollback: set `CODEGRAPH_PARSE_WORKERS=1`.
26
+ *
27
+ * Memory: peak scales with pool size (≈ size × a worker's pre-recycle heap), so
28
+ * the default is capped and the env var lets constrained machines dial it down.
29
+ */
30
+ Object.defineProperty(exports, "__esModule", { value: true });
31
+ exports.ParseWorkerPool = void 0;
32
+ exports.resolveParsePoolSize = resolveParsePoolSize;
33
+ const worker_threads_1 = require("worker_threads");
34
+ /** Default upper bound on the pool size derived from the core count. */
35
+ const DEFAULT_PARSE_POOL_CAP = 8;
36
+ /** Hard ceiling on pool size regardless of an explicit env override. */
37
+ const MAX_PARSE_POOL_SIZE = 16;
38
+ /** Parses a worker performs before it's recycled to reclaim WASM heap. */
39
+ const DEFAULT_RECYCLE_INTERVAL = 250;
40
+ /** Base per-parse timeout; scaled up for large files by the caller's formula. */
41
+ const DEFAULT_PARSE_TIMEOUT_MS = 10_000;
42
+ /**
43
+ * Max workers cold-starting at once. A worker's cold start is heavy (module load
44
+ * + grammar WASM compile); starting the whole pool simultaneously thrashes CPU.
45
+ * Warming a couple at a time keeps each start fast while the pool still reaches
46
+ * full size within a few parses of a large run.
47
+ */
48
+ const MAX_CONCURRENT_SPAWN = 2;
49
+ /**
50
+ * Total worker deaths before the pool stops respawning and fails outstanding
51
+ * work, so a systematically-broken worker platform degrades instead of
52
+ * respawning forever. Set high: normal per-file WASM crashes are cleared by the
53
+ * orchestrator's retry pass and shouldn't trip this on a merely-crashy repo.
54
+ */
55
+ const CRASH_BUDGET = 100;
56
+ /**
57
+ * Resolve the pool size from the `CODEGRAPH_PARSE_WORKERS` override and the
58
+ * machine's core count.
59
+ * - explicit `0` or `1` → 1 worker (the old single-worker path; the rollback).
60
+ * - explicit `N` → N, clamped to [1, 16].
61
+ * - unset / blank / non-numeric → `clamp(cores - 1, 1, 8)` (leave a core for
62
+ * the main thread + UI; never zero — parsing always needs a worker).
63
+ */
64
+ function resolveParsePoolSize(envVal, cpuCount) {
65
+ if (envVal !== undefined && envVal !== '') {
66
+ const n = Number(envVal);
67
+ if (Number.isFinite(n) && n >= 0) {
68
+ return Math.max(1, Math.min(Math.floor(n), MAX_PARSE_POOL_SIZE));
69
+ }
70
+ // non-numeric / negative → fall through to the default
71
+ }
72
+ return Math.max(1, Math.min(cpuCount - 1, DEFAULT_PARSE_POOL_CAP));
73
+ }
74
+ class ParseWorkerPool {
75
+ idle = [];
76
+ queue = [];
77
+ inflight = new Map();
78
+ workers = new Set();
79
+ // Spawned but not yet 'grammars-loaded'. Growth counts these so a single first
80
+ // parse doesn't spawn the whole pool before the eager worker reports ready.
81
+ pending = new Set();
82
+ parseCounts = new Map();
83
+ nextId = 1;
84
+ totalCrashes = 0;
85
+ destroyed = false;
86
+ languages;
87
+ maxSize;
88
+ recycleInterval;
89
+ parseTimeoutMs;
90
+ createWorker;
91
+ log;
92
+ constructor(opts) {
93
+ this.languages = opts.languages;
94
+ this.maxSize = Math.max(1, Math.min(opts.size, MAX_PARSE_POOL_SIZE));
95
+ this.recycleInterval = opts.recycleInterval ?? DEFAULT_RECYCLE_INTERVAL;
96
+ this.parseTimeoutMs = opts.parseTimeoutMs ?? DEFAULT_PARSE_TIMEOUT_MS;
97
+ this.log = opts.log ?? (() => { });
98
+ if (opts.createWorker) {
99
+ this.createWorker = opts.createWorker;
100
+ }
101
+ else if (opts.workerScriptPath) {
102
+ const scriptPath = opts.workerScriptPath;
103
+ this.createWorker = () => new worker_threads_1.Worker(scriptPath);
104
+ }
105
+ else {
106
+ throw new Error('ParseWorkerPool requires workerScriptPath or createWorker');
107
+ }
108
+ this.spawnOne(); // one eager warm worker, ready for the first parse
109
+ }
110
+ /** Pool size cap (for logging). */
111
+ get size() { return this.maxSize; }
112
+ /** Live worker count (for tests). */
113
+ get liveWorkers() { return this.workers.size; }
114
+ /** False once the crash budget is exhausted (or after destroy). */
115
+ get healthy() {
116
+ return !this.destroyed && this.totalCrashes < CRASH_BUDGET;
117
+ }
118
+ /**
119
+ * Parse one file on the pool. Resolves with the extraction result, or REJECTS
120
+ * if the parse times out or its worker crashes — the caller records the error
121
+ * and (for worker-exit/OOM rejections) re-attempts in its retry pass.
122
+ */
123
+ requestParse(task) {
124
+ if (this.destroyed)
125
+ return Promise.reject(new Error('Parse pool destroyed'));
126
+ return new Promise((resolve, reject) => {
127
+ this.queue.push({ id: this.nextId++, task, resolve, reject, settled: false });
128
+ this.drain();
129
+ });
130
+ }
131
+ spawnOne() {
132
+ if (this.destroyed || this.workers.size >= this.maxSize || !this.healthy)
133
+ return;
134
+ let w;
135
+ try {
136
+ w = this.createWorker();
137
+ }
138
+ catch {
139
+ this.totalCrashes++; // counts toward the circuit breaker
140
+ return;
141
+ }
142
+ this.workers.add(w);
143
+ this.pending.add(w);
144
+ this.parseCounts.set(w, 0);
145
+ w.on('message', (m) => this.onMessage(w, (m ?? {})));
146
+ w.on('error', (e) => this.onWorkerGone(w, `Worker error: ${e?.message ?? 'unknown'}`));
147
+ w.on('exit', (code) => { if (code !== 0)
148
+ this.onWorkerGone(w, `Worker exited with code ${code}`); });
149
+ // Load grammars; the worker replies 'grammars-loaded' and only then is idle.
150
+ w.postMessage({ type: 'load-grammars', languages: this.languages });
151
+ }
152
+ onMessage(w, m) {
153
+ if (m.type === 'grammars-loaded') {
154
+ if (!this.workers.has(w))
155
+ return; // recycled/destroyed before ready
156
+ this.pending.delete(w);
157
+ this.idle.push(w);
158
+ this.drain();
159
+ return;
160
+ }
161
+ if (m.type === 'parse-result') {
162
+ const job = this.inflight.get(w);
163
+ if (!job || (m.id !== undefined && m.id !== job.id))
164
+ return; // stale (post-recycle)
165
+ this.inflight.delete(w);
166
+ // Recycle the worker once it's done enough parses to have grown its WASM
167
+ // heap; otherwise return it to the idle set for the next job.
168
+ if ((this.parseCounts.get(w) ?? 0) >= this.recycleInterval) {
169
+ this.recycle(w);
170
+ }
171
+ else {
172
+ this.idle.push(w);
173
+ }
174
+ this.settle(job, m.result);
175
+ this.drain();
176
+ }
177
+ }
178
+ /** A worker died (crash hook / OOM exit / spawn error). Reject its in-flight
179
+ * parse so the caller's retry pass can re-attempt it, then respawn. */
180
+ onWorkerGone(w, message) {
181
+ if (!this.workers.has(w))
182
+ return; // already handled (error+exit both fire), or recycled
183
+ this.removeWorker(w);
184
+ this.totalCrashes++;
185
+ const job = this.inflight.get(w);
186
+ this.inflight.delete(w);
187
+ try {
188
+ void w.terminate();
189
+ }
190
+ catch { /* already gone */ }
191
+ if (job)
192
+ this.settle(job, undefined, new Error(message));
193
+ if (this.healthy)
194
+ this.spawnOne(); // keep capacity
195
+ this.drain();
196
+ }
197
+ /** Tear down a worker that has hit its recycle threshold and replace it. Not a
198
+ * crash, so it doesn't count against the budget. */
199
+ recycle(w) {
200
+ this.log(`Recycling worker after ${this.parseCounts.get(w)} parses (heap: ${Math.round(process.memoryUsage().rss / 1024 / 1024)}MB RSS)`);
201
+ this.removeWorker(w);
202
+ // Fire-and-forget: worker.terminate() can hang if WASM is wedged.
203
+ try {
204
+ void w.terminate();
205
+ }
206
+ catch { /* already gone */ }
207
+ if (this.healthy && !this.destroyed)
208
+ this.spawnOne();
209
+ }
210
+ removeWorker(w) {
211
+ this.workers.delete(w);
212
+ this.pending.delete(w);
213
+ this.parseCounts.delete(w);
214
+ this.idle = this.idle.filter((x) => x !== w);
215
+ }
216
+ dispatch(w, job) {
217
+ this.inflight.set(w, job);
218
+ this.parseCounts.set(w, (this.parseCounts.get(w) ?? 0) + 1);
219
+ // Scale the timeout for large files: base + 10s per 100KB (matches the
220
+ // original single-worker formula so pathological-file behaviour is unchanged).
221
+ const timeoutMs = this.parseTimeoutMs + Math.floor(job.task.content.length / 100_000) * 10_000;
222
+ job.timer = setTimeout(() => this.onTimeout(w, job, timeoutMs), timeoutMs);
223
+ job.timer.unref?.();
224
+ w.postMessage({
225
+ type: 'parse',
226
+ id: job.id,
227
+ filePath: job.task.filePath,
228
+ content: job.task.content,
229
+ frameworkNames: job.task.frameworkNames,
230
+ language: job.task.language,
231
+ });
232
+ }
233
+ onTimeout(w, job, ms) {
234
+ if (job.settled || !this.workers.has(w))
235
+ return;
236
+ this.log(`TIMEOUT: ${job.task.filePath} exceeded ${ms}ms — killing worker`);
237
+ // Kill the (possibly WASM-wedged) worker and reject this parse. A timeout
238
+ // isn't a crash — don't charge the budget — but the worker is gone, so spawn
239
+ // a replacement to keep capacity.
240
+ this.removeWorker(w);
241
+ this.inflight.delete(w);
242
+ try {
243
+ void w.terminate();
244
+ }
245
+ catch { /* already gone */ }
246
+ this.settle(job, undefined, new Error(`Parse timed out after ${ms}ms`));
247
+ if (this.healthy)
248
+ this.spawnOne();
249
+ this.drain();
250
+ }
251
+ drain() {
252
+ // Grow toward maxSize while queued work outstrips workers that are idle OR
253
+ // already on their way up — throttled so we never cold-start the whole pool
254
+ // at once.
255
+ while (this.queue.length > this.idle.length + this.pending.size &&
256
+ this.workers.size < this.maxSize &&
257
+ this.pending.size < MAX_CONCURRENT_SPAWN &&
258
+ !this.destroyed &&
259
+ this.healthy) {
260
+ this.spawnOne();
261
+ }
262
+ // Dispatch queued jobs to idle workers.
263
+ while (this.idle.length && this.queue.length) {
264
+ let job;
265
+ while (this.queue.length && (job = this.queue.shift()) && job.settled)
266
+ job = undefined;
267
+ if (!job || job.settled)
268
+ break;
269
+ const w = this.idle.pop();
270
+ this.dispatch(w, job);
271
+ }
272
+ // Hang-prevention: if there's queued work but nothing can ever run it (no
273
+ // idle workers, none spawning, none alive), fail it instead of hanging
274
+ // forever. Reached only when the crash budget is exhausted or after destroy.
275
+ if (this.queue.length && this.idle.length === 0 && this.pending.size === 0 && this.workers.size === 0) {
276
+ const reason = this.destroyed ? 'parse pool destroyed' : 'parse pool exhausted its worker crash budget';
277
+ for (const job of this.queue.splice(0))
278
+ this.settle(job, undefined, new Error(reason));
279
+ }
280
+ }
281
+ settle(job, result, err) {
282
+ if (job.settled)
283
+ return;
284
+ job.settled = true;
285
+ if (job.timer)
286
+ clearTimeout(job.timer);
287
+ if (err)
288
+ job.reject(err);
289
+ else
290
+ job.resolve(result);
291
+ }
292
+ /**
293
+ * Recycle every idle worker now (fresh WASM heaps). The orchestrator calls
294
+ * this before its retry pass so crash-on-memory files get the cleanest heap.
295
+ */
296
+ recycleAll() {
297
+ for (const w of [...this.idle])
298
+ this.recycle(w);
299
+ }
300
+ /** Terminate all workers and reject any outstanding parses. */
301
+ async destroy() {
302
+ if (this.destroyed)
303
+ return;
304
+ this.destroyed = true;
305
+ const ws = [...this.workers];
306
+ this.workers.clear();
307
+ this.pending.clear();
308
+ this.parseCounts.clear();
309
+ this.idle = [];
310
+ for (const job of [...this.inflight.values(), ...this.queue]) {
311
+ this.settle(job, undefined, new Error('parse pool destroyed'));
312
+ }
313
+ this.inflight.clear();
314
+ this.queue = [];
315
+ await Promise.all(ws.map((w) => Promise.resolve(w.terminate()).catch(() => { })));
316
+ }
317
+ }
318
+ exports.ParseWorkerPool = ParseWorkerPool;
319
+ //# sourceMappingURL=parse-pool.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parse-pool.js","sourceRoot":"","sources":["../../src/extraction/parse-pool.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;;;AA2DH,oDASC;AAlED,mDAAwC;AA0BxC,wEAAwE;AACxE,MAAM,sBAAsB,GAAG,CAAC,CAAC;AACjC,wEAAwE;AACxE,MAAM,mBAAmB,GAAG,EAAE,CAAC;AAC/B,0EAA0E;AAC1E,MAAM,wBAAwB,GAAG,GAAG,CAAC;AACrC,iFAAiF;AACjF,MAAM,wBAAwB,GAAG,MAAM,CAAC;AACxC;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,MAAM,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,EAAE,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,GAAsB,CAAC,CAAC,CAAC,CAAC,CAAC;IACvG,CAAC;CACF;AArOD,0CAqOC"}
@@ -438,6 +438,27 @@ export declare class TreeSitterExtractor {
438
438
  * arguments (`new Foo(bar())`) get their own `calls` references.
439
439
  */
440
440
  private extractInstantiation;
441
+ /**
442
+ * Is this C++ `declaration` a stack/direct-initialization object construction
443
+ * that invokes a constructor — `Calculator calc(0)` (direct-init) or
444
+ * `Widget w{1, 2}` (brace-init) — as opposed to a plain variable or a
445
+ * function declaration? Used to emit an `instantiates` edge for the
446
+ * call-less construction syntax (#1035); heap `new T(...)` is handled
447
+ * separately by INSTANTIATION_KINDS.
448
+ *
449
+ * Two signals, both required:
450
+ * - the `type` field is a class-like NAMED type (`type_identifier`,
451
+ * `template_type`, or `qualified_identifier`). Primitives (`int x(0)`),
452
+ * `auto` (`placeholder_type_specifier` — that form always carries a real
453
+ * `call_expression`, already handled), and sized specifiers are excluded —
454
+ * they construct no class; and
455
+ * - a declarator carries constructor arguments: an `init_declarator` whose
456
+ * `value` is an `argument_list` (`(args)`) or `initializer_list` (`{args}`).
457
+ * This skips default construction `Calculator c;` (no value) and the
458
+ * most-vexing-parse `Calculator c();` (a bodyless `function_declarator`,
459
+ * a function decl — not a construction).
460
+ */
461
+ private isCppStackConstruction;
441
462
  /**
442
463
  * Static-member / value-read pass. A type/enum/class used only via a member
443
464
  * VALUE — `Enum.value`, `Type.CONST`, `Colors.red`, `Foo::BAR` — recorded no
@@ -1 +1 @@
1
- {"version":3,"file":"tree-sitter.d.ts","sourceRoot":"","sources":["../../src/extraction/tree-sitter.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,OAAO,EACL,QAAQ,EAIR,gBAAgB,EAGjB,MA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AAQ,EAAE,MAAM,EAChB,MAAM,EAAE,MAAM,EACd,QAAQ,CAAC,EAAE,QAAQ,EACnB,cAAc,CAAC,EAAE,MAAM,EAAE,GACxB,gBAAgB,CA2ElB"}
@@ -46,6 +46,7 @@ const tree_sitter_helpers_1 = require("./tree-sitter-helpers");
46
46
  const function_ref_1 = require("./function-ref");
47
47
  const generated_detection_1 = require("./generated-detection");
48
48
  const languages_1 = require("./languages");
49
+ const c_cpp_1 = require("./languages/c-cpp");
49
50
  const liquid_extractor_1 = require("./liquid-extractor");
50
51
  const razor_extractor_1 = require("./razor-extractor");
51
52
  const svelte_extractor_1 = require("./svelte-extractor");
@@ -979,29 +980,44 @@ class TreeSitterExtractor {
979
980
  this.scanFnRefSubtree(node, 0);
980
981
  skipChildren = true; // extractVariable handles children
981
982
  }
982
- // Swift stored properties inside a type. Swift instance properties aren't
983
- // extracted as their own nodes, but a property's PROPERTY WRAPPER
984
- // (`@Argument`/`@Published`/`@State`/custom) and declared type ARE
985
- // dependencies attribute them to the enclosing type so the wrapper/type
986
- // files get dependents. Don't skipChildren: an initializer's calls still
987
- // matter. (Other languages extract properties via property/field types.)
983
+ // Swift properties inside a type. A stored instance property becomes a `field`
984
+ // node; a `static let`/`static var` member becomes `constant`/`variable`
985
+ // (Swift's `static`-namespacing idiom value-reference edges can then target
986
+ // it); a COMPUTED property (getter block, no stored value) becomes a `property`
987
+ // node whose getter is walked below so its calls attribute to it. A property's
988
+ // PROPERTY WRAPPER (`@Argument`/`@Published`/`@State`/custom) and declared type
989
+ // are dependencies attributed to the enclosing type. (Other languages extract
990
+ // properties via property/field types.)
988
991
  else if (this.language === 'swift' &&
989
- nodeType === 'property_declaration' &&
992
+ (nodeType === 'property_declaration' || nodeType === 'protocol_property_declaration') &&
990
993
  this.isInsideClassLikeNode()) {
991
994
  const ownerId = this.nodeStack[this.nodeStack.length - 1];
992
- // A `static let`/`static var` member is a SHARED constant of the type
993
- // (Swift's `static`-namespacing idiom, esp. in `enum`/`struct`) — extract
994
- // it as `constant`/`variable` so value-reference edges can target it. An
995
- // instance stored property stays a `field` (per-instance; Swift instance
996
- // properties otherwise aren't own nodes — that's unchanged). A *computed*
997
- // property (getter, no stored value) is never a constant — skip the node.
998
995
  const { nameNode, isLet, isComputed } = swiftPropertyInfo(node, this.source);
999
- if (nameNode && !isComputed) {
1000
- const isStatic = this.extractor.isStatic?.(node) ?? false;
1001
- this.createNode(isStatic ? (isLet ? 'constant' : 'variable') : 'field', (0, tree_sitter_helpers_1.getNodeText)(nameNode, this.source), node, {
1002
- visibility: this.extractor.getVisibility?.(node),
1003
- isStatic,
1004
- });
996
+ let computedPropId;
997
+ if (nameNode) {
998
+ if (isComputed) {
999
+ // Computed property — accessed like a property but its getter holds real
1000
+ // logic. Index as `property` so search/explore find it (#1020: computed
1001
+ // props such as a heavily-read `var isCloudProxy: Bool` returned "No
1002
+ // results found"); pushed below so the getter's calls attribute to it
1003
+ // rather than flattening onto the owning type (SwiftUI `var body: some
1004
+ // View { … }` — the whole subview tree — is the canonical case).
1005
+ const prop = this.createNode('property', (0, tree_sitter_helpers_1.getNodeText)(nameNode, this.source), node, {
1006
+ visibility: this.extractor.getVisibility?.(node),
1007
+ isStatic: this.extractor.isStatic?.(node) ?? false,
1008
+ });
1009
+ computedPropId = prop?.id;
1010
+ }
1011
+ else {
1012
+ // A `static let`/`static var` member is a SHARED constant of the type
1013
+ // (esp. in `enum`/`struct`); an instance stored property stays a `field`
1014
+ // (per-instance — Swift instance properties otherwise aren't own nodes).
1015
+ const isStatic = this.extractor.isStatic?.(node) ?? false;
1016
+ this.createNode(isStatic ? (isLet ? 'constant' : 'variable') : 'field', (0, tree_sitter_helpers_1.getNodeText)(nameNode, this.source), node, {
1017
+ visibility: this.extractor.getVisibility?.(node),
1018
+ isStatic,
1019
+ });
1020
+ }
1005
1021
  }
1006
1022
  if (ownerId) {
1007
1023
  this.extractDecoratorsFor(node, ownerId);
@@ -1027,6 +1043,20 @@ class TreeSitterExtractor {
1027
1043
  walkAttrArgs(modifiers);
1028
1044
  }
1029
1045
  }
1046
+ // A computed property's getter holds real logic — walk it with the property
1047
+ // node pushed so its calls/instantiations attribute to the property (a
1048
+ // SwiftUI `body`'s subview tree becomes the property's callees). skipChildren
1049
+ // then stops the generic walker from re-walking the getter (and the
1050
+ // modifiers/type annotation already handled above).
1051
+ if (computedPropId) {
1052
+ const getter = node.namedChildren.find((c) => c.type === 'computed_property' || c.type === 'protocol_property_requirements');
1053
+ if (getter) {
1054
+ this.nodeStack.push(computedPropId);
1055
+ this.visitFunctionBody(getter, '');
1056
+ this.nodeStack.pop();
1057
+ }
1058
+ skipChildren = true;
1059
+ }
1030
1060
  }
1031
1061
  // `export_statement` itself is not extracted — the walker descends
1032
1062
  // into children, where the inner declaration (lexical_declaration,
@@ -3821,6 +3851,45 @@ class TreeSitterExtractor {
3821
3851
  });
3822
3852
  }
3823
3853
  }
3854
+ /**
3855
+ * Is this C++ `declaration` a stack/direct-initialization object construction
3856
+ * that invokes a constructor — `Calculator calc(0)` (direct-init) or
3857
+ * `Widget w{1, 2}` (brace-init) — as opposed to a plain variable or a
3858
+ * function declaration? Used to emit an `instantiates` edge for the
3859
+ * call-less construction syntax (#1035); heap `new T(...)` is handled
3860
+ * separately by INSTANTIATION_KINDS.
3861
+ *
3862
+ * Two signals, both required:
3863
+ * - the `type` field is a class-like NAMED type (`type_identifier`,
3864
+ * `template_type`, or `qualified_identifier`). Primitives (`int x(0)`),
3865
+ * `auto` (`placeholder_type_specifier` — that form always carries a real
3866
+ * `call_expression`, already handled), and sized specifiers are excluded —
3867
+ * they construct no class; and
3868
+ * - a declarator carries constructor arguments: an `init_declarator` whose
3869
+ * `value` is an `argument_list` (`(args)`) or `initializer_list` (`{args}`).
3870
+ * This skips default construction `Calculator c;` (no value) and the
3871
+ * most-vexing-parse `Calculator c();` (a bodyless `function_declarator`,
3872
+ * a function decl — not a construction).
3873
+ */
3874
+ isCppStackConstruction(node) {
3875
+ const typeNode = (0, tree_sitter_helpers_1.getChildByField)(node, 'type');
3876
+ if (!typeNode ||
3877
+ (typeNode.type !== 'type_identifier' &&
3878
+ typeNode.type !== 'template_type' &&
3879
+ typeNode.type !== 'qualified_identifier')) {
3880
+ return false;
3881
+ }
3882
+ for (let i = 0; i < node.namedChildCount; i++) {
3883
+ const child = node.namedChild(i);
3884
+ if (child?.type !== 'init_declarator')
3885
+ continue;
3886
+ const value = (0, tree_sitter_helpers_1.getChildByField)(child, 'value');
3887
+ if (value && (value.type === 'argument_list' || value.type === 'initializer_list')) {
3888
+ return true;
3889
+ }
3890
+ }
3891
+ return false;
3892
+ }
3824
3893
  /**
3825
3894
  * Static-member / value-read pass. A type/enum/class used only via a member
3826
3895
  * VALUE — `Enum.value`, `Type.CONST`, `Colors.red`, `Foo::BAR` — recorded no
@@ -4201,6 +4270,18 @@ class TreeSitterExtractor {
4201
4270
  }
4202
4271
  }
4203
4272
  }
4273
+ // C++ stack / direct-initialization construction — `Calculator calc(0)`
4274
+ // and `Widget w{1, 2}`. Unlike heap `new Calculator(0)` (a new_expression
4275
+ // handled above), these carry the constructor arguments directly on the
4276
+ // declarator with NO call/new node, so the body walker saw no constructor
4277
+ // invocation and recorded no `instantiates` edge (#1035). A declaration's
4278
+ // `type` field IS the constructed class name, so reuse extractInstantiation
4279
+ // (which strips template args / namespace and emits the `instantiates`
4280
+ // ref). Children still recurse below, so a nested ctor-arg call
4281
+ // (`Calculator calc(make())`) keeps its own `calls` ref.
4282
+ if (nodeType === 'declaration' && this.language === 'cpp' && this.isCppStackConstruction(node)) {
4283
+ this.extractInstantiation(node);
4284
+ }
4204
4285
  // Static-member / value-read: `Enum.value`, `Type.CONST`, `Foo::BAR`.
4205
4286
  this.extractStaticMemberRef(node);
4206
4287
  // Local variable type annotations inside a body — `const items: Foo[] = []`,
@@ -4395,7 +4476,11 @@ class TreeSitterExtractor {
4395
4476
  }
4396
4477
  // C++ base classes: `class Derived : public Base, private Other` →
4397
4478
  // base_class_clause holds access specifiers + base type(s). Emit an extends
4398
- // ref per base type (skip the public/private/protected keywords).
4479
+ // ref per base type (skip the public/private/protected keywords). A
4480
+ // templated base (`Base<int>`, `ns::Tpl<int>`) arrives as a `template_type`
4481
+ // or a `qualified_identifier` wrapping one; strip the `<…>` args so the ref
4482
+ // matches the bare class the template was defined as — `Base`, `ns::Tpl` —
4483
+ // instead of never resolving (#1043).
4399
4484
  if (child.type === 'base_class_clause') {
4400
4485
  for (const t of child.namedChildren) {
4401
4486
  if (t.type === 'type_identifier' ||
@@ -4403,7 +4488,7 @@ class TreeSitterExtractor {
4403
4488
  t.type === 'template_type') {
4404
4489
  this.unresolvedReferences.push({
4405
4490
  fromNodeId: classId,
4406
- referenceName: (0, tree_sitter_helpers_1.getNodeText)(t, this.source),
4491
+ referenceName: (0, c_cpp_1.stripCppTemplateArgs)((0, tree_sitter_helpers_1.getNodeText)(t, this.source)),
4407
4492
  referenceKind: 'extends',
4408
4493
  line: t.startPosition.row + 1,
4409
4494
  column: t.startPosition.column,