Commands
Open the CMD, PowerShell, or terminal and run codearts [command] to enter the CLI development mode of CodeArts Agent.
| Command | Description | Subcommand or Subparameter |
|---|---|---|
| codearts help | Views command help information. | None |
| codearts completion | Generates a shell autocomplete script. | None |
| codearts mcp | Manages the MCP server. | For details about subcommands, see MCP Commands. |
| codearts [project] | Starts the TUI development environment of a specified project. [project] is an optional parameter indicating the project name. For example, you can run the following command to enter the TUI development mode and load the Test project: codearts D:\Test | None |
| codearts run [message] | Runs CodeArts Agent CLI in non-interactive mode and directly inputs a prompt. For example, run the following command to read files in the current directory: codearts run read file | For details about the parameters supported by the codearts run command, see Table 2. |
| codearts agent | Manages agents. |
|
| codearts models [provider] | Lists available models.
| None |
| codearts stats | Queries token usage and cost statistics. | Run the following command to query all statistics: codearts stats For details about other subcommands, see Table 3. |
| codearts session | Manages sessions. |
|
| codearts export [sessionID] | Prints the data of the session with a specified ID in JSON format. You can obtain the sessionID by running the codearts session list command.
| None |
| codearts import <file> | Imports session data from a local JSON file. The <file> parameter is mandatory. For example, you can run the following command to import data from a specified file. The imported data includes the sessionID. codearts import session.json Application scenario: You can continue the session based on the generated sessionID. | None |
| codearts upgrade | Upgrades CodeArts Agent CLI to the latest version. | None |
| codearts uninstall | Uninstalls CodeArts Agent CLI and deletes all related files. | None |
| codearts docs | Obtains the help documentation URL of CodeArts Agent CLI. | None |
| codearts privacy | Queries the privacy policy of CodeArts Agent CLI. | None |
| codearts debug | Debugs issues. | For details about subcommands, see Table 7. |
| codearts --version | Prints the version. | None |
| codearts --print-logs | Prints logs to stderr. | None |
| codearts --log-level <Log level> | Sets the log level, which can be DEBUG, INFO, WARN, or ERROR. | None |
| codearts codebase | Manages repository indexes. | For the parameters supported by this command, see Table 3. |
| codearts serve | Starts a server without a GUI. Before running this command, run the following command in PowerShell, CMD, or the terminal to configure the username and password for the server. Otherwise, error message "Error: CODEARTS_SERVER_PASSWORD is not set; please configure the password to start the server." is displayed. export CODEARTS_SERVER_USERNAME="Username for logging in to the server" export CODEARTS_SERVER_PASSWORD="Password for logging in to the server" You need to set the username and password by yourself. | For the parameters supported by this command, see Table 10. |
| codearts attach <url> | Binds a local command line to a remote CodeArts Agent CLI instance using a username and a password. You can pass the username and password using environment variables or command line--password. | For the parameters supported by this command, see Table 11. |
| Flag | Description |
|---|---|
| codearts run --command |
|
| codearts run --continue | Continues the previous session. It can be abbreviated as -c. For example, you can run the following command to continue the previous session: codearts run --continue |
| codearts run "Command to be executed" --sessionID <sessionID> | Continues a session with a specified ID. It can be abbreviated as -s. For example, you can run the following command to continue the session with the specified ID: codearts run "What day is it today?" --sessionid ses_07885a8e7ffe8ESvH4zV1BdFJw In the preceding command, ses_07885a8e7ffe8ESvH4zV1BdFJw is the session ID. You can obtain it by running the codearts session list command. |
| codearts run --fork | Continues a fork session. |
| codearts run --model | Model to be used. It can be abbreviated as -m. |
| codearts run --agent | Agent to be used |
| codearts run --file | File to be attached to the message. It can be abbreviated as -f. |
| codearts run --format | Format, which can be default or json |
| codearts run --title | Session title |
| codearts run --thinking | Displays thinking blocks. |
| codearts run --attach | Connects to a running server. For example, you can run the following command to connect to a running CodeArts server whose URL is http://localhost:4096 and perform Q&A: codearts run --attach http://localhost:4096 --password 1***5 "hi" |
| codearts run --auto | Runs the Bash tool in automatic mode in the current session. |
| codearts run --sandbox | Runs the Bash tool in sandbox mode in the current session. |
| Command | Description |
|---|---|
| codearts stats --days | Displays statistics of the last N days.
|
| codearts stats --tools | Displays statistics of tools. |
| codearts stats --models | Displays usage details of all models. |
| codearts stats --project | Displays statistics of a project. Go to the root directory of the Git repository to be queried, right-click in the blank area, and select Open Windows Terminal here. Run the following command to query the statistics of the current project: codearts stats --project NOTE: If the target repository has no Git commit records, the system displays project data of all non-Git repositories. |
| Flag | Abbreviation | Description |
|---|---|---|
| --continue | -c | Enters the TUI development mode and continues the previous session. For example, you can run the following command to enter the D:\Test project and the TUI development mode to continue the session: codearts D:\Test -c |
| --session | -s | ID of the session to be continued. You can obtain the sessionID by running the codearts session list command. codearts D:\Test -s <sessionID> |
| --fork | - | Creates a fork session based on a specified session. The subcommands are as follows:
|
| --model | -m | Model to be used |
| --agent | - | Agent to be used |
| Flag | Abbreviation | Description |
|---|---|---|
| --max-count | -n | Maximum number of recent sessions |
| --format | - | Output format, which can be table or json |
| Flag | Abbreviation | Description |
|---|---|---|
| --keep-config | -c | Retains the configuration file. |
| --keep-data | -d | Retains session data. |
| --dry-run | - | Displays the content to be deleted. |
| --force | -f | Skips the confirmation prompt. |
| Commands | Description |
|---|---|
| codearts debug config | Definition: displays the complete configuration after parsing. Function: This command displays all configurations that have taken effect (including default values and environment variables) for troubleshooting configuration loading issues. |
| codearts debug rg | Definition: debugs the ripgrep code search tool. For details about subcommands, see Table 8. Function: This command is used to debug ripgrep-related behavior, such as searching for rules, ignoring files, and matching paths. |
| codearts debug file | Definition: debugs file systems. For details about subcommands, see Table 9. Function: This command is used to debug file-related issues, such as file reading/writing, path parsing, permissions, and symbolic links. |
| codearts debug scrap | Definition: lists all known projects. Function: This command helps developers learn the projects identified by CodeArts Agent CLI. |
| codearts debug skill | Definition: lists all available skills. Function: This command returns all the skills loaded in the current environment, including their names, descriptions, locations, and content. |
| codearts debug agent <name> | Definition: queries the configuration details of a specified agent. <name> is a mandatory parameter. Function: This command returns all configurations of an agent, including permissions, tools, model parameters, and prompts. It is used to debug abnormal agent behavior. |
| codearts debug paths | Definition: displays global paths. Function: This command returns core directories, including the data directory, configuration directory, cache directory, or status directory. It is used to troubleshoot issues such as missing files and permission issues. |
| codearts debug wait | Definition: waits indefinitely (for debugging). To exit, press the shortcut key (Windows: Ctrl+C; Mac: ⌘+C). Function: This command keeps a process running so that a debugger can be attached to the process for debugging. |
| Command | Description |
|---|---|
| codearts debug rg tree | Definition: displays the file directory tree using ripgrep. With this command, you can:
Typical use case: You can use this command when you suspect that project files were accidentally ignored and want to confirm the scanning scope of ripgrep. |
| codearts debug rg files | Definition: lists all files using ripgrep. With this command, you can:
Typical use case: You can use this command when you cannot find a file in CodeArts Agent CLI and want to check whether the file has been ignored by ripgrep. |
| codearts debug rg search <pattern> | Definition: searches for file content using ripgrep. With this command, you can:
Typical use case: When search results are missing or matching rules are abnormal, you can run this command if you want to use native ripgrep for comparison and verification. |
| Command | Description |
|---|---|
| codearts debug file read <path> | Definition: reads and outputs the content of a specified file in JSON format. With this command, you can:
|
| codearts debug file status | Definition: displays the status of a file system. With this command, you can:
|
| codearts debug file list <path> | Definition: lists all files and subdirectories in a specified directory of the current project. With this command, you can list files and subdirectories in a directory of a project. |
| codearts debug file search <query> | Definition: performs a fuzzy search for files in the current project by condition. With this command, you can quickly search for files that meet specified conditions. |
| codearts debug file tree [dir] | Definition: displays the tree structure of non-empty directories in a specified directory. This command displays the complete structure of a specified directory, allowing you to view levels of the directory. |
| Parameter | Description |
|---|---|
| --port | Server listening port. The default port is 4096. For example, you can run the following command to specify listening port 4096: codearts serve --port 4096 After the service is started, you can open a new window and run the codearts attach command to connect to the server. For details, see Table 1. |
| --hostname | Server listening address. The default value is 127.0.0.1. For example, you can run the following command to specify the server listening address 127.0.0.1: codearts serve --hostname 127.0.0.1 After the service is started, you can open a new window and run the codearts attach command to connect to the server. For details, see Table 1. |
| --mdns | Enables discovery of the mDNS services with zero configuration on the LAN. Devices on the same LAN as CodeArts Agent CLI can be automatically scanned and can access CodeArts Agent CLI. The IP address of the local host does not need to be manually specified. For example, you can run the following command to start CodeArts Agent CLI on port 4096 of the local host and enable discovery of mDNS services on the LAN. Devices on the same LAN can automatically scan the current service and access the web management page and MCP interfaces using the .local domain name without the host IP address. codearts serve --port 4096 --mdns |
| --mdns-domain | This parameter must be used together with --mdns. It specifies the custom host name prefix of the mDNS LAN. The default value is codearts.local. If you do not specify --mdns-domain, the system uses the codearts prefix and combines it with the fixed mDNS suffix .local to generate the LAN domain name codearts.local. For example, the following command uses the default domain name codearts.local. The access address is http://codearts.local:4096. codearts serve --port 4096 --mdns The following command uses manually specified --mdns-domain to overwrite the default value. The domain name is dev-server.local, and the access address is http://dev-server.local:4096. codearts serve --port 4096 --mdns --mdns-domain dev-server |
| --cors <origin> | Addresses of external web pages that have permissions to access the service. If * is passed, all web pages can access the service. This is used for local development and debugging. If this parameter is not set, only pages of the service can call APIs. External web pages will be blocked by the browser. For example, you can run the following command to allow the local frontend page running on http://localhost:5173 to request APIs through port 4096: codearts serve --port 4096 --cors http://localhost:5173 You can run the following command to allow access from multiple sources: codearts serve --port 4096 \ --cors http://localhost:5173 \ --cors http://127.0.0.1:3000 You can run the following command to allow access from all sources. This command is used only for local debugging. It may pose security risks and is not recommended for the production environment. codearts serve --port 4096 --cors * |
| Parameter | Description |
|---|---|
| <url> | You can run this command to connect to a running server. You can perform the following steps to connect to a running server:
|
| -p,--password | Server password |
| -c,--continue | Continues the last session. |
| -s,--session | Session ID |
| --fork | Fork session, which is used together with --continue or --session. |
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot