Skip to content

Pass the rewrite subcommand from the GitHub Action - #33

Merged
Mpdreamz merged 1 commit into
mainfrom
fix/action-rewrite-subcommand
Nov 12, 2026
Merged

Mpdreamz merged 1 commit into
mainfrom
fix/action-rewrite-subcommand

Conversation

@Mpdreamz

Copy link
Copy Markdown
Collaborator

The GitHub Action now runs assembly-rewriter rewrite <args> instead of assembly-rewriter <args>, and the packaged skill and the docker run example name the subcommand too.

Fixes #30

What

  • action.yml puts rewrite before ${{ inputs.args }}. Without it, every action run took the bare root-alias path, which writes Error: unknown short option '-i'. to stderr and then rewrites anyway.
  • skills/assembly-rewriter/SKILL.md (shipped in the package) and the README's docker run example use assembly-rewriter rewrite …, matching the rest of the README.
  • The bare invocation is unchanged. The spurious error is A bare positional never reaches the root alias or MapRoot handler argh#138: the leading-flag prefetch reports the root alias's own flags as unknown. It reproduces on Argh 0.18.0 (main) and 0.27.2. The root alias stays on purpose: uses: nullean/assembly-rewriter@v0 runs the edge image, which follows main, with the action.yml of the last release, which has no rewrite. Making a bare call fail would break those runs as soon as this merged. A comment in Program.cs says so.

Verify

  • With a main build (net10.0), assembly-rewriter -i Elasticsearch.Net.dll -o out/Elasticsearch.Net620.dll prints the "unknown short option" error, exits 0 and writes the output. assembly-rewriter rewrite … writes the same output with an empty stderr. Same results with Argh 0.27.2.
  • The skill's rewrite form, with -r and -k, rewrote NEST and Elasticsearch.Net 6.2.0 with an empty stderr.
  • actionlint, zizmor --min-severity medium . and curb check . are clean.
  • Not tested: the action itself. Docker is not available on this machine, and the container image is linux-x64 AOT. The runner joins a docker action's args entries into the docker run command line, which is why a single args string with spaces works today, and why a separate rewrite entry comes out as the first argument.

🤖 Generated with Claude Code

action.yml handed args straight to assembly-rewriter, so every action run took the bare root-alias path,
which prints "unknown short option" (nullean/argh#138) before it runs. The packaged skill and the docker run
example used the same bare call; they now name `rewrite` as the README already does.

The root alias stays, so the edge image keeps working for action.yml versions that predate this.

Fixes #30

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@Mpdreamz Mpdreamz added the bug A defect fixed (patch) label Nov 12, 2026
@Mpdreamz
Mpdreamz merged commit 7a3c0db into main Nov 12, 2026
4 of 5 checks passed
@Mpdreamz
Mpdreamz deleted the fix/action-rewrite-subcommand branch November 12, 2026 09:40
Mpdreamz added a commit that referenced this pull request Nov 12, 2026
Brings every dependency of assembly-rewriter, the GitHub Actions
included, to its latest version, and adapts the build to the tools whose
command lines changed.

**Prompt summary:** Bring every dependency, GitHub Actions included, to
its latest version, drop unused and sponsor-gated packages, and release
the nullean repositories in dependency order.

## What

| Package | Old | New |
|---|---|---|
| Mono.Cecil | 0.11.3 | 0.11.6 |
| ILRepack.Lib | 2.0.18 | 2.0.48 |
| MinVer | 4.3.0 | 8.0.0 |
| Nullean.Argh | 0.18.0 | 0.28.0 |
| Nullean.Make.Fs (build) | 0.25.0 | 0.28.0 |
| Proc.Fs (build) | 0.18.0 | 0.21.0 |
| FSharp.Core (build) | 11.0.101 | 11.0.101 (already latest) |
| minver-cli (tool) | 4.3.0 | 8.0.0 |
| nupkg-validator (tool) | 0.10.1 | 0.11.5 |
| assembly-differ (tool) | 0.16.0 | 0.18.2 |
| curb-cli (tool) | 0.14.0 | 0.14.1 |
| docker/login-action | v3.7.0 | v4.8.0 |
| nullean/.github workflows (release-drafter, zizmor) | v1.3.0 | v1.5.0
|

`global.json` (11.0.100) and the other actions were already on the
latest.

- **TFM ceilings:** none. Mono.Cecil and ILRepack.Lib restore and build
on net8.0 and net10.0.
- **Removed:** MinVer from `build/scripts`, which is not packed.
`Directory.Build.props` now adds it only to packable projects.
- **Sponsor-gated packages:** none were present.
- **Tool manifest order:** assembly-differ is listed before
nupkg-validator, so a restore from a cold cache succeeds.

Changes forced by the bumps:
- MinVer 5 removed `MinVerDefaultPreReleasePhase`. `canary` becomes
`MinVerDefaultPreReleaseIdentifiers` `canary.0` (and
`--default-pre-release-identifiers canary.0` for the CLI), which
computes the same versions (`0.14.6-canary.0.4`).
- nupkg-validator 0.11 needs the `validate` subcommand.
`--allow-roll-forward` was dropped: no version of the validator has that
option, so 0.10.1 ignored it.
- Nullean.Make.Fs 0.27+ makes `-s` a switch, so `publishcontainers -s
true` becomes `publishcontainers -s` in `ci.yml`.
- assembly-differ 0.18 moves to a `diff` subcommand and makes `-a` a
switch. `generateapichanges` now runs `assembly-differ diff … -a`, and
`-f github-comment` is kept.
- Argh 0.28.0 includes nullean/argh#139: a bare `assembly-rewriter -i …
-o …` (the root alias #33 keeps for older `action.yml` arguments) no
longer prints a spurious "unknown short option". The comment in
`Program.cs` that described that workaround is removed.

**Breaking:** none for consumers. assembly-rewriter is a tool, so its
dependencies ship inside it.

## Verify

- `mise run ci`: build, pack, `nupkg-validator validate` (both TFMs
signed with 96c599bbe3e70f5d, version 0.14.6-canary.0.4),
`assembly-differ diff` 0.18.2 against the published
`assembly-rewriter.any`, `curb check` (0 would change). All pass.
- `mise run check`: curb clean, zizmor no findings. `actionlint` (with
shellcheck): clean. `zizmor --min-severity medium .github`: no findings.
- `NUGET_PACKAGES=$(mktemp -d) DOTNET_CLI_HOME=$(mktemp -d) dotnet tool
restore`: "Restore was successful".
- `check-package-readme.sh` passes on both nupkgs.
- `dotnet list package --outdated --include-transitive`: nothing listed.
The sponsor-package grep over `project.assets.json` prints nothing.
- argh#139, managed net10.0 build, rewriting Elasticsearch.Net 6.2.0
(netstandard1.3): bare `-i … -o …` and `rewrite -i … -o …` both exit 0
with no "unknown short option", and their outputs are byte-identical,
with the `Elasticsearch.Net620` names in place.
- `dotnet pack -r osx-arm64` (native AOT) succeeds and the Mach-O arm64
binary runs (`--help`, `rewrite --help`). The bare form prints no
"unknown short option". `main`'s AOT binary, built for comparison,
prints `Error: unknown short option '-i'.` for the same command.
- Mutation check: setting `SignAssembly` to false makes `mise run ci`
fail in `validatepackages` ("NOT publicly signed with expected token").
After the revert it passes again.

Found, not changed here (pre-existing on `main`, same failure there):
- The **native-AOT** binary cannot rewrite real assemblies. Cecil's
`DefaultAssemblyResolver` finds framework assemblies through
`TRUSTED_PLATFORM_ASSEMBLIES`, which native AOT does not set, so
Elasticsearch.Net (netstandard1.3 and net46) and a net10.0 dll all fail
with `AssemblyResolutionException` (for example System.Diagnostics.Debug
or System.Private.CoreLib), with or without `-r <shared framework dir>`.
`AssemblyResolver` reads its `-r` hits without passing itself on as the
resolver, so facades fail on their forwards. The managed build is not
affected. This matters for the `ghcr.io/nullean/assembly-rewriter`
container that `action.yml` runs, and belongs in a separate fix.
- `--merge` (`-m`) fails on `main` (ILRepack 2.0.18:
`ArgumentOutOfRangeException`) and still fails here (ILRepack 2.0.48
tries to resolve `IKVM.Runtime` because `LineIndexation = true`). With
`LineIndexation = false` the merge succeeds on 2.0.48, which also
belongs in a separate fix.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug A defect fixed (patch)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

GitHub Action passes args without the rewrite subcommand

1 participant