Files
Sushant PoudelandGitHub 4d3357e554 fix(engine): make the skill-map self-check a real gate, close the fail-open (#84)
skill_map.py already verified that every mapped skill is installed and every
installed hunt-* skill is reachable, but it only printed the result: it never
exited non-zero, and nothing in CI ran it. The guarantee it describes was
therefore unenforced — a skill added without a mapping would go unreachable
again exactly as it did before #81.

Three changes:

1. main(argv) returns 1 on error, with ::error:: / ::warning:: annotations when
   $GITHUB_ACTIONS is set, matching scripts/lint_skills.py. Errors are the
   unreadable-skills-dir, mapped-but-absent, and unreachable-hunt-* conditions.
   Classes with a mapping but no tailored starter probe are reported as
   warnings, not errors, since they still route correctly.

2. _present() returns None when the skills directory cannot be read, instead of
   an empty set. _filter() previously read an empty set as "assume everything is
   installed" and returned every name unfiltered, so a missing or unreadable
   skills directory made the module name skills that are not there — the
   opposite of its documented contract.

3. skill-lint.yml runs the check, and triggers on engine/** so a change to the
   maps is validated too.

Verified: healthy checkout exits 0; an unreadable CBH_SKILLS_DIR, a missing
mapped skill, and an unmapped installed skill each exit 1. The existing
lint_skills.py gate and the public API (skills_for/tech_skills/probe_for) are
unchanged.
2026-10-03 10:53:36 +05:30

51 lines
1.4 KiB
YAML

name: skill-lint
# Quality + safety gate for every skill change.
# - Validates SKILL.md structure against CONTRIBUTING.md rules
# - Scans for client/engagement identifiers (hashed denylist) and leaked secrets
# Runs on PRs and pushes to main. No external dependencies — stdlib Python only.
on:
pull_request:
paths:
- "skills/**"
- "engine/**"
- "scripts/lint_skills.py"
- "scripts/.identifier-denylist.sha256"
- ".github/workflows/skill-lint.yml"
push:
branches: [main]
paths:
- "skills/**"
- "engine/**"
- "scripts/lint_skills.py"
workflow_dispatch:
permissions:
contents: read
jobs:
lint:
name: Lint skills
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Validate skills (structure + identifier/secret scan)
run: python3 scripts/lint_skills.py
# The routing maps are only useful if every mapped skill is installed and
# every installed hunt-* skill is reachable. skill_map.py checks both and
# exits non-zero, so a skill added without a mapping fails here rather than
# silently becoming unreachable.
- name: Validate skill routing (skill_map self-check)
run: python3 engine/skill_map.py
- name: Summary
if: always()
run: echo "Skill lint finished — see annotations above for any errors/warnings."