@tokenoftrust/cli 2.4.6 → 2.4.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tokenoftrust/cli",
3
- "version": "2.4.6",
3
+ "version": "2.4.7",
4
4
  "description": "Token of Trust developer CLI — clone a tenant store, run it locally with save→reload, and submit it for preview. Installs the `tot` command.",
5
5
  "license": "Apache-2.0",
6
6
  "author": "Token of Trust",
@@ -21,8 +21,8 @@
21
21
  * result (instant, no network on the hot path); the registry refresh happens in a
22
22
  * DETACHED, unref'd child so it can't add latency or hold the process open.
23
23
  * • Cached in `~/.tot/update-check.json`; refreshed at most once per CHECK_INTERVAL_MS.
24
- * • Suppressed when stderr isn't a TTY, in CI, or when TOT_NO_UPDATE_CHECK /
25
- * NO_UPDATE_NOTIFIER is set. `TOT_HOME` overrides the home dir (tests).
24
+ * • Printed to stderr whether or not it is a TTY; suppressed in CI or when
25
+ * TOT_NO_UPDATE_CHECK / NO_UPDATE_NOTIFIER is set. `TOT_HOME` overrides the home dir (tests).
26
26
  */
27
27
  import { readFileSync, writeFileSync, mkdirSync, renameSync, chmodSync } from "node:fs";
28
28
  import { homedir } from "node:os";
@@ -195,11 +195,15 @@ export function renderNotice(notice, current) {
195
195
  .join("\n");
196
196
  }
197
197
 
198
- /** Whether we should print a nudge at all in this environment. */
199
- export function shouldShowNudge(env = process.env, stream = process.stderr) {
198
+ /**
199
+ * Whether we should print a nudge at all in this environment. Deliberately NOT
200
+ * gated on a TTY: agent-driven sessions run `tot` non-interactively, and a stale
201
+ * CLI caps the runner it resolves at its own major.minor. The nudge goes to
202
+ * stderr, so stdout stays parseable.
203
+ */
204
+ export function shouldShowNudge(env = process.env) {
200
205
  if (env.TOT_NO_UPDATE_CHECK || env.NO_UPDATE_NOTIFIER) return false;
201
206
  if (env.CI) return false;
202
- if (!stream || !stream.isTTY) return false;
203
207
  return true;
204
208
  }
205
209
 
@@ -292,7 +296,7 @@ function refreshInBackground(env) {
292
296
  */
293
297
  export function maybeNotifyUpdate(current, env = process.env, { stream = process.stderr } = {}) {
294
298
  try {
295
- if (shouldShowNudge(env, stream)) {
299
+ if (shouldShowNudge(env)) {
296
300
  const notice = updateNotice(current, env);
297
301
  if (notice) stream.write(`${renderNotice(notice, current)}\n`);
298
302
  }