Skip to content

chore(tools): add tools/ directory + Unlist-NugetPackage.ps1 - #223

Merged
ChrisonSimtian merged 1 commit into
mainfrom
chore/tools-unlist-nuget
May 27, 2026
Merged

chore(tools): add tools/ directory + Unlist-NugetPackage.ps1#223
ChrisonSimtian merged 1 commit into
mainfrom
chore/tools-unlist-nuget

Conversation

@ChrisonSimtian

Copy link
Copy Markdown
Collaborator

Why

Surfaced from the v11 / semver-policy work in #220: we need to unlist 102 `Fallout.*` package versions in the `10.3.40`-`10.3.47` range (the ones that shipped breaking changes under patch numbers). Rather than a throwaway shell loop, this PR introduces a proper, reusable tool.

What's in this PR

  • `tools/Unlist-NugetPackage.ps1` — PowerShell Core 7+ tool wrapping `dotnet nuget delete` with two input modes:
    • Single: `-Package Foo -Version 1.2.3` (or comma-separated `-Version 1.0,1.1,1.2`).
    • Bulk: `-JsonPath ./batch.json` (array of `{ package, version }` objects).
    • API key from `-ApiKey` or `$env:NUGET_API_KEY`. Fails fast if neither.
    • `[CmdletBinding(SupportsShouldProcess)]` → `-WhatIf` and `-Confirm` work.
    • Per-item ok/FAIL output; exit code = failure count. Idempotent.
  • `tools/README.md` — directory conventions (not built, not version-bumped, PS Core 7+, comment-based help on every script).
  • `version.json` — adds `pathFilters: [":/", ":!/tools"]` so commits touching only `tools/` don't bump patch height. A typo fix in a tool script no longer produces a phantom `11.0.<n+1>` release.

Smoke-tested locally

```
$ pwsh ./tools/Unlist-NugetPackage.ps1 -Package Foo -Version 1.0.0 -ApiKey dummy -WhatIf
Unlisting 1 package version(s) from https://api.nuget.org/v3/index.json
What if: Performing the operation "Unlist from https://api.nuget.org/v3/index.json" on target "Foo 1.0.0".
[ 1/ 1] Foo 1.0.0 (skipped: -WhatIf)
Done. ok=0 fail=0
```

Bulk mode against a 2-entry JSON also dry-ran cleanly.

Out of scope (follow-up)

The auto-generated CI workflows (`.github/workflows/{ubuntu,macos,windows}-latest.yml` + `release.yml`) have `paths-ignore: [docs/, .assets/, /*.md]` — they don't yet ignore `tools/`. So a `tools/`-only push still triggers the full CI run and release pipeline. Release won't produce a new version (pathFilters prevents height bump → `--skip-duplicate` no-ops on NuGet), but it's a wasted CI cycle. Worth teaching the `[GitHubActions]` attribute about `tools/**` in a separate PR — that touches the generator at `src/Fallout.Common/CI/GitHubActions/`.

Test plan

  • CI green.
  • After merge, build the bulk JSON for our actual 10.3.40-47 case and run the tool against nuget.org with a real API key.

Per-repo convention for operational helper scripts that aren't part of
the build or release pipeline:

  - Not referenced by fallout.slnx / any .csproj — never built or packed.
  - Excluded from version.json's git-height via pathFilters — commits
    that only touch tools/ don't bump the patch version. (No more
    11.0.<n+1> releases just because a script's docblock got tidied.)
  - PowerShell Core 7+ by convention (cross-platform).

First inhabitant: Unlist-NugetPackage.ps1 — wraps `dotnet nuget delete`
with two input modes:

  - Single: -Package Foo -Version 1.2.3 (or -Version 1.0,1.1,1.2)
  - Bulk:   -JsonPath ./batch.json  (array of {package, version})

API key from -ApiKey or $env:NUGET_API_KEY. Fails fast if neither.
SupportsShouldProcess, so -WhatIf and -Confirm work for the mutating
calls. Per-item ok/FAIL output; exit code = failure count.

Built to address the 10.3.40-10.3.47 unlist work that surfaced after
the semver-policy fix in #220 — but kept generic so it's reusable for
any future unlist sweep without modification.

Also adds tools/README.md documenting the conventions for future
inhabitants of the directory.
@ChrisonSimtian
ChrisonSimtian merged commit ecf39d8 into main May 27, 2026
2 checks passed
@ChrisonSimtian
ChrisonSimtian deleted the chore/tools-unlist-nuget branch May 27, 2026 09:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant