-
Notifications
You must be signed in to change notification settings - Fork 7.6k
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
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 | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -327,6 +327,10 @@ def callback(ctx: typer.Context): | |||||||||||||
| 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. | ||||||||||||||
| if ctx.invoked_subcommand not in (None, "version"): | ||||||||||||||
| _check_for_updates() | ||||||||||||||
|
Comment on lines
+330
to
+333
|
||||||||||||||
|
|
||||||||||||||
| 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.""" | ||||||||||||||
|
|
@@ -1586,6 +1590,143 @@ def get_speckit_version() -> str: | |||||||||||||
| return "unknown" | ||||||||||||||
|
|
||||||||||||||
|
|
||||||||||||||
| # ===== Update check (addresses #1320) ===== | ||||||||||||||
| # | ||||||||||||||
| # Cached once per 24h in the platform user-cache dir. Triggered from the top-level | ||||||||||||||
| # callback. Never blocks the user — every failure path swallows the exception. | ||||||||||||||
|
||||||||||||||
| # callback. Never blocks the user — every failure path swallows the exception. | |
| # callback. This is best-effort: every failure path swallows the exception so it | |
| # never fails the command, but cache misses may add a small startup delay while | |
| # performing the network check. |
Copilot
AI
Apr 14, 2026
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.
_parse_version_tuple is annotated as taking version: str, but the implementation handles falsey/non-str inputs (e.g., tests pass None). To keep annotations accurate (and avoid future type-checking surprises), either update the signature to str | None and guard with isinstance(version, str), or change callers/tests to never pass None.
| def _parse_version_tuple(version: str) -> tuple[int, ...] | None: | |
| """Parse `v0.6.2` / `0.6.2` / `0.6.2.dev0` → tuple of ints. Returns None if unparseable.""" | |
| if not version: | |
| def _parse_version_tuple(version: str | None) -> tuple[int, ...] | None: | |
| """Parse `v0.6.2` / `0.6.2` / `0.6.2.dev0` → tuple of ints. Returns None if unparseable.""" | |
| if not isinstance(version, str) or not version: |
Copilot
AI
Apr 14, 2026
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.
_read_update_check_cache uses path.read_text() without an explicit encoding, while other JSON reads in this module use encoding="utf-8" (e.g., _read_integration_json). For consistency and to avoid platform default-encoding surprises, specify UTF-8 explicitly here.
This issue also appears on line 1646 of the same file.
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.
This doc claims the update check “never blocks the command you ran,” but the current implementation performs a synchronous network request during the CLI callback on cache misses, which can add latency before the command executes. Either adjust the implementation to be non-blocking, or tweak this wording to match the behavior (e.g., “never aborts/fails the command” rather than “never blocks”).