Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion skills/skill2-audit/scripts/.runtime-manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"source": "src/skill2/__init__.py"
},
"skill2/cli.py": {
"sha256": "614a10d8977fa98a8d5d9ca7851a214f13e4132a673e8ce5ef49dfc8f612a0f9",
"sha256": "31866a5627693f32bed04fc93f97d157c490bb549f862c0182c7d60700bd01c5",
"source": "src/skill2/cli.py"
},
"skill2/lint.py": {
Expand Down
13 changes: 12 additions & 1 deletion skills/skill2-audit/scripts/_runtime/skill2/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from pathlib import Path
from typing import Any

from . import __version__
from .models import SCHEMA_VERSION, Issue, LintResult, ScanResult, Severity

_SARIF_SCHEMA = "https://json.schemastore.org/sarif-2.1.0.json"
Expand Down Expand Up @@ -302,7 +303,17 @@ def _path_uri(value: str) -> str:


def build_parser() -> argparse.ArgumentParser:
parser = argparse.ArgumentParser(prog="skill2")
parser = argparse.ArgumentParser(prog="skill2", add_help=False)
parser.add_argument(
"-h", "--help", action="help", help="show this help message and exit"
)
parser.add_argument(
"-V",
"--version",
action="version",
version=f"skill2 {__version__}",
help="print version and exit",
)
sub = parser.add_subparsers(dest="command", required=True)

scaffold = sub.add_parser("scaffold", help="create skill scaffolds")
Expand Down
2 changes: 1 addition & 1 deletion skills/skill2-create/scripts/.runtime-manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"source": "src/skill2/__init__.py"
},
"skill2/cli.py": {
"sha256": "614a10d8977fa98a8d5d9ca7851a214f13e4132a673e8ce5ef49dfc8f612a0f9",
"sha256": "31866a5627693f32bed04fc93f97d157c490bb549f862c0182c7d60700bd01c5",
"source": "src/skill2/cli.py"
},
"skill2/models.py": {
Expand Down
13 changes: 12 additions & 1 deletion skills/skill2-create/scripts/_runtime/skill2/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from pathlib import Path
from typing import Any

from . import __version__
from .models import SCHEMA_VERSION, Issue, LintResult, ScanResult, Severity

_SARIF_SCHEMA = "https://json.schemastore.org/sarif-2.1.0.json"
Expand Down Expand Up @@ -302,7 +303,17 @@ def _path_uri(value: str) -> str:


def build_parser() -> argparse.ArgumentParser:
parser = argparse.ArgumentParser(prog="skill2")
parser = argparse.ArgumentParser(prog="skill2", add_help=False)
parser.add_argument(
"-h", "--help", action="help", help="show this help message and exit"
)
parser.add_argument(
"-V",
"--version",
action="version",
version=f"skill2 {__version__}",
help="print version and exit",
)
sub = parser.add_subparsers(dest="command", required=True)

scaffold = sub.add_parser("scaffold", help="create skill scaffolds")
Expand Down
2 changes: 1 addition & 1 deletion skills/skill2-package/scripts/.runtime-manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"source": "src/skill2/bundle.py"
},
"skill2/cli.py": {
"sha256": "614a10d8977fa98a8d5d9ca7851a214f13e4132a673e8ce5ef49dfc8f612a0f9",
"sha256": "31866a5627693f32bed04fc93f97d157c490bb549f862c0182c7d60700bd01c5",
"source": "src/skill2/cli.py"
},
"skill2/lint.py": {
Expand Down
13 changes: 12 additions & 1 deletion skills/skill2-package/scripts/_runtime/skill2/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from pathlib import Path
from typing import Any

from . import __version__
from .models import SCHEMA_VERSION, Issue, LintResult, ScanResult, Severity

_SARIF_SCHEMA = "https://json.schemastore.org/sarif-2.1.0.json"
Expand Down Expand Up @@ -302,7 +303,17 @@ def _path_uri(value: str) -> str:


def build_parser() -> argparse.ArgumentParser:
parser = argparse.ArgumentParser(prog="skill2")
parser = argparse.ArgumentParser(prog="skill2", add_help=False)
parser.add_argument(
"-h", "--help", action="help", help="show this help message and exit"
)
parser.add_argument(
"-V",
"--version",
action="version",
version=f"skill2 {__version__}",
help="print version and exit",
)
sub = parser.add_subparsers(dest="command", required=True)

scaffold = sub.add_parser("scaffold", help="create skill scaffolds")
Expand Down
2 changes: 1 addition & 1 deletion skills/skill2-test/scripts/.runtime-manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"source": "src/skill2/claude_runner.py"
},
"skill2/cli.py": {
"sha256": "614a10d8977fa98a8d5d9ca7851a214f13e4132a673e8ce5ef49dfc8f612a0f9",
"sha256": "31866a5627693f32bed04fc93f97d157c490bb549f862c0182c7d60700bd01c5",
"source": "src/skill2/cli.py"
},
"skill2/codex_runner.py": {
Expand Down
13 changes: 12 additions & 1 deletion skills/skill2-test/scripts/_runtime/skill2/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from pathlib import Path
from typing import Any

from . import __version__
from .models import SCHEMA_VERSION, Issue, LintResult, ScanResult, Severity

_SARIF_SCHEMA = "https://json.schemastore.org/sarif-2.1.0.json"
Expand Down Expand Up @@ -302,7 +303,17 @@ def _path_uri(value: str) -> str:


def build_parser() -> argparse.ArgumentParser:
parser = argparse.ArgumentParser(prog="skill2")
parser = argparse.ArgumentParser(prog="skill2", add_help=False)
parser.add_argument(
"-h", "--help", action="help", help="show this help message and exit"
)
parser.add_argument(
"-V",
"--version",
action="version",
version=f"skill2 {__version__}",
help="print version and exit",
)
sub = parser.add_subparsers(dest="command", required=True)

scaffold = sub.add_parser("scaffold", help="create skill scaffolds")
Expand Down
2 changes: 1 addition & 1 deletion skills/skill2-visualize/scripts/.runtime-manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"source": "src/skill2/__init__.py"
},
"skill2/cli.py": {
"sha256": "614a10d8977fa98a8d5d9ca7851a214f13e4132a673e8ce5ef49dfc8f612a0f9",
"sha256": "31866a5627693f32bed04fc93f97d157c490bb549f862c0182c7d60700bd01c5",
"source": "src/skill2/cli.py"
},
"skill2/models.py": {
Expand Down
13 changes: 12 additions & 1 deletion skills/skill2-visualize/scripts/_runtime/skill2/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from pathlib import Path
from typing import Any

from . import __version__
from .models import SCHEMA_VERSION, Issue, LintResult, ScanResult, Severity

_SARIF_SCHEMA = "https://json.schemastore.org/sarif-2.1.0.json"
Expand Down Expand Up @@ -302,7 +303,17 @@ def _path_uri(value: str) -> str:


def build_parser() -> argparse.ArgumentParser:
parser = argparse.ArgumentParser(prog="skill2")
parser = argparse.ArgumentParser(prog="skill2", add_help=False)
parser.add_argument(
"-h", "--help", action="help", help="show this help message and exit"
)
parser.add_argument(
"-V",
"--version",
action="version",
version=f"skill2 {__version__}",
help="print version and exit",
)
sub = parser.add_subparsers(dest="command", required=True)

scaffold = sub.add_parser("scaffold", help="create skill scaffolds")
Expand Down
13 changes: 12 additions & 1 deletion src/skill2/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from pathlib import Path
from typing import Any

from . import __version__
from .models import SCHEMA_VERSION, Issue, LintResult, ScanResult, Severity

_SARIF_SCHEMA = "https://json.schemastore.org/sarif-2.1.0.json"
Expand Down Expand Up @@ -302,7 +303,17 @@ def _path_uri(value: str) -> str:


def build_parser() -> argparse.ArgumentParser:
parser = argparse.ArgumentParser(prog="skill2")
parser = argparse.ArgumentParser(prog="skill2", add_help=False)
parser.add_argument(
"-h", "--help", action="help", help="show this help message and exit"
)
parser.add_argument(
"-V",
"--version",
action="version",
version=f"skill2 {__version__}",
help="print version and exit",
)
sub = parser.add_subparsers(dest="command", required=True)

scaffold = sub.add_parser("scaffold", help="create skill scaffolds")
Expand Down
10 changes: 10 additions & 0 deletions tests/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,16 @@ def test_cli_import_is_lazy(self) -> None:
self.assertEqual(result.returncode, 0, result.stderr)
self.assertEqual(json.loads(result.stdout), [])

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")
Comment on lines +312 to +320

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__}")



if __name__ == "__main__":
unittest.main()