@aroman22/codegraph-vba 1.3.4 → 1.4.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 +19 -1
- package/dist/bin/node-version-check.d.ts +9 -6
- package/dist/db/migrations.d.ts +1 -1
- package/dist/db/queries.d.ts +5 -17
- package/dist/extraction/vba-extractor.d.ts +22 -2
- package/dist/types.d.ts +2 -2
- package/dist/utils/backtrace-helpers.d.ts +35 -0
- package/dist/utils/sql-impact-helpers.d.ts +38 -0
- package/package.json +7 -7
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`
|
|
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
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
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 =
|
|
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
|
package/dist/db/migrations.d.ts
CHANGED
package/dist/db/queries.d.ts
CHANGED
|
@@ -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
|
-
*
|
|
248
|
-
*
|
|
249
|
-
*
|
|
250
|
-
*
|
|
251
|
-
*
|
|
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.
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { SqliteDatabase } from '../db';
|
|
2
|
+
/**
|
|
3
|
+
* VBA Handler Backtrace Helper Functions
|
|
4
|
+
*/
|
|
5
|
+
export interface VariableInfo {
|
|
6
|
+
name: string;
|
|
7
|
+
type: string;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Parses parameters from a VBA subroutine/function signature,
|
|
11
|
+
* extracting parameters of custom types (filtering out primitive types).
|
|
12
|
+
*/
|
|
13
|
+
export declare function parseSignatureParams(signature: string): VariableInfo[];
|
|
14
|
+
/**
|
|
15
|
+
* Reconstructs a multiline SQL query string concatenated using VBA line continuation
|
|
16
|
+
* and string concatenation operators. Accumulates up to a limit of 200 characters.
|
|
17
|
+
*/
|
|
18
|
+
export declare function reconstructSQL(lines: string[]): string;
|
|
19
|
+
export interface TraversalNode {
|
|
20
|
+
id: string;
|
|
21
|
+
name: string;
|
|
22
|
+
kind: string;
|
|
23
|
+
children: TraversalNode[];
|
|
24
|
+
}
|
|
25
|
+
export interface TraversalResult {
|
|
26
|
+
tree: TraversalNode | null;
|
|
27
|
+
cycle_detected: boolean;
|
|
28
|
+
warnings: string[];
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Traverses VBA call/relationship graphs starting from a specific node ID,
|
|
32
|
+
* tracking cycles and capping search depth.
|
|
33
|
+
*/
|
|
34
|
+
export declare function traverseGraph(db: SqliteDatabase, startNodeId: string, maxDepth?: number): TraversalResult;
|
|
35
|
+
//# sourceMappingURL=backtrace-helpers.d.ts.map
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Interface representing the extracted bindings of a VBA form or report layout.
|
|
3
|
+
*/
|
|
4
|
+
export interface FormBindings {
|
|
5
|
+
recordSource?: string;
|
|
6
|
+
rowSources: Array<{
|
|
7
|
+
control: string;
|
|
8
|
+
target: string;
|
|
9
|
+
}>;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Interface representing the SQL lineage analysis result.
|
|
13
|
+
*/
|
|
14
|
+
export interface SqlLineage {
|
|
15
|
+
tables: string[];
|
|
16
|
+
lineage: Array<{
|
|
17
|
+
source: string;
|
|
18
|
+
resolved: string;
|
|
19
|
+
}>;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Traces references to the target query name inside a VBA module's content.
|
|
23
|
+
* Returns 1-based line numbers where references are found.
|
|
24
|
+
*/
|
|
25
|
+
export declare function traceVbaCallers(content: string, queryName: string): number[];
|
|
26
|
+
/**
|
|
27
|
+
* Parses a VBA form definition (.form.txt/.report.txt) and extracts RecordSource and RowSource bindings.
|
|
28
|
+
*/
|
|
29
|
+
export declare function extractFormBindings(content: string): FormBindings;
|
|
30
|
+
/**
|
|
31
|
+
* Resolves table and column aliases from a SQL string to build a column-level lineage.
|
|
32
|
+
*/
|
|
33
|
+
export declare function resolveSqlLineage(sql: string): SqlLineage;
|
|
34
|
+
/**
|
|
35
|
+
* Runs a combined database and file-level downstream impact analysis.
|
|
36
|
+
*/
|
|
37
|
+
export declare function runImpactAnalysis(db: any, workspaceDir: string, queryName: string): any;
|
|
38
|
+
//# sourceMappingURL=sql-impact-helpers.d.ts.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aroman22/codegraph-vba",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.4.0",
|
|
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.
|
|
19
|
-
"@aroman22/codegraph-vba-darwin-x64": "1.
|
|
20
|
-
"@aroman22/codegraph-vba-linux-arm64": "1.
|
|
21
|
-
"@aroman22/codegraph-vba-linux-x64": "1.
|
|
22
|
-
"@aroman22/codegraph-vba-win32-arm64": "1.
|
|
23
|
-
"@aroman22/codegraph-vba-win32-x64": "1.
|
|
18
|
+
"@aroman22/codegraph-vba-darwin-arm64": "1.4.0",
|
|
19
|
+
"@aroman22/codegraph-vba-darwin-x64": "1.4.0",
|
|
20
|
+
"@aroman22/codegraph-vba-linux-arm64": "1.4.0",
|
|
21
|
+
"@aroman22/codegraph-vba-linux-x64": "1.4.0",
|
|
22
|
+
"@aroman22/codegraph-vba-win32-arm64": "1.4.0",
|
|
23
|
+
"@aroman22/codegraph-vba-win32-x64": "1.4.0"
|
|
24
24
|
},
|
|
25
25
|
"files": [
|
|
26
26
|
"npm-shim.js",
|