CLI Overview

The stx CLI is your primary interface for working with Syntext documentation. It handles project initialization, local development, building, and deployment.

Installation

curl -fsSL https://get.syntext.dev | sh
brew install syntext-dev/tap/stx
npm install -g @syntext/cli

Verify installation:

stx --version

Quick Reference

Command Description
stx init Initialize a new docs project
stx dev Start the development server
stx build Build on the Syntext backend and download the static site
stx deploy Deploy to Syntext CDN
stx generate Generate API docs from OpenAPI/code
stx check Validate configuration and content

Global Flags

All commands support these global flags:

Flag Alias Description
--help -h Show help for a command
--version -v Show CLI version
--config -c Path to config file (default: syntext.json)
--cwd Working directory (default: current directory)
--verbose Enable verbose output
--json Output as JSON (for scripting)

Configuration Files

The CLI looks for configuration in these locations (in order):

  1. .syntext/syntext.json or .syntext/stx.json
  2. .syntext/syntext.yaml or .syntext/stx.yaml
  3. .stx/syntext.json or .stx/stx.json
  4. .stx/syntext.yaml or .stx/stx.yaml
  5. syntext.json or stx.json (project root)
  6. syntext.yaml or stx.yaml (project root)

The first matching file is used. JSON and YAML formats are functionally equivalent — use whichever you prefer. For monorepos, place configuration in .syntext/ to keep the root clean.

Project Detection

The CLI auto-detects your project layout:

Standalone — Config at repository root:

docs-repo/
├── syntext.json
├── docs/
└── public/

Embedded — Config inside .syntext/ or .stx/:

my-api/
├── src/
├── package.json
└── .syntext/
    ├── syntext.json
    └── docs/

Environment Variables

Variable Description
SYNTEXT_API_KEY API key for authenticated operations
SYNTEXT_PROJECT_ID Override project ID
SYNTEXT_ENV Environment: production, staging
NO_COLOR Disable colored output

Exit Codes

Code Meaning
0 Success
1 General error
2 Configuration error
3 Validation error
4 Network error
5 Authentication error

Command Details

Initialize a new documentation project

Start the development server

Build static site for production

Deploy to Syntext CDN

Generate docs from OpenAPI or code

Validate configuration and content

Was this page helpful?