@mmapp/react-compiler 0.1.0-alpha.15 → 0.1.0-alpha.17
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/dist/{chunk-NUPJYPFU.mjs → chunk-6LAII7OP.mjs} +79 -1
- package/dist/{chunk-UBDNXVL2.mjs → chunk-FPAMQXKB.mjs} +89 -3
- package/dist/cli/index.js +240 -9
- package/dist/cli/index.mjs +57 -9
- package/dist/dev-server.js +79 -1
- package/dist/dev-server.mjs +1 -1
- package/dist/index.js +79 -1
- package/dist/index.mjs +1 -1
- package/dist/{init-2CRSUGV5.mjs → init-CJCDWI33.mjs} +119 -0
- package/package.json +2 -2
- package/dist/chunk-26U577GB.mjs +0 -3465
- package/dist/chunk-2FBDFAX6.mjs +0 -2362
- package/dist/chunk-2L4QSMXG.mjs +0 -175
- package/dist/chunk-2REDFOER.mjs +0 -931
- package/dist/chunk-3USIFFE4.mjs +0 -2190
- package/dist/chunk-45YMGEVT.mjs +0 -186
- package/dist/chunk-46YKSHQR.mjs +0 -175
- package/dist/chunk-4FN2AISW.mjs +0 -148
- package/dist/chunk-4OPI5L7G.mjs +0 -2593
- package/dist/chunk-4RYTKOOJ.mjs +0 -186
- package/dist/chunk-4XHK6FWL.mjs +0 -2058
- package/dist/chunk-52XHYD2V.mjs +0 -214
- package/dist/chunk-5FTDWKHH.mjs +0 -244
- package/dist/chunk-5GUFFFGL.mjs +0 -148
- package/dist/chunk-5RKTOVR5.mjs +0 -244
- package/dist/chunk-5VNJ7C6N.mjs +0 -154
- package/dist/chunk-5YDMOO4X.mjs +0 -214
- package/dist/chunk-64ZWEMLJ.mjs +0 -148
- package/dist/chunk-6CQOAAMV.mjs +0 -1803
- package/dist/chunk-6SEVAAVT.mjs +0 -3516
- package/dist/chunk-6XP4KSWQ.mjs +0 -2190
- package/dist/chunk-6YLR5ZDA.mjs +0 -2829
- package/dist/chunk-72QWL54I.mjs +0 -175
- package/dist/chunk-7B4TRI7C.mjs +0 -4835
- package/dist/chunk-7JRAEFRB.mjs +0 -7510
- package/dist/chunk-7ZKGHTNB.mjs +0 -4952
- package/dist/chunk-AOGY2GK6.mjs +0 -3292
- package/dist/chunk-AXXUXRNA.mjs +0 -1434
- package/dist/chunk-CHLVKMQW.mjs +0 -175
- package/dist/chunk-CKGOZAB7.mjs +0 -939
- package/dist/chunk-D34RAZUX.mjs +0 -2223
- package/dist/chunk-DE3ZGQAC.mjs +0 -148
- package/dist/chunk-DMCY3BBG.mjs +0 -1933
- package/dist/chunk-DPIK3PJS.mjs +0 -244
- package/dist/chunk-E5IVH4RE.mjs +0 -186
- package/dist/chunk-E6FZNUR5.mjs +0 -4953
- package/dist/chunk-EJRBDQDP.mjs +0 -2607
- package/dist/chunk-ELO4TXJL.mjs +0 -186
- package/dist/chunk-EO6SYNCG.mjs +0 -175
- package/dist/chunk-EQGA6A6D.mjs +0 -121
- package/dist/chunk-EY2CSXYA.mjs +0 -822
- package/dist/chunk-FIQ65CDR.mjs +0 -925
- package/dist/chunk-FKRO52XH.mjs +0 -3446
- package/dist/chunk-FL4YAKU6.mjs +0 -4941
- package/dist/chunk-FOZXJFAR.mjs +0 -186
- package/dist/chunk-FX6URXWN.mjs +0 -186
- package/dist/chunk-FYT47UBU.mjs +0 -5076
- package/dist/chunk-G7SMOWOL.mjs +0 -828
- package/dist/chunk-GCLGPOJZ.mjs +0 -148
- package/dist/chunk-GGB4G5YY.mjs +0 -175
- package/dist/chunk-GXB4JOP7.mjs +0 -5072
- package/dist/chunk-HFXOUMTD.mjs +0 -175
- package/dist/chunk-HLRGCCIL.mjs +0 -4839
- package/dist/chunk-HOIUP6IF.mjs +0 -690
- package/dist/chunk-HRYR54PT.mjs +0 -175
- package/dist/chunk-HWIZ47US.mjs +0 -214
- package/dist/chunk-I3AU7GRD.mjs +0 -120
- package/dist/chunk-IB7MNPQL.mjs +0 -4953
- package/dist/chunk-ICSIHQCG.mjs +0 -148
- package/dist/chunk-ILFGMUVD.mjs +0 -1933
- package/dist/chunk-IPTX5MJU.mjs +0 -3223
- package/dist/chunk-ITGUSH2Z.mjs +0 -2783
- package/dist/chunk-IXHBCAMF.mjs +0 -3306
- package/dist/chunk-J7JUAHS4.mjs +0 -186
- package/dist/chunk-J7TWJ3TM.mjs +0 -2784
- package/dist/chunk-JDPLDGVF.mjs +0 -4810
- package/dist/chunk-JLA5VNQ3.mjs +0 -186
- package/dist/chunk-JQLWFCTM.mjs +0 -214
- package/dist/chunk-K53XP2DL.mjs +0 -148
- package/dist/chunk-K5HX2SVL.mjs +0 -1902
- package/dist/chunk-KFGYOOVS.mjs +0 -214
- package/dist/chunk-KFJJCQAL.mjs +0 -148
- package/dist/chunk-KFVVOS5N.mjs +0 -925
- package/dist/chunk-KJUIIEQE.mjs +0 -186
- package/dist/chunk-KNWTHRVQ.mjs +0 -175
- package/dist/chunk-KSG4XSZF.mjs +0 -175
- package/dist/chunk-L2OZ4CDV.mjs +0 -113
- package/dist/chunk-LF5N6DOU.mjs +0 -175
- package/dist/chunk-LJQCM2IM.mjs +0 -214
- package/dist/chunk-MIZV3TAN.mjs +0 -3293
- package/dist/chunk-NKKLQE5V.mjs +0 -148
- package/dist/chunk-NOW23XFZ.mjs +0 -186
- package/dist/chunk-NRXQKQ74.mjs +0 -148
- package/dist/chunk-NTB7OEX2.mjs +0 -2918
- package/dist/chunk-NW6555WJ.mjs +0 -186
- package/dist/chunk-O4AUS7EU.mjs +0 -148
- package/dist/chunk-OMZE6VLQ.mjs +0 -214
- package/dist/chunk-OPJKP747.mjs +0 -7506
- package/dist/chunk-OWI6XWCD.mjs +0 -3375
- package/dist/chunk-P4BR7WVO.mjs +0 -2190
- package/dist/chunk-PRUMNNDI.mjs +0 -3192
- package/dist/chunk-QQHVYH2X.mjs +0 -244
- package/dist/chunk-QTBD5B3F.mjs +0 -148
- package/dist/chunk-R57T26RR.mjs +0 -734
- package/dist/chunk-S5QLWLLT.mjs +0 -186
- package/dist/chunk-SCWGT2FY.mjs +0 -2190
- package/dist/chunk-SKSDPPNT.mjs +0 -3788
- package/dist/chunk-SMKJUSB3.mjs +0 -2190
- package/dist/chunk-SP2YUS33.mjs +0 -186
- package/dist/chunk-SU4E6E7B.mjs +0 -3153
- package/dist/chunk-SYUUKW5A.mjs +0 -3379
- package/dist/chunk-THFYE5ZX.mjs +0 -244
- package/dist/chunk-UDDTWG5J.mjs +0 -734
- package/dist/chunk-UL2XZEMA.mjs +0 -3128
- package/dist/chunk-VCAY2KGM.mjs +0 -175
- package/dist/chunk-VLTKQDJ3.mjs +0 -244
- package/dist/chunk-WBYMW4NQ.mjs +0 -3450
- package/dist/chunk-WECAV6QB.mjs +0 -148
- package/dist/chunk-WMKBXUCE.mjs +0 -3228
- package/dist/chunk-XAJ5BKKL.mjs +0 -4947
- package/dist/chunk-XG2X7AEA.mjs +0 -175
- package/dist/chunk-XG7Z23NQ.mjs +0 -148
- package/dist/chunk-XMWUHQVV.mjs +0 -939
- package/dist/chunk-XWZAOCQ7.mjs +0 -2607
- package/dist/chunk-XZNEDRGN.mjs +0 -3876
- package/dist/chunk-Y6FXYEAI.mjs +0 -10
- package/dist/chunk-Y6MA7ULW.mjs +0 -148
- package/dist/chunk-YFS6JMYO.mjs +0 -3342
- package/dist/chunk-YMS7Q7LG.mjs +0 -214
- package/dist/chunk-Z2G5RZ4H.mjs +0 -186
- package/dist/chunk-Z6AIQ4KL.mjs +0 -113
- package/dist/chunk-ZA37XTGA.mjs +0 -175
- package/dist/chunk-ZE3KCHBM.mjs +0 -2918
- package/dist/config-PL24KEWL.mjs +0 -219
- package/dist/dev-server-Bs_sz2DG.d.mts +0 -111
- package/dist/dev-server-Bs_sz2DG.d.ts +0 -111
- package/dist/dev-server-CjoufJ-u.d.mts +0 -109
- package/dist/dev-server-CjoufJ-u.d.ts +0 -109
- package/dist/dev-server-RmGHIntF.d.mts +0 -113
- package/dist/dev-server-RmGHIntF.d.ts +0 -113
- package/dist/engine-binary-QQUDACBJ.mjs +0 -455
- package/dist/envelope-DD7v0v6E.d.mts +0 -265
- package/dist/envelope-DD7v0v6E.d.ts +0 -265
- package/dist/envelope-vCVjrHlo.d.mts +0 -265
- package/dist/envelope-vCVjrHlo.d.ts +0 -265
- package/dist/index-B5gSgvnd.d.mts +0 -44
- package/dist/index-B5gSgvnd.d.ts +0 -44
- package/dist/index-Bs0MnR54.d.mts +0 -103
- package/dist/index-Bs0MnR54.d.ts +0 -103
- package/dist/index-DR0nNc_f.d.mts +0 -101
- package/dist/index-DR0nNc_f.d.ts +0 -101
- package/dist/index-revho_gS.d.mts +0 -104
- package/dist/index-revho_gS.d.ts +0 -104
- package/dist/init-7FJENUDK.mjs +0 -407
- package/dist/init-7JQMAAXS.mjs +0 -363
- package/dist/init-DQDX3QK6.mjs +0 -369
- package/dist/init-EHO4VQ22.mjs +0 -369
- package/dist/init-IXEE2RCF.mjs +0 -340
- package/dist/init-UC3FWPIW.mjs +0 -367
- package/dist/init-UNSMVKIK.mjs +0 -366
- package/dist/init-UNV5XIDE.mjs +0 -367
- package/dist/project-compiler-2P4N4DR7.mjs +0 -10
- package/dist/project-compiler-D2LCC27O.mjs +0 -10
- package/dist/project-compiler-EGJUTAJU.mjs +0 -10
- package/dist/project-compiler-EJ3GANJE.mjs +0 -10
- package/dist/project-compiler-LOQKVRZJ.mjs +0 -10
- package/dist/project-compiler-NNK32MPG.mjs +0 -10
- package/dist/project-compiler-OP2VVGJQ.mjs +0 -10
- package/dist/project-compiler-RQ6OQKRM.mjs +0 -10
- package/dist/project-compiler-VFR6CSDX.mjs +0 -10
- package/dist/project-compiler-VWNNCHGO.mjs +0 -10
- package/dist/project-compiler-XVAAU4C5.mjs +0 -10
- package/dist/project-compiler-YES5FGMD.mjs +0 -10
- package/dist/project-compiler-ZKMQDLGU.mjs +0 -10
- package/dist/project-decompiler-5GY2KSG4.mjs +0 -7
- package/dist/project-decompiler-FLXCEJHS.mjs +0 -7
- package/dist/project-decompiler-US7GAVIC.mjs +0 -7
- package/dist/project-decompiler-VLPR22QF.mjs +0 -7
- package/dist/pull-A2QUHW4K.mjs +0 -109
- package/dist/pull-FUS5QYZS.mjs +0 -109
- package/dist/pull-JBEQWVPE.mjs +0 -109
- package/dist/pull-LD5ENLGY.mjs +0 -109
- package/dist/pull-P44LDRWB.mjs +0 -109
- package/dist/verify-BYHUKARQ.mjs +0 -1833
- package/dist/verify-SEIXUGN4.mjs +0 -1833
|
@@ -1,265 +0,0 @@
|
|
|
1
|
-
import { IRWorkflowDefinition } from '@mindmatrix/player-core';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* File System Tree — generates a manifest of project files with roles and hashes.
|
|
5
|
-
*
|
|
6
|
-
* The fs.tree is the first component of the source envelope.
|
|
7
|
-
* It maps every source file to its role in the workflow project.
|
|
8
|
-
*
|
|
9
|
-
* Roles:
|
|
10
|
-
* - view-entry: .workflow.tsx files (main workflow components)
|
|
11
|
-
* - model: models/*.ts files (workflow definitions)
|
|
12
|
-
* - server-action: *.server.ts files (backend action handlers)
|
|
13
|
-
* - layout: layout.tsx files (route layout boundaries)
|
|
14
|
-
* - page: page.tsx files (route page components)
|
|
15
|
-
* - config: mm.config.ts, blueprint.config.ts
|
|
16
|
-
* - component: regular .tsx components used by workflows
|
|
17
|
-
* - asset: static assets (images, styles, etc.)
|
|
18
|
-
* - unknown: unclassified files
|
|
19
|
-
*/
|
|
20
|
-
type FileRole = 'view-entry' | 'model' | 'server-action' | 'layout' | 'page' | 'config' | 'component' | 'test' | 'asset' | 'unknown';
|
|
21
|
-
interface FsTreeEntry {
|
|
22
|
-
/** Relative path from project root. */
|
|
23
|
-
path: string;
|
|
24
|
-
/** File role in the workflow project. */
|
|
25
|
-
role: FileRole;
|
|
26
|
-
/** SHA-256 content hash. */
|
|
27
|
-
hash: string;
|
|
28
|
-
/** File size in bytes. */
|
|
29
|
-
size: number;
|
|
30
|
-
/** Last modified timestamp. */
|
|
31
|
-
mtime: string;
|
|
32
|
-
/** Workflow slug (for view-entry and model files). */
|
|
33
|
-
slug?: string;
|
|
34
|
-
}
|
|
35
|
-
interface FsTree {
|
|
36
|
-
/** fs.tree format version. */
|
|
37
|
-
version: 1;
|
|
38
|
-
/** Project root directory (absolute). */
|
|
39
|
-
root: string;
|
|
40
|
-
/** Timestamp when the tree was generated. */
|
|
41
|
-
generatedAt: string;
|
|
42
|
-
/** File entries. */
|
|
43
|
-
entries: FsTreeEntry[];
|
|
44
|
-
/** Summary statistics. */
|
|
45
|
-
summary: {
|
|
46
|
-
totalFiles: number;
|
|
47
|
-
byRole: Record<FileRole, number>;
|
|
48
|
-
totalSize: number;
|
|
49
|
-
};
|
|
50
|
-
}
|
|
51
|
-
/**
|
|
52
|
-
* Determines the role of a file based on its path and naming convention.
|
|
53
|
-
*/
|
|
54
|
-
declare function detectFileRole(relativePath: string): FileRole;
|
|
55
|
-
/**
|
|
56
|
-
* Generates an FsTree from a list of file paths.
|
|
57
|
-
*/
|
|
58
|
-
declare function generateFsTree(files: string[], rootDir: string): FsTree;
|
|
59
|
-
/**
|
|
60
|
-
* Filters an FsTree to only include specific roles.
|
|
61
|
-
*/
|
|
62
|
-
declare function filterByRole(tree: FsTree, roles: FileRole[]): FsTreeEntry[];
|
|
63
|
-
/**
|
|
64
|
-
* Finds changed files between two FsTree snapshots.
|
|
65
|
-
*/
|
|
66
|
-
declare function diffFsTrees(before: FsTree, after: FsTree): {
|
|
67
|
-
added: FsTreeEntry[];
|
|
68
|
-
removed: FsTreeEntry[];
|
|
69
|
-
modified: FsTreeEntry[];
|
|
70
|
-
};
|
|
71
|
-
|
|
72
|
-
/**
|
|
73
|
-
* Source Envelope — bundles compiled workflows with source metadata.
|
|
74
|
-
*
|
|
75
|
-
* A source envelope is the unit of deployment. It contains:
|
|
76
|
-
* 1. All compiled workflow definitions (IR)
|
|
77
|
-
* 2. File manifest (fs.tree) with content hashes
|
|
78
|
-
* 3. Source bindings (semantic refs ↔ file spans)
|
|
79
|
-
* 4. Deployment metadata (version, timestamp, environment)
|
|
80
|
-
*
|
|
81
|
-
* The envelope enables:
|
|
82
|
-
* - Immutable versioning (content-addressed)
|
|
83
|
-
* - Source-level debugging (map IR back to .tsx source)
|
|
84
|
-
* - Differential deployment (only deploy changed workflows)
|
|
85
|
-
* - P2P sync (envelope is the unit of transfer)
|
|
86
|
-
*/
|
|
87
|
-
|
|
88
|
-
interface SourceEnvelope {
|
|
89
|
-
/** Envelope format version. */
|
|
90
|
-
version: 1;
|
|
91
|
-
/** Content-addressed envelope ID (SHA-256 of canonical content). */
|
|
92
|
-
envelopeId: string;
|
|
93
|
-
/** Blueprint slug this envelope belongs to. */
|
|
94
|
-
blueprintSlug: string;
|
|
95
|
-
/** Blueprint version. */
|
|
96
|
-
blueprintVersion: string;
|
|
97
|
-
/** When the envelope was created. */
|
|
98
|
-
createdAt: string;
|
|
99
|
-
/** Deployment target environment. */
|
|
100
|
-
environment?: string;
|
|
101
|
-
/** Compiled workflow definitions. */
|
|
102
|
-
definitions: IRWorkflowDefinition[];
|
|
103
|
-
/** File manifest. */
|
|
104
|
-
fsTree: FsTree;
|
|
105
|
-
/** Source bindings (IR element → source location). */
|
|
106
|
-
sourceBindings: SourceBinding[];
|
|
107
|
-
/** Deployment metadata. */
|
|
108
|
-
metadata: EnvelopeMetadata;
|
|
109
|
-
}
|
|
110
|
-
/**
|
|
111
|
-
* Maps an IR element to its source location.
|
|
112
|
-
*/
|
|
113
|
-
interface SourceBinding {
|
|
114
|
-
/** Type of IR element. */
|
|
115
|
-
kind: 'field' | 'state' | 'transition' | 'action' | 'component' | 'grammar-island';
|
|
116
|
-
/** Name/ID of the element. */
|
|
117
|
-
name: string;
|
|
118
|
-
/** Workflow slug this binding belongs to. */
|
|
119
|
-
workflowSlug: string;
|
|
120
|
-
/** Source file path (relative). */
|
|
121
|
-
file: string;
|
|
122
|
-
/** Start line (1-based). */
|
|
123
|
-
startLine: number;
|
|
124
|
-
/** Start column (0-based). */
|
|
125
|
-
startColumn: number;
|
|
126
|
-
/** End line (1-based). */
|
|
127
|
-
endLine?: number;
|
|
128
|
-
/** End column (0-based). */
|
|
129
|
-
endColumn?: number;
|
|
130
|
-
}
|
|
131
|
-
/**
|
|
132
|
-
* Deployment metadata.
|
|
133
|
-
*/
|
|
134
|
-
interface EnvelopeMetadata {
|
|
135
|
-
/** Total number of workflow definitions. */
|
|
136
|
-
definitionCount: number;
|
|
137
|
-
/** Total number of fields across all definitions. */
|
|
138
|
-
totalFields: number;
|
|
139
|
-
/** Total number of states across all definitions. */
|
|
140
|
-
totalStates: number;
|
|
141
|
-
/** Total number of transitions across all definitions. */
|
|
142
|
-
totalTransitions: number;
|
|
143
|
-
/** Compiler version. */
|
|
144
|
-
compilerVersion: string;
|
|
145
|
-
/** Build mode. */
|
|
146
|
-
mode: 'strict' | 'infer';
|
|
147
|
-
/** Whether any errors were detected. */
|
|
148
|
-
hasErrors: boolean;
|
|
149
|
-
/** Error/warning summary. */
|
|
150
|
-
diagnostics: DiagnosticSummary;
|
|
151
|
-
}
|
|
152
|
-
interface DiagnosticSummary {
|
|
153
|
-
errors: number;
|
|
154
|
-
warnings: number;
|
|
155
|
-
errorCodes: string[];
|
|
156
|
-
}
|
|
157
|
-
/**
|
|
158
|
-
* Creates a source envelope from compiled definitions.
|
|
159
|
-
*/
|
|
160
|
-
declare function createSourceEnvelope(params: {
|
|
161
|
-
blueprintSlug: string;
|
|
162
|
-
blueprintVersion: string;
|
|
163
|
-
definitions: IRWorkflowDefinition[];
|
|
164
|
-
fsTree: FsTree;
|
|
165
|
-
sourceBindings?: SourceBinding[];
|
|
166
|
-
environment?: string;
|
|
167
|
-
mode?: 'strict' | 'infer';
|
|
168
|
-
compilerVersion?: string;
|
|
169
|
-
}): SourceEnvelope;
|
|
170
|
-
/**
|
|
171
|
-
* Computes a content-addressed ID for an envelope.
|
|
172
|
-
* Uses SHA-256 of the canonical JSON (sorted keys, no whitespace).
|
|
173
|
-
*/
|
|
174
|
-
declare function computeEnvelopeId(envelope: SourceEnvelope): string;
|
|
175
|
-
/**
|
|
176
|
-
* Checks if two envelopes have the same content (ignoring timestamps).
|
|
177
|
-
*/
|
|
178
|
-
declare function envelopesEqual(a: SourceEnvelope, b: SourceEnvelope): boolean;
|
|
179
|
-
/**
|
|
180
|
-
* Finds definitions that changed between two envelopes.
|
|
181
|
-
*/
|
|
182
|
-
declare function diffEnvelopes(before: SourceEnvelope, after: SourceEnvelope): {
|
|
183
|
-
added: string[];
|
|
184
|
-
removed: string[];
|
|
185
|
-
modified: string[];
|
|
186
|
-
unchanged: string[];
|
|
187
|
-
};
|
|
188
|
-
|
|
189
|
-
/**
|
|
190
|
-
* Envelope Builder — walks a project directory, compiles all .workflow.tsx files,
|
|
191
|
-
* and produces a content-addressed SHA-256 deployment bundle.
|
|
192
|
-
*
|
|
193
|
-
* This is the high-level API that combines:
|
|
194
|
-
* - File discovery (fs-tree)
|
|
195
|
-
* - Compilation (babel plugin)
|
|
196
|
-
* - Source binding extraction
|
|
197
|
-
* - Content-addressed envelope creation
|
|
198
|
-
*
|
|
199
|
-
* Usage:
|
|
200
|
-
* import { buildEnvelope } from '@mindmatrix/react-compiler';
|
|
201
|
-
* const envelope = await buildEnvelope('./src/workflows', { slug: 'my-app' });
|
|
202
|
-
* // envelope.manifest.hash === 'a1b2c3...' (SHA-256)
|
|
203
|
-
*/
|
|
204
|
-
|
|
205
|
-
interface EnvelopeManifest {
|
|
206
|
-
/** Content-addressed SHA-256 hash of the entire envelope. */
|
|
207
|
-
hash: string;
|
|
208
|
-
/** Files included in the envelope (relative paths). */
|
|
209
|
-
files: EnvelopeFile[];
|
|
210
|
-
/** Blueprint version string. */
|
|
211
|
-
version: string;
|
|
212
|
-
/** ISO 8601 timestamp. */
|
|
213
|
-
timestamp: string;
|
|
214
|
-
/** Total compiled definitions. */
|
|
215
|
-
definitionCount: number;
|
|
216
|
-
/** Total compilation errors. */
|
|
217
|
-
errorCount: number;
|
|
218
|
-
}
|
|
219
|
-
interface EnvelopeFile {
|
|
220
|
-
/** Relative path from project root. */
|
|
221
|
-
path: string;
|
|
222
|
-
/** SHA-256 hash of file content. */
|
|
223
|
-
hash: string;
|
|
224
|
-
/** File size in bytes. */
|
|
225
|
-
size: number;
|
|
226
|
-
/** Workflow slug (if this file produced a definition). */
|
|
227
|
-
slug?: string;
|
|
228
|
-
/** Whether compilation succeeded for this file. */
|
|
229
|
-
compiled: boolean;
|
|
230
|
-
}
|
|
231
|
-
interface BuildEnvelopeOptions {
|
|
232
|
-
/** Blueprint slug. Default: basename of projectDir */
|
|
233
|
-
slug?: string;
|
|
234
|
-
/** Blueprint version. Default: '0.1.0' */
|
|
235
|
-
version?: string;
|
|
236
|
-
/** Compilation mode. Default: 'infer' */
|
|
237
|
-
mode?: 'strict' | 'infer';
|
|
238
|
-
/** Glob patterns for files to include. Default: discovers all workflow-related files */
|
|
239
|
-
include?: string[];
|
|
240
|
-
/** Environment tag. Default: undefined */
|
|
241
|
-
environment?: string;
|
|
242
|
-
}
|
|
243
|
-
interface BuildEnvelopeResult {
|
|
244
|
-
/** The complete source envelope. */
|
|
245
|
-
envelope: SourceEnvelope;
|
|
246
|
-
/** Content-addressed manifest for the bundle. */
|
|
247
|
-
manifest: EnvelopeManifest;
|
|
248
|
-
/** Individual file compilation results. */
|
|
249
|
-
files: EnvelopeFile[];
|
|
250
|
-
/** Definitions that compiled successfully. */
|
|
251
|
-
definitions: IRWorkflowDefinition[];
|
|
252
|
-
/** Compilation errors. */
|
|
253
|
-
errors: Array<{
|
|
254
|
-
file: string;
|
|
255
|
-
message: string;
|
|
256
|
-
line?: number;
|
|
257
|
-
}>;
|
|
258
|
-
}
|
|
259
|
-
/**
|
|
260
|
-
* Walk a project directory, compile all workflow files, and produce a
|
|
261
|
-
* content-addressed deployment bundle.
|
|
262
|
-
*/
|
|
263
|
-
declare function buildEnvelope(projectDir: string, options?: BuildEnvelopeOptions): Promise<BuildEnvelopeResult>;
|
|
264
|
-
|
|
265
|
-
export { type BuildEnvelopeOptions as B, type EnvelopeManifest as E, type FileRole as F, type SourceEnvelope as S, type EnvelopeFile as a, buildEnvelope as b, type BuildEnvelopeResult as c, createSourceEnvelope as d, computeEnvelopeId as e, envelopesEqual as f, diffEnvelopes as g, type SourceBinding as h, type EnvelopeMetadata as i, generateFsTree as j, detectFileRole as k, filterByRole as l, diffFsTrees as m, type FsTree as n, type FsTreeEntry as o };
|
|
@@ -1,265 +0,0 @@
|
|
|
1
|
-
import { IRWorkflowDefinition } from '@mindmatrix/player-core';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* File System Tree — generates a manifest of project files with roles and hashes.
|
|
5
|
-
*
|
|
6
|
-
* The fs.tree is the first component of the source envelope.
|
|
7
|
-
* It maps every source file to its role in the workflow project.
|
|
8
|
-
*
|
|
9
|
-
* Roles:
|
|
10
|
-
* - view-entry: .workflow.tsx files (main workflow components)
|
|
11
|
-
* - model: models/*.ts files (workflow definitions)
|
|
12
|
-
* - server-action: *.server.ts files (backend action handlers)
|
|
13
|
-
* - layout: layout.tsx files (route layout boundaries)
|
|
14
|
-
* - page: page.tsx files (route page components)
|
|
15
|
-
* - config: mm.config.ts, blueprint.config.ts
|
|
16
|
-
* - component: regular .tsx components used by workflows
|
|
17
|
-
* - asset: static assets (images, styles, etc.)
|
|
18
|
-
* - unknown: unclassified files
|
|
19
|
-
*/
|
|
20
|
-
type FileRole = 'view-entry' | 'model' | 'server-action' | 'layout' | 'page' | 'config' | 'component' | 'test' | 'asset' | 'unknown';
|
|
21
|
-
interface FsTreeEntry {
|
|
22
|
-
/** Relative path from project root. */
|
|
23
|
-
path: string;
|
|
24
|
-
/** File role in the workflow project. */
|
|
25
|
-
role: FileRole;
|
|
26
|
-
/** SHA-256 content hash. */
|
|
27
|
-
hash: string;
|
|
28
|
-
/** File size in bytes. */
|
|
29
|
-
size: number;
|
|
30
|
-
/** Last modified timestamp. */
|
|
31
|
-
mtime: string;
|
|
32
|
-
/** Workflow slug (for view-entry and model files). */
|
|
33
|
-
slug?: string;
|
|
34
|
-
}
|
|
35
|
-
interface FsTree {
|
|
36
|
-
/** fs.tree format version. */
|
|
37
|
-
version: 1;
|
|
38
|
-
/** Project root directory (absolute). */
|
|
39
|
-
root: string;
|
|
40
|
-
/** Timestamp when the tree was generated. */
|
|
41
|
-
generatedAt: string;
|
|
42
|
-
/** File entries. */
|
|
43
|
-
entries: FsTreeEntry[];
|
|
44
|
-
/** Summary statistics. */
|
|
45
|
-
summary: {
|
|
46
|
-
totalFiles: number;
|
|
47
|
-
byRole: Record<FileRole, number>;
|
|
48
|
-
totalSize: number;
|
|
49
|
-
};
|
|
50
|
-
}
|
|
51
|
-
/**
|
|
52
|
-
* Determines the role of a file based on its path and naming convention.
|
|
53
|
-
*/
|
|
54
|
-
declare function detectFileRole(relativePath: string): FileRole;
|
|
55
|
-
/**
|
|
56
|
-
* Generates an FsTree from a list of file paths.
|
|
57
|
-
*/
|
|
58
|
-
declare function generateFsTree(files: string[], rootDir: string): FsTree;
|
|
59
|
-
/**
|
|
60
|
-
* Filters an FsTree to only include specific roles.
|
|
61
|
-
*/
|
|
62
|
-
declare function filterByRole(tree: FsTree, roles: FileRole[]): FsTreeEntry[];
|
|
63
|
-
/**
|
|
64
|
-
* Finds changed files between two FsTree snapshots.
|
|
65
|
-
*/
|
|
66
|
-
declare function diffFsTrees(before: FsTree, after: FsTree): {
|
|
67
|
-
added: FsTreeEntry[];
|
|
68
|
-
removed: FsTreeEntry[];
|
|
69
|
-
modified: FsTreeEntry[];
|
|
70
|
-
};
|
|
71
|
-
|
|
72
|
-
/**
|
|
73
|
-
* Source Envelope — bundles compiled workflows with source metadata.
|
|
74
|
-
*
|
|
75
|
-
* A source envelope is the unit of deployment. It contains:
|
|
76
|
-
* 1. All compiled workflow definitions (IR)
|
|
77
|
-
* 2. File manifest (fs.tree) with content hashes
|
|
78
|
-
* 3. Source bindings (semantic refs ↔ file spans)
|
|
79
|
-
* 4. Deployment metadata (version, timestamp, environment)
|
|
80
|
-
*
|
|
81
|
-
* The envelope enables:
|
|
82
|
-
* - Immutable versioning (content-addressed)
|
|
83
|
-
* - Source-level debugging (map IR back to .tsx source)
|
|
84
|
-
* - Differential deployment (only deploy changed workflows)
|
|
85
|
-
* - P2P sync (envelope is the unit of transfer)
|
|
86
|
-
*/
|
|
87
|
-
|
|
88
|
-
interface SourceEnvelope {
|
|
89
|
-
/** Envelope format version. */
|
|
90
|
-
version: 1;
|
|
91
|
-
/** Content-addressed envelope ID (SHA-256 of canonical content). */
|
|
92
|
-
envelopeId: string;
|
|
93
|
-
/** Blueprint slug this envelope belongs to. */
|
|
94
|
-
blueprintSlug: string;
|
|
95
|
-
/** Blueprint version. */
|
|
96
|
-
blueprintVersion: string;
|
|
97
|
-
/** When the envelope was created. */
|
|
98
|
-
createdAt: string;
|
|
99
|
-
/** Deployment target environment. */
|
|
100
|
-
environment?: string;
|
|
101
|
-
/** Compiled workflow definitions. */
|
|
102
|
-
definitions: IRWorkflowDefinition[];
|
|
103
|
-
/** File manifest. */
|
|
104
|
-
fsTree: FsTree;
|
|
105
|
-
/** Source bindings (IR element → source location). */
|
|
106
|
-
sourceBindings: SourceBinding[];
|
|
107
|
-
/** Deployment metadata. */
|
|
108
|
-
metadata: EnvelopeMetadata;
|
|
109
|
-
}
|
|
110
|
-
/**
|
|
111
|
-
* Maps an IR element to its source location.
|
|
112
|
-
*/
|
|
113
|
-
interface SourceBinding {
|
|
114
|
-
/** Type of IR element. */
|
|
115
|
-
kind: 'field' | 'state' | 'transition' | 'action' | 'component' | 'grammar-island';
|
|
116
|
-
/** Name/ID of the element. */
|
|
117
|
-
name: string;
|
|
118
|
-
/** Workflow slug this binding belongs to. */
|
|
119
|
-
workflowSlug: string;
|
|
120
|
-
/** Source file path (relative). */
|
|
121
|
-
file: string;
|
|
122
|
-
/** Start line (1-based). */
|
|
123
|
-
startLine: number;
|
|
124
|
-
/** Start column (0-based). */
|
|
125
|
-
startColumn: number;
|
|
126
|
-
/** End line (1-based). */
|
|
127
|
-
endLine?: number;
|
|
128
|
-
/** End column (0-based). */
|
|
129
|
-
endColumn?: number;
|
|
130
|
-
}
|
|
131
|
-
/**
|
|
132
|
-
* Deployment metadata.
|
|
133
|
-
*/
|
|
134
|
-
interface EnvelopeMetadata {
|
|
135
|
-
/** Total number of workflow definitions. */
|
|
136
|
-
definitionCount: number;
|
|
137
|
-
/** Total number of fields across all definitions. */
|
|
138
|
-
totalFields: number;
|
|
139
|
-
/** Total number of states across all definitions. */
|
|
140
|
-
totalStates: number;
|
|
141
|
-
/** Total number of transitions across all definitions. */
|
|
142
|
-
totalTransitions: number;
|
|
143
|
-
/** Compiler version. */
|
|
144
|
-
compilerVersion: string;
|
|
145
|
-
/** Build mode. */
|
|
146
|
-
mode: 'strict' | 'infer';
|
|
147
|
-
/** Whether any errors were detected. */
|
|
148
|
-
hasErrors: boolean;
|
|
149
|
-
/** Error/warning summary. */
|
|
150
|
-
diagnostics: DiagnosticSummary;
|
|
151
|
-
}
|
|
152
|
-
interface DiagnosticSummary {
|
|
153
|
-
errors: number;
|
|
154
|
-
warnings: number;
|
|
155
|
-
errorCodes: string[];
|
|
156
|
-
}
|
|
157
|
-
/**
|
|
158
|
-
* Creates a source envelope from compiled definitions.
|
|
159
|
-
*/
|
|
160
|
-
declare function createSourceEnvelope(params: {
|
|
161
|
-
blueprintSlug: string;
|
|
162
|
-
blueprintVersion: string;
|
|
163
|
-
definitions: IRWorkflowDefinition[];
|
|
164
|
-
fsTree: FsTree;
|
|
165
|
-
sourceBindings?: SourceBinding[];
|
|
166
|
-
environment?: string;
|
|
167
|
-
mode?: 'strict' | 'infer';
|
|
168
|
-
compilerVersion?: string;
|
|
169
|
-
}): SourceEnvelope;
|
|
170
|
-
/**
|
|
171
|
-
* Computes a content-addressed ID for an envelope.
|
|
172
|
-
* Uses SHA-256 of the canonical JSON (sorted keys, no whitespace).
|
|
173
|
-
*/
|
|
174
|
-
declare function computeEnvelopeId(envelope: SourceEnvelope): string;
|
|
175
|
-
/**
|
|
176
|
-
* Checks if two envelopes have the same content (ignoring timestamps).
|
|
177
|
-
*/
|
|
178
|
-
declare function envelopesEqual(a: SourceEnvelope, b: SourceEnvelope): boolean;
|
|
179
|
-
/**
|
|
180
|
-
* Finds definitions that changed between two envelopes.
|
|
181
|
-
*/
|
|
182
|
-
declare function diffEnvelopes(before: SourceEnvelope, after: SourceEnvelope): {
|
|
183
|
-
added: string[];
|
|
184
|
-
removed: string[];
|
|
185
|
-
modified: string[];
|
|
186
|
-
unchanged: string[];
|
|
187
|
-
};
|
|
188
|
-
|
|
189
|
-
/**
|
|
190
|
-
* Envelope Builder — walks a project directory, compiles all .workflow.tsx files,
|
|
191
|
-
* and produces a content-addressed SHA-256 deployment bundle.
|
|
192
|
-
*
|
|
193
|
-
* This is the high-level API that combines:
|
|
194
|
-
* - File discovery (fs-tree)
|
|
195
|
-
* - Compilation (babel plugin)
|
|
196
|
-
* - Source binding extraction
|
|
197
|
-
* - Content-addressed envelope creation
|
|
198
|
-
*
|
|
199
|
-
* Usage:
|
|
200
|
-
* import { buildEnvelope } from '@mindmatrix/react-compiler';
|
|
201
|
-
* const envelope = await buildEnvelope('./src/workflows', { slug: 'my-app' });
|
|
202
|
-
* // envelope.manifest.hash === 'a1b2c3...' (SHA-256)
|
|
203
|
-
*/
|
|
204
|
-
|
|
205
|
-
interface EnvelopeManifest {
|
|
206
|
-
/** Content-addressed SHA-256 hash of the entire envelope. */
|
|
207
|
-
hash: string;
|
|
208
|
-
/** Files included in the envelope (relative paths). */
|
|
209
|
-
files: EnvelopeFile[];
|
|
210
|
-
/** Blueprint version string. */
|
|
211
|
-
version: string;
|
|
212
|
-
/** ISO 8601 timestamp. */
|
|
213
|
-
timestamp: string;
|
|
214
|
-
/** Total compiled definitions. */
|
|
215
|
-
definitionCount: number;
|
|
216
|
-
/** Total compilation errors. */
|
|
217
|
-
errorCount: number;
|
|
218
|
-
}
|
|
219
|
-
interface EnvelopeFile {
|
|
220
|
-
/** Relative path from project root. */
|
|
221
|
-
path: string;
|
|
222
|
-
/** SHA-256 hash of file content. */
|
|
223
|
-
hash: string;
|
|
224
|
-
/** File size in bytes. */
|
|
225
|
-
size: number;
|
|
226
|
-
/** Workflow slug (if this file produced a definition). */
|
|
227
|
-
slug?: string;
|
|
228
|
-
/** Whether compilation succeeded for this file. */
|
|
229
|
-
compiled: boolean;
|
|
230
|
-
}
|
|
231
|
-
interface BuildEnvelopeOptions {
|
|
232
|
-
/** Blueprint slug. Default: basename of projectDir */
|
|
233
|
-
slug?: string;
|
|
234
|
-
/** Blueprint version. Default: '0.1.0' */
|
|
235
|
-
version?: string;
|
|
236
|
-
/** Compilation mode. Default: 'infer' */
|
|
237
|
-
mode?: 'strict' | 'infer';
|
|
238
|
-
/** Glob patterns for files to include. Default: discovers all workflow-related files */
|
|
239
|
-
include?: string[];
|
|
240
|
-
/** Environment tag. Default: undefined */
|
|
241
|
-
environment?: string;
|
|
242
|
-
}
|
|
243
|
-
interface BuildEnvelopeResult {
|
|
244
|
-
/** The complete source envelope. */
|
|
245
|
-
envelope: SourceEnvelope;
|
|
246
|
-
/** Content-addressed manifest for the bundle. */
|
|
247
|
-
manifest: EnvelopeManifest;
|
|
248
|
-
/** Individual file compilation results. */
|
|
249
|
-
files: EnvelopeFile[];
|
|
250
|
-
/** Definitions that compiled successfully. */
|
|
251
|
-
definitions: IRWorkflowDefinition[];
|
|
252
|
-
/** Compilation errors. */
|
|
253
|
-
errors: Array<{
|
|
254
|
-
file: string;
|
|
255
|
-
message: string;
|
|
256
|
-
line?: number;
|
|
257
|
-
}>;
|
|
258
|
-
}
|
|
259
|
-
/**
|
|
260
|
-
* Walk a project directory, compile all workflow files, and produce a
|
|
261
|
-
* content-addressed deployment bundle.
|
|
262
|
-
*/
|
|
263
|
-
declare function buildEnvelope(projectDir: string, options?: BuildEnvelopeOptions): Promise<BuildEnvelopeResult>;
|
|
264
|
-
|
|
265
|
-
export { type BuildEnvelopeOptions as B, type EnvelopeManifest as E, type FileRole as F, type SourceEnvelope as S, type EnvelopeFile as a, buildEnvelope as b, type BuildEnvelopeResult as c, createSourceEnvelope as d, computeEnvelopeId as e, envelopesEqual as f, diffEnvelopes as g, type SourceBinding as h, type EnvelopeMetadata as i, generateFsTree as j, detectFileRole as k, filterByRole as l, diffFsTrees as m, type FsTree as n, type FsTreeEntry as o };
|