Skip to content

feat(kodena): static (kind:assets) deploy support#42

Merged
sutisnamulyana merged 1 commit into
mainfrom
feat/kodena-static-deploy
Jun 5, 2026
Merged

feat(kodena): static (kind:assets) deploy support#42
sutisnamulyana merged 1 commit into
mainfrom
feat/kodena-static-deploy

Conversation

@sutisnamulyana
Copy link
Copy Markdown
Member

What

kodena deploy can now deploy a pure static site as a kind:'assets' bundle. Previously it only emitted kind:'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's scripts/deploy-static.mjs). The kodena backend already accepts kind:'assets'; this just teaches the CLI to send it.

How

  • --static / --no-static flags + a kodena.json build.static field. When neither is set, the CLI auto-detects: if the resolved worker entry is missing, it deploys static.
  • Static assets root = build.assetsDir ?? build.outputDir ?? 'out' (the whole static export, not outputDir/assets). Reuses the existing walkAssets().
  • vars / compatibilityFlags / compatibilityDate are worker-only; for a static deploy they're ignored with a warning (there's no worker to bind them to).
  • New AssetsBundle + DeployBundle types; summarise() and redactBundle() handle both kinds; resolveStaticAssetsDir() helper added.

CLI-only — no backend change (the services/kodena deploy route already routes on body.kind with an assets branch).

Tests

  • tsc --noEmit clean; 79 vitest tests pass (+6 new: build.static parses, resolveStaticAssetsDir, summarise(assets) ⇒ 0 worker bytes).

  • Validated by a read-only dry-run against torajamelo's out/:

    → Reading static assets: .../torajamelo/out
    ✓ Bundle ready: static — 2974 assets (40.14 MiB total)
      "kind": "assets", "scriptContent": "<none — static>"
    

    Identical to what deploy-static.mjs produces (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

`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>
@sutisnamulyana sutisnamulyana merged commit ba350e5 into main Jun 5, 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.

1 participant