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
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@
import argparse
import contextlib
import re
import shlex
import subprocess
import sys
from collections.abc import Iterable
Expand Down Expand Up @@ -2726,7 +2727,11 @@ def validate_gh_list_limit(path: Path, text: str) -> Iterable[Violation]:
if line_end == -1:
line_end = len(joined)
logical_line = joined[line_start:line_end]
if "--limit" in logical_line:
try:
tokens = shlex.split(logical_line, comments=True)
except ValueError:
tokens = [] # unbalanced quoting, can't tell, so flag it
if any(tok == "--limit" or tok.startswith("--limit=") for tok in tokens):
continue
line_no = text[: block_match.start()].count("\n") + joined[: cmd_match.start()].count("\n") + 1
yield Violation(
Expand Down
17 changes: 17 additions & 0 deletions tools/skill-and-tool-validator/tests/test_validator.py
Original file line number Diff line number Diff line change
Expand Up @@ -1800,6 +1800,23 @@ def test_silent_outside_fenced_block(self, tmp_path: Path) -> None:
violations = list(validate_gh_list_limit(path, text))
assert not any("gh-list-no-limit" in v.message for v in violations)

def test_fires_when_limit_only_appears_in_a_trailing_comment(self, tmp_path: Path) -> None:
path = tmp_path / "SKILL.md"
text = _fenced("gh issue list --repo <repo> --state open # add --limit later if slow")
violations = list(validate_gh_list_limit(path, text))
assert any("gh-list-no-limit" in v.message for v in violations)

def test_fires_when_limit_only_appears_inside_a_quoted_argument(self, tmp_path: Path) -> None:
path = tmp_path / "SKILL.md"
text = _fenced('gh issue list --repo <repo> --search "mentions --limit"')
violations = list(validate_gh_list_limit(path, text))
assert any("gh-list-no-limit" in v.message for v in violations)

def test_silent_when_limit_uses_equals_form(self, tmp_path: Path) -> None:
path = tmp_path / "SKILL.md"
violations = list(validate_gh_list_limit(path, _fenced("gh issue list --repo <repo> --limit=100")))
assert not any("gh-list-no-limit" in v.message for v in violations)


# ---------------------------------------------------------------------------
# Pattern 6 — Privacy-LLM gate-check
Expand Down