Skip to Content
CLIinit

init

Initialize Knoku in your documentation project.

npx @knoku/cli@latest init # or, if installed globally knoku init

What it does

  1. Detects your framework: automatically identifies your documentation framework and sets the docs directory accordingly. See Integrations for supported platforms.
  2. Prompts for credentials: asks for your API key (sk_live_...) and Project ID (UUID). If these already exist in your env file, they are reused.
  3. Saves config to .knoku/.env.
  4. Updates .gitignore: adds .knoku/.env to keep your credentials out of version control.
  5. Shows next steps: prints the commands to run next (push, doctor).

Interactive prompts

If no existing config is found, init asks two questions:

Enter your API key (sk_live_...): Enter your Project ID (UUID):

You can find both values in your Knoku Dashboard  under Project > Settings > API Keys.

Framework detection

init checks your project root and auto-detects your documentation framework. When detected, the docs directory is set automatically. If no framework is detected, the current directory (./) is used as the docs root.

To point at a different folder, edit KNOKU_DOCS_DIR in .knoku/.env after running init. URLs are then generated by stripping the file extension and any /index suffix (e.g. getting-started/install.md/getting-started/install), which works for most static site generators. If your site uses a different URL scheme, set KNOKU_URL_BASE or add a url: frontmatter field to specific files. See Configuration → URL routing.

See Integrations for the full list of supported platforms.

Generated files

.knoku/.env

Stores your project credentials:

# Knoku Configuration # # KNOKU_EXCLUDE: Comma-separated glob patterns to exclude from sync # Example: KNOKU_EXCLUDE=blog/**,changelog.md,api-reference/** # KNOKU_API_URL=https://api.knoku.com KNOKU_API_KEY=sk_live_... KNOKU_PROJECT_ID=01234567-89ab-cdef-0123-456789abcdef KNOKU_DOCS_DIR=./docs/

KNOKU_DOCS_DIR is the detected framework directory when a supported framework is found. If no framework is detected, init writes KNOKU_DOCS_DIR=./.

If your framework has a built-in blog feature (Docusaurus, MkDocs), the CLI adds KNOKU_EXCLUDE=blog/** automatically. Other frameworks omit this line.

This file is automatically added to .gitignore. If .gitignore does not exist, init creates it. See Configuration for all available variables and exclude pattern details.

Re-running init

Running init again in an already-configured project is safe. Existing values are preserved; the CLI only prompts for missing fields.

Example output

Knoku — Initializing... Framework: Nextra (./src/content/) Enter your API key (sk_live_...): sk_live_xxxxx Enter your Project ID (UUID): 01234567-89ab-cdef-0123-456789abcdef ✓ Config saved: .knoku/.env ✓ Added .knoku/.env to .gitignore Next steps: 1. Push your docs: npx @knoku/cli@latest push 2. Verify setup: npx @knoku/cli@latest doctor

If .gitignore did not exist, the output says ✓ Created .gitignore with .knoku/.env instead.

Last updated on