Skip to content

Keep cast --check from creating the bundle dir#366

Merged
jmchilton merged 1 commit into
mainfrom
close-360-cast-check-readonly
Jul 21, 2026
Merged

Keep cast --check from creating the bundle dir#366
jmchilton merged 1 commit into
mainfrom
close-360-cast-check-readonly

Conversation

@jmchilton

Copy link
Copy Markdown
Member

Posted by Claude (AI assistant) on behalf of @jmchilton — not authored by them personally.

Closes #360.

runCastMoldCommand called mkdirSync(bundleRoot, { recursive: true }) before anything branched on args.check, so a read-only drift check against a never-cast Mold left an empty casts/claude/skills/<mold>/ behind. Git doesn't track empty dirs, so these were invisible in git status but broke tests/plugin-packaging.test.ts's SKILL.md-per-skill assertion.

Every other write in the check path (castOneRef, reconcileSkillMarkdown, _required_tools.json, _verify.json) was already guarded — the mkdir was the sole leak.

Regression test

tests/cast-mold.test.ts — "--check on a never-cast mold leaves no bundle directory behind": temp repo, minimal Mold with no refs, cast m --check → nonzero exit, SKILL.md drift reported, casts/claude/skills/m absent. Confirmed red-to-green.

Verification

  • Issue's reproduction: cast validate-cwl --check reports both drifts, exit 1, no dir created.
  • Repo-wide --check scan over all content/molds/*/index.md: find casts/claude/skills -type d -empty returns nothing.
  • npm run test 151/151, typecheck 0 errors, packages-test, packages-format, packages-lint, validate (0 errors) all pass.

🤖 Generated with Claude Code

runCastMoldCommand mkdir'd bundleRoot before branching on --check, so a
drift check against a never-cast Mold left an empty
casts/claude/skills/<mold>/ behind. Git ignores empty dirs, so these were
invisible in git status but broke plugin-packaging's SKILL.md-per-skill
assertion.

All other writes in the check path were already guarded; only the mkdir
was not.

Closes #360

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@jmchilton
jmchilton merged commit ad7dd43 into main Jul 21, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

foundry-build cast --check creates its destination directory

1 participant