Skip to content

feat(release): publish @unixwin/codex and keep the wpm index current - #2

Merged
caomengxuan666 merged 2 commits into
niu-first-class-shellfrom
feat/unixwin-scope-and-wpm
Oct 19, 2026
Merged

caomengxuan666 merged 2 commits into
niu-first-class-shellfrom
feat/unixwin-scope-and-wpm

Conversation

@caomengxuan666

Copy link
Copy Markdown
Member

Three things the org asked for, on top of your in-flight npm release work (this targets niu-first-class-shell, not main, because that is where the flow lives).

1. The npm scope moves to the org

@cmx666/codex → @unixwin/codex — 40 references across the workflow, codex-cli/{bin/codex.js,package.json,scripts/*}, RELEASE.md and scripts/niu/verify-npm-package.sh. The unixwin npm org exists (verified: npm org ls unixwin → owner) and the NPM_TOKEN secret already carries publish rights for it, so the next publish=true run goes to the new name. The old package stays on npm and gets npm deprecate pointing at the new one.

2. The canonical zip becomes a release asset

wpm needs a versioned URL; workflow artifacts need auth and expire. The zip this job already assembles is attached to a codex-v<version> pre-release, and the index points at that. Order matters: the repository has to move to unixwin before the next publish, or the URLs the script writes will 404.

3. The WPM index keeps itself current

scripts/niu/update-wpm-index.ps1 creates or rewrites the codex entry in unixwin/wpm-source:

{
  "name": "codex", "version": "0.2.0", "kind": "external",
  "commands": ["codex"], "artifacts": { "windows-x64": {
    "type": "zip", "layout": "shim", "sha256": "…", "size": 1234567,
    "urls": ["https://github.com/unixwin/codex/releases/download/codex-v0.2.0/…zip"],
    "files": [
      { "from": "bin/codex.exe", "to": "bin/codex.exe" },
      { "from": "codex-resources", "to": "codex-resources", "kind": "dir" },
      { "from": "codex-path", "to": "codex-path", "kind": "dir" },
      { "from": "codex-package.json", "to": "codex-package.json" }
    ] } }
}

layout: shim keeps the payload out of a %PATH% directory and the mapping preserves the relative layout the executable expects (bin/codex.exe finds codex-resources/ one level up). The script refuses to map a file the archive does not carry — the failure that once shipped a package without its payload (unixwin/WinuxCmd#1225) — and the workflow step clones wpm-source, runs it, opens the PR and merges it. Without WPM_SOURCE_TOKEN it warns and skips rather than failing a good npm release.

Needs from the org

  • WPM_SOURCE_TOKEN on this repository (a token with repo on unixwin/wpm-source) — or as an org secret, which also fixes niu-git's manual index updates.
  • The repository transfer to unixwin/codex before the next publish (I can do it; it needs the admin I have).

Verified

Fixtures: the script creates the entry on first run (real size/digest, urls on unixwin/codex), is idempotent, and rejects an archive missing a mapped directory. Workflow YAML parses; codex.js, build_npm_package.py and the verifier pass syntax checks. On the wpm side, payload resolution from the artifact mapping landed as unixwin/WinuxCmd#1252, which is what makes bin/codex.exe resolvable.

… 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.
…l 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.
@caomengxuan666
caomengxuan666 merged commit 4012b2b into niu-first-class-shell Oct 19, 2026
10 of 34 checks passed
@caomengxuan666
caomengxuan666 deleted the feat/unixwin-scope-and-wpm branch October 19, 2026 08:58
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