Repository navigation
feat(cli): say so when the installed n8nac is behind what is published - #662
Merged
EtienneLescot merged 3 commits intoSep 11, 2026
Merged
Conversation
Nothing in this repo ever compared the installed CLI against the registry. That was survivable while generated agent instructions ran `npx --yes n8nac@<tag>`: npx re-resolved the dist tag on every single call, so an agent silently ran the newest publish and nobody had to think about versions. Naming a local install is roughly eight times faster per call but pins the version, so the invisible update is gone and something has to say so out loud. One dim line on stderr at the end of a successful `update-ai`, which is exactly the moment the agent context is regenerated and already the command that knows both the version and the dist tag. It reads about 80 bytes from the registry's dist-tags document, not a packument. Everything about it is best-effort: a three-second abort signal, and a catch that swallows offline, refused, malformed and unexpected alike. `update-ai` is documented as never throwing and that stays true. Respects the opt-outs that already exist rather than inventing one — `CI=true` and `DO_NOT_TRACK=1`, both already read by the telemetry package — plus `NO_UPDATE_NOTIFIER`, the de-facto standard name for this specific check. Silent under `--silent`, and silent in a dev checkout, where a maintainer on a locally bumped version should not be told to update. No semver dependency: a plain inequality against the dist tag is enough for a hint, and skipping dev checkouts removes the only case where it could read backwards. The dev-checkout probe that `inferFastCliCommand` had inline is now a named function, since two callers need it. Closes #660
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Advanced Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
The check opts out on NO_UPDATE_NOTIFIER, DO_NOT_TRACK and CI, but an opt-out nobody can find is not an opt-out. Put in troubleshooting rather than the CLI Update section, which #657 is currently rewriting.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #660. Stacked on #661, because both touch
update-ai.ts. Review or merge that one first; the diff here is the last commit only.Nothing in this repo ever compared the installed CLI against the registry. No
update-notifier, no query, no warning.That was survivable while generated agent instructions ran
npx --yes n8nac@<tag>: npx re-resolved the dist tag on every single call, so an agent silently ran the newest publish and nobody had to think about versions. #657 makes the generated context name a locally installed n8nac, which is roughly eight times faster per call but pins the version. The invisible update is gone, so something has to say so out loud.What it does
One dim line on stderr at the end of a successful
update-ai:update-aiis the right place: it runs rarely, it is exactly when the agent context is regenerated, and it already knows both the version and the dist tag.Why it cannot hurt
update-aiis documented as never throwing and that stays true.update-ai.ts:267-269: around forty commands take--json.--silent, and silent in a dev checkout, where a maintainer on a locally bumped version should not be told to update.Opt-outs
Reuses what already exists rather than inventing a variable.
CI=trueandDO_NOT_TRACK=1are both already read bypackages/telemetry. AddedNO_UPDATE_NOTIFIER, the de-facto standard name for this one check.These want a doc line. The natural home is the Update section #657 adds to
docs/docs/usage/cli.md, which does not exist on this branch. I will add it there rather than write a conflicting version here.No semver dependency
A plain inequality against the dist tag is enough for a hint, and skipping dev checkouts removes the only case where it could read backwards.
semveris not a direct dependency ofpackages/cliand one string compare does not earn it.Checks
Seven new unit tests covering the opt-outs, the missing-version case, a refused response, a rejected fetch, a malformed document, an absent dist tag, and the abort signal being sent. Fetch is injected, matching the global-swap pattern already used in
preflight-node-validator.test.ts.packages/cli: 457 tests pass, typecheck clean. Also exercised against the live registry:latestandnextboth resolve, an up-to-date version reports nothing, andCI=truenever opens a socket.Adjacent, not fixed here
checkAndRefreshIfStalehas no production caller. Outsidedistandnode_modules, the only references are its own definition and two tests, so only the explicitupdate-aipath runs today. Worth its own issue.🤖 Generated with Claude Code