Home · Developers · Guides · CLI

Interfaces

CLI

86 Typer commands mirroring the API

The Nova Coder CLI is built with Typer and provides commands for interacting with the application, inspecting health, scanning projects, and running agents.

Running the CLI

novacoder --help
python -m novacoder --help

Commands

Command Description
version Show Nova Coder version
doctor Check health of all services
config show Display loaded configuration
config validate Validate the loaded configuration
config backup Back up the current configuration to a JSON file
config restore --file <path> Restore configuration from a .json, .yaml, or .yml file
config diff --file <path> Diff the current configuration against a .json, .yaml, or .yml file
config migrate Run pending configuration schema migrations
scan <path> Scan a project directory
models List available AI providers and models
tools List registered tools (includes linter, package manager, HTTP request)
agents List registered agents (includes security by default)
plan <goal> Generate a structured plan using the Planner agent
plugins List registered plugins and their contributions
run <goal> Execute a goal through the agent pipeline
chat <message> Send a message through the planner agent
stream <message> Stream AI tokens from the configured provider
interactive Start an interactive REPL session
memory Manage session/working/project memory
serve Start the REST API and web dashboard server
gui Launch the terminal UI (TUI)
deployment build-wheel Build a wheel distribution
deployment build-docker Build a Docker image
deployment status Check build status
deployment artifacts List build artifacts

Examples

Check Health

novacoder doctor

Output:

┌───────────┬────────┬─────────┐
│ Service   │ Status │ Message │
├───────────┼────────┼─────────┤
│ config    │ ✓      │         │
│ logging   │ ✓      │         │
│ workspace │ ✓      │         │
│ ai        │ ✓      │         │
│ tools     │ ✓      │         │
│ agents    │ ✓      │         │
└───────────┴────────┴─────────┘
Overall: healthy - All 8 services are healthy.

Scan a Project

novacoder scan /path/to/project

Chat with the Planner

novacoder chat "Build a Flask API"

This produces a structured plan with tasks and dependencies.

Stream AI Tokens

novacoder stream "Explain Python decorators" --provider mock

Output is written to stdout as each token is received from the provider.

List Tools

novacoder tools

Build Wheel Distribution

novacoder deployment build-wheel

Build Docker Image

novacoder deployment build-docker --image novacoder:latest

Check Build Status

novacoder deployment status

List Build Artifacts

novacoder deployment artifacts

Project Path Option

Most commands accept a --project option. When provided, it is used as the working directory for the command. If a command accepts a positional path, the --project flag is used as the default:

novacoder --project /path/to/project scan

Start the REST API Server

novacoder serve

With a custom port and token:

NOVACODER_API__TOKEN=secret novacoder serve --port 8080

CLI Execute API

POST /api/cli/execute runs commands in a sandboxed subprocess (run_shell_commands permission enforced). GET /api/cli/commands lists all invocable commands including Typer sub-app groups:

  • Groups (plugin, security, workflow, deployment, cicd, distributed, infrastructure, workspace, code, memory-advanced, agents-advanced, system) are listed with is_group: true.
  • Sub-commands appear as group sub entries (e.g. workspace merge, system restore) and may be executed either as {"command": "workspace merge"} or {"command": "workspace", "args": ["merge", ...]}.
  • Timeout: 30 seconds; stderr from unknown commands is returned verbatim.

CLI Helper

The internal _get_app() helper in novacoder/cli/main.py creates and starts a NovaApplication. It supports:

  • minimal=True, passes through to create_app() to disable workspace.index_on_start for quick metadata commands.
  • overrides=dict, passes arbitrary config overrides through to create_app().

create_app() now accepts a minimal flag directly, which sets workspace.index_on_start = False in the overrides. Every CLI command uses nova_app = None and a try/finally block so _get_app() failures still clean up resources.

Adding Commands

Commands are defined in novacoder/cli/main.py using Typer decorators:

@app.command()
def my_command(name: str) -> None:
    """Description."""
    console.print(f"Hello {name}")

CLI Architecture

The CLI is the primary user interface for v0.1.0. It creates a NovaApplication, starts it, resolves services from the container, runs the command, and then stops the application cleanly.

from novacoder.app import create_app

app = create_app()
app.start()
# run command...
app.stop()

Development Instructions

Adding a New CLI Command

  1. Add a new function in novacoder/cli/main.py decorated with @app.command().
  2. Use create_app() and app.start() to access services, then app.stop() to clean up.
  3. Resolve services from the container by class name for type safety.
  4. Add a test in tests/ that invokes the Typer command using CliRunner.

Example Command

@app.command()
def stats() -> None:
    """Show project statistics."""
    app = _get_app()
    try:
        workspace = app.container.resolve(WorkspaceService)
        summary = workspace.summary()
        console.print(summary)
    finally:
        app.stop()

Testing Commands

from typer.testing import CliRunner
from novacoder.cli.main import app

runner = CliRunner()
result = runner.invoke(app, ["version"])
assert result.exit_code == 0
assert "Nova Coder" in result.output

CLI Style Guidelines

  • Use rich for tables, panels, and JSON output.
  • Keep command descriptions short and clear.
  • Accept Path objects for filesystem paths.
  • Always shut down the application in a finally block.

Discovery Notes

During the latest system-wide debug pass, the models command failed with TypeError: can only join an iterable and a RuntimeWarning: coroutine 'OllamaProvider.available_models' was never awaited. The provider method available_models() is async, but the CLI was calling it synchronously.

Fix: novacoder/cli/main.py now defines a _run_async() helper that detects whether an event loop is already running and uses asyncio.run() or a thread-pool executor as needed:

models_list = _run_async(provider.available_models())

The global --project flag is now stored in the CLI state and respected by commands that accept a path. Error output is routed to stderr via err_console, and every command wraps service startup in try/finally to stop NovaApplication on failure.

A full suite of CLI regression tests was added in tests/test_cli.py using Typer's CliRunner. The covered commands include version, models, tools, agents, chat, plan, and gui.

The serve command starts the FastAPI/uvicorn server. The REST API and dashboard are documented in REST API.

Source: wiki/cli.md · rendered 2026-11-10