Skip to content

fix(site): delete only an output directory the build made - #90

Merged
TMHSDigital merged 1 commit into
mainfrom
fix/site-out-guard
Sep 24, 2026
Merged

TMHSDigital merged 1 commit into
mainfrom
fix/site-out-guard

Conversation

@TMHSDigital

Copy link
Copy Markdown
Owner

Fixes #50.

scripts/build_site.py deletes --out before it writes the site. Until now the only guard refused the repository root, site/, and the directories above them. Anything else was deleted, so --out docs, --out src, --out .git, or --out ~ deleted it.

Now every build writes a .plumbline-site marker into its output. refusal_to_clear(out) allows only three kinds of path:

  • a path that does not exist
  • an empty directory
  • a directory that holds the marker

Anything else is refused, with a message that says why, before any build work starts. The old repository and site/ check is still there.

A contributor's _site from before this change has no marker, so it is refused once and has to be removed by hand. The CHANGELOG entry says so. CI builds into a fresh checkout, so it is not affected. actions/upload-pages-artifact leaves out dotfiles, so the marker is never deployed.

Tests: every protected path is refused (repo root, site/, docs/, src/, .git/, home, a file, a directory holding a stranger's file). A new directory, an empty one, and one built earlier are accepted. Run by hand: a fresh build, a rebuild over its own output, and --out docs (refused, exit 1). check_site_links.mjs passes on the output.

🤖 Generated with Claude Code

build_site.py deleted any --out that was not the repository, site/, or
above them, so a typo like --out docs deleted source. It now clears only a
missing or empty directory, or one carrying the .plumbline-site marker
that every build writes, and refuses the rest before any work is done.

Fixes #50.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@TMHSDigital
TMHSDigital merged commit 1bf9cb7 into main Sep 24, 2026
18 checks passed
@TMHSDigital
TMHSDigital deleted the fix/site-out-guard branch September 24, 2026 00:30
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.

build_site.py --out will delete real directories

1 participant