coderifts 8.3.0 → 8.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "coderifts",
3
- "version": "8.3.0",
3
+ "version": "8.4.0",
4
4
  "description": "Detect breaking API changes from the command line. Works locally or with the CodeRifts cloud API.",
5
5
  "author": "CodeRifts <hello@coderifts.com>",
6
6
  "license": "MIT",
@@ -43,7 +43,8 @@
43
43
  "prepublishOnly": "node scripts/assert-guard-major.js && node scripts/assert-changelog-version.js && bash ../../scripts/freeze-gate.sh && npm run build && bash ../../scripts/release-check.sh .",
44
44
  "assert-guard-major": "node scripts/assert-guard-major.js",
45
45
  "postinstall": "node scripts/postinstall.js",
46
- "test": "node --test test/*.test.js"
46
+ "test": "node --test test/*.test.js",
47
+ "check:packed": "node scripts/check-packed-install.js"
47
48
  },
48
49
  "dependencies": {
49
50
  "@coderifts/agent-guard": "^17.1.0",
@@ -0,0 +1,91 @@
1
+ #!/usr/bin/env node
2
+ 'use strict';
3
+
4
+ /**
5
+ * Pack → install the tarball into a temp dir → run the documented CLI entry.
6
+ *
7
+ * Pattern (1413 / prove check-packed-sample.js): the working tree is not the
8
+ * artifact. So: `npm pack`, install THAT tarball, then run `coderifts --help`
9
+ * (README Quick Start is `coderifts diff …`; --help is the always-safe
10
+ * documented entrypoint that does not need spec files).
11
+ */
12
+
13
+ const { spawnSync } = require('node:child_process');
14
+ const fs = require('node:fs');
15
+ const os = require('node:os');
16
+ const path = require('node:path');
17
+
18
+ const REPO = path.join(__dirname, '..');
19
+
20
+ function run(cmd, args, opts) {
21
+ const r = spawnSync(cmd, args, { encoding: 'utf8', ...opts });
22
+ if (r.error) throw r.error;
23
+ return r;
24
+ }
25
+
26
+ function fail(msg) {
27
+ process.stderr.write(`FAIL: ${msg}\n`);
28
+ process.exit(1);
29
+ }
30
+
31
+ const distBin = path.join(REPO, 'dist', 'cli.js');
32
+ if (!fs.existsSync(distBin)) {
33
+ fail(`dist/cli.js is missing — run npm run build before packing. `
34
+ + 'A tarball without dist cannot run `coderifts`.');
35
+ }
36
+
37
+ const tmp = fs.mkdtempSync(path.join(os.tmpdir(), 'cli-pack-'));
38
+ try {
39
+ const packed = run('npm', ['pack', '--silent', '--pack-destination', tmp], { cwd: REPO });
40
+ if (packed.status !== 0) fail(`npm pack failed:\n${packed.stderr}`);
41
+ const tgz = packed.stdout.trim().split('\n').pop().trim();
42
+ const tarball = path.join(tmp, path.basename(tgz));
43
+ if (!fs.existsSync(tarball)) fail(`npm pack reported ${tgz} but no tarball is there`);
44
+ process.stdout.write(`tarball : ${path.basename(tarball)} `
45
+ + `(${fs.statSync(tarball).size} bytes)\n`);
46
+
47
+ const installDir = path.join(tmp, 'install');
48
+ fs.mkdirSync(installDir);
49
+ const init = run('npm', ['init', '-y'], { cwd: installDir });
50
+ if (init.status !== 0) fail(`npm init failed:\n${init.stderr}`);
51
+ const inst = run('npm', ['install', tarball], { cwd: installDir });
52
+ if (inst.status !== 0) fail(`npm install tarball failed:\n${inst.stderr}`);
53
+
54
+ const bin = path.join(installDir, 'node_modules', '.bin', 'coderifts');
55
+ if (!fs.existsSync(bin)) fail(`installed package has no node_modules/.bin/coderifts`);
56
+
57
+ const help = run(bin, ['--help'], { cwd: installDir });
58
+ process.stdout.write(help.stdout);
59
+ if (help.status !== 0) fail(`coderifts --help exited ${help.status}:\n${help.stderr}`);
60
+ if (!/Usage:|coderifts/i.test(help.stdout + help.stderr)) {
61
+ fail('coderifts --help did not print Usage/coderifts');
62
+ }
63
+
64
+ const ver = run(bin, ['--version'], { cwd: installDir });
65
+ process.stdout.write(`version : ${(ver.stdout || '').trim()}\n`);
66
+ if (ver.status !== 0) fail(`coderifts --version exited ${ver.status}:\n${ver.stderr}`);
67
+
68
+ // 1436 — Atomic V2 must be in the packed binary, not only in the checkout.
69
+ const initHelp = run(bin, ['init', '--help'], {
70
+ cwd: installDir, env: { ...process.env, NO_COLOR: '1' },
71
+ });
72
+ if (!/--atomic-v2/.test(`${initHelp.stdout}\n${initHelp.stderr}`)) {
73
+ fail('packed `coderifts init --help` does not list --atomic-v2 (8.3.0 surface)');
74
+ }
75
+ const dry = run(bin, ['init', '--agents', '--atomic-v2', '--dry-run'], {
76
+ cwd: installDir, env: { ...process.env, NO_COLOR: '1' },
77
+ });
78
+ process.stdout.write(dry.stdout || '');
79
+ if (dry.stderr) process.stderr.write(dry.stderr);
80
+ if (dry.status !== 0) {
81
+ fail(`coderifts init --agents --atomic-v2 --dry-run exited ${dry.status}`);
82
+ }
83
+ const dryText = `${dry.stdout || ''}\n${dry.stderr || ''}`;
84
+ if (!/ATOMIC_V2|WIRING_REQUIRED|atomic-v2/i.test(dryText)) {
85
+ fail('packed init --agents --atomic-v2 --dry-run did not mention atomic-v2 / WIRING_REQUIRED');
86
+ }
87
+
88
+ process.stdout.write('packed install smoke: OK (atomic-v2 dry-run)\n');
89
+ } finally {
90
+ fs.rmSync(tmp, { recursive: true, force: true });
91
+ }