Skip to content

Commit bd431d7

Browse files
committed
feat(update-checker): surface update notice to non-TTY/agent runs
- drop the CI / non-TTY early-return so agents see "Update available" too - widen check interval 4h→24h; stay silent inside the window (no per-command repeat) - remove orphan isCI() helper (zero callers) - versioning.md: drop the now-false "banner suppressed under agent" rationale
1 parent df89ede commit bd431d7

4 files changed

Lines changed: 5 additions & 34 deletions

File tree

packages/core/src/utils/env.ts

Lines changed: 0 additions & 17 deletions
This file was deleted.

packages/core/src/utils/index.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
export { generateFilename } from "./filename.ts";
22
export { resolveOutputDir } from "./output-dir.ts";
33
export { maskToken } from "./token.ts";
4-
export { isCI } from "./env.ts";
54
export { stripUndefined } from "./object.ts";
65
export {
76
parseBooleanValue,

packages/runtime/src/utils/update-checker.ts

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ export const NPM_REGISTRY = "https://registry.npmjs.org";
77
export const NPM_PACKAGE = "bailian-cli";
88

99
const STATE_FILE = () => join(getConfigDir(), "update-state.json");
10-
const CHECK_INTERVAL_MS = 4 * 60 * 60 * 1000; // 4h
10+
const CHECK_INTERVAL_MS = 24 * 60 * 60 * 1000; // 24h
1111
const FETCH_TIMEOUT_MS = 3000;
1212

1313
/**
@@ -77,19 +77,13 @@ export async function checkForUpdate(
7777
currentVersion: string,
7878
npmPackage: string = NPM_PACKAGE,
7979
): Promise<void> {
80-
// Skip in CI / non-TTY environments
81-
if (process.env.CI || !process.stderr.isTTY) return;
82-
8380
const state = readState();
8481
const now = Date.now();
8582

86-
// Throttle: skip if checked within the last 4 hours
87-
if (state && now - state.lastChecked < CHECK_INTERVAL_MS) {
88-
if (state.latestVersion && isNewerVersion(state.latestVersion, currentVersion)) {
89-
pendingNotification = state.latestVersion;
90-
}
91-
return;
92-
}
83+
// Inside the throttle window (CHECK_INTERVAL_MS since the last fetch): no
84+
// network call and no notice. The state file is global, so the notice fires at
85+
// most once per window across all processes/sessions — not once per command.
86+
if (state && now - state.lastChecked < CHECK_INTERVAL_MS) return;
9387

9488
const latest = await fetchLatestVersion(FETCH_TIMEOUT_MS, npmPackage);
9589
if (!latest) return;

skills/bailian-cli/assets/versioning.md

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,6 @@
33
> Hand-maintained. Lives in `assets/` (not auto-generated from `catalog.ts`).
44
> Entry point: [SKILL.md → Version & updates](../SKILL.md#version--updates-agent--do-first).
55
6-
**Why this matters for agents:** when `bl` runs interactively it prints an
7-
`Update available` banner. That banner is **suppressed when `bl` is piped by an
8-
agent** (non-TTY stderr), so the user never learns their `bl` is outdated. The
9-
agent must take over that responsibility.
10-
116
## Agent pre-flight checklist (MANDATORY)
127

138
**Do NOT run any `bl` command until you complete this checklist.** Run it **once per session**, before the first `bl` command. Cache the result — do not re-check before every command.

0 commit comments

Comments
 (0)