Skip to content

[Hackathon] Non-blocking "new version available" notice (24h-cached npm check, opt-out, CI-safe) #122

Description

@Andy00L

Discord Username / User ID

interferon0

What does this improvement do?

The CLI ships only via npm and goes stale silently: a user on 0.1.x is missing setup, doctor, completion, and the failure-bundle fixes, and nothing ever tells them. Add the gh/npm-style update notice: at most once per 24h, fetch the latest version from registry.npmjs.org, cache it in ~/.testsprite/update-check.json, and print a one-line stderr notice when a newer version exists. Strictly non-blocking and silent where it must be: stderr only, TTY only, skipped in CI, under --output json, under --dry-run, and for the completion command (its stdout is eval'd by shells); opt-out via TESTSPRITE_NO_UPDATE_NOTIFIER (mirrors the existing TESTSPRITE_NO_SKILL_WARNING); every error swallowed so the nudge can never break a command.

Details / implementation notes

Hand-rolled 130 lines in src/lib/update-check.ts: global fetch with AbortSignal.timeout(1500), a simple x.y.z compare (prerelease = older), a valibot-validated cache shape (/.testsprite/ is already owned by config/credentials). The update-notifier npm package is deliberately NOT used (large transitive tree; violates the 2-dependency budget). Wire next to the existing preAction skill-nudge hook in src/index.ts. Honest note: this adds the CLI's only outbound call besides api.testsprite.com — mitigations are the 24h TTL, a request carrying nothing but the package name, and the env opt-out. Tests: TTL cache behavior, every gate (CI/TTY/json/dry-run/completion), notice rendering. PR to follow once assigned.

Confirmations

  • I have searched existing issues and this is not a duplicate.
  • I have provided my Discord identity above for reward coordination.

Metadata

Metadata

Assignees

Labels

hackathonCLI hackathon submissionsin-progressAssigned and actively being worked on

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions