Skip to content

Say when npm has a newer release, and cut 0.7.1 - #266

Merged
devmaxxx merged 2 commits into
mainfrom
feat/update-notice
Oct 19, 2026
Merged

devmaxxx merged 2 commits into
mainfrom
feat/update-notice

Conversation

@devmaxxx

Copy link
Copy Markdown
Owner

Summary

  • Update notice. The CLI checks npm for a newer zerograph at most once a day, from a detached thread with a 2 s timeout, through update-informer 1.3.0 (npm registry, the ureq 3 and native-tls hf-hub already brings; adds etcetera, home and the Windows-only windows-sys). The answer is cached in ~/.cache/zerograph/update.json, one entry per release, written through a temp file and a rename; a run that set out to ask records claimed (retried after an hour), and checked is written only once npm answers.
  • What the user sees. On a terminal, the classic box on stderr at exit: Update available 0.7.0 → 0.7.1, Run npm i -g zerograph@0.7.1, or pnpm add -g zerograph@0.7.1, coloured only where the terminal allows it. In Claude Code, a SessionStart systemMessage in two lines and a · ↑0.7.1 marker at the end of the index hint line; Codex gets the context line only. The hook shows the entry for the version of the binary it actually runs, and only when the cached latest is newer.
  • Never on stdout, never in the way. Skipped for mcp, serve, status, --json, in CI, when stderr is not a terminal, and under ZEROGRAPH_NO_UPDATE_CHECK or NO_UPDATE_NOTIFIER. status --json gains a nullable update field; status prints it as text.
  • Release 0.7.1. Cargo.toml/.lock, both plugin manifests, the marketplace ref, the npm package, commands.md and the Codex --ref in install.md; notes in docs/releases/0.7.1.md.

Test plan

  • cargo test 1704 pass (new: update.rs units, tests/update.rs with CI removed and a pty end-to-end run)
  • cargo clippy --all-targets -- -D warnings
  • node tests from ci.yml: 89 pass (new: upgrade, downgrade, other-version, claimed-only and pre-release cache cases)
  • claude plugin test agent/claude-code: 28 pass (hint-line marker)
  • release.yml dispatched from this branch: three build jobs green

An interactive run asks npm for zerograph's latest release at most once a
day, through update-informer 1.3.0 (npm registry, ureq and native-tls,
which unify with hf-hub's), on a thread no command waits for. Answers live
in ~/.cache/zerograph/update.json, one entry per release, written through
a rename. A run that sets out to ask claims the hour, and only an answer
from npm stamps the day, so a command that exits first is retried soon.

The run prints from what was cached: an update-notifier style box on
stderr after the command's output, naming npm i -g and pnpm add -g,
coloured only on a terminal that takes colour. mcp, serve, status,
--json, CI, a stderr that is not a terminal, ZEROGRAPH_NO_UPDATE_CHECK and
NO_UPDATE_NOTIFIER skip it.

status and the MCP status tool report the cached release as an update
line and field, without a request. The Claude Code hook asks the binary
its version when the file names a newer release, and shows the entry for
that version to the person as a systemMessage, with one line in the
brief; Codex gets the line only. The status mod ends its hint line in a
release marker.
Cargo.toml, Cargo.lock, both plugin manifests, the marketplace ref, the
npm package, the status line in docs/commands.md and the Codex install
command move to 0.7.1. docs/releases/0.7.1.md names the update notice,
its opt-outs, the status field and the new crates.
@devmaxxx
devmaxxx merged commit e92ad9d into main Oct 19, 2026
14 checks passed
@devmaxxx
devmaxxx deleted the feat/update-notice branch October 19, 2026 17:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant