Skip to main content

Command Line Arguments

This document details all command line arguments and subcommands of Codely CLI.

Basic Usage

codely [options] [command]

Start the Codely CLI interactive interface, or use -p/--prompt to enter non-interactive mode.

Global Options

ParameterShort FormTypeDefault ValueDescription
--model-mstringGEMINI_MODEL environment variableSpecify the primary model to use
--multimodal-stringCODELY_MULTIMODAL environment variableMultimodal model for image/video analysis
--flash-stringCODELY_FLASH_MODEL environment variableFlash model for internal operations (as fallback target)

Examples:

codely --model qwen-max
codely --multimodal qwen-vl-max
codely --flash qwen-turbo

Interactive Mode Options

ParameterShort FormTypeDefault ValueDescription
--prompt-pstring-Provide a prompt (non-interactive mode). If stdin input is also provided, it will be appended to the input
--prompt-interactive-istring-Continue into interactive mode after executing the provided prompt

Note: --prompt and --prompt-interactive cannot be used simultaneously.

Examples:

# Non-interactive mode, execute a single prompt
codely -p "Help me write a Python function"

# Enter interactive mode after executing prompt
codely -i "Initialize a React project"

File and Context Options

ParameterShort FormTypeDefault ValueDescription
--all-files-abooleanfalseInclude all files in context
--include-directories-array-Additional directories to include in workspace (comma-separated or use the option multiple times)

Deprecated: --all_files (use --all-files instead)

Examples:

# Include all files
codely --all-files

# Include additional directories
codely --include-directories /path/to/extra --include-directories /another/path
codely --include-directories /path1,/path2

Approval and Security Options

ParameterShort FormTypeDefault ValueDescription
--yolo-ybooleanfalseAutomatically accept all operations (YOLO mode)
--approval-mode-stringdefaultSet approval mode:
- default: prompt for approval
- auto_edit: automatically approve edit tools
- yolo: automatically approve all tools

Note: --yolo and --approval-mode cannot be used simultaneously.

Examples:

# YOLO mode (automatically approve all operations)
codely --yolo

# Automatically approve edit tools, other tools still require approval
codely --approval-mode auto_edit

Debug and Logging Options

ParameterShort FormTypeDefault ValueDescription
--debug-dbooleanfalseRun in debug mode
--show-memory-usage-booleanfalseDisplay memory usage in status bar

Deprecated: --show_memory_usage (use --show-memory-usage instead)

Examples:

codely --debug
codely --show-memory-usage

MCP Server Options

ParameterTypeDefault ValueDescription
--allowed-mcp-server-namesarray-List of allowed MCP server names

Examples:

codely --allowed-mcp-server-names server1,server2
codely --allowed-mcp-server-names server1 --allowed-mcp-server-names server2

Extension Options

ParameterShort FormTypeDefault ValueDescription
--extensions-earray-List of extensions to use. If not provided, all extensions will be used
--list-extensions-lbooleanfalseList all available extensions and exit

Examples:

# Use only specified extensions
codely --extensions github,jira

# List all available extensions
codely --list-extensions

Sandbox Options ** experimental **

ParameterShort FormTypeDefault ValueDescription
--sandbox-sboolean-Run in sandbox
--sandbox-image-string-Sandbox image URI

Examples:

codely --sandbox
codely --sandbox-image my-sandbox-image:latest

Feature Flags

ParameterTypeDefault ValueDescription
--checkpointing-cbooleanfalse
--experimental-acpbooleanfalseStart agent in ACP mode
--agentsbooleantrueEnable or disable agent system

Examples:

codely --checkpointing
codely --experimental-acp
codely --agents=false

Network and Proxy Options

ParameterTypeDefault ValueDescription
--proxystring-Proxy for Gemini client, format: schema://user:password@host:port

Examples:

codely --proxy http://user:pass@proxy.example.com:8080
codely --proxy socks5://127.0.0.1:1080

OpenAI Compatibility Options

ParameterTypeDefault ValueDescription
--openai-loggingboolean-Enable logging of OpenAI API calls for debugging and analysis
--openai-api-keystring-OpenAI API key for authentication
--openai-base-urlstring-OpenAI base URL (for custom endpoints)
--reasoning_effortstring-OpenAI reasoning_effort parameter (minimal|low|medium|high)
--enable_thinkingboolean-OpenAI compatible extension: set chat_template_kwargs.enable_thinking

Aliases: --reasoning_effort can be abbreviated as --reasoningEffort --enable_thinking can be abbreviated as --enableThinking

Examples:

codely --openai-api-key sk-xxx --openai-base-url https://api.openai.com/v1
codely --reasoning_effort high --enable_thinking

Web Search Options

ParameterTypeDefault ValueDescription
--tavily-api-keystring-Tavily API key for web search functionality
--searxng-urlstring-SearXNG instance URL for web search

Examples:

codely --tavily-api-key tvly-xxx
codely --searxng-url https://searx.example.com

Example Prompts and Tools Options

ParameterTypeDefault ValueDescription
--example-promptstring-Load and execute an example prompt from the example-prompts folder (non-interactive mode only)
--list-example-promptsbooleanfalseList all available example prompts
--list-toolsbooleanfalseList all available builtin tools
--exclude-toolsarray-Exclude specific tools for this session (doesn't modify settings)

Note: --example-prompt cannot be used with --prompt or --prompt-interactive simultaneously.

Examples:

# List all example prompts
codely --list-example-prompts

# Use example prompt
codely --example-prompt my-prompt

# List all tools
codely --list-tools

# Exclude specific tools
codely --exclude-tools shell,edit

Output Format Options

ParameterTypeDefault ValueDescription
--output-formatstringtextOutput format of response (text|json|stream-json)

Examples:

codely --output-format json
codely --output-format stream-json

General Options

ParameterShort FormDescription
--version-vShow version number and exit
--help-hDisplay help information

Subcommands

mcp command

Manage MCP servers to extend Tuanjie AI's functionality with external tools and services.

mcp add

Add a new MCP server.

codely mcp add <name> <commandOrUrl> [args...] [options]

Options:

ParameterShort FormTypeDefault ValueDescription
--scope-sstringprojectConfiguration scope (user or project)
--transport-tstringstdioTransport type (stdio|sse|http)
--env-earray-Set environment variables (e.g., -e KEY=value)
--header-Harray-Set HTTP headers for SSE and HTTP transports
--timeout-number-Set connection timeout (milliseconds)
--trust-boolean-Trust server (bypass all tool call confirmation prompts)
--description-string-Set description for server
--include-tools-array-List of tools to include (comma-separated)
--exclude-tools-array-List of tools to exclude (comma-separated)

Examples:

# Add stdio server
codely mcp add my-server python /path/to/server.py --env API_KEY=abc123 --env DEBUG=true

# Add HTTP server
codely mcp add my-http-server http://localhost:8000 --transport http --header "Authorization: Bearer token"

# Add server with tool filtering
codely mcp add my-server python /path/to/server.py --include-tools tool1,tool2 --exclude-tools dangerous-tool

# Add user-level configuration
codely mcp add my-server python /path/to/server.py --scope user --description "My personal tool server"

# Add trusted remote HTTP server
codely mcp add secure-server https://api.example.com/mcp --transport http --header "X-API-Key: abc123xyz" --trust

mcp remove

Remove the specified MCP server.

codely mcp remove <name> [options]

Options:

ParameterShort FormTypeDefault ValueDescription
--scope-sstringprojectConfiguration scope (user or project)

Examples:

# Remove project-level server
codely mcp remove my-server

# Remove user-level server
codely mcp remove my-server --scope user

mcp list

List all configured MCP servers and their connection status.

codely mcp list

Output example:

✓ my-server: python /path/to/server.py (stdio) - Connected
✗ http-server: http://localhost:8000 (http) - Disconnected

extensions command

Manage Codely CLI extensions. Fully compatible with https://geminicli.com/extensions/

extensions install

Install an extension from a git repository URL or local path.

codely extensions install <source> [options]

Positional arguments:

ParameterDescription
sourceGitHub URL (e.g., https://github.com/owner/repo or owner/repo), git URL, or local path to the extension

Options:

ParameterTypeDefault ValueDescription
--refstring-Git reference to install
--auto-updateboolean-Enable auto-update for this extension
--pre-releaseboolean-Enable pre-release versions for this extension
--consentbooleanfalseConfirm security risk of installing extension and skip confirmation prompt

Examples:

# Install from GitHub (full URL)
codely extensions install https://github.com/owner/repo

# Install from GitHub (shorthand)
codely extensions install owner/repo

# Specify branch or tag
codely extensions install https://github.com/owner/repo --ref main

# Enable auto-update
codely extensions install https://github.com/owner/repo --auto-update

# Install pre-release version
codely extensions install https://github.com/owner/repo --pre-release

# Install from local path
codely extensions install /path/to/local/extension

# Skip confirmation prompt
codely extensions install https://github.com/owner/repo --consent

extensions uninstall

Uninstall an installed extension.

codely extensions uninstall <name>

extensions list

List all installed extensions.

codely extensions list

extensions update

Update installed extensions.

codely extensions update [name]

If no name is specified, update all extensions.

extensions enable

Enable a disabled extension.

codely extensions enable <name>

extensions disable

Disable an installed extension.

codely extensions disable <name>

Link a local extension for development.

codely extensions link <name> <path>

extensions new

Create a new extension scaffold.

codely extensions new <name>

Environment Variables

In addition to command line arguments, Codely CLI also supports the following environment variables:

Environment VariableDescription
GEMINI_MODELDefault model to use
CODELY_MULTIMODALDefault multimodal model
CODELY_FLASH_MODELDefault Flash model
OPENAI_API_KEYOpenAI API key
OPENAI_BASE_URLOpenAI base URL
OPENAI_MODELOpenAI model name
TAVILY_API_KEYTavily API key
SEARXNG_URLSearXNG instance URL
HTTP_PROXY / http_proxyHTTP proxy
HTTPS_PROXY / https_proxyHTTPS proxy
OTEL_EXPORTER_OTLP_ENDPOINTOTLP export endpoint
DEBUG / DEBUG_MODEEnable debug mode (set to true or 1)
NO_BROWSERDisable browser functionality

Examples

Basic Usage

# Start interactive mode
codely

# Start with specified model
codely --model qwen-max

# Execute a single task in non-interactive mode
codely -p "Help me write a quick sort algorithm"

Advanced Usage

# YOLO mode + include all files
codely -y -a -p "Refactor the entire project"

# Enable telemetry and output to file
codely --telemetry --telemetry-outfile /tmp/telemetry.log

# Use only specific extensions
codely -e github,jira

# Use OpenAI compatible API
codely --openai-api-key sk-xxx --openai-base-url https://api.openai.com/v1 --model gpt-4

# Use web search
codely --tavily-api-key tvly-xxx -p "Search for latest AI news"

# JSON format output
codely --output-format json -p "Analyze this project's structure"

MCP Server Management

# Add stdio MCP server
codely mcp add filesystem node /path/to/mcp-filesystem-server/dist/index.js --env ALLOW_READ=/path/to/project

# Add HTTP MCP server
codely mcp add custom-tools http://localhost:3000 --transport http --header "Authorization: Bearer token"

# List all MCP servers
codely mcp list

# Remove MCP server
codely mcp remove filesystem

Extension Management

# Install extension
codely extensions install https://github.com/owner/my-extension

# Install and enable auto-update
codely extensions install https://github.com/owner/my-extension --auto-update

# List all extensions
codely extensions list

# Disable extension
codely extensions disable my-extension

# Update all extensions
codely extensions update

Unity Integration

# Start Unity MCP server (HTTP mode)
codely serve unity-mcp --http --unity-project-path /path/to/UnityProject

# Start Unity MCP server (stdio mode, for Claude Desktop)
codely serve unity-mcp --stdio --unity-project-path /path/to/UnityProject

# Enable debug mode
codely serve unity-mcp --http --unity-project-path /path/to/UnityProject --debug

Notes

Parameter Priority: Command line arguments take precedence over environment variables, and environment variables take precedence over configuration files.

Mutually Exclusive Parameters: Some parameters cannot be used simultaneously, such as --prompt and --prompt-interactive, --yolo and --approval-mode.

Deprecated Parameters: The following parameters are deprecated; use the new versions instead: --all_files → --all-files --show_memory_usage → --show-memory-usage

Sandbox Mode: When running in sandbox mode, file system access is restricted.

Telemetry: Use the --telemetry flag to enable telemetry; setting other --telemetry-* flags alone will not automatically enable telemetry.

MCP Servers: When adding MCP servers, if the URL starts with http:// or https://, it will be automatically detected as the HTTP transport type.