Repository navigation
feat(wpm): point git at niugit, and find a shim payload wherever its mapping puts it - #1252
Merged
Merged
Conversation
The index carries one name per tool in most cases, but `git` and `niugit` both declared `commands: ["git"]`, so which git a user got depended on which entry they happened to pick - and the `git` entry is the upstream MinGit this stack does not want. An entry that only forwards removes the choice without removing the name: `wpm install git` installs niu-git and says so (#1218). - `alias_of` on a package makes wpm resolve it before anything looks at artifacts (an alias has none on purpose), with a depth bound, a cycle detector whose message shows the loop (`loop-a -> loop-b -> loop-a`), a missing-target error that names both packages, and one index refresh in between so a stale cache cannot hide a target that was just added. - `wpm info` shows `Alias of: <target>` (and `alias_of` in `--json`), and `wpm list` labels such an entry `alias` instead of `index-only`. - `wpm install git --json` reports the requested name plus `alias_of`. Tests: `wpm_install_follows_a_package_alias` (installs the target, reports the forwarding, `info` shows it) and `wpm_install_rejects_alias_cycles_and_missing_targets`. `wpm.*` 71/71. The index side (dropping the upstream MinGit artifact and pointing `git` at `niugit`) follows in unixwin/wpm-source once a release carries this.
The forwarder's map was written from the `opt\<pkg>\<command>.exe` convention alone, so a shim package whose payload has to keep its own layout - codex ships `bin/codex.exe` beside `codex-resources/`, which the executable resolves relative to itself - would get a map entry pointing at a file that does not exist, and the forwarder would refuse to start it. Look in the artifact's `files` mapping when the convention misses, which is what the entry links for flat layouts have always done. Convention first, mapping second, so nothing that works today changes. Test: `wpm_shim_map_points_at_a_non_conventional_payload` installs a shim package mapping its payload to `bin/tool.exe` and asserts the map points there.
This was referenced Oct 19, 2026
caomengxuan666
added a commit
to unixwin/wpm-source
that referenced
this pull request
Oct 19, 2026
`wpm install codex` installs the canonical package zip of the niu build of OpenAI Codex: `bin/codex.exe` keeps `codex-resources/` and `codex-path/` beside itself, so the sandbox helpers resolve exactly as they do in the npm platform package. `layout: shim` keeps the payload (and the ~300 MB executable) out of a directory on %PATH%. The asset is the canonical zip npm published as `@cmx666/[email protected]`, attached to unixwin/codex's `codex-v0.1.0` release (sha256 e44c2cac…, 128,074,227 bytes). Releases update this entry automatically from now on (scripts/niu/update-wpm-index.ps1 in unixwin/codex, which refuses to map a file the archive does not carry). Note for the command to resolve on an existing installation: wpm needs the payload-from-mapping lookup that landed in unixwin/WinuxCmd#1252 (shim payloads are not always at opt/<pkg>/<cmd>.exe), so this needs a WinuxCmd release that carries it. Co-authored-by: caomengxuan666 <[email protected]>
caomengxuan666
added a commit
to unixwin/codex
that referenced
this pull request
Oct 19, 2026
) * feat(release): publish @unixwin/codex, ship the wpm package, keep the index current Three things the org needs from this repository, in one place. **The npm scope moves to the org.** `@cmx666/codex` becomes `@unixwin/codex` (40 references across the workflow, both package scripts, `codex.js`'s platform map / install hints / self-detection path, `RELEASE.md` and the verifier). The `unixwin` npm org exists, so the next publish goes there; the old package stays published and gets deprecated pointing at the new name. **The canonical zip becomes a release asset.** `wpm` needs a versioned URL, not a workflow artifact (those need auth and expire), so the zip this job already builds is attached to a `codex-v<version>` pre-release. The index points at it, so the move and the rename have to land before the next publish. **The WPM index updates itself.** `scripts/niu/update-wpm-index.ps1` creates or rewrites the `codex` entry in unixwin/wpm-source - `layout: shim`, `commands: ["codex"]`, and a mapping that keeps `bin/codex.exe` beside `codex-resources/` and `codex-path/` so the executable resolves its helpers exactly as in the npm platform package. It refuses to write an index that maps a file the archive does not carry, which is the failure that let a package ship without its payload once already (unixwin/WinuxCmd#1225). The workflow step clones wpm-source, runs it, opens the PR and merges it; without `WPM_SOURCE_TOKEN` it warns and skips instead of failing a good npm release. Verified on the `unixwin` side too: wpm now resolves a shim payload from the artifact's `files` mapping when it is not at the `opt/<pkg>/<cmd>.exe` convention (unixwin/WinuxCmd#1252), which is what makes `bin/codex.exe` work. Fixtures: the script creates the entry on first run (real size and digest, urls on unixwin/codex), is idempotent, and refuses an archive missing a mapped directory. Workflow YAML parses; `codex.js`, `build_npm_package.py` and the verifier pass their syntax checks. * docs(npm): ship our README in the published package, keep the official one in the repo The npm package staged `README.md` from the repository root, so npmjs showed upstream's README - correct for the repository, misleading as the front page of an unofficial build. The stager now prefers `README-niu.md` when it exists, and that file says what this build is, how to install it (`@unixwin/codex`, or `wpm install codex` inside the niu stack), what differs, and that the official README still applies. Nothing in the repository's own README changes, so upstream merges stay clean. Verified by staging the meta package: `stage/README.md` is this file.
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.
Implementing the
git→niugitforwarding part of #1218, plus the payload lookup that the codex package will need. This is the wpm half; the index half follows in unixwin/wpm-source after a release carries this, because analias_ofentry seen by an older wpm reads as "metadata-only (no current-arch artifact)" — an entry with no artifact is only meaningful to a wpm that understands why.Why a package alias and not just deleting
gitThe index has two entries claiming
commands: ["git"]:gitshimniugitflatSo which git a user gets today depends on which name they typed. Deleting the
gitentry removes the wrong one but also removes the name people type; an alias keeps the name and pins it to niu-git. The same shape exists forawk/gawkin the index (aawkpackage still points at the pre-prune mirror build) — not touched here, reported instead.What
alias_ofdoesartifacts,filesorsha256.kMaxPackageAliasDepth), cycle detection whose message shows the loop (wpm: 'loop-a' is part of an alias cycle: loop-a -> loop-b -> loop-a), a missing target that names both ends, and one index refresh so a target added since the cache was written is still found.wpm install gitprintswpm: 'git' is provided by 'niugit';wpm info gitshowsAlias of: niugit(alias_ofin--json);wpm listlabels italiasrather thanindex-only;install --jsonreports the requested name withalias_of.Second commit: the shim payload is found wherever its mapping puts it
create_package_shimswrote the forwarder's map from theopt/<pkg>/<command>.execonvention alone. A shim package whose payload must keep its own directory layout — codex shipsbin/codex.exebesidecodex-resources/, which the executable resolves relative to itself — would have got a map entry pointing at a file that does not exist, and the forwarder would refuse to start it.The artifact's
filesmapping is consulted when the convention misses, which is what the entry links for flat layouts have always done. Convention first, mapping second, so nothing that works today changes.Verification
wpm_install_follows_a_package_alias: a fixture wheregit→targetinstalls the target, prints the forwarding, andinfo gitshows the alias.wpm_install_rejects_alias_cycles_and_missing_targets:loop-a/loop-bfails with the loop spelled out; a dangling alias fails naming the missing package.wpm_shim_map_points_at_a_non_conventional_payload: a package mapping its payload tobin/tool.exegets a map entry pointing there.wpm.*72/72.Sequence
gitas{"alias_of": "niugit"}, sowpm install gitkeeps working and installs niu-git;