View raw

CLI#

@clipkit/cli is the command-line interface for Clipkit. Use it to scaffold projects, validate Sources, render locally, and (soon) preview locally.

Install#

npm install -g @clipkit/cli
# or, no install:
npx @clipkit/cli <command>

The CLI is published under Apache-2.0 and lives in the open at github.com/clipkit-video/clipkit.

Commands#

clipkit init [name]#

Scaffold a new Clipkit project in a fresh directory.

clipkit init my-video
cd my-video
npm install

The scaffold writes:

FilePurpose
video.tsA starter Source with one text element + one shape. Edit this.
package.jsonPinned @clipkit/cli, @clipkit/protocol, @clipkit/runtime.
tsconfig.jsonStrict TS, moduleResolution: 'bundler'.
AGENTS.mdAuto-loaded by AI agents working in this directory.
README.mdOne-page project notes.

If you omit [name], the CLI scaffolds into the current working directory (only if it is empty).

clipkit validate <file>#

Schema-check a Source against the Clipkit Protocol.

clipkit validate video.ts
# ✓ video.ts is a valid Clipkit Protocol v1.0 document.

clipkit validate broken.json
# ✗ broken.json failed validation (2 errors):
#   - elements.0.type: Invalid discriminator value
#   - width: Expected positive integer

Accepts .json, .ts, .tsx, .mts, .cts, .js, .mjs, .cjs. TypeScript files load via jiti — no separate build step.

Source resolution. The file must export the Source as one of:

  1. default export
  2. A named export called source, video, project, or composition
  3. The only named export, if exactly one named export exists

If none of those match, the command errors with a list of the named exports it found.

Exit codes.

CodeMeaning
0Valid.
1Validation errors. The list is printed to stderr; the parsed Source is not.
2The file could not be loaded (syntax error, missing module, etc.).

clipkit validate is the same function @clipkit/renderer runs before it spawns Chromium. If it passes here, the runtime will not reject the document for schema reasons.

clipkit preview <file> (coming soon)#

Open a local Vite-driven browser preview. Hot-reloads on save.

Today, this command validates the Source and opens the hosted playground at playground.clipkit.dev pre-loaded with your file. The local preview ships alongside the next render-service release.

clipkit render <file> -o <output.mp4>#

Render the Source to MP4. Local by default — headless Chrome via @clipkit/renderer (an optional peer; install it and have Google Chrome). Use --cloud for the hosted GPU renderer, which also unlocks ProRes / AV1 / transparent formats (needs clipkit login).

clipkit render video.ts -o out.mp4            # local (default)
clipkit render video.ts -o out.mp4 --cloud    # hosted GPU

--backend auto|webgpu|webgl2 forces the local engine's backend; -r/--resolution and --bitrate tune the output. See the renderer docs for the full API.

Global flags#

FlagDefaultDescription
--version, -vPrint the CLI version.
--help, -hShow help for the current command.
--cwd <path>process.cwd()Run as if invoked from <path>.

License#

Apache-2.0. See packages/cli/LICENSE in the repo.