-
Notifications
You must be signed in to change notification settings - Fork 8.1k
feat(cli): warn when a newer spec-kit release is available (#1320) #2212
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
1ffcbf9
81a7418
e45a36a
b75e55f
d8c16f7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -94,6 +94,23 @@ After initialization, you should see the following commands available in your co | |
|
|
||
| The `.specify/scripts` directory will contain both `.sh` and `.ps1` scripts. | ||
|
|
||
| ### Update Notifications | ||
|
|
||
| `specify` can check once per 24 hours whether a newer release is available on GitHub and print an upgrade hint. This is **opt-in**: the check is off by default because air-gapped and network-constrained environments cannot reach GitHub. | ||
|
|
||
|
Comment on lines
+99
to
+100
|
||
| To enable it, set: | ||
|
|
||
| ```bash | ||
| export SPECIFY_ENABLE_UPDATE_CHECK=1 # or true / yes / on | ||
| ``` | ||
|
|
||
| Even when enabled, the check stays silent when: | ||
|
|
||
| - stdout is not a TTY (piped output, redirected to a file, etc.) | ||
| - the `CI` environment variable is set | ||
|
|
||
| Network failures and rate-limit responses are swallowed — the check never fails the command you ran, though a cache miss may add a small startup delay (bounded by a 2-second fetch timeout) while contacting GitHub. | ||
|
|
||
| ## Troubleshooting | ||
|
|
||
| ### Enterprise / Air-Gapped Installation | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -374,6 +374,16 @@ def callback( | |||||
| show_banner() | ||||||
| console.print(Align.center("[dim]Run 'specify --help' for usage information[/dim]")) | ||||||
| console.print() | ||||||
| # Addresses #1320: nudge users running outdated CLIs. The `version` subcommand | ||||||
| # already surfaces the version, so skip there to avoid double-printing; also | ||||||
| # skip help invocations. Runs on bare `specify` too so the banner launch | ||||||
| # benefits from the nudge when the user has opted in. | ||||||
| if ( | ||||||
| ctx.invoked_subcommand != "version" | ||||||
| and "--help" not in sys.argv | ||||||
| and "-h" not in sys.argv | ||||||
| ): | ||||||
| _check_for_updates() | ||||||
|
mnriem marked this conversation as resolved.
|
||||||
|
|
||||||
| def run_command(cmd: list[str], check_return: bool = True, capture: bool = False, shell: bool = False) -> Optional[str]: | ||||||
| """Run a shell command and optionally capture output.""" | ||||||
|
|
@@ -1877,6 +1887,157 @@ def get_speckit_version() -> str: | |||||
| return "unknown" | ||||||
|
|
||||||
|
|
||||||
| # ===== Update check (addresses #1320) ===== | ||||||
| # | ||||||
| # Opt-in only (set SPECIFY_ENABLE_UPDATE_CHECK=1). Air-gapped / network-constrained | ||||||
| # environments never reach GitHub, so the check is off by default. When enabled, | ||||||
| # it is cached once per 24h in the platform user-cache dir and triggered from the | ||||||
| # top-level callback. Best-effort: every failure path swallows the exception so | ||||||
| # the check never fails the command, though cache misses may add a small startup | ||||||
| # delay (bounded by the fetch timeout) while contacting GitHub. | ||||||
|
|
||||||
| _UPDATE_CHECK_URL = "https://api.github.com/repos/github/spec-kit/releases/latest" | ||||||
|
||||||
| _UPDATE_CHECK_URL = "https://api.github.com/repos/github/spec-kit/releases/latest" | |
| _UPDATE_CHECK_URL = GITHUB_API_LATEST |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The changelog entry says the warning is suppressed in
CI=1, but the implementation suppresses whenever theCIenvironment variable is set to any value. Consider rewording to “suppressed whenCIis set” to match actual behavior.