Skip to content

bl apps: deploy a static site directory with --dir - #51

Merged
nathan-thillairajah merged 3 commits into
block:mainfrom
scottcrawford03:scrawford/apps-deploy-dir
Nov 17, 2026
Merged

nathan-thillairajah merged 3 commits into
block:mainfrom
scottcrawford03:scrawford/apps-deploy-dir

Conversation

@scottcrawford03

Copy link
Copy Markdown
Contributor

Why

To publish a static site today, the caller writes hotpod.manifest.json, moves the build into public/, and creates a tarball. macOS tar also adds ._* AppleDouble files, which the platform's static validation rejects. Agents and wrapper tools have to get every step right before they can deploy plain build output such as dist/.

What changes

  • bl apps deploy APP_ID --dir DIR packages a built site and deploys it. DIR must have index.html at its root.
  • --spa sets not_found_handling: "spa". Without it, unknown paths return 404.
  • The JSON response gains packaged_site with the file count, content and archive sizes, and the skipped paths.
  • A tarball path still works as before. --dir conflicts with it, and with --spa when a tarball is given.
  • The README has a new "Static sites" section.

How

The new src/bl/static_site.rs builds the artifact in a temporary file:

  • It writes a static manifest (root: public) and puts the files under public/.
  • It skips .DS_Store, ._*, .git/ and __MACOSX/.
  • It refuses symlinks and non-regular files.
  • It enforces the platform validator's entry and size limits before any network call.
  • It fails clearly if DIR contains hotpod.manifest.json (an artifact directory, not a site) or has no root index.html.
  • It uses fixed modes, mtimes, ownership and gzip header, so an unchanged directory always produces the same bytes.
  • It fails if a file changes size during packaging, instead of writing a short entry.

Packaging and directory errors happen before authentication or network calls.

It adds the tar crate (no default features) and moves tempfile from a dev-dependency to a dependency. flate2 was already in the lockfile.

Testing

  • Unit tests cover:
    • manifest and layout;
    • SPA mode;
    • identical archives;
    • skipped metadata;
    • missing index.html;
    • artifact directories;
    • file paths and symlinks.
  • Process tests:
    • --dir --spa uploads artifact.tar.gz with the expected manifest and entries, and reports packaged_site;
    • a directory without index.html fails without auth or network requests;
    • argument conflicts are rejected.
  • just lint and just test pass.
  • Live: bl apps deploy <app> --dir build/public --json on a bb-block staging static app. The CLI skipped .DS_Store, the server validated the 5-file artifact, and the version went active.

🤖 Generated with Claude Code

`bl apps deploy APP_ID --dir dist` packages a built static site as a Hot Pod
static artifact and uploads it, so callers no longer write a manifest or
tarball by hand. `--spa` selects index.html fallback for unknown paths.

Packaging writes the static manifest, places files under public/, skips
macOS metadata and .git, refuses symlinks, and produces identical bytes for
an unchanged directory. The deploy response gains `packaged_site`.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@scottcrawford03
scottcrawford03 requested a review from a team as a code owner November 16, 2026 21:18
Comment thread src/bl/static_site.rs Resolved
Comment thread src/bl/static_site.rs Resolved
Comment thread src/bl/static_site.rs Resolved
Address review on block#51:
- Skip `.env*`/`.envrc` files and `node_modules/`, so `--dir .` on a
  project doesn't publish secrets or dependencies to every viewer.
- Skip `.git` whatever its type; it is a file in worktrees and submodules.
- Match skip names before rejecting symlinks, so a symlinked
  `node_modules` is skipped instead of failing the deploy.
- Count the manifest and `public/` entry against the validator's entry and
  byte limits.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Comment thread src/bl/apps.rs Resolved
Comment thread README.md Resolved
The required deploy-source group made clap print it before APP_ID, while
parsing expects APP_ID first. Agents that copy syntax from --help would
swap the arguments. Also say that the static profile requirement applies
to --dir deploys only.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@nathan-thillairajah
nathan-thillairajah merged commit 670a3e9 into block:main Nov 17, 2026
4 checks 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.

3 participants