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
Model-related Options
| Parameter | Short Form | Type | Default Value | Description |
|---|---|---|---|---|
| --model | -m | string | GEMINI_MODEL environment variable | Specify the primary model to use |
| --multimodal | - | string | CODELY_MULTIMODAL environment variable | Multimodal model for image/video analysis |
| --flash | - | string | CODELY_FLASH_MODEL environment variable | Flash model for internal operations (as fallback target) |
Examples:
codely --model qwen-max
codely --multimodal qwen-vl-max
codely --flash qwen-turbo
Interactive Mode Options
| Parameter | Short Form | Type | Default Value | Description |
|---|---|---|---|---|
| --prompt | -p | string | - | Provide a prompt (non-interactive mode). If stdin input is also provided, it will be appended to the input |
| --prompt-interactive | -i | string | - | 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
| Parameter | Short Form | Type | Default Value | Description |
|---|---|---|---|---|
| --all-files | -a | boolean | false | Include 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
| Parameter | Short Form | Type | Default Value | Description |
|---|---|---|---|---|
| --yolo | -y | boolean | false | Automatically accept all operations (YOLO mode) |
| --approval-mode | - | string | default | Set 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
| Parameter | Short Form | Type | Default Value | Description |
|---|---|---|---|---|
| --debug | -d | boolean | false | Run in debug mode |
| --show-memory-usage | - | boolean | false | Display memory usage in status bar |
Deprecated: --show_memory_usage (use --show-memory-usage instead)
Examples:
codely --debug
codely --show-memory-usage
MCP Server Options
| Parameter | Type | Default Value | Description |
|---|---|---|---|
| --allowed-mcp-server-names | array | - | 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
| Parameter | Short Form | Type | Default Value | Description |
|---|---|---|---|---|
| --extensions | -e | array | - | List of extensions to use. If not provided, all extensions will be used |
| --list-extensions | -l | boolean | false | List all available extensions and exit |
Examples:
# Use only specified extensions
codely --extensions github,jira
# List all available extensions
codely --list-extensions
Sandbox Options ** experimental **
| Parameter | Short Form | Type | Default Value | Description |
|---|---|---|---|---|
| --sandbox | -s | boolean | - | Run in sandbox |
| --sandbox-image | - | string | - | Sandbox image URI |
Examples:
codely --sandbox
codely --sandbox-image my-sandbox-image:latest
Feature Flags
| Parameter | Type | Default Value | Description |
|---|---|---|---|
| --checkpointing | -c | boolean | false |
| --experimental-acp | boolean | false | Start agent in ACP mode |
| --agents | boolean | true | Enable or disable agent system |
Examples:
codely --checkpointing
codely --experimental-acp
codely --agents=false
Network and Proxy Options
| Parameter | Type | Default Value | Description |
|---|---|---|---|
| --proxy | string | - | 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
| Parameter | Type | Default Value | Description |
|---|---|---|---|
| --openai-logging | boolean | - | Enable logging of OpenAI API calls for debugging and analysis |
| --openai-api-key | string | - | OpenAI API key for authentication |
| --openai-base-url | string | - | OpenAI base URL (for custom endpoints) |
| --reasoning_effort | string | - | OpenAI reasoning_effort parameter (minimal|low|medium|high) |
| --enable_thinking | boolean | - | 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
| Parameter | Type | Default Value | Description |
|---|---|---|---|
| --tavily-api-key | string | - | Tavily API key for web search functionality |
| --searxng-url | string | - | 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
| Parameter | Type | Default Value | Description |
|---|---|---|---|
| --example-prompt | string | - | Load and execute an example prompt from the example-prompts folder (non-interactive mode only) |
| --list-example-prompts | boolean | false | List all available example prompts |
| --list-tools | boolean | false | List all available builtin tools |
| --exclude-tools | array | - | 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
| Parameter | Type | Default Value | Description |
|---|---|---|---|
| --output-format | string | text | Output format of response (text|json|stream-json) |
Examples:
codely --output-format json
codely --output-format stream-json
General Options
| Parameter | Short Form | Description |
|---|---|---|
| --version | -v | Show version number and exit |
| --help | -h | Display 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:
| Parameter | Short Form | Type | Default Value | Description |
|---|---|---|---|---|
| --scope | -s | string | project | Configuration scope (user or project) |
| --transport | -t | string | stdio | Transport type (stdio|sse|http) |
| --env | -e | array | - | Set environment variables (e.g., -e KEY=value) |
| --header | -H | array | - | 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:
| Parameter | Short Form | Type | Default Value | Description |
|---|---|---|---|---|
| --scope | -s | string | project | Configuration 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:
| Parameter | Description |
|---|---|
| source | GitHub URL (e.g., https://github.com/owner/repo or owner/repo), git URL, or local path to the extension |
Options:
| Parameter | Type | Default Value | Description |
|---|---|---|---|
| --ref | string | - | Git reference to install |
| --auto-update | boolean | - | Enable auto-update for this extension |
| --pre-release | boolean | - | Enable pre-release versions for this extension |
| --consent | boolean | false | Confirm 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>
extensions link
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 Variable | Description |
|---|---|
| GEMINI_MODEL | Default model to use |
| CODELY_MULTIMODAL | Default multimodal model |
| CODELY_FLASH_MODEL | Default Flash model |
| OPENAI_API_KEY | OpenAI API key |
| OPENAI_BASE_URL | OpenAI base URL |
| OPENAI_MODEL | OpenAI model name |
| TAVILY_API_KEY | Tavily API key |
| SEARXNG_URL | SearXNG instance URL |
| HTTP_PROXY / http_proxy | HTTP proxy |
| HTTPS_PROXY / https_proxy | HTTPS proxy |
| OTEL_EXPORTER_OTLP_ENDPOINT | OTLP export endpoint |
| DEBUG / DEBUG_MODE | Enable debug mode (set to true or 1) |
| NO_BROWSER | Disable 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.