@zenithbuild/cli
v0.8.0
Published
Deterministic project orchestrator for Zenith framework
Readme
@zenithbuild/cli ⚡
⚠️ Internal API: This package is an internal implementation detail of the Zenith framework. It is not intended for public use and its API may break without warning. Please use
@zenithbuild/coreinstead.
The command-line interface for developing and building Zenith applications.
Canonical Docs
- CLI contract:
../../docs/documentation/cli-contract.md - Deployment targets guide:
../../docs/documentation/guides/deployment-targets.md - Route protection:
../../docs/documentation/routing/route-protection.md - Server output contract:
./SERVER_OUTPUT_CONTRACT.md
Overview
@zenithbuild/cli is Zenith's deterministic project orchestrator. It owns the daily development loop:
zenith devzenith buildzenith preview
It ships a minimal V1 plugin surface for config-time normalization only.
Features
- Dev Server: Instant HMR (Hot Module Replacement) powered by Bun.
- Build System: deterministic build output and adapter packaging.
- Preview: target-aware verification of built output.
Config Baseline
Current top-level zenith.config.js keys:
routerembeddedMarkupExpressionstypescriptDefaultoutDirpagesDirbasePathtargetadapterstrictDomLintsimagesplugins
There is no separate assetPrefix config. Public framework asset URLs follow basePath.
plugins behavior:
- Plugins are added in
zenith.config.jswithplugins: [authPlugin(), mdxPlugin()]. - V1 plugins must be named objects and may only provide a
config()hook. - V1 plugin config patches are shallow top-level patches; nested objects such as
imagesreplace that config object instead of deep-merging. - V1 plugins cannot transform files, register middleware, mutate routes/security, or install compiler/bundler/dev-server hooks.
- Global middleware is separate Lane 2 work.
pagesDir resolution:
- If
pagesDiris set, the CLI uses that path relative to the project root. - If
pagesDiris not set, the CLI checkspages/first, thensrc/pages/, then falls back to the defaultpagespath.
basePath behavior:
basePathdefaults to/.- Canonical route paths stay base-path free in manifests and route classification.
- Public app URLs, bundled asset URLs, router URLs, and any framework endpoints exposed by the selected target are prefixed with
basePath. - Canonical
.zenith-outputfiles stay adapter-neutral; final adapter output may still nest public files underbasePathwhen direct-file serving requires it.
router behavior:
router: trueenables client router bootstrap/runtime injection.router: falsedisables client router bootstrap/runtime injection.assets/router-manifest.jsonmay still be emitted as an internal preview artifact. Its presence does not mean client router mode is enabled.
target / adapter behavior:
targetis the shorthand deployment target. Phase 1 defaults loaded config totarget: 'static'.adapteris the explicit adapter object form and is mutually exclusive withtarget.static-exportemits rewrite-free concrete public files rooted atoutDirand requiresexportPathsfor dynamic prerender routes.vercel-staticemits a Vercel Build Output API layout rooted atoutDir.netlify-staticemits a Netlify publish directory rooted atoutDir, including generated_redirectsrewrites for dynamic prerendered routes.vercelemits a Vercel Build Output API layout with packaged route functions for server-classified routes and static rewrites for prerendered dynamic routes.netlifyemits a deploy root withpublish/,functions/,netlify.toml, and generated_redirectsthat force server-classified routes through packaged functions.nodeemits a standalone Node artifact rooted atoutDirwithindex.js,package.json,manifest.json,static/, andserver/.
Server-capable target contract:
- Route classification stays upstream in the manifest and server package layers.
.zenith-output/serveris the canonical packaged server contract consumed by adapters.- Adapters package classified output into host layouts; they do not reinterpret route meaning.
Current limitations:
- There is no separate
assetPrefixknob. Assets intentionally followbasePath. static-exportdoes not expose deployed/_zenith/imageor/__zenith/route-checkendpoints. A plain static file server is the contract.node,vercel, andnetlifyexpose deployed/_zenith/imageendpoints on the packaged image contract.- Hosted
vercelandnetlifytargets skip advisory/__zenith/route-check; direct HTML requests remain the server-side route boundary. - Image materialization is route-artifact-driven. Bundler owns final build/static HTML image materialization, while preview and server render still materialize at runtime from structured
image_materializationmetadata. No path executes page assets, and dynamic image props are currently unsupported until the compiler emits a dedicated image-props artifact. - Extension discovery commands are read-only; they do not install packages or mutate
zenith.config.
Commands
zenith plugin
zenith plugin list— official registry pluginszenith plugin search <term>— metadata searchzenith plugin info <name|alias>— registry metadata and localpackage.jsonzenithblock if installed
zenith adapter
zenith adapter list— registry adapters and built-in targets
zenith dev
Starts the development server on localhost:3000.
Changes to zenith.config.js or zenith.config.ts require restarting zenith dev. If the dev watcher observes a config-file edit, it reports the restart policy instead of rebuilding with stale config.
zenith build
Compiles and bundles your application for production.
zenith preview
Previews the locally built target contract for verification. Static targets serve built files; target: 'node' boots the built Node artifact.
Installation
Typically installed as a dev dependency in your Zenith project:
bun add -d @zenithbuild/cliLicense
MIT
