Skip to content

Commit 5049687

Browse files
committed
Fix 0.22 CLI diagnostics and tooling alignment
1 parent c253a41 commit 5049687

36 files changed

Lines changed: 1697 additions & 1057 deletions

‎CHANGELOG.md‎

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,13 @@
22

33
## 0.22.0 - 2026-07-19
44

5-
- Harden diagnostic and CLI ergonomics: make `--message-format` global across
6-
package commands, keep structured diagnostics on stderr and successful JSON
7-
payloads on stdout, classify exit codes, preserve error causes, assign a
8-
stable backend diagnostic family, render Unicode source snippets by terminal
9-
width, expose JSON run metrics, and make MCP documentation reads UTF-8-safe.
5+
- Harden diagnostic and CLI ergonomics: make global `--json` the canonical
6+
machine-output switch and emit exactly one success or failure document on
7+
stdout; retain hidden `--message-format=json` compatibility, classify exit
8+
codes, preserve error causes, assign stable `E2xxx` backend diagnostics with
9+
LSP `codeDescription` links, render Unicode source snippets by terminal
10+
width, unify VM/simulator run metrics, centralise core command rendering,
11+
and make MCP documentation reads UTF-8-safe.
1012
- Add the bounded no-profile Fiber interoperability path. Metadata schema 55
1113
records the structurally derived `fungible-type-group-v1` entry; its ELF
1214
verifies exact 16-byte little-endian `u128` data, checked full-group
@@ -82,10 +84,15 @@
8284
serialization, or ABI representation; escape, root lifecycle crossing, and
8385
calls outside `Pure`/`ReadOnly` helpers with dedicated `&T` parameters fail
8486
closed. Runtime metadata and ProofPlan expose the checked-static evidence.
85-
- Bump compile metadata to schema version 50 for callable/flow/evidence fields,
86-
`runtime.transaction_view_handles`, and bounded collection source, ownership,
87-
cardinality, vacuity, capacity-builder, evidence-tier, and type-validity
88-
fields, plus `runtime.borrow_regions`.
87+
- Advance compile metadata through schema version 55. The 0.22 schema sequence
88+
adds callable/flow/evidence fields, `runtime.transaction_view_handles`,
89+
bounded collection source/ownership/cardinality/vacuity/capacity evidence,
90+
type validity, borrow regions, capability proofs, enum layouts, protocol-role
91+
candidates, and the bounded Fiber compatibility contract.
92+
- Publish the complete 0.22 release record, refresh the current wiki/roadmap and
93+
MCP documentation topics, document extension submodule initialization, and
94+
replace the unreachable VS Code gitlink with a validated 0.22 extension
95+
commit.
8996

9097
## 0.21.1 - 2026-07-11
9198

‎README.md‎

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -454,6 +454,13 @@ CellScript includes production-style local language tooling for early users:
454454
status-bar feedback. It shells out to `cellc` (or a `cargo run` fallback), so
455455
behavior stays identical to CLI and CI gates.
456456

457+
The extension is a Git submodule. A source checkout that will build or package
458+
it must initialize the pinned, release-reviewed commit first:
459+
460+
```bash
461+
git submodule update --init editors/vscode-cellscript
462+
```
463+
457464
The 0.19 ecosystem-reuse work adds a formal headless
458465
`cellscript-ckb-adapter` crate. The compiler emits semantic action plans and
459466
ABI evidence; the adapter uses `ckb-sdk-rust` to materialize CKB transaction
@@ -496,6 +503,9 @@ or CellFabric intent engine.
496503
- [0.19 roadmap](docs/archive/0.19/CELLSCRIPT_0_19_ROADMAP.md)
497504
- [0.20 release notes](docs/releases/CELLSCRIPT_0_20_RELEASE_NOTES.md)
498505
- [0.21 release notes](docs/releases/CELLSCRIPT_0_21_RELEASE_NOTES.md)
506+
- [0.22 release notes](docs/releases/CELLSCRIPT_0_22_RELEASE_NOTES.md)
507+
- [0.22 type and set theory roadmap](roadmap/CELLSCRIPT_0_22_TYPE_AND_SET_THEORY_ROADMAP.md)
508+
- [0.22 bounded Fiber interoperability guide](examples/fiber/README.md)
499509
- [Agentic Loops and cellscript-mcp tutorial](docs/wiki/Tutorial-13-Agentic-Loops-and-cellscript-mcp.md)
500510

501511
---
@@ -842,20 +852,22 @@ still fail closed.
842852
| `--target-profile ckb` | Use the CKB profile |
843853
| `--entry-action <ACTION>` | Compile a single action as the artifact entrypoint |
844854
| `--entry-lock <LOCK>` | Compile a single lock as the artifact entrypoint |
845-
| `--json` | Emit machine-readable summaries where supported (successful payloads) |
846-
| `--message-format=json` | Global diagnostic transport for direct mode and every subcommand; failures are JSON on stderr. |
855+
| `--json` | Emit one machine-readable result on stdout for success or failure; the flag is global and may appear before or after a subcommand |
847856
| `--color=auto\|always\|never` | Control ANSI colour output. `auto` is the default; `NO_COLOR=1` forces `never` |
848857
| `--production` | Apply production-oriented metadata policy checks |
849858
| `--deny-fail-closed` | Reject fail-closed runtime features or obligations |
850859
| `--deny-ckb-runtime` | Reject CKB transaction/syscall runtime requirements |
851860
| `--deny-runtime-obligations` | Reject runtime-required verifier obligations |
852861

853-
Successful command payloads selected by `--json` are written to stdout.
854-
Diagnostics selected by `--message-format=json` are written to stderr and
855-
include `status`, `category`, `exit_code`, stable diagnostic codes when
856-
available, source ranges, and cause chains. Usage errors exit with `2`;
857-
compilation errors use `1`; classified I/O, network, authentication, and
858-
internal failures use `74`, `69`, `77`, and `70` respectively.
862+
Results selected by `--json` are written to stdout for both success and
863+
failure, so `cellc build --json | jq` cannot lose an error document. Failure
864+
results include `status`, `category`, `exit_code`, stable diagnostic codes when
865+
available, source ranges, and cause chains. The hidden
866+
`--message-format=json` spelling remains a deprecated compatibility alias.
867+
Usage errors exit with `2`; compilation errors use `1`; classified I/O,
868+
network, authentication, and internal failures use `74`, `69`, `77`, and `70`
869+
respectively. Compiler backend codes are documented in
870+
[`docs/CELLSCRIPT_COMPILER_ERROR_CODES.md`](docs/CELLSCRIPT_COMPILER_ERROR_CODES.md).
859871

860872
---
861873

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# CellScript Compiler Error Codes
2+
3+
Compiler diagnostics use stable numeric ranges. Runtime verifier exits remain
4+
in the low-numbered `E####` registry documented by
5+
`CELLSCRIPT_RUNTIME_ERROR_CODES.md`; backend/compiler failures use the
6+
non-overlapping `E2xxx` range.
7+
8+
| Code | Name | Meaning | Suggested action |
9+
| --- | --- | --- | --- |
10+
| `E2000` | `backend-uncategorized` | Backend failure outside a classified boundary. | Preserve the full diagnostic and the source that reached code generation. |
11+
| `E2001` | `backend-empty-artifact` | Code generation produced no artifact bytes. | Check entrypoint selection and artifact target. |
12+
| `E2100` | `type-layout-lowering` | A type could not be lowered to its backend storage layout. | Check fixed widths, schema fields, and payload layouts. |
13+
| `E2101` | `entry-abi-lowering` | The selected entrypoint could not be lowered to the entry ABI. | Check entry parameters and witness ABI support. |
14+
| `E2102` | `action-lowering` | An action body could not be lowered. | Inspect the named action and operation in the diagnostic. |
15+
| `E2103` | `lock-lowering` | A lock body could not be lowered. | Inspect the named lock and target runtime requirements. |
16+
| `E2104` | `pure-function-lowering` | A pure function could not be lowered. | Check call ABI, return layout, and the reported expression. |
17+
| `E2200` | `unresolved-assembly-symbol` | Generated assembly references a missing label or call target. | Check callable reachability and helper closure. |
18+
| `E2201` | `assembly-layout` | Generated assembly could not form a valid machine layout. | Check sections, labels, branches, and block ordering. |
19+
| `E2202` | `instruction-encoding` | A RISC-V instruction or immediate could not be encoded. | Check the mnemonic, operands, registers, and immediate range. |
20+
| `E2300` | `elf-emission` | A valid RISC-V ELF artifact could not be constructed. | Check entrypoint, section layout, offsets, and size constraints. |
21+
| `E2400` | `external-toolchain` | An explicitly configured RISC-V toolchain failed. | Check the toolchain environment variables, executable paths, and stderr. |
22+
| `E2900` | `backend-invariant` | An internal backend invariant failed after semantic checking. | Retain the source and compiler version and report a compiler defect. |
23+
24+
The CLI exposes these codes in human diagnostics and in the `diagnostics[].code`
25+
field of `--json` failures. The language server publishes them through the LSP
26+
diagnostic `code` field and supplies a `codeDescription` link to this registry.

‎docs/CELLSCRIPT_GATE_POLICY.md‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -207,10 +207,10 @@ coverage pins effect compatibility, escape rejection, and crossing
207207
./scripts/cellscript_gate.sh release-quick
208208
```
209209

210-
For scripted gate wrappers, `--json` selects command result payloads on stdout,
211-
while the global `--message-format=json` selects failure diagnostics on stderr.
212-
Do not merge the two streams before parsing them. Structured diagnostics carry
213-
their category and exit code in addition to source ranges and diagnostic codes.
210+
For scripted gate wrappers, the global `--json` flag selects one command result
211+
on stdout for either success or failure. Structured failures carry their
212+
category and exit code in addition to source ranges and diagnostic codes.
213+
`--message-format=json` remains a hidden deprecated alias for compatibility.
214214

215215
The old release wrapper remains supported:
216216

‎docs/CELLSCRIPT_GRAMMAR_GOVERNANCE_RFC.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ The 0.21 RC adds governance requirements that build on the baseline matrix:
103103
| TemplateLayout metadata | Layout records are metadata-only in this RC, mark cyclic flows as `RootRequired`, acyclic flows as `PathOnlyAllowed`, and reject unsupported `consensus_checked = true`. | `CompileMetadata.template_layouts` schema v44. |
104104
| Compile receipts | `cellc receipt`, `cellc sign-receipt`, `cellc verify-receipt`, and `verify-artifact --receipt` bind metadata/artifact evidence without claiming transaction validity. | `cellscript-compile-receipt-v1`. |
105105
| CLI command groups | Public discovery uses nested `explain`, `tx`, `deploy`, `registry`, `package`, and `auth capability` groups; hidden flat aliases are compatibility only. | `cellc --list` and CLI help. |
106-
| Diagnostic transport | `--message-format=json`, `--color=auto|always|never`, and `NO_COLOR` are part of the scripted diagnostics surface. | CLI command definitions and gate usage. |
106+
| Diagnostic transport | Global `--json`, `--color=auto|always|never`, and `NO_COLOR` are part of the scripted diagnostics surface; hidden `--message-format=json` is compatibility-only. | CLI command definitions and gate usage. |
107107
| Agent tooling | `cellscript-mcp` and the six `docs/skills/cellscript-*` skills are read-oriented compiler surfaces whose freshness is checked by dev/ci gates. | `scripts/check_cellscript_skill_pack.py`. |
108108

109109
## `verification`

‎docs/CELLSCRIPT_RUNTIME_ERROR_CODES.md‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ li a0, 14
1313
Use the error name first when debugging. Numeric codes are retained for VM,
1414
wallet, explorer, and acceptance-script compatibility.
1515

16-
The same table is emitted in metadata schema 30 under
16+
The table was introduced in compile metadata schema 30 and is emitted by the
17+
current schema 55 under
1718
`constraints.runtime_errors`, so `cellc constraints`, `cellc check --json`, and
1819
sidecar metadata all expose the same machine-readable registry.
1920
When a CLI failure can be tied to this registry, stderr uses the same

‎docs/README.md‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,12 @@ drafts. Released versions should use non-draft filenames.
2929
note and release-evidence summary.
3030
- `docs/releases/CELLSCRIPT_0_16_1_RELEASE_NOTES.md` is the final 0.16.1 release
3131
note and release-evidence summary.
32+
- `docs/releases/CELLSCRIPT_0_20_RELEASE_NOTES.md` records the generated-builder
33+
and live-registry line.
34+
- `docs/releases/CELLSCRIPT_0_21_RELEASE_NOTES.md` records semantic closure,
35+
authenticated evidence, the canonical CLI tree, MCP, and skill-pack scope.
36+
- `docs/releases/CELLSCRIPT_0_22_RELEASE_NOTES.md` records the current typed
37+
language, diagnostics, metadata schema 55, and bounded Fiber boundary.
3238

3339
Release candidates and planning notes should not live here unless they are the
3440
final release record.
@@ -65,7 +71,10 @@ High-value active references include:
6571
- `CELLSCRIPT_LINEAR_OWNERSHIP.md`
6672
- `CELLSCRIPT_OUTPUT_BINDINGS.md`
6773
- `CELLSCRIPT_RUNTIME_ERROR_CODES.md`
74+
- `CELLSCRIPT_COMPILER_ERROR_CODES.md`
6875
- `CELLSCRIPT_SCHEDULER_HINTS.md`
76+
- `../examples/fiber/README.md` for the bounded 0.22 Fiber interoperability
77+
operator workflow
6978

7079
## Specs And Future Tracks
7180

@@ -116,6 +125,11 @@ to current branch-specific evidence or forward design:
116125
- `CELLSCRIPT_0_21_ROADMAP.md` for semantic closure, authenticated compiler
117126
evidence, derived cyclic graph views, type-level TemplateLayout metadata, and
118127
deferred optional template Merkleisation
128+
- `../roadmap/CELLSCRIPT_0_22_TYPE_AND_SET_THEORY_ROADMAP.md` for the 0.22 typed
129+
transaction-view, finite quantifier, bounded collection, validity, borrow,
130+
capability, and payload-enum design/implementation record
131+
- `../roadmap/CELLSCRIPT_0_22_FIBER_NATIVE_SUPPORT_PLAN.md` for the implemented
132+
bounded Fiber path and its still-pending production evidence
119133

120134
## Archive
121135

Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
# CellScript 0.22 Release Notes
2+
3+
**Status**: Stable release notes for CellScript 0.22.0.
4+
5+
**Updated**: 2026-07-21.
6+
7+
CellScript 0.22 extends the typed language and evidence model while tightening
8+
the CLI, diagnostics, LSP, and bounded Fiber interoperability path. The release
9+
keeps CKB's Cell model and evidence boundaries explicit: compiler success is
10+
not a production or live-chain claim.
11+
12+
## CLI And Diagnostics
13+
14+
`--json` is the single public machine-output switch. Success and failure emit
15+
exactly one JSON document on stdout; the hidden `--message-format=json` spelling
16+
remains only for compatibility. Public help and `cellc --list` show the
17+
canonical nested command tree.
18+
19+
Backend diagnostics use stable `E2xxx` codes. JSON diagnostics include code,
20+
name, description, and recovery hint; `cellc explain E2202 --json` exposes the
21+
same registry. LSP diagnostics carry the standard `code` field and a
22+
`codeDescription` link. VM and simulator `cellc run --json` results now share
23+
one schema, with unavailable `cycles` or `steps` represented as `null`.
24+
25+
## Typed 0.22 Language Surface
26+
27+
The 0.22 line adds:
28+
29+
- checked casts, transitive callable effects, initial/terminal flow evidence,
30+
typed aggregate targets, and a six-tier ProofPlan evidence taxonomy;
31+
- typed read-only transaction handles such as `InputView<T>`, `OutputView<T>`,
32+
`CellDepView`, `HeaderDepView`, and `WitnessArgsView`;
33+
- finite `forall` and `count(...)` invariant quantification over closed source
34+
views;
35+
- source-aware `BoundedCellSet<T, N>` and witness/static
36+
`BoundedList<T, N>` contracts with `consume_each` and `create_each`;
37+
- a closed capability algebra with explicit entailment evidence;
38+
- concrete fixed-width payload enums with exhaustive matching and bounded ABI
39+
support;
40+
- canonical type `validity` blocks, including the explicit
41+
builder-evidence boundary for `env::block_number()`;
42+
- compile-time-only `borrow root as view { ... }` regions;
43+
- deterministic participant-role attribution in ProtocolGraph metadata.
44+
45+
Unsupported dynamic, recursive, generic, unbounded, or authority-ambiguous
46+
forms remain rejected or explicitly recorded as deferred/runtime-required.
47+
48+
## Metadata Schema 55
49+
50+
Current artifacts emit compile metadata schema 55. It carries the 0.22
51+
callable/flow evidence, transaction-view handles, bounded collections,
52+
capability proofs, enum layouts, protocol-role candidates, validity predicates,
53+
borrow regions, and the bounded Fiber compatibility contract. Source, artifact,
54+
and constraints sub-schemas retain their own version fields.
55+
56+
Consumers must compare the emitted version rather than assuming that an older
57+
schema number remains current. Historical release documents may still name the
58+
schema in which a field first appeared.
59+
60+
## Bounded Fiber Interoperability
61+
62+
The separate `cellscript-fiber-adapter` crate derives a dedicated
63+
`fungible-type-group-v1` artifact and native Fiber UDT configuration from typed
64+
compiler, deployment, live-cell, and node evidence. It does not add a Fiber
65+
target profile or depend on `fiber-lib`.
66+
67+
The path is deliberately narrow: exact 16-byte little-endian `u128` Cell data,
68+
full Type Script group conservation, and closed issuance/destruction authority
69+
formats. Local-devnet scenarios cover bounded multi-hop payment and watchtower
70+
force-close flows. The clean pinned full lifecycle/negative matrix remains
71+
pending, so 0.22 does not claim production-ready Fiber interoperability.
72+
73+
See `examples/fiber/README.md` for the operator workflow and examples.
74+
75+
## Editor And Agent Tooling
76+
77+
The VS Code extension is maintained as the
78+
`editors/vscode-cellscript` submodule. The 0.22 extension release adds grammar
79+
and snippet coverage for the new language forms while continuing to delegate
80+
semantic diagnostics and reports to `cellc`.
81+
82+
`cellscript-mcp` adds bounded 0.22 language, Fiber interoperability, and roadmap
83+
documentation topics. MCP remains read-only and does not become a second
84+
compiler, builder, or deployment client.
85+
86+
## Deferred And External Evidence
87+
88+
The following remain outside a compiler-only 0.22 claim:
89+
90+
- production Fiber readiness without the pinned external lifecycle matrix;
91+
- builder, capacity, tx-pool, commit, and live-chain evidence represented by
92+
non-compiler ProofPlan tiers;
93+
- dynamic/generic payload ADTs and unbounded collection iteration;
94+
- transaction-view reads inside type validity predicates;
95+
- consensus-checked TemplateLayout commitments and canonical AST/IR receipt
96+
hashes.
97+
98+
## Validation Boundary
99+
100+
Routine local work:
101+
102+
```bash
103+
./scripts/cellscript_gate.sh dev
104+
```
105+
106+
Merge readiness:
107+
108+
```bash
109+
./scripts/cellscript_gate.sh ci
110+
```
111+
112+
Backend changes:
113+
114+
```bash
115+
./scripts/cellscript_gate.sh backend
116+
```
117+
118+
Production-facing release claims still require the release gate and its
119+
external CKB/Fiber evidence dependencies.

‎docs/skills/cellscript-diagnostics/SKILL.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,6 @@ next check.
2424

2525
Validation defaults:
2626

27-
- run `cellc check --message-format=json`;
27+
- run `cellc check --json`;
2828
- run `cellc explain <CODE>`;
2929
- keep write-producing commands behind explicit confirmation.
Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
---
22
name: cellscript-language-basics
3-
description: CellScript action, transition, resource, shared, receipt, capability, flow, and fail-closed basics.
3+
description: CellScript action, transition, resource, capability, finite quantifier, bounded collection, validity, borrow, and fail-closed basics.
44
references:
55
- docs/wiki/Tutorial-02-Language-Basics.md
66
- docs/wiki/Tutorial-03-Resources-and-Cell-Effects.md
77
- docs/wiki/Tutorial-09-Action-Model-and-Canonical-Syntax.md
8+
- docs/wiki/Tutorial-11-Scoped-Invariants-and-ProofPlan.md
89
- examples/token.cell
910
commands:
1011
- cellc check
@@ -15,14 +16,16 @@ commands:
1516

1617
Use this skill when writing or reviewing CellScript source. Prefer the action
1718
model already documented in the repository: visible actions, explicit
18-
transitions, resource/shared/receipt declarations, and verification blocks.
19+
transitions, resource/shared/receipt declarations, finite source views,
20+
bounded collection ownership, validity predicates, borrow regions, and
21+
verification blocks.
1922

2023
Do not introduce actor-style terminology or hidden state transitions. If a
2124
surface is reserved, deferred, metadata-only, runtime-required, or fail-closed,
2225
say so directly and point to current compiler evidence.
2326

2427
Validation defaults:
2528

26-
- run `cellc check --message-format=json` for source feedback;
29+
- run `cellc check --json` for source feedback;
2730
- use `cellc explain <CODE>` for diagnostic recovery;
2831
- inspect bundled examples before inventing syntax.

0 commit comments

Comments
 (0)