behavior-contracts 0.8.11 → 0.8.12
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 +22 -16
- package/cli-contract.yaml +46 -44
- package/dist/cli.js +16 -14
- package/dist/cli.js.map +1 -1
- package/dist/commands/codegen.d.ts +4 -3
- package/dist/commands/codegen.d.ts.map +1 -1
- package/dist/commands/codegen.js +8 -5
- package/dist/commands/codegen.js.map +1 -1
- package/dist/generated/commands.d.ts.map +1 -1
- package/dist/generated/commands.js +12 -16
- package/dist/generated/commands.js.map +1 -1
- package/dist/generated/contract.d.ts.map +1 -1
- package/dist/generated/contract.js +2 -2
- package/dist/generated/contract.js.map +1 -1
- package/dist/generated/program.d.ts +6 -8
- package/dist/generated/program.d.ts.map +1 -1
- package/dist/generated/program.js +6 -8
- package/dist/generated/program.js.map +1 -1
- package/dist/generated/types.d.ts +6 -8
- package/dist/generated/types.d.ts.map +1 -1
- package/dist/generator/core.d.ts +9 -24
- package/dist/generator/core.d.ts.map +1 -1
- package/dist/generator/core.js +1 -1
- package/dist/generator/core.js.map +1 -1
- package/dist/generator/emit-typed-native-go.d.ts +10 -0
- package/dist/generator/emit-typed-native-go.d.ts.map +1 -1
- package/dist/generator/emit-typed-native-go.js +340 -202
- package/dist/generator/emit-typed-native-go.js.map +1 -1
- package/dist/generator/emit-typed-native-rust.d.ts.map +1 -1
- package/dist/generator/emit-typed-native-rust.js +195 -221
- package/dist/generator/emit-typed-native-rust.js.map +1 -1
- package/dist/generator/index.d.ts +1 -1
- package/dist/generator/index.d.ts.map +1 -1
- package/dist/generator/index.js +1 -1
- package/dist/generator/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -82,12 +82,15 @@ bc generate --lang rust-typed-native --in behaviors.ir.json --out behaviors.gene
|
|
|
82
82
|
bc check --lang go-typed-native --in behaviors.ir.json --out behaviors.generated.go
|
|
83
83
|
```
|
|
84
84
|
|
|
85
|
-
|
|
86
|
-
|
|
85
|
+
The consumer's only hand-written native code is a single op-agnostic **leaf transport** per leaf
|
|
86
|
+
that returns the BC-owned wire value; bind it (and, for a cross-package Go layout, hoist the
|
|
87
|
+
BC-generated wire types into a shared package):
|
|
87
88
|
|
|
88
89
|
```bash
|
|
89
|
-
bc generate --lang
|
|
90
|
-
#
|
|
90
|
+
bc generate --lang rust-typed-native --leaf-transport GetItem=get_item --leaf-transport-import crate::tx --in behaviors.ir.json
|
|
91
|
+
# Go cross-package: emit the BC-OWNED wire types (+ the batched/fanout batch ports structs) into a shared
|
|
92
|
+
# package so the transport package can return them without an import cycle (see examples/go-cross-package/)
|
|
93
|
+
bc generate --lang go-typed-native --shared-types-import example.com/pkg/wire --leaf-transport-import example.com/pkg/tx --in behaviors.ir.json
|
|
91
94
|
```
|
|
92
95
|
|
|
93
96
|
Run `bc generate --help` for the full option reference (also generated at `docs/cli-reference.md`).
|
|
@@ -103,18 +106,21 @@ const result = runBehavior(ir, handlers, { userId: "u1" }, "UserReads");
|
|
|
103
106
|
|
|
104
107
|
## Consuming a typed-native module
|
|
105
108
|
|
|
106
|
-
A `*-typed-native` module is runtime-free and fully typed.
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
109
|
+
A `*-typed-native` module is runtime-free and fully typed. BC OWNS and GENERATES the concrete
|
|
110
|
+
wire type (`WireValue`/`WireRow`/`WireList`) and all of the strict de-box that classifies each
|
|
111
|
+
producer value against the declared type. The consumer implements NOTHING over the wire type —
|
|
112
|
+
no trait, no probe protocol. The **only** hand-written native code is a single op-agnostic **leaf
|
|
113
|
+
transport** per leaf that does the raw I/O and returns the BC-owned wire value:
|
|
114
|
+
|
|
115
|
+
- **Rust** — write `fn leaf_<comp>(…) -> Result<WireValue, BehaviorError>` (or your chosen symbol
|
|
116
|
+
via `--leaf-transport`); the covered module calls it directly and de-boxes the returned
|
|
117
|
+
`WireValue` inline (no trait, no generics, no dynamic dispatch). The wire type lives in the
|
|
118
|
+
covered module; the transport references it back (intra-crate module cycles are legal).
|
|
119
|
+
- **Go** — write `func Leaf_<comp>(…) (WireValue, error)`, likewise called directly. For a
|
|
120
|
+
cross-package layout, `--shared-types-import` emits the BC-owned wire types **and** the
|
|
121
|
+
batched/fanout batch ports structs into a shared package, so the transport package returns them
|
|
122
|
+
without an import cycle (covered → transport → shared). See `../examples/go-cross-package/` and
|
|
123
|
+
`../examples/rust-cross-module/`.
|
|
118
124
|
|
|
119
125
|
`opt` fields are key-omittable (an absent optional attribute decodes to `None`/null); an
|
|
120
126
|
integer supplied to a `float` slot is widened. A shape whose declared type the emitter
|
package/cli-contract.yaml
CHANGED
|
@@ -93,41 +93,42 @@ command_sets:
|
|
|
93
93
|
schema:
|
|
94
94
|
type: string
|
|
95
95
|
|
|
96
|
-
- name:
|
|
96
|
+
- name: shared-types-import
|
|
97
97
|
required: false
|
|
98
98
|
description: >-
|
|
99
|
-
(--lang go-typed-native only) Go package path the
|
|
100
|
-
|
|
101
|
-
|
|
99
|
+
(--lang go-typed-native only) Go package path for the BC-GENERATED
|
|
100
|
+
shared wire types (WireValue/WireRow/WireList). When set, BC emits
|
|
101
|
+
those types into that shared package and the covered module imports +
|
|
102
|
+
qualifies them, so a separate leaf-transport package can return them
|
|
103
|
+
without an import cycle (cross-package layout). Absent → in-package.
|
|
102
104
|
Ignored by other emitters.
|
|
103
105
|
value_name: spec
|
|
104
106
|
schema:
|
|
105
107
|
type: string
|
|
106
108
|
|
|
107
|
-
- name:
|
|
109
|
+
- name: leaf-transport
|
|
108
110
|
required: false
|
|
111
|
+
repeatable: true
|
|
109
112
|
description: >-
|
|
110
|
-
(--lang go-typed-native only)
|
|
111
|
-
|
|
112
|
-
|
|
113
|
+
(--lang rust-typed-native / go-typed-native only) Map a covered leaf
|
|
114
|
+
(catalog component) to the op-agnostic transport symbol the runner
|
|
115
|
+
calls directly, as <leaf>=<symbol>; repeat per leaf. A leaf not
|
|
116
|
+
listed uses the in-package default name (rust leaf_<comp> / go
|
|
117
|
+
Leaf_<comp>). Ignored by other emitters.
|
|
118
|
+
value_name: mapping
|
|
113
119
|
schema:
|
|
114
|
-
type:
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
required: false
|
|
118
|
-
description: >-
|
|
119
|
-
(--lang go-typed-native only) Name of the consumer's WireRow seam
|
|
120
|
-
type. Default WireRow. Ignored by other emitters.
|
|
121
|
-
value_name: name
|
|
122
|
-
schema:
|
|
123
|
-
type: string
|
|
120
|
+
type: array
|
|
121
|
+
items:
|
|
122
|
+
type: string
|
|
124
123
|
|
|
125
|
-
- name:
|
|
124
|
+
- name: leaf-transport-import
|
|
126
125
|
required: false
|
|
127
126
|
description: >-
|
|
128
|
-
(--lang go-typed-native only)
|
|
129
|
-
|
|
130
|
-
|
|
127
|
+
(--lang rust-typed-native / go-typed-native only) Module the leaf
|
|
128
|
+
transport symbols are imported from (rust `use <module>::{…}`, go
|
|
129
|
+
package import + selector); absent → resolve in-scope / same
|
|
130
|
+
package. Ignored by other emitters.
|
|
131
|
+
value_name: module
|
|
131
132
|
schema:
|
|
132
133
|
type: string
|
|
133
134
|
|
|
@@ -204,41 +205,42 @@ command_sets:
|
|
|
204
205
|
schema:
|
|
205
206
|
type: string
|
|
206
207
|
|
|
207
|
-
- name:
|
|
208
|
+
- name: shared-types-import
|
|
208
209
|
required: false
|
|
209
210
|
description: >-
|
|
210
|
-
(--lang go-typed-native only) Go package path the
|
|
211
|
-
|
|
212
|
-
|
|
211
|
+
(--lang go-typed-native only) Go package path for the BC-GENERATED
|
|
212
|
+
shared wire types (WireValue/WireRow/WireList). When set, BC emits
|
|
213
|
+
those types into that shared package and the covered module imports +
|
|
214
|
+
qualifies them, so a separate leaf-transport package can return them
|
|
215
|
+
without an import cycle (cross-package layout). Absent → in-package.
|
|
213
216
|
Ignored by other emitters.
|
|
214
217
|
value_name: spec
|
|
215
218
|
schema:
|
|
216
219
|
type: string
|
|
217
220
|
|
|
218
|
-
- name:
|
|
221
|
+
- name: leaf-transport
|
|
219
222
|
required: false
|
|
223
|
+
repeatable: true
|
|
220
224
|
description: >-
|
|
221
|
-
(--lang go-typed-native only)
|
|
222
|
-
|
|
223
|
-
|
|
225
|
+
(--lang rust-typed-native / go-typed-native only) Map a covered leaf
|
|
226
|
+
(catalog component) to the op-agnostic transport symbol the runner
|
|
227
|
+
calls directly, as <leaf>=<symbol>; repeat per leaf. A leaf not
|
|
228
|
+
listed uses the in-package default name (rust leaf_<comp> / go
|
|
229
|
+
Leaf_<comp>). Ignored by other emitters.
|
|
230
|
+
value_name: mapping
|
|
224
231
|
schema:
|
|
225
|
-
type:
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
required: false
|
|
229
|
-
description: >-
|
|
230
|
-
(--lang go-typed-native only) Name of the consumer's WireRow seam
|
|
231
|
-
type. Default WireRow. Ignored by other emitters.
|
|
232
|
-
value_name: name
|
|
233
|
-
schema:
|
|
234
|
-
type: string
|
|
232
|
+
type: array
|
|
233
|
+
items:
|
|
234
|
+
type: string
|
|
235
235
|
|
|
236
|
-
- name:
|
|
236
|
+
- name: leaf-transport-import
|
|
237
237
|
required: false
|
|
238
238
|
description: >-
|
|
239
|
-
(--lang go-typed-native only)
|
|
240
|
-
|
|
241
|
-
|
|
239
|
+
(--lang rust-typed-native / go-typed-native only) Module the leaf
|
|
240
|
+
transport symbols are imported from (rust `use <module>::{…}`, go
|
|
241
|
+
package import + selector); absent → resolve in-scope / same
|
|
242
|
+
package. Ignored by other emitters.
|
|
243
|
+
value_name: module
|
|
242
244
|
schema:
|
|
243
245
|
type: string
|
|
244
246
|
|
package/dist/cli.js
CHANGED
|
@@ -32,21 +32,23 @@ function generateOrExit(opts) {
|
|
|
32
32
|
process.stderr.write("bc: --in <ir-doc.json> is required\n");
|
|
33
33
|
process.exit(2);
|
|
34
34
|
}
|
|
35
|
-
// Build the go-typed-native wire seam option only when a go-wire-* flag is present; absent → leave
|
|
36
|
-
// undefined so the emitter applies its in-package default names (unqualified WireValue/WireRow/WireList).
|
|
37
|
-
const goWire = opts.goWireImport !== undefined ||
|
|
38
|
-
opts.goWireValue !== undefined ||
|
|
39
|
-
opts.goWireRow !== undefined ||
|
|
40
|
-
opts.goWireList !== undefined
|
|
41
|
-
? {
|
|
42
|
-
value: opts.goWireValue ?? "WireValue",
|
|
43
|
-
row: opts.goWireRow ?? "WireRow",
|
|
44
|
-
list: opts.goWireList ?? "WireList",
|
|
45
|
-
...(opts.goWireImport !== undefined ? { import: opts.goWireImport } : {}),
|
|
46
|
-
}
|
|
47
|
-
: undefined;
|
|
48
35
|
try {
|
|
49
|
-
|
|
36
|
+
// Build the leaf-transport option only when a leaf-transport flag is present; absent → undefined so the
|
|
37
|
+
// native emitters apply their in-package default symbols (rust leaf_<comp> / go Leaf_<comp>). Each
|
|
38
|
+
// `--leaf-transport <leaf>=<symbol>` maps a covered leaf to the symbol the runner calls directly.
|
|
39
|
+
const ltList = opts.leafTransport === undefined ? undefined : Array.isArray(opts.leafTransport) ? opts.leafTransport : [opts.leafTransport];
|
|
40
|
+
const leafTransport = ltList !== undefined || opts.leafTransportImport !== undefined
|
|
41
|
+
? {
|
|
42
|
+
symbols: Object.fromEntries((ltList ?? []).map((m) => {
|
|
43
|
+
const eq = m.indexOf("=");
|
|
44
|
+
if (eq <= 0 || eq === m.length - 1)
|
|
45
|
+
throw new Error(`--leaf-transport expects <leaf>=<symbol>, got '${m}'`);
|
|
46
|
+
return [m.slice(0, eq), m.slice(eq + 1)];
|
|
47
|
+
})),
|
|
48
|
+
...(opts.leafTransportImport !== undefined ? { import: opts.leafTransportImport } : {}),
|
|
49
|
+
}
|
|
50
|
+
: undefined;
|
|
51
|
+
return generateFromDoc(readDoc(opts.in), opts.lang, opts.runtimeImport, leafTransport, opts.sharedTypesImport);
|
|
50
52
|
}
|
|
51
53
|
catch (e) {
|
|
52
54
|
process.stderr.write(`bc: ${e instanceof Error ? e.message : String(e)}\n`);
|
package/dist/cli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AACA,+EAA+E;AAC/E,uEAAuE;AACvE,EAAE;AACF,8EAA8E;AAC9E,8EAA8E;AAC9E,+EAA+E;AAC/E,8EAA8E;AAC9E,sCAAsC;AACtC,EAAE;AACF,6FAA6F;AAC7F,6FAA6F;AAC7F,EAAE;AACF,wEAAwE;AACxE,+FAA+F;AAC/F,EAAE;AACF,gGAAgG;AAChG,8DAA8D;AAC9D,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACtD,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAwB,MAAM,wBAAwB,CAAC;AAC7E,OAAO,EAAE,eAAe,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAEjE,MAAM,OAAO,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC/C,MAAM,GAAG,GAAG,OAAO,CAAC,iBAAiB,CAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AACA,+EAA+E;AAC/E,uEAAuE;AACvE,EAAE;AACF,8EAA8E;AAC9E,8EAA8E;AAC9E,+EAA+E;AAC/E,8EAA8E;AAC9E,sCAAsC;AACtC,EAAE;AACF,6FAA6F;AAC7F,6FAA6F;AAC7F,EAAE;AACF,wEAAwE;AACxE,+FAA+F;AAC/F,EAAE;AACF,gGAAgG;AAChG,8DAA8D;AAC9D,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACtD,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAwB,MAAM,wBAAwB,CAAC;AAC7E,OAAO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AI,CAAC,GAAG,EAAE,CAAC;YACd,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,mDAAmD,CAAC,CAAC;YAC1E,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;QACD,MAAM,IAAI,GAAG,cAAc,CAAC,IAAI,CAAC,CAAC;QAClC,IAAI,SAAiB,CAAC;QACtB,IAAI,CAAC;YACH,SAAS,GAAG,YAAY,CAAC,IAAI,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC;QAC7C,CAAC;QAAC,MAAM,CAAC;YACP,OAAO,CAAC,MAAM,CAAC,KAAK,CAClB,sBAAsB,IAAI,CAAC,GAAG,+CAA+C,CAC9E,CAAC;YACF,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;QACD,IAAI,SAAS,KAAK,IAAI,EAAE,CAAC;YACvB,OAAO,CAAC,MAAM,CAAC,KAAK,CAClB,eAAe,IAAI,CAAC,GAAG,kDAAkD;gBACvE,sBAAsB,IAAI,CAAC,IAAI,SAAS,IAAI,CAAC,EAAE,UAAU,IAAI,CAAC,GAAG,IAAI,CACxE,CAAC;YACF,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;QACD,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,oBAAoB,IAAI,CAAC,GAAG,IAAI,CAAC,CAAC;IACzD,CAAC;CACF,CAAC;AAEF,aAAa,CAAC,QAAQ,EAAE,GAAG,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,CAAC"}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { type ComponentGraphIRDoc, type GenerateOptions } from "../index.js";
|
|
2
2
|
/** A serialized IR doc → the native module source (same path as the in-process API).
|
|
3
|
-
* `
|
|
4
|
-
*
|
|
5
|
-
|
|
3
|
+
* `leafTransport` (native emitters only) + `sharedTypesImport` (go cross-package: BC-generated shared wire
|
|
4
|
+
* types package) are forwarded verbatim to the emitter options of the same name; other emitters ignore
|
|
5
|
+
* them. Omitted → the emitter's default transport symbols / in-package wire types. */
|
|
6
|
+
export declare function generateFromDoc(doc: ComponentGraphIRDoc, language: string, runtimeImport?: string, leafTransport?: GenerateOptions["leafTransport"], sharedTypesImport?: string): string;
|
|
6
7
|
/** Read + parse a serialized ComponentGraphIRDoc from disk. */
|
|
7
8
|
export declare function readDoc(inPath: string): ComponentGraphIRDoc;
|
|
8
9
|
//# sourceMappingURL=codegen.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"codegen.d.ts","sourceRoot":"","sources":["../../src/commands/codegen.ts"],"names":[],"mappings":"AAYA,OAAO,EAIL,KAAK,mBAAmB,EACxB,KAAK,eAAe,EACrB,MAAM,aAAa,CAAC;AAErB
|
|
1
|
+
{"version":3,"file":"codegen.d.ts","sourceRoot":"","sources":["../../src/commands/codegen.ts"],"names":[],"mappings":"AAYA,OAAO,EAIL,KAAK,mBAAmB,EACxB,KAAK,eAAe,EACrB,MAAM,aAAa,CAAC;AAErB;;;sFAGsF;AACtF,wBAAgB,eAAe,CAC7B,GAAG,EAAE,mBAAmB,EACxB,QAAQ,EAAE,MAAM,EAChB,aAAa,CAAC,EAAE,MAAM,EACtB,aAAa,CAAC,EAAE,eAAe,CAAC,eAAe,CAAC,EAChD,iBAAiB,CAAC,EAAE,MAAM,GACzB,MAAM,CAaR;AAED,+DAA+D;AAC/D,wBAAgB,OAAO,CAAC,MAAM,EAAE,MAAM,GAAG,mBAAmB,CAY3D"}
|
package/dist/commands/codegen.js
CHANGED
|
@@ -12,9 +12,10 @@
|
|
|
12
12
|
import { readFileSync } from "node:fs";
|
|
13
13
|
import { loadCompiledIR, generateModule, registeredLanguages, } from "../index.js";
|
|
14
14
|
/** A serialized IR doc → the native module source (same path as the in-process API).
|
|
15
|
-
* `
|
|
16
|
-
*
|
|
17
|
-
|
|
15
|
+
* `leafTransport` (native emitters only) + `sharedTypesImport` (go cross-package: BC-generated shared wire
|
|
16
|
+
* types package) are forwarded verbatim to the emitter options of the same name; other emitters ignore
|
|
17
|
+
* them. Omitted → the emitter's default transport symbols / in-package wire types. */
|
|
18
|
+
export function generateFromDoc(doc, language, runtimeImport, leafTransport, sharedTypesImport) {
|
|
18
19
|
if (!registeredLanguages().includes(language)) {
|
|
19
20
|
throw new Error(`--lang '${language}' is not a registered emitter (registered: ${registeredLanguages().join(", ")})`);
|
|
20
21
|
}
|
|
@@ -22,8 +23,10 @@ export function generateFromDoc(doc, language, runtimeImport, goWire) {
|
|
|
22
23
|
const options = { language };
|
|
23
24
|
if (runtimeImport !== undefined)
|
|
24
25
|
options.runtimeImport = runtimeImport;
|
|
25
|
-
if (
|
|
26
|
-
options.
|
|
26
|
+
if (leafTransport !== undefined)
|
|
27
|
+
options.leafTransport = leafTransport;
|
|
28
|
+
if (sharedTypesImport !== undefined)
|
|
29
|
+
options.sharedTypesImport = sharedTypesImport;
|
|
27
30
|
const module = generateModule(compiled, options);
|
|
28
31
|
return module.code;
|
|
29
32
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"codegen.js","sourceRoot":"","sources":["../../src/commands/codegen.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAC/E,6DAA6D;AAC7D,EAAE;AACF,8EAA8E;AAC9E,yEAAyE;AACzE,4EAA4E;AAC5E,oDAAoD;AACpD,EAAE;AACF,gFAAgF;AAChF,sEAAsE;AACtE,+EAA+E;AAC/E,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EACL,cAAc,EACd,cAAc,EACd,mBAAmB,GAGpB,MAAM,aAAa,CAAC;AAErB
|
|
1
|
+
{"version":3,"file":"codegen.js","sourceRoot":"","sources":["../../src/commands/codegen.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAC/E,6DAA6D;AAC7D,EAAE;AACF,8EAA8E;AAC9E,yEAAyE;AACzE,4EAA4E;AAC5E,oDAAoD;AACpD,EAAE;AACF,gFAAgF;AAChF,sEAAsE;A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AC;IAChD,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACX,MAAM,IAAI,KAAK,CAAC,SAAS,MAAM,wBAAwB,CAAC,YAAY,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;IACvG,CAAC;AACH,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"commands.d.ts","sourceRoot":"","sources":["../../src/generated/commands.ts"],"names":[],"mappings":"AAMA,MAAM,WAAW,UAAU;IACzB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,wBAAsB,UAAU,CAC9B,UAAU,EAAE,MAAM,EAClB,OAAO,CAAC,EAAE,OAAO,CAAC,OAAO,YAAY,EAAE,eAAe,CAAC,GACtD,OAAO,CAAC,UAAU,CAAC,
|
|
1
|
+
{"version":3,"file":"commands.d.ts","sourceRoot":"","sources":["../../src/generated/commands.ts"],"names":[],"mappings":"AAMA,MAAM,WAAW,UAAU;IACzB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,wBAAsB,UAAU,CAC9B,UAAU,EAAE,MAAM,EAClB,OAAO,CAAC,EAAE,OAAO,CAAC,OAAO,YAAY,EAAE,eAAe,CAAC,GACtD,OAAO,CAAC,UAAU,CAAC,CAuBrB;AAED,wBAAsB,OAAO,CAC3B,UAAU,EAAE,MAAM,EAClB,OAAO,CAAC,EAAE,OAAO,CAAC,OAAO,YAAY,EAAE,YAAY,CAAC,GACnD,OAAO,CAAC,UAAU,CAAC,CAuBrB"}
|
|
@@ -13,14 +13,12 @@ export async function bcGenerate(executable, options) {
|
|
|
13
13
|
cmdArgs.push("--out", String(options.out));
|
|
14
14
|
if (options.runtimeImport !== undefined)
|
|
15
15
|
cmdArgs.push("--runtime-import", String(options.runtimeImport));
|
|
16
|
-
if (options.
|
|
17
|
-
cmdArgs.push("--
|
|
18
|
-
if (options.
|
|
19
|
-
cmdArgs.push("--
|
|
20
|
-
if (options.
|
|
21
|
-
cmdArgs.push("--
|
|
22
|
-
if (options.goWireList !== undefined)
|
|
23
|
-
cmdArgs.push("--go-wire-list", String(options.goWireList));
|
|
16
|
+
if (options.sharedTypesImport !== undefined)
|
|
17
|
+
cmdArgs.push("--shared-types-import", String(options.sharedTypesImport));
|
|
18
|
+
if (options.leafTransport !== undefined)
|
|
19
|
+
cmdArgs.push("--leaf-transport", String(options.leafTransport));
|
|
20
|
+
if (options.leafTransportImport !== undefined)
|
|
21
|
+
cmdArgs.push("--leaf-transport-import", String(options.leafTransportImport));
|
|
24
22
|
}
|
|
25
23
|
try {
|
|
26
24
|
const result = await execFileAsync(executable, cmdArgs);
|
|
@@ -46,14 +44,12 @@ export async function bcCheck(executable, options) {
|
|
|
46
44
|
cmdArgs.push("--out", String(options.out));
|
|
47
45
|
if (options.runtimeImport !== undefined)
|
|
48
46
|
cmdArgs.push("--runtime-import", String(options.runtimeImport));
|
|
49
|
-
if (options.
|
|
50
|
-
cmdArgs.push("--
|
|
51
|
-
if (options.
|
|
52
|
-
cmdArgs.push("--
|
|
53
|
-
if (options.
|
|
54
|
-
cmdArgs.push("--
|
|
55
|
-
if (options.goWireList !== undefined)
|
|
56
|
-
cmdArgs.push("--go-wire-list", String(options.goWireList));
|
|
47
|
+
if (options.sharedTypesImport !== undefined)
|
|
48
|
+
cmdArgs.push("--shared-types-import", String(options.sharedTypesImport));
|
|
49
|
+
if (options.leafTransport !== undefined)
|
|
50
|
+
cmdArgs.push("--leaf-transport", String(options.leafTransport));
|
|
51
|
+
if (options.leafTransportImport !== undefined)
|
|
52
|
+
cmdArgs.push("--leaf-transport-import", String(options.leafTransportImport));
|
|
57
53
|
}
|
|
58
54
|
try {
|
|
59
55
|
const result = await execFileAsync(executable, cmdArgs);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"commands.js","sourceRoot":"","sources":["../../src/generated/commands.ts"],"names":[],"mappings":"AAAA,gDAAgD;AAChD,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAEtC,MAAM,aAAa,GAAG,SAAS,CAAC,QAAQ,CAAC,CAAC;AAQ1C,MAAM,CAAC,KAAK,UAAU,UAAU,CAC9B,UAAkB,EAClB,OAAuD;IAEvD,MAAM,OAAO,GAAa,CAAC,UAAU,CAAC,CAAC;IACvC,IAAI,OAAO,EAAE,CAAC;QACZ,IAAI,OAAO,CAAC,IAAI,KAAK,SAAS;YAAE,OAAO,CAAC,IAAI,CAAC,QAAQ,EAAE,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;QAC7E,IAAI,OAAO,CAAC,EAAE,KAAK,SAAS;YAAE,OAAO,CAAC,IAAI,CAAC,MAAM,EAAE,MAAM,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,CAAC;QACvE,IAAI,OAAO,CAAC,GAAG,KAAK,SAAS;YAAE,OAAO,CAAC,IAAI,CAAC,OAAO,EAAE,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC;QAC1E,IAAI,OAAO,CAAC,aAAa,KAAK,SAAS;YAAE,OAAO,CAAC,IAAI,CAAC,kBAAkB,EAAE,MAAM,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC,CAAC;QACzG,IAAI,OAAO,CAAC,
|
|
1
|
+
{"version":3,"file":"commands.js","sourceRoot":"","sources":["../../src/generated/commands.ts"],"names":[],"mappings":"AAAA,gDAAgD;AAChD,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAEtC,MAAM,aAAa,GAAG,SAAS,CAAC,QAAQ,CAAC,CAAC;AAQ1C,MAAM,CAA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I,OAAO,CAAC,aAAa,KAAK,SAAS;YAAE,OAAO,CAAC,IAAI,CAAC,kBAAkB,EAAE,MAAM,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC,CAAC;QACzG,IAAI,OAAO,CAAC,mBAAmB,KAAK,SAAS;YAAE,OAAO,CAAC,IAAI,CAAC,yBAAyB,EAAE,MAAM,CAAC,OAAO,CAAC,mBAAmB,CAAC,CAAC,CAAC;IAC9H,CAAC;IAED,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,MAAM,aAAa,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC;QACxD,OAAO,EAAE,QAAQ,EAAE,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,CAAC;IACvE,CAAC;IAAC,OAAO,GAAY,EAAE,CAAC;QACtB,MAAM,CAAC,GAAG,GAA0D,CAAC;QACrE,OAAO;YACL,QAAQ,EAAE,OAAO,CAAC,CAAC,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;YACjD,MAAM,EAAE,CAAC,CAAC,MAAM,IAAI,EAAE;YACtB,MAAM,EAAE,CAAC,CAAC,MAAM,IAAI,EAAE;SACvB,CAAC;IACJ,CAAC;AACH,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contract.d.ts","sourceRoot":"","sources":["../../src/generated/contract.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,aAAa,EAAE,
|
|
1
|
+
{"version":3,"file":"contract.d.ts","sourceRoot":"","sources":["../../src/generated/contract.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,aAAa,EAAE,MAA6nT,CAAC;AAE1pT,eAAO,MAAM,iBAAiB,EAAE,MAA2rX,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// Auto-generated by cli-contracts. Do not edit.
|
|
2
2
|
// Embedded contract for the extract subcommand.
|
|
3
|
-
export const CONTRACT_YAML = "# yaml-language-server: $schema=./node_modules/cli-contracts/schemas/cli-contract.schema.json\ncli_contracts: 0.1.0\n\ninfo:\n title: behavior-contracts CLI\n version: 0.1.0\n description: >-\n bc — the build-time codegen CLI over behavior-contracts' public API.\n Reads a serialized ComponentGraphIRDoc (the unbranded JSON IR), adopts it\n via loadCompiledIR, and runs the same generateModule the in-process API runs\n to emit a runtime-free native module (data baked as literals). The IR doc is\n a build-time input only; nothing reads it at runtime.\n license:\n name: MIT\n contact:\n name: foo-ogawa\n url: https://github.com/foo-ogawa/behavior-contracts\n\nartifact_slots:\n ir-doc:\n direction: read\n description: Serialized ComponentGraphIRDoc (unbranded JSON IR) — the codegen input.\n generated-module:\n direction: write\n description: Generated native module source (baked-literal, runtime-free).\n\ncommand_sets:\n bc:\n summary: build-time codegen CLI over behavior-contracts' public API.\n executable: bc\n\n global_options:\n - name: version\n aliases: [V]\n description: Print version and exit.\n schema:\n type: boolean\n\n - name: help\n aliases: [h]\n description: Show help and exit.\n schema:\n type: boolean\n\n commands:\n # ── generate ─────────────────────────────────────────\n generate:\n summary: Emit a native module from a serialized IR doc.\n description: >-\n Reads the --in ComponentGraphIRDoc, adopts it via loadCompiledIR, and\n runs generateModule for the --lang emitter. Writes the module source\n to --out if given, else to stdout. Rejects an unregistered --lang.\n usage:\n - bc generate --lang rust-typed-native --in ir-doc.json\n - bc generate --lang go-typed-native --in ir-doc.json --out gen.go\n - bc generate --lang typescript-typed --in ir-doc.json --runtime-import ./runtime.js\n\n options:\n - name: lang\n required: true\n description: >-\n Target emitter (must be a registered language, e.g.\n rust-typed-native, go-typed-native, typescript-typed).\n value_name: emitter\n schema:\n type: string\n\n - name: in\n required: true\n description: Path to the serialized ComponentGraphIRDoc JSON file.\n value_name: ir-doc.json\n schema:\n type: string\n file:\n mode: read\n exists: true\n media_type: application/json\n encoding: utf-8\n\n - name: out\n required: false\n description: Write the generated module here instead of stdout.\n value_name: file\n schema:\n type: string\n file:\n mode: write\n\n - name: runtime-import\n required: false\n description: Override the runtime import specifier baked into the module.\n value_name: spec\n schema:\n type: string\n\n - name:
|
|
4
|
-
export const CONTRACT_JSON_STR = "{\n \"cli_contracts\": \"0.1.0\",\n \"info\": {\n \"title\": \"behavior-contracts CLI\",\n \"version\": \"0.1.0\",\n \"description\": \"bc — the build-time codegen CLI over behavior-contracts' public API. Reads a serialized ComponentGraphIRDoc (the unbranded JSON IR), adopts it via loadCompiledIR, and runs the same generateModule the in-process API runs to emit a runtime-free native module (data baked as literals). The IR doc is a build-time input only; nothing reads it at runtime.\",\n \"license\": {\n \"name\": \"MIT\"\n },\n \"contact\": {\n \"name\": \"foo-ogawa\",\n \"url\": \"https://github.com/foo-ogawa/behavior-contracts\"\n }\n },\n \"artifact_slots\": {\n \"ir-doc\": {\n \"direction\": \"read\",\n \"description\": \"Serialized ComponentGraphIRDoc (unbranded JSON IR) — the codegen input.\"\n },\n \"generated-module\": {\n \"direction\": \"write\",\n \"description\": \"Generated native module source (baked-literal, runtime-free).\"\n }\n },\n \"command_sets\": {\n \"bc\": {\n \"summary\": \"build-time codegen CLI over behavior-contracts' public API.\",\n \"executable\": \"bc\",\n \"global_options\": [\n {\n \"name\": \"version\",\n \"aliases\": [\n \"V\"\n ],\n \"description\": \"Print version and exit.\",\n \"schema\": {\n \"type\": \"boolean\"\n }\n },\n {\n \"name\": \"help\",\n \"aliases\": [\n \"h\"\n ],\n \"description\": \"Show help and exit.\",\n \"schema\": {\n \"type\": \"boolean\"\n }\n }\n ],\n \"commands\": {\n \"generate\": {\n \"summary\": \"Emit a native module from a serialized IR doc.\",\n \"description\": \"Reads the --in ComponentGraphIRDoc, adopts it via loadCompiledIR, and runs generateModule for the --lang emitter. Writes the module source to --out if given, else to stdout. Rejects an unregistered --lang.\",\n \"usage\": [\n \"bc generate --lang rust-typed-native --in ir-doc.json\",\n \"bc generate --lang go-typed-native --in ir-doc.json --out gen.go\",\n \"bc generate --lang typescript-typed --in ir-doc.json --runtime-import ./runtime.js\"\n ],\n \"options\": [\n {\n \"name\": \"lang\",\n \"required\": true,\n \"description\": \"Target emitter (must be a registered language, e.g. rust-typed-native, go-typed-native, typescript-typed).\",\n \"value_name\": \"emitter\",\n \"schema\": {\n \"type\": \"string\"\n }\n },\n {\n \"name\": \"in\",\n \"required\": true,\n \"description\": \"Path to the serialized ComponentGraphIRDoc JSON file.\",\n \"value_name\": \"ir-doc.json\",\n \"schema\": {\n \"type\": \"string\"\n },\n \"file\": {\n \"mode\": \"read\",\n \"exists\": true,\n \"media_type\": \"application/json\",\n \"encoding\": \"utf-8\"\n }\n },\n {\n \"name\": \"out\",\n \"required\": false,\n \"description\": \"Write the generated module here instead of stdout.\",\n \"value_name\": \"file\",\n \"schema\": {\n \"type\": \"string\"\n },\n \"file\": {\n \"mode\": \"write\"\n }\n },\n {\n \"name\": \"runtime-import\",\n \"required\": false,\n \"description\": \"Override the runtime import specifier baked into the module.\",\n \"value_name\": \"spec\",\n \"schema\": {\n \"type\": \"string\"\n }\n },\n {\n \"name\": \"go-wire-import\",\n \"required\": false,\n \"description\": \"(--lang go-typed-native only) Go package path the consumer's wire seam types live in; when set, the covered module imports it and qualifies the seam type names (e.g. WireValue → <pkg>.WireValue). Ignored by other emitters.\",\n \"value_name\": \"spec\",\n \"schema\": {\n \"type\": \"string\"\n }\n },\n {\n \"name\": \"go-wire-value\",\n \"required\": false,\n \"description\": \"(--lang go-typed-native only) Name of the consumer's WireValue seam type. Default WireValue. Ignored by other emitters.\",\n \"value_name\": \"name\",\n \"schema\": {\n \"type\": \"string\"\n }\n },\n {\n \"name\": \"go-wire-row\",\n \"required\": false,\n \"description\": \"(--lang go-typed-native only) Name of the consumer's WireRow seam type. Default WireRow. Ignored by other emitters.\",\n \"value_name\": \"name\",\n \"schema\": {\n \"type\": \"string\"\n }\n },\n {\n \"name\": \"go-wire-list\",\n \"required\": false,\n \"description\": \"(--lang go-typed-native only) Name of the consumer's WireList seam type. Default WireList. Ignored by other emitters.\",\n \"value_name\": \"name\",\n \"schema\": {\n \"type\": \"string\"\n }\n }\n ],\n \"exits\": {\n \"0\": {\n \"description\": \"Module generated (written to --out, or printed to stdout).\",\n \"stdout\": {\n \"format\": \"text\"\n }\n },\n \"1\": {\n \"description\": \"Generation failed (unreadable/invalid --in, or --lang is not a registered emitter).\",\n \"stderr\": {\n \"format\": \"text\"\n }\n },\n \"2\": {\n \"description\": \"Usage error — a required option (--lang or --in) was omitted.\",\n \"stderr\": {\n \"format\": \"text\"\n }\n }\n },\n \"x-agent\": {\n \"riskLevel\": \"low\",\n \"requiresConfirmation\": false,\n \"idempotent\": true,\n \"sideEffects\": [\n \"file_write\"\n ],\n \"sideEffectNote\": \"Writes to the filesystem only when --out is specified; otherwise output goes to stdout.\"\n }\n },\n \"check\": {\n \"summary\": \"Verify a committed module matches a fresh generation (drift gate).\",\n \"description\": \"Regenerates the module from --in for --lang and byte-compares it against the committed --out file. Exits non-zero on drift. This is the build's codegen drift gate.\",\n \"usage\": [\n \"bc check --lang rust-typed-native --in ir-doc.json --out gen.rs\"\n ],\n \"options\": [\n {\n \"name\": \"lang\",\n \"required\": true,\n \"description\": \"Target emitter (must be a registered language).\",\n \"value_name\": \"emitter\",\n \"schema\": {\n \"type\": \"string\"\n }\n },\n {\n \"name\": \"in\",\n \"required\": true,\n \"description\": \"Path to the serialized ComponentGraphIRDoc JSON file.\",\n \"value_name\": \"ir-doc.json\",\n \"schema\": {\n \"type\": \"string\"\n },\n \"file\": {\n \"mode\": \"read\",\n \"exists\": true,\n \"media_type\": \"application/json\",\n \"encoding\": \"utf-8\"\n }\n },\n {\n \"name\": \"out\",\n \"required\": true,\n \"description\": \"The committed module file to diff a fresh generation against.\",\n \"value_name\": \"file\",\n \"schema\": {\n \"type\": \"string\"\n },\n \"file\": {\n \"mode\": \"read\",\n \"exists\": true\n }\n },\n {\n \"name\": \"runtime-import\",\n \"required\": false,\n \"description\": \"Override the runtime import specifier baked into the module.\",\n \"value_name\": \"spec\",\n \"schema\": {\n \"type\": \"string\"\n }\n },\n {\n \"name\": \"go-wire-import\",\n \"required\": false,\n \"description\": \"(--lang go-typed-native only) Go package path the consumer's wire seam types live in; when set, the covered module imports it and qualifies the seam type names (e.g. WireValue → <pkg>.WireValue). Ignored by other emitters.\",\n \"value_name\": \"spec\",\n \"schema\": {\n \"type\": \"string\"\n }\n },\n {\n \"name\": \"go-wire-value\",\n \"required\": false,\n \"description\": \"(--lang go-typed-native only) Name of the consumer's WireValue seam type. Default WireValue. Ignored by other emitters.\",\n \"value_name\": \"name\",\n \"schema\": {\n \"type\": \"string\"\n }\n },\n {\n \"name\": \"go-wire-row\",\n \"required\": false,\n \"description\": \"(--lang go-typed-native only) Name of the consumer's WireRow seam type. Default WireRow. Ignored by other emitters.\",\n \"value_name\": \"name\",\n \"schema\": {\n \"type\": \"string\"\n }\n },\n {\n \"name\": \"go-wire-list\",\n \"required\": false,\n \"description\": \"(--lang go-typed-native only) Name of the consumer's WireList seam type. Default WireList. Ignored by other emitters.\",\n \"value_name\": \"name\",\n \"schema\": {\n \"type\": \"string\"\n }\n }\n ],\n \"exits\": {\n \"0\": {\n \"description\": \"Up to date — the committed --out matches a fresh generation.\",\n \"stdout\": {\n \"format\": \"text\"\n }\n },\n \"1\": {\n \"description\": \"Drift detected (--out differs or does not exist), or generation failed (unreadable/invalid --in, or unregistered --lang).\",\n \"stderr\": {\n \"format\": \"text\"\n }\n },\n \"2\": {\n \"description\": \"Usage error — a required option (--lang or --in) was omitted.\",\n \"stderr\": {\n \"format\": \"text\"\n }\n }\n },\n \"x-agent\": {\n \"riskLevel\": \"low\",\n \"requiresConfirmation\": false,\n \"idempotent\": true,\n \"sideEffects\": []\n }\n }\n }\n }\n }\n}";
|
|
3
|
+
export const CONTRACT_YAML = "# yaml-language-server: $schema=./node_modules/cli-contracts/schemas/cli-contract.schema.json\ncli_contracts: 0.1.0\n\ninfo:\n title: behavior-contracts CLI\n version: 0.1.0\n description: >-\n bc — the build-time codegen CLI over behavior-contracts' public API.\n Reads a serialized ComponentGraphIRDoc (the unbranded JSON IR), adopts it\n via loadCompiledIR, and runs the same generateModule the in-process API runs\n to emit a runtime-free native module (data baked as literals). The IR doc is\n a build-time input only; nothing reads it at runtime.\n license:\n name: MIT\n contact:\n name: foo-ogawa\n url: https://github.com/foo-ogawa/behavior-contracts\n\nartifact_slots:\n ir-doc:\n direction: read\n description: Serialized ComponentGraphIRDoc (unbranded JSON IR) — the codegen input.\n generated-module:\n direction: write\n description: Generated native module source (baked-literal, runtime-free).\n\ncommand_sets:\n bc:\n summary: build-time codegen CLI over behavior-contracts' public API.\n executable: bc\n\n global_options:\n - name: version\n aliases: [V]\n description: Print version and exit.\n schema:\n type: boolean\n\n - name: help\n aliases: [h]\n description: Show help and exit.\n schema:\n type: boolean\n\n commands:\n # ── generate ─────────────────────────────────────────\n generate:\n summary: Emit a native module from a serialized IR doc.\n description: >-\n Reads the --in ComponentGraphIRDoc, adopts it via loadCompiledIR, and\n runs generateModule for the --lang emitter. Writes the module source\n to --out if given, else to stdout. Rejects an unregistered --lang.\n usage:\n - bc generate --lang rust-typed-native --in ir-doc.json\n - bc generate --lang go-typed-native --in ir-doc.json --out gen.go\n - bc generate --lang typescript-typed --in ir-doc.json --runtime-import ./runtime.js\n\n options:\n - name: lang\n required: true\n description: >-\n Target emitter (must be a registered language, e.g.\n rust-typed-native, go-typed-native, typescript-typed).\n value_name: emitter\n schema:\n type: string\n\n - name: in\n required: true\n description: Path to the serialized ComponentGraphIRDoc JSON file.\n value_name: ir-doc.json\n schema:\n type: string\n file:\n mode: read\n exists: true\n media_type: application/json\n encoding: utf-8\n\n - name: out\n required: false\n description: Write the generated module here instead of stdout.\n value_name: file\n schema:\n type: string\n file:\n mode: write\n\n - name: runtime-import\n required: false\n description: Override the runtime import specifier baked into the module.\n value_name: spec\n schema:\n type: string\n\n - name: shared-types-import\n required: false\n description: >-\n (--lang go-typed-native only) Go package path for the BC-GENERATED\n shared wire types (WireValue/WireRow/WireList). When set, BC emits\n those types into that shared package and the covered module imports +\n qualifies them, so a separate leaf-transport package can return them\n without an import cycle (cross-package layout). Absent → in-package.\n Ignored by other emitters.\n value_name: spec\n schema:\n type: string\n\n - name: leaf-transport\n required: false\n repeatable: true\n description: >-\n (--lang rust-typed-native / go-typed-native only) Map a covered leaf\n (catalog component) to the op-agnostic transport symbol the runner\n calls directly, as <leaf>=<symbol>; repeat per leaf. A leaf not\n listed uses the in-package default name (rust leaf_<comp> / go\n Leaf_<comp>). Ignored by other emitters.\n value_name: mapping\n schema:\n type: array\n items:\n type: string\n\n - name: leaf-transport-import\n required: false\n description: >-\n (--lang rust-typed-native / go-typed-native only) Module the leaf\n transport symbols are imported from (rust `use <module>::{…}`, go\n package import + selector); absent → resolve in-scope / same\n package. Ignored by other emitters.\n value_name: module\n schema:\n type: string\n\n exits:\n '0':\n description: Module generated (written to --out, or printed to stdout).\n stdout:\n format: text\n '1':\n description: >-\n Generation failed (unreadable/invalid --in, or --lang is not a\n registered emitter).\n stderr:\n format: text\n '2':\n description: Usage error — a required option (--lang or --in) was omitted.\n stderr:\n format: text\n\n x-agent:\n riskLevel: low\n requiresConfirmation: false\n idempotent: true\n sideEffects:\n - file_write\n sideEffectNote: >-\n Writes to the filesystem only when --out is specified; otherwise\n output goes to stdout.\n\n # ── check ────────────────────────────────────────────\n check:\n summary: Verify a committed module matches a fresh generation (drift gate).\n description: >-\n Regenerates the module from --in for --lang and byte-compares it\n against the committed --out file. Exits non-zero on drift. This is the\n build's codegen drift gate.\n usage:\n - bc check --lang rust-typed-native --in ir-doc.json --out gen.rs\n\n options:\n - name: lang\n required: true\n description: Target emitter (must be a registered language).\n value_name: emitter\n schema:\n type: string\n\n - name: in\n required: true\n description: Path to the serialized ComponentGraphIRDoc JSON file.\n value_name: ir-doc.json\n schema:\n type: string\n file:\n mode: read\n exists: true\n media_type: application/json\n encoding: utf-8\n\n - name: out\n required: true\n description: The committed module file to diff a fresh generation against.\n value_name: file\n schema:\n type: string\n file:\n mode: read\n exists: true\n\n - name: runtime-import\n required: false\n description: Override the runtime import specifier baked into the module.\n value_name: spec\n schema:\n type: string\n\n - name: shared-types-import\n required: false\n description: >-\n (--lang go-typed-native only) Go package path for the BC-GENERATED\n shared wire types (WireValue/WireRow/WireList). When set, BC emits\n those types into that shared package and the covered module imports +\n qualifies them, so a separate leaf-transport package can return them\n without an import cycle (cross-package layout). Absent → in-package.\n Ignored by other emitters.\n value_name: spec\n schema:\n type: string\n\n - name: leaf-transport\n required: false\n repeatable: true\n description: >-\n (--lang rust-typed-native / go-typed-native only) Map a covered leaf\n (catalog component) to the op-agnostic transport symbol the runner\n calls directly, as <leaf>=<symbol>; repeat per leaf. A leaf not\n listed uses the in-package default name (rust leaf_<comp> / go\n Leaf_<comp>). Ignored by other emitters.\n value_name: mapping\n schema:\n type: array\n items:\n type: string\n\n - name: leaf-transport-import\n required: false\n description: >-\n (--lang rust-typed-native / go-typed-native only) Module the leaf\n transport symbols are imported from (rust `use <module>::{…}`, go\n package import + selector); absent → resolve in-scope / same\n package. Ignored by other emitters.\n value_name: module\n schema:\n type: string\n\n exits:\n '0':\n description: Up to date — the committed --out matches a fresh generation.\n stdout:\n format: text\n '1':\n description: >-\n Drift detected (--out differs or does not exist), or generation\n failed (unreadable/invalid --in, or unregistered --lang).\n stderr:\n format: text\n '2':\n description: Usage error — a required option (--lang or --in) was omitted.\n stderr:\n format: text\n\n x-agent:\n riskLevel: low\n requiresConfirmation: false\n idempotent: true\n sideEffects: []\n";
|
|
4
|
+
export const CONTRACT_JSON_STR = "{\n \"cli_contracts\": \"0.1.0\",\n \"info\": {\n \"title\": \"behavior-contracts CLI\",\n \"version\": \"0.1.0\",\n \"description\": \"bc — the build-time codegen CLI over behavior-contracts' public API. Reads a serialized ComponentGraphIRDoc (the unbranded JSON IR), adopts it via loadCompiledIR, and runs the same generateModule the in-process API runs to emit a runtime-free native module (data baked as literals). The IR doc is a build-time input only; nothing reads it at runtime.\",\n \"license\": {\n \"name\": \"MIT\"\n },\n \"contact\": {\n \"name\": \"foo-ogawa\",\n \"url\": \"https://github.com/foo-ogawa/behavior-contracts\"\n }\n },\n \"artifact_slots\": {\n \"ir-doc\": {\n \"direction\": \"read\",\n \"description\": \"Serialized ComponentGraphIRDoc (unbranded JSON IR) — the codegen input.\"\n },\n \"generated-module\": {\n \"direction\": \"write\",\n \"description\": \"Generated native module source (baked-literal, runtime-free).\"\n }\n },\n \"command_sets\": {\n \"bc\": {\n \"summary\": \"build-time codegen CLI over behavior-contracts' public API.\",\n \"executable\": \"bc\",\n \"global_options\": [\n {\n \"name\": \"version\",\n \"aliases\": [\n \"V\"\n ],\n \"description\": \"Print version and exit.\",\n \"schema\": {\n \"type\": \"boolean\"\n }\n },\n {\n \"name\": \"help\",\n \"aliases\": [\n \"h\"\n ],\n \"description\": \"Show help and exit.\",\n \"schema\": {\n \"type\": \"boolean\"\n }\n }\n ],\n \"commands\": {\n \"generate\": {\n \"summary\": \"Emit a native module from a serialized IR doc.\",\n \"description\": \"Reads the --in ComponentGraphIRDoc, adopts it via loadCompiledIR, and runs generateModule for the --lang emitter. Writes the module source to --out if given, else to stdout. Rejects an unregistered --lang.\",\n \"usage\": [\n \"bc generate --lang rust-typed-native --in ir-doc.json\",\n \"bc generate --lang go-typed-native --in ir-doc.json --out gen.go\",\n \"bc generate --lang typescript-typed --in ir-doc.json --runtime-import ./runtime.js\"\n ],\n \"options\": [\n {\n \"name\": \"lang\",\n \"required\": true,\n \"description\": \"Target emitter (must be a registered language, e.g. rust-typed-native, go-typed-native, typescript-typed).\",\n \"value_name\": \"emitter\",\n \"schema\": {\n \"type\": \"string\"\n }\n },\n {\n \"name\": \"in\",\n \"required\": true,\n \"description\": \"Path to the serialized ComponentGraphIRDoc JSON file.\",\n \"value_name\": \"ir-doc.json\",\n \"schema\": {\n \"type\": \"string\"\n },\n \"file\": {\n \"mode\": \"read\",\n \"exists\": true,\n \"media_type\": \"application/json\",\n \"encoding\": \"utf-8\"\n }\n },\n {\n \"name\": \"out\",\n \"required\": false,\n \"description\": \"Write the generated module here instead of stdout.\",\n \"value_name\": \"file\",\n \"schema\": {\n \"type\": \"string\"\n },\n \"file\": {\n \"mode\": \"write\"\n }\n },\n {\n \"name\": \"runtime-import\",\n \"required\": false,\n \"description\": \"Override the runtime import specifier baked into the module.\",\n \"value_name\": \"spec\",\n \"schema\": {\n \"type\": \"string\"\n }\n },\n {\n \"name\": \"shared-types-import\",\n \"required\": false,\n \"description\": \"(--lang go-typed-native only) Go package path for the BC-GENERATED shared wire types (WireValue/WireRow/WireList). When set, BC emits those types into that shared package and the covered module imports + qualifies them, so a separate leaf-transport package can return them without an import cycle (cross-package layout). Absent → in-package. Ignored by other emitters.\",\n \"value_name\": \"spec\",\n \"schema\": {\n \"type\": \"string\"\n }\n },\n {\n \"name\": \"leaf-transport\",\n \"required\": false,\n \"repeatable\": true,\n \"description\": \"(--lang rust-typed-native / go-typed-native only) Map a covered leaf (catalog component) to the op-agnostic transport symbol the runner calls directly, as <leaf>=<symbol>; repeat per leaf. A leaf not listed uses the in-package default name (rust leaf_<comp> / go Leaf_<comp>). Ignored by other emitters.\",\n \"value_name\": \"mapping\",\n \"schema\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"string\"\n }\n }\n },\n {\n \"name\": \"leaf-transport-import\",\n \"required\": false,\n \"description\": \"(--lang rust-typed-native / go-typed-native only) Module the leaf transport symbols are imported from (rust `use <module>::{…}`, go package import + selector); absent → resolve in-scope / same package. Ignored by other emitters.\",\n \"value_name\": \"module\",\n \"schema\": {\n \"type\": \"string\"\n }\n }\n ],\n \"exits\": {\n \"0\": {\n \"description\": \"Module generated (written to --out, or printed to stdout).\",\n \"stdout\": {\n \"format\": \"text\"\n }\n },\n \"1\": {\n \"description\": \"Generation failed (unreadable/invalid --in, or --lang is not a registered emitter).\",\n \"stderr\": {\n \"format\": \"text\"\n }\n },\n \"2\": {\n \"description\": \"Usage error — a required option (--lang or --in) was omitted.\",\n \"stderr\": {\n \"format\": \"text\"\n }\n }\n },\n \"x-agent\": {\n \"riskLevel\": \"low\",\n \"requiresConfirmation\": false,\n \"idempotent\": true,\n \"sideEffects\": [\n \"file_write\"\n ],\n \"sideEffectNote\": \"Writes to the filesystem only when --out is specified; otherwise output goes to stdout.\"\n }\n },\n \"check\": {\n \"summary\": \"Verify a committed module matches a fresh generation (drift gate).\",\n \"description\": \"Regenerates the module from --in for --lang and byte-compares it against the committed --out file. Exits non-zero on drift. This is the build's codegen drift gate.\",\n \"usage\": [\n \"bc check --lang rust-typed-native --in ir-doc.json --out gen.rs\"\n ],\n \"options\": [\n {\n \"name\": \"lang\",\n \"required\": true,\n \"description\": \"Target emitter (must be a registered language).\",\n \"value_name\": \"emitter\",\n \"schema\": {\n \"type\": \"string\"\n }\n },\n {\n \"name\": \"in\",\n \"required\": true,\n \"description\": \"Path to the serialized ComponentGraphIRDoc JSON file.\",\n \"value_name\": \"ir-doc.json\",\n \"schema\": {\n \"type\": \"string\"\n },\n \"file\": {\n \"mode\": \"read\",\n \"exists\": true,\n \"media_type\": \"application/json\",\n \"encoding\": \"utf-8\"\n }\n },\n {\n \"name\": \"out\",\n \"required\": true,\n \"description\": \"The committed module file to diff a fresh generation against.\",\n \"value_name\": \"file\",\n \"schema\": {\n \"type\": \"string\"\n },\n \"file\": {\n \"mode\": \"read\",\n \"exists\": true\n }\n },\n {\n \"name\": \"runtime-import\",\n \"required\": false,\n \"description\": \"Override the runtime import specifier baked into the module.\",\n \"value_name\": \"spec\",\n \"schema\": {\n \"type\": \"string\"\n }\n },\n {\n \"name\": \"shared-types-import\",\n \"required\": false,\n \"description\": \"(--lang go-typed-native only) Go package path for the BC-GENERATED shared wire types (WireValue/WireRow/WireList). When set, BC emits those types into that shared package and the covered module imports + qualifies them, so a separate leaf-transport package can return them without an import cycle (cross-package layout). Absent → in-package. Ignored by other emitters.\",\n \"value_name\": \"spec\",\n \"schema\": {\n \"type\": \"string\"\n }\n },\n {\n \"name\": \"leaf-transport\",\n \"required\": false,\n \"repeatable\": true,\n \"description\": \"(--lang rust-typed-native / go-typed-native only) Map a covered leaf (catalog component) to the op-agnostic transport symbol the runner calls directly, as <leaf>=<symbol>; repeat per leaf. A leaf not listed uses the in-package default name (rust leaf_<comp> / go Leaf_<comp>). Ignored by other emitters.\",\n \"value_name\": \"mapping\",\n \"schema\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"string\"\n }\n }\n },\n {\n \"name\": \"leaf-transport-import\",\n \"required\": false,\n \"description\": \"(--lang rust-typed-native / go-typed-native only) Module the leaf transport symbols are imported from (rust `use <module>::{…}`, go package import + selector); absent → resolve in-scope / same package. Ignored by other emitters.\",\n \"value_name\": \"module\",\n \"schema\": {\n \"type\": \"string\"\n }\n }\n ],\n \"exits\": {\n \"0\": {\n \"description\": \"Up to date — the committed --out matches a fresh generation.\",\n \"stdout\": {\n \"format\": \"text\"\n }\n },\n \"1\": {\n \"description\": \"Drift detected (--out differs or does not exist), or generation failed (unreadable/invalid --in, or unregistered --lang).\",\n \"stderr\": {\n \"format\": \"text\"\n }\n },\n \"2\": {\n \"description\": \"Usage error — a required option (--lang or --in) was omitted.\",\n \"stderr\": {\n \"format\": \"text\"\n }\n }\n },\n \"x-agent\": {\n \"riskLevel\": \"low\",\n \"requiresConfirmation\": false,\n \"idempotent\": true,\n \"sideEffects\": []\n }\n }\n }\n }\n }\n}";
|
|
5
5
|
//# sourceMappingURL=contract.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contract.js","sourceRoot":"","sources":["../../src/generated/contract.ts"],"names":[],"mappings":"AAAA,gDAAgD;AAChD,gDAAgD;AAEhD,MAAM,CAAC,MAAM,aAAa,GAAW,
|
|
1
|
+
{"version":3,"file":"contract.js","sourceRoot":"","sources":["../../src/generated/contract.ts"],"names":[],"mappings":"AAAA,gDAAgD;AAChD,gDAAgD;AAEhD,MAAM,CAAC,MAAM,aAAa,GAAW,onTAAonT,CAAC;AAE1pT,MAAM,CAAC,MAAM,iBAAiB,GAAW,krXAAkrX,CAAC"}
|
|
@@ -5,20 +5,18 @@ export interface CommandHandlers {
|
|
|
5
5
|
in?: string;
|
|
6
6
|
out?: string;
|
|
7
7
|
runtimeImport?: string;
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
goWireList?: string;
|
|
8
|
+
sharedTypesImport?: string;
|
|
9
|
+
leafTransport?: string;
|
|
10
|
+
leafTransportImport?: string;
|
|
12
11
|
}, parentOpts: Record<string, unknown>) => Promise<void>;
|
|
13
12
|
check: (options: {
|
|
14
13
|
lang?: string;
|
|
15
14
|
in?: string;
|
|
16
15
|
out?: string;
|
|
17
16
|
runtimeImport?: string;
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
goWireList?: string;
|
|
17
|
+
sharedTypesImport?: string;
|
|
18
|
+
leafTransport?: string;
|
|
19
|
+
leafTransportImport?: string;
|
|
22
20
|
}, parentOpts: Record<string, unknown>) => Promise<void>;
|
|
23
21
|
}
|
|
24
22
|
export declare function createProgram(handlers: CommandHandlers, version: string): Command;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"program.d.ts","sourceRoot":"","sources":["../../src/generated/program.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAGpC,MAAM,WAAW,eAAe;IAC9B,QAAQ,EAAE,CAAC,OAAO,EAAE;QAAE,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,EAAE,CAAC,EAAE,MAAM,CAAC;QAAC,GAAG,CAAC,EAAE,MAAM,CAAC;QAAC,aAAa,CAAC,EAAE,MAAM,CAAC;QAAC,
|
|
1
|
+
{"version":3,"file":"program.d.ts","sourceRoot":"","sources":["../../src/generated/program.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAGpC,MAAM,WAAW,eAAe;IAC9B,QAAQ,EAAE,CAAC,OAAO,EAAE;QAAE,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,EAAE,CAAC,EAAE,MAAM,CAAC;QAAC,GAAG,CAAC,EAAE,MAAM,CAAC;QAAC,aAAa,CAAC,EAAE,MAAM,CAAC;QAAC,iBAAiB,CAAC,EAAE,MAAM,CAAC;QAAC,aAAa,CAAC,EAAE,MAAM,CAAC;QAAC,mBAAmB,CAAC,EAAE,MAAM,CAAA;KAAE,EAAE,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAClO,KAAK,EAAE,CAAC,OAAO,EAAE;QAAE,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,EAAE,CAAC,EAAE,MAAM,CAAC;QAAC,GAAG,CAAC,EAAE,MAAM,CAAC;QAAC,aAAa,CAAC,EAAE,MAAM,CAAC;QAAC,iBAAiB,CAAC,EAAE,MAAM,CAAC;QAAC,aAAa,CAAC,EAAE,MAAM,CAAC;QAAC,mBAAmB,CAAC,EAAE,MAAM,CAAA;KAAE,EAAE,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CAChO;AAED,wBAAgB,aAAa,CAC3B,QAAQ,EAAE,eAAe,EACzB,OAAO,EAAE,MAAM,GACd,OAAO,CAyHT"}
|
|
@@ -14,10 +14,9 @@ export function createProgram(handlers, version) {
|
|
|
14
14
|
.option("--in <ir-doc.json>", "Path to the serialized ComponentGraphIRDoc JSON file.")
|
|
15
15
|
.option("--out <file>", "Write the generated module here instead of stdout.")
|
|
16
16
|
.option("--runtime-import <spec>", "Override the runtime import specifier baked into the module.")
|
|
17
|
-
.option("--
|
|
18
|
-
.option("--
|
|
19
|
-
.option("--
|
|
20
|
-
.option("--go-wire-list <name>", "(--lang go-typed-native only) Name of the consumer's WireList seam type. Default WireList. Ignored by other emitters.")
|
|
17
|
+
.option("--shared-types-import <spec>", "(--lang go-typed-native only) Go package path for the BC-GENERATED shared wire types (WireValue/WireRow/WireList). When set, BC emits those types into that shared package and the covered module imports + qualifies them, so a separate leaf-transport package can return them without an import cycle (cross-package layout). Absent → in-package. Ignored by other emitters.")
|
|
18
|
+
.option("--leaf-transport <mapping...>", "(--lang rust-typed-native / go-typed-native only) Map a covered leaf (catalog component) to the op-agnostic transport symbol the runner calls directly, as <leaf>=<symbol>; repeat per leaf. A leaf not listed uses the in-package default name (rust leaf_<comp> / go Leaf_<comp>). Ignored by other emitters.")
|
|
19
|
+
.option("--leaf-transport-import <module>", "(--lang rust-typed-native / go-typed-native only) Module the leaf transport symbols are imported from (rust `use <module>::{…}`, go package import + selector); absent → resolve in-scope / same package. Ignored by other emitters.")
|
|
21
20
|
.action(async (opts, cmd) => {
|
|
22
21
|
await handlers.generate(opts, cmd.optsWithGlobals());
|
|
23
22
|
});
|
|
@@ -28,10 +27,9 @@ export function createProgram(handlers, version) {
|
|
|
28
27
|
.option("--in <ir-doc.json>", "Path to the serialized ComponentGraphIRDoc JSON file.")
|
|
29
28
|
.option("--out <file>", "The committed module file to diff a fresh generation against.")
|
|
30
29
|
.option("--runtime-import <spec>", "Override the runtime import specifier baked into the module.")
|
|
31
|
-
.option("--
|
|
32
|
-
.option("--
|
|
33
|
-
.option("--
|
|
34
|
-
.option("--go-wire-list <name>", "(--lang go-typed-native only) Name of the consumer's WireList seam type. Default WireList. Ignored by other emitters.")
|
|
30
|
+
.option("--shared-types-import <spec>", "(--lang go-typed-native only) Go package path for the BC-GENERATED shared wire types (WireValue/WireRow/WireList). When set, BC emits those types into that shared package and the covered module imports + qualifies them, so a separate leaf-transport package can return them without an import cycle (cross-package layout). Absent → in-package. Ignored by other emitters.")
|
|
31
|
+
.option("--leaf-transport <mapping...>", "(--lang rust-typed-native / go-typed-native only) Map a covered leaf (catalog component) to the op-agnostic transport symbol the runner calls directly, as <leaf>=<symbol>; repeat per leaf. A leaf not listed uses the in-package default name (rust leaf_<comp> / go Leaf_<comp>). Ignored by other emitters.")
|
|
32
|
+
.option("--leaf-transport-import <module>", "(--lang rust-typed-native / go-typed-native only) Module the leaf transport symbols are imported from (rust `use <module>::{…}`, go package import + selector); absent → resolve in-scope / same package. Ignored by other emitters.")
|
|
35
33
|
.action(async (opts, cmd) => {
|
|
36
34
|
await handlers.check(opts, cmd.optsWithGlobals());
|
|
37
35
|
});
|