diff --git a/.claude/commands/plan-issue.md b/.claude/commands/plan-issue.md
index acb2f08..faf7f3e 100644
--- a/.claude/commands/plan-issue.md
+++ b/.claude/commands/plan-issue.md
@@ -205,7 +205,7 @@ Clone into a scratch folder outside the repository, `$scratch = Join-Path ([IO.P
2. A check step: `build_command` and the checks the trial ran in the clone, now in the repository.
3. One step for each project file that step 3 found, with its exact old and new text.
4. When the trial printed `README.md doesn't follow the .NET library layout yet`, one step titled `Bring README.md to the .NET library layout`, after the project-file steps. Its Change runs `./.template/Test-Readme.ps1 -Fix`, which puts the template's header block at the top of a README that has none, the `## Project` block right below a `## Project` heading that has none and the package header block at the top of each package readme that has none, then deletes the old title, description and badge lines the header block replaces, quoting each, keeps the library's own badges, such as a coverage badge, in a centred `
` paragraph right below the header block, deletes the `## Project` links the block repeats, keeping the project's own below it, deletes each package readme's old title and the badges its block repeats, keeping the package's own badges on a line right below the block, writes a package readme the trial names as missing, with what the package is for, `## Installation` and an example, and adds or moves `## Installation`, `## Quick start`, `## Usage` and `## Project` into that order, naming for each section the README's own text it takes, so no line of the project's is lost (the template's ADR-0055 and ADR-0061). When a gap is the blank `repository` answer, the update step's `-Data` gets `repository = ''`, the project's GitHub repository. Its Done-when runs `$o = @(./.template/Test-Readme.ps1); if (-not $? -or $LASTEXITCODE -or ($o -match '^(Warning: |::warning::)')) { exit 1 } else { exit 0 }`, which also fails on a gap the check only warns about, under GitHub Actions too.
- 5. When the project has `changelog.d/README.md` after the trial's update and `./.template/Publish-Release.ps1 -Fold -WhatIf`, run in the trial's clone, doesn't print `Nothing to fold.`, one step titled `Fold published changelog entries into `, before the gate. Its Change runs `./.template/Publish-Release.ps1 -Fold`, which writes each published release whose entries are still in `changelog.d/` into the changelog as its section and deletes those files (ADR-0081 in `docs/decisions/project-template/`); its Files line names the changelog and the entry files the trial's run named; its Done-when is `$o = @(./.template/Publish-Release.ps1 -Fold -WhatIf); if ($? -and ($o -join ' ') -match 'Nothing to fold\.') { exit 0 } else { exit 1 }`.
+ 5. When the project has `changelog.d/README.md` after the trial's update and `./.template/Publish-Release.ps1 -Fold -WhatIf`, run in the trial's clone, doesn't print `Nothing to fold.`, one step titled `Fold changelog entries into `, before the gate. Its Change runs `./.template/Publish-Release.ps1 -Fold`, which writes each published release whose entries are still in `changelog.d/` into the changelog as its section, and, under `release: none` in `AGENTS.md`'s Landing section, each entry file no release published into its `## [Unreleased]`, and deletes those files (ADR-0081 and ADR-0087 in `docs/decisions/project-template/`); its Files line names the changelog and the entry files the trial's run named; its Done-when is `$o = @(./.template/Publish-Release.ps1 -Fold -WhatIf); if ($? -and ($o -join ' ') -match 'Nothing to fold\.') { exit 0 } else { exit 1 }`.
6. The gate, last: the gate `AGENTS.md` names, or else `build_command` and then `test_command`.
When the trial adds `.github/workflows/codeql.yml`, its output says so, with the commands written for this project's own GitHub repository, which the trial's clone has as its `origin`. The plan's Review checklist then starts with a step for the person, done before the update's pull request can pass, since GitHub refuses the workflow's results while CodeQL's default setup is on and an executor never calls `gh`: list the default setup's languages with `gh api repos///code-scanning/default-setup --jq .languages`, turn the default setup off with `gh api -X PATCH repos///code-scanning/default-setup -f state=not-configured`, and re-run the pull request's failed Analyze jobs. No step of the plan runs either command.
diff --git a/.claude/commands/plan-template-update.md b/.claude/commands/plan-template-update.md
index 74a77c5..190e67e 100644
--- a/.claude/commands/plan-template-update.md
+++ b/.claude/commands/plan-template-update.md
@@ -41,7 +41,7 @@ Clone into a scratch folder outside the repository, `$scratch = Join-Path ([IO.P
2. A check step: `build_command` and the checks the trial ran in the clone, now in the repository.
3. One step for each project file that step 3 found, with its exact old and new text.
4. When the trial printed `README.md doesn't follow the .NET library layout yet`, one step titled `Bring README.md to the .NET library layout`, after the project-file steps. Its Change runs `./.template/Test-Readme.ps1 -Fix`, which puts the template's header block at the top of a README that has none, the `## Project` block right below a `## Project` heading that has none and the package header block at the top of each package readme that has none, then deletes the old title, description and badge lines the header block replaces, quoting each, keeps the library's own badges, such as a coverage badge, in a centred `
` paragraph right below the header block, deletes the `## Project` links the block repeats, keeping the project's own below it, deletes each package readme's old title and the badges its block repeats, keeping the package's own badges on a line right below the block, writes a package readme the trial names as missing, with what the package is for, `## Installation` and an example, and adds or moves `## Installation`, `## Quick start`, `## Usage` and `## Project` into that order, naming for each section the README's own text it takes, so no line of the project's is lost (the template's ADR-0055 and ADR-0061). When a gap is the blank `repository` answer, the update step's `-Data` gets `repository = ''`, the project's GitHub repository. Its Done-when runs `$o = @(./.template/Test-Readme.ps1); if (-not $? -or $LASTEXITCODE -or ($o -match '^(Warning: |::warning::)')) { exit 1 } else { exit 0 }`, which also fails on a gap the check only warns about, under GitHub Actions too.
- 5. When the project has `changelog.d/README.md` after the trial's update and `./.template/Publish-Release.ps1 -Fold -WhatIf`, run in the trial's clone, doesn't print `Nothing to fold.`, one step titled `Fold published changelog entries into `, before the gate. Its Change runs `./.template/Publish-Release.ps1 -Fold`, which writes each published release whose entries are still in `changelog.d/` into the changelog as its section and deletes those files (ADR-0081 in `docs/decisions/project-template/`); its Files line names the changelog and the entry files the trial's run named; its Done-when is `$o = @(./.template/Publish-Release.ps1 -Fold -WhatIf); if ($? -and ($o -join ' ') -match 'Nothing to fold\.') { exit 0 } else { exit 1 }`.
+ 5. When the project has `changelog.d/README.md` after the trial's update and `./.template/Publish-Release.ps1 -Fold -WhatIf`, run in the trial's clone, doesn't print `Nothing to fold.`, one step titled `Fold changelog entries into `, before the gate. Its Change runs `./.template/Publish-Release.ps1 -Fold`, which writes each published release whose entries are still in `changelog.d/` into the changelog as its section, and, under `release: none` in `AGENTS.md`'s Landing section, each entry file no release published into its `## [Unreleased]`, and deletes those files (ADR-0081 and ADR-0087 in `docs/decisions/project-template/`); its Files line names the changelog and the entry files the trial's run named; its Done-when is `$o = @(./.template/Publish-Release.ps1 -Fold -WhatIf); if ($? -and ($o -join ' ') -match 'Nothing to fold\.') { exit 0 } else { exit 1 }`.
6. The gate, last: the gate `AGENTS.md` names, or else `build_command` and then `test_command`.
When the trial adds `.github/workflows/codeql.yml`, its output says so, with the commands written for this project's own GitHub repository, which the trial's clone has as its `origin`. The plan's Review checklist then starts with a step for the person, done before the update's pull request can pass, since GitHub refuses the workflow's results while CodeQL's default setup is on and an executor never calls `gh`: list the default setup's languages with `gh api repos///code-scanning/default-setup --jq .languages`, turn the default setup off with `gh api -X PATCH repos///code-scanning/default-setup -f state=not-configured`, and re-run the pull request's failed Analyze jobs. No step of the plan runs either command.
diff --git a/.copier-answers.yml b/.copier-answers.yml
index 84feb0c..7a8a11e 100644
--- a/.copier-answers.yml
+++ b/.copier-answers.yml
@@ -1,5 +1,5 @@
# Written by Copier; never edit by hand. Change an answer with .template\Update-Project.ps1 -Data.
-_commit: v0.165.0
+_commit: v0.166.0
_src_path: https://github.com/NCodeGroup/project-template.git
author_name: NCode Group
build_command: npm run build
diff --git a/.github/instructions/project-template.instructions.md b/.github/instructions/project-template.instructions.md
index c3683ed..21e0c3f 100644
--- a/.github/instructions/project-template.instructions.md
+++ b/.github/instructions/project-template.instructions.md
@@ -23,7 +23,7 @@ Work in this repository is planned by a frontier model and executed by cheaper o
- A finished step is committed as `Plan step N: `, staging only the files the step lists (never `git add -A`, never `PLAN.md`); a re-planned step is recorded as an empty commit, `Re-plan step N: `.
- The workflow commands are in Claude Code (`.claude/commands/`), VS Code's Copilot Chat (`.github/prompts/` and `.github/agents/`) and Copilot CLI (`.github/skills/`), and `PLAN.md` is the only state they share: any of them can plan, execute, re-plan or review the same plan, whichever wrote the steps before.
- `/ship-plan` lands a reviewed plan as the `## Landing` section of `AGENTS.md` says. `integrate: pull-request`, the default, pushes the plan's branch and opens a pull request whose description summarizes the plan and ends with one `Closes ` line per issue, then one per open follow-up issue the plan's work completes, which it records on a `Completes:` line of `PLAN.md`, then one `Refs ` line per issue it only refers to. Before it opens the pull request, and each time it pushes to an open one, it lists the open issues labelled `follow-up`, or the label `follow-up-label` names, created since the plan's branch left the default branch, or every open one when the branch changes `.copier-answers.yml`'s `_commit:` line, as a template update does, and judges each against the branch's diff from the default branch, as a review would, never by its title alone; an issue the work only partly completes stays open and, once the plan has landed, gets an `Autopilot:` comment naming what the plan did and what remains, and its body rewritten to describe only what remains. `integrate: direct` pushes its commits to the default branch, after it looks for the same follow-up issues, and once the commits land it comments on and closes each one its work completes, because no pull request closes them; when the default branch has moved since the plan branched, it first adds a step that merges it in, because that push must fast-forward, and lands once that step is reviewed. `release: tag` or `tag+release` also tags the plan's `Release:` version and publishes a release from that version's section of the `changelog` file (default `CHANGELOG.md`); the default, `release: none`, does neither. A plan has a `Release:` line only when it changes something a release ships: the product's code, a file its package carries, such as the readme nuget.org shows, or its build output. A plan that changes only documentation-site pages, which deploy from every push, CI, decision records, tests or repository docs has none: `/ship-plan` lands it with no tag and no release, and its changelog entries wait under `## [Unreleased]` for the next release, as ADR-0032 in `docs/decisions/project-template/` says. It writes that version into the pull request's description as a `Release: ` line. On GitHub, `.github/workflows/tag-release.yml` reads it, or the changelog's newest section, and tags and publishes the release as the pull request merges, so `/ship-plan` run after the merge finds both done and does them only when that workflow didn't. When another plan has landed the `Release:` version first, it adds a step that merges in the default branch and moves the plan's changelog section to the next free version, which `.template/Get-PlanState.ps1` prints as `renumber`, and lands once that step is reviewed. In a pre-release project, whose changelog has no release section, it moves only the plan's `Release:` line and adds no step. While the plan's pull request is open, the next `/ship-plan` after that review pushes the step to it. When the default branch changed files the plan also changed, so its pull request would conflict, it doesn't push or open it: it adds a step that merges in the default branch and resolves the files the state script's `conflicts` line names, and lands once that step is reviewed. It never merges the default branch in when the merge is clean. `draft: yes` opens the pull request as a draft, as `/ship-plan draft` does; the default is `draft: no`. `gate: ` runs that command from the repository root before it pushes, such as `gate: ./build/dod.ps1 -Fast`, and stops when it exits non-zero or changes a file; the default, `gate: none`, runs nothing. `prelude: ` names one PowerShell command that sets up the shell, such as `prelude: ./build/env.ps1`, a script in the repository that puts a tool installed through a version manager on `PATH`: `/ship-plan`, `/run-issues`, `/address-feedback` and `/run-feedback` dot-source it before the gate, executors and coordinators before each Done-when command, in the same PowerShell, and plans name it in Context for the executor instead of repeating a guard in every step. When it fails, they stop and show its error; the default, `prelude: none`, runs nothing. `pr-format: #` writes the pull request's title and description as that section of the file says, such as a conventional-commit title; the default, `pr-format: none`, uses the plan's title and a short summary. Without a Landing section, or for a key it leaves out, the defaults apply. It asks once before it pushes, drops the empty `Plan:` and `Re-plan step` commits from a branch that was never pushed, comments on and closes each of the plan's issues, and files its follow-ups as issues labelled `follow-up`, or the label `follow-up-label` names, except the ones you drop: in this repository with `follow-ups: issues`, the default, in another with `follow-ups: `, or nowhere with `follow-ups: none`, where it lists them for you to record. With `follow-ups: issues`, you can also name follow-ups to act on next: they are filed too, and `/finish-plan` then names `/plan-issue #` for each. Before the plan lands, you can instead name follow-ups to fix in its pull request: each becomes a step of the plan, and nothing is filed for it. Run it again after a pull request merges, or after it stopped, and it carries on where it left off.
-- The changelog, the file the `changelog` key of the `## Landing` section names (default `CHANGELOG.md`), follows [Keep a Changelog 1.1.0](https://keepachangelog.com/en/1.1.0/). It has `## [Unreleased]` first, then one `## [1.4.0] - 2026-10-28` section per release, newest first, with entries grouped under `### Added`, `### Changed`, `### Deprecated`, `### Removed`, `### Fixed` and `### Security`, and compare links at the end. Every plan's last step writes it. A plan without a `Release:` line adds its entries under `## [Unreleased]`, and a plan with one moves them into its new version's section. The first such step creates the file when the project has none. Where the project has `changelog.d/README.md`, a plan writes its entries to a file of its own, `changelog.d/-.md`, instead, and never edits the changelog: the release its merge makes takes the version its `Release:` line names, or the next free one, and its notes from the entry files the merge added, and `.template/Publish-Release.ps1 -Fold`, run in a pull request of its own, writes published entries into the changelog (ADR-0081). A changelog in another format, such as one an adopted project already had, is left as it is: plans with a `Release:` line add sections in its own style, and plans without one don't touch it. To change that, have a plan convert it, such as `/plan-migration Convert CHANGELOG.md to Keep a Changelog 1.1.0`. When the project has version tags the changelog has no section for, such as releases from before it had one, `Update-Project.ps1` and the template's `Adopt-Project.ps1` print a `/plan-migration` request to backfill them, and each plan lists the backfill as a follow-up until it lands. In a pre-release project, the changelog describes the product as it is instead: `## [Unreleased]` holds only `### Added` and `### Security`, every plan's last step edits its entries in place to match the code, the file has no release section, a release's notes are that section, and the version tags before 1.0.0 need none; the plan that releases the first stable version moves the entries into that version's section.
+- The changelog, the file the `changelog` key of the `## Landing` section names (default `CHANGELOG.md`), follows [Keep a Changelog 1.1.0](https://keepachangelog.com/en/1.1.0/). It has `## [Unreleased]` first, then one `## [1.4.0] - 2026-10-28` section per release, newest first, with entries grouped under `### Added`, `### Changed`, `### Deprecated`, `### Removed`, `### Fixed` and `### Security`, and compare links at the end. Every plan's last step writes it. A plan without a `Release:` line adds its entries under `## [Unreleased]`, and a plan with one moves them into its new version's section. The first such step creates the file when the project has none. Where the project has `changelog.d/README.md`, a plan writes its entries to a file of its own, `changelog.d/-.md`, instead, and never edits the changelog: the release its merge makes takes the version its `Release:` line names, or the next free one, and its notes from the entry files the merge added, and `.template/Publish-Release.ps1 -Fold`, run in a pull request of its own, writes published entries into the changelog (ADR-0081). A workflow or script of the project's own that publishes a release reads its notes with `.template/Publish-Release.ps1 -Notes -OutFile `; under `release: none`, `-Fold` also writes the entry files no release published into `## [Unreleased]`, and a release made by hand is tagged first, then folded in a pull request of its own (ADR-0087). A changelog in another format, such as one an adopted project already had, is left as it is: plans with a `Release:` line add sections in its own style, and plans without one don't touch it. To change that, have a plan convert it, such as `/plan-migration Convert CHANGELOG.md to Keep a Changelog 1.1.0`. When the project has version tags the changelog has no section for, such as releases from before it had one, `Update-Project.ps1` and the template's `Adopt-Project.ps1` print a `/plan-migration` request to backfill them, and each plan lists the backfill as a follow-up until it lands. In a pre-release project, the changelog describes the product as it is instead: `## [Unreleased]` holds only `### Added` and `### Security`, every plan's last step edits its entries in place to match the code, the file has no release section, a release's notes are that section, and the version tags before 1.0.0 need none; the plan that releases the first stable version moves the entries into that version's section.
- A clean `/review-plan-diff` records the commit it reviewed on a `Reviewed:` line in `PLAN.md`, and `/ship-plan` lands only work that matches it. `/continue-plan` shows where each open plan stands and the command to run next. Both run `.template/Get-PlanState.ps1`, which prints those facts for the plan in a folder.
- Never push, force-push or open a pull request unless asked. Don't count on an approval prompt to stop a push: `git push` can run without one, as `.claude/settings.json` lets it in Claude Code, so the check that follows is what catches an unexpected push. Before a push you were asked for, list what the unpushed commits contain and stop on anything unexpected, such as `PLAN.md`, secrets or large files. Run `git fetch origin`, then `git log --stat origin/..` when `origin` has the branch you push to, or `git log --stat origin/..` when it doesn't yet, as before a plan branch's first push; `git ls-remote --exit-code --heads origin ` exits 0 when it has the branch and 2 when it doesn't; stop and report on any other exit, because that means `origin` couldn't say. Compare with `origin`, not the branch's upstream: a plan branch made with `--no-track` has none, and one made from the default branch tracks that branch instead of its own.
- Before such a push, made without `/ship-plan`, retire a finished plan: when every step in `PLAN.md` is marked `[x]`, the review's fix steps included, delete `PLAN.md`, so no finished plan is left in the checkout. When a step is still open, keep `PLAN.md` and say which steps remain before you push. Unless the Landing section says `follow-ups: none`, first find the follow-up issues the branch completes, as `/ship-plan` does: the open issues labelled `follow-up`, or the label `follow-up-label` names, created since the branch left the default branch, or every open one when the branch changes `.copier-answers.yml`'s `_commit:` line, as a template update does, each judged against `git diff origin/...HEAD` as a review would, never by its title alone; put each one the work completes on the plan's `Completes:` line. When it has an `Issue:` or `Completes:` line, draft the pull request description from it before deleting it: as the section the Landing section's `pr-format` names says, or two to five lines summarizing its steps and Decisions, then one `Closes ` line per issue on the `Issue:` line, then one per issue on its `Completes:` line, then one `Refs ` line per issue on its `Refs:` line, each on a line of its own, such as `Closes #42` and `Refs owner/repo#90`. Use it when you open the pull request, or put it in the open one with `gh pr edit --body-file `; when you weren't asked for a pull request, give it in your reply. When the push goes straight to the default branch, as with `integrate: direct`, no pull request closes those issues: note the issues on the `Issue:` and `Completes:` lines before you delete `PLAN.md`, and once the commits land, comment on each one still open that the work completes it, naming the commit, then close it. `/ship-plan` keeps `PLAN.md` until `/finish-plan` deletes it.
diff --git a/.github/prompts/plan-issue.prompt.md b/.github/prompts/plan-issue.prompt.md
index 5cb9145..dbed07f 100644
--- a/.github/prompts/plan-issue.prompt.md
+++ b/.github/prompts/plan-issue.prompt.md
@@ -211,7 +211,7 @@ Clone into a scratch folder outside the repository, `$scratch = Join-Path ([IO.P
2. A check step: `build_command` and the checks the trial ran in the clone, now in the repository.
3. One step for each project file that step 3 found, with its exact old and new text.
4. When the trial printed `README.md doesn't follow the .NET library layout yet`, one step titled `Bring README.md to the .NET library layout`, after the project-file steps. Its Change runs `./.template/Test-Readme.ps1 -Fix`, which puts the template's header block at the top of a README that has none, the `## Project` block right below a `## Project` heading that has none and the package header block at the top of each package readme that has none, then deletes the old title, description and badge lines the header block replaces, quoting each, keeps the library's own badges, such as a coverage badge, in a centred `
` paragraph right below the header block, deletes the `## Project` links the block repeats, keeping the project's own below it, deletes each package readme's old title and the badges its block repeats, keeping the package's own badges on a line right below the block, writes a package readme the trial names as missing, with what the package is for, `## Installation` and an example, and adds or moves `## Installation`, `## Quick start`, `## Usage` and `## Project` into that order, naming for each section the README's own text it takes, so no line of the project's is lost (the template's ADR-0055 and ADR-0061). When a gap is the blank `repository` answer, the update step's `-Data` gets `repository = ''`, the project's GitHub repository. Its Done-when runs `$o = @(./.template/Test-Readme.ps1); if (-not $? -or $LASTEXITCODE -or ($o -match '^(Warning: |::warning::)')) { exit 1 } else { exit 0 }`, which also fails on a gap the check only warns about, under GitHub Actions too.
- 5. When the project has `changelog.d/README.md` after the trial's update and `./.template/Publish-Release.ps1 -Fold -WhatIf`, run in the trial's clone, doesn't print `Nothing to fold.`, one step titled `Fold published changelog entries into `, before the gate. Its Change runs `./.template/Publish-Release.ps1 -Fold`, which writes each published release whose entries are still in `changelog.d/` into the changelog as its section and deletes those files (ADR-0081 in `docs/decisions/project-template/`); its Files line names the changelog and the entry files the trial's run named; its Done-when is `$o = @(./.template/Publish-Release.ps1 -Fold -WhatIf); if ($? -and ($o -join ' ') -match 'Nothing to fold\.') { exit 0 } else { exit 1 }`.
+ 5. When the project has `changelog.d/README.md` after the trial's update and `./.template/Publish-Release.ps1 -Fold -WhatIf`, run in the trial's clone, doesn't print `Nothing to fold.`, one step titled `Fold changelog entries into `, before the gate. Its Change runs `./.template/Publish-Release.ps1 -Fold`, which writes each published release whose entries are still in `changelog.d/` into the changelog as its section, and, under `release: none` in `AGENTS.md`'s Landing section, each entry file no release published into its `## [Unreleased]`, and deletes those files (ADR-0081 and ADR-0087 in `docs/decisions/project-template/`); its Files line names the changelog and the entry files the trial's run named; its Done-when is `$o = @(./.template/Publish-Release.ps1 -Fold -WhatIf); if ($? -and ($o -join ' ') -match 'Nothing to fold\.') { exit 0 } else { exit 1 }`.
6. The gate, last: the gate `AGENTS.md` names, or else `build_command` and then `test_command`.
When the trial adds `.github/workflows/codeql.yml`, its output says so, with the commands written for this project's own GitHub repository, which the trial's clone has as its `origin`. The plan's Review checklist then starts with a step for the person, done before the update's pull request can pass, since GitHub refuses the workflow's results while CodeQL's default setup is on and an executor never calls `gh`: list the default setup's languages with `gh api repos///code-scanning/default-setup --jq .languages`, turn the default setup off with `gh api -X PATCH repos///code-scanning/default-setup -f state=not-configured`, and re-run the pull request's failed Analyze jobs. No step of the plan runs either command.
diff --git a/.github/prompts/plan-template-update.prompt.md b/.github/prompts/plan-template-update.prompt.md
index 232a526..75144dc 100644
--- a/.github/prompts/plan-template-update.prompt.md
+++ b/.github/prompts/plan-template-update.prompt.md
@@ -47,7 +47,7 @@ Clone into a scratch folder outside the repository, `$scratch = Join-Path ([IO.P
2. A check step: `build_command` and the checks the trial ran in the clone, now in the repository.
3. One step for each project file that step 3 found, with its exact old and new text.
4. When the trial printed `README.md doesn't follow the .NET library layout yet`, one step titled `Bring README.md to the .NET library layout`, after the project-file steps. Its Change runs `./.template/Test-Readme.ps1 -Fix`, which puts the template's header block at the top of a README that has none, the `## Project` block right below a `## Project` heading that has none and the package header block at the top of each package readme that has none, then deletes the old title, description and badge lines the header block replaces, quoting each, keeps the library's own badges, such as a coverage badge, in a centred `
` paragraph right below the header block, deletes the `## Project` links the block repeats, keeping the project's own below it, deletes each package readme's old title and the badges its block repeats, keeping the package's own badges on a line right below the block, writes a package readme the trial names as missing, with what the package is for, `## Installation` and an example, and adds or moves `## Installation`, `## Quick start`, `## Usage` and `## Project` into that order, naming for each section the README's own text it takes, so no line of the project's is lost (the template's ADR-0055 and ADR-0061). When a gap is the blank `repository` answer, the update step's `-Data` gets `repository = ''`, the project's GitHub repository. Its Done-when runs `$o = @(./.template/Test-Readme.ps1); if (-not $? -or $LASTEXITCODE -or ($o -match '^(Warning: |::warning::)')) { exit 1 } else { exit 0 }`, which also fails on a gap the check only warns about, under GitHub Actions too.
- 5. When the project has `changelog.d/README.md` after the trial's update and `./.template/Publish-Release.ps1 -Fold -WhatIf`, run in the trial's clone, doesn't print `Nothing to fold.`, one step titled `Fold published changelog entries into `, before the gate. Its Change runs `./.template/Publish-Release.ps1 -Fold`, which writes each published release whose entries are still in `changelog.d/` into the changelog as its section and deletes those files (ADR-0081 in `docs/decisions/project-template/`); its Files line names the changelog and the entry files the trial's run named; its Done-when is `$o = @(./.template/Publish-Release.ps1 -Fold -WhatIf); if ($? -and ($o -join ' ') -match 'Nothing to fold\.') { exit 0 } else { exit 1 }`.
+ 5. When the project has `changelog.d/README.md` after the trial's update and `./.template/Publish-Release.ps1 -Fold -WhatIf`, run in the trial's clone, doesn't print `Nothing to fold.`, one step titled `Fold changelog entries into `, before the gate. Its Change runs `./.template/Publish-Release.ps1 -Fold`, which writes each published release whose entries are still in `changelog.d/` into the changelog as its section, and, under `release: none` in `AGENTS.md`'s Landing section, each entry file no release published into its `## [Unreleased]`, and deletes those files (ADR-0081 and ADR-0087 in `docs/decisions/project-template/`); its Files line names the changelog and the entry files the trial's run named; its Done-when is `$o = @(./.template/Publish-Release.ps1 -Fold -WhatIf); if ($? -and ($o -join ' ') -match 'Nothing to fold\.') { exit 0 } else { exit 1 }`.
6. The gate, last: the gate `AGENTS.md` names, or else `build_command` and then `test_command`.
When the trial adds `.github/workflows/codeql.yml`, its output says so, with the commands written for this project's own GitHub repository, which the trial's clone has as its `origin`. The plan's Review checklist then starts with a step for the person, done before the update's pull request can pass, since GitHub refuses the workflow's results while CodeQL's default setup is on and an executor never calls `gh`: list the default setup's languages with `gh api repos///code-scanning/default-setup --jq .languages`, turn the default setup off with `gh api -X PATCH repos///code-scanning/default-setup -f state=not-configured`, and re-run the pull request's failed Analyze jobs. No step of the plan runs either command.
diff --git a/.github/skills/plan-issue/SKILL.md b/.github/skills/plan-issue/SKILL.md
index 6f56dc8..bb61396 100644
--- a/.github/skills/plan-issue/SKILL.md
+++ b/.github/skills/plan-issue/SKILL.md
@@ -209,7 +209,7 @@ Clone into a scratch folder outside the repository, `$scratch = Join-Path ([IO.P
2. A check step: `build_command` and the checks the trial ran in the clone, now in the repository.
3. One step for each project file that step 3 found, with its exact old and new text.
4. When the trial printed `README.md doesn't follow the .NET library layout yet`, one step titled `Bring README.md to the .NET library layout`, after the project-file steps. Its Change runs `./.template/Test-Readme.ps1 -Fix`, which puts the template's header block at the top of a README that has none, the `## Project` block right below a `## Project` heading that has none and the package header block at the top of each package readme that has none, then deletes the old title, description and badge lines the header block replaces, quoting each, keeps the library's own badges, such as a coverage badge, in a centred `
` paragraph right below the header block, deletes the `## Project` links the block repeats, keeping the project's own below it, deletes each package readme's old title and the badges its block repeats, keeping the package's own badges on a line right below the block, writes a package readme the trial names as missing, with what the package is for, `## Installation` and an example, and adds or moves `## Installation`, `## Quick start`, `## Usage` and `## Project` into that order, naming for each section the README's own text it takes, so no line of the project's is lost (the template's ADR-0055 and ADR-0061). When a gap is the blank `repository` answer, the update step's `-Data` gets `repository = ''`, the project's GitHub repository. Its Done-when runs `$o = @(./.template/Test-Readme.ps1); if (-not $? -or $LASTEXITCODE -or ($o -match '^(Warning: |::warning::)')) { exit 1 } else { exit 0 }`, which also fails on a gap the check only warns about, under GitHub Actions too.
- 5. When the project has `changelog.d/README.md` after the trial's update and `./.template/Publish-Release.ps1 -Fold -WhatIf`, run in the trial's clone, doesn't print `Nothing to fold.`, one step titled `Fold published changelog entries into `, before the gate. Its Change runs `./.template/Publish-Release.ps1 -Fold`, which writes each published release whose entries are still in `changelog.d/` into the changelog as its section and deletes those files (ADR-0081 in `docs/decisions/project-template/`); its Files line names the changelog and the entry files the trial's run named; its Done-when is `$o = @(./.template/Publish-Release.ps1 -Fold -WhatIf); if ($? -and ($o -join ' ') -match 'Nothing to fold\.') { exit 0 } else { exit 1 }`.
+ 5. When the project has `changelog.d/README.md` after the trial's update and `./.template/Publish-Release.ps1 -Fold -WhatIf`, run in the trial's clone, doesn't print `Nothing to fold.`, one step titled `Fold changelog entries into `, before the gate. Its Change runs `./.template/Publish-Release.ps1 -Fold`, which writes each published release whose entries are still in `changelog.d/` into the changelog as its section, and, under `release: none` in `AGENTS.md`'s Landing section, each entry file no release published into its `## [Unreleased]`, and deletes those files (ADR-0081 and ADR-0087 in `docs/decisions/project-template/`); its Files line names the changelog and the entry files the trial's run named; its Done-when is `$o = @(./.template/Publish-Release.ps1 -Fold -WhatIf); if ($? -and ($o -join ' ') -match 'Nothing to fold\.') { exit 0 } else { exit 1 }`.
6. The gate, last: the gate `AGENTS.md` names, or else `build_command` and then `test_command`.
When the trial adds `.github/workflows/codeql.yml`, its output says so, with the commands written for this project's own GitHub repository, which the trial's clone has as its `origin`. The plan's Review checklist then starts with a step for the person, done before the update's pull request can pass, since GitHub refuses the workflow's results while CodeQL's default setup is on and an executor never calls `gh`: list the default setup's languages with `gh api repos///code-scanning/default-setup --jq .languages`, turn the default setup off with `gh api -X PATCH repos///code-scanning/default-setup -f state=not-configured`, and re-run the pull request's failed Analyze jobs. No step of the plan runs either command.
diff --git a/.github/skills/plan-template-update/SKILL.md b/.github/skills/plan-template-update/SKILL.md
index 063becf..4e2b3de 100644
--- a/.github/skills/plan-template-update/SKILL.md
+++ b/.github/skills/plan-template-update/SKILL.md
@@ -45,7 +45,7 @@ Clone into a scratch folder outside the repository, `$scratch = Join-Path ([IO.P
2. A check step: `build_command` and the checks the trial ran in the clone, now in the repository.
3. One step for each project file that step 3 found, with its exact old and new text.
4. When the trial printed `README.md doesn't follow the .NET library layout yet`, one step titled `Bring README.md to the .NET library layout`, after the project-file steps. Its Change runs `./.template/Test-Readme.ps1 -Fix`, which puts the template's header block at the top of a README that has none, the `## Project` block right below a `## Project` heading that has none and the package header block at the top of each package readme that has none, then deletes the old title, description and badge lines the header block replaces, quoting each, keeps the library's own badges, such as a coverage badge, in a centred `
` paragraph right below the header block, deletes the `## Project` links the block repeats, keeping the project's own below it, deletes each package readme's old title and the badges its block repeats, keeping the package's own badges on a line right below the block, writes a package readme the trial names as missing, with what the package is for, `## Installation` and an example, and adds or moves `## Installation`, `## Quick start`, `## Usage` and `## Project` into that order, naming for each section the README's own text it takes, so no line of the project's is lost (the template's ADR-0055 and ADR-0061). When a gap is the blank `repository` answer, the update step's `-Data` gets `repository = ''`, the project's GitHub repository. Its Done-when runs `$o = @(./.template/Test-Readme.ps1); if (-not $? -or $LASTEXITCODE -or ($o -match '^(Warning: |::warning::)')) { exit 1 } else { exit 0 }`, which also fails on a gap the check only warns about, under GitHub Actions too.
- 5. When the project has `changelog.d/README.md` after the trial's update and `./.template/Publish-Release.ps1 -Fold -WhatIf`, run in the trial's clone, doesn't print `Nothing to fold.`, one step titled `Fold published changelog entries into `, before the gate. Its Change runs `./.template/Publish-Release.ps1 -Fold`, which writes each published release whose entries are still in `changelog.d/` into the changelog as its section and deletes those files (ADR-0081 in `docs/decisions/project-template/`); its Files line names the changelog and the entry files the trial's run named; its Done-when is `$o = @(./.template/Publish-Release.ps1 -Fold -WhatIf); if ($? -and ($o -join ' ') -match 'Nothing to fold\.') { exit 0 } else { exit 1 }`.
+ 5. When the project has `changelog.d/README.md` after the trial's update and `./.template/Publish-Release.ps1 -Fold -WhatIf`, run in the trial's clone, doesn't print `Nothing to fold.`, one step titled `Fold changelog entries into `, before the gate. Its Change runs `./.template/Publish-Release.ps1 -Fold`, which writes each published release whose entries are still in `changelog.d/` into the changelog as its section, and, under `release: none` in `AGENTS.md`'s Landing section, each entry file no release published into its `## [Unreleased]`, and deletes those files (ADR-0081 and ADR-0087 in `docs/decisions/project-template/`); its Files line names the changelog and the entry files the trial's run named; its Done-when is `$o = @(./.template/Publish-Release.ps1 -Fold -WhatIf); if ($? -and ($o -join ' ') -match 'Nothing to fold\.') { exit 0 } else { exit 1 }`.
6. The gate, last: the gate `AGENTS.md` names, or else `build_command` and then `test_command`.
When the trial adds `.github/workflows/codeql.yml`, its output says so, with the commands written for this project's own GitHub repository, which the trial's clone has as its `origin`. The plan's Review checklist then starts with a step for the person, done before the update's pull request can pass, since GitHub refuses the workflow's results while CodeQL's default setup is on and an executor never calls `gh`: list the default setup's languages with `gh api repos///code-scanning/default-setup --jq .languages`, turn the default setup off with `gh api -X PATCH repos///code-scanning/default-setup -f state=not-configured`, and re-run the pull request's failed Analyze jobs. No step of the plan runs either command.
diff --git a/.github/workflows/dependency-review.yml b/.github/workflows/dependency-review.yml
index 4b7c7d2..33d2d01 100644
--- a/.github/workflows/dependency-review.yml
+++ b/.github/workflows/dependency-review.yml
@@ -37,9 +37,11 @@ jobs:
permissions:
contents: read
steps:
- # The same step is in codeql.yml's languages job, scorecard.yml's visibility job and tag-release.yml's policy
- # job; keep the four the same (the template's tests/Test-Template.ps1 checks it). The template owns this file, so
- # the copies a project adds in workflows of its own are listed in codeql.yml's comment, which the project owns.
+ # The same step is in the template's codeql.yml, in its languages job, and in scorecard.yml's visibility job and
+ # tag-release.yml's policy job; keep the four the same (the template's tests/Test-Template.ps1 checks it). The
+ # template owns this file, so a project lists the copies it adds in workflows of its own in its CodeQL workflow,
+ # which it owns: in the comment above the step in codeql.yml, or, in a CodeQL workflow of its own without the
+ # step (the template's ADR-0047), on a header comment line that starts "The project's own copies:".
- name: Read whether the repository is public
id: visibility
shell: pwsh
diff --git a/.github/workflows/scorecard.yml b/.github/workflows/scorecard.yml
index b3f83da..5df0af6 100644
--- a/.github/workflows/scorecard.yml
+++ b/.github/workflows/scorecard.yml
@@ -30,9 +30,11 @@ jobs:
outputs:
public: ${{ steps.visibility.outputs.public }}
steps:
- # The same step is in codeql.yml's languages job, dependency-review.yml and tag-release.yml's policy job;
- # keep the four the same (the template's tests/Test-Template.ps1 checks it). The template owns this file, so the
- # copies a project adds in workflows of its own are listed in codeql.yml's comment, which the project owns.
+ # The same step is in the template's codeql.yml, in its languages job, and in dependency-review.yml and
+ # tag-release.yml's policy job; keep the four the same (the template's tests/Test-Template.ps1 checks it). The
+ # template owns this file, so a project lists the copies it adds in workflows of its own in its CodeQL workflow,
+ # which it owns: in the comment above the step in codeql.yml, or, in a CodeQL workflow of its own without the
+ # step (the template's ADR-0047), on a header comment line that starts "The project's own copies:".
- name: Read whether the repository is public
id: visibility
shell: pwsh
diff --git a/.github/workflows/tag-release.yml b/.github/workflows/tag-release.yml
index 77485a6..86a30fd 100644
--- a/.github/workflows/tag-release.yml
+++ b/.github/workflows/tag-release.yml
@@ -86,9 +86,11 @@ jobs:
# A public repository's tag is signed, so the release job needs the visibility. It is read from the REST API
# because a scheduled run's event payload may carry no repository (the template's ADR-0056).
- # The same step is in codeql.yml's languages job, scorecard.yml's visibility job and dependency-review.yml; keep
- # the four the same (the template's tests/Test-Template.ps1 checks it). The template owns this file, so the
- # copies a project adds in workflows of its own are listed in codeql.yml's comment, which the project owns.
+ # The same step is in the template's codeql.yml, in its languages job, and in scorecard.yml's visibility job and
+ # dependency-review.yml; keep the four the same (the template's tests/Test-Template.ps1 checks it). The template
+ # owns this file, so a project lists the copies it adds in workflows of its own in its CodeQL workflow, which it
+ # owns: in the comment above the step in codeql.yml, or, in a CodeQL workflow of its own without the step (the
+ # template's ADR-0047), on a header comment line that starts "The project's own copies:".
- name: Read whether the repository is public
id: visibility
if: steps.policy.outputs.release == 'tag' || steps.policy.outputs.release == 'tag+release'
diff --git a/.template-version b/.template-version
index 7ce2352..961e260 100644
--- a/.template-version
+++ b/.template-version
@@ -1 +1 @@
-v0.165.0
+v0.166.0
diff --git a/.template/Publish-Release.ps1 b/.template/Publish-Release.ps1
index f24ac99..cfedddc 100644
--- a/.template/Publish-Release.ps1
+++ b/.template/Publish-Release.ps1
@@ -70,7 +70,8 @@
.github/workflows/publish-chart.yml instead, the same way; with both, publish-image.yml starts publish-chart.yml
itself once every image is recorded (the template's ADR-0076).
- With -Fold it moves the entry files that releases published into the changelog instead (see -Fold).
+ With -Fold it moves the entry files that releases published into the changelog instead (see -Fold), and with -Notes
+ it writes a version's notes to a file (see -Notes).
.PARAMETER Commit
The commit to tag: in the workflow, the commit the push made main point to.
@@ -118,6 +119,26 @@
above the first older section, with its link line. The entry files it took in and the `## [Unreleased]` lines it
took in are deleted. It writes the working tree and commits nothing, so a person runs it in a pull request of its
own. -WhatIf prints the releases and files and changes nothing. It prints `Nothing to fold.` when there is none.
+ Under release: none, where no merge releases anything, it also folds each entry file no release published, one HEAD
+ has and the commit of the newest version tag merged into HEAD lacks (a tag below 1.0.0 doesn't count in a
+ pre-release: untracked project), into ## [Unreleased], merged with the entries there under one heading per group,
+ in the order the files reached the branch, and deletes it (the template's ADR-0087).
+ Without AGENTS.md it runs as under release: none.
+
+.PARAMETER Notes
+ Write the notes of this version, v1.2.3 or 1.2.3, to -OutFile, and exit without tagging or publishing, under any
+ release policy (the template's ADR-0087). It reads at the commit of the version's tag when the clone has it, else at
+ -Commit. The notes are the version's changelog section with the entry files that the previous version tag's commit
+ lacks and the lines `## [Unreleased]` gained since that tag; without a section they are those alone; in a
+ pre-release: untracked project whose changelog has no release section they are all of `## [Unreleased]` and every
+ entry file. Without changelog.d/README.md they are the section, or such a pre-release project's `## [Unreleased]`.
+ It counts the clone's own tags, which a checkout with fetch-depth: 0 holds, and it fails when the notes are empty.
+ A project's own publishing workflow, or a person releasing by hand, reads a release's notes this way rather than
+ from the changelog alone, which lacks the entries still in changelog.d/.
+ Without AGENTS.md it runs as under release: none.
+
+.PARAMETER OutFile
+ The file -Notes writes, UTF-8 without a byte order mark.
.EXAMPLE
./.template/Publish-Release.ps1 -Commit $env:GITHUB_SHA
@@ -136,6 +157,9 @@
.EXAMPLE
./.template/Publish-Release.ps1 -Fold
+
+.EXAMPLE
+ ./.template/Publish-Release.ps1 -Notes v1.2.3 -OutFile release-notes.md
#>
[CmdletBinding(SupportsShouldProcess)]
param(
@@ -146,7 +170,9 @@ param(
[switch]$Sign,
[switch]$Find,
[switch]$RequireCommit,
- [switch]$Fold
+ [switch]$Fold,
+ [string]$Notes,
+ [string]$OutFile
)
$ErrorActionPreference = 'Stop'
Set-StrictMode -Version Latest
@@ -178,11 +204,11 @@ function Get-LandingPolicy([string[]]$Lines) {
$landing
}
-# The changelog's newest release section: its number, its heading's text and its notes, without the heading and the
-# blank lines around them.
-function Get-NewestRelease([string[]]$Lines) {
+# The changelog's newest release section, or, with -Number, the section of that version: its number, its heading's text
+# and its notes, without the heading and the blank lines around them.
+function Get-NewestRelease([string[]]$Lines, [string]$Number = '') {
for ($i = 0; $i -lt $Lines.Count; $i++) {
- if ($Lines[$i] -notmatch '^## \[(?[^\]]+)\]' -or $Matches.number -eq 'Unreleased') { continue }
+ if ($Lines[$i] -notmatch '^## \[(?[^\]]+)\]' -or $Matches.number -eq 'Unreleased' -or ($Number -and ($Matches.number -replace '^v') -ne $Number)) { continue }
$number = $Matches.number
$notes = [Collections.Generic.List[string]]::new()
for ($j = $i + 1; $j -lt $Lines.Count -and $Lines[$j] -notmatch '^## ' -and $Lines[$j] -notmatch '^\[[^\]]+\]:\s'; $j++) {
@@ -207,6 +233,12 @@ function Get-UnreleasedNotes([string[]]$Lines) {
''
}
+# The index of the changelog's ## [Unreleased] line in $Lines, or -1.
+function Find-UnreleasedHeading($Lines) {
+ for ($i = 0; $i -lt $Lines.Count; $i++) { if ($Lines[$i] -match '^## \[Unreleased\]') { return $i } }
+ -1
+}
+
# GitHub's anchor for a Markdown heading's text.
function Get-HeadingAnchor([string]$Text) {
($Text.Trim().ToLowerInvariant() -replace '[^\p{L}\p{M}\p{N}\p{Pc} -]', '') -replace ' ', '-'
@@ -407,6 +439,38 @@ function Get-EntryNotes([string]$Sha, [string]$Previous, [switch]$All) {
}
}
+# Writes the notes of the release $Version to $Path, as -Notes describes (the template's ADR-0087).
+function Write-VersionNote([string]$Version, [string]$Path) {
+ if ($Version -cnotmatch '^v?(?[0-9]+\.[0-9]+\.[0-9]+)\z') { throw "-Notes takes a release version such as v1.2.3 or 1.2.3, not '$Version'." }
+ $number = $Matches.number
+ $tags = @(& git tag --list)
+ if ($LASTEXITCODE) { throw "Can't list the tags of this clone (git tag exited $LASTEXITCODE)." }
+ $versionTags = @($tags | Where-Object { $_ -cmatch $versionTagPattern })
+ $tag = @(("v$number", $number) | Where-Object { $tags -ccontains $_ }) | Select-Object -First 1
+ $at = if ($tag) { "refs/tags/$tag" } else { $Commit }
+ $sha = (& git rev-parse --verify --quiet "$at^{commit}")
+ if ($LASTEXITCODE -or -not $sha) { throw "$at isn't a commit in this clone." }
+ $lines = Get-ChangelogAt $sha
+ $previous = Get-PreviousVersionTag $number $versionTags
+ $section = if ($null -ne $lines) { Get-NewestRelease $lines $number }
+ if ($section) {
+ $text = $section.Notes
+ if (Test-EntryLayout $sha) {
+ $entry = Get-EntryNotes $sha $previous
+ if ($entry.Files.Count -or $entry.Unreleased.Count) { $text = Merge-ChangelogGroup (@($section.Notes) + $entry.Texts) }
+ }
+ } elseif (Test-EntryLayout $sha) {
+ $text = (Get-EntryNotes $sha $previous -All:($untracked -and -not ($null -ne $lines -and (Get-NewestRelease $lines)))).Notes
+ } elseif ($untracked -and $null -ne $lines) {
+ $text = Get-UnreleasedNotes $lines
+ } else {
+ throw "$changelogName at $sha has no section for $number, and the project keeps no entry files in changelog.d/: there are no notes to write."
+ }
+ if (-not "$text".Trim()) { throw "The notes for $number at $sha are empty: nothing to write." }
+ Set-Content -LiteralPath $Path -Value $text -Encoding utf8NoBOM
+ "Wrote the notes of $number, read at $(if ($tag) { "the tag $tag" } else { $sha }), to $Path."
+}
+
# Whether GitHub has the release for $Version, or an error when it can't be told.
function Test-GitHubRelease([string]$Version) {
$answer = @(& $Gh api "repos/{owner}/{repo}/releases/tags/$Version" --silent 2>&1)
@@ -451,14 +515,13 @@ function Find-ReleaseCommit([switch]$RequireCommit) {
$tags = Get-RemoteTag '.'
$versionTags = @($tags | Where-Object { $_ -cmatch $versionTagPattern })
$prefix = if ($versionTags.Count -and -not @($versionTags | Where-Object { $_ -like 'v*' }).Count) { '' } else { 'v' }
- $preRelease = $landing.ContainsKey('pre-release') -and $landing['pre-release'] -eq 'untracked'
$entries = Test-EntryLayout $tip
$landed = $null
$newest = Get-NewestRelease $lines
if ($newest -and -not ($entries -and $tags -ccontains "$prefix$($newest.Number)")) {
if ($newest.Number -notmatch '^[0-9]+\.[0-9]+\.[0-9]+\z') { Write-Host "$changelogName's newest release, $($newest.Number), isn't a release version such as 1.2.3: a release's version carries no prerelease label (the template's ADR-0075), so retitle the section to its version without one."; return }
$number = $newest.Number
- } elseif ($preRelease -or $entries) {
+ } elseif ($untracked -or $entries) {
# The tag objects and, through ^{}, the commits the version tags name.
$tagRefs = @(& git ls-remote --tags .)
if ($LASTEXITCODE) { throw "Can't read the tags of . (git ls-remote exited $LASTEXITCODE)." }
@@ -602,7 +665,8 @@ function Get-RegistryPublisher([string]$Root) {
# Moves what releases published as entry files into the changelog (the template's ADR-0081): a section for each version
# tag merged into HEAD whose entries are still in files, the entry files and `## [Unreleased]` lines it took in deleted,
-# and the link lines. It writes the working tree only.
+# and the link lines; under release: none also each entry file no release published, into [Unreleased] (ADR-0087). It
+# writes the working tree only.
function Invoke-ChangelogFold {
[CmdletBinding(SupportsShouldProcess)]
param()
@@ -616,7 +680,6 @@ function Invoke-ChangelogFold {
if ($LASTEXITCODE) { throw "Can't list the tags merged into HEAD (git tag exited $LASTEXITCODE)." }
$versionTags = @($merged | Where-Object { $_ -cmatch $versionTagPattern } | Sort-Object { [version]($_ -replace '^v') })
$listed = @($lines | ForEach-Object { if ($_ -cmatch '^## \[?v?(?[0-9]+\.[0-9]+\.[0-9]+)\]?( - \S+)?( \[YANKED\])?\s*\z') { $Matches.number } })
- $untracked = $landing.ContainsKey('pre-release') -and $landing['pre-release'] -eq 'untracked'
$folds = [Collections.Generic.List[object]]::new()
foreach ($tag in $versionTags) {
@@ -631,15 +694,39 @@ function Invoke-ChangelogFold {
$previous = Get-PreviousVersionTag $number $versionTags
$folds.Add([pscustomobject]@{ Number = $number; Tag = $tag; Previous = $previous; Date = "$date".Trim(); Entry = (Get-EntryNotes $sha $previous) })
}
- if (-not $folds.Count) { 'Nothing to fold.'; return }
- $toDelete = @($folds | ForEach-Object { $_.Entry.Files } | Select-Object -Unique | Where-Object { $_ -cne $entryMarker -and (Test-Path -LiteralPath (Join-Path $root $_) -PathType Leaf) })
- "Releases to fold into ${changelogName}: $(($folds | ForEach-Object { $_.Tag }) -join ', '); entry files to delete: $(if ($toDelete.Count) { $toDelete -join ', ' } else { 'none' })."
+ # Under release: none no merge releases an entry file, so the fold also takes in each one no version tag released:
+ # one HEAD has and the newest counted version tag's commit lacks (the template's ADR-0087).
+ $pending = @()
+ if ($release -eq 'none') {
+ $head = (& git rev-parse --verify HEAD)
+ if ($LASTEXITCODE) { throw "Can't read HEAD (git rev-parse exited $LASTEXITCODE)." }
+ $counted = @($versionTags | Where-Object { -not ($untracked -and [version]($_ -replace '^v') -lt [version]'1.0.0') })
+ $newestTag = if ($counted.Count) { $counted[$counted.Count - 1] } else { '' }
+ $atHead = @(& git ls-tree --name-only $head -- changelog.d/)
+ if ($LASTEXITCODE) { throw "Can't read the tree of HEAD (git ls-tree exited $LASTEXITCODE)." }
+ $released = @()
+ if ($newestTag) {
+ $released = @(& git ls-tree --name-only "refs/tags/$newestTag" -- changelog.d/)
+ if ($LASTEXITCODE) { throw "Can't read the tree of $newestTag (git ls-tree exited $LASTEXITCODE)." }
+ }
+ $foldedFiles = @($folds | ForEach-Object { $_.Entry.Files })
+ $pending = [string[]]@($atHead | Where-Object { $_ -cmatch $entryFilePattern -and $_ -cne $entryMarker -and $released -cnotcontains $_ -and $foldedFiles -cnotcontains $_ -and (Test-Path -LiteralPath (Join-Path $root $_) -PathType Leaf) })
+ if ($pending.Count) { $pending = Get-EntryOrder $head $newestTag $pending }
+ }
+ if (-not $folds.Count -and -not $pending.Count) { 'Nothing to fold.'; return }
+
+ $toDelete = @(@($folds | ForEach-Object { $_.Entry.Files }) + @($pending) | Select-Object -Unique | Where-Object { $_ -cne $entryMarker -and (Test-Path -LiteralPath (Join-Path $root $_) -PathType Leaf) })
+ if ($folds.Count) {
+ "Releases to fold into ${changelogName}: $(($folds | ForEach-Object { $_.Tag }) -join ', '); entry files to delete: $(if ($toDelete.Count) { $toDelete -join ', ' } else { 'none' })."
+ }
+ if ($pending.Count) {
+ "Entry files no release published, to fold into the [Unreleased] section of ${changelogName}, since AGENTS.md's Landing section says release: none: $($pending -join ', ')."
+ }
# The lines under [Unreleased] that the folds took in.
$taken = @($folds | ForEach-Object { $_.Entry.Unreleased })
- $at = -1
- for ($i = 0; $i -lt $lines.Count; $i++) { if ($lines[$i] -match '^## \[Unreleased\]') { $at = $i; break } }
+ $at = Find-UnreleasedHeading $lines
if ($at -ge 0 -and $taken.Count) {
$end = $lines.Count
for ($i = $at + 1; $i -lt $lines.Count; $i++) { if ($lines[$i] -match '^## ' -or $lines[$i] -match '^\[[^\]]+\]:\s') { $end = $i; break } }
@@ -689,7 +776,7 @@ function Invoke-ChangelogFold {
for ($i = 0; $i -lt $lines.Count; $i++) {
if ($lines[$i] -match '^\[(?