Skip to content

refactor: tested scripts for command shell programs + real YAML frontmatter check - #120

Merged
rshankras merged 1 commit into
mainfrom
feat/112-109-scripts
Nov 6, 2026
Merged

rshankras merged 1 commit into
mainfrom
feat/112-109-scripts

Conversation

@rshankras

Copy link
Copy Markdown
Owner

Closes #112. Closes #109.

In plain words

Several commands carried 20–40 line shell programs that the AI retyped on every run, and nothing checked them. They now live in real script files, and every check run tests them against small sample projects. The validator also now reads each command's settings block the same way Claude Code does, so a broken one fails here instead of only on GitHub. Doing this turned up two real bugs, both fixed.

What changed

Scripts (#112). templates/_scripts/, reached through the ~/.claude/swiftship-templates link for both plugin and manual installs:

Script Used by Does
design-debt.sh map Step 4.4 design-debt table, score and missing-font check
debt-measure.sh debt Step 1 violations per area and rule set, ranked by recent commits
baseline-refresh.sh debt Step 6 rewrites the baseline; if an existing rule grew, restores the old one itself (exit 3)
design-pin.sh plan Design Pin copies and hashes the frames
design-compare.sh verify 3.7c added / removed / changed frames
  • Each command now calls its script in one line, with a short note on what it prints.
  • If a script is missing, the command tells you to update SwiftShip, rather than letting the AI retype the program.
  • I didn't keep an inline fallback copy (the issue suggested one). Two copies would drift apart, and the scripts always ship with the commands.

Tests.

  • scripts/test-scripts.sh runs every script against tests/fixtures/app, a sample app with folder and file names containing spaces, a test folder, and a token folder. It also covers an empty project, baseline growth vs new rules, and design changes.
  • A fake swiftlint stands in for the real one, so the tests run on GitHub's Linux machines without Xcode.
  • validate.sh runs the tests as check feat: optional ASC metadata + What's New push (Phase 5) #8.
  • Proving the tests can fail: I planted three bugs: the old space-splitting loop, removing the test-folder exclusion, and not restoring the baseline. The tests caught all three.

YAML check (#109).

  • New scripts/check-frontmatter.sh parses each command's and agent's settings block with Ruby's YAML parser (present on macOS and Ubuntu). It fails on:
    • a block that doesn't parse
    • a description that isn't text
    • an argument-hint that isn't text
  • Sample files cover feat: /apple:debt — measure and pay down an existing app's own debt #108's broken hint, a hint that reads as a list, and a good one.

Bugs found along the way

  • map's design-debt measure split file paths on spaces. It also missed test folders like App Tests/. ChantFlow read 53%; the real figure is 28%, now that its ChantFlow Watch App/ views are counted. Antics (13%) and Specimen (36%) are unchanged.
  • 24 commands' argument-hint (e.g. [phase-number]) read as a list, not text. They're now quoted. privacy.md had an empty hint, now removed.

Tested

  • ./scripts/validate.sh passes, including 22 script and frontmatter tests.
  • claude plugin validate . passes.
  • design-debt.sh and debt-measure.sh were also run on Antics, Specimen and ChantFlow.

🤖 Generated with Claude Code

…tmatter as YAML (#112, #109)

templates/_scripts/ now holds design-debt, debt-measure,
baseline-refresh, design-pin and design-compare; map, debt, plan and
verify call them. scripts/test-scripts.sh runs them against fixture
projects with a fake swiftlint, from validate.sh. Fixes design-debt
skipping paths with spaces. validate.sh parses frontmatter with Ruby's
YAML parser; 24 list-shaped argument-hints are quoted.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@rshankras
rshankras merged commit 348098b into main Nov 6, 2026
2 checks passed
@rshankras
rshankras deleted the feat/112-109-scripts branch November 6, 2026 11:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant