feat(kodena): static (kind:assets) deploy support#42
Merged
Conversation
`kodena deploy` only emitted kind:'worker-bundle', so pure static sites (no worker.js) couldn't use it — they reinvented a direct-POST script. The kodena backend already accepts kind:'assets'; this teaches the CLI to send it. - kodena.json `build.static` + `--static` / `--no-static` flags; auto-detect static when the resolved worker entry is missing. - Static assets root = build.assetsDir ?? build.outputDir ?? 'out' (the whole static export, not outputDir/assets). Reuses walkAssets. - vars / compatibility flags ignored-with-warning for static (no worker). - summarise() + redactBundle() handle both bundle kinds; AssetsBundle + DeployBundle types added. - Tests: build.static parses, resolveStaticAssetsDir, summarise(assets)=0 worker bytes. 79 passing. Validated by dry-run against torajamelo's out/ (2974 assets, identical to its deploy-static.mjs). CLI-only; no backend change. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
kodena deploycan now deploy a pure static site as akind:'assets'bundle. Previously it only emittedkind:'worker-bundle'(worker.js + assets), so static sites with no worker of their own couldn't use it — they had to reinvent a direct-POST script (e.g. torajamelo'sscripts/deploy-static.mjs). The kodena backend already acceptskind:'assets'; this just teaches the CLI to send it.How
--static/--no-staticflags + akodena.jsonbuild.staticfield. When neither is set, the CLI auto-detects: if the resolved worker entry is missing, it deploys static.build.assetsDir ?? build.outputDir ?? 'out'(the whole static export, notoutputDir/assets). Reuses the existingwalkAssets().vars/compatibilityFlags/compatibilityDateare worker-only; for a static deploy they're ignored with a warning (there's no worker to bind them to).AssetsBundle+DeployBundletypes;summarise()andredactBundle()handle both kinds;resolveStaticAssetsDir()helper added.CLI-only — no backend change (the
services/kodenadeploy route already routes onbody.kindwith anassetsbranch).Tests
tsc --noEmitclean; 79 vitest tests pass (+6 new:build.staticparses,resolveStaticAssetsDir,summarise(assets)⇒ 0 worker bytes).Validated by a read-only dry-run against torajamelo's
out/:Identical to what
deploy-static.mjsproduces (2974 assets / 40.1 MiB). Auto-detect path verified too.A changeset (
.changeset/kodena-static-deploy.md, minor bump for@sawala/kodena) is included.Design rationale and the follow-up (retiring torajamelo's bespoke script) are in
sawala-cloud/docs/plan/PLAN-kodena-cli-static-deploy.md.🤖 Generated with Claude Code