* 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>
94 lines
4.2 KiB
JavaScript
94 lines
4.2 KiB
JavaScript
'use strict';
|
|
|
|
/**
|
|
* Integration test for `get-shit-done/bin/lib/cjs-sdk-bridge.cjs` — locks the
|
|
* load-success invariant that Phase 5/6 silently violated before this PR.
|
|
*
|
|
* Original bug: the bridge used `require('@opengsd/gsd-sdk')` to load the
|
|
* runtime-bridge module. That package name is not resolvable from the root
|
|
* `node_modules` (the SDK lives at `./sdk/` as a sibling, not a dependency),
|
|
* and even if it were, the public entry didn't expose `executeForCjs` or
|
|
* `formatStateLoadRawStdout`. `tryLoadSdk()` always returned false,
|
|
* `_loadFailed` was cached for the process lifetime, and every CJS router
|
|
* silently fell through to the CJS fallback path — making the entire
|
|
* CJS→SDK delegation in Phase 5/6 dead code. CI passed because the fallback
|
|
* still executed CJS handlers, masking the regression.
|
|
*
|
|
* This test proves:
|
|
* 1. `tryLoadSdk()` returns true on the current checkout.
|
|
* 2. `getExecuteForCjs()` returns a real function (not null).
|
|
* 3. `getFormatStateLoadRawStdout()` returns a real function (not null).
|
|
* 4. Calling `executeForCjs` with a real canonical registry command
|
|
* produces a successful SDK result — proving the bridge actually
|
|
* dispatches through the runtime bridge rather than failing/falling back.
|
|
*
|
|
* Requires `sdk/dist/` to exist (i.e. `npm run build:sdk` has run). The
|
|
* project's `pretest` hook runs `build:sdk` before tests, so this is met by
|
|
* default. If `dist/` is missing, the assertion failures in this file
|
|
* surface the cause directly rather than silently masking under fallback.
|
|
*/
|
|
|
|
const { test, describe } = require('node:test');
|
|
const assert = require('node:assert/strict');
|
|
const path = require('node:path');
|
|
|
|
const BRIDGE_PATH = path.join(__dirname, '..', 'get-shit-done', 'bin', 'lib', 'cjs-sdk-bridge.cjs');
|
|
|
|
describe('cjs-sdk-bridge: SDK runtime bridge integration', () => {
|
|
test('tryLoadSdk() resolves the bundled SDK on the current checkout', () => {
|
|
// Fresh require each run so module-level caches reset.
|
|
delete require.cache[require.resolve(BRIDGE_PATH)];
|
|
const bridge = require(BRIDGE_PATH);
|
|
const loaded = bridge.tryLoadSdk();
|
|
assert.strictEqual(
|
|
loaded,
|
|
true,
|
|
'tryLoadSdk() must return true; if false, the bridge can no longer ' +
|
|
'locate sdk/dist/runtime-bridge-sync/index.js or its exports — every ' +
|
|
'CJS router will fall back to the per-side CJS handler.',
|
|
);
|
|
});
|
|
|
|
test('getExecuteForCjs() returns a function after a successful load', () => {
|
|
const bridge = require(BRIDGE_PATH);
|
|
bridge.tryLoadSdk();
|
|
assert.strictEqual(typeof bridge.getExecuteForCjs(), 'function');
|
|
});
|
|
|
|
test('getFormatStateLoadRawStdout() returns a function after a successful load', () => {
|
|
const bridge = require(BRIDGE_PATH);
|
|
bridge.tryLoadSdk();
|
|
assert.strictEqual(typeof bridge.getFormatStateLoadRawStdout(), 'function');
|
|
});
|
|
|
|
test('executeForCjs() actually dispatches a canonical registry command (not a fallback)', () => {
|
|
const bridge = require(BRIDGE_PATH);
|
|
assert.strictEqual(bridge.tryLoadSdk(), true);
|
|
const executeForCjs = bridge.getExecuteForCjs();
|
|
|
|
// `generate-slug` is a canonical, project-independent command in the SDK
|
|
// registry. It does not require a `.planning/` fixture, so its success
|
|
// proves the bridge dispatch path works end-to-end without confounding
|
|
// it with project-state setup. Same command Phase 5.0's smoke test uses.
|
|
const result = executeForCjs({
|
|
registryCommand: 'generate-slug',
|
|
registryArgs: ['Phase 6 Bridge Wired'],
|
|
legacyCommand: 'generate-slug',
|
|
legacyArgs: ['Phase 6 Bridge Wired'],
|
|
mode: 'json',
|
|
projectDir: process.cwd(),
|
|
});
|
|
|
|
assert.strictEqual(
|
|
result.ok,
|
|
true,
|
|
`executeForCjs result.ok must be true; got: ${JSON.stringify(result)}. ` +
|
|
'If this fails, the bridge loaded but registry.dispatch did not return ' +
|
|
'a typed-ok result for a known-canonical command — the seam is broken.',
|
|
);
|
|
assert.ok(result.data && typeof result.data === 'object', 'result.data must be an object');
|
|
assert.strictEqual(result.data.slug, 'phase-6-bridge-wired');
|
|
assert.strictEqual(result.exitCode, 0);
|
|
});
|
|
});
|