@manifesto-ai/compiler 5.0.0 → 5.0.1

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
@@ -1,16 +1,22 @@
1
1
  # @manifesto-ai/compiler
2
2
 
3
- > **Compiler** translates MEL (Manifesto Expression Language) into DomainSchema for Manifesto Core.
3
+ > **Compiler** lets apps import MEL domains and can emit generated SDK domain facades.
4
4
 
5
5
  ---
6
6
 
7
7
  ## What is the Compiler?
8
8
 
9
- The compiler is the MEL frontend for Manifesto. It tokenizes, parses, validates, and lowers MEL source into a DomainSchema that Core can evaluate deterministically.
9
+ The compiler is the MEL frontend for Manifesto. For app developers, it lets a
10
+ bundler import `.mel` files and optionally emit the generated
11
+ `<source>.domain.ts` facade used by `createManifesto<TDomain>()`.
10
12
 
13
+ ```text
14
+ .mel source -> compiler plugin -> createManifesto()
15
+ -> optional generated <source>.domain.ts facade
11
16
  ```
12
- MEL source -> Compiler -> DomainSchema -> Core
13
- ```
17
+
18
+ Internally, the compiler tokenizes, parses, validates, and lowers MEL source
19
+ into the runtime schema consumed behind the SDK app path.
14
20
 
15
21
  ---
16
22
 
@@ -19,9 +25,10 @@ MEL source -> Compiler -> DomainSchema -> Core
19
25
  | Responsibility | Description |
20
26
  | --- | --- |
21
27
  | Parse MEL | Tokenize and parse MEL into an AST |
22
- | Validate | Scope, typing, and semantic checks aligned to the current compiler contract |
23
- | Generate IR | Produce DomainSchema for Core |
24
- | Lower runtime/context expressions | Lower ADR-027 `$runtime.*` and `$context.*` references into Core expressions |
28
+ | Validate | Scope, typing, and domain-rule checks aligned to the current compiler contract |
29
+ | Emit runtime schema | Produce the schema imported by `createManifesto()` |
30
+ | Emit optional TypeScript facade | Write generated domain types for larger SDK apps |
31
+ | Lower runtime/context expressions | Lower `$runtime.*` and `$context.*` references for deterministic runtime evaluation |
25
32
 
26
33
  ---
27
34
 
@@ -29,15 +36,15 @@ MEL source -> Compiler -> DomainSchema -> Core
29
36
 
30
37
  | NOT Responsible For | Who Is |
31
38
  | --- | --- |
32
- | Execute effects | Host |
33
- | Apply patches | Core |
34
- | Govern authority or seal history | `@manifesto-ai/governance` + `@manifesto-ai/lineage` |
39
+ | Execute external work | Runtime effect handlers |
40
+ | Apply domain transitions | Manifesto runtime |
41
+ | Add optional approval/history protocols | `@manifesto-ai/governance` + `@manifesto-ai/lineage` |
35
42
  | Bind UI or caller integrations | SDK / application layer |
36
43
 
37
44
  Current MEL/compiler highlights:
38
45
 
39
46
  - `available when` remains the coarse action gate.
40
- - `dispatchable when` is the fine bound-intent legality gate.
47
+ - `dispatchable when` is the fine input-specific legality gate.
41
48
  - Expression-level collection builtins include `filter`, `map`, `find`, `every`, and `some`.
42
49
  - Bounded parser-free sugar includes `absDiff`, `clamp`, `idiv`, `streak`, `match`, `argmax`, and `argmin`.
43
50
  - Current schema-position lowering supports `Record<string, T>` and `T | null`.
@@ -122,31 +129,32 @@ import { createCompilerCodegen } from "@manifesto-ai/codegen";
122
129
 
123
130
  melPlugin({
124
131
  include: /\.mel$/, // File filter (default: /\.mel$/)
125
- codegen: {
126
- emit: createCompilerCodegen(),
127
- timing: "transform", // default: run during dev/build transforms
128
- },
132
+ codegen: createCompilerCodegen(),
129
133
  });
130
134
  ```
131
135
 
132
- `codegen` is an explicit emitter hook. `@manifesto-ai/compiler` does not import `@manifesto-ai/codegen` for you; install it only if you want MEL artifacts written during dev or build and inject the emitter yourself.
136
+ `codegen` is an explicit emitter hook. `@manifesto-ai/compiler` does not import
137
+ `@manifesto-ai/codegen` for you; install it only if you want MEL artifacts
138
+ written during dev or build and inject the emitter yourself.
133
139
 
134
- `createCompilerCodegen()` can be called with no options. In that default mode it uses the canonical domain plugin and writes `<source>.domain.ts` next to the compiled `.mel` file during transform. If you prefer build-end emission, set `timing: "build"` or `timing: "both"`. You can still customize the pipeline:
140
+ `createCompilerCodegen()` can be called with no options. In that default mode
141
+ it writes `<source>.domain.ts` next to the compiled `.mel` file during
142
+ transform. You can still customize the generated facade:
135
143
 
136
144
  ```typescript
137
145
  import { createCompilerCodegen, createDomainPlugin } from "@manifesto-ai/codegen";
138
146
 
139
147
  melPlugin({
140
- codegen: {
141
- emit: createCompilerCodegen({
142
- outDir: "src/generated",
143
- plugins: [createDomainPlugin({ interfaceName: "CounterDomain" })],
144
- }),
145
- timing: "build",
146
- },
148
+ codegen: createCompilerCodegen({
149
+ outDir: "src/generated",
150
+ plugins: [createDomainPlugin({ interfaceName: "TodoDomain" })],
151
+ }),
147
152
  });
148
153
  ```
149
154
 
155
+ Advanced build setups can still pass `{ emit, timing }` when they need build-end
156
+ or dual transform/build emission.
157
+
150
158
  ### Subpath Exports
151
159
 
152
160
  | Export | Bundler |
@@ -181,12 +189,12 @@ const source = `
181
189
  domain Counter {
182
190
  state { count: number = 0 }
183
191
  action increment() {
184
- when true { patch count = add(count, 1) }
192
+ onceIntent { patch count = count + 1 }
185
193
  }
186
194
  }
187
195
  `;
188
196
 
189
- const result = compile(source, { lowerSystemValues: true });
197
+ const result = compile(source);
190
198
 
191
199
  if (!result.success) {
192
200
  console.error(result.errors);
@@ -202,10 +210,13 @@ const errors = check(source);
202
210
  ```typescript
203
211
  type CompileOptions = {
204
212
  skipSemanticAnalysis?: boolean;
205
- lowerSystemValues?: boolean;
206
213
  };
207
214
  ```
208
215
 
216
+ Legacy compatibility options may still exist for older call sites, but they are
217
+ not current v5 integration seams. Runtime facts are represented through
218
+ `$runtime.*` and explicit Core `Context`, not compiler-lowered system values.
219
+
209
220
  ---
210
221
 
211
222
  ## Documentation
@@ -72,7 +72,6 @@ export declare class SemanticValidator {
72
72
  private validateMatchCall;
73
73
  private validateArgSelectionCall;
74
74
  private error;
75
- private warn;
76
75
  }
77
76
  /**
78
77
  * Validate a MEL program semantically