* chore(npm): rebrand packages to @opengsd scope Rename: - get-shit-done-redux → @opengsd/get-shit-done-redux - @gsd-redux/sdk → @opengsd/gsd-sdk Add publishConfig.access=public for first-time scoped publish. CLI binary names (get-shit-done-redux, gsd-sdk, gsd-tools) unchanged. Sweeps install commands, npx invocations, CI publish/version-check workflows, tests, docs, READMEs (all translations), and the PACKAGE_NAME constant in check-latest-version. Bumps qs 6.15.1 → 6.15.2 to clear a moderate advisory surfaced by the audit-clean test (GHSA-q8mj-m7cp-5q26). Closes #126 * chore: pin 2.0.0 release + remove canary workflow - Bump both packages 1.50.0-canary.0 → 2.0.0 for first @opengsd publish - Remove .github/workflows/canary.yml and canary dist-tag handling in release.yml / release-sdk.yml - Drop canary section from VERSIONING.md Refs #126 * chore: address review findings + harden tarball-smoke timeout - .changeset/opengsd-org-rename.md: match project's custom parse.cjs frontmatter (type: Changed / pr: 127); the scoped @changesets/cli keys were silently rejected. - CONTEXT.md: drop two canary-stream policy lines and a dangling DEFECT.CANARY-VERSION-LEAK.cross-ref now that canary.yml is gone. - tests/release-tarball-smoke.install.test.cjs: pass timeout: 600_000 for npm pack + global install; the 3-minute runNpm default was timing out on slower Docker hosts (cartographer). Refs #126 * fix(sdk): add missing type/runtime devDependencies for build prepublishOnly invokes tsc which couldn't resolve @types/node, @types/ws, or synckit. They had been hoisted from root but were not declared in sdk/'s own package.json — first publish from a clean SDK tree failed. Refs #126 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * fix(ci): use npm pack stdout instead of glob to find tarball `npm pack --silent` for a scoped package (@opengsd/get-shit-done-redux) produces `opengsd-get-shit-done-redux-*.tgz`, not `get-shit-done-redux-*.tgz`. Capture the filename from stdout instead of a hardcoded glob so the step works regardless of package name format. Fixes smoke (ubuntu-latest, 22, false) CI failure. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * ci: treat workflow-file changes as test-skip eligible `.github/workflows/install-smoke.yml` (and other workflow files) were in neither `test.yml` paths nor `test-skip.yml` paths-ignore, so neither workflow ran on a workflow-only commit — leaving the required test-skip check perpetually missing. Refs #126 * chore: reset version to 1.0.0 for first @opengsd publish Nothing has been published yet under the @opengsd scope, so the inaugural release uses 1.0.0 rather than 2.0.0. The "major bump" in the changeset reflects the breaking install-command change for users migrating from the prior unscoped `get-shit-done-redux`, not a numeric continuation from a 1.x line under the new identity. Refs #126 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> --------- Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
147 lines
4.9 KiB
JavaScript
147 lines
4.9 KiB
JavaScript
/**
|
|
* Regression test for bug #3359.
|
|
*
|
|
* `npx @opengsd/get-shit-done-redux@latest` can refresh runtime files while an older
|
|
* global `gsd-sdk` earlier on PATH remains the executable workflows call.
|
|
* The installer must not report SDK readiness when the resolved `gsd-sdk`
|
|
* version differs from the package/runtime version being installed.
|
|
*/
|
|
|
|
'use strict';
|
|
|
|
process.env.GSD_TEST_MODE = '1';
|
|
|
|
const { describe, test, beforeEach, afterEach } = require('node:test');
|
|
const assert = require('node:assert/strict');
|
|
const fs = require('fs');
|
|
const path = require('path');
|
|
|
|
const { installSdkIfNeeded, readGsdSdkVersion } = require('../bin/install.js');
|
|
const cp = require('node:child_process');
|
|
const pkg = require('../package.json');
|
|
const { createTempDir, cleanup, captureConsole } = require('./helpers.cjs');
|
|
|
|
const isWindows = process.platform === 'win32';
|
|
|
|
describe('bug #3359: installer detects stale gsd-sdk earlier on PATH',
|
|
{ skip: isWindows ? 'POSIX-only: stages bare gsd-sdk shebang shims in a PATH dir; Windows uses .cmd + PATHEXT resolution' : false },
|
|
() => {
|
|
let tmpRoot;
|
|
let sdkDir;
|
|
let pathDir;
|
|
let homeDir;
|
|
let savedEnv;
|
|
|
|
beforeEach(() => {
|
|
tmpRoot = createTempDir('gsd-3359-');
|
|
sdkDir = path.join(tmpRoot, 'sdk');
|
|
pathDir = path.join(tmpRoot, 'global-bin');
|
|
homeDir = path.join(tmpRoot, 'home');
|
|
fs.mkdirSync(path.join(sdkDir, 'dist'), { recursive: true });
|
|
fs.writeFileSync(
|
|
path.join(sdkDir, 'dist', 'cli.js'),
|
|
'#!/usr/bin/env node\nconsole.log("sdk cli");\n',
|
|
{ mode: 0o755 },
|
|
);
|
|
fs.mkdirSync(pathDir, { recursive: true });
|
|
fs.mkdirSync(homeDir, { recursive: true });
|
|
savedEnv = {
|
|
PATH: process.env.PATH,
|
|
HOME: process.env.HOME,
|
|
SHELL: process.env.SHELL,
|
|
};
|
|
process.env.PATH = pathDir;
|
|
process.env.HOME = homeDir;
|
|
delete process.env.SHELL;
|
|
});
|
|
|
|
afterEach(() => {
|
|
if (savedEnv.PATH == null) delete process.env.PATH;
|
|
else process.env.PATH = savedEnv.PATH;
|
|
if (savedEnv.HOME == null) delete process.env.HOME;
|
|
else process.env.HOME = savedEnv.HOME;
|
|
if (savedEnv.SHELL == null) delete process.env.SHELL;
|
|
else process.env.SHELL = savedEnv.SHELL;
|
|
cleanup(tmpRoot);
|
|
});
|
|
|
|
test('does not print ready when resolved gsd-sdk version differs from installer package version', () => {
|
|
const staleSdk = path.join(pathDir, 'gsd-sdk');
|
|
fs.writeFileSync(
|
|
staleSdk,
|
|
'#!/bin/sh\nprintf "%s\\n" "gsd-sdk v0.0.1"\n',
|
|
{ mode: 0o755 },
|
|
);
|
|
|
|
const { stdout, stderr } = captureConsole(() => {
|
|
installSdkIfNeeded({ sdkDir });
|
|
});
|
|
const combined = `${stdout}\n${stderr}`;
|
|
|
|
assert.ok(
|
|
/version mismatch|different version|stale/i.test(combined),
|
|
`installer must warn that resolved gsd-sdk is stale. Output:\n${combined}`,
|
|
);
|
|
assert.ok(
|
|
combined.includes(staleSdk),
|
|
`warning must include resolved gsd-sdk path. Output:\n${combined}`,
|
|
);
|
|
assert.ok(
|
|
combined.includes('0.0.1') && combined.includes(pkg.version),
|
|
`warning must include detected and installer versions. Output:\n${combined}`,
|
|
);
|
|
assert.ok(
|
|
/npm install -g @opengsd\/get-shit-done-redux@latest/.test(combined),
|
|
`warning must include global update remediation. Output:\n${combined}`,
|
|
);
|
|
assert.ok(
|
|
!/GSD SDK ready/.test(combined),
|
|
`installer must not report ready while PATH resolves a stale gsd-sdk. Output:\n${combined}`,
|
|
);
|
|
});
|
|
|
|
test('prints ready when no stale gsd-sdk is on PATH', () => {
|
|
const currentSdk = path.join(pathDir, 'gsd-sdk');
|
|
fs.writeFileSync(
|
|
currentSdk,
|
|
`#!/bin/sh\nprintf "%s\\n" "gsd-sdk v${pkg.version}"\n`,
|
|
{ mode: 0o755 },
|
|
);
|
|
|
|
const { stdout, stderr } = captureConsole(() => {
|
|
installSdkIfNeeded({ sdkDir });
|
|
});
|
|
const combined = `${stdout}\n${stderr}`;
|
|
|
|
assert.ok(
|
|
/GSD SDK ready/.test(combined),
|
|
`installer must report ready when no stale gsd-sdk exists. Output:\n${combined}`,
|
|
);
|
|
});
|
|
|
|
test('reads Windows cmd shim versions through cmd.exe', () => {
|
|
const originalSpawnSync = cp.spawnSync;
|
|
const platformDescriptor = Object.getOwnPropertyDescriptor(process, 'platform');
|
|
const calls = [];
|
|
cp.spawnSync = (command, args, options) => {
|
|
calls.push({ command, args, options });
|
|
return { status: 0, stdout: `gsd-sdk v${pkg.version}\n`, stderr: '' };
|
|
};
|
|
Object.defineProperty(process, 'platform', { value: 'win32' });
|
|
|
|
try {
|
|
assert.equal(readGsdSdkVersion('C:\\tools\\gsd-sdk.cmd'), pkg.version);
|
|
} finally {
|
|
cp.spawnSync = originalSpawnSync;
|
|
Object.defineProperty(process, 'platform', platformDescriptor);
|
|
}
|
|
|
|
assert.deepEqual(calls.map(({ command, args }) => ({ command, args })), [{
|
|
command: 'cmd.exe',
|
|
args: ['/c', 'C:\\tools\\gsd-sdk.cmd', '--version'],
|
|
}]);
|
|
assert.equal(calls[0].options.encoding, 'utf8');
|
|
assert.equal(calls[0].options.timeout, 2000);
|
|
});
|
|
});
|