From 8e98e13e2b3e75953fe0f7954970ae222706ddda Mon Sep 17 00:00:00 2001 From: Stephen Walsh <868017+stphnwlsh@users.noreply.github.com> Date: Sat, 5 Dec 2026 14:16:01 +0000 Subject: [PATCH] Record the template release and options in every generated solution --- .agents/skills/releases/SKILL.md | 3 ++- .agents/skills/template-authoring/SKILL.md | 4 +++- .github/workflows/build-pipeline.yml | 7 ++++++- .lmca.json | 17 +++++++++++++++++ README.md | 2 ++ template/README.md | 4 ++++ template/template.csproj | 11 +++++++++++ 7 files changed, 45 insertions(+), 3 deletions(-) create mode 100644 .lmca.json diff --git a/.agents/skills/releases/SKILL.md b/.agents/skills/releases/SKILL.md index f7da3de..3616dd7 100644 --- a/.agents/skills/releases/SKILL.md +++ b/.agents/skills/releases/SKILL.md @@ -26,13 +26,14 @@ Versions are the build date and run number, `YYYY.MM.DD.`, like `2026.12.01 1. **Release Check** runs after Summary passes. It compares `HEAD` with the latest GitHub release tag, ignoring `.github/`. No changes means no release, unless `force` is set. 2. **Publish** downloads the packed template and logs in to NuGet with trusted publishing (`NuGet/login`, no stored API key). It publishes the Presentation project to build an SPDX bill of materials, attests the package, pushes it to nuget.org and creates the GitHub release with the package, the SBOM and notes generated from the pull request labels (`branches-and-pull-requests`). -3. A scheduled release opens its notes with "Monthly release for ". A manual one says "Out-of-cycle release". +3. A scheduled release opens its notes with "Monthly release for ". A manual one says "Out-of-cycle release". Both end with a link to the upgrade guide on the docs site. ### Before the 1st 1. Make sure everything meant for the month is merged and `main` is green. 2. Rehearse: run **Build Pipeline** from the Actions page with `run: release` and `dry-run: true`. It runs Release Check and Publish, logs in to NuGet and builds the SBOM, but pushes, attests and releases nothing. Dry runs work from any branch. 3. Read the run summary: Release Check says what it compared and whether it would publish. +4. Write the month's upgrade notes. Every release's notes link to the upgrade guide on the docs site (`guides/upgrade/`), and that page has a section per release under **What changed in each release**: a few handwritten lines on what someone with an older solution should bring in and anything that needs care, such as a setting that changed name. Add the section for the coming release in a docs site pull request, merged before the 1st. A release with nothing worth porting still gets a line saying so. ### After the 1st diff --git a/.agents/skills/template-authoring/SKILL.md b/.agents/skills/template-authoring/SKILL.md index d7d7df2..06afccf 100644 --- a/.agents/skills/template-authoring/SKILL.md +++ b/.agents/skills/template-authoring/SKILL.md @@ -44,6 +44,8 @@ The repository itself stays all on. The Presentation project and the presentatio A toggle's inputs, such as `authority` and `audience`, are separate symbols, enabled with `isEnabled` and made required with `isRequired` only when the toggle is on. Only `dotnet new` honours those two. Visual Studio and Rider show every input whatever the toggle says ([dotnet/templating#7860](https://github.com/dotnet/templating/issues/7860)), and Rider lists checkboxes first, then text fields in alphabetical order by label. So an input's label starts with its feature, such as "Authentication authority", to sit right under its checkbox, and its IDE description says it's only used when that box is ticked. A toggle that needs another one says so in its conditions, such as `(includeTests && includeArchitectureTests)`. Verify Template checks the defaults, everything on, everything off, and each toggle flipped on its own. +Every generated solution gets `.lmca.json`, which records the template release and the options it was made with, so the docs site's upgrade guide can generate the same solution from the old and new releases and diff them. The repository's copy says `0.0.0-local`; `template/template.csproj` swaps in the package version when it packs. Its options come through the usual replacements: the `sourceName` becomes the name, `Stephen Walsh` the author name and, where the template has `--include-auth`, the `"Authority": ""` and `"Audience": ""` lines the authentication values, inside `//#if (includeAuth)`. A new option gets a line there too. Name the template by its `lmca-` short name, never by anything containing the `sourceName`, which `dotnet new` would replace. + The package includes `src/`, `tests/`, `docs/RUN.md`, the root build files, `AGENTS.md`, `CLAUDE.md` and the engineering skills. It also packs `template/README.md` as the generated solution's `README.md` and `template/ci.yml` as `.github/workflows/ci.yml`, while leaving the template repository's own `README.md`, the rest of `.github/`, the community files and the repository and maintainer skills out. Those skills are listed in `RepositorySkills` in `template/template.csproj`; a new one is added there. The pipeline fails a package over 1 MB. ## Getting found @@ -95,4 +97,4 @@ The README and `NUGET.md` name the aliases under the install commands, and the d ## Check -The Test job's Verify Template step installs the packed template, generates a solution and checks that nothing of the template leaked into it (no `includeAuth` markers, no trace of the template's own name, no `icon.png`) and that it has `README.md` and `.github/workflows/ci.yml`, then checks its format and runs its tests. Where the template has `--include-auth` it does it again with the toggle on, and checks that `--include-auth` without `--authority` is refused with exit code 102. +The Test job's Verify Template step installs the packed template, generates a solution and checks that nothing of the template leaked into it (no `includeAuth` markers, no trace of the template's own name, no `icon.png`) that it has `README.md` and `.github/workflows/ci.yml`, and that `.lmca.json` names the version and the options it was made with, then checks its format and runs its tests. Where the template has `--include-auth` it does it again with the toggle on, and checks that `--include-auth` without `--authority` is refused with exit code 102. diff --git a/.github/workflows/build-pipeline.yml b/.github/workflows/build-pipeline.yml index 1fbd596..66adfed 100644 --- a/.github/workflows/build-pipeline.yml +++ b/.github/workflows/build-pipeline.yml @@ -239,17 +239,19 @@ jobs: test ! -e "$1/icon.png" test -f "$1/README.md" test -f "$1/.github/workflows/ci.yml" + jq -e --arg version "$VERSION" --arg name "$1" '.version == $version and .options.name == $name' "$1/.lmca.json" dotnet format "$1" --verify-no-changes dotnet test "$1" --configuration Release } verify Template.Verification - VARIANTS="the generated solution carries nothing of the template, passes its format check, builds and passes its tests" + VARIANTS="the generated solution carries nothing of the template, records the release and options that made it, passes its format check, builds and passes its tests" # Templates with an auth option are verified a second time with it on, and --include-auth without # --authority has to stop before anything is written (exit code 102, a missing mandatory option). if jq -e '.symbols.includeAuth' .template.config/template.json > /dev/null; then verify Template.Authentication --include-auth --authority https://login.example.com --audience https://api.example.com + jq -e '.options.authentication.Authority == "https://login.example.com"' Template.Authentication/.lmca.json set +e dotnet new "$SHORT_NAME" --name Template.NoAuthority --output Template.NoAuthority --include-auth NO_AUTHORITY=$? @@ -260,6 +262,8 @@ jobs: echo "### Template" >> "$GITHUB_STEP_SUMMARY" echo "The packed template installs, and $VARIANTS." >> "$GITHUB_STEP_SUMMARY" + env: + VERSION: ${{ needs.build.outputs.version }} shell: bash analysis: @@ -597,6 +601,7 @@ jobs: else NOTES="Out-of-cycle release. The template is normally released on the 1st of each month with every change merged since the previous release." fi + NOTES="$NOTES Made a solution with an earlier release? The upgrade guide shows how to bring the changes in: https://leanmeanclean.dev/mcp/guides/upgrade/" echo "notes=$NOTES" >> "$GITHUB_OUTPUT" { echo "### Publish${DRY_RUN:+ (dry run)}" diff --git a/.lmca.json b/.lmca.json new file mode 100644 index 0000000..7dd6ecd --- /dev/null +++ b/.lmca.json @@ -0,0 +1,17 @@ +{ + "$comment": "The template release and options this solution was made with. The upgrade guide uses them to show what changed in the template since: https://leanmeanclean.dev/mcp/guides/upgrade/", + "template": "lmca-mcp", + "version": "0.0.0-local", + "options": { + "name": "CleanModelContextProtocol", + "authorName": "Stephen Walsh", +//#if (includeAuth) + "authentication": { + "Authority": "", + "Audience": "" + } +//#else + "authentication": null +//#endif + } +} diff --git a/README.md b/README.md index 4765241..34b2a1d 100644 --- a/README.md +++ b/README.md @@ -125,6 +125,8 @@ A new version lands on the 1st of each month, as long as something changed, with dotnet new update ``` +That updates the template, not the solution you already made with it. `dotnet new` hands over a solution and never looks back. The [upgrade guide](https://leanmeanclean.dev/mcp/guides/upgrade/) shows exactly what changed between your release and the latest, and lets git merge it in around your own changes. + ## The family | Template | Presentation | diff --git a/template/README.md b/template/README.md index 06fa054..3da5c83 100644 --- a/template/README.md +++ b/template/README.md @@ -17,6 +17,10 @@ docker compose up -d --build See [docs/RUN.md](docs/RUN.md) for the ports, the database and its migrations, the Aspire dashboard and the tests. +## Template updates + +`.lmca.json` records the template release and options this solution was made with. When a new release comes out, the [upgrade guide](https://leanmeanclean.dev/mcp/guides/upgrade/) uses it to show you exactly what changed, so you can bring in the parts you want. Leave it be; the upgrade updates it for you. + ## Docs and coding agents - [AGENTS.md](AGENTS.md): architecture rules, project map and the skills in `.agents/skills/` for coding agents. diff --git a/template/template.csproj b/template/template.csproj index 7f47810..3a310cc 100644 --- a/template/template.csproj +++ b/template/template.csproj @@ -50,4 +50,15 @@ + + + + $(IntermediateOutputPath).lmca.json + + + + + + +