@aroman22/codegraph-vba 1.3.4 → 1.3.5

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 CHANGED
@@ -386,13 +386,31 @@ The two are **sibling tools**: Dysflow owns the Access binary round-trip (sync,
386
386
  | **`Implements IFoo`** | `.cls` declares `Implements IFoo` | — | Emits an `implements` edge from the class to `IFoo` |
387
387
  | **`Dim x As Foo.Bar`** | `.bas`/`.cls` qualified type reference | — | `references` edge to `Foo` with `synthesizedBy: 'vba-name-resolution'`; silent when unresolvable |
388
388
  | **`WithEvents m_X As Form_Foo`** | `.cls` listener declaration | — | `references` edge to `Form_Foo` with `synthesizedBy: 'vba-withevents'` — closes the event-driven form flow |
389
+ | **`Event Foo(...)` / `RaiseEvent Foo(...)`** | `.cls` custom event declaration + raise site | — | `event` node plus `raises-event` edges from the raising procedure; `WithEvents` also emits `subscribes-event` edges with the listener variable name |
390
+ | **`Type T ... End Type`** | `.bas`/`.cls` user-defined type declaration | — | `type` node plus `type_member` child nodes linked by `type-member` edges and member type metadata |
391
+ | **`Declare PtrSafe Function X Lib "dll"`** | `.bas`/`.cls` Win32/API declaration | — | `declare` node with DLL, alias, kind, and PtrSafe metadata; VBA call sites still emit `calls` edges to it |
392
+ | **`Enum` / `Const` domain dictionaries** | `.bas`/`.cls` enum blocks and module constants | — | `enum`, `enum_member`, and `constant` nodes linked to their module/class; constant string values are preserved in metadata for local resolution |
393
+ | **Saved Access QueryDefs** | `queries/<Name>.sql` | — | `query` node per Dysflow-exported `.sql` file with `references` edges to tables named by `FROM` / `JOIN` / `INTO` / `UPDATE` |
389
394
  | **`New Clase(...)`** | `.bas`/`.cls` instantiation | — | `references` edge with `synthesizedBy: 'vba-new-binding'` |
390
395
  | **SQL in VBA strings** | `.bas`/`.cls` SQL inside `DoCmd.RunSQL` / `CurrentDb.OpenRecordset` / `CurrentDb.Execute` / `db.Execute` | — | Table names extracted from `FROM`/`INTO`/`UPDATE <table>` → `references` edges with `synthesizedBy: 'vba-sql-table'` |
391
396
 
392
397
  **Hard invariants** enforced by the extractor and verified by tests:
393
398
 
394
399
  - **`.cls` is the canonical source for form code.** `.form.txt` emits **zero** `function` / `sub` / `class` nodes — only the form-level `module` node and `property` nodes per control. Dysflow overwrites `.form.txt`'s embedded code on the next import, so emitting code from there would be both wrong and ephemeral.
395
- - **A `.bas` with only `Public Const` declarations** (no Subs, Functions, Properties, Implements, or Dim) emits the `file` node only no `module` / `class` per REQ-CODE-10.
400
+ - **Option-only files stay silent.** A `.bas` containing only `Option ...` directives emits zero symbol nodes; a `.bas` with only `Enum`, `Const`, `Event`, `Type`, or `Declare` declarations DOES emit its module node because those declarations are real graph symbols.
401
+
402
+ **VBA / Access node kinds added by the fork:**
403
+
404
+ | Node kind | Meaning |
405
+ |---|---|
406
+ | `enum` / `enum_member` | VBA `Enum` block and its members |
407
+ | `constant` | VBA `Const` declaration; string values are kept in metadata when available |
408
+ | `query` | Dysflow-exported saved Access query (`queries/<Name>.sql`) |
409
+ | `event` | VBA custom `Event` declaration |
410
+ | `type` / `type_member` | VBA user-defined `Type ... End Type` and each declared member |
411
+ | `declare` | Win32/API `Declare` / `Declare PtrSafe` statement |
412
+ | `form-layout` | `.form.txt` / `.report.txt` form/report container |
413
+ | `form-instance-control` | Access control instance from form/report UI text |
396
414
 
397
415
  **Scope:** Dysflow-managed projects only (Dysflow's `.form.txt` / `.report.txt` SaveAsText format). Legacy `.frm` / `.dsr` Access binary formats are not in scope.
398
416
 
@@ -18,13 +18,16 @@
18
18
  */
19
19
  export declare function buildNode25BlockBanner(nodeVersion: string): string;
20
20
  /**
21
- * Lowest supported Node.js major version. Matches the `engines` floor in
22
- * package.json. Below this, CodeGraph relies on language features / native APIs
23
- * that aren't present, and the combination is untested. `engines` alone only
24
- * *warns* on install (unless the user set `engine-strict`), so the CLI bootstrap
25
- * also hard-blocks here to actually enforce the floor.
21
+ * Lowest supported Node.js version. Matches the `engines` floor in package.json.
22
+ * Node.js 22.5.0 is the first version with the built-in `node:sqlite` API used
23
+ * by CodeGraph. `engines` alone only *warns* on install (unless the user set
24
+ * `engine-strict`), so the CLI bootstrap also hard-blocks here to actually
25
+ * enforce the floor.
26
26
  */
27
- export declare const MIN_NODE_MAJOR = 20;
27
+ export declare const MIN_NODE_MAJOR = 22;
28
+ export declare const MIN_NODE_MINOR = 5;
29
+ export declare const MIN_NODE_VERSION = "22.5";
30
+ export declare function isBelowMinimumNodeVersion(nodeVersion: string): boolean;
28
31
  /**
29
32
  * Build the bordered banner shown when CodeGraph detects a Node.js major below
30
33
  * {@link MIN_NODE_MAJOR}. Pinned via unit test so the recovery commands and the
@@ -7,7 +7,7 @@ import { SqliteDatabase } from './sqlite-adapter';
7
7
  /**
8
8
  * Current schema version
9
9
  */
10
- export declare const CURRENT_SCHEMA_VERSION = 5;
10
+ export declare const CURRENT_SCHEMA_VERSION = 6;
11
11
  /**
12
12
  * Migration definition
13
13
  */
@@ -244,23 +244,11 @@ export declare class QueryBuilder {
244
244
  * Find VBA call-stub candidate nodes for `resolveVbaCallStubs` (vba-graph-
245
245
  * connectivity-fixes, #12).
246
246
  *
247
- * Design deviation note: the design's `getVbaCallStubs()` was specified as
248
- * `SELECT * FROM nodes WHERE ... metadata LIKE '%"stub":true%'`, mirroring
249
- * the JSON-in-JS convention used elsewhere (F2). That assumes a
250
- * `nodes.metadata` column but `nodes` has NO `metadata` column (only
251
- * `edges` does; see schema.sql). `Node.metadata` is genuinely never
252
- * persisted anywhere in this codebase today (the pre-existing
253
- * `DoCmd.OpenForm` stub's `metadata:{stub:true}` on its `form-layout`
254
- * node has the same characteristic — decorative at extraction time only).
255
- * Adding a nodes-wide schema column is out of scope for this targeted fix.
256
- *
257
- * Equivalent-semantics fix: a VBA call-stub node is, BY DEFINITION,
258
- * exactly a node that is the TARGET of a `calls` edge whose OWN metadata
259
- * (which DOES persist) carries `stub: true`. So this queries via a JOIN
260
- * against `edges.metadata` instead of a `nodes.metadata` column — same
261
- * LIKE-prefilter-then-correctness-check shape as the JSON-in-JS
262
- * convention, just anchored on the table that actually stores metadata
263
- * for this row type.
247
+ * A VBA call-stub node is, BY DEFINITION, a node targeted by a `calls`
248
+ * edge whose OWN metadata carries `stub: true`. Keep this anchored on
249
+ * `edges.metadata` even though `nodes.metadata` now exists: the stub flag
250
+ * is a relationship fact about an unresolved call, not an intrinsic fact
251
+ * about the target symbol.
264
252
  */
265
253
  getVbaCallStubs(): Node[];
266
254
  /**
@@ -57,8 +57,6 @@ export declare class VbaExtractor {
57
57
  private createModuleOrClassNode;
58
58
  /** Sub/Function/Property regex — captures visibility prefix, kind, and name. */
59
59
  private static readonly PROC_RE;
60
- /** `[visibility] Declare [PtrSafe] Sub|Function <Name> ...` DLL/API declaration. */
61
- private static readonly DLL_DECLARE_RE;
62
60
  /**
63
61
  * Walk the (uncommented, line-joined) source and emit one `function` node
64
62
  * per `Sub` / `Function` / `Property` declaration. Also records the proc
@@ -66,6 +64,24 @@ export declare class VbaExtractor {
66
64
  * cross-module calls.
67
65
  */
68
66
  private sweepProcedures;
67
+ /** `[visibility] Event <Name>(...)` custom event declaration. */
68
+ private static readonly EVENT_DECL_RE;
69
+ /** `[visibility] Type <Name>` user-defined type block start. */
70
+ private static readonly TYPE_START_RE;
71
+ /** `End Type` user-defined type block end. */
72
+ private static readonly TYPE_END_RE;
73
+ /** `<MemberName> As <Type>` inside a user-defined type block. */
74
+ private static readonly TYPE_MEMBER_RE;
75
+ /** `[visibility] Declare [PtrSafe] Sub|Function <Name> Lib "dll" [Alias "x"] ...` */
76
+ private static readonly DLL_DECLARE_RE;
77
+ /**
78
+ * Roadmap #26 declaration sweep:
79
+ * - Event declarations become `event` nodes and `RaiseEvent` can point to them.
80
+ * - Type...End Type blocks become `type` + `type_member` nodes.
81
+ * - Win32 API Declare statements become `declare` nodes, while still being
82
+ * cached by name so normal call-site scanning can emit `calls` edges.
83
+ */
84
+ private sweepEventsTypesAndDeclares;
69
85
  /** Implements regex. */
70
86
  private static readonly IMPLEMENTS_RE;
71
87
  /** Edges whose source needs to be set to the module/class id once it exists. */
@@ -253,6 +269,8 @@ export declare class VbaExtractor {
253
269
  */
254
270
  private resolveReceiverType;
255
271
  private sweepCallsAndSql;
272
+ private static readonly RAISE_EVENT_RE;
273
+ private scanRaiseEvents;
256
274
  private scanCallSites;
257
275
  /** Cache so we don't re-emit the same proc function node per call site. */
258
276
  private procNodeIdCache;
@@ -410,5 +428,7 @@ export declare class VbaExtractor {
410
428
  private localVarTypeMap;
411
429
  /** Local constant name (lowercase) → simple literal value for OpenForm resolution. */
412
430
  private localConstants;
431
+ /** Local event name (lowercase) → event node for `RaiseEvent` edge emission. */
432
+ private localEvents;
413
433
  }
414
434
  //# sourceMappingURL=vba-extractor.d.ts.map
package/dist/types.d.ts CHANGED
@@ -10,12 +10,12 @@
10
10
  * of truth backs both the TS type and any runtime validation
11
11
  * (e.g. the search query parser).
12
12
  */
13
- export declare const NODE_KINDS: readonly ["file", "module", "class", "struct", "interface", "trait", "protocol", "function", "method", "property", "field", "variable", "constant", "enum", "enum_member", "type_alias", "namespace", "parameter", "import", "export", "route", "component", "query", "form-layout", "form-instance-control"];
13
+ export declare const NODE_KINDS: readonly ["file", "module", "class", "struct", "interface", "trait", "protocol", "function", "method", "property", "field", "variable", "constant", "enum", "enum_member", "event", "type", "type_member", "declare", "type_alias", "namespace", "parameter", "import", "export", "route", "component", "query", "form-layout", "form-instance-control"];
14
14
  export type NodeKind = (typeof NODE_KINDS)[number];
15
15
  /**
16
16
  * Types of edges (relationships) between nodes
17
17
  */
18
- export type EdgeKind = 'contains' | 'calls' | 'imports' | 'exports' | 'extends' | 'implements' | 'references' | 'type_of' | 'returns' | 'instantiates' | 'overrides' | 'decorates' | 'event-handler' | 'opens-form';
18
+ export type EdgeKind = 'contains' | 'calls' | 'imports' | 'exports' | 'extends' | 'implements' | 'references' | 'type_of' | 'returns' | 'instantiates' | 'overrides' | 'decorates' | 'event-handler' | 'opens-form' | 'raises-event' | 'subscribes-event' | 'type-member';
19
19
  /**
20
20
  * Supported programming languages. See NODE_KINDS for why this is a
21
21
  * runtime-iterable const array.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aroman22/codegraph-vba",
3
- "version": "1.3.4",
3
+ "version": "1.3.5",
4
4
  "description": "Local-first code intelligence for AI agents (MCP). Self-contained — bundles its own runtime.",
5
5
  "bin": {
6
6
  "codegraph-vba": "npm-shim.js"
@@ -15,12 +15,12 @@
15
15
  "./package.json": "./package.json"
16
16
  },
17
17
  "optionalDependencies": {
18
- "@aroman22/codegraph-vba-darwin-arm64": "1.3.4",
19
- "@aroman22/codegraph-vba-darwin-x64": "1.3.4",
20
- "@aroman22/codegraph-vba-linux-arm64": "1.3.4",
21
- "@aroman22/codegraph-vba-linux-x64": "1.3.4",
22
- "@aroman22/codegraph-vba-win32-arm64": "1.3.4",
23
- "@aroman22/codegraph-vba-win32-x64": "1.3.4"
18
+ "@aroman22/codegraph-vba-darwin-arm64": "1.3.5",
19
+ "@aroman22/codegraph-vba-darwin-x64": "1.3.5",
20
+ "@aroman22/codegraph-vba-linux-arm64": "1.3.5",
21
+ "@aroman22/codegraph-vba-linux-x64": "1.3.5",
22
+ "@aroman22/codegraph-vba-win32-arm64": "1.3.5",
23
+ "@aroman22/codegraph-vba-win32-x64": "1.3.5"
24
24
  },
25
25
  "files": [
26
26
  "npm-shim.js",