@colbymchenry/codegraph 0.7.10 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +70 -54
- package/npm-shim.js +43 -0
- package/package.json +13 -51
- package/LICENSE +0 -21
- package/dist/bin/codegraph.d.ts +0 -21
- package/dist/bin/codegraph.d.ts.map +0 -1
- package/dist/bin/codegraph.js +0 -1232
- package/dist/bin/codegraph.js.map +0 -1
- package/dist/bin/node-version-check.d.ts +0 -20
- package/dist/bin/node-version-check.d.ts.map +0 -1
- package/dist/bin/node-version-check.js +0 -42
- package/dist/bin/node-version-check.js.map +0 -1
- package/dist/bin/uninstall.d.ts +0 -14
- package/dist/bin/uninstall.d.ts.map +0 -1
- package/dist/bin/uninstall.js +0 -36
- package/dist/bin/uninstall.js.map +0 -1
- package/dist/config.d.ts +0 -51
- package/dist/config.d.ts.map +0 -1
- package/dist/config.js +0 -321
- package/dist/config.js.map +0 -1
- package/dist/context/formatter.d.ts +0 -30
- package/dist/context/formatter.d.ts.map +0 -1
- package/dist/context/formatter.js +0 -244
- package/dist/context/formatter.js.map +0 -1
- package/dist/context/index.d.ts +0 -97
- package/dist/context/index.d.ts.map +0 -1
- package/dist/context/index.js +0 -1048
- package/dist/context/index.js.map +0 -1
- package/dist/db/index.d.ts +0 -72
- package/dist/db/index.d.ts.map +0 -1
- package/dist/db/index.js +0 -200
- package/dist/db/index.js.map +0 -1
- package/dist/db/migrations.d.ts +0 -44
- package/dist/db/migrations.d.ts.map +0 -1
- package/dist/db/migrations.js +0 -131
- package/dist/db/migrations.js.map +0 -1
- package/dist/db/queries.d.ts +0 -253
- package/dist/db/queries.d.ts.map +0 -1
- package/dist/db/queries.js +0 -1207
- package/dist/db/queries.js.map +0 -1
- package/dist/db/schema.sql +0 -151
- package/dist/db/sqlite-adapter.d.ts +0 -52
- package/dist/db/sqlite-adapter.d.ts.map +0 -1
- package/dist/db/sqlite-adapter.js +0 -237
- package/dist/db/sqlite-adapter.js.map +0 -1
- package/dist/directory.d.ts +0 -57
- package/dist/directory.d.ts.map +0 -1
- package/dist/directory.js +0 -264
- package/dist/directory.js.map +0 -1
- package/dist/errors.d.ts +0 -136
- package/dist/errors.d.ts.map +0 -1
- package/dist/errors.js +0 -219
- package/dist/errors.js.map +0 -1
- package/dist/extraction/dfm-extractor.d.ts +0 -31
- package/dist/extraction/dfm-extractor.d.ts.map +0 -1
- package/dist/extraction/dfm-extractor.js +0 -151
- package/dist/extraction/dfm-extractor.js.map +0 -1
- package/dist/extraction/grammars.d.ts +0 -78
- package/dist/extraction/grammars.d.ts.map +0 -1
- package/dist/extraction/grammars.js +0 -322
- package/dist/extraction/grammars.js.map +0 -1
- package/dist/extraction/index.d.ts +0 -130
- package/dist/extraction/index.d.ts.map +0 -1
- package/dist/extraction/index.js +0 -1279
- package/dist/extraction/index.js.map +0 -1
- package/dist/extraction/languages/c-cpp.d.ts +0 -4
- package/dist/extraction/languages/c-cpp.d.ts.map +0 -1
- package/dist/extraction/languages/c-cpp.js +0 -126
- package/dist/extraction/languages/c-cpp.js.map +0 -1
- package/dist/extraction/languages/csharp.d.ts +0 -3
- package/dist/extraction/languages/csharp.d.ts.map +0 -1
- package/dist/extraction/languages/csharp.js +0 -72
- package/dist/extraction/languages/csharp.js.map +0 -1
- package/dist/extraction/languages/dart.d.ts +0 -3
- package/dist/extraction/languages/dart.d.ts.map +0 -1
- package/dist/extraction/languages/dart.js +0 -192
- package/dist/extraction/languages/dart.js.map +0 -1
- package/dist/extraction/languages/go.d.ts +0 -3
- package/dist/extraction/languages/go.d.ts.map +0 -1
- package/dist/extraction/languages/go.js +0 -58
- package/dist/extraction/languages/go.js.map +0 -1
- package/dist/extraction/languages/index.d.ts +0 -10
- package/dist/extraction/languages/index.d.ts.map +0 -1
- package/dist/extraction/languages/index.js +0 -45
- package/dist/extraction/languages/index.js.map +0 -1
- package/dist/extraction/languages/java.d.ts +0 -3
- package/dist/extraction/languages/java.d.ts.map +0 -1
- package/dist/extraction/languages/java.js +0 -64
- package/dist/extraction/languages/java.js.map +0 -1
- package/dist/extraction/languages/javascript.d.ts +0 -3
- package/dist/extraction/languages/javascript.d.ts.map +0 -1
- package/dist/extraction/languages/javascript.js +0 -90
- package/dist/extraction/languages/javascript.js.map +0 -1
- package/dist/extraction/languages/kotlin.d.ts +0 -3
- package/dist/extraction/languages/kotlin.d.ts.map +0 -1
- package/dist/extraction/languages/kotlin.js +0 -253
- package/dist/extraction/languages/kotlin.js.map +0 -1
- package/dist/extraction/languages/pascal.d.ts +0 -3
- package/dist/extraction/languages/pascal.d.ts.map +0 -1
- package/dist/extraction/languages/pascal.js +0 -66
- package/dist/extraction/languages/pascal.js.map +0 -1
- package/dist/extraction/languages/php.d.ts +0 -3
- package/dist/extraction/languages/php.d.ts.map +0 -1
- package/dist/extraction/languages/php.js +0 -107
- package/dist/extraction/languages/php.js.map +0 -1
- package/dist/extraction/languages/python.d.ts +0 -3
- package/dist/extraction/languages/python.d.ts.map +0 -1
- package/dist/extraction/languages/python.js +0 -56
- package/dist/extraction/languages/python.js.map +0 -1
- package/dist/extraction/languages/ruby.d.ts +0 -3
- package/dist/extraction/languages/ruby.d.ts.map +0 -1
- package/dist/extraction/languages/ruby.js +0 -114
- package/dist/extraction/languages/ruby.js.map +0 -1
- package/dist/extraction/languages/rust.d.ts +0 -3
- package/dist/extraction/languages/rust.d.ts.map +0 -1
- package/dist/extraction/languages/rust.js +0 -109
- package/dist/extraction/languages/rust.js.map +0 -1
- package/dist/extraction/languages/scala.d.ts +0 -3
- package/dist/extraction/languages/scala.d.ts.map +0 -1
- package/dist/extraction/languages/scala.js +0 -139
- package/dist/extraction/languages/scala.js.map +0 -1
- package/dist/extraction/languages/swift.d.ts +0 -3
- package/dist/extraction/languages/swift.d.ts.map +0 -1
- package/dist/extraction/languages/swift.js +0 -91
- package/dist/extraction/languages/swift.js.map +0 -1
- package/dist/extraction/languages/typescript.d.ts +0 -3
- package/dist/extraction/languages/typescript.d.ts.map +0 -1
- package/dist/extraction/languages/typescript.js +0 -129
- package/dist/extraction/languages/typescript.js.map +0 -1
- package/dist/extraction/liquid-extractor.d.ts +0 -52
- package/dist/extraction/liquid-extractor.d.ts.map +0 -1
- package/dist/extraction/liquid-extractor.js +0 -313
- package/dist/extraction/liquid-extractor.js.map +0 -1
- package/dist/extraction/parse-worker.d.ts +0 -8
- package/dist/extraction/parse-worker.d.ts.map +0 -1
- package/dist/extraction/parse-worker.js +0 -94
- package/dist/extraction/parse-worker.js.map +0 -1
- package/dist/extraction/svelte-extractor.d.ts +0 -56
- package/dist/extraction/svelte-extractor.d.ts.map +0 -1
- package/dist/extraction/svelte-extractor.js +0 -272
- package/dist/extraction/svelte-extractor.js.map +0 -1
- package/dist/extraction/tree-sitter-helpers.d.ts +0 -28
- package/dist/extraction/tree-sitter-helpers.d.ts.map +0 -1
- package/dist/extraction/tree-sitter-helpers.js +0 -103
- package/dist/extraction/tree-sitter-helpers.js.map +0 -1
- package/dist/extraction/tree-sitter-types.d.ts +0 -179
- package/dist/extraction/tree-sitter-types.d.ts.map +0 -1
- package/dist/extraction/tree-sitter-types.js +0 -10
- package/dist/extraction/tree-sitter-types.js.map +0 -1
- package/dist/extraction/tree-sitter.d.ts +0 -233
- package/dist/extraction/tree-sitter.d.ts.map +0 -1
- package/dist/extraction/tree-sitter.js +0 -2393
- package/dist/extraction/tree-sitter.js.map +0 -1
- package/dist/extraction/vue-extractor.d.ts +0 -36
- package/dist/extraction/vue-extractor.d.ts.map +0 -1
- package/dist/extraction/vue-extractor.js +0 -163
- package/dist/extraction/vue-extractor.js.map +0 -1
- package/dist/extraction/wasm/tree-sitter-pascal.wasm +0 -0
- package/dist/extraction/wasm/tree-sitter-scala.wasm +0 -0
- package/dist/graph/index.d.ts +0 -8
- package/dist/graph/index.d.ts.map +0 -1
- package/dist/graph/index.js +0 -13
- package/dist/graph/index.js.map +0 -1
- package/dist/graph/queries.d.ts +0 -106
- package/dist/graph/queries.d.ts.map +0 -1
- package/dist/graph/queries.js +0 -366
- package/dist/graph/queries.js.map +0 -1
- package/dist/graph/traversal.d.ts +0 -127
- package/dist/graph/traversal.d.ts.map +0 -1
- package/dist/graph/traversal.js +0 -493
- package/dist/graph/traversal.js.map +0 -1
- package/dist/index.d.ts +0 -447
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -825
- package/dist/index.js.map +0 -1
- package/dist/installer/claude-md-template.d.ts +0 -14
- package/dist/installer/claude-md-template.d.ts.map +0 -1
- package/dist/installer/claude-md-template.js +0 -21
- package/dist/installer/claude-md-template.js.map +0 -1
- package/dist/installer/config-writer.d.ts +0 -29
- package/dist/installer/config-writer.d.ts.map +0 -1
- package/dist/installer/config-writer.js +0 -109
- package/dist/installer/config-writer.js.map +0 -1
- package/dist/installer/index.d.ts +0 -53
- package/dist/installer/index.d.ts.map +0 -1
- package/dist/installer/index.js +0 -338
- package/dist/installer/index.js.map +0 -1
- package/dist/installer/instructions-template.d.ts +0 -28
- package/dist/installer/instructions-template.d.ts.map +0 -1
- package/dist/installer/instructions-template.js +0 -63
- package/dist/installer/instructions-template.js.map +0 -1
- package/dist/installer/targets/claude.d.ts +0 -27
- package/dist/installer/targets/claude.d.ts.map +0 -1
- package/dist/installer/targets/claude.js +0 -246
- package/dist/installer/targets/claude.js.map +0 -1
- package/dist/installer/targets/codex.d.ts +0 -18
- package/dist/installer/targets/codex.d.ts.map +0 -1
- package/dist/installer/targets/codex.js +0 -185
- package/dist/installer/targets/codex.js.map +0 -1
- package/dist/installer/targets/cursor.d.ts +0 -35
- package/dist/installer/targets/cursor.d.ts.map +0 -1
- package/dist/installer/targets/cursor.js +0 -229
- package/dist/installer/targets/cursor.js.map +0 -1
- package/dist/installer/targets/opencode.d.ts +0 -30
- package/dist/installer/targets/opencode.d.ts.map +0 -1
- package/dist/installer/targets/opencode.js +0 -235
- package/dist/installer/targets/opencode.js.map +0 -1
- package/dist/installer/targets/registry.d.ts +0 -35
- package/dist/installer/targets/registry.d.ts.map +0 -1
- package/dist/installer/targets/registry.js +0 -83
- package/dist/installer/targets/registry.js.map +0 -1
- package/dist/installer/targets/shared.d.ts +0 -77
- package/dist/installer/targets/shared.d.ts.map +0 -1
- package/dist/installer/targets/shared.js +0 -246
- package/dist/installer/targets/shared.js.map +0 -1
- package/dist/installer/targets/toml.d.ts +0 -52
- package/dist/installer/targets/toml.d.ts.map +0 -1
- package/dist/installer/targets/toml.js +0 -147
- package/dist/installer/targets/toml.js.map +0 -1
- package/dist/installer/targets/types.d.ts +0 -116
- package/dist/installer/targets/types.d.ts.map +0 -1
- package/dist/installer/targets/types.js +0 -16
- package/dist/installer/targets/types.js.map +0 -1
- package/dist/mcp/index.d.ts +0 -86
- package/dist/mcp/index.d.ts.map +0 -1
- package/dist/mcp/index.js +0 -355
- package/dist/mcp/index.js.map +0 -1
- package/dist/mcp/server-instructions.d.ts +0 -19
- package/dist/mcp/server-instructions.d.ts.map +0 -1
- package/dist/mcp/server-instructions.js +0 -59
- package/dist/mcp/server-instructions.js.map +0 -1
- package/dist/mcp/tools.d.ts +0 -200
- package/dist/mcp/tools.d.ts.map +0 -1
- package/dist/mcp/tools.js +0 -1319
- package/dist/mcp/tools.js.map +0 -1
- package/dist/mcp/transport.d.ts +0 -89
- package/dist/mcp/transport.d.ts.map +0 -1
- package/dist/mcp/transport.js +0 -170
- package/dist/mcp/transport.js.map +0 -1
- package/dist/resolution/frameworks/cargo-workspace.d.ts +0 -18
- package/dist/resolution/frameworks/cargo-workspace.d.ts.map +0 -1
- package/dist/resolution/frameworks/cargo-workspace.js +0 -225
- package/dist/resolution/frameworks/cargo-workspace.js.map +0 -1
- package/dist/resolution/frameworks/csharp.d.ts +0 -8
- package/dist/resolution/frameworks/csharp.d.ts.map +0 -1
- package/dist/resolution/frameworks/csharp.js +0 -213
- package/dist/resolution/frameworks/csharp.js.map +0 -1
- package/dist/resolution/frameworks/express.d.ts +0 -8
- package/dist/resolution/frameworks/express.d.ts.map +0 -1
- package/dist/resolution/frameworks/express.js +0 -225
- package/dist/resolution/frameworks/express.js.map +0 -1
- package/dist/resolution/frameworks/go.d.ts +0 -8
- package/dist/resolution/frameworks/go.d.ts.map +0 -1
- package/dist/resolution/frameworks/go.js +0 -158
- package/dist/resolution/frameworks/go.js.map +0 -1
- package/dist/resolution/frameworks/index.d.ts +0 -41
- package/dist/resolution/frameworks/index.d.ts.map +0 -1
- package/dist/resolution/frameworks/index.js +0 -129
- package/dist/resolution/frameworks/index.js.map +0 -1
- package/dist/resolution/frameworks/java.d.ts +0 -8
- package/dist/resolution/frameworks/java.d.ts.map +0 -1
- package/dist/resolution/frameworks/java.js +0 -177
- package/dist/resolution/frameworks/java.js.map +0 -1
- package/dist/resolution/frameworks/laravel.d.ts +0 -13
- package/dist/resolution/frameworks/laravel.d.ts.map +0 -1
- package/dist/resolution/frameworks/laravel.js +0 -248
- package/dist/resolution/frameworks/laravel.js.map +0 -1
- package/dist/resolution/frameworks/python.d.ts +0 -10
- package/dist/resolution/frameworks/python.d.ts.map +0 -1
- package/dist/resolution/frameworks/python.js +0 -278
- package/dist/resolution/frameworks/python.js.map +0 -1
- package/dist/resolution/frameworks/react.d.ts +0 -8
- package/dist/resolution/frameworks/react.d.ts.map +0 -1
- package/dist/resolution/frameworks/react.js +0 -272
- package/dist/resolution/frameworks/react.js.map +0 -1
- package/dist/resolution/frameworks/ruby.d.ts +0 -8
- package/dist/resolution/frameworks/ruby.d.ts.map +0 -1
- package/dist/resolution/frameworks/ruby.js +0 -198
- package/dist/resolution/frameworks/ruby.js.map +0 -1
- package/dist/resolution/frameworks/rust.d.ts +0 -8
- package/dist/resolution/frameworks/rust.d.ts.map +0 -1
- package/dist/resolution/frameworks/rust.js +0 -207
- package/dist/resolution/frameworks/rust.js.map +0 -1
- package/dist/resolution/frameworks/svelte.d.ts +0 -9
- package/dist/resolution/frameworks/svelte.d.ts.map +0 -1
- package/dist/resolution/frameworks/svelte.js +0 -249
- package/dist/resolution/frameworks/svelte.js.map +0 -1
- package/dist/resolution/frameworks/swift.d.ts +0 -10
- package/dist/resolution/frameworks/swift.d.ts.map +0 -1
- package/dist/resolution/frameworks/swift.js +0 -376
- package/dist/resolution/frameworks/swift.js.map +0 -1
- package/dist/resolution/frameworks/vue.d.ts +0 -9
- package/dist/resolution/frameworks/vue.d.ts.map +0 -1
- package/dist/resolution/frameworks/vue.js +0 -306
- package/dist/resolution/frameworks/vue.js.map +0 -1
- package/dist/resolution/import-resolver.d.ts +0 -40
- package/dist/resolution/import-resolver.d.ts.map +0 -1
- package/dist/resolution/import-resolver.js +0 -663
- package/dist/resolution/import-resolver.js.map +0 -1
- package/dist/resolution/index.d.ts +0 -106
- package/dist/resolution/index.d.ts.map +0 -1
- package/dist/resolution/index.js +0 -709
- package/dist/resolution/index.js.map +0 -1
- package/dist/resolution/name-matcher.d.ts +0 -32
- package/dist/resolution/name-matcher.d.ts.map +0 -1
- package/dist/resolution/name-matcher.js +0 -384
- package/dist/resolution/name-matcher.js.map +0 -1
- package/dist/resolution/path-aliases.d.ts +0 -68
- package/dist/resolution/path-aliases.d.ts.map +0 -1
- package/dist/resolution/path-aliases.js +0 -238
- package/dist/resolution/path-aliases.js.map +0 -1
- package/dist/resolution/strip-comments.d.ts +0 -27
- package/dist/resolution/strip-comments.d.ts.map +0 -1
- package/dist/resolution/strip-comments.js +0 -441
- package/dist/resolution/strip-comments.js.map +0 -1
- package/dist/resolution/types.d.ts +0 -172
- package/dist/resolution/types.d.ts.map +0 -1
- package/dist/resolution/types.js +0 -8
- package/dist/resolution/types.js.map +0 -1
- package/dist/search/query-parser.d.ts +0 -57
- package/dist/search/query-parser.d.ts.map +0 -1
- package/dist/search/query-parser.js +0 -177
- package/dist/search/query-parser.js.map +0 -1
- package/dist/search/query-utils.d.ts +0 -53
- package/dist/search/query-utils.d.ts.map +0 -1
- package/dist/search/query-utils.js +0 -347
- package/dist/search/query-utils.js.map +0 -1
- package/dist/sync/index.d.ts +0 -13
- package/dist/sync/index.d.ts.map +0 -1
- package/dist/sync/index.js +0 -17
- package/dist/sync/index.js.map +0 -1
- package/dist/sync/watcher.d.ts +0 -81
- package/dist/sync/watcher.d.ts.map +0 -1
- package/dist/sync/watcher.js +0 -184
- package/dist/sync/watcher.js.map +0 -1
- package/dist/types.d.ts +0 -423
- package/dist/types.d.ts.map +0 -1
- package/dist/types.js +0 -256
- package/dist/types.js.map +0 -1
- package/dist/ui/glyphs.d.ts +0 -42
- package/dist/ui/glyphs.d.ts.map +0 -1
- package/dist/ui/glyphs.js +0 -78
- package/dist/ui/glyphs.js.map +0 -1
- package/dist/ui/shimmer-progress.d.ts +0 -11
- package/dist/ui/shimmer-progress.d.ts.map +0 -1
- package/dist/ui/shimmer-progress.js +0 -90
- package/dist/ui/shimmer-progress.js.map +0 -1
- package/dist/ui/shimmer-worker.d.ts +0 -2
- package/dist/ui/shimmer-worker.d.ts.map +0 -1
- package/dist/ui/shimmer-worker.js +0 -118
- package/dist/ui/shimmer-worker.js.map +0 -1
- package/dist/ui/types.d.ts +0 -17
- package/dist/ui/types.d.ts.map +0 -1
- package/dist/ui/types.js +0 -3
- package/dist/ui/types.js.map +0 -1
- package/dist/utils.d.ts +0 -205
- package/dist/utils.d.ts.map +0 -1
- package/dist/utils.js +0 -549
- package/dist/utils.js.map +0 -1
- package/scripts/local-install.sh +0 -41
- package/scripts/patch-tree-sitter-dart.js +0 -112
- package/scripts/release.sh +0 -70
|
@@ -1,179 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Tree-sitter Extraction Types
|
|
3
|
-
*
|
|
4
|
-
* Defines the LanguageExtractor interface and related types used by
|
|
5
|
-
* the core TreeSitterExtractor and per-language extraction configs.
|
|
6
|
-
* Extracted to a leaf module to avoid circular imports.
|
|
7
|
-
*/
|
|
8
|
-
import { Node as SyntaxNode } from 'web-tree-sitter';
|
|
9
|
-
import { Node, NodeKind, UnresolvedReference } from '../types';
|
|
10
|
-
/**
|
|
11
|
-
* Information returned by a language's extractImport hook.
|
|
12
|
-
*/
|
|
13
|
-
export interface ImportInfo {
|
|
14
|
-
/** The module/package name being imported */
|
|
15
|
-
moduleName: string;
|
|
16
|
-
/** Full import statement text for display */
|
|
17
|
-
signature: string;
|
|
18
|
-
/** If true, the hook already created unresolved references itself */
|
|
19
|
-
handledRefs?: boolean;
|
|
20
|
-
}
|
|
21
|
-
/**
|
|
22
|
-
* Information about a single variable within a declaration.
|
|
23
|
-
* Returned by a language's extractVariables hook.
|
|
24
|
-
*/
|
|
25
|
-
export interface VariableInfo {
|
|
26
|
-
/** Variable name */
|
|
27
|
-
name: string;
|
|
28
|
-
/** Node kind: 'variable' or 'constant' */
|
|
29
|
-
kind: NodeKind;
|
|
30
|
-
/** Optional signature string */
|
|
31
|
-
signature?: string;
|
|
32
|
-
/** If set, this declarator is actually a function and should be extracted as such */
|
|
33
|
-
delegateToFunction?: SyntaxNode;
|
|
34
|
-
/** The AST node to use for positioning (may differ from the declaration node) */
|
|
35
|
-
positionNode?: SyntaxNode;
|
|
36
|
-
}
|
|
37
|
-
/**
|
|
38
|
-
* Context object passed to language hooks that need to call back into the core extractor.
|
|
39
|
-
* Provides a controlled API surface — hooks can create nodes, visit children, and add
|
|
40
|
-
* references without accessing the full TreeSitterExtractor internals.
|
|
41
|
-
*/
|
|
42
|
-
export interface ExtractorContext {
|
|
43
|
-
/** Create a node and add it to the extraction result */
|
|
44
|
-
createNode(kind: NodeKind, name: string, node: SyntaxNode, extra?: Partial<Node>): Node | null;
|
|
45
|
-
/** Visit a child node (dispatches through the standard visitNode logic) */
|
|
46
|
-
visitNode(node: SyntaxNode): void;
|
|
47
|
-
/** Visit a function body to extract calls */
|
|
48
|
-
visitFunctionBody(body: SyntaxNode, functionId: string): void;
|
|
49
|
-
/** Add an unresolved reference */
|
|
50
|
-
addUnresolvedReference(ref: UnresolvedReference): void;
|
|
51
|
-
/** Push a node ID onto the scope stack (for containment/qualified name building) */
|
|
52
|
-
pushScope(nodeId: string): void;
|
|
53
|
-
/** Pop the last node ID from the scope stack */
|
|
54
|
-
popScope(): void;
|
|
55
|
-
/** Current file path */
|
|
56
|
-
readonly filePath: string;
|
|
57
|
-
/** Current source text */
|
|
58
|
-
readonly source: string;
|
|
59
|
-
/** Stack of parent node IDs (current scope) */
|
|
60
|
-
readonly nodeStack: readonly string[];
|
|
61
|
-
/** All nodes extracted so far */
|
|
62
|
-
readonly nodes: readonly Node[];
|
|
63
|
-
}
|
|
64
|
-
/**
|
|
65
|
-
* Language-specific extraction configuration.
|
|
66
|
-
*
|
|
67
|
-
* Each supported language provides an implementation of this interface
|
|
68
|
-
* that configures which AST node types to look for and how to extract
|
|
69
|
-
* language-specific details like signatures, visibility, and imports.
|
|
70
|
-
*/
|
|
71
|
-
export interface LanguageExtractor {
|
|
72
|
-
/** Node types that represent functions */
|
|
73
|
-
functionTypes: string[];
|
|
74
|
-
/** Node types that represent classes */
|
|
75
|
-
classTypes: string[];
|
|
76
|
-
/** Node types that represent methods */
|
|
77
|
-
methodTypes: string[];
|
|
78
|
-
/** Node types that represent interfaces/protocols/traits */
|
|
79
|
-
interfaceTypes: string[];
|
|
80
|
-
/** Node types that represent structs */
|
|
81
|
-
structTypes: string[];
|
|
82
|
-
/** Node types that represent enums */
|
|
83
|
-
enumTypes: string[];
|
|
84
|
-
/** Node types that represent enum members/cases (e.g. Swift: 'enum_entry', Rust: 'enum_variant') */
|
|
85
|
-
enumMemberTypes?: string[];
|
|
86
|
-
/** Node types that represent type aliases (e.g. `type X = ...`) */
|
|
87
|
-
typeAliasTypes: string[];
|
|
88
|
-
/** Node types that represent imports */
|
|
89
|
-
importTypes: string[];
|
|
90
|
-
/** Node types that represent function calls */
|
|
91
|
-
callTypes: string[];
|
|
92
|
-
/** Node types that represent variable declarations (const, let, var, etc.) */
|
|
93
|
-
variableTypes: string[];
|
|
94
|
-
/** Node types that represent class fields (extracted as 'field' kind inside class bodies) */
|
|
95
|
-
fieldTypes?: string[];
|
|
96
|
-
/** Node types that represent class properties (extracted as 'property' kind inside class bodies) */
|
|
97
|
-
propertyTypes?: string[];
|
|
98
|
-
/** Field name for identifier/name */
|
|
99
|
-
nameField: string;
|
|
100
|
-
/** Field name for body */
|
|
101
|
-
bodyField: string;
|
|
102
|
-
/** Field name for parameters */
|
|
103
|
-
paramsField: string;
|
|
104
|
-
/** Field name for return type */
|
|
105
|
-
returnField?: string;
|
|
106
|
-
/** Extract signature from node */
|
|
107
|
-
getSignature?: (node: SyntaxNode, source: string) => string | undefined;
|
|
108
|
-
/** Extract visibility from node */
|
|
109
|
-
getVisibility?: (node: SyntaxNode) => 'public' | 'private' | 'protected' | 'internal' | undefined;
|
|
110
|
-
/** Check if node is exported */
|
|
111
|
-
isExported?: (node: SyntaxNode, source: string) => boolean;
|
|
112
|
-
/** Check if node is async */
|
|
113
|
-
isAsync?: (node: SyntaxNode) => boolean;
|
|
114
|
-
/** Check if node is static */
|
|
115
|
-
isStatic?: (node: SyntaxNode) => boolean;
|
|
116
|
-
/** Check if variable declaration is a constant (const vs let/var) */
|
|
117
|
-
isConst?: (node: SyntaxNode) => boolean;
|
|
118
|
-
/** Additional node types to treat as class declarations (e.g. Dart: 'mixin_declaration') */
|
|
119
|
-
extraClassNodeTypes?: string[];
|
|
120
|
-
/** Whether methods can be top-level without enclosing class (Go: true) */
|
|
121
|
-
methodsAreTopLevel?: boolean;
|
|
122
|
-
/** NodeKind to use for interface-like declarations (Rust: 'trait'). Default: 'interface' */
|
|
123
|
-
interfaceKind?: NodeKind;
|
|
124
|
-
/**
|
|
125
|
-
* Custom node visitor. Return true if the node was fully handled (skip default dispatch).
|
|
126
|
-
* Used by languages with fundamentally different AST structures (e.g. Pascal).
|
|
127
|
-
*/
|
|
128
|
-
visitNode?: (node: SyntaxNode, ctx: ExtractorContext) => boolean;
|
|
129
|
-
/**
|
|
130
|
-
* Classify a class_declaration node when the grammar reuses one node type
|
|
131
|
-
* for multiple concepts (e.g. Swift uses class_declaration for classes, structs, and enums).
|
|
132
|
-
*/
|
|
133
|
-
classifyClassNode?: (node: SyntaxNode) => 'class' | 'struct' | 'enum' | 'interface' | 'trait';
|
|
134
|
-
/**
|
|
135
|
-
* Resolve the body node for a function/method/class when it's not a child field.
|
|
136
|
-
* (e.g. Dart puts function_body as a sibling, not a child.)
|
|
137
|
-
*/
|
|
138
|
-
resolveBody?: (node: SyntaxNode, bodyField: string) => SyntaxNode | null;
|
|
139
|
-
/**
|
|
140
|
-
* Extract import information from an import node.
|
|
141
|
-
* Return null if the node isn't a recognized import form.
|
|
142
|
-
*/
|
|
143
|
-
extractImport?: (node: SyntaxNode, source: string) => ImportInfo | null;
|
|
144
|
-
/**
|
|
145
|
-
* Extract variable declarations from a variable declaration node.
|
|
146
|
-
* Returns info about each declared variable, allowing the core to create nodes.
|
|
147
|
-
*/
|
|
148
|
-
extractVariables?: (node: SyntaxNode, source: string) => VariableInfo[];
|
|
149
|
-
/**
|
|
150
|
-
* Extract receiver/owner type name from a method declaration.
|
|
151
|
-
* Used by Go to get the struct receiver (e.g., "scrapeLoop" from "func (sl *scrapeLoop) run()").
|
|
152
|
-
* When present, the receiver type is included in the qualified name for better searchability.
|
|
153
|
-
*/
|
|
154
|
-
getReceiverType?: (node: SyntaxNode, source: string) => string | undefined;
|
|
155
|
-
/**
|
|
156
|
-
* Resolve the actual node kind for a type alias declaration.
|
|
157
|
-
* Used by Go where `type_spec` is the named declaration wrapper for structs/interfaces:
|
|
158
|
-
* `type Foo struct { ... }` → type_spec (name: "Foo") → struct_type
|
|
159
|
-
* Returns 'struct', 'interface', etc. to override the default 'type_alias' kind,
|
|
160
|
-
* or undefined to keep it as a type alias.
|
|
161
|
-
*/
|
|
162
|
-
resolveTypeAliasKind?: (node: SyntaxNode, source: string) => NodeKind | undefined;
|
|
163
|
-
/**
|
|
164
|
-
* Check if a function/method name is a misparse artifact that should be skipped.
|
|
165
|
-
* Used by C/C++ where macros (e.g. NLOHMANN_JSON_NAMESPACE_BEGIN) cause tree-sitter
|
|
166
|
-
* to misparse namespace blocks as function_definitions. When this returns true,
|
|
167
|
-
* the function node is NOT created, but the body is still visited for calls and
|
|
168
|
-
* structural nodes (classes, structs, enums).
|
|
169
|
-
*/
|
|
170
|
-
isMisparsedFunction?: (name: string, node: SyntaxNode) => boolean;
|
|
171
|
-
/**
|
|
172
|
-
* Detect bare method calls that don't use call expression syntax.
|
|
173
|
-
* Used by Ruby where `reset` (no parens, no receiver) is a method call but
|
|
174
|
-
* tree-sitter parses it as a plain `identifier` node instead of `call`/`method_call`.
|
|
175
|
-
* Returns the callee name if this node is a bare call, or undefined if not.
|
|
176
|
-
*/
|
|
177
|
-
extractBareCall?: (node: SyntaxNode, source: string) => string | undefined;
|
|
178
|
-
}
|
|
179
|
-
//# sourceMappingURL=tree-sitter-types.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"tree-sitter-types.d.ts","sourceRoot":"","sources":["../../src/extraction/tree-sitter-types.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,IAAI,IAAI,UAAU,EAAE,MAAM,iBAAiB,CAAC;AACrD,OAAO,EACL,IAAI,EACJ,QAAQ,EACR,mBAAmB,EACpB,MAAM,UAAU,CAAC;AAElB;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB,6CAA6C;IAC7C,UAAU,EAAE,MAAM,CAAC;IACnB,6CAA6C;IAC7C,SAAS,EAAE,MAAM,CAAC;IAClB,qEAAqE;IACrE,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AAED;;;GAGG;AACH,MAAM,WAAW,YAAY;IAC3B,oBAAoB;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,0CAA0C;IAC1C,IAAI,EAAE,QAAQ,CAAC;IACf,gCAAgC;IAChC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,qFAAqF;IACrF,kBAAkB,CAAC,EAAE,UAAU,CAAC;IAChC,iFAAiF;IACjF,YAAY,CAAC,EAAE,UAAU,CAAC;CAC3B;AAED;;;;GAIG;AACH,MAAM,WAAW,g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|
|
6
|
-
* the core TreeSitterExtractor and per-language extraction configs.
|
|
7
|
-
* Extracted to a leaf module to avoid circular imports.
|
|
8
|
-
*/
|
|
9
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
-
//# sourceMappingURL=tree-sitter-types.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"tree-sitter-types.js","sourceRoot":"","sources":["../../src/extraction/tree-sitter-types.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG"}
|
|
@@ -1,233 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Tree-sitter Parser Wrapper
|
|
3
|
-
*
|
|
4
|
-
* Handles parsing source code and extracting structural information.
|
|
5
|
-
*/
|
|
6
|
-
import { Language, ExtractionResult } from '../types';
|
|
7
|
-
export { generateNodeId } from './tree-sitter-helpers';
|
|
8
|
-
/**
|
|
9
|
-
* TreeSitterExtractor - Main extraction class
|
|
10
|
-
*/
|
|
11
|
-
export declare class TreeSitterExtractor {
|
|
12
|
-
private filePath;
|
|
13
|
-
private language;
|
|
14
|
-
private source;
|
|
15
|
-
private tree;
|
|
16
|
-
private nodes;
|
|
17
|
-
private edges;
|
|
18
|
-
private unresolvedReferences;
|
|
19
|
-
private errors;
|
|
20
|
-
private extractor;
|
|
21
|
-
private nodeStack;
|
|
22
|
-
private methodIndex;
|
|
23
|
-
constructor(filePath: string, source: string, language?: Language);
|
|
24
|
-
/**
|
|
25
|
-
* Parse and extract from the source code
|
|
26
|
-
*/
|
|
27
|
-
extract(): ExtractionResult;
|
|
28
|
-
/**
|
|
29
|
-
* Visit a node and extract information
|
|
30
|
-
*/
|
|
31
|
-
private visitNode;
|
|
32
|
-
/**
|
|
33
|
-
* Create a Node object
|
|
34
|
-
*/
|
|
35
|
-
private createNode;
|
|
36
|
-
/**
|
|
37
|
-
* Find first named child whose type is in the given list.
|
|
38
|
-
* Used to locate inner type nodes (e.g. enum_specifier inside a typedef).
|
|
39
|
-
*/
|
|
40
|
-
private findChildByTypes;
|
|
41
|
-
/**
|
|
42
|
-
* Build qualified name from node stack
|
|
43
|
-
*/
|
|
44
|
-
private buildQualifiedName;
|
|
45
|
-
/**
|
|
46
|
-
* Build an ExtractorContext for passing to language-specific visitNode hooks.
|
|
47
|
-
*/
|
|
48
|
-
private makeExtractorContext;
|
|
49
|
-
/**
|
|
50
|
-
* Check if the current node stack indicates we are inside a class-like node
|
|
51
|
-
* (class, struct, interface, trait). File nodes do not count as class-like.
|
|
52
|
-
*/
|
|
53
|
-
private isInsideClassLikeNode;
|
|
54
|
-
/**
|
|
55
|
-
* Extract a function
|
|
56
|
-
*/
|
|
57
|
-
private extractFunction;
|
|
58
|
-
/**
|
|
59
|
-
* Extract a class
|
|
60
|
-
*/
|
|
61
|
-
private extractClass;
|
|
62
|
-
/**
|
|
63
|
-
* Extract a method
|
|
64
|
-
*/
|
|
65
|
-
private extractMethod;
|
|
66
|
-
/**
|
|
67
|
-
* Extract an interface/protocol/trait
|
|
68
|
-
*/
|
|
69
|
-
private extractInterface;
|
|
70
|
-
/**
|
|
71
|
-
* Extract a struct
|
|
72
|
-
*/
|
|
73
|
-
private extractStruct;
|
|
74
|
-
/**
|
|
75
|
-
* Extract an enum
|
|
76
|
-
*/
|
|
77
|
-
private extractEnum;
|
|
78
|
-
/**
|
|
79
|
-
* Extract enum member names from an enum member node.
|
|
80
|
-
* Handles multi-case declarations (Swift: `case put, delete`) and single-case patterns.
|
|
81
|
-
*/
|
|
82
|
-
private extractEnumMembers;
|
|
83
|
-
/**
|
|
84
|
-
* Extract a class property declaration (e.g. C# `public string Name { get; set; }`).
|
|
85
|
-
* Extracts as 'property' kind node inside the owning class.
|
|
86
|
-
*/
|
|
87
|
-
private extractProperty;
|
|
88
|
-
/**
|
|
89
|
-
* Extract a class field declaration (e.g. Java field_declaration, C# field_declaration).
|
|
90
|
-
* Extracts each declarator as a 'field' kind node inside the owning class.
|
|
91
|
-
*/
|
|
92
|
-
private extractField;
|
|
93
|
-
/**
|
|
94
|
-
* Extract a variable declaration (const, let, var, etc.)
|
|
95
|
-
*
|
|
96
|
-
* Extracts top-level and module-level variable declarations.
|
|
97
|
-
* Captures the variable name and first 100 chars of initializer in signature for searchability.
|
|
98
|
-
*/
|
|
99
|
-
private extractVariable;
|
|
100
|
-
/**
|
|
101
|
-
* Extract a type alias (e.g. `export type X = ...` in TypeScript).
|
|
102
|
-
* For languages like Go, resolveTypeAliasKind detects when the type_spec
|
|
103
|
-
* wraps a struct or interface definition and creates the correct node kind.
|
|
104
|
-
* Returns true if children should be skipped (struct/interface handled body visiting).
|
|
105
|
-
*/
|
|
106
|
-
private extractTypeAlias;
|
|
107
|
-
/**
|
|
108
|
-
* Extract an import
|
|
109
|
-
*
|
|
110
|
-
* Creates an import node with the full import statement stored in signature for searchability.
|
|
111
|
-
* Also creates unresolved references for resolution purposes.
|
|
112
|
-
*/
|
|
113
|
-
private extractImport;
|
|
114
|
-
/**
|
|
115
|
-
* Extract a function call
|
|
116
|
-
*/
|
|
117
|
-
private extractCall;
|
|
118
|
-
/**
|
|
119
|
-
* `new Foo(...)` / `Foo::new(...)` / object_creation_expression —
|
|
120
|
-
* emit an `instantiates` reference to the class name. The resolver
|
|
121
|
-
* then links it to the class node, producing the `instantiates`
|
|
122
|
-
* edge that powers "what creates instances of X" queries.
|
|
123
|
-
*
|
|
124
|
-
* Children are still walked so nested calls inside the constructor
|
|
125
|
-
* arguments (`new Foo(bar())`) get their own `calls` references.
|
|
126
|
-
*/
|
|
127
|
-
private extractInstantiation;
|
|
128
|
-
/**
|
|
129
|
-
* Scan `declNode` and its preceding siblings (within the parent's
|
|
130
|
-
* named children) for decorator nodes, emitting a `decorates`
|
|
131
|
-
* reference from `decoratedId` to each decorator's function name.
|
|
132
|
-
*
|
|
133
|
-
* Why preceding siblings: in TypeScript, `@Foo class Bar {}` parses
|
|
134
|
-
* as an `export_statement` (or top-level wrapper) with the
|
|
135
|
-
* `decorator` as a child *before* the `class_declaration` — so the
|
|
136
|
-
* decorator isn't a child of the class itself. For methods/
|
|
137
|
-
* properties, the decorator IS a direct child of the declaration,
|
|
138
|
-
* so we also scan declNode.namedChildren.
|
|
139
|
-
*
|
|
140
|
-
* Idempotent across grammars: if neither location yields decorators
|
|
141
|
-
* (most non-decorator-using languages), the function is a no-op.
|
|
142
|
-
*/
|
|
143
|
-
private extractDecoratorsFor;
|
|
144
|
-
/**
|
|
145
|
-
* Visit function body and extract calls (and structural nodes).
|
|
146
|
-
*
|
|
147
|
-
* In addition to call expressions, this also detects class/struct/enum
|
|
148
|
-
* definitions inside function bodies. This handles two cases:
|
|
149
|
-
* 1. Local class/struct/enum definitions (valid in C++, Java, etc.)
|
|
150
|
-
* 2. C++ macro misparsing — macros like NLOHMANN_JSON_NAMESPACE_BEGIN cause
|
|
151
|
-
* tree-sitter to interpret the namespace block as a function_definition,
|
|
152
|
-
* hiding real class/struct/enum nodes inside the "function body".
|
|
153
|
-
*/
|
|
154
|
-
private visitFunctionBody;
|
|
155
|
-
/**
|
|
156
|
-
* Extract inheritance relationships
|
|
157
|
-
*/
|
|
158
|
-
private extractInheritance;
|
|
159
|
-
/**
|
|
160
|
-
* Rust `impl Trait for Type` — creates an implements edge from Type to Trait.
|
|
161
|
-
* For plain `impl Type { ... }` (no trait), no inheritance edge is needed.
|
|
162
|
-
*/
|
|
163
|
-
private extractRustImplItem;
|
|
164
|
-
/**
|
|
165
|
-
* Find a previously-extracted node by name (used for back-references like impl blocks)
|
|
166
|
-
*/
|
|
167
|
-
private findNodeByName;
|
|
168
|
-
/**
|
|
169
|
-
* Languages that support type annotations (TypeScript, etc.)
|
|
170
|
-
*/
|
|
171
|
-
private readonly TYPE_ANNOTATION_LANGUAGES;
|
|
172
|
-
/**
|
|
173
|
-
* Built-in/primitive type names that shouldn't create references
|
|
174
|
-
*/
|
|
175
|
-
private readonly BUILTIN_TYPES;
|
|
176
|
-
/**
|
|
177
|
-
* Extract type references from type annotations on a function/method/field node.
|
|
178
|
-
* Creates 'references' edges for parameter types, return types, and field types.
|
|
179
|
-
*/
|
|
180
|
-
private extractTypeAnnotations;
|
|
181
|
-
/**
|
|
182
|
-
* Extract type references from a variable's type annotation.
|
|
183
|
-
*/
|
|
184
|
-
private extractVariableTypeAnnotation;
|
|
185
|
-
/**
|
|
186
|
-
* Recursively walk a subtree and extract all type_identifier references.
|
|
187
|
-
* Handles unions, intersections, generics, arrays, etc.
|
|
188
|
-
*/
|
|
189
|
-
private extractTypeRefsFromSubtree;
|
|
190
|
-
/**
|
|
191
|
-
* Handle Pascal-specific AST structures.
|
|
192
|
-
* Returns true if the node was fully handled and children should be skipped.
|
|
193
|
-
*/
|
|
194
|
-
private visitPascalNode;
|
|
195
|
-
/**
|
|
196
|
-
* Extract a Pascal declType node (class, interface, enum, or type alias)
|
|
197
|
-
*/
|
|
198
|
-
private extractPascalDeclType;
|
|
199
|
-
/**
|
|
200
|
-
* Extract Pascal uses clause into individual import nodes
|
|
201
|
-
*/
|
|
202
|
-
private extractPascalUses;
|
|
203
|
-
/**
|
|
204
|
-
* Extract a Pascal constant declaration
|
|
205
|
-
*/
|
|
206
|
-
private extractPascalConst;
|
|
207
|
-
/**
|
|
208
|
-
* Extract Pascal inheritance (extends/implements) from declClass typeref children
|
|
209
|
-
*/
|
|
210
|
-
private extractPascalInheritance;
|
|
211
|
-
/**
|
|
212
|
-
* Extract calls and resolve method context from a Pascal defProc (implementation body).
|
|
213
|
-
* Does not create a new node — the declaration was already captured from the interface section.
|
|
214
|
-
*/
|
|
215
|
-
private extractPascalDefProc;
|
|
216
|
-
/**
|
|
217
|
-
* Extract function calls from a Pascal expression
|
|
218
|
-
*/
|
|
219
|
-
private extractPascalCall;
|
|
220
|
-
/**
|
|
221
|
-
* Recursively visit a Pascal block/statement tree for call expressions
|
|
222
|
-
*/
|
|
223
|
-
private visitPascalBlock;
|
|
224
|
-
}
|
|
225
|
-
/**
|
|
226
|
-
* Extract nodes and edges from source code.
|
|
227
|
-
*
|
|
228
|
-
* If `frameworkNames` is provided, framework-specific extractors matching
|
|
229
|
-
* those names and the file's language are run after the tree-sitter pass.
|
|
230
|
-
* Their nodes/references/errors are merged into the returned result.
|
|
231
|
-
*/
|
|
232
|
-
export declare function extractFromSource(filePath: string, source: string, language?: Language, frameworkNames?: string[]): ExtractionResult;
|
|
233
|
-
//# sourceMappingURL=tree-sitter.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
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,MAAM,UAAU,CAAC;AAelB,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAkFvD;;GAEG;AACH,qBAAa,mBAAmB;IAC9B,OAAO,CAAC,QAAQ,CAAS;IACzB,OAAO,CAAC,QAAQ,CAAW;IAC3B,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,IAAI,CAAqB;IACjC,OAAO,CAAC,KAAK,CAAc;IAC3B,OAAO,CAAC,KAAK,CAAc;IAC3B,OAAO,CAAC,oBAAoB,CAA6B;IACzD,OAAO,CAAC,MAAM,CAAyB;IACvC,OAAO,CAAC,SAAS,CAAkC;IACnD,OAAO,CAAC,SAAS,CAAgB;IACjC,OAAO,CAAC,WAAW,CAAoC;gBAE3C,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,QAAQ;IAOjE;;OAEG;IACH,OAAO,IAAI,gBAAgB;IAqG3B;;OAEG;IACH,OAAO,CAAC,SAAS;IA+IjB;;OAEG;IACH,OAAO,CAAC,UAAU;IA8ClB;;;OAGG;IACH,OAAO,CAAC,gBAAgB;IAQxB;;OAEG;IACH,OAAO,CAAC,kBAAkB;IAc1B;;OAEG;IACH,OAAO,CAAC,oBAAoB;IAiB5B;;;OAGG;IACH,OAAO,CAAC,qBAAqB;IAgB7B;;OAEG;IACH,O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