Skip to content

Theme installer (zip upload, manifest validation) #13

Description

@tayebmokni

Summary

Admin-facing theme installer: zip upload endpoint, manifest validation, sandboxed esbuild compile of .tsx templates, forbidden-import linter, engineVersion check, SHA-256 of package, signature verification for registry installs. Outputs a theme row + extracted files in themes/{id}/.

Design reference

  • docs/03-theme-system.md §12 (Theme Installer & Switcher)
  • docs/03-theme-system.md §12.2 (Validation)
  • docs/03-theme-system.md §12.3 (Security considerations)

Acceptance criteria

  • POST /api/v1/admin/themes accepts a theme.zip (admin only)
  • Verifies package.json.gonext.kind === "theme"
  • Validates theme.json against schema (theme.json v1 schema and validator #5)
  • esbuild-compiles every .tsx file in a sandbox; surfaces syntax errors
  • Forbidden-import lint: rejects node:fs, node:child_process, cookie-write APIs from next/headers
  • Checks engineVersion against host CMS version
  • Computes SHA-256 of the package
  • Warns "unsigned theme" for non-registry installs, requires confirmation
  • Installation events logged
  • Integration test: upload zip → validation passes → theme row written + files extracted

Dependencies

#5

Complexity

L

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions