@colbymchenry/codegraph-darwin-x64 1.1.0 → 1.1.2
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.
- package/lib/dist/bin/codegraph.js +79 -52
- package/lib/dist/bin/codegraph.js.map +1 -1
- package/lib/dist/bin/command-supervision.d.ts +12 -0
- package/lib/dist/bin/command-supervision.d.ts.map +1 -0
- package/lib/dist/bin/command-supervision.js +76 -0
- package/lib/dist/bin/command-supervision.js.map +1 -0
- package/lib/dist/db/queries.d.ts.map +1 -1
- package/lib/dist/db/queries.js +10 -2
- package/lib/dist/db/queries.js.map +1 -1
- package/lib/dist/directory.d.ts +32 -0
- package/lib/dist/directory.d.ts.map +1 -1
- package/lib/dist/directory.js +83 -0
- package/lib/dist/directory.js.map +1 -1
- package/lib/dist/extraction/index.d.ts +19 -4
- package/lib/dist/extraction/index.d.ts.map +1 -1
- package/lib/dist/extraction/index.js +287 -241
- package/lib/dist/extraction/index.js.map +1 -1
- package/lib/dist/extraction/parse-pool.d.ts +126 -0
- package/lib/dist/extraction/parse-pool.d.ts.map +1 -0
- package/lib/dist/extraction/parse-pool.js +319 -0
- package/lib/dist/extraction/parse-pool.js.map +1 -0
- package/lib/dist/extraction/tree-sitter.d.ts.map +1 -1
- package/lib/dist/extraction/tree-sitter.js +48 -19
- package/lib/dist/extraction/tree-sitter.js.map +1 -1
- package/lib/dist/mcp/daemon-paths.d.ts +30 -3
- package/lib/dist/mcp/daemon-paths.d.ts.map +1 -1
- package/lib/dist/mcp/daemon-paths.js +50 -10
- package/lib/dist/mcp/daemon-paths.js.map +1 -1
- package/lib/dist/mcp/daemon-registry.d.ts.map +1 -1
- package/lib/dist/mcp/daemon-registry.js +7 -3
- package/lib/dist/mcp/daemon-registry.js.map +1 -1
- package/lib/dist/mcp/daemon.d.ts +38 -0
- package/lib/dist/mcp/daemon.d.ts.map +1 -1
- package/lib/dist/mcp/daemon.js +168 -19
- package/lib/dist/mcp/daemon.js.map +1 -1
- package/lib/dist/mcp/engine.d.ts +17 -0
- package/lib/dist/mcp/engine.d.ts.map +1 -1
- package/lib/dist/mcp/engine.js +73 -1
- package/lib/dist/mcp/engine.js.map +1 -1
- package/lib/dist/mcp/index.d.ts.map +1 -1
- package/lib/dist/mcp/index.js +25 -43
- package/lib/dist/mcp/index.js.map +1 -1
- package/lib/dist/mcp/ppid-watchdog.d.ts +18 -0
- package/lib/dist/mcp/ppid-watchdog.d.ts.map +1 -1
- package/lib/dist/mcp/ppid-watchdog.js +37 -0
- package/lib/dist/mcp/ppid-watchdog.js.map +1 -1
- package/lib/dist/mcp/proxy.d.ts.map +1 -1
- package/lib/dist/mcp/proxy.js +14 -1
- package/lib/dist/mcp/proxy.js.map +1 -1
- package/lib/dist/mcp/query-pool.d.ts +94 -0
- package/lib/dist/mcp/query-pool.d.ts.map +1 -0
- package/lib/dist/mcp/query-pool.js +297 -0
- package/lib/dist/mcp/query-pool.js.map +1 -0
- package/lib/dist/mcp/query-worker.d.ts +24 -0
- package/lib/dist/mcp/query-worker.d.ts.map +1 -0
- package/lib/dist/mcp/query-worker.js +87 -0
- package/lib/dist/mcp/query-worker.js.map +1 -0
- package/lib/dist/mcp/tools.d.ts +57 -0
- package/lib/dist/mcp/tools.d.ts.map +1 -1
- package/lib/dist/mcp/tools.js +147 -37
- package/lib/dist/mcp/tools.js.map +1 -1
- package/lib/dist/project-config.d.ts +37 -0
- package/lib/dist/project-config.d.ts.map +1 -1
- package/lib/dist/project-config.js +127 -32
- package/lib/dist/project-config.js.map +1 -1
- package/lib/dist/resolution/c-fnptr-synthesizer.d.ts +0 -28
- package/lib/dist/resolution/c-fnptr-synthesizer.d.ts.map +1 -1
- package/lib/dist/resolution/c-fnptr-synthesizer.js +765 -79
- package/lib/dist/resolution/c-fnptr-synthesizer.js.map +1 -1
- package/lib/dist/resolution/name-matcher.d.ts.map +1 -1
- package/lib/dist/resolution/name-matcher.js +44 -0
- package/lib/dist/resolution/name-matcher.js.map +1 -1
- package/lib/node_modules/.package-lock.json +1 -1
- package/lib/package.json +1 -1
- package/package.json +1 -1
|
@@ -4,6 +4,25 @@ export declare const PROJECT_CONFIG_FILENAME = "codegraph.json";
|
|
|
4
4
|
export interface ProjectConfig {
|
|
5
5
|
/** Map of custom file extension (`.foo`) to a supported language id. */
|
|
6
6
|
extensions?: Record<string, string>;
|
|
7
|
+
/**
|
|
8
|
+
* Gitignore-style patterns naming gitignored directories whose embedded git
|
|
9
|
+
* repositories should be indexed anyway — the explicit opt-in to override
|
|
10
|
+
* `.gitignore` for nested-repo discovery (#622, #699). Absent/empty (the
|
|
11
|
+
* default) means `.gitignore` is fully respected: gitignored embedded repos
|
|
12
|
+
* are never discovered or indexed (#970, #976).
|
|
13
|
+
*/
|
|
14
|
+
includeIgnored?: string[];
|
|
15
|
+
/**
|
|
16
|
+
* Gitignore-style patterns for paths to keep OUT of the index — even when
|
|
17
|
+
* they are git-TRACKED, which `.gitignore` cannot do (#999). The escape hatch
|
|
18
|
+
* for a committed vendor/theme/SDK directory (e.g. a checked-in Metronic theme
|
|
19
|
+
* under `static/`) that bloats the graph and slows indexing but isn't really
|
|
20
|
+
* your code. Matched against project-root-relative paths, so a directory like
|
|
21
|
+
* `"static/"`, a double-star vendor glob, or `"assets/theme"` all work.
|
|
22
|
+
* Absent/empty (the default) excludes nothing beyond the built-in defaults
|
|
23
|
+
* and your `.gitignore`.
|
|
24
|
+
*/
|
|
25
|
+
exclude?: string[];
|
|
7
26
|
}
|
|
8
27
|
/**
|
|
9
28
|
* Load the validated extension overrides for a project, mtime-cached.
|
|
@@ -14,6 +33,24 @@ export interface ProjectConfig {
|
|
|
14
33
|
* map when there is no `codegraph.json` (the zero-config default).
|
|
15
34
|
*/
|
|
16
35
|
export declare function loadExtensionOverrides(rootDir: string): Record<string, Language>;
|
|
36
|
+
/**
|
|
37
|
+
* Load the validated `includeIgnored` patterns for a project, mtime-cached.
|
|
38
|
+
*
|
|
39
|
+
* These name gitignored directories whose embedded git repositories should be
|
|
40
|
+
* indexed despite `.gitignore` (#622, #699). An empty result — the zero-config
|
|
41
|
+
* default — means `.gitignore` is fully respected: gitignored embedded repos
|
|
42
|
+
* are never discovered or indexed (#970, #976).
|
|
43
|
+
*/
|
|
44
|
+
export declare function loadIncludeIgnoredPatterns(rootDir: string): string[];
|
|
45
|
+
/**
|
|
46
|
+
* Load the validated `exclude` patterns for a project, mtime-cached.
|
|
47
|
+
*
|
|
48
|
+
* These name paths to keep OUT of the index even when git-tracked — the escape
|
|
49
|
+
* hatch for a committed vendor/theme/SDK directory `.gitignore` can't drop
|
|
50
|
+
* (#999). An empty result — the zero-config default — excludes nothing beyond
|
|
51
|
+
* the built-in defaults and the project's `.gitignore`.
|
|
52
|
+
*/
|
|
53
|
+
export declare function loadExcludePatterns(rootDir: string): string[];
|
|
17
54
|
/** Test/maintenance hook: forget cached config (e.g. after rewriting it in a test). */
|
|
18
55
|
export declare function clearProjectConfigCache(): void;
|
|
19
56
|
//# sourceMappingURL=project-config.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"project-config.d.ts","sourceRoot":"","sources":["../src/project-config.ts"],"names":[],"mappings":"AA0BA,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAInC,oFAAoF;AACpF,eAAO,MAAM,uBAAuB,mBAAmB,CAAC;AAExD,MAAM,WAAW,aAAa;IAC5B,wEAAwE;IACxE,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"project-config.d.ts","sourceRoot":"","sources":["../src/project-config.ts"],"names":[],"mappings":"AA0BA,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAInC,oFAAoF;AACpF,eAAO,MAAM,uBAAuB,mBAAmB,CAAC;AAExD,MAAM,WAAW,aAAa;IAC5B,wEAAwE;IACxE,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACpC;;;;;;OAMG;IACH,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;IAC1B;;;;;;;;;OASG;IACH,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;CACpB;AA0LD;;;;;;;GAOG;AACH,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,CAEhF;AAED;;;;;;;GAOG;AACH,wBAAgB,0BAA0B,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,EAAE,CAEpE;AAED;;;;;;;GAOG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,EAAE,CAE7D;AAED,uFAAuF;AACvF,wBAAgB,uBAAuB,IAAI,IAAI,CAE9C"}
|
|
@@ -35,6 +35,8 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
36
|
exports.PROJECT_CONFIG_FILENAME = void 0;
|
|
37
37
|
exports.loadExtensionOverrides = loadExtensionOverrides;
|
|
38
|
+
exports.loadIncludeIgnoredPatterns = loadIncludeIgnoredPatterns;
|
|
39
|
+
exports.loadExcludePatterns = loadExcludePatterns;
|
|
38
40
|
exports.clearProjectConfigCache = clearProjectConfigCache;
|
|
39
41
|
/**
|
|
40
42
|
* Project-scoped configuration: a committed `codegraph.json` at the project
|
|
@@ -72,10 +74,14 @@ exports.PROJECT_CONFIG_FILENAME = 'codegraph.json';
|
|
|
72
74
|
* `stat` while a single `codegraph.json` is in force. Keying by root keeps two
|
|
73
75
|
* projects in the same process (the daemon / multi-project MCP server) isolated.
|
|
74
76
|
*/
|
|
75
|
-
const
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
const
|
|
77
|
+
const cache = new Map();
|
|
78
|
+
/** Shared frozen empties so the no-config path allocates nothing. */
|
|
79
|
+
const EMPTY_EXTENSIONS = Object.freeze({});
|
|
80
|
+
const EMPTY_CONFIG = Object.freeze({
|
|
81
|
+
extensions: EMPTY_EXTENSIONS,
|
|
82
|
+
includeIgnored: Object.freeze([]),
|
|
83
|
+
exclude: Object.freeze([]),
|
|
84
|
+
});
|
|
79
85
|
/**
|
|
80
86
|
* Normalize a user-provided extension key to the `.ext` lowercase form used by
|
|
81
87
|
* the built-in map. Returns null for keys that can never match a real file
|
|
@@ -101,17 +107,17 @@ function normalizeExtKey(raw) {
|
|
|
101
107
|
return ext;
|
|
102
108
|
}
|
|
103
109
|
/**
|
|
104
|
-
*
|
|
105
|
-
* Every failure mode degrades to
|
|
106
|
-
* a typo'd
|
|
110
|
+
* Read + JSON-parse a `codegraph.json` once and return its validated view.
|
|
111
|
+
* Every failure mode degrades to the zero-config default — a missing file, bad
|
|
112
|
+
* JSON, or a typo'd value never throws.
|
|
107
113
|
*/
|
|
108
|
-
function
|
|
114
|
+
function parseConfig(file) {
|
|
109
115
|
let raw;
|
|
110
116
|
try {
|
|
111
117
|
raw = fs.readFileSync(file, 'utf-8');
|
|
112
118
|
}
|
|
113
119
|
catch {
|
|
114
|
-
return
|
|
120
|
+
return EMPTY_CONFIG;
|
|
115
121
|
}
|
|
116
122
|
let parsed;
|
|
117
123
|
try {
|
|
@@ -122,13 +128,26 @@ function parseExtensionOverrides(file) {
|
|
|
122
128
|
file,
|
|
123
129
|
error: err instanceof Error ? err.message : String(err),
|
|
124
130
|
});
|
|
125
|
-
return
|
|
131
|
+
return EMPTY_CONFIG;
|
|
126
132
|
}
|
|
127
133
|
if (!parsed || typeof parsed !== 'object')
|
|
128
|
-
return
|
|
134
|
+
return EMPTY_CONFIG;
|
|
135
|
+
const extensions = extractExtensions(parsed, file);
|
|
136
|
+
const includeIgnored = extractIncludeIgnored(parsed, file);
|
|
137
|
+
const exclude = extractExclude(parsed, file);
|
|
138
|
+
if (extensions === EMPTY_EXTENSIONS && includeIgnored.length === 0 && exclude.length === 0) {
|
|
139
|
+
return EMPTY_CONFIG;
|
|
140
|
+
}
|
|
141
|
+
return { extensions, includeIgnored, exclude };
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* Validate the `extensions` map. Every failure mode degrades to "no overrides
|
|
145
|
+
* from this entry" — a bad value or a typo'd language never throws.
|
|
146
|
+
*/
|
|
147
|
+
function extractExtensions(parsed, file) {
|
|
129
148
|
const exts = parsed.extensions;
|
|
130
149
|
if (!exts || typeof exts !== 'object' || Array.isArray(exts))
|
|
131
|
-
return
|
|
150
|
+
return EMPTY_EXTENSIONS;
|
|
132
151
|
const out = {};
|
|
133
152
|
for (const [rawKey, rawVal] of Object.entries(exts)) {
|
|
134
153
|
const key = normalizeExtKey(rawKey);
|
|
@@ -142,17 +161,63 @@ function parseExtensionOverrides(file) {
|
|
|
142
161
|
}
|
|
143
162
|
out[key] = rawVal;
|
|
144
163
|
}
|
|
145
|
-
return Object.keys(out).length > 0 ? out :
|
|
164
|
+
return Object.keys(out).length > 0 ? out : EMPTY_EXTENSIONS;
|
|
146
165
|
}
|
|
147
166
|
/**
|
|
148
|
-
*
|
|
149
|
-
*
|
|
150
|
-
*
|
|
151
|
-
*
|
|
152
|
-
* `isSourceFile`), with these user mappings taking precedence. Returns an empty
|
|
153
|
-
* map when there is no `codegraph.json` (the zero-config default).
|
|
167
|
+
* Validate the `includeIgnored` patterns: an array of non-empty gitignore-style
|
|
168
|
+
* strings. A non-array value or a non-string/blank entry warns-and-skips; never
|
|
169
|
+
* throws. Patterns are kept verbatim (trimmed) so they match exactly as a
|
|
170
|
+
* `.gitignore` line would.
|
|
154
171
|
*/
|
|
155
|
-
function
|
|
172
|
+
function extractIncludeIgnored(parsed, file) {
|
|
173
|
+
const raw = parsed.includeIgnored;
|
|
174
|
+
if (raw === undefined)
|
|
175
|
+
return [];
|
|
176
|
+
if (!Array.isArray(raw)) {
|
|
177
|
+
(0, errors_1.logWarn)(`Ignoring "includeIgnored" in ${exports.PROJECT_CONFIG_FILENAME}: must be an array of gitignore-style patterns`, { file });
|
|
178
|
+
return [];
|
|
179
|
+
}
|
|
180
|
+
const out = [];
|
|
181
|
+
for (const entry of raw) {
|
|
182
|
+
if (typeof entry !== 'string' || !entry.trim()) {
|
|
183
|
+
(0, errors_1.logWarn)(`Ignoring an "includeIgnored" entry in ${exports.PROJECT_CONFIG_FILENAME}: every pattern must be a non-empty string`, { file });
|
|
184
|
+
continue;
|
|
185
|
+
}
|
|
186
|
+
out.push(entry.trim());
|
|
187
|
+
}
|
|
188
|
+
return out;
|
|
189
|
+
}
|
|
190
|
+
/**
|
|
191
|
+
* Validate the `exclude` patterns: an array of non-empty gitignore-style
|
|
192
|
+
* strings naming paths to keep out of the index even when git-tracked (#999). A
|
|
193
|
+
* non-array value or a non-string/blank entry warns-and-skips; never throws.
|
|
194
|
+
* Patterns are kept verbatim (trimmed) so they match exactly as a `.gitignore`
|
|
195
|
+
* line would, against project-root-relative paths.
|
|
196
|
+
*/
|
|
197
|
+
function extractExclude(parsed, file) {
|
|
198
|
+
const raw = parsed.exclude;
|
|
199
|
+
if (raw === undefined)
|
|
200
|
+
return [];
|
|
201
|
+
if (!Array.isArray(raw)) {
|
|
202
|
+
(0, errors_1.logWarn)(`Ignoring "exclude" in ${exports.PROJECT_CONFIG_FILENAME}: must be an array of gitignore-style patterns`, { file });
|
|
203
|
+
return [];
|
|
204
|
+
}
|
|
205
|
+
const out = [];
|
|
206
|
+
for (const entry of raw) {
|
|
207
|
+
if (typeof entry !== 'string' || !entry.trim()) {
|
|
208
|
+
(0, errors_1.logWarn)(`Ignoring an "exclude" entry in ${exports.PROJECT_CONFIG_FILENAME}: every pattern must be a non-empty string`, { file });
|
|
209
|
+
continue;
|
|
210
|
+
}
|
|
211
|
+
out.push(entry.trim());
|
|
212
|
+
}
|
|
213
|
+
return out;
|
|
214
|
+
}
|
|
215
|
+
/**
|
|
216
|
+
* Load the parsed `codegraph.json` for a project, mtime-cached. A missing or
|
|
217
|
+
* malformed file yields the zero-config default. One `stat` (and at most one
|
|
218
|
+
* read/parse) while a single config file is in force, shared across every field.
|
|
219
|
+
*/
|
|
220
|
+
function loadParsedConfig(rootDir) {
|
|
156
221
|
const file = path.join(rootDir, exports.PROJECT_CONFIG_FILENAME);
|
|
157
222
|
let mtimeMs;
|
|
158
223
|
try {
|
|
@@ -160,21 +225,51 @@ function loadExtensionOverrides(rootDir) {
|
|
|
160
225
|
}
|
|
161
226
|
catch {
|
|
162
227
|
// No config file — drop any stale cache entry and return the default.
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
return EMPTY;
|
|
228
|
+
cache.delete(rootDir);
|
|
229
|
+
return EMPTY_CONFIG;
|
|
166
230
|
}
|
|
167
|
-
const
|
|
168
|
-
if (
|
|
169
|
-
return
|
|
170
|
-
const
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
231
|
+
const entry = cache.get(rootDir);
|
|
232
|
+
if (entry && entry.mtimeMs === mtimeMs)
|
|
233
|
+
return entry.config;
|
|
234
|
+
const config = parseConfig(file);
|
|
235
|
+
cache.set(rootDir, { mtimeMs, config });
|
|
236
|
+
return config;
|
|
237
|
+
}
|
|
238
|
+
/**
|
|
239
|
+
* Load the validated extension overrides for a project, mtime-cached.
|
|
240
|
+
*
|
|
241
|
+
* Returns a map of `.ext` → supported language id. The result merges on top of
|
|
242
|
+
* the built-in extension map at the point of use (see `detectLanguage` /
|
|
243
|
+
* `isSourceFile`), with these user mappings taking precedence. Returns an empty
|
|
244
|
+
* map when there is no `codegraph.json` (the zero-config default).
|
|
245
|
+
*/
|
|
246
|
+
function loadExtensionOverrides(rootDir) {
|
|
247
|
+
return loadParsedConfig(rootDir).extensions;
|
|
248
|
+
}
|
|
249
|
+
/**
|
|
250
|
+
* Load the validated `includeIgnored` patterns for a project, mtime-cached.
|
|
251
|
+
*
|
|
252
|
+
* These name gitignored directories whose embedded git repositories should be
|
|
253
|
+
* indexed despite `.gitignore` (#622, #699). An empty result — the zero-config
|
|
254
|
+
* default — means `.gitignore` is fully respected: gitignored embedded repos
|
|
255
|
+
* are never discovered or indexed (#970, #976).
|
|
256
|
+
*/
|
|
257
|
+
function loadIncludeIgnoredPatterns(rootDir) {
|
|
258
|
+
return loadParsedConfig(rootDir).includeIgnored;
|
|
259
|
+
}
|
|
260
|
+
/**
|
|
261
|
+
* Load the validated `exclude` patterns for a project, mtime-cached.
|
|
262
|
+
*
|
|
263
|
+
* These name paths to keep OUT of the index even when git-tracked — the escape
|
|
264
|
+
* hatch for a committed vendor/theme/SDK directory `.gitignore` can't drop
|
|
265
|
+
* (#999). An empty result — the zero-config default — excludes nothing beyond
|
|
266
|
+
* the built-in defaults and the project's `.gitignore`.
|
|
267
|
+
*/
|
|
268
|
+
function loadExcludePatterns(rootDir) {
|
|
269
|
+
return loadParsedConfig(rootDir).exclude;
|
|
174
270
|
}
|
|
175
271
|
/** Test/maintenance hook: forget cached config (e.g. after rewriting it in a test). */
|
|
176
272
|
function clearProjectConfigCache() {
|
|
177
|
-
|
|
178
|
-
overridesCache.clear();
|
|
273
|
+
cache.clear();
|
|
179
274
|
}
|
|
180
275
|
//# sourceMappingURL=project-config.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"project-config.js","sourceRoot":"","sources":["../src/project-config.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"project-config.js","sourceRoot":"","sources":["../src/project-config.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyPA,wDAEC;AAUD,gEAEC;AAUD,kDAEC;AAGD,0DAEC;AAxRD;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,uCAAyB;AACzB,2CAA6B;AAE7B,oDAA4D;AAC5D,qCAAmC;AAEnC,oFAAoF;AACvE,QAAA,uBAAuB,GAAG,gBAAgB,CAAC;AAsCxD;;;;;GAKG;AACH,MAAM,KAAK,GAAG,IAAI,GAAG,EAAsB,CAAC;AAE5C,qEAAqE;AACrE,MAAM,gBAAgB,GAA6B,MAAM,CAAC,MAAM,CA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C,IAAI,KAAK,IAAI,KAAK,CAAC,OAAO,KAAK,OAAO;QAAE,OAAO,KAAK,CAAC,MAAM,CAAC;IAE5D,MAAM,MAAM,GAAG,WAAW,CAAC,IAAI,CAAC,CAAC;IACjC,KAAK,CAAC,GAAG,CAAC,OAAO,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC,CAAC;IACxC,OAAO,MAAM,CAAC;AAChB,CAAC;AAED;;;;;;;GAOG;AACH,SAAgB,sBAAsB,CAAC,OAAe;IACpD,OAAO,gBAAgB,CAAC,OAAO,CAAC,CAAC,UAAU,CAAC;AAC9C,CAAC;AAED;;;;;;;GAOG;AACH,SAAgB,0BAA0B,CAAC,OAAe;IACxD,OAAO,gBAAgB,CAAC,OAAO,CAAC,CAAC,cAAc,CAAC;AAClD,CAAC;AAED;;;;;;;GAOG;AACH,SAAgB,mBAAmB,CAAC,OAAe;IACjD,OAAO,gBAAgB,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC;AAC3C,CAAC;AAED,uFAAuF;AACvF,SAAgB,uBAAuB;IACrC,KAAK,CAAC,KAAK,EAAE,CAAC;AAChB,CAAC"}
|
|
@@ -1,31 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* C/C++ function-pointer dispatch synthesis (#932).
|
|
3
|
-
*
|
|
4
|
-
* C/C++ polymorphism is the function pointer: a struct carries a fn-pointer
|
|
5
|
-
* field (`int (*fn)(int)`, or a fn-pointer-typedef field `hook_func func`),
|
|
6
|
-
* concrete functions are *registered* into it through a table
|
|
7
|
-
* (`static struct cmd cmds[] = {{"add", cmd_add}, …}`, a designated
|
|
8
|
-
* `.fn = cmd_add`, or `x->fn = cmd_add`), and the dispatcher calls through it
|
|
9
|
-
* indirectly (`p->fn(argv)`). Static extraction captures neither the
|
|
10
|
-
* registration→field binding nor the indirect call, so the dispatcher→handler
|
|
11
|
-
* edge is missing and `git`'s `run_builtin` looks like it calls nothing, the
|
|
12
|
-
* hooks in `hook_demo.c` are unreachable, etc.
|
|
13
|
-
*
|
|
14
|
-
* This bridges it, keyed by **(struct type, fn-pointer field)**:
|
|
15
|
-
* • registrations — a function bound to `S.field` via a positional
|
|
16
|
-
* initializer (matched by field index), a designated `.field = fn`, or a
|
|
17
|
-
* direct `x.field = fn` / `x->field = fn` assignment;
|
|
18
|
-
* • dispatch — `recv->field(…)` / `recv.field(…)` where `recv` resolves to a
|
|
19
|
-
* value of struct type `S` (from the enclosing function's params / locals),
|
|
20
|
-
* falling back to the field name when it is unique to one struct;
|
|
21
|
-
* • field←field propagation — `a->f = b->g` merges `B.g`'s handlers into
|
|
22
|
-
* `A.f`, so a generic single-slot hook that is reassigned from a registry
|
|
23
|
-
* (the `hook_demo.c` shape: `h->func = found->fn`) still resolves.
|
|
24
|
-
*
|
|
25
|
-
* Whole-graph pass after base resolution; all edges are `provenance:'heuristic'`
|
|
26
|
-
* (`synthesizedBy:'fn-pointer-dispatch'`). High precision via the (type, field)
|
|
27
|
-
* key + a real-function gate; a project with no fn-pointer dispatch is a no-op.
|
|
28
|
-
*/
|
|
29
1
|
import type { Edge } from '../types';
|
|
30
2
|
import type { QueryBuilder } from '../db/queries';
|
|
31
3
|
import type { ResolutionContext } from './types';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"c-fnptr-synthesizer.d.ts","sourceRoot":"","sources":["../../src/resolution/c-fnptr-synthesizer.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"c-fnptr-synthesizer.d.ts","sourceRoot":"","sources":["../../src/resolution/c-fnptr-synthesizer.ts"],"names":[],"mappings":"AAmDA,OAAO,KAAK,EAAE,IAAI,EAAQ,MAAM,UAAU,CAAC;AAC3C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAClD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AA+PjD,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,YAAY,EAAE,GAAG,EAAE,iBAAiB,GAAG,IAAI,EAAE,CA4oB7F"}
|