Skip to content

Commit 3e23ca4

Browse files
tarasclaude
andauthored
Establish the XMD formatter parser foundation (#1475)
* Treat structural indentation as syntax A block's body loses two spaces per enclosing block at the start of each line that has them, a standalone element's line is a delimiter line that supplies its newline only to a nonempty rendering lacking one, and a line four columns past its prefix after a blank line is Markdown indented code. The scanner applies the rule in the same walk that recognizes elements and fences. Repository documents whose unindented block bodies held prefixed content are re-indented so their elements, executable blocks and passive fence bytes are unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Update workflow, testing and smoke expectations for standalone lines Pull request and issue bodies written as blocks no longer begin with the opening line's newline, a skipped standalone Test takes its line with it, and the smoke guide's captures lose the leading newlines their delimiter lines used to contribute. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Anchor the Plan smoke agent's refusal prompt at its first line The refusal prompt no longer begins with the newline its delimiter line used to contribute, and a capture hole matches at least one character. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Keep a standalone element's content indentation A standalone element that is not a block — self-closing, or paired with its content inline — keeps the indentation left after the structural prefix in front of a nonempty rendering, so a component inside a list item renders inside the item. An empty rendering contributes neither indentation nor a line, and the line-ending rule is unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Place a nested preview region as execution places it A standalone `<Output>` nested in a root `<Output>` previews with the indentation left after its prefix and its supplied newline, and an empty one leaves no line, so the preview of a generated root matches its finished rendering. A slotted standalone element's witness now covers its indentation as well as its line ending, and Tier SIN says which rows are the formatter examples. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Share Rust Markdown boundaries in the XMD scanner * Fix CI fixtures for Markdown boundary rules --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
1 parent 5c40839 commit 3e23ca4

90 files changed

Lines changed: 4069 additions & 1733 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.github/workflows/ci.yml‎

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -598,13 +598,10 @@ jobs:
598598
with:
599599
bun-version: 1.4.0
600600

601-
# `deno install` rather than `deno task deps`: the task also caches the
602-
# graphs a browser build and a release compile walk, and it reaches them
603-
# by spawning a child — which does not survive the Windows runner's path
604-
# handling. Nothing here builds the bundle or compiles the CLI, so the
605-
# plain frozen install is the whole preparation this job needs.
601+
# The runtime-only test graph does not need Core's prepared Markdown
602+
# module or the other producers used by the CLI graph.
606603
- name: Install dependencies
607-
run: deno install --frozen
604+
run: deno install --entrypoint --frozen packages/runtime/tests/host-files.test.ts
608605

609606
# The compile below runs under `--node-modules-dir=none`, which resolves
610607
# npm packages from the Deno cache rather than from `node_modules`. This
@@ -712,8 +709,8 @@ jobs:
712709
with:
713710
deno-version: v2.9.5
714711

715-
- name: Install workspace deps
716-
run: deno install
712+
- name: Install site dependencies
713+
run: deno install --entrypoint --frozen site/main.ts site/client.ts site/vite.config.ts
717714

718715
- name: Check (fmt + lint + typecheck)
719716
run: deno task check

‎.gitignore‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,3 +37,6 @@ packages/acp/generated/
3737

3838
# Generated by deps from pinned public tty source and its local patch.
3939
packages/cli/generated/
40+
41+
# Generated by deps from pinned Rust source and crate inputs.
42+
packages/core/generated/

‎.oxfmtrc.json‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
// `packages/*/npm` is generated dnt output, written by a test while the
66
// battery runs; format-checking it fails on a file nobody wrote by hand.
77
// `packages/cli/generated` is the prepared terminal runtime, held to the
8-
// hashes its recipe records.
8+
// hashes its recipe records. The prepared Core Markdown module is likewise
9+
// held to its recipe hash.
910
// The retained-repository history fixtures are journals an older revision
1011
// emitted, held to the SHA-256 their own receipt records: reserializing one
1112
// changes the bytes the evidence is, and the suite that continues them
@@ -19,6 +20,7 @@
1920
"packages/acp/vendor/acpx/**",
2021
"packages/acp/vendor/adapters/claude/sdk-transform.mjs",
2122
"packages/cli/src/repl/vendor/freedom/**",
22-
"packages/cli/generated/**"
23+
"packages/cli/generated/**",
24+
"packages/core/generated/**"
2325
]
2426
}

‎README.md‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,9 @@ Locate the package that owns the behavior you are about to change:
6868
and the checks CI runs.
6969
- `specs/` — the specification each package is held to.
7070

71-
On a fresh clone, start here:
71+
On a fresh clone, install the Rustup launcher alongside the JavaScript tooling,
72+
then run setup. Setup selects and installs the pinned Rust toolchain and WASM
73+
target.
7274

7375
```bash exec
7476
deno task setup
@@ -142,7 +144,8 @@ Select it after changing a dependency, or whenever you want the checkout
142144
restored on its own without building or testing. It executes `deno task setup`,
143145
the preamble block above and the only thing in this repository that installs.
144146
Setup owns both dependency layouts — `node_modules/` and Deno's global cache —
145-
and prepares them in the order their union resolves in: Deno's frozen install
147+
and prepares them in the order their union resolves in: the pinned Markdown
148+
boundary module, Deno's frozen install
146149
and cached module graphs first, then pnpm's store beside it, then the browser
147150
bundle.
148151

‎components/BootstrapNpmPackage.md‎

Lines changed: 94 additions & 94 deletions
Original file line numberDiff line numberDiff line change
@@ -62,19 +62,19 @@ npm --version
6262

6363
<Let as="manifestSchema" select="code[lang=json]">
6464

65-
```json
66-
{
67-
"type": "object",
68-
"properties": {
69-
"name": {
70-
"type": "string",
71-
"pattern": "^@executablemd/[a-z0-9][a-z0-9._-]*$"
65+
```json
66+
{
67+
"type": "object",
68+
"properties": {
69+
"name": {
70+
"type": "string",
71+
"pattern": "^@executablemd/[a-z0-9][a-z0-9._-]*$"
72+
},
73+
"description": { "type": "string" }
7274
},
73-
"description": { "type": "string" }
74-
},
75-
"required": ["name"]
76-
}
77-
```
75+
"required": ["name"]
76+
}
77+
```
7878

7979
</Let>
8080

@@ -385,9 +385,9 @@ file, where you can see it.
385385

386386
<Let as="artifactManifest"><Json value={artifactPackage} /></Let>
387387

388-
```ts eval
389-
const artifactDisplay = artifactManifest.split("\n").map((line) => ` ${line}`).join("\n");
390-
```
388+
```ts eval
389+
const artifactDisplay = artifactManifest.split("\n").map((line) => ` ${line}`).join("\n");
390+
```
391391

392392
<File path="package.json">{artifactManifest}
393393
</File>
@@ -407,28 +407,28 @@ npm pack --dry-run --json
407407

408408
</Let>
409409

410-
```ts eval
411-
const packDisplay = (() => {
412-
let packed = null;
413-
try {
414-
packed = JSON.parse(packOutput.trim());
415-
} catch (error) {
416-
packed = null;
417-
}
418-
const entry = Array.isArray(packed) ? packed[0] : packed;
419-
const files = entry && Array.isArray(entry.files) ? entry.files : [];
420-
if (files.length === 0) {
421-
return " npm reported no files";
422-
}
423-
const width = Math.max(...files.map((file) => String(file.path).length));
424-
const listed = files
425-
.map((file) => ` ${String(file.path).padEnd(width)} ${file.size} B`)
426-
.join("\n");
427-
return `${listed}\n ${files.length} files, ${entry.unpackedSize} B unpacked`;
428-
})();
429-
```
410+
```ts eval
411+
const packDisplay = (() => {
412+
let packed = null;
413+
try {
414+
packed = JSON.parse(packOutput.trim());
415+
} catch (error) {
416+
packed = null;
417+
}
418+
const entry = Array.isArray(packed) ? packed[0] : packed;
419+
const files = entry && Array.isArray(entry.files) ? entry.files : [];
420+
if (files.length === 0) {
421+
return " npm reported no files";
422+
}
423+
const width = Math.max(...files.map((file) => String(file.path).length));
424+
const listed = files
425+
.map((file) => ` ${String(file.path).padEnd(width)} ${file.size} B`)
426+
.join("\n");
427+
return `${listed}\n ${files.length} files, ${entry.unpackedSize} B unpacked`;
428+
})();
429+
```
430430

431-
{packageName}@{bootstrapVersion}
431+
{packageName}@{bootstrapVersion}
432432

433433
{artifactDisplay}
434434

@@ -448,20 +448,20 @@ rest.
448448

449449
<Let as="otpSchema" select="code[lang=json]">
450450

451-
```json
452-
{
453-
"type": "object",
454-
"properties": {
455-
"code": {
456-
"type": "string",
457-
"writeOnly": true,
458-
"pattern": "^\\d{6}$"
451+
```json
452+
{
453+
"type": "object",
454+
"properties": {
455+
"code": {
456+
"type": "string",
457+
"writeOnly": true,
458+
"pattern": "^\\d{6}$"
459+
}
460+
},
461+
"required": ["code"],
462+
"additionalProperties": false
459463
}
460-
},
461-
"required": ["code"],
462-
"additionalProperties": false
463-
}
464-
```
464+
```
465465

466466
</Let>
467467

@@ -479,18 +479,18 @@ one in this document's table means the package has been set up by someone else
479479
and that stops the run here, before the placeholder is published. A refusal
480480
leaves npm exactly as it was.
481481

482-
```bash exec as="trustList"
482+
```bash exec as="trustList"
483483
npm_config_otp={otp.code} npm trust list {packageName} --json --registry {registry}
484-
```
484+
```
485485

486-
```ts eval
487-
const trust = classifyTrust(
488-
trustList,
489-
expectedTrust,
490-
reservation.state === "absent",
491-
);
492-
const trustDetail = indent(trust.detail);
493-
```
486+
```ts eval
487+
const trust = classifyTrust(
488+
trustList,
489+
expectedTrust,
490+
reservation.state === "absent",
491+
);
492+
const trustDetail = indent(trust.detail);
493+
```
494494

495495
<If condition={trust.state === "conflicting"}>
496496

@@ -542,21 +542,21 @@ The registry is read once more, but only to refuse: you have been away with your
542542
authenticator, and a package that gained real versions in the meantime is not
543543
one to publish a placeholder into.
544544

545-
```bash exec as="versionsAfter"
546-
npm view {packageName} versions --json --registry {registry}
547-
```
545+
```bash exec as="versionsAfter"
546+
npm view {packageName} versions --json --registry {registry}
547+
```
548548

549-
```bash exec as="distTagsAfter"
550-
npm view {packageName} dist-tags --json --registry {registry}
551-
```
549+
```bash exec as="distTagsAfter"
550+
npm view {packageName} dist-tags --json --registry {registry}
551+
```
552552

553-
```ts eval
554-
const reservationNow = classifyReservation(
555-
versionsAfter,
556-
distTagsAfter,
557-
bootstrapVersion,
558-
);
559-
```
553+
```ts eval
554+
const reservationNow = classifyReservation(
555+
versionsAfter,
556+
distTagsAfter,
557+
bootstrapVersion,
558+
);
559+
```
560560

561561
<If condition={reservationNow.state === "conflicting" || reservationNow.state === "unreadable"}>
562562

@@ -581,14 +581,14 @@ would have given, from the party that decides it.
581581
`exec as="…"` keeps a successful publish quiet without discarding what npm said,
582582
so each of the three answers is reported in npm's own terms.
583583

584-
```bash exec as="publishResult"
584+
```bash exec as="publishResult"
585585
npm_config_otp={otp.code} npm publish --access public --tag bootstrap --registry {registry}
586-
```
586+
```
587587

588-
```ts eval
589-
const publication = classifyPublish(publishResult, bootstrapVersion);
590-
const publishDetail = indent(publication.detail);
591-
```
588+
```ts eval
589+
const publication = classifyPublish(publishResult, bootstrapVersion);
590+
const publishDetail = indent(publication.detail);
591+
```
592592

593593
<If condition={publication.state === "failed"}>
594594

@@ -675,39 +675,39 @@ So what is read back is the trusted publisher, which is not served from that
675675
cache and answered truthfully throughout: it carries the id that revokes this
676676
configuration, which is worth printing while you are here.
677677

678-
```bash exec as="finalTrustList"
678+
```bash exec as="finalTrustList"
679679
npm_config_otp={otp.code} npm trust list {packageName} --json --registry {registry}
680-
```
680+
```
681681

682-
```ts eval
683-
const finalTrust = classifyTrust(finalTrustList, expectedTrust, false);
684-
const finalTrustDetail = indent(finalTrust.detail);
685-
```
682+
```ts eval
683+
const finalTrust = classifyTrust(finalTrustList, expectedTrust, false);
684+
const finalTrustDetail = indent(finalTrust.detail);
685+
```
686686

687687
<If condition={finalTrust.state !== "expected"}>
688688

689689
npm does not report the trusted publisher this run left behind:
690690

691691
{finalTrustDetail}
692692

693-
```ts eval
694-
throw new Error(
695-
`${packageName} does not carry the expected trusted publisher: ${
696-
finalTrust.detail || finalTrust.state
697-
}`,
698-
);
699-
```
693+
```ts eval
694+
throw new Error(
695+
`${packageName} does not carry the expected trusted publisher: ${
696+
finalTrust.detail || finalTrust.state
697+
}`,
698+
);
699+
```
700700

701701
</If>
702702

703-
{bootstrapVersion} is reserved under the bootstrap dist-tag
704-
{finalTrust.summary}
703+
{bootstrapVersion} is reserved under the bootstrap dist-tag
704+
{finalTrust.summary}
705705

706706
If you ever need to undo the trust configuration — the workflow moves, the
707707
environment is renamed, the package changes hands — revoke it by id and run this
708708
document again:
709709

710-
npm trust revoke {packageName} --id {finalTrust.id}
710+
npm trust revoke {packageName} --id {finalTrust.id}
711711

712712
</TempDir>
713713

‎examples/adversarial-implementation/components/Ticket/Settle.md‎

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -55,13 +55,13 @@ its signed commit and focused evidence requirements.
5555
<Fail message="Implementation needs a saved focused evidence receipt." />
5656
</If>
5757
<Let as="checkout" value={null} />
58-
<If condition={completed && !discovery}>
59-
<Ticket.Checkout repository={pending.call.assignment.repository} as="checkout" />
60-
<Dir path={pending.call.record}><File path="checkout.json"><Json value={checkout} /></File></Dir>
61-
<If condition={checkout.head !== result.revision || !checkout.clean}>
62-
<Fail message="Feedback must identify actual clean HEAD descended from the accepted source revision." />
63-
</If>
64-
</If>
58+
<If condition={completed && !discovery}>
59+
<Ticket.Checkout repository={pending.call.assignment.repository} as="checkout" />
60+
<Dir path={pending.call.record}><File path="checkout.json"><Json value={checkout} /></File></Dir>
61+
<If condition={checkout.head !== result.revision || !checkout.clean}>
62+
<Fail message="Feedback must identify actual clean HEAD descended from the accepted source revision." />
63+
</If>
64+
</If>
6565
<Let as="revision" value={completed ? result.revision : pending.checkpoint.revision} />
6666
<Let as="ancestry" value={null} />
6767
<Let as="changes" value={{paths:[]}} />
@@ -81,13 +81,13 @@ git merge-base --is-ancestor {pending.manifest.assignment.revision} {revision}
8181
<Fail message="The migration changed an API-owned path. Preserve the commit and return an API conflict to the original Planner instead of accepting an unvalidated API change." />
8282
</If>
8383
<Dir path={pending.call.record}><File path="changes.json"><Json value={changes} /></File></Dir>
84-
<If condition={completed}>
85-
<Ticket.Signature repository={pending.call.assignment.repository} revision={revision} as="signature" />
86-
<Dir path={pending.call.record}><File path="signature.json"><Json value={signature} /></File></Dir>
87-
<If condition={signature.exitCode !== 0}>
88-
<Fail message={"Feedback signature verification failed; inspect " + pending.call.record + "/signature.json"} />
89-
</If>
90-
</If>
84+
<If condition={completed}>
85+
<Ticket.Signature repository={pending.call.assignment.repository} revision={revision} as="signature" />
86+
<Dir path={pending.call.record}><File path="signature.json"><Json value={signature} /></File></Dir>
87+
<If condition={signature.exitCode !== 0}>
88+
<Fail message={"Feedback signature verification failed; inspect " + pending.call.record + "/signature.json"} />
89+
</If>
90+
</If>
9191
<If condition={completed && pending.call.role === "implementor" && pending.checkpoint.exactApproval}>
9292
<ExactCorrection.Verify repository={pending.call.assignment.repository} approval={pending.checkpoint.exactApproval} revision={result.revision} as="exactReceipt" />
9393
<Dir path={pending.call.record}><File path="exact-correction.json"><Json value={exactReceipt} /></File></Dir>

0 commit comments

Comments
 (0)