@colbymchenry/codegraph-darwin-x64 0.9.4 → 0.9.6
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 +12 -0
- package/lib/dist/bin/codegraph.js.map +1 -1
- package/lib/dist/db/queries.d.ts +1 -0
- package/lib/dist/db/queries.d.ts.map +1 -1
- package/lib/dist/db/queries.js +31 -3
- package/lib/dist/db/queries.js.map +1 -1
- package/lib/dist/extraction/grammars.d.ts +1 -1
- package/lib/dist/extraction/grammars.d.ts.map +1 -1
- package/lib/dist/extraction/grammars.js +29 -1
- package/lib/dist/extraction/grammars.js.map +1 -1
- package/lib/dist/extraction/index.d.ts +15 -2
- package/lib/dist/extraction/index.d.ts.map +1 -1
- package/lib/dist/extraction/index.js +170 -78
- package/lib/dist/extraction/index.js.map +1 -1
- package/lib/dist/extraction/languages/c-cpp.d.ts.map +1 -1
- package/lib/dist/extraction/languages/c-cpp.js +45 -0
- package/lib/dist/extraction/languages/c-cpp.js.map +1 -1
- package/lib/dist/extraction/languages/csharp.d.ts.map +1 -1
- package/lib/dist/extraction/languages/csharp.js +2 -1
- package/lib/dist/extraction/languages/csharp.js.map +1 -1
- package/lib/dist/extraction/languages/go.d.ts.map +1 -1
- package/lib/dist/extraction/languages/go.js +12 -0
- package/lib/dist/extraction/languages/go.js.map +1 -1
- package/lib/dist/extraction/languages/index.d.ts.map +1 -1
- package/lib/dist/extraction/languages/index.js +2 -0
- package/lib/dist/extraction/languages/index.js.map +1 -1
- package/lib/dist/extraction/languages/objc.d.ts +3 -0
- package/lib/dist/extraction/languages/objc.d.ts.map +1 -0
- package/lib/dist/extraction/languages/objc.js +133 -0
- package/lib/dist/extraction/languages/objc.js.map +1 -0
- package/lib/dist/extraction/mybatis-extractor.d.ts +48 -0
- package/lib/dist/extraction/mybatis-extractor.d.ts.map +1 -0
- package/lib/dist/extraction/mybatis-extractor.js +198 -0
- package/lib/dist/extraction/mybatis-extractor.js.map +1 -0
- package/lib/dist/extraction/tree-sitter-types.d.ts +4 -0
- package/lib/dist/extraction/tree-sitter-types.d.ts.map +1 -1
- package/lib/dist/extraction/tree-sitter.d.ts +33 -0
- package/lib/dist/extraction/tree-sitter.d.ts.map +1 -1
- package/lib/dist/extraction/tree-sitter.js +351 -14
- package/lib/dist/extraction/tree-sitter.js.map +1 -1
- package/lib/dist/index.d.ts +21 -2
- package/lib/dist/index.d.ts.map +1 -1
- package/lib/dist/index.js +53 -1
- package/lib/dist/index.js.map +1 -1
- package/lib/dist/installer/index.d.ts +1 -1
- package/lib/dist/installer/index.js +3 -3
- package/lib/dist/installer/index.js.map +1 -1
- package/lib/dist/installer/instructions-template.d.ts +2 -2
- package/lib/dist/installer/instructions-template.d.ts.map +1 -1
- package/lib/dist/installer/instructions-template.js +1 -1
- package/lib/dist/installer/targets/antigravity.d.ts +57 -0
- package/lib/dist/installer/targets/antigravity.d.ts.map +1 -0
- package/lib/dist/installer/targets/antigravity.js +307 -0
- package/lib/dist/installer/targets/antigravity.js.map +1 -0
- package/lib/dist/installer/targets/gemini.d.ts +26 -0
- package/lib/dist/installer/targets/gemini.d.ts.map +1 -0
- package/lib/dist/installer/targets/gemini.js +165 -0
- package/lib/dist/installer/targets/gemini.js.map +1 -0
- package/lib/dist/installer/targets/hermes.d.ts.map +1 -1
- package/lib/dist/installer/targets/hermes.js +57 -3
- package/lib/dist/installer/targets/hermes.js.map +1 -1
- package/lib/dist/installer/targets/kiro.d.ts +27 -0
- package/lib/dist/installer/targets/kiro.d.ts.map +1 -0
- package/lib/dist/installer/targets/kiro.js +196 -0
- package/lib/dist/installer/targets/kiro.js.map +1 -0
- package/lib/dist/installer/targets/registry.d.ts.map +1 -1
- package/lib/dist/installer/targets/registry.js +6 -0
- package/lib/dist/installer/targets/registry.js.map +1 -1
- package/lib/dist/installer/targets/types.d.ts +1 -1
- package/lib/dist/installer/targets/types.d.ts.map +1 -1
- package/lib/dist/mcp/daemon-paths.d.ts +46 -0
- package/lib/dist/mcp/daemon-paths.d.ts.map +1 -0
- package/lib/dist/mcp/daemon-paths.js +125 -0
- package/lib/dist/mcp/daemon-paths.js.map +1 -0
- package/lib/dist/mcp/daemon.d.ts +161 -0
- package/lib/dist/mcp/daemon.d.ts.map +1 -0
- package/lib/dist/mcp/daemon.js +403 -0
- package/lib/dist/mcp/daemon.js.map +1 -0
- package/lib/dist/mcp/engine.d.ts +100 -0
- package/lib/dist/mcp/engine.d.ts.map +1 -0
- package/lib/dist/mcp/engine.js +291 -0
- package/lib/dist/mcp/engine.js.map +1 -0
- package/lib/dist/mcp/index.d.ts +64 -53
- package/lib/dist/mcp/index.d.ts.map +1 -1
- package/lib/dist/mcp/index.js +307 -387
- package/lib/dist/mcp/index.js.map +1 -1
- package/lib/dist/mcp/proxy.d.ts +46 -0
- package/lib/dist/mcp/proxy.d.ts.map +1 -0
- package/lib/dist/mcp/proxy.js +276 -0
- package/lib/dist/mcp/proxy.js.map +1 -0
- package/lib/dist/mcp/server-instructions.d.ts +1 -1
- package/lib/dist/mcp/server-instructions.d.ts.map +1 -1
- package/lib/dist/mcp/server-instructions.js +1 -1
- package/lib/dist/mcp/session.d.ts +67 -0
- package/lib/dist/mcp/session.d.ts.map +1 -0
- package/lib/dist/mcp/session.js +276 -0
- package/lib/dist/mcp/session.js.map +1 -0
- package/lib/dist/mcp/tools.d.ts +49 -0
- package/lib/dist/mcp/tools.d.ts.map +1 -1
- package/lib/dist/mcp/tools.js +253 -17
- package/lib/dist/mcp/tools.js.map +1 -1
- package/lib/dist/mcp/transport.d.ts +111 -29
- package/lib/dist/mcp/transport.d.ts.map +1 -1
- package/lib/dist/mcp/transport.js +181 -71
- package/lib/dist/mcp/transport.js.map +1 -1
- package/lib/dist/mcp/version.d.ts +19 -0
- package/lib/dist/mcp/version.d.ts.map +1 -0
- package/lib/dist/mcp/version.js +71 -0
- package/lib/dist/mcp/version.js.map +1 -0
- package/lib/dist/resolution/callback-synthesizer.d.ts +3 -2
- package/lib/dist/resolution/callback-synthesizer.d.ts.map +1 -1
- package/lib/dist/resolution/callback-synthesizer.js +351 -3
- package/lib/dist/resolution/callback-synthesizer.js.map +1 -1
- package/lib/dist/resolution/frameworks/expo-modules.d.ts +3 -0
- package/lib/dist/resolution/frameworks/expo-modules.d.ts.map +1 -0
- package/lib/dist/resolution/frameworks/expo-modules.js +143 -0
- package/lib/dist/resolution/frameworks/expo-modules.js.map +1 -0
- package/lib/dist/resolution/frameworks/fabric.d.ts +3 -0
- package/lib/dist/resolution/frameworks/fabric.d.ts.map +1 -0
- package/lib/dist/resolution/frameworks/fabric.js +354 -0
- package/lib/dist/resolution/frameworks/fabric.js.map +1 -0
- package/lib/dist/resolution/frameworks/index.d.ts +4 -0
- package/lib/dist/resolution/frameworks/index.d.ts.map +1 -1
- package/lib/dist/resolution/frameworks/index.js +21 -1
- package/lib/dist/resolution/frameworks/index.js.map +1 -1
- package/lib/dist/resolution/frameworks/java.d.ts.map +1 -1
- package/lib/dist/resolution/frameworks/java.js +270 -1
- package/lib/dist/resolution/frameworks/java.js.map +1 -1
- package/lib/dist/resolution/frameworks/nestjs.d.ts.map +1 -1
- package/lib/dist/resolution/frameworks/nestjs.js +324 -0
- package/lib/dist/resolution/frameworks/nestjs.js.map +1 -1
- package/lib/dist/resolution/frameworks/react-native.d.ts +3 -0
- package/lib/dist/resolution/frameworks/react-native.d.ts.map +1 -0
- package/lib/dist/resolution/frameworks/react-native.js +360 -0
- package/lib/dist/resolution/frameworks/react-native.js.map +1 -0
- package/lib/dist/resolution/frameworks/swift-objc.d.ts +37 -0
- package/lib/dist/resolution/frameworks/swift-objc.d.ts.map +1 -0
- package/lib/dist/resolution/frameworks/swift-objc.js +252 -0
- package/lib/dist/resolution/frameworks/swift-objc.js.map +1 -0
- package/lib/dist/resolution/go-module.d.ts +26 -0
- package/lib/dist/resolution/go-module.d.ts.map +1 -0
- package/lib/dist/resolution/go-module.js +78 -0
- package/lib/dist/resolution/go-module.js.map +1 -0
- package/lib/dist/resolution/import-resolver.d.ts +18 -0
- package/lib/dist/resolution/import-resolver.d.ts.map +1 -1
- package/lib/dist/resolution/import-resolver.js +538 -4
- package/lib/dist/resolution/import-resolver.js.map +1 -1
- package/lib/dist/resolution/index.d.ts +10 -0
- package/lib/dist/resolution/index.d.ts.map +1 -1
- package/lib/dist/resolution/index.js +102 -0
- package/lib/dist/resolution/index.js.map +1 -1
- package/lib/dist/resolution/name-matcher.d.ts.map +1 -1
- package/lib/dist/resolution/name-matcher.js +212 -0
- package/lib/dist/resolution/name-matcher.js.map +1 -1
- package/lib/dist/resolution/swift-objc-bridge.d.ts +134 -0
- package/lib/dist/resolution/swift-objc-bridge.d.ts.map +1 -0
- package/lib/dist/resolution/swift-objc-bridge.js +256 -0
- package/lib/dist/resolution/swift-objc-bridge.js.map +1 -0
- package/lib/dist/resolution/types.d.ts +29 -0
- package/lib/dist/resolution/types.d.ts.map +1 -1
- package/lib/dist/sync/index.d.ts +3 -1
- package/lib/dist/sync/index.d.ts.map +1 -1
- package/lib/dist/sync/index.js +8 -1
- package/lib/dist/sync/index.js.map +1 -1
- package/lib/dist/sync/watcher.d.ts +119 -7
- package/lib/dist/sync/watcher.d.ts.map +1 -1
- package/lib/dist/sync/watcher.js +243 -37
- package/lib/dist/sync/watcher.js.map +1 -1
- package/lib/dist/sync/worktree.d.ts +54 -0
- package/lib/dist/sync/worktree.d.ts.map +1 -0
- package/lib/dist/sync/worktree.js +136 -0
- package/lib/dist/sync/worktree.js.map +1 -0
- package/lib/dist/types.d.ts +1 -1
- package/lib/dist/types.d.ts.map +1 -1
- package/lib/dist/types.js +3 -0
- package/lib/dist/types.js.map +1 -1
- package/lib/node_modules/.package-lock.json +29 -1
- package/lib/node_modules/chokidar/LICENSE +21 -0
- package/lib/node_modules/chokidar/README.md +305 -0
- package/lib/node_modules/chokidar/esm/handler.d.ts +90 -0
- package/lib/node_modules/chokidar/esm/handler.js +629 -0
- package/lib/node_modules/chokidar/esm/index.d.ts +215 -0
- package/lib/node_modules/chokidar/esm/index.js +798 -0
- package/lib/node_modules/chokidar/esm/package.json +1 -0
- package/lib/node_modules/chokidar/handler.d.ts +90 -0
- package/lib/node_modules/chokidar/handler.js +635 -0
- package/lib/node_modules/chokidar/index.d.ts +215 -0
- package/lib/node_modules/chokidar/index.js +804 -0
- package/lib/node_modules/chokidar/package.json +69 -0
- package/lib/node_modules/readdirp/LICENSE +21 -0
- package/lib/node_modules/readdirp/README.md +120 -0
- package/lib/node_modules/readdirp/esm/index.d.ts +108 -0
- package/lib/node_modules/readdirp/esm/index.js +257 -0
- package/lib/node_modules/readdirp/esm/package.json +1 -0
- package/lib/node_modules/readdirp/index.d.ts +108 -0
- package/lib/node_modules/readdirp/index.js +263 -0
- package/lib/node_modules/readdirp/package.json +70 -0
- package/lib/package.json +2 -1
- package/package.json +1 -1
|
@@ -83,6 +83,7 @@ const WASM_GRAMMAR_FILES = {
|
|
|
83
83
|
scala: 'tree-sitter-scala.wasm',
|
|
84
84
|
lua: 'tree-sitter-lua.wasm',
|
|
85
85
|
luau: 'tree-sitter-luau.wasm',
|
|
86
|
+
objc: 'tree-sitter-objc.wasm',
|
|
86
87
|
};
|
|
87
88
|
/**
|
|
88
89
|
* File extension to Language mapping
|
|
@@ -137,6 +138,15 @@ exports.EXTENSION_MAP = {
|
|
|
137
138
|
'.sc': 'scala',
|
|
138
139
|
'.lua': 'lua',
|
|
139
140
|
'.luau': 'luau',
|
|
141
|
+
'.m': 'objc',
|
|
142
|
+
'.mm': 'objc',
|
|
143
|
+
// XML: file-level tracking; the MyBatis extractor matches `<mapper namespace="...">`
|
|
144
|
+
// shape and emits SQL-statement nodes (other XML returns empty).
|
|
145
|
+
'.xml': 'xml',
|
|
146
|
+
// Spring config: `application.properties` / `application-*.properties`. Same
|
|
147
|
+
// shape as the `.yml` variants — the YAML/properties extractor emits one node
|
|
148
|
+
// per leaf key, and the Spring resolver links `@Value("${k}")` references.
|
|
149
|
+
'.properties': 'properties',
|
|
140
150
|
};
|
|
141
151
|
/**
|
|
142
152
|
* Whether a file is one CodeGraph can parse, based purely on its extension.
|
|
@@ -256,10 +266,12 @@ function detectLanguage(filePath, source) {
|
|
|
256
266
|
return 'yaml';
|
|
257
267
|
const ext = filePath.substring(filePath.lastIndexOf('.')).toLowerCase();
|
|
258
268
|
const lang = exports.EXTENSION_MAP[ext] || 'unknown';
|
|
259
|
-
// .h files could be C or C
|
|
269
|
+
// .h files could be C, C++, or Objective-C — check source content
|
|
260
270
|
if (lang === 'c' && ext === '.h' && source) {
|
|
261
271
|
if (looksLikeCpp(source))
|
|
262
272
|
return 'cpp';
|
|
273
|
+
if (looksLikeObjc(source))
|
|
274
|
+
return 'objc';
|
|
263
275
|
}
|
|
264
276
|
return lang;
|
|
265
277
|
}
|
|
@@ -271,6 +283,13 @@ function looksLikeCpp(source) {
|
|
|
271
283
|
const sample = source.substring(0, 8192);
|
|
272
284
|
return /\bnamespace\b|\bclass\s+\w+\s*[:{]|\btemplate\s*<|\b(?:public|private|protected)\s*:|\bvirtual\b|\busing\s+(?:namespace\b|\w+\s*=)/.test(sample);
|
|
273
285
|
}
|
|
286
|
+
/**
|
|
287
|
+
* Heuristic: does a .h file contain Objective-C constructs?
|
|
288
|
+
*/
|
|
289
|
+
function looksLikeObjc(source) {
|
|
290
|
+
const sample = source.substring(0, 8192);
|
|
291
|
+
return /@(?:interface|implementation|protocol|synthesize)\b/.test(sample);
|
|
292
|
+
}
|
|
274
293
|
/**
|
|
275
294
|
* Check if a language is supported (has a grammar defined).
|
|
276
295
|
* Returns true if the grammar exists, even if not yet loaded.
|
|
@@ -286,6 +305,10 @@ function isLanguageSupported(language) {
|
|
|
286
305
|
return true; // file-level tracking only; Drupal routing extraction via framework resolver
|
|
287
306
|
if (language === 'twig')
|
|
288
307
|
return true; // file-level tracking only
|
|
308
|
+
if (language === 'xml')
|
|
309
|
+
return true; // MyBatis mapper extractor
|
|
310
|
+
if (language === 'properties')
|
|
311
|
+
return true; // Spring config keys
|
|
289
312
|
if (language === 'unknown')
|
|
290
313
|
return false;
|
|
291
314
|
return language in WASM_GRAMMAR_FILES;
|
|
@@ -298,6 +321,8 @@ function isGrammarLoaded(language) {
|
|
|
298
321
|
return true;
|
|
299
322
|
if (language === 'yaml' || language === 'twig')
|
|
300
323
|
return true; // no WASM grammar needed
|
|
324
|
+
if (language === 'xml' || language === 'properties')
|
|
325
|
+
return true; // no WASM grammar needed
|
|
301
326
|
return languageCache.has(language);
|
|
302
327
|
}
|
|
303
328
|
/**
|
|
@@ -370,8 +395,11 @@ function getLanguageDisplayName(language) {
|
|
|
370
395
|
scala: 'Scala',
|
|
371
396
|
lua: 'Lua',
|
|
372
397
|
luau: 'Luau',
|
|
398
|
+
objc: 'Objective-C',
|
|
373
399
|
yaml: 'YAML',
|
|
374
400
|
twig: 'Twig',
|
|
401
|
+
xml: 'XML',
|
|
402
|
+
properties: 'Java properties',
|
|
375
403
|
unknown: 'Unknown',
|
|
376
404
|
};
|
|
377
405
|
return names[language] || language;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"grammars.js","sourceRoot":"","sources":["../../src/extraction/grammars.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"grammars.js","sourceRoot":"","sources":["../../src/extraction/grammars.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyGH,oCAKC;AAOD,4CAMC;AAgBD,oCAMC;AAOD,4DAkCC;AAMD,0CAGC;AAKD,sDAEC;AAMD,8BAcC;AAKD,wCAcC;AAuBD,kDAUC;AAKD,0CAKC;AAKD,sDAEC;AASD,kCAMC;AAKD,4CAQC;AAKD,kEAMC;AAKD,wDAiCC;AA9WD,2CAA6B;AAC7B,qDAAmE;AAKnE;;;GAGG;AACH,MAAM,kBAAkB,GAAoC;IAC1D,UAAU,EAAE,6BAA6B;IACz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QACZ,IAAI,EAAE,MAAM;QACZ,GAAG,EAAE,KAAK;QACV,UAAU,EAAE,iBAAiB;QAC7B,OAAO,EAAE,SAAS;KACnB,CAAC;IACF,OAAO,KAAK,CAAC,QAAQ,CAAC,IAAI,QAAQ,CAAC;AACrC,CAAC"}
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
import * as fs from 'fs';
|
|
7
7
|
import { ExtractionResult, ExtractionError } from '../types';
|
|
8
8
|
import { QueryBuilder } from '../db/queries';
|
|
9
|
+
import { Ignore } from 'ignore';
|
|
9
10
|
/**
|
|
10
11
|
* Progress callback for indexing operations
|
|
11
12
|
*/
|
|
@@ -44,6 +45,14 @@ export interface SyncResult {
|
|
|
44
45
|
* Calculate SHA256 hash of file contents
|
|
45
46
|
*/
|
|
46
47
|
export declare function hashContent(content: string): string;
|
|
48
|
+
/**
|
|
49
|
+
* An `ignore` matcher seeded with the built-in defaults, merged with the project's
|
|
50
|
+
* root .gitignore so a negation there (e.g. `!vendor/`) overrides a default. Shared
|
|
51
|
+
* by both enumeration paths so behavior is identical with or without git — and so
|
|
52
|
+
* the defaults apply to tracked files too (committing a dependency dir doesn't make
|
|
53
|
+
* it project code; the explicit `.gitignore` negation is the only opt-in).
|
|
54
|
+
*/
|
|
55
|
+
export declare function buildDefaultIgnore(rootDir: string): Ignore;
|
|
47
56
|
/**
|
|
48
57
|
* Recursively scan a directory for source files.
|
|
49
58
|
*
|
|
@@ -106,8 +115,12 @@ export declare class ExtractionOrchestrator {
|
|
|
106
115
|
*/
|
|
107
116
|
private storeExtractionResult;
|
|
108
117
|
/**
|
|
109
|
-
* Sync with current file state.
|
|
110
|
-
*
|
|
118
|
+
* Sync the index with the current file state.
|
|
119
|
+
*
|
|
120
|
+
* Change detection is filesystem-based, never git: a (size, mtime) stat
|
|
121
|
+
* pre-filter skips unchanged files, then a content-hash compare confirms real
|
|
122
|
+
* changes. This works in non-git projects and catches committed changes from
|
|
123
|
+
* `git pull`/`checkout`/`merge`/`rebase` that `git status` cannot see.
|
|
111
124
|
*/
|
|
112
125
|
sync(onProgress?: (progress: IndexProgress) => void): Promise<SyncResult>;
|
|
113
126
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/extraction/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AAKzB,OAAO,EAGL,gBAAgB,EAChB,eAAe,EAChB,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/extraction/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AAKzB,OAAO,EAGL,gBAAgB,EAChB,eAAe,EAChB,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAK7C,OAAe,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AA4BxC;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,KAAK,EAAE,UAAU,GAAG,SAAS,GAAG,SAAS,GAAG,WAAW,CAAC;IACxD,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,OAAO,EAAE,OAAO,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC;IACrB,YAAY,EAAE,MAAM,CAAC;IACrB,YAAY,EAAE,MAAM,CAAC;IACrB,YAAY,EAAE,MAAM,CAAC;IACrB,YAAY,EAAE,MAAM,CAAC;IACrB,MAAM,EAAE,eAAe,EAAE,CAAC;IAC1B,UAAU,EAAE,MAAM,CAAC;CACpB;AAED;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB,YAAY,EAAE,MAAM,CAAC;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AE,GAAG,OAAO,CAAC,WAAW,CAAC;IAuC3D;;OAEG;IACG,SAAS,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,CAAC;IAuChE;;;OAGG;IACG,oBAAoB,CACxB,YAAY,EAAE,MAAM,EACpB,OAAO,EAAE,MAAM,EACf,KAAK,EAAE,EAAE,CAAC,KAAK,GACd,OAAO,CAAC,gBAAgB,CAAC;IA0D5B;;OAEG;IACH,OAAO,CAAC,qBAAqB;IAsE7B;;;;;;;OAOG;IACG,IAAI,CAAC,UAAU,CAAC,EAAE,CAAC,QAAQ,EAAE,aAAa,KAAK,IAAI,GAAG,OAAO,CAAC,UAAU,CAAC;IA6H/E;;;OAGG;IACH,eAAe,IAAI;QAAE,KAAK,EAAE,MAAM,EAAE,CAAC;QAAC,QAAQ,EAAE,MAAM,EAAE,CAAC;QAAC,OAAO,EAAE,MAAM,EAAE,CAAA;KAAE;CAwF9E;AAGD,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAClD,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,mBAAmB,EAAE,eAAe,EAAE,qBAAqB,EAAE,YAAY,EAAE,wBAAwB,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC"}
|
|
@@ -43,6 +43,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
43
43
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
44
44
|
exports.loadAllGrammars = exports.loadGrammarsForLanguages = exports.initGrammars = exports.getSupportedLanguages = exports.isGrammarLoaded = exports.isLanguageSupported = exports.isSourceFile = exports.detectLanguage = exports.extractFromSource = exports.ExtractionOrchestrator = void 0;
|
|
45
45
|
exports.hashContent = hashContent;
|
|
46
|
+
exports.buildDefaultIgnore = buildDefaultIgnore;
|
|
46
47
|
exports.scanDirectory = scanDirectory;
|
|
47
48
|
exports.scanDirectoryAsync = scanDirectoryAsync;
|
|
48
49
|
const fs = __importStar(require("fs"));
|
|
@@ -88,6 +89,83 @@ function hashContent(content) {
|
|
|
88
89
|
* symbols. 1 MB covers essentially all hand-written source.
|
|
89
90
|
*/
|
|
90
91
|
const MAX_FILE_SIZE = 1024 * 1024;
|
|
92
|
+
/**
|
|
93
|
+
* Directory names that are dependency, build, cache, or tooling output across the
|
|
94
|
+
* languages/frameworks CodeGraph supports — curated from the canonical
|
|
95
|
+
* github/gitignore templates. Excluded by default so the graph reflects your code,
|
|
96
|
+
* not third-party noise, without requiring a `.gitignore` (issue #407). The
|
|
97
|
+
* exclusion applies uniformly (git or not, tracked or not); the only opt-in is an
|
|
98
|
+
* explicit `.gitignore` negation (e.g. `!vendor/`). First-party-prone or generic
|
|
99
|
+
* names (`packages`, `lib`, `app`, `bin`, `src`, `deps`, `env`, `tmp`, `storage`,
|
|
100
|
+
* `Library`) are deliberately NOT listed, to avoid ever hiding real source.
|
|
101
|
+
*
|
|
102
|
+
* Only dirs that actually contain *indexable source* (or are enormous) earn a slot
|
|
103
|
+
* — IDE/state dirs like `.idea`/`.vs` are omitted because CodeGraph indexes only
|
|
104
|
+
* recognized source extensions, so they produce no symbols regardless.
|
|
105
|
+
*/
|
|
106
|
+
const DEFAULT_IGNORE_DIRS = new Set([
|
|
107
|
+
// JS / TS — dependency directories
|
|
108
|
+
'node_modules', 'bower_components', 'jspm_packages', 'web_modules',
|
|
109
|
+
'.yarn', '.pnpm-store',
|
|
110
|
+
// JS / TS — framework & bundler build / cache / deploy output
|
|
111
|
+
'.next', '.nuxt', '.svelte-kit', '.turbo', '.vite', '.parcel-cache', '.angular',
|
|
112
|
+
'.docusaurus', 'storybook-static', '.vinxi', '.nitro', 'out-tsc',
|
|
113
|
+
'.vercel', '.netlify', '.wrangler',
|
|
114
|
+
// Build output (common across ecosystems)
|
|
115
|
+
'dist', 'build', 'out', '.output',
|
|
116
|
+
// Test / coverage
|
|
117
|
+
'coverage', '.nyc_output',
|
|
118
|
+
// Python
|
|
119
|
+
'__pycache__', '__pypackages__', '.venv', 'venv', '.pixi', '.pdm-build',
|
|
120
|
+
'.mypy_cache', '.pytest_cache', '.ruff_cache', '.tox', '.nox', '.hypothesis',
|
|
121
|
+
'.ipynb_checkpoints', '.eggs',
|
|
122
|
+
// Rust / JVM (Maven, Gradle, Scala)
|
|
123
|
+
'target', '.gradle',
|
|
124
|
+
// .NET
|
|
125
|
+
'obj',
|
|
126
|
+
// Vendored deps (Go, PHP/Composer, Ruby/Bundler)
|
|
127
|
+
'vendor',
|
|
128
|
+
// Swift / iOS
|
|
129
|
+
'.build', 'Pods', 'Carthage', 'DerivedData', '.swiftpm',
|
|
130
|
+
// Dart / Flutter
|
|
131
|
+
'.dart_tool', '.pub-cache',
|
|
132
|
+
// Native (Android NDK, C/C++ deps)
|
|
133
|
+
'.cxx', '.externalNativeBuild', 'vcpkg_installed',
|
|
134
|
+
// Scala tooling
|
|
135
|
+
'.bloop', '.metals',
|
|
136
|
+
// Lua / Luau (LuaRocks)
|
|
137
|
+
'lua_modules', '.luarocks',
|
|
138
|
+
// Delphi / RAD Studio IDE backups (duplicate .pas source — would double-count)
|
|
139
|
+
'__history', '__recovery',
|
|
140
|
+
// Generic cache
|
|
141
|
+
'.cache',
|
|
142
|
+
]);
|
|
143
|
+
/** Gitignore-style patterns for the `ignore` matcher: the dirs above plus a few globs. */
|
|
144
|
+
const DEFAULT_IGNORE_PATTERNS = [
|
|
145
|
+
...Array.from(DEFAULT_IGNORE_DIRS, (d) => `${d}/`),
|
|
146
|
+
'*.egg-info/', // Python packaging metadata
|
|
147
|
+
'cmake-build-*/', // CLion / CMake build trees
|
|
148
|
+
'bazel-*/', // Bazel output symlink trees
|
|
149
|
+
];
|
|
150
|
+
/**
|
|
151
|
+
* An `ignore` matcher seeded with the built-in defaults, merged with the project's
|
|
152
|
+
* root .gitignore so a negation there (e.g. `!vendor/`) overrides a default. Shared
|
|
153
|
+
* by both enumeration paths so behavior is identical with or without git — and so
|
|
154
|
+
* the defaults apply to tracked files too (committing a dependency dir doesn't make
|
|
155
|
+
* it project code; the explicit `.gitignore` negation is the only opt-in).
|
|
156
|
+
*/
|
|
157
|
+
function buildDefaultIgnore(rootDir) {
|
|
158
|
+
const ig = (0, ignore_1.default)().add(DEFAULT_IGNORE_PATTERNS);
|
|
159
|
+
try {
|
|
160
|
+
const rootGitignore = path.join(rootDir, '.gitignore');
|
|
161
|
+
if (fs.existsSync(rootGitignore))
|
|
162
|
+
ig.add(fs.readFileSync(rootGitignore, 'utf-8'));
|
|
163
|
+
}
|
|
164
|
+
catch {
|
|
165
|
+
// Unreadable root .gitignore — the built-in defaults still apply.
|
|
166
|
+
}
|
|
167
|
+
return ig;
|
|
168
|
+
}
|
|
91
169
|
/**
|
|
92
170
|
* Collect git-visible files (tracked + untracked, .gitignore-respected) from the
|
|
93
171
|
* git repository rooted at `repoDir`, adding each to `files` with `prefix`
|
|
@@ -161,7 +239,11 @@ function getGitVisibleFiles(rootDir) {
|
|
|
161
239
|
}
|
|
162
240
|
const files = new Set();
|
|
163
241
|
collectGitFiles(rootDir, '', files);
|
|
164
|
-
|
|
242
|
+
// Apply built-in default ignores uniformly — to tracked files too, since
|
|
243
|
+
// committing a dependency/build dir doesn't make it project code. A
|
|
244
|
+
// `.gitignore` negation (e.g. `!vendor/`) is the explicit opt-in. (issue #407)
|
|
245
|
+
const ig = buildDefaultIgnore(rootDir);
|
|
246
|
+
return new Set([...files].filter((f) => !ig.ignores(f)));
|
|
165
247
|
}
|
|
166
248
|
catch {
|
|
167
249
|
return null;
|
|
@@ -297,7 +379,9 @@ function scanDirectoryWalk(rootDir, onProgress) {
|
|
|
297
379
|
}
|
|
298
380
|
visitedDirs.add(realDir);
|
|
299
381
|
// This directory's own .gitignore (if present) applies to everything below it.
|
|
300
|
-
|
|
382
|
+
// The root's .gitignore is already merged into the seeded base matcher (so a
|
|
383
|
+
// negation there can override a built-in default), so skip it here.
|
|
384
|
+
const own = dir === rootDir ? null : loadIgnore(dir);
|
|
301
385
|
const active = own ? [...matchers, own] : matchers;
|
|
302
386
|
let entries;
|
|
303
387
|
try {
|
|
@@ -349,7 +433,9 @@ function scanDirectoryWalk(rootDir, onProgress) {
|
|
|
349
433
|
}
|
|
350
434
|
}
|
|
351
435
|
}
|
|
352
|
-
|
|
436
|
+
// Seed a base matcher with the built-in default ignores (merged with the root
|
|
437
|
+
// .gitignore so a negation can override). Nested .gitignores still layer per-dir.
|
|
438
|
+
walk(rootDir, [{ dir: rootDir, ig: buildDefaultIgnore(rootDir) }]);
|
|
353
439
|
return files;
|
|
354
440
|
}
|
|
355
441
|
/**
|
|
@@ -408,6 +494,24 @@ class ExtractionOrchestrator {
|
|
|
408
494
|
return null;
|
|
409
495
|
}
|
|
410
496
|
},
|
|
497
|
+
// Monorepo support — needed by framework detect()s that probe
|
|
498
|
+
// subpackage manifests (e.g. fabric-view looking at
|
|
499
|
+
// packages/<sub>/package.json when the root manifest is just a
|
|
500
|
+
// workspace declaration). Matches the resolver-context shape.
|
|
501
|
+
listDirectories: (relativePath) => {
|
|
502
|
+
const target = relativePath === '.' || relativePath === ''
|
|
503
|
+
? rootDir
|
|
504
|
+
: path.join(rootDir, relativePath);
|
|
505
|
+
try {
|
|
506
|
+
return fs
|
|
507
|
+
.readdirSync(target, { withFileTypes: true })
|
|
508
|
+
.filter((entry) => entry.isDirectory())
|
|
509
|
+
.map((entry) => entry.name);
|
|
510
|
+
}
|
|
511
|
+
catch {
|
|
512
|
+
return [];
|
|
513
|
+
}
|
|
514
|
+
},
|
|
411
515
|
};
|
|
412
516
|
}
|
|
413
517
|
/**
|
|
@@ -1053,8 +1157,12 @@ class ExtractionOrchestrator {
|
|
|
1053
1157
|
this.queries.upsertFile(fileRecord);
|
|
1054
1158
|
}
|
|
1055
1159
|
/**
|
|
1056
|
-
* Sync with current file state.
|
|
1057
|
-
*
|
|
1160
|
+
* Sync the index with the current file state.
|
|
1161
|
+
*
|
|
1162
|
+
* Change detection is filesystem-based, never git: a (size, mtime) stat
|
|
1163
|
+
* pre-filter skips unchanged files, then a content-hash compare confirms real
|
|
1164
|
+
* changes. This works in non-git projects and catches committed changes from
|
|
1165
|
+
* `git pull`/`checkout`/`merge`/`rebase` that `git status` cannot see.
|
|
1058
1166
|
*/
|
|
1059
1167
|
async sync(onProgress) {
|
|
1060
1168
|
await (0, grammars_1.initGrammars)(); // Initialize WASM runtime (grammars loaded lazily below)
|
|
@@ -1071,88 +1179,72 @@ class ExtractionOrchestrator {
|
|
|
1071
1179
|
total: 0,
|
|
1072
1180
|
});
|
|
1073
1181
|
const filesToIndex = [];
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1182
|
+
// === Filesystem reconcile (git-independent) ===
|
|
1183
|
+
// The source of truth for "what changed" is the filesystem vs the indexed
|
|
1184
|
+
// state — never git. We enumerate the current source files and reconcile
|
|
1185
|
+
// each against the DB. A cheap (size, mtime) stat pre-filter skips unchanged
|
|
1186
|
+
// files without reading or hashing them, so the expensive read+hash+parse
|
|
1187
|
+
// only runs for files that actually changed. This catches edits/adds/deletes
|
|
1188
|
+
// whether or not the project uses git, and crucially also catches committed
|
|
1189
|
+
// changes from `git pull`/`checkout`/`merge`/`rebase` — which `git status`
|
|
1190
|
+
// cannot see, because the working tree is clean afterward.
|
|
1191
|
+
const currentFiles = scanDirectory(this.rootDir);
|
|
1192
|
+
filesChecked = currentFiles.length;
|
|
1193
|
+
const currentSet = new Set(currentFiles);
|
|
1194
|
+
const trackedFiles = this.queries.getAllFiles();
|
|
1195
|
+
const trackedMap = new Map();
|
|
1196
|
+
for (const f of trackedFiles) {
|
|
1197
|
+
trackedMap.set(f.path, f);
|
|
1198
|
+
}
|
|
1199
|
+
// Removals: tracked in the DB but no longer a present source file. Check the
|
|
1200
|
+
// filesystem directly — `scanDirectory` (via `git ls-files`) still lists a
|
|
1201
|
+
// file deleted from disk but not yet staged, so set membership alone misses it.
|
|
1202
|
+
for (const tracked of trackedFiles) {
|
|
1203
|
+
if (!currentSet.has(tracked.path) || !fs.existsSync(path.join(this.rootDir, tracked.path))) {
|
|
1204
|
+
this.queries.deleteFile(tracked.path);
|
|
1205
|
+
filesRemoved++;
|
|
1086
1206
|
}
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1207
|
+
}
|
|
1208
|
+
// Adds / modifications.
|
|
1209
|
+
for (const filePath of currentFiles) {
|
|
1210
|
+
const fullPath = path.join(this.rootDir, filePath);
|
|
1211
|
+
const tracked = trackedMap.get(filePath);
|
|
1212
|
+
// Cheap pre-filter: an already-indexed file whose size AND mtime both match
|
|
1213
|
+
// the DB is unchanged — skip it without reading or hashing. (A content
|
|
1214
|
+
// change that preserves both exactly is the blind spot every mtime-based
|
|
1215
|
+
// incremental tool accepts; `index --force` is the escape hatch. Git bumps
|
|
1216
|
+
// mtime on every file it writes during checkout/merge, so pulls are caught.)
|
|
1217
|
+
if (tracked) {
|
|
1095
1218
|
try {
|
|
1096
|
-
|
|
1219
|
+
const stat = fs.statSync(fullPath);
|
|
1220
|
+
if (stat.size === tracked.size && Math.floor(stat.mtimeMs) === Math.floor(tracked.modifiedAt)) {
|
|
1221
|
+
continue;
|
|
1222
|
+
}
|
|
1097
1223
|
}
|
|
1098
1224
|
catch (error) {
|
|
1099
|
-
(0, errors_1.logDebug)('Skipping
|
|
1225
|
+
(0, errors_1.logDebug)('Skipping unstattable file during sync', { filePath, error: String(error) });
|
|
1100
1226
|
continue;
|
|
1101
1227
|
}
|
|
1102
|
-
const contentHash = hashContent(content);
|
|
1103
|
-
const tracked = this.queries.getFileByPath(filePath);
|
|
1104
|
-
if (!tracked) {
|
|
1105
|
-
filesToIndex.push(filePath);
|
|
1106
|
-
changedFilePaths.push(filePath);
|
|
1107
|
-
filesAdded++;
|
|
1108
|
-
}
|
|
1109
|
-
else if (tracked.contentHash !== contentHash) {
|
|
1110
|
-
filesToIndex.push(filePath);
|
|
1111
|
-
changedFilePaths.push(filePath);
|
|
1112
|
-
filesModified++;
|
|
1113
|
-
}
|
|
1114
1228
|
}
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
filesChecked = currentFiles.size;
|
|
1120
|
-
// Build Map for O(1) lookups instead of .find() per file
|
|
1121
|
-
const trackedFiles = this.queries.getAllFiles();
|
|
1122
|
-
const trackedMap = new Map();
|
|
1123
|
-
for (const f of trackedFiles) {
|
|
1124
|
-
trackedMap.set(f.path, f);
|
|
1229
|
+
// New, or size/mtime changed — read + hash to confirm a real content change.
|
|
1230
|
+
let content;
|
|
1231
|
+
try {
|
|
1232
|
+
content = fs.readFileSync(fullPath, 'utf-8');
|
|
1125
1233
|
}
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
this.queries.deleteFile(tracked.path);
|
|
1130
|
-
filesRemoved++;
|
|
1131
|
-
}
|
|
1234
|
+
catch (error) {
|
|
1235
|
+
(0, errors_1.logDebug)('Skipping unreadable file during sync', { filePath, error: String(error) });
|
|
1236
|
+
continue;
|
|
1132
1237
|
}
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
}
|
|
1144
|
-
const contentHash = hashContent(content);
|
|
1145
|
-
const tracked = trackedMap.get(filePath);
|
|
1146
|
-
if (!tracked) {
|
|
1147
|
-
filesToIndex.push(filePath);
|
|
1148
|
-
changedFilePaths.push(filePath);
|
|
1149
|
-
filesAdded++;
|
|
1150
|
-
}
|
|
1151
|
-
else if (tracked.contentHash !== contentHash) {
|
|
1152
|
-
filesToIndex.push(filePath);
|
|
1153
|
-
changedFilePaths.push(filePath);
|
|
1154
|
-
filesModified++;
|
|
1155
|
-
}
|
|
1238
|
+
const contentHash = hashContent(content);
|
|
1239
|
+
if (!tracked) {
|
|
1240
|
+
filesToIndex.push(filePath);
|
|
1241
|
+
changedFilePaths.push(filePath);
|
|
1242
|
+
filesAdded++;
|
|
1243
|
+
}
|
|
1244
|
+
else if (tracked.contentHash !== contentHash) {
|
|
1245
|
+
filesToIndex.push(filePath);
|
|
1246
|
+
changedFilePaths.push(filePath);
|
|
1247
|
+
filesModified++;
|
|
1156
1248
|
}
|
|
1157
1249
|
}
|
|
1158
1250
|
// Load only grammars needed for changed files
|