KB LabsDocs

CLI Reference

Last updated April 7, 2026


All pnpm kb commands — how to discover them, what groups exist, and key flags.

The KB Labs CLI is the primary interface for developers. Commands are registered by plugins at runtime, so the full list is always dynamic — it reflects exactly what's installed. This page covers the structure, the built-in command groups, and how to navigate the CLI yourself.

The complete, always-current command list lives in your terminal: pnpm kb --help and pnpm kb plugins commands. This page explains the structure; the live output is the canonical reference.

How to discover commands

Bash
# Top-level: all registered groups + system commands
pnpm kb --help
 
# Commands in a specific group
pnpm kb <group> --help
# Examples:
pnpm kb marketplace --help
pnpm kb workflow --help
pnpm kb commit --help
 
# Full structured dump of all commands across all installed plugins
pnpm kb plugins commands
 
# Detailed help for a specific command
pnpm kb <group>:<command> --help
pnpm kb commit:commit --help

The output of pnpm kb plugins commands is the authoritative list — it reads directly from the loaded plugin registry, including any locally linked plugins.

Command structure

Commands follow a two-level hierarchy:

pnpm kb <group> <command> [flags]
pnpm kb <group> <subgroup> <command> [flags]   # with subgroup

Examples:

  • pnpm kb commit commit --dry-runcommit group, commit command
  • pnpm kb marketplace plugins listmarketplace group, plugins subgroup, list command
  • pnpm kb workflow:run --workflow-id=my-flow — colon syntax (equivalent)

Built-in command groups

These groups are part of the core platform and are always available.

marketplace

Manage plugins and adapters.

Bash
pnpm kb marketplace install <pkg>       # Install from npm
pnpm kb marketplace uninstall <pkg>     # Remove
pnpm kb marketplace update [pkg]        # Update to latest
 
# Plugin subgroup
pnpm kb marketplace plugins list        # List installed plugins
pnpm kb marketplace plugins enable <id>
pnpm kb marketplace plugins disable <id>
pnpm kb marketplace plugins link <path> # Link local plugin for development
pnpm kb marketplace plugins unlink <id>
pnpm kb marketplace plugins doctor      # Diagnose plugin issues
 
pnpm kb marketplace clear-cache         # Clear plugin registry snapshot
pnpm kb marketplace clear-cache --deep  # Also clear Node.js module cache

workflow

Run and manage workflows.

Bash
pnpm kb workflow:run --workflow-id <id> [--input '<json>']
pnpm kb workflow:list
pnpm kb workflow:status --run-id <id>
pnpm kb workflow:cancel --run-id <id>
pnpm kb workflow:logs --run-id <id>

mind

Semantic code search (requires Mind plugin).

Bash
pnpm kb mind rag-query --text "your question" --agent
pnpm kb mind rag-query --text "question" --mode instant|auto|thinking
pnpm kb mind rag-index --scope default
pnpm kb mind rag-index --scope default --include "path/**/*.ts"

commit

AI-powered commit generation (requires commit plugin).

Bash
pnpm kb commit commit
pnpm kb commit commit --dry-run
pnpm kb commit commit --scope "@kb-labs/package-name"
pnpm kb commit commit --with-push

agent

Run and manage agents.

Bash
pnpm kb agent:run --agentId <id> --task "description"
pnpm kb agent:run --agentId <id> --session-id <id> --approve
pnpm kb agent:list
pnpm kb agent:init

review

AI code review.

Bash
pnpm kb review:run --repos "<repo>" --mode full --agent
pnpm kb review:run --repos "<repo>" --mode heuristic
pnpm kb review:run --repos "<repo>" --mode llm

docs

Documentation tooling.

Bash
pnpm kb docs generate-cli-reference     # Regenerate CLI-REFERENCE.md

devlink

Cross-repo dependency management.

Bash
pnpm kb devlink status
pnpm kb devlink switch --mode local --install
pnpm kb devlink switch --mode npm
pnpm kb devlink switch --mode local --dry-run
pnpm kb devlink undo

Global flags

These flags work on any command:

FlagDescription
--helpShow help for the current command or group
--jsonEmit structured JSON output (supported by most commands)
--log-level <level>Override log level: debug, info, warn, error

Output modes

Most commands support two output modes:

  • Text mode (default) — formatted for human reading: tables, spinners, colored output
  • JSON mode (--json) — structured JSON on stdout, no decorations, suitable for piping and agent consumption

When building scripts or workflows that consume CLI output, always use --json.

Environment variables

VariableEffect
KB_PROJECT_ROOTOverride project root (where .kb/kb.config.json lives)
KB_PLATFORM_ROOTOverride platform root (where node_modules/@kb-labs/* lives)
LOG_LEVELSet log level (debug, info, warn, error)
OPENAI_API_KEYLLM and embeddings access

Generated reference

A static snapshot of all commands is maintained in CLI-REFERENCE.md at the workspace root. Regenerate it after adding or changing commands:

Bash
pnpm kb docs generate-cli-reference
git add CLI-REFERENCE.md
git commit -m "docs: update CLI reference"

This file is useful for searching with grep or reading offline, but it can lag behind the live registry — always prefer pnpm kb --help for the authoritative list.

Adding commands (plugin authors)

Commands are declared in the cli.commands[] array of a plugin manifest. See Plugins → CLI Commands for the full authoring guide and Manifest Reference → cli for the schema.

After adding commands:

  1. Build the plugin: pnpm --filter your-plugin build
  2. Clear the registry cache: pnpm kb marketplace clear-cache
  3. Verify: pnpm kb your-group --help
CLI Reference — KB Labs Docs