feat(scaffold): match SDK v0.2.0 — Slug, v0.1.0-dev, Need callback#31
Merged
Conversation
Updates the module scaffold template so freshly-created modules pick up
the v0.2.0 SDK contract end-to-end:
- main.go.tmpl: add Slug: "__MS_SLUG__" between ID and Name. The token
was already in scaffold.rs and substituted in go.mod / response
bodies; just wasn't wired into ms.Init's Config.
- main.go.tmpl: bump default Versions key from "v0.1.0" to "v0.1.0-dev".
The -dev prerelease tag distinguishes "iterating locally" from
"real release"; mirrorstack publish prompts to promote it before
shipping. See docs/module-identity-and-storage-prefix.md.
- main.go.tmpl: replace stale ms.DependsOn("oauth-core") doc-comment
example with the v0.2.0 shape — @<owner>/<id>@<version> spec plus
the optional Need callback declaring n.Table / n.Event.
- go.mod.tmpl: pin app-module-sdk to v0.2.0 so scaffolded modules
resolve Need / OptionalDependOn / Config.Slug.
- scaffold tests: assert each substitution lands and stale shapes are
gone (Slug present, v0.1.0-dev replaces v0.1.0, DependsOn example
matches v0.2.0, go.mod pins v0.2.0).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Updates the module scaffold so
mirrorstack module initproduces source trees that match the SDK v0.2.0 contract end-to-end. Three template fixes plus a SDK pin bump:Slug: "__MS_SLUG__"toms.Init(ms.Config{...})templates/module/main.go.tmplSlugpart of Config; manifest carries it from day one. The__MS_SLUG__token was already inscaffold.rsand substituted intogo.mod/ response bodies — just wasn't wired intomain.go'sms.Initcall.Versionskeyv0.1.0→v0.1.0-devtemplates/module/main.go.tmpl-devprerelease tag distinguishes "iterating locally" from "real release".mirrorstack publish(planned) prompts to promote it before shipping. Perdocs/module-identity-and-storage-prefix.md.ms.DependsOn("oauth-core")doc-comment exampletemplates/module/main.go.tmpl@<owner>/<id>@<version>plus thefunc(n *ms.Need) { n.Table(...); n.Event(...) }callback shape — the actual contract scaffolded modules need.v0.2.0templates/module/go.mod.tmplv0.1.1. Scaffolded modules needNeed/OptionalDependOn/Config.Slugfrom v0.2.0 to compile.What scaffolded modules look like now
Test plan
cargo build --all-targetscleancargo test --quietclean — 64 tests pass (4 new:render_substitutes_slug_into_config_slug,render_versions_default_is_dev_prerelease,render_dependson_example_matches_v0_2_shape,render_go_mod_pins_sdk_v0_2)cargo clippy --all-targets -- -D warningscleancargo fmt --checkcleanReviewer's quick-glance check
In
templates/module/main.go.tmpl:ID: "__MS_MODULE_ID__"— unchangedSlug: "__MS_SLUG__""v0.1.0-dev"DependsOnexample withNeedcallbackIn
templates/module/go.mod.tmpl:v0.1.1→v0.2.0Out of scope
mirrorstack publishcommand itself (planned PR 2 ofmodule-identity-and-storage-prefix.md). The template'sv0.1.0-devdefault is set up for it; the publish-time-devpromotion logic lands separately.OptionalDependOn/OnEventexample in the events template — separate small follow-up.🤖 Generated with Claude Code