From 78f9829ddb59e6a052d1889b87b0e651c1d928a5 Mon Sep 17 00:00:00 2001 From: jettwang Date: Wed, 19 Aug 2026 23:36:11 +0800 Subject: [PATCH] feat: add MakeCode song export and release v0.7.1 Compile scenes to Microsoft MakeCode song encoding v0 (`scorekit makecode`) as paste-ready music.createSong TypeScript plus a voice-mapping manifest. Chip amplitudes follow intensity against a mix budget so Arcade/micro:bit speakers do not clip. Documents the target and updates the acceptance matrix. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> --- Cargo.lock | 2 +- Cargo.toml | 2 +- README.md | 1 + docs-site/src/agent-skill.md | 2 +- docs-site/src/architecture.md | 11 +- docs-site/src/commands.md | 16 + docs-site/src/introduction.md | 5 +- docs-site/src/machine-interface.md | 3 +- docs-site/src/scene-protocol.md | 2 +- docs/roadmap.md | 40 + skills/scorekit/SKILL.md | 29 +- skills/scorekit/reference.md | 3 +- src/main.rs | 109 +++ src/makecode.rs | 1305 ++++++++++++++++++++++++++++ tests/cli.rs | 188 ++++ tests/golden/forest.makecode.ts | 3 + 16 files changed, 1697 insertions(+), 24 deletions(-) create mode 100644 src/makecode.rs create mode 100644 tests/golden/forest.makecode.ts diff --git a/Cargo.lock b/Cargo.lock index 0f1f88d..6b5ff91 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -552,7 +552,7 @@ dependencies = [ [[package]] name = "scorekit" -version = "0.7.0" +version = "0.7.1" dependencies = [ "assert_cmd", "clap", diff --git a/Cargo.toml b/Cargo.toml index 7f35812..4e59802 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "scorekit" -version = "0.7.0" +version = "0.7.1" edition = "2024" [dependencies] diff --git a/README.md b/README.md index f0b87cc..d700c76 100644 --- a/README.md +++ b/README.md @@ -19,6 +19,7 @@ Because the score is plain text, it lives in git next to your code: diff it, rev - **Scene suites** — intro / explore / combat / victory sections that share the same musical motifs, compiled from a single file. - **Exact event clips** — stable-ID pitched/percussion events, section variants, and deterministic step/linear automation for arrangements that need authored syncopation, fills, filter sweeps, or talking-bass motion. - **Sound textures** — layer field recordings, ambience, and SFX (water, birds, engines…) as deterministic loops or beat-scheduled one-shots without baking local paths into the scene. +- **MakeCode songs** — `scorekit makecode` compiles the same scene into ``music.createSong(hex`…`)`` TypeScript for MakeCode Arcade and micro:bit V2, one song per section, with a manifest of every voice mapping. - **`meta.json`** — exact loop points and sample counts, ready for your engine to consume. ## Install diff --git a/docs-site/src/agent-skill.md b/docs-site/src/agent-skill.md index c5d9434..d42914e 100644 --- a/docs-site/src/agent-skill.md +++ b/docs-site/src/agent-skill.md @@ -1,6 +1,6 @@ # Agent Skill -The release archive and source repository include an Agent skill under `skills/scorekit`. It teaches a skill-capable coding Agent how to query the schema, write scenes, validate musical structure, apply grammar profiles, and build assets. +The release archive and source repository include an Agent skill under `skills/scorekit`. It teaches a skill-capable coding Agent how to query the schema, write scenes, validate musical structure, apply grammar profiles, build audio assets, and compile MakeCode `music.createSong` TypeScript. Install it together with the local binary: diff --git a/docs-site/src/architecture.md b/docs-site/src/architecture.md index 52f16f3..c6ec7b4 100644 --- a/docs-site/src/architecture.md +++ b/docs-site/src/architecture.md @@ -6,15 +6,16 @@ scorekit is a thin compiler and orchestration layer. YAML scene -> semantic validation -> Score IR - -> deterministic MIDI - -> external renderer - -> PCM audio - -> external FFmpeg export + -> deterministic MIDI + -> external renderer + -> PCM audio + -> external FFmpeg export + -> MakeCode song bytes (`scorekit makecode`) ``` ## Guarantees -- The same DSL and compiler inputs produce byte-identical MIDI. +- The same DSL and compiler inputs produce byte-identical MIDI, and the same scene produces byte-identical MakeCode song encoding. - Loop and stem lengths are derived from quantized musical time. - File-writing commands stage output and publish it atomically. - JSON Schema and structured errors expose the same contract used by the CLI. diff --git a/docs-site/src/commands.md b/docs-site/src/commands.md index bbb19e6..1040cbf 100644 --- a/docs-site/src/commands.md +++ b/docs-site/src/commands.md @@ -14,6 +14,7 @@ All commands accept the global `--json` flag. Successful diagnostic commands wri | `schema --resolver` | Print the instrument-resolver config schema | | `lint --grammar ` | Check compiled music against measurable style rules | | `midi -o ` | Compile deterministic Standard MIDI | +| `makecode -o ` | Compile MakeCode `music.createSong` TypeScript (plus a `.meta.json` manifest) | | `render -o ` | Render one MIDI file through a selected backend | | `export