diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f0efc2d..3cd2198 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -110,7 +110,7 @@ jobs: # changed lines to be killed (stryker.config.mjs, vitest.mutation.config.ts). # A new context arrives NOT REQUIRED (see the banner above) until a ruleset names it. ci: - uses: cosyte/.github/.github/workflows/ci.yml@ee3e8abed80294c3bb6bfcb4a6e54330be2df8b1 # workflows-2026-11-28-ee3e8abed802 + uses: cosyte/.github/.github/workflows/ci.yml@8c4385954cad27276f39241deb085b397e9cf837 # workflows-2026-11-29-8c4385954cad with: run-phi-scan: true node-versions: '["22", "24", "26"]' diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index 51e3c57..7bd489a 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -21,4 +21,4 @@ jobs: security-events: write # upload the SARIF to the Security tab contents: read actions: read - uses: cosyte/.github/.github/workflows/codeql.yml@ee3e8abed80294c3bb6bfcb4a6e54330be2df8b1 # workflows-2026-11-28-ee3e8abed802 + uses: cosyte/.github/.github/workflows/codeql.yml@8c4385954cad27276f39241deb085b397e9cf837 # workflows-2026-11-29-8c4385954cad diff --git a/.github/workflows/nightly-fuzz.yml b/.github/workflows/nightly-fuzz.yml index 21f5b20..ffee4ec 100644 --- a/.github/workflows/nightly-fuzz.yml +++ b/.github/workflows/nightly-fuzz.yml @@ -36,6 +36,6 @@ permissions: jobs: fuzz: - uses: cosyte/.github/.github/workflows/nightly-fuzz.yml@ee3e8abed80294c3bb6bfcb4a6e54330be2df8b1 # workflows-2026-11-28-ee3e8abed802 + uses: cosyte/.github/.github/workflows/nightly-fuzz.yml@8c4385954cad27276f39241deb085b397e9cf837 # workflows-2026-11-29-8c4385954cad with: fuzz-cmd: CLI_FUZZ_SEED="$GITHUB_RUN_ID" CLI_FUZZ_SECONDS=120 timeout --kill-after=1m 40m pnpm test:property diff --git a/.github/workflows/no-emdash.yml b/.github/workflows/no-emdash.yml index 2702bd5..9e12cdd 100644 --- a/.github/workflows/no-emdash.yml +++ b/.github/workflows/no-emdash.yml @@ -49,7 +49,7 @@ jobs: # A published reference: a `workflows-*` release of cosyte/.github. Those releases # are immutable, so the tag is locked to one commit, and every caller in this repository # moves to the next reference together. The installing form: the gate lives in node_modules. - uses: cosyte/.github/.github/workflows/gate-no-emdash-install.yml@ee3e8abed80294c3bb6bfcb4a6e54330be2df8b1 # workflows-2026-11-28-ee3e8abed802 + uses: cosyte/.github/.github/workflows/gate-no-emdash-install.yml@8c4385954cad27276f39241deb085b397e9cf837 # workflows-2026-11-29-8c4385954cad # No more than the scan needs. A called workflow's GITHUB_TOKEN can only be # downgraded by its caller, and this gate reads the tree and nothing else. permissions: diff --git a/.github/workflows/no-internal-refs.yml b/.github/workflows/no-internal-refs.yml index 2e66705..fa30482 100644 --- a/.github/workflows/no-internal-refs.yml +++ b/.github/workflows/no-internal-refs.yml @@ -43,7 +43,7 @@ jobs: # A published reference: a `workflows-*` release of cosyte/.github. Those releases # are immutable, so the tag is locked to one commit, and every caller in this repository # moves to the next reference together. - uses: cosyte/.github/.github/workflows/gate-no-internal-refs-install.yml@ee3e8abed80294c3bb6bfcb4a6e54330be2df8b1 # workflows-2026-11-28-ee3e8abed802 + uses: cosyte/.github/.github/workflows/gate-no-internal-refs-install.yml@8c4385954cad27276f39241deb085b397e9cf837 # workflows-2026-11-29-8c4385954cad # No more than the scan needs: it installs and reads the tree. permissions: contents: read diff --git a/.github/workflows/pr-title.yml b/.github/workflows/pr-title.yml index bdbdee5..595063e 100644 --- a/.github/workflows/pr-title.yml +++ b/.github/workflows/pr-title.yml @@ -24,4 +24,4 @@ jobs: pr-title: permissions: contents: read - uses: cosyte/.github/.github/workflows/pr-title.yml@ee3e8abed80294c3bb6bfcb4a6e54330be2df8b1 # workflows-2026-11-28-ee3e8abed802 + uses: cosyte/.github/.github/workflows/pr-title.yml@8c4385954cad27276f39241deb085b397e9cf837 # workflows-2026-11-29-8c4385954cad diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 85afb17..55ac4ab 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -72,7 +72,7 @@ jobs: contents: write # create tags / the GitHub release id-token: write # npm provenance pull-requests: write # open the "Version Packages" PR - uses: cosyte/.github/.github/workflows/release.yml@ee3e8abed80294c3bb6bfcb4a6e54330be2df8b1 # workflows-2026-11-28-ee3e8abed802 + uses: cosyte/.github/.github/workflows/release.yml@8c4385954cad27276f39241deb085b397e9cf837 # workflows-2026-11-29-8c4385954cad with: package-name: "@cosyte/cli" # Before the publish, the shared workflow packs this tree, checks every declared file and diff --git a/.github/workflows/scorecard.yml b/.github/workflows/scorecard.yml index affcfaa..a39cdb4 100644 --- a/.github/workflows/scorecard.yml +++ b/.github/workflows/scorecard.yml @@ -15,4 +15,4 @@ jobs: contents: read # required to resolve the reusable workflow (else contents:none → startup failure) security-events: write # upload the SARIF to the Security tab id-token: write # publish results to the OpenSSF API (for the badge) - uses: cosyte/.github/.github/workflows/scorecard.yml@ee3e8abed80294c3bb6bfcb4a6e54330be2df8b1 # workflows-2026-11-28-ee3e8abed802 + uses: cosyte/.github/.github/workflows/scorecard.yml@8c4385954cad27276f39241deb085b397e9cf837 # workflows-2026-11-29-8c4385954cad diff --git a/.github/workflows/weekly-mutation.yml b/.github/workflows/weekly-mutation.yml index 2a23a42..b872c80 100644 --- a/.github/workflows/weekly-mutation.yml +++ b/.github/workflows/weekly-mutation.yml @@ -29,6 +29,6 @@ permissions: jobs: weekly: - uses: cosyte/.github/.github/workflows/weekly-mutation.yml@ee3e8abed80294c3bb6bfcb4a6e54330be2df8b1 # workflows-2026-11-28-ee3e8abed802 + uses: cosyte/.github/.github/workflows/weekly-mutation.yml@8c4385954cad27276f39241deb085b397e9cf837 # workflows-2026-11-29-8c4385954cad with: mutate-cmd: "pnpm mutate:full" diff --git a/RELEASING.md b/RELEASING.md index f277e7a..fa96942 100644 --- a/RELEASING.md +++ b/RELEASING.md @@ -180,7 +180,7 @@ npm error could not determine executable to run this package ships `cosyte` and `cosyte-mcp`. `npx --package @cosyte/cli cosyte --help` works and is what the docs tell people to run. **A `cli` bin alias would fix the short form and is deliberately not added**, because `npm install -g` would then put a command named `cli` on every user's `PATH`. If that -trade is ever revisited, it is a founder call, not a packaging tidy-up. +trade is ever revisited, it is a decision about the commands every user gets, not a packaging tidy-up. ## The pipeline diff --git a/scripts/release-install-gate.mjs b/scripts/release-install-gate.mjs index 8669b57..d3403b7 100644 --- a/scripts/release-install-gate.mjs +++ b/scripts/release-install-gate.mjs @@ -43,6 +43,7 @@ import { import { tmpdir } from "node:os"; import { join, resolve, sep } from "node:path"; import { parseArgs } from "node:util"; +import { toolCommand } from "@cosyte/script-utils/attw"; /** The manifest fields a consumer's own install resolves. A local path in one of these is fatal. */ const CONSUMER_FIELDS = ["dependencies", "optionalDependencies", "peerDependencies"]; @@ -376,10 +377,14 @@ async function gate(opts) { const packDir = mkdtempSync(join(tmpdir(), "release-install-gate-pack-")); created.push(packDir); log(`packing ${packageDir}`); - const packed = spawnSync("pnpm", ["pack", "--pack-destination", packDir], { + // npm and pnpm are `.cmd` files on Windows, which Node starts only through `cmd.exe`. + // `toolCommand` returns the name and arguments unchanged elsewhere, with no shell, and on Windows + // one quoted command line for `cmd.exe`. + const pnpmPack = toolCommand("pnpm", ["pack", "--pack-destination", packDir]); + const packed = spawnSync(pnpmPack.file, pnpmPack.args, { cwd: packageDir, encoding: "utf8", - shell: false, + shell: pnpmPack.shell, timeout: opts.packTimeoutMs, }); const packOutput = `${packed.stdout ?? ""}${packed.stderr ?? ""}`; @@ -412,10 +417,11 @@ async function gate(opts) { // uses, because the question it answers is the consumer's, not this repo's. log(`installing ${tarballs[0]} into ${consumerDir}`); const startedAt = Date.now(); - const installed = spawnSync("npm", ["install", tarball, "--no-audit", "--no-fund"], { + const npmInstall = toolCommand("npm", ["install", tarball, "--no-audit", "--no-fund"]); + const installed = spawnSync(npmInstall.file, npmInstall.args, { cwd: consumerDir, encoding: "utf8", - shell: false, + shell: npmInstall.shell, timeout: opts.installTimeoutMs, }); const installOutput = `${installed.stdout ?? ""}${installed.stderr ?? ""}`; @@ -510,9 +516,13 @@ async function gate(opts) { // The `.bin` link is the path a consumer's shell invokes, so it is preferred. Falling back to // the target file under `node` is not a way past a packaging defect: the target's presence was // established above, and this only decides which of two real paths to the same file is used. - const launcher = existsSync(link) - ? { command: link, args: [] } - : { command: process.execPath, args: [entry.targetPath] }; + // On Windows the target always runs under `node`: the extensionless `.bin` entry there is a + // POSIX shell script Windows cannot start, and the `.cmd` beside it runs through `cmd.exe`, + // whose `node` child would outlive the kill that ends a still-running server's window. + const launcher = + process.platform !== "win32" && existsSync(link) + ? { command: link, args: [] } + : { command: process.execPath, args: [entry.targetPath] }; log(`running bin "${entry.name}"`); const outcome = await runBin( entry.name, diff --git a/test/release-install-gate.test.ts b/test/release-install-gate.test.ts index 1028309..bdbe952 100644 --- a/test/release-install-gate.test.ts +++ b/test/release-install-gate.test.ts @@ -100,6 +100,20 @@ interface GateRun { stderr: string; } +/** + * This process's environment with `overrides` applied. A variable already set under another case + * (`NPM_CONFIG_REGISTRY` for `npm_config_registry`) is dropped first: Windows names variables without + * regard to case, so a child there could see the inherited value in place of the override, and npm + * reads its `npm_config_*` variables without regard to case on every platform. + */ +function childEnv(overrides: NodeJS.ProcessEnv): NodeJS.ProcessEnv { + const names = new Set(Object.keys(overrides).map((k) => k.toLowerCase())); + const base = Object.fromEntries( + Object.entries(process.env).filter(([k]) => !names.has(k.toLowerCase())), + ); + return { ...base, ...overrides }; +} + /** Run the gate as the release path runs it: a real process, reading only its report and status. */ function runGate(args: string[], env: NodeJS.ProcessEnv = {}): GateRun { const r = spawnSync(process.execPath, [GATE, "--json", ...args], { @@ -107,7 +121,7 @@ function runGate(args: string[], env: NodeJS.ProcessEnv = {}): GateRun { encoding: "utf8", shell: false, timeout: 180_000, - env: { ...process.env, ...env }, + env: childEnv(env), }); const stdout = r.stdout ?? ""; let report: GateReport; diff --git a/vitest.config.ts b/vitest.config.ts index 655260b..eaed5fc 100644 --- a/vitest.config.ts +++ b/vitest.config.ts @@ -54,13 +54,10 @@ const DENO_EXCLUDES: readonly string[] = [ * (`.cmd` launchers). What they test runs on Linux and macOS in CI, and the library API and both * bins' code paths run on Windows in every other file. * - * - `test/release-install-gate.test.ts`: it runs the release install gate, which packs with pnpm - * and installs with npm, a step that runs on Linux in the release workflow. * - `test/docs-content.test.ts`: its shell samples run under bash. * - `test/docs-standard.test.ts`: it starts `node_modules/.bin/cosyte-docs-content` directly. */ const WINDOWS_EXCLUDES: readonly string[] = [ - "test/release-install-gate.test.ts", "test/docs-content.test.ts", "test/docs-standard.test.ts", ];