@colbymchenry/codegraph-darwin-x64 1.1.2 → 1.1.4
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 +20 -7
- package/lib/dist/bin/codegraph.js.map +1 -1
- package/lib/dist/db/migrations.d.ts +1 -1
- package/lib/dist/db/migrations.d.ts.map +1 -1
- package/lib/dist/db/migrations.js +25 -1
- package/lib/dist/db/migrations.js.map +1 -1
- package/lib/dist/db/schema.sql +11 -0
- package/lib/dist/extraction/index.d.ts.map +1 -1
- package/lib/dist/extraction/index.js +130 -5
- package/lib/dist/extraction/index.js.map +1 -1
- package/lib/dist/extraction/languages/c-cpp.d.ts +16 -0
- package/lib/dist/extraction/languages/c-cpp.d.ts.map +1 -1
- package/lib/dist/extraction/languages/c-cpp.js +33 -0
- package/lib/dist/extraction/languages/c-cpp.js.map +1 -1
- package/lib/dist/extraction/tree-sitter.d.ts +21 -0
- package/lib/dist/extraction/tree-sitter.d.ts.map +1 -1
- package/lib/dist/extraction/tree-sitter.js +58 -2
- package/lib/dist/extraction/tree-sitter.js.map +1 -1
- package/lib/dist/mcp/daemon.d.ts +10 -0
- package/lib/dist/mcp/daemon.d.ts.map +1 -1
- package/lib/dist/mcp/daemon.js +39 -1
- package/lib/dist/mcp/daemon.js.map +1 -1
- package/lib/dist/mcp/tools.d.ts.map +1 -1
- package/lib/dist/mcp/tools.js +49 -3
- package/lib/dist/mcp/tools.js.map +1 -1
- package/lib/dist/sync/worktree.d.ts +9 -0
- package/lib/dist/sync/worktree.d.ts.map +1 -1
- package/lib/dist/sync/worktree.js +40 -0
- package/lib/dist/sync/worktree.js.map +1 -1
- package/lib/dist/types.d.ts +6 -1
- package/lib/dist/types.d.ts.map +1 -1
- package/lib/node_modules/.package-lock.json +1 -1
- package/lib/package.json +1 -1
- package/package.json +1 -1
|
@@ -46,6 +46,7 @@ const tree_sitter_helpers_1 = require("./tree-sitter-helpers");
|
|
|
46
46
|
const function_ref_1 = require("./function-ref");
|
|
47
47
|
const generated_detection_1 = require("./generated-detection");
|
|
48
48
|
const languages_1 = require("./languages");
|
|
49
|
+
const c_cpp_1 = require("./languages/c-cpp");
|
|
49
50
|
const liquid_extractor_1 = require("./liquid-extractor");
|
|
50
51
|
const razor_extractor_1 = require("./razor-extractor");
|
|
51
52
|
const svelte_extractor_1 = require("./svelte-extractor");
|
|
@@ -3850,6 +3851,45 @@ class TreeSitterExtractor {
|
|
|
3850
3851
|
});
|
|
3851
3852
|
}
|
|
3852
3853
|
}
|
|
3854
|
+
/**
|
|
3855
|
+
* Is this C++ `declaration` a stack/direct-initialization object construction
|
|
3856
|
+
* that invokes a constructor — `Calculator calc(0)` (direct-init) or
|
|
3857
|
+
* `Widget w{1, 2}` (brace-init) — as opposed to a plain variable or a
|
|
3858
|
+
* function declaration? Used to emit an `instantiates` edge for the
|
|
3859
|
+
* call-less construction syntax (#1035); heap `new T(...)` is handled
|
|
3860
|
+
* separately by INSTANTIATION_KINDS.
|
|
3861
|
+
*
|
|
3862
|
+
* Two signals, both required:
|
|
3863
|
+
* - the `type` field is a class-like NAMED type (`type_identifier`,
|
|
3864
|
+
* `template_type`, or `qualified_identifier`). Primitives (`int x(0)`),
|
|
3865
|
+
* `auto` (`placeholder_type_specifier` — that form always carries a real
|
|
3866
|
+
* `call_expression`, already handled), and sized specifiers are excluded —
|
|
3867
|
+
* they construct no class; and
|
|
3868
|
+
* - a declarator carries constructor arguments: an `init_declarator` whose
|
|
3869
|
+
* `value` is an `argument_list` (`(args)`) or `initializer_list` (`{args}`).
|
|
3870
|
+
* This skips default construction `Calculator c;` (no value) and the
|
|
3871
|
+
* most-vexing-parse `Calculator c();` (a bodyless `function_declarator`,
|
|
3872
|
+
* a function decl — not a construction).
|
|
3873
|
+
*/
|
|
3874
|
+
isCppStackConstruction(node) {
|
|
3875
|
+
const typeNode = (0, tree_sitter_helpers_1.getChildByField)(node, 'type');
|
|
3876
|
+
if (!typeNode ||
|
|
3877
|
+
(typeNode.type !== 'type_identifier' &&
|
|
3878
|
+
typeNode.type !== 'template_type' &&
|
|
3879
|
+
typeNode.type !== 'qualified_identifier')) {
|
|
3880
|
+
return false;
|
|
3881
|
+
}
|
|
3882
|
+
for (let i = 0; i < node.namedChildCount; i++) {
|
|
3883
|
+
const child = node.namedChild(i);
|
|
3884
|
+
if (child?.type !== 'init_declarator')
|
|
3885
|
+
continue;
|
|
3886
|
+
const value = (0, tree_sitter_helpers_1.getChildByField)(child, 'value');
|
|
3887
|
+
if (value && (value.type === 'argument_list' || value.type === 'initializer_list')) {
|
|
3888
|
+
return true;
|
|
3889
|
+
}
|
|
3890
|
+
}
|
|
3891
|
+
return false;
|
|
3892
|
+
}
|
|
3853
3893
|
/**
|
|
3854
3894
|
* Static-member / value-read pass. A type/enum/class used only via a member
|
|
3855
3895
|
* VALUE — `Enum.value`, `Type.CONST`, `Colors.red`, `Foo::BAR` — recorded no
|
|
@@ -4230,6 +4270,18 @@ class TreeSitterExtractor {
|
|
|
4230
4270
|
}
|
|
4231
4271
|
}
|
|
4232
4272
|
}
|
|
4273
|
+
// C++ stack / direct-initialization construction — `Calculator calc(0)`
|
|
4274
|
+
// and `Widget w{1, 2}`. Unlike heap `new Calculator(0)` (a new_expression
|
|
4275
|
+
// handled above), these carry the constructor arguments directly on the
|
|
4276
|
+
// declarator with NO call/new node, so the body walker saw no constructor
|
|
4277
|
+
// invocation and recorded no `instantiates` edge (#1035). A declaration's
|
|
4278
|
+
// `type` field IS the constructed class name, so reuse extractInstantiation
|
|
4279
|
+
// (which strips template args / namespace and emits the `instantiates`
|
|
4280
|
+
// ref). Children still recurse below, so a nested ctor-arg call
|
|
4281
|
+
// (`Calculator calc(make())`) keeps its own `calls` ref.
|
|
4282
|
+
if (nodeType === 'declaration' && this.language === 'cpp' && this.isCppStackConstruction(node)) {
|
|
4283
|
+
this.extractInstantiation(node);
|
|
4284
|
+
}
|
|
4233
4285
|
// Static-member / value-read: `Enum.value`, `Type.CONST`, `Foo::BAR`.
|
|
4234
4286
|
this.extractStaticMemberRef(node);
|
|
4235
4287
|
// Local variable type annotations inside a body — `const items: Foo[] = []`,
|
|
@@ -4424,7 +4476,11 @@ class TreeSitterExtractor {
|
|
|
4424
4476
|
}
|
|
4425
4477
|
// C++ base classes: `class Derived : public Base, private Other` →
|
|
4426
4478
|
// base_class_clause holds access specifiers + base type(s). Emit an extends
|
|
4427
|
-
// ref per base type (skip the public/private/protected keywords).
|
|
4479
|
+
// ref per base type (skip the public/private/protected keywords). A
|
|
4480
|
+
// templated base (`Base<int>`, `ns::Tpl<int>`) arrives as a `template_type`
|
|
4481
|
+
// or a `qualified_identifier` wrapping one; strip the `<…>` args so the ref
|
|
4482
|
+
// matches the bare class the template was defined as — `Base`, `ns::Tpl` —
|
|
4483
|
+
// instead of never resolving (#1043).
|
|
4428
4484
|
if (child.type === 'base_class_clause') {
|
|
4429
4485
|
for (const t of child.namedChildren) {
|
|
4430
4486
|
if (t.type === 'type_identifier' ||
|
|
@@ -4432,7 +4488,7 @@ class TreeSitterExtractor {
|
|
|
4432
4488
|
t.type === 'template_type') {
|
|
4433
4489
|
this.unresolvedReferences.push({
|
|
4434
4490
|
fromNodeId: classId,
|
|
4435
|
-
referenceName: (0, tree_sitter_helpers_1.getNodeText)(t, this.source),
|
|
4491
|
+
referenceName: (0, c_cpp_1.stripCppTemplateArgs)((0, tree_sitter_helpers_1.getNodeText)(t, this.source)),
|
|
4436
4492
|
referenceKind: 'extends',
|
|
4437
4493
|
line: t.startPosition.row + 1,
|
|
4438
4494
|
column: t.startPosition.column,
|