Skip to content

feat: add top-level --version flag to CLI (Closes #1) - #2

Open
gandzekas wants to merge 1 commit into
MisterBrookT:mainfrom
gandzekas:feat/version-flag
Open

feat: add top-level --version flag to CLI (Closes #1)#2
gandzekas wants to merge 1 commit into
MisterBrookT:mainfrom
gandzekas:feat/version-flag

Conversation

@gandzekas

Copy link
Copy Markdown

Implements #1 by adding a top-level --version / -V flag to the skill2 CLI.

Changes:

  • src/skill2/cli.py: Import __version__ from package and register argparse version action
  • tests/test_cli.py: Add regression tests for --version and -V flags
  • Sync generated Skill runtime bundles via tools/sync_skill_runtime.py

Validation:

PYTHONPATH=src python -m skill2.cli --version
# skill2 0.1.1
PYTHONPATH=src python -m skill2.cli -V
# skill2 0.1.1
PYTHONPATH=src python -m unittest tests.test_cli -v
# All relevant tests pass
python tools/sync_skill_runtime.py --check
# Exits 0 (runtimes in sync)

Closes #1

- Import __version__ from skill2 package in cli.py
- Add -V/--version argparse action to build_parser()
- Add regression tests for --version and -V flags in test_cli.py
- Sync generated Skill runtime bundles via sync_skill_runtime.py

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request adds support for the -V and --version flags to the skill2 CLI, allowing users to print the package version. It also updates the CLI parser to explicitly handle help arguments and updates the runtime manifests accordingly. Tests are added to verify the version flags. The review feedback points out that hardcoding the version string '0.1.1' in the tests makes them fragile, and suggests dynamically importing __version__ from the package to ensure the tests remain robust when the version is bumped.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread tests/test_cli.py
Comment on lines +312 to +320
def test_version_flag_prints_version_and_exits_zero(self) -> None:
result = run_cli("--version")
self.assertEqual(result.returncode, 0, result.stderr)
self.assertEqual(result.stdout.strip(), "skill2 0.1.1")

def test_version_short_flag_prints_version_and_exits_zero(self) -> None:
result = run_cli("-V")
self.assertEqual(result.returncode, 0, result.stderr)
self.assertEqual(result.stdout.strip(), "skill2 0.1.1")

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Hardcoding the version string '0.1.1' in the tests makes them fragile. If the package version is bumped in 'src/skill2/init.py', these tests will fail. Instead, import 'version' dynamically from the package to ensure the tests remain robust and maintainable.

Suggested change
def test_version_flag_prints_version_and_exits_zero(self) -> None:
result = run_cli("--version")
self.assertEqual(result.returncode, 0, result.stderr)
self.assertEqual(result.stdout.strip(), "skill2 0.1.1")
def test_version_short_flag_prints_version_and_exits_zero(self) -> None:
result = run_cli("-V")
self.assertEqual(result.returncode, 0, result.stderr)
self.assertEqual(result.stdout.strip(), "skill2 0.1.1")
def test_version_flag_prints_version_and_exits_zero(self) -> None:
from skill2 import __version__
result = run_cli("--version")
self.assertEqual(result.returncode, 0, result.stderr)
self.assertEqual(result.stdout.strip(), f"skill2 {__version__}")
def test_version_short_flag_prints_version_and_exits_zero(self) -> None:
from skill2 import __version__
result = run_cli("-V")
self.assertEqual(result.returncode, 0, result.stderr)
self.assertEqual(result.stdout.strip(), f"skill2 {__version__}")

@MisterBrookT
MisterBrookT self-requested a review July 19, 2026 08:59
@MisterBrookT MisterBrookT added the enhancement New feature or request label Jul 19, 2026
@MisterBrookT

Copy link
Copy Markdown
Owner

please avoid hard-cord version according to gemini's advice... @gandzekas

@MisterBrookT MisterBrookT left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as i've commented

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add a top-level skill2 --version flag

2 participants