@nahisaho/musubix-dfg 1.8.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.
@@ -0,0 +1,312 @@
1
+ /**
2
+ * Type definitions for DFG/CFG analysis
3
+ *
4
+ * @packageDocumentation
5
+ * @module @nahisaho/musubix-dfg/types
6
+ */
7
+ /**
8
+ * Unique identifier for graph nodes
9
+ */
10
+ export type NodeId = string;
11
+ /**
12
+ * Unique identifier for graph edges
13
+ */
14
+ export type EdgeId = string;
15
+ /**
16
+ * Source location in code
17
+ */
18
+ export interface SourceLocation {
19
+ /** File path */
20
+ filePath: string;
21
+ /** Start line (1-based) */
22
+ startLine: number;
23
+ /** Start column (0-based) */
24
+ startColumn: number;
25
+ /** End line (1-based) */
26
+ endLine: number;
27
+ /** End column (0-based) */
28
+ endColumn: number;
29
+ }
30
+ /**
31
+ * Node types in Data Flow Graph
32
+ */
33
+ export type DFGNodeType = 'variable' | 'parameter' | 'literal' | 'expression' | 'call' | 'return' | 'assignment' | 'property-access' | 'array-access' | 'binary-operation' | 'unary-operation' | 'conditional' | 'function' | 'class' | 'import' | 'export';
34
+ /**
35
+ * Edge types in Data Flow Graph
36
+ */
37
+ export type DFGEdgeType = 'def-use' | 'use-def' | 'data-dep' | 'call-arg' | 'call-return' | 'property' | 'alias' | 'phi' | 'control-dep';
38
+ /**
39
+ * Data type information for nodes
40
+ */
41
+ export interface TypeInfo {
42
+ /** Type name */
43
+ name: string;
44
+ /** Full qualified type */
45
+ fullType: string;
46
+ /** Is nullable */
47
+ nullable: boolean;
48
+ /** Generic type arguments */
49
+ typeArguments?: TypeInfo[];
50
+ /** Is array type */
51
+ isArray: boolean;
52
+ /** Is promise type */
53
+ isPromise: boolean;
54
+ }
55
+ /**
56
+ * Node in Data Flow Graph
57
+ */
58
+ export interface DFGNode {
59
+ /** Unique node identifier */
60
+ id: NodeId;
61
+ /** Node type */
62
+ type: DFGNodeType;
63
+ /** Node name/label */
64
+ name: string;
65
+ /** Source code location */
66
+ location: SourceLocation;
67
+ /** Type information */
68
+ typeInfo?: TypeInfo;
69
+ /** Scope path (e.g., 'module.class.method') */
70
+ scope: string;
71
+ /** Additional metadata */
72
+ metadata: Record<string, unknown>;
73
+ }
74
+ /**
75
+ * Edge in Data Flow Graph
76
+ */
77
+ export interface DFGEdge {
78
+ /** Unique edge identifier */
79
+ id: EdgeId;
80
+ /** Edge type */
81
+ type: DFGEdgeType;
82
+ /** Source node ID */
83
+ source: NodeId;
84
+ /** Target node ID */
85
+ target: NodeId;
86
+ /** Edge label/description */
87
+ label?: string;
88
+ /** Edge weight (for analysis) */
89
+ weight: number;
90
+ /** Additional metadata */
91
+ metadata: Record<string, unknown>;
92
+ }
93
+ /**
94
+ * Complete Data Flow Graph
95
+ */
96
+ export interface DataFlowGraph {
97
+ /** Graph identifier */
98
+ id: string;
99
+ /** Source file path */
100
+ filePath: string;
101
+ /** All nodes */
102
+ nodes: Map<NodeId, DFGNode>;
103
+ /** All edges */
104
+ edges: Map<EdgeId, DFGEdge>;
105
+ /** Entry points (function/module entries) */
106
+ entryPoints: NodeId[];
107
+ /** Exit points */
108
+ exitPoints: NodeId[];
109
+ /** Analysis metadata */
110
+ metadata: {
111
+ /** Analysis timestamp */
112
+ analyzedAt: Date;
113
+ /** Language version */
114
+ languageVersion: string;
115
+ /** Number of nodes */
116
+ nodeCount: number;
117
+ /** Number of edges */
118
+ edgeCount: number;
119
+ };
120
+ }
121
+ /**
122
+ * Basic block types in Control Flow Graph
123
+ */
124
+ export type CFGBlockType = 'entry' | 'exit' | 'basic' | 'conditional' | 'loop-header' | 'loop-body' | 'loop-exit' | 'switch' | 'case' | 'try' | 'catch' | 'finally' | 'throw';
125
+ /**
126
+ * Edge types in Control Flow Graph
127
+ */
128
+ export type CFGEdgeType = 'sequential' | 'conditional-true' | 'conditional-false' | 'loop-back' | 'loop-exit' | 'switch-case' | 'switch-default' | 'exception' | 'return' | 'break' | 'continue';
129
+ /**
130
+ * Statement in a basic block
131
+ */
132
+ export interface CFGStatement {
133
+ /** Statement index in block */
134
+ index: number;
135
+ /** Statement type */
136
+ type: string;
137
+ /** Source code text */
138
+ text: string;
139
+ /** Source location */
140
+ location: SourceLocation;
141
+ }
142
+ /**
143
+ * Basic block in Control Flow Graph
144
+ */
145
+ export interface CFGBlock {
146
+ /** Unique block identifier */
147
+ id: NodeId;
148
+ /** Block type */
149
+ type: CFGBlockType;
150
+ /** Block label */
151
+ label: string;
152
+ /** Statements in this block */
153
+ statements: CFGStatement[];
154
+ /** Predecessor block IDs */
155
+ predecessors: NodeId[];
156
+ /** Successor block IDs */
157
+ successors: NodeId[];
158
+ /** Dominator block ID */
159
+ dominator?: NodeId;
160
+ /** Post-dominator block ID */
161
+ postDominator?: NodeId;
162
+ /** Loop depth */
163
+ loopDepth: number;
164
+ /** Source location */
165
+ location: SourceLocation;
166
+ }
167
+ /**
168
+ * Edge in Control Flow Graph
169
+ */
170
+ export interface CFGEdge {
171
+ /** Unique edge identifier */
172
+ id: EdgeId;
173
+ /** Edge type */
174
+ type: CFGEdgeType;
175
+ /** Source block ID */
176
+ source: NodeId;
177
+ /** Target block ID */
178
+ target: NodeId;
179
+ /** Condition expression (for conditional edges) */
180
+ condition?: string;
181
+ /** Is back edge (loop) */
182
+ isBackEdge: boolean;
183
+ }
184
+ /**
185
+ * Complete Control Flow Graph
186
+ */
187
+ export interface ControlFlowGraph {
188
+ /** Graph identifier */
189
+ id: string;
190
+ /** Function/method name */
191
+ functionName: string;
192
+ /** Source file path */
193
+ filePath: string;
194
+ /** Entry block ID */
195
+ entryBlock: NodeId;
196
+ /** Exit block IDs */
197
+ exitBlocks: NodeId[];
198
+ /** All blocks */
199
+ blocks: Map<NodeId, CFGBlock>;
200
+ /** All edges */
201
+ edges: Map<EdgeId, CFGEdge>;
202
+ /** Analysis metadata */
203
+ metadata: {
204
+ /** Analysis timestamp */
205
+ analyzedAt: Date;
206
+ /** Cyclomatic complexity */
207
+ cyclomaticComplexity: number;
208
+ /** Maximum loop depth */
209
+ maxLoopDepth: number;
210
+ /** Number of blocks */
211
+ blockCount: number;
212
+ /** Number of edges */
213
+ edgeCount: number;
214
+ };
215
+ }
216
+ /**
217
+ * Options for DFG analysis
218
+ */
219
+ export interface DFGAnalysisOptions {
220
+ /** Include inter-procedural analysis */
221
+ interprocedural: boolean;
222
+ /** Track aliasing */
223
+ trackAliasing: boolean;
224
+ /** Include type information */
225
+ includeTypes: boolean;
226
+ /** Maximum analysis depth */
227
+ maxDepth: number;
228
+ /** Timeout in milliseconds */
229
+ timeout: number;
230
+ /** Include library/external dependencies */
231
+ includeExternal: boolean;
232
+ }
233
+ /**
234
+ * Options for CFG analysis
235
+ */
236
+ export interface CFGAnalysisOptions {
237
+ /** Compute dominators */
238
+ computeDominators: boolean;
239
+ /** Compute post-dominators */
240
+ computePostDominators: boolean;
241
+ /** Identify loops */
242
+ identifyLoops: boolean;
243
+ /** Include exception flow */
244
+ includeExceptions: boolean;
245
+ /** Maximum analysis depth */
246
+ maxDepth: number;
247
+ /** Timeout in milliseconds */
248
+ timeout: number;
249
+ }
250
+ /**
251
+ * Default DFG analysis options
252
+ */
253
+ export declare const DEFAULT_DFG_OPTIONS: DFGAnalysisOptions;
254
+ /**
255
+ * Default CFG analysis options
256
+ */
257
+ export declare const DEFAULT_CFG_OPTIONS: CFGAnalysisOptions;
258
+ /**
259
+ * Data dependency chain
260
+ */
261
+ export interface DataDependencyChain {
262
+ /** Starting variable/expression */
263
+ source: DFGNode;
264
+ /** Dependency chain */
265
+ chain: DFGEdge[];
266
+ /** End variable/expression */
267
+ target: DFGNode;
268
+ /** Chain length */
269
+ length: number;
270
+ }
271
+ /**
272
+ * Execution path through CFG
273
+ */
274
+ export interface ExecutionPath {
275
+ /** Path identifier */
276
+ id: string;
277
+ /** Blocks in path order */
278
+ blocks: CFGBlock[];
279
+ /** Edges in path */
280
+ edges: CFGEdge[];
281
+ /** Path conditions */
282
+ conditions: string[];
283
+ /** Is feasible path */
284
+ isFeasible: boolean;
285
+ }
286
+ /**
287
+ * Variable definition-use information
288
+ */
289
+ export interface DefUseInfo {
290
+ /** Variable name */
291
+ variable: string;
292
+ /** Definition node */
293
+ definition: DFGNode;
294
+ /** Use nodes */
295
+ uses: DFGNode[];
296
+ /** Is dead code (no uses) */
297
+ isDeadCode: boolean;
298
+ }
299
+ /**
300
+ * Taint propagation result
301
+ */
302
+ export interface TaintPropagation {
303
+ /** Taint source */
304
+ source: DFGNode;
305
+ /** Taint sinks */
306
+ sinks: DFGNode[];
307
+ /** Propagation paths */
308
+ paths: DataDependencyChain[];
309
+ /** Sanitizers encountered */
310
+ sanitizers: DFGNode[];
311
+ }
312
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAMH;;GAEG;AACH,MAAM,MAAM,MAAM,GAAG,MAAM,CAAC;AAE5B;;GAEG;AACH,MAAM,MAAM,MAAM,GAAG,MAAM,CAAC;AAE5B;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,gBAAgB;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,2BAA2B;IAC3B,SAAS,EAAE,MAAM,CAAC;IAClB,6BAA6B;IAC7B,WAAW,EAAE,MAAM,CAAC;IACpB,yBAAyB;IACzB,OAAO,EAAE,MAAM,CAAC;IAChB,2BAA2B;IAC3B,SAAS,EAAE,MAAM,CAAC;CACnB;AAMD;;GAEG;AACH,MAAM,MAAM,WAAW,GACnB,UAAU,GACV,WAAW,GACX,SAAS,GACT,YAAY,GACZ,MAAM,GACN,QAAQ,GACR,YAAY,GACZ,iBAAiB,GACjB,cAAc,GACd,kBAAkB,GAClB,iBAAiB,GACjB,aAAa,GACb,UAAU,GACV,OAAO,GACP,QAAQ,GACR,QAAQ,CAAC;AAEb;;GAEG;AACH,MAAM,MAAM,WAAW,GACnB,SAAS,GACT,SAAS,GACT,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WAAW,aAAa;IAC5B,sBAAsB;IACtB,EAAE,EAAE,MAAM,CAAC;IACX,2BAA2B;IAC3B,MAAM,EAAE,QAAQ,EAAE,CAAC;IACnB,oBAAoB;IACpB,KAAK,EAAE,OAAO,EAAE,CAAC;IACjB,sBAAsB;IACtB,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,uBAAuB;IACvB,UAAU,EAAE,OAAO,CAAC;CACrB;AAED;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB,oBAAoB;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,sBAAsB;IACtB,UAAU,EAAE,OAAO,CAAC;IACpB,gBAAgB;IAChB,IAAI,EAAE,OAAO,EAAE,CAAC;IAChB,6BAA6B;IAC7B,UAAU,EAAE,OAAO,CAAC;CACrB;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,mBAAmB;IACnB,MAAM,EAAE,OAAO,CAAC;IAChB,kBAAkB;IAClB,KAAK,EAAE,OAAO,EAAE,CAAC;IACjB,wBAAwB;IACxB,KAAK,EAAE,mBAAmB,EAAE,CAAC;IAC7B,6BAA6B;IAC7B,UAAU,EAAE,OAAO,EAAE,CAAC;CACvB"}
@@ -0,0 +1,29 @@
1
+ /**
2
+ * Type definitions for DFG/CFG analysis
3
+ *
4
+ * @packageDocumentation
5
+ * @module @nahisaho/musubix-dfg/types
6
+ */
7
+ /**
8
+ * Default DFG analysis options
9
+ */
10
+ export const DEFAULT_DFG_OPTIONS = {
11
+ interprocedural: false,
12
+ trackAliasing: true,
13
+ includeTypes: true,
14
+ maxDepth: 10,
15
+ timeout: 30000,
16
+ includeExternal: false,
17
+ };
18
+ /**
19
+ * Default CFG analysis options
20
+ */
21
+ export const DEFAULT_CFG_OPTIONS = {
22
+ computeDominators: true,
23
+ computePostDominators: true,
24
+ identifyLoops: true,
25
+ includeExceptions: true,
26
+ maxDepth: 10,
27
+ timeout: 30000,
28
+ };
29
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAuUH;;GAEG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAuB;IACrD,eAAe,EAAE,KAAK;IACtB,aAAa,EAAE,IAAI;IACnB,YAAY,EAAE,IAAI;IAClB,QAAQ,EAAE,EAAE;IACZ,OAAO,EAAE,KAAK;IACd,eAAe,EAAE,KAAK;CACvB,CAAC;AAEF;;GAEG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAuB;IACrD,iBAAiB,EAAE,IAAI;IACvB,qBAAqB,EAAE,IAAI;IAC3B,aAAa,EAAE,IAAI;IACnB,iBAAiB,EAAE,IAAI;IACvB,QAAQ,EAAE,EAAE;IACZ,OAAO,EAAE,KAAK;CACf,CAAC"}
@@ -0,0 +1,135 @@
1
+ /**
2
+ * YATA Knowledge Graph integration for DFG/CFG
3
+ *
4
+ * @packageDocumentation
5
+ * @module @nahisaho/musubix-dfg/yata
6
+ */
7
+ import type { DataFlowGraph, ControlFlowGraph } from '../types/index.js';
8
+ /**
9
+ * RDF Triple for YATA knowledge graph
10
+ */
11
+ export interface Triple {
12
+ subject: string;
13
+ predicate: string;
14
+ object: string;
15
+ graph?: string;
16
+ }
17
+ /**
18
+ * Namespace prefixes for DFG/CFG triples
19
+ */
20
+ export declare const DFG_NAMESPACES: {
21
+ readonly dfg: "https://musubix.dev/ontology/dfg#";
22
+ readonly cfg: "https://musubix.dev/ontology/cfg#";
23
+ readonly code: "https://musubix.dev/ontology/code#";
24
+ readonly rdf: "http://www.w3.org/1999/02/22-rdf-syntax-ns#";
25
+ readonly rdfs: "http://www.w3.org/2000/01/rdf-schema#";
26
+ readonly xsd: "http://www.w3.org/2001/XMLSchema#";
27
+ };
28
+ /**
29
+ * Options for YATA export
30
+ */
31
+ export interface YATAExportOptions {
32
+ /** Include source location information */
33
+ includeLocation: boolean;
34
+ /** Include type information */
35
+ includeTypes: boolean;
36
+ /** Include metadata */
37
+ includeMetadata: boolean;
38
+ /** Graph namespace */
39
+ graphNamespace: string;
40
+ }
41
+ /**
42
+ * Default export options
43
+ */
44
+ export declare const DEFAULT_EXPORT_OPTIONS: YATAExportOptions;
45
+ /**
46
+ * Convert Data Flow Graph to YATA triples
47
+ *
48
+ * @example
49
+ * ```typescript
50
+ * const converter = new DFGToYATAConverter();
51
+ * const triples = converter.convert(dfg);
52
+ *
53
+ * // Import to YATA
54
+ * await yataLocal.importTriples(triples);
55
+ * ```
56
+ *
57
+ * @traces REQ-DFG-003
58
+ */
59
+ export declare class DFGToYATAConverter {
60
+ private options;
61
+ constructor(options?: Partial<YATAExportOptions>);
62
+ /**
63
+ * Convert DFG to triples
64
+ */
65
+ convert(dfg: DataFlowGraph): Triple[];
66
+ private convertDFGNode;
67
+ private convertDFGEdge;
68
+ private capitalize;
69
+ private edgeTypeToClass;
70
+ private escapeString;
71
+ }
72
+ /**
73
+ * Convert Control Flow Graph to YATA triples
74
+ *
75
+ * @traces REQ-DFG-003
76
+ */
77
+ export declare class CFGToYATAConverter {
78
+ private options;
79
+ constructor(options?: Partial<YATAExportOptions>);
80
+ /**
81
+ * Convert CFG to triples
82
+ */
83
+ convert(cfg: ControlFlowGraph): Triple[];
84
+ private convertCFGBlock;
85
+ private convertCFGEdge;
86
+ private capitalize;
87
+ private edgeTypeToClass;
88
+ private escapeString;
89
+ }
90
+ /**
91
+ * YATA integration helper for DFG/CFG
92
+ *
93
+ * @example
94
+ * ```typescript
95
+ * import { YATALocal } from '@nahisaho/yata-local';
96
+ *
97
+ * const yata = new YATALocal('myproject.db');
98
+ * const integrator = new YATAIntegrator(yata);
99
+ *
100
+ * // Import DFG
101
+ * await integrator.importDFG(dfg);
102
+ *
103
+ * // Query related code
104
+ * const results = await integrator.queryRelatedCode('userId');
105
+ * ```
106
+ */
107
+ export declare class YATAIntegrator {
108
+ private readonly yataClient?;
109
+ private dfgConverter;
110
+ private cfgConverter;
111
+ constructor(yataClient?: unknown | undefined, // YATALocal type when available
112
+ options?: Partial<YATAExportOptions>);
113
+ /**
114
+ * Import DFG to YATA knowledge graph
115
+ */
116
+ importDFG(dfg: DataFlowGraph): Promise<void>;
117
+ /**
118
+ * Import CFG to YATA knowledge graph
119
+ */
120
+ importCFG(cfg: ControlFlowGraph): Promise<void>;
121
+ /**
122
+ * Import multiple graphs
123
+ */
124
+ importAll(dfgs: DataFlowGraph[], cfgs: ControlFlowGraph[]): Promise<void>;
125
+ /**
126
+ * Export triples without importing
127
+ */
128
+ exportToTriples(dfg: DataFlowGraph): Triple[];
129
+ /**
130
+ * Export to N-Triples format
131
+ */
132
+ exportToNTriples(dfg: DataFlowGraph): string;
133
+ private importTriples;
134
+ }
135
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/yata/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EACV,aAAa,EACb,gBAAgB,EAKjB,MAAM,mBAAmB,CAAC;AAM3B;;GAEG;AACH,MAAM,WAAW,MAAM;IACrB,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;GAEG;AACH,eAAO,MAAM,cAAc;;;;;;;CAOjB,CAAC;AAMX;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,0CAA0C;IAC1C,eAAe,EAAE,OAAO,CAAC;IACzB,+BAA+B;IAC/B,YAAY,EAAE,OAAO,CAAC;IACtB,uBAAuB;IACvB,eAAe,EAAE,OAAO,CAAC;IACzB,sBAAsB;IACtB,cAAc,EAAE,MAAM,CAAC;CACxB;AAED;;GAEG;AACH,eAAO,MAAM,sBAAsB,EAAE,iBAKpC,CAAC;AAEF;;;;;;;;;;;;;GAaG;AACH,qBAAa,kBAAkB;IAC7B,OAAO,CAAC,OAAO,CAAoB;gB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