diff --git a/packages/core/src/utils/env.ts b/packages/core/src/utils/env.ts deleted file mode 100644 index 32c2130..0000000 --- a/packages/core/src/utils/env.ts +++ /dev/null @@ -1,17 +0,0 @@ -/** - * Environment detection utilities for bailian-cli. - */ - -/** - * Detects whether the current process is running in a CI environment. - */ -export function isCI(): boolean { - return !!( - process.env.CI || - process.env.GITHUB_ACTIONS || - process.env.GITLAB_CI || - process.env.JENKINS_URL || - process.env.TRAVIS || - process.env.CIRCLECI - ); -} diff --git a/packages/core/src/utils/index.ts b/packages/core/src/utils/index.ts index 33bfeb0..a0c3c27 100644 --- a/packages/core/src/utils/index.ts +++ b/packages/core/src/utils/index.ts @@ -1,7 +1,6 @@ export { generateFilename } from "./filename.ts"; export { resolveOutputDir } from "./output-dir.ts"; export { maskToken } from "./token.ts"; -export { isCI } from "./env.ts"; export { stripUndefined } from "./object.ts"; export { parseBooleanValue, diff --git a/packages/runtime/src/utils/update-checker.ts b/packages/runtime/src/utils/update-checker.ts index bf3f111..1277be3 100644 --- a/packages/runtime/src/utils/update-checker.ts +++ b/packages/runtime/src/utils/update-checker.ts @@ -7,7 +7,7 @@ export const NPM_REGISTRY = "https://registry.npmjs.org"; export const NPM_PACKAGE = "bailian-cli"; const STATE_FILE = () => join(getConfigDir(), "update-state.json"); -const CHECK_INTERVAL_MS = 4 * 60 * 60 * 1000; // 4h +const CHECK_INTERVAL_MS = 24 * 60 * 60 * 1000; // 24h const FETCH_TIMEOUT_MS = 3000; /** @@ -77,19 +77,13 @@ export async function checkForUpdate( currentVersion: string, npmPackage: string = NPM_PACKAGE, ): Promise { - // Skip in CI / non-TTY environments - if (process.env.CI || !process.stderr.isTTY) return; - const state = readState(); const now = Date.now(); - // Throttle: skip if checked within the last 4 hours - if (state && now - state.lastChecked < CHECK_INTERVAL_MS) { - if (state.latestVersion && isNewerVersion(state.latestVersion, currentVersion)) { - pendingNotification = state.latestVersion; - } - return; - } + // Inside the throttle window (CHECK_INTERVAL_MS since the last fetch): no + // network call and no notice. The state file is global, so the notice fires at + // most once per window across all processes/sessions — not once per command. + if (state && now - state.lastChecked < CHECK_INTERVAL_MS) return; const latest = await fetchLatestVersion(FETCH_TIMEOUT_MS, npmPackage); if (!latest) return; diff --git a/skills/bailian-cli/assets/versioning.md b/skills/bailian-cli/assets/versioning.md index 5637105..1a31c4c 100644 --- a/skills/bailian-cli/assets/versioning.md +++ b/skills/bailian-cli/assets/versioning.md @@ -3,11 +3,6 @@ > Hand-maintained. Lives in `assets/` (not auto-generated from `catalog.ts`). > Entry point: [SKILL.md → Version & updates](../SKILL.md#version--updates-agent--do-first). -**Why this matters for agents:** when `bl` runs interactively it prints an -`Update available` banner. That banner is **suppressed when `bl` is piped by an -agent** (non-TTY stderr), so the user never learns their `bl` is outdated. The -agent must take over that responsibility. - ## Agent pre-flight checklist (MANDATORY) **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.