Skip to content

Commit 89e33f1

Browse files
fsilvaortizclaude
andcommitted
refactor: reuse get_speckit_version() and assert -V in help test
Address Copilot review suggestions: - Use get_speckit_version() instead of duplicating importlib.metadata logic, which provides a better fallback via pyproject.toml for source-based runs - Assert both --version and -V appear in help output Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent f871e28 commit 89e33f1

File tree

2 files changed

+3
-7
lines changed

2 files changed

+3
-7
lines changed

src/specify_cli/__init__.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -490,12 +490,7 @@ def show_banner():
490490
def _version_callback(value: bool):
491491
"""Print CLI version and exit."""
492492
if value:
493-
import importlib.metadata
494-
495-
try:
496-
ver = importlib.metadata.version("specify-cli")
497-
except Exception:
498-
ver = "unknown"
493+
ver = get_speckit_version()
499494
print(f"specify {ver}")
500495
raise typer.Exit()
501496

tests/test_ai_skills.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -664,14 +664,15 @@ def test_short_version_flag(self):
664664
assert result.output.strip().startswith("specify ")
665665

666666
def test_version_flag_appears_in_help(self):
667-
"""--version should appear in the help output."""
667+
"""--version and -V should appear in the help output."""
668668
from typer.testing import CliRunner
669669

670670
runner = CliRunner()
671671
result = runner.invoke(app, ["--help"])
672672

673673
plain = re.sub(r'\x1b\[[0-9;]*m', '', result.output)
674674
assert "--version" in plain
675+
assert "-V" in plain
675676

676677

677678
class TestParameterOrderingIssue:

0 commit comments

Comments
 (0)