coding-agents: auto-update never runs on npm 12 — `npm view --json` returns an array, check fails as "unparsable npm output"
Bug Description
On npm 12, the coding-agents auto-update check can never succeed. Every session logs:
INFO [auto-update] version check failed: unparsable npm output: [
so ~/.hindsight/coding-agents silently stays on whatever version was last installed by hand. In my case it stayed on 0.8.0 from 2026-10-09 until I ran update manually today (0.8.1 and 0.8.2 were both missed).
Root cause
npmViewVersion() in src/core/auto-update.ts runs npm view <pkg> version --json and expects a JSON string:
const v = JSON.parse(out.trim()) as unknown;
// --json on one field is a quoted string; anything else is not a version to pin.
if (typeof v !== "string")
return done("", `unparsable npm output: ${out.trim().slice(0, 80)}`);
npm 12 returns a one-element array for the same command:
$ npm --version
12.2.1
$ npm view @vectorize-io/hindsight-coding-agents version --json
[
"0.8.2"
]
so typeof v !== "string" is always true and the check bails out.
Suggested fix
Accept both shapes before the RELEASE_RE whitelist, e.g.:
const parsed = JSON.parse(out.trim()) as unknown;
const v = Array.isArray(parsed) ? parsed[parsed.length - 1] : parsed;
(or drop --json and trim the plain output). The existing RELEASE_RE check still guards the value before it reaches a spawn argv. I applied exactly this patch to my staged runtime and the version check now resolves.
Environment
@vectorize-io/hindsight-coding-agents0.8.0 → 0.8.2 (bug present in both; also onmain)- npm 12.2.1, macOS
- Harnesses: OpenCode 2.2, Claude Code, Codex, Pi (all share the staged runtime, so all miss updates)
I'd like to take this. Plan: handle npm 12 returning an array from npm view … --json (use the last element when it's an array) and add a unit test in auto-update.test.ts. PR coming soon.
Update after digging into CONTRIBUTING: Hindsight does not accept external PRs, so I will not open one against this repo (sorry for the earlier claim comment).
I still implemented the npm 12 fix on a personal fork in case it helps the team cherry-pick:
- Branch/PR (fork only): https://github.com/Octopus-98/hindsight/pull/1
- Change: in
npmViewVersion(), whennpm view … --jsonparses to an array, use the last element; keep string behavior; release whitelist unchanged - Tests:
npx vitest run src/core/auto-update.test.ts→ 29 passed;tsc --noEmitpassed
Feel free to close this issue once an internal PR lands, or ignore the fork if you prefer a different approach.
Fixed in 0.8.4: the version check accepts npm 12's one-element array. Checked against npm 12.2.1. If you're on npm 12 you'll need one manual update to get it: npx @vectorize-io/hindsight-coding-agents@latest update.