CLI Reference

Complete reference for the flydocs command-line interface: installation, configuration, and every subcommand.

The flydocs CLI (@flydocs/cli) is the primary tool for initializing projects, syncing configuration, and managing your connection to the FlyDocs cloud portal. It installs project infrastructure, generates context files, and keeps your local environment in sync with your workspace.

Installation

terminal
npm install -g @flydocs/cli

Requires Node.js 18.17.0 or later. After installing, run flydocs init in your project directory to get started.

Version Check

The CLI checks for updates before every command execution, caching the result for five minutes. If a newer version is available, it prompts you to update. This check is skipped for --version, --help, and self-update.

terminal
flydocs --version

Commands

Command Description
flydocs init The single setup command. Initializes FlyDocs in a project for the local or cloud tier (use --tier local for offline evaluation).
flydocs connect Connect an existing local project to the cloud portal.
flydocs update Update config and artifacts from the server.
flydocs sync Sync config and artifacts with the server.
flydocs auth Store an API key globally for authentication.
flydocs scan AI-generate project context files from your codebase.
flydocs upgrade Learn about cloud tier benefits and migrate from local mode.
flydocs uninstall Remove all FlyDocs files and configuration from a project.

Additional Commands

Command Description
flydocs skills Manage skills. Subcommands: list, search <keyword>.
flydocs clean Remove legacy artifacts. Use --workspace-root to target the workspace root.
flydocs self-update Update the CLI itself to the latest published version.
flydocs telemetry Manage analytics. Subcommands: enable, disable, status.

Credential Resolution

When the CLI needs an API key, it checks these sources in order. The first match wins.

  1. FLYDOCS_API_KEY environment variable
  2. .flydocs/credentials.json in the project directory (created with --project-key)
  3. .flydocs-workspace.json parent directory credentials (multi-repo workspaces)
  4. ~/.flydocs/credentials global file (the default location)

For most setups, running flydocs init or flydocs auth stores the key globally at ~/.flydocs/credentials. Override with environment variables in CI or when managing multiple workspaces.

Environment Variables

See the Environment Variables page for the full reference. Key variables:

Variable Description
FLYDOCS_API_KEY API key (fdk_...). Highest priority in credential resolution.
FLYDOCS_WORKSPACE_ID Workspace ID override.
FLYDOCS_TELEMETRY Set to 0 to disable telemetry.

Exit Codes

Code Meaning
0 Success, or the user cancelled an interactive prompt.
1 Error: validation failure, API error, or filesystem issue.

Select a command from the sidebar for detailed documentation, flags, examples, and behavior notes.