@supacloud/compiler 0.8.0 → 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 +63 -1
- package/dist/cli.js +606 -44
- package/dist/feature.d.ts +8 -0
- package/dist/fixes.d.ts +13 -0
- package/dist/index.d.ts +6 -3
- package/dist/index.js +573 -83
- package/dist/inspect.d.ts +17 -1
- package/dist/traits.d.ts +1 -1
- package/dist/types.d.ts +68 -0
- package/package.json +2 -1
package/dist/inspect.d.ts
CHANGED
|
@@ -1,4 +1,15 @@
|
|
|
1
|
-
import type { ApplicationGraph, Diagnostic } from "./types";
|
|
1
|
+
import type { ApplicationGraph, Diagnostic, ModuleNode } from "./types";
|
|
2
|
+
export interface ContextPack {
|
|
3
|
+
version: 1;
|
|
4
|
+
subject: string;
|
|
5
|
+
modules: ModuleNode[];
|
|
6
|
+
files: string[];
|
|
7
|
+
externalTokens: string[];
|
|
8
|
+
relatedModules: {
|
|
9
|
+
importedBy: string[];
|
|
10
|
+
imports: string[];
|
|
11
|
+
};
|
|
12
|
+
}
|
|
2
13
|
export interface DoctorResult {
|
|
3
14
|
checks: Array<{
|
|
4
15
|
name: string;
|
|
@@ -10,6 +21,11 @@ export interface DoctorResult {
|
|
|
10
21
|
}
|
|
11
22
|
export declare function formatGraph(graph: ApplicationGraph): string;
|
|
12
23
|
export declare function explainGraph(graph: ApplicationGraph, subject: string): string;
|
|
24
|
+
/**
|
|
25
|
+
* Extracts the smallest graph neighborhood that is useful for an agent
|
|
26
|
+
* editing one feature: the subject module, its imports, and its dependents.
|
|
27
|
+
*/
|
|
28
|
+
export declare function createContextPack(graph: ApplicationGraph, subject: string): ContextPack;
|
|
13
29
|
export declare function doctorProject(rootDir: string, outDir: string, graph: ApplicationGraph, upToDate: boolean, diagnostics?: Diagnostic[]): DoctorResult;
|
|
14
30
|
/**
|
|
15
31
|
* Exports the application module architecture as a Mermaid graph diagram.
|
package/dist/traits.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as ts from "@typescript/typescript6";
|
|
2
|
-
export type TraitKind = "module" | "injectable" | "controller" | "command" | "query" | "defineModule" | "injectionToken";
|
|
2
|
+
export type TraitKind = "module" | "injectable" | "controller" | "command" | "query" | "defineModule" | "defineFeatureSlice" | "injectionToken";
|
|
3
3
|
export interface TraitRecord {
|
|
4
4
|
kind: TraitKind;
|
|
5
5
|
name: string;
|
package/dist/types.d.ts
CHANGED
|
@@ -42,7 +42,56 @@ export interface Diagnostic {
|
|
|
42
42
|
errorCode?: string;
|
|
43
43
|
/** Documentation URL for this diagnostic. */
|
|
44
44
|
docsUrl?: string;
|
|
45
|
+
/** Machine-readable remediation that an agent or IDE can apply. */
|
|
46
|
+
fix?: DiagnosticFix;
|
|
45
47
|
}
|
|
48
|
+
/**
|
|
49
|
+
* Stable, semantic repair actions. These intentionally describe intent rather
|
|
50
|
+
* than raw text offsets so fixes remain valid after unrelated edits.
|
|
51
|
+
*/
|
|
52
|
+
export type DiagnosticFix = {
|
|
53
|
+
type: "add_module_import";
|
|
54
|
+
targetFile: string;
|
|
55
|
+
module: string;
|
|
56
|
+
provider?: string;
|
|
57
|
+
importPath?: string;
|
|
58
|
+
symbol?: string;
|
|
59
|
+
targetModule?: string;
|
|
60
|
+
} | {
|
|
61
|
+
type: "add_provider";
|
|
62
|
+
targetFile: string;
|
|
63
|
+
token: string;
|
|
64
|
+
module: string;
|
|
65
|
+
} | {
|
|
66
|
+
type: "mark_optional_dependency";
|
|
67
|
+
targetFile: string;
|
|
68
|
+
owner: string;
|
|
69
|
+
token: string;
|
|
70
|
+
} | {
|
|
71
|
+
type: "change_provider_scope";
|
|
72
|
+
targetFile: string;
|
|
73
|
+
provider: string;
|
|
74
|
+
from: Scope;
|
|
75
|
+
to: Scope;
|
|
76
|
+
} | {
|
|
77
|
+
type: "add_command_permission";
|
|
78
|
+
targetFile: string;
|
|
79
|
+
command: string;
|
|
80
|
+
module: string;
|
|
81
|
+
permission?: string;
|
|
82
|
+
} | {
|
|
83
|
+
type: "add_route_parameter_binding";
|
|
84
|
+
targetFile: string;
|
|
85
|
+
controller: string;
|
|
86
|
+
route: string;
|
|
87
|
+
parameter: string;
|
|
88
|
+
binding: "param" | "query";
|
|
89
|
+
} | {
|
|
90
|
+
type: "remove_route_body_binding";
|
|
91
|
+
targetFile: string;
|
|
92
|
+
controller: string;
|
|
93
|
+
route: string;
|
|
94
|
+
};
|
|
46
95
|
export interface ProviderNode {
|
|
47
96
|
/** Token name (InjectionToken variable name or class name). */
|
|
48
97
|
token: string;
|
|
@@ -180,6 +229,24 @@ export interface QueryNode {
|
|
|
180
229
|
className: string;
|
|
181
230
|
name: string;
|
|
182
231
|
}
|
|
232
|
+
export interface FeatureTransitionNode {
|
|
233
|
+
name: string;
|
|
234
|
+
from: string;
|
|
235
|
+
to: string;
|
|
236
|
+
permission?: string;
|
|
237
|
+
command?: string;
|
|
238
|
+
route?: string;
|
|
239
|
+
transaction?: "required" | "none";
|
|
240
|
+
idempotency?: "required" | "none";
|
|
241
|
+
audit?: string;
|
|
242
|
+
}
|
|
243
|
+
export interface FeatureSpecNode {
|
|
244
|
+
name: string;
|
|
245
|
+
states: string[];
|
|
246
|
+
transitions: FeatureTransitionNode[];
|
|
247
|
+
file?: string;
|
|
248
|
+
line?: number;
|
|
249
|
+
}
|
|
183
250
|
export interface ModuleNode {
|
|
184
251
|
/** Name from @Module({ name }) or defineModule. */
|
|
185
252
|
name: string;
|
|
@@ -199,6 +266,7 @@ export interface ModuleNode {
|
|
|
199
266
|
aspects?: AspectRefNode[];
|
|
200
267
|
/** Exported token names. */
|
|
201
268
|
exports: string[];
|
|
269
|
+
featureSpec?: FeatureSpecNode;
|
|
202
270
|
}
|
|
203
271
|
export interface ApplicationGraph {
|
|
204
272
|
modules: ModuleNode[];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@supacloud/compiler",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.9.0",
|
|
4
4
|
"description": "Static compiler for @supacloud/app metadata: builds the application graph from AST, validates it, and generates reflection-free factory code",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -27,6 +27,7 @@
|
|
|
27
27
|
"clean": "rm -rf dist",
|
|
28
28
|
"prepublishOnly": "bun run build",
|
|
29
29
|
"test": "bun test",
|
|
30
|
+
"benchmark": "bun run src/benchmark.ts",
|
|
30
31
|
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
31
32
|
"typecheck:test": "tsc -p tsconfig.test.json --noEmit"
|
|
32
33
|
},
|