chrome-relay 0.5.6 → 0.5.7

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/dist/cli.js CHANGED
@@ -43,7 +43,7 @@ var RelayError = class extends Error {
43
43
  };
44
44
 
45
45
  // src/index.ts
46
- var CHROME_RELAY_VERSION = true ? "0.5.6" : "0.0.0-dev";
46
+ var CHROME_RELAY_VERSION = true ? "0.5.7" : "0.0.0-dev";
47
47
 
48
48
  // src/install/install.ts
49
49
  import os from "os";
@@ -196,6 +196,11 @@ async function callTool(name, args) {
196
196
 
197
197
  // src/release-notes.ts
198
198
  var RELEASE_NOTES = {
199
+ "0.5.7": [
200
+ "`chrome-relay update` returns structured verification metadata (code-quality-hardening PR 5). Output now has `install: { attempted, packageManager, status, command }`, `binary: { path, reexeced }`, `releaseNotes: { source: 'current_process' | 'updated_binary', changes }`, and a `warnings[]` array.",
201
+ "Surfaces the 'install said success but binary didn't change' failure mode (PATH mismatch, stale shim, cross-package-manager confusion) as `warnings[].code === 'update_not_verified'`. Agents can branch on it.",
202
+ "Falls back gracefully: when the re-exec can't be proven, release notes are read from the current (pre-update) process and marked `source: 'current_process'`. The agent knows the bullets may be stale."
203
+ ],
199
204
  "0.5.6": [
200
205
  "BEHAVIOR CHANGE \u2014 `chrome-relay network har --with-bodies` is now strict by default (code-quality-hardening PR 4). When ANY body fails to fetch, the call throws `partial_success_disallowed` with details about which entries failed.",
201
206
  "New `--best-effort-bodies` flag restores the legacy behavior: HAR still emits, missing/errored bodies are recorded per-entry in `_chrome_relay.bodyState` and `_chrome_relay.bodyError` (with code, message, and phase).",
@@ -294,31 +299,75 @@ Notes:
294
299
  program.command("update").description("Update chrome-relay CLI to the latest version and print what changed (agent-readable JSON).").option("--dry-run", "skip the install; just show what changed since the current version").action(async (opts) => {
295
300
  const fromVersion = CHROME_RELAY_VERSION;
296
301
  const { spawnSync } = await import("child_process");
302
+ const out = {
303
+ updatedFrom: fromVersion,
304
+ updatedTo: fromVersion,
305
+ install: { attempted: false },
306
+ binary: { path: process.argv[1] ?? "", reexeced: false },
307
+ releaseNotes: { source: "current_process", changes: [] },
308
+ warnings: []
309
+ };
297
310
  if (!opts.dryRun) {
298
311
  const argv0 = process.argv[1] ?? "";
299
312
  const pm = /[\\/](pnpm|\.pnpm)[\\/]/.test(argv0) ? "pnpm" : /[\\/]bun[\\/]/.test(argv0) ? "bun" : "npm";
300
313
  const cmd = pm === "pnpm" ? ["pnpm", ["add", "-g", "chrome-relay@latest"]] : pm === "bun" ? ["bun", ["add", "-g", "chrome-relay@latest"]] : ["npm", ["install", "-g", "chrome-relay@latest"]];
314
+ out.install = {
315
+ attempted: true,
316
+ packageManager: pm,
317
+ command: `${cmd[0]} ${cmd[1].join(" ")}`
318
+ };
301
319
  process.stderr.write(`[chrome-relay] updating from ${fromVersion} via ${pm}...
302
320
  `);
303
321
  const install = spawnSync(cmd[0], cmd[1], { stdio: "inherit" });
322
+ out.install.status = install.status;
304
323
  if (install.status !== 0) {
305
- process.stderr.write(`[chrome-relay] install failed (${pm} exited ${install.status}). Try manually: ${pm} ${cmd[1].join(" ")}
324
+ process.stderr.write(`[chrome-relay] install failed (${pm} exited ${install.status}). Try manually: ${cmd[0]} ${cmd[1].join(" ")}
306
325
  `);
326
+ out.warnings.push({
327
+ code: "update_install_failed",
328
+ message: `Package-manager exit ${install.status}. Active binary unchanged.`
329
+ });
330
+ process.stdout.write(JSON.stringify(out, null, 2) + "\n");
307
331
  process.exit(1);
308
332
  }
309
333
  const which = spawnSync("which", ["chrome-relay"]);
310
334
  const newBin = which.stdout?.toString().trim();
311
- if (which.status === 0 && newBin && newBin !== argv0) {
312
- spawnSync(newBin, ["release-notes", "--since", fromVersion], { stdio: "inherit" });
313
- return;
335
+ if (which.status === 0 && newBin) {
336
+ const versionOut = spawnSync(newBin, ["--version"]);
337
+ const newVersion = (versionOut.stdout?.toString() ?? "").trim();
338
+ out.binary.path = newBin;
339
+ if (newVersion && newVersion !== fromVersion) {
340
+ out.updatedTo = newVersion;
341
+ const rn = spawnSync(newBin, ["release-notes", "--since", fromVersion]);
342
+ try {
343
+ const parsed = JSON.parse(rn.stdout?.toString() ?? "");
344
+ if (Array.isArray(parsed.changes)) {
345
+ out.releaseNotes = { source: "updated_binary", changes: parsed.changes };
346
+ }
347
+ } catch {
348
+ out.warnings.push({
349
+ code: "release_notes_parse_failed",
350
+ message: `Could not parse output of "${newBin} release-notes --since ${fromVersion}".`
351
+ });
352
+ }
353
+ out.binary.reexeced = true;
354
+ } else {
355
+ out.warnings.push({
356
+ code: "update_not_verified",
357
+ message: `Install completed but \`${newBin} --version\` still reports ${newVersion || "unknown"}. The active binary may not have changed \u2014 check your PATH or run "${cmd[0]} ${cmd[1].join(" ")}" manually and verify.`
358
+ });
359
+ }
360
+ } else {
361
+ out.warnings.push({
362
+ code: "update_not_verified",
363
+ message: `Install completed but \`which chrome-relay\` did not return a path. Could not verify the active binary changed.`
364
+ });
314
365
  }
315
366
  }
316
- const changes = listReleaseNotesSince(fromVersion);
317
- process.stdout.write(JSON.stringify({
318
- updatedFrom: fromVersion,
319
- updatedTo: CHROME_RELAY_VERSION,
320
- changes
321
- }, null, 2) + "\n");
367
+ if (out.releaseNotes.source === "current_process") {
368
+ out.releaseNotes.changes = listReleaseNotesSince(fromVersion);
369
+ }
370
+ process.stdout.write(JSON.stringify(out, null, 2) + "\n");
322
371
  });
323
372
  program.command("release-notes").description("Print release notes since a version (no install). JSON output for agents.").option("--since <version>", "show release notes for versions newer than this", "0.0.0").action((opts) => {
324
373
  const changes = listReleaseNotesSince(opts.since);
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  // src/index.ts
2
- var CHROME_RELAY_VERSION = true ? "0.5.6" : "0.0.0-dev";
2
+ var CHROME_RELAY_VERSION = true ? "0.5.7" : "0.0.0-dev";
3
3
  export {
4
4
  CHROME_RELAY_VERSION
5
5
  };
@@ -48,7 +48,7 @@ function toBridgeError(unknownErr, fallbackTool) {
48
48
  }
49
49
 
50
50
  // src/index.ts
51
- var CHROME_RELAY_VERSION = true ? "0.5.6" : "0.0.0-dev";
51
+ var CHROME_RELAY_VERSION = true ? "0.5.7" : "0.0.0-dev";
52
52
 
53
53
  // src/release-notes.ts
54
54
  function compareSemver(a, b) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "chrome-relay",
3
- "version": "0.5.6",
3
+ "version": "0.5.7",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",