Skip to content

Commit e886a15

Browse files
committed
feat: add self-check tip to check output
1 parent 81e9ecd commit e886a15

4 files changed

Lines changed: 48 additions & 2 deletions

File tree

docs/reference/core.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,8 @@ specify check
6969

7070
Checks that required tools are available on your system: `git` and any CLI-based AI coding agents. IDE-based agents are skipped since they don't require a CLI tool.
7171

72+
This command stays offline. If a command behaves like an older Spec Kit version or an expected CLI feature is missing, run `specify self check` to check whether your local CLI is behind the latest release.
73+
7274
## Version Information
7375

7476
```bash

docs/upgrade.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -388,6 +388,14 @@ Only Spec Kit infrastructure files:
388388

389389
### "CLI upgrade doesn't seem to work"
390390

391+
If a command behaves like an older Spec Kit version, first check for local CLI drift:
392+
393+
```bash
394+
specify self check
395+
```
396+
397+
`specify check` is an offline environment scan; `specify self check` is the CLI version lookup.
398+
391399
Verify the installation:
392400

393401
```bash

src/specify_cli/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1157,6 +1157,8 @@ def check():
11571157
if not any(agent_results.values()):
11581158
console.print("[dim]Tip: Install a coding agent for the best experience[/dim]")
11591159

1160+
console.print("[dim]Tip: Run 'specify self check' to verify you have the latest CLI version.[/dim]")
1161+
11601162

11611163
def _feature_capabilities() -> dict[str, bool]:
11621164
"""Return stable local CLI capability flags for humans and agents."""

tests/test_check_tool.py

Lines changed: 36 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,13 @@
77

88
from unittest.mock import patch, MagicMock
99

10-
from specify_cli import check_tool
10+
from typer.testing import CliRunner
11+
12+
from specify_cli import app, check_tool
13+
from tests.conftest import strip_ansi
14+
15+
16+
runner = CliRunner()
1117

1218

1319
class TestCheckToolClaude:
@@ -103,4 +109,32 @@ def fake_which(name):
103109
return "/usr/bin/kiro" if name == "kiro" else None
104110

105111
with patch("shutil.which", side_effect=fake_which):
106-
assert check_tool("kiro-cli") is True
112+
assert check_tool("kiro-cli") is True
113+
114+
115+
class TestCheckTip:
116+
"""`specify check` should point users to the existing version check."""
117+
118+
def test_check_shows_self_check_tip(self):
119+
with patch("specify_cli.check_tool", return_value=True):
120+
result = runner.invoke(app, ["check"])
121+
122+
output = strip_ansi(result.output)
123+
assert result.exit_code == 0
124+
assert (
125+
"Tip: Run 'specify self check' to verify you have the latest CLI version."
126+
in output
127+
)
128+
129+
def test_check_tip_does_not_fetch_latest_release(self):
130+
with (
131+
patch("specify_cli.check_tool", return_value=True),
132+
patch(
133+
"specify_cli._version._fetch_latest_release_tag",
134+
side_effect=AssertionError("latest release lookup should not run"),
135+
) as fetch_latest,
136+
):
137+
result = runner.invoke(app, ["check"])
138+
139+
assert result.exit_code == 0
140+
fetch_latest.assert_not_called()

0 commit comments

Comments
 (0)