Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"]'
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion .github/workflows/nightly-fuzz.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion .github/workflows/no-emdash.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/no-internal-refs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion .github/workflows/pr-title.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/scorecard.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion .github/workflows/weekly-mutation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
2 changes: 1 addition & 1 deletion RELEASING.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
24 changes: 17 additions & 7 deletions scripts/release-install-gate.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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"];
Expand Down Expand Up @@ -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 ?? ""}`;
Expand Down Expand Up @@ -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 ?? ""}`;
Expand Down Expand Up @@ -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,
Expand Down
16 changes: 15 additions & 1 deletion test/release-install-gate.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,14 +100,28 @@ 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], {
cwd: REPO_ROOT,
encoding: "utf8",
shell: false,
timeout: 180_000,
env: { ...process.env, ...env },
env: childEnv(env),
});
const stdout = r.stdout ?? "";
let report: GateReport;
Expand Down
3 changes: 0 additions & 3 deletions vitest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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",
];
Expand Down
Loading