Skip to content
svedocs

CLI

Create, build, check, index, generate OG assets, and deploy to Cloudflare with the svedocs CLI.

svedocs-cli provides two binaries: create-svedocs for scaffolding a project and svedocs for working with an existing one. The unscoped create-svedocs package only provides compatibility with package-manager create commands; it delegates all behavior to svedocs-cli.

Create

Shell
pnpm create svedocs my-docs --template docsnpm create svedocs@latest my-docs -- --template docspnpm dlx --package svedocs-cli create-svedocs my-docs --template docssvedocs create my-docs --template cloudflare

The create command first checks npm_config_user_agent, then the current project, to determine which package manager to use. If neither provides an answer, it looks for pnpm, npm, yarn, and bun in that order. Use --package-manager or --pm to choose one explicitly. Dependencies are not installed by default; add --install to install them immediately.

Generated projects receive svedocs and svedocs-cli through the template package.json. The template dependency specs are normal npm package specs, so --install installs them through the selected package manager rather than copying framework code from the create package.

Templates are fetched from GitHub first (backrunner/svedocs@main) so template fixes can ship without republishing the CLI. If GitHub is unavailable, create falls back to the bundled templates. Set SVEDOCS_TEMPLATE_SOURCE=bundled to force bundled templates, SVEDOCS_TEMPLATE_SOURCE=github to fail instead of falling back, or SVEDOCS_TEMPLATE_REF=<branch|tag|sha> to pin a remote template version.

Templates:

TemplatePurpose
minimalSmall SvelteKit docs project with local rendering.
docsDocumentation site with local MiniSearch-powered search, sitemap, robots, and OG routes.
cloudflareEdge-first project with Cloudflare Pages config and AI Search binding shape.

Upgrade

Shell
svedocs upgradesvedocs upgrade 0.2.0svedocs upgrade 0.2.0 --no-installsvedocs upgrade --check-only

The upgrade command updates both svedocs and svedocs-cli, checks the current-to-target version span, and runs the detected package manager by default. Use --no-install to only rewrite package.json, --dry-run to preview the dependency plan, or --check-only to run compatibility checks without changing files.

No breaking-change rules are registered yet. A future release can attach a rule to the version that introduces a breaking change. Upgrades that cross that version can then warn or stop, with --force available as an explicit override.

Build

Shell
svedocs build --mode edgesvedocs build --mode staticsvedocs ssgsvedocs build --mode spa

edge is the default and targets Cloudflare Pages SSR. static and svedocs ssg prerender the whole docs site. spa prerenders known pages and writes a fallback page for constrained hosts. Without an edge runtime, hosted search, Ask AI, and other server-only features use their local alternatives.

Check

Shell
svedocs check --strictsvedocs check --translationssvedocs check --packagesvedocs check --config ./svedocs.config.ts

Checks include duplicate routes, duplicate canonical URLs, missing descriptions, broken internal links, broken anchors, local assets, empty search output, SPA risk, optional translation gaps across public docs and standalone pages, and optional package export validation.

Index

Shell
svedocs index --format json --out static/search.jsonsvedocs index --format jsonl --out static/search.jsonlsvedocs index --provider cloudflare-ai-search --dry-run

Cloudflare AI Search indexing supports append and replace strategies:

Shell
svedocs index \ --provider cloudflare-ai-search \ --strategy replace \ --existing old-id,stale-id \ --delete manual-delete \ --wait

Set CLOUDFLARE_ACCOUNT_ID and CLOUDFLARE_API_TOKEN to upload records. Without credentials, the command stays in dry-run mode.

OG

Shell
svedocs og --format svg --out static/ogsvedocs og --format png --out static/ogsvedocs og --renderer satori --font ./Inter-Regular.ttf --format png

SVG output has no native runtime dependency. PNG output uses Resvg at generation time.

Deploy

Shell
svedocs deploy cloudflaresvedocs deploy cloudflare setupsvedocs deploy cloudflare setup --write

deploy cloudflare builds the configured Cloudflare output and runs wrangler pages deploy. If the project does not have wrangler.toml or wrangler.jsonc yet, the command initializes Cloudflare Pages config and src/app.cloudflare.d.ts first.

deploy cloudflare setup previews the generated wrangler.toml and platform type declarations. Add --write to create the files, or pass --format jsonc when you need wrangler.jsonc.