T-4ZZX-audit-skill-runtime-match-ts-citations
Status: closed/superseded · Impact: medium · Complexity: medium
audit_skill_runtime is the surface-area check that catches drift between what
a SKILL.md documents and what its cited script actually exposes via --help.
After the harness TS migration, every real SKILL.md script citation became a
.ts invocation — but the auditor’s invocation regex still matches only
.py/.sh. There are no .py citations left in the plugin, so the auditor
now audits zero of the ~100 real .ts script citations (only 2 advisory
.sh references survive, and .sh is existence-checked, not introspected).
This task extends the auditor to match .ts and introspect those scripts’
flags via bun run <script> --help, restoring the check’s intent.
| Location | Role today |
|---|---|
.claude/scripts/audit_skill_runtime.ts | The shipped TS auditor (the .py original is gone). SCRIPT_INVOCATION_RE matches only `….(?:py |
.claude/scripts/tests/audit_skill_runtime/fixtures/ | All fixtures are .py-based (widget.py, multiflag.py, detect_quality_runners.py, committer.py) — there is no .ts fixture exercising the new path. |
plugin/skills/*/SKILL.md | Carry ~100 ${CLAUDE_PLUGIN_ROOT}…\.ts script citations the auditor currently ignores, plus 2 .sh citations it only existence-checks. |
Proposed
Section titled “Proposed”The auditor extracts .ts script citations from SKILL.md files and
flag-introspects them, so the ~100 real .ts citations are audited for
broken-reference and undocumented-flag drift exactly as .py scripts were
before the migration.
SCRIPT_INVOCATION_REmatches.py,.sh, and.tsinvocations.queryScriptFlagsintrospects.tsscripts viabun run <script> --help(not bare shebang exec), parses the advertised flags from the help output with the existingFLAG_REpath, and keeps the.shexistence-only and.pyshebang-exec behaviors intact.- The test corpus gains
.tsfixture counterparts so the.tsextraction andbun run --helpintrospection paths are exercised, including a clean case and an undocumented-flag drift case.
Approach
Section titled “Approach”- Extend
SCRIPT_INVOCATION_REinaudit_skill_runtime.tsto includetsin the extension alternation ((?:py|sh|ts)). - In
queryScriptFlags, add a.tsbranch that runsbun run <scriptPath> --help(keeping the existing 30s timeout, timeout-signal handling, and non-zero-exit handling), then feeds stdout through the existing flag parser. Leave the.shexistence-only branch and the.pyshebang-exec branch unchanged. - Refresh the module docstring’s “Matched invocation extensions” note to say
.py,.sh,.tsand to describe thebun run … --helppath for.ts. - Add
.tsfixture counterparts under.claude/scripts/tests/audit_skill_runtime/fixtures/— at minimum a clean.tsscript whose--helpadvertises the flags its demo SKILL.md cites, and a drift fixture whose SKILL.md cites a flag the.tsscript does not advertise — and wire them intoaudit_skill_runtime.test.ts.
Files to touch
Section titled “Files to touch”| Location | Kind | Change |
|---|---|---|
.claude/scripts/audit_skill_runtime.ts | modify | Add ts to SCRIPT_INVOCATION_RE; add the bun run <script> --help introspection branch for .ts in queryScriptFlags; update the module docstring. |
.claude/scripts/tests/audit_skill_runtime/audit_skill_runtime.test.ts | modify | Add cases covering .ts citation extraction and bun run --help flag introspection (clean + undocumented-flag drift). |
.claude/scripts/tests/audit_skill_runtime/fixtures/ | new | New .ts-based fixture trees (clean + drift) mirroring the existing .py fixture layout. |
Acceptance criteria
Section titled “Acceptance criteria”- AC-1: A
.tsscript cited in a SKILL.md fixture whose--helpdoes not advertise a cited flag is reported as drift (undocumented flag), proving.tscitations are now extracted and introspected. - AC-2: A
.tsscript whose--helpadvertises every cited flag passes clean (no false-positive drift), proving thebun run … --helppath parses real flags. - AC-3: Running the auditor against the live
plugin/skills/tree now introspects the.tscitations (audited count > 0) rather than auditing zero flag-bearing scripts. - AC-4: The existing
.shexistence-only and.pyshebang-exec behaviors are unchanged (their fixtures still pass).
Out of scope
Section titled “Out of scope”- Behavior assertions about what each cited script does (those belong to eval suites); this stays a documentation-vs-interface surface check.
- Auditing script citations outside
plugin/skills/<slug>/SKILL.md(e.g. citations in docs or other skill trees).
Dependencies
Section titled “Dependencies”- none
Discovery context
Section titled “Discovery context”Post-mortem follow-up from T-79SM-finish-claude-harness-ts-migration
(closed/done). The TS port of the auditor deliberately preserved the
.py/.sh-only matching to keep that migration faithful; this follow-up
restores the auditor’s intent now that the corpus it audits is entirely .ts.
Originally drafted on PR #215, which would have landed a schema-invalid,
date-prefixed, id-less task referencing the now-deleted .py auditor; this
re-mint reframes it to the shipped .ts auditor and supersedes #215.