### Build and Install CLI Locally Source: https://github.com/zoo-code-org/zoo-code/blob/main/apps/cli/README.md Build the CLI tarball and then install it locally on your system. This allows you to test the installed CLI version. ```bash # Build and install locally ./apps/cli/scripts/build.sh --install ``` -------------------------------- ### IPC Client Usage Example Source: https://github.com/zoo-code-org/zoo-code/blob/main/packages/ipc/README.md Demonstrates how to use the IpcClient to send commands to the Roo Code extension. This includes resuming an existing task and starting a new task with configuration and initial message. ```typescript import { IpcClient } from "@roo-code/ipc" const client = new IpcClient("/path/to/socket") // Resume a task client.sendCommand({ commandName: "ResumeTask", data: "task-123", }) // Start a new task client.sendCommand({ commandName: "StartNewTask", data: { configuration: { /* RooCode settings */ }, text: "Hello, world!", images: [], newTab: false, }, }) ``` -------------------------------- ### Install Project Dependencies Source: https://github.com/zoo-code-org/zoo-code/blob/main/CONTRIBUTING.md After cloning the repository, install all necessary project dependencies using pnpm. This command ensures your development environment is set up correctly. ```bash pnpm install ``` -------------------------------- ### Development Installation Source: https://github.com/zoo-code-org/zoo-code/blob/main/apps/cli/README.md Installs dependencies and builds the Roo Code CLI from the monorepo for development purposes. ```bash # From the monorepo root. pnpm install # Build the main extension first. pnpm --filter ./src bundle # Build the CLI. pnpm --filter @roo-code/cli build ``` -------------------------------- ### StartNewTask Source: https://github.com/zoo-code-org/zoo-code/blob/main/packages/ipc/README.md Starts a new task with optional configuration and initial message. This command allows for the initiation of new tasks, providing initial data and settings. ```APIDOC ## StartNewTask ### Description Starts a new task with optional configuration and initial message. ### Parameters - **configuration** (object) - Required - RooCode settings object - **text** (string) - Required - Initial task message - **images** (array) - Optional - Array of image data URIs - **newTab** (boolean) - Optional - Whether to open in a new tab ``` -------------------------------- ### Quick Install Roo Code CLI Source: https://github.com/zoo-code-org/zoo-code/blob/main/apps/cli/README.md Installs the Roo Code CLI using a curl command. Ensure Node.js 20+ is installed. ```bash curl -fsSL https://raw.githubusercontent.com/RooCodeInc/Roo-Code/main/apps/cli/install.sh | sh ``` -------------------------------- ### Custom Installation Directory Source: https://github.com/zoo-code-org/zoo-code/blob/main/apps/cli/README.md Installs the Roo Code CLI to a custom directory using environment variables. ```bash ROO_INSTALL_DIR=/opt/roo-code ROO_BIN_DIR=/usr/local/bin curl -fsSL ... | sh ``` -------------------------------- ### Manual VSIX Installation via CLI Source: https://github.com/zoo-code-org/zoo-code/blob/main/README.md Install a manually built VSIX package using the VSCode command-line interface. Replace with the actual version number. ```sh code --install-extension bin/zoo-code-.vsix ``` -------------------------------- ### Automated VSIX Installation Source: https://github.com/zoo-code-org/zoo-code/blob/main/README.md Build and install the Zoo Code extension as a VSIX package automatically. This command handles uninstallation, building, and installation, prompting for editor selection by default. ```sh pnpm install:vsix [-y] [--editor=] ``` -------------------------------- ### Example Debug Log Output Source: https://github.com/zoo-code-org/zoo-code/blob/main/apps/cli/docs/AGENT_LOOP.md This is an example of the log output you might see when debug logging is enabled. It shows state transitions and message processing. ```text [MessageProcessor] State update: { "messageCount": 5, "lastMessage": { "msgType": "ask:completion_result" }, "stateTransition": "running → idle", "currentAsk": "completion_result", "isWaitingForInput": true } [MessageProcessor] EMIT waitingForInput: { "ask": "completion_result" } [MessageProcessor] EMIT taskCompleted: { "success": true } ``` -------------------------------- ### Install Specific Version Source: https://github.com/zoo-code-org/zoo-code/blob/main/apps/cli/README.md Installs a specific version of the Roo Code CLI by setting the ROO_VERSION environment variable. ```bash ROO_VERSION=0.1.0 curl -fsSL https://raw.githubusercontent.com/RooCodeInc/Roo-Code/main/apps/cli/install.sh | sh ``` -------------------------------- ### Multi-turn Test Fixture Example Source: https://github.com/zoo-code-org/zoo-code/blob/main/apps/vscode-e2e/AGENTS.md This JSON fixture demonstrates a two-turn test. The first turn matches a user message and responds with a tool call. The second turn matches the tool call ID and responds with an attempt completion. ```json { "fixtures": [ { "match": { "userMessage": "my-e2e-tag:my-test", "sequenceIndex": 0 }, "response": { "toolCalls": [{ "name": "read_file", "arguments": "{\"path\":\"marker.txt\"}", "id": "call_my_read" }] } }, { "match": { "toolCallId": "call_my_read" }, "response": { "toolCalls": [ { "name": "attempt_completion", "arguments": "{\"result\":\"MY_MARKER\"}", "id": "call_my_done" } ] } } ] } ``` -------------------------------- ### Build VSIX Package Manually Source: https://github.com/zoo-code-org/zoo-code/blob/main/README.md Generate the VSIX package for manual installation. This command creates a .vsix file in the bin/ directory. ```sh pnpm vsix ``` -------------------------------- ### Run Roo Code CLI in Stdin Stream Mode Source: https://github.com/zoo-code-org/zoo-code/blob/main/apps/cli/README.md Enables programmatic control by streaming NDJSON commands via stdin, used with --print. Supports specifying a taskId per start command. ```bash printf '{"command":"start","requestId":"1","prompt":"1+1=?"}\n' | roo --print --stdin-prompt-stream --output-format stream-json ``` ```bash # Optional: provide taskId per start command printf '{"command":"start","requestId":"1","taskId":"018f7fc8-7c96-7f7c-98aa-2ec4ff7f6d87","prompt":"1+1=?"}\n' | roo --print --stdin-prompt-stream --output-format stream-json ``` -------------------------------- ### Uninstall Roo Code CLI Source: https://github.com/zoo-code-org/zoo-code/blob/main/apps/cli/README.md Removes the Roo Code CLI installation files from the system. ```bash rm -rf ~/.roo/cli ~/.local/bin/roo ``` -------------------------------- ### Agent Response Messages Source: https://github.com/zoo-code-org/zoo-code/blob/main/apps/cli/docs/AGENT_LOOP.md Send these messages to control the agent's behavior, such as approving/rejecting actions, answering questions, starting new tasks, or canceling current tasks. ```typescript // Approve an action (tool, command, browser, MCP) client.sendMessage({ type: "askResponse", askResponse: "yesButtonClicked", }) ``` ```typescript // Reject an action client.sendMessage({ type: "askResponse", askResponse: "noButtonClicked", }) ``` ```typescript // Answer a question client.sendMessage({ type: "askResponse", askResponse: "messageResponse", text: "My answer here", }) ``` ```typescript // Start a new task client.sendMessage({ type: "newTask", text: "Build a web app", }) ``` ```typescript // Cancel current task client.sendMessage({ type: "cancelTask", }) ``` -------------------------------- ### Run CLI Directly from Source Source: https://github.com/zoo-code-org/zoo-code/blob/main/apps/cli/README.md Execute the CLI using pnpm dev, specifying the provider and API key. Useful for quick development cycles without a full build. ```bash # Run directly from source (no build required) pnpm dev --provider openrouter --api-key $OPENROUTER_API_KEY --print "Hello" ``` -------------------------------- ### Initialize and Use ExtensionClient Source: https://github.com/zoo-code-org/zoo-code/blob/main/apps/cli/docs/AGENT_LOOP.md Instantiate the ExtensionClient to manage agent state and communicate with the extension. You can query the agent's state and current mode, and subscribe to state and mode change events. ```typescript const client = new ExtensionClient({ ssendMessage: (msg) => extensionHost.sendToExtension(msg), debug: true, // Writes to ~/.roo/cli-debug.log }) // Query state at any time const state = client.getAgentState() if (state.isWaitingForInput) { console.log(`Agent needs: ${state.currentAsk}`) } // Query current mode const mode = client.getCurrentMode() console.log(`Current mode: ${mode}`) // e.g., "code", "architect", "ask" // Subscribe to events client.on("waitingForInput", (event) => { console.log(`Waiting for: ${event.ask}`) }) // Subscribe to mode changes client.on("modeChanged", (event) => { console.log(`Mode changed: ${event.previousMode} -> ${event.currentMode}`) }) ``` -------------------------------- ### Verify xAI Grok Fixtures in Mock Mode Source: https://github.com/zoo-code-org/zoo-code/blob/main/apps/vscode-e2e/AGENTS.md Run this command to verify recorded xAI fixtures without hitting the real API. No API key is needed. This uses the `fixtures/xai.json` for responses. ```sh TEST_FILE=xai.test pnpm --filter @roo-code/vscode-e2e test:ci:mock ``` -------------------------------- ### Create a Named Fixture File Source: https://github.com/zoo-code-org/zoo-code/blob/main/apps/vscode-e2e/AGENTS.md Define a named fixture file with a short, stable match string and the expected LLM response. Ensure the match string does not contain timestamps or environment details. ```json { "fixtures": [ { "match": { "userMessage": "your unique prompt text" }, "response": { "toolCalls": [ { "name": "attempt_completion", "arguments": "{\"result\":\"...\"}", "id": "call_001" } ] } } ] } ``` -------------------------------- ### Fast Local CLI Build Source: https://github.com/zoo-code-org/zoo-code/blob/main/apps/cli/README.md Perform a quick build of the CLI tarball, skipping the verification step. Use this for faster iteration during development when verification is not critical. ```bash # Fast build (skip verification) ./apps/cli/scripts/build.sh --skip-verify ``` -------------------------------- ### Clone the Zoo-Code Repository Source: https://github.com/zoo-code-org/zoo-code/blob/main/CONTRIBUTING.md Clone the main repository to your local machine to begin development. Ensure you replace YOUR_USERNAME with your GitHub username. ```bash git clone https://github.com/YOUR_USERNAME/Zoo-Code.git ``` -------------------------------- ### Override Backend URL for Local Development Source: https://github.com/zoo-code-org/zoo-code/blob/main/apps/cli/README.md Run the CLI in development mode while pointing the backend URL to production. This is useful for testing against the live API. ```bash ROO_CODE_PROVIDER_URL=https://api.roocode.com/proxy pnpm dev --provider openrouter --api-key $OPENROUTER_API_KEY --print "Hello" ``` -------------------------------- ### Configure Extension Dependencies Source: https://github.com/zoo-code-org/zoo-code/blob/main/packages/types/npm/README.md Add the Zoo Code extension to your extension's `extensionDependencies` in `package.json` to ensure it is activated before your extension. ```json "extensionDependencies": ["ZooCodeOrganization.zoo-code"] ``` -------------------------------- ### Run CLI Tests Source: https://github.com/zoo-code-org/zoo-code/blob/main/apps/cli/README.md Execute the test suite for the CLI application using pnpm test. ```bash # Run tests pnpm test ``` -------------------------------- ### Verify Tests in Mock Mode Source: https://github.com/zoo-code-org/zoo-code/blob/main/apps/vscode-e2e/AGENTS.md Run E2E tests in mock mode without needing an API key to verify that fixtures are correctly set up and replayed. ```sh pnpm --filter @roo-code/vscode-e2e test:ci:mock ``` -------------------------------- ### Verify DeepSeek V4 Fixtures in Mock Mode Source: https://github.com/zoo-code-org/zoo-code/blob/main/apps/vscode-e2e/AGENTS.md Verify DeepSeek V4 fixtures using aimock. Set `USE_MOCK=true` to ensure responses come from fixtures. No API key is needed for this verification step. ```sh USE_MOCK=true TEST_FILE=deepseek-v4.test pnpm --filter @roo-code/vscode-e2e test:run ``` -------------------------------- ### Record xAI Grok Fixtures Source: https://github.com/zoo-code-org/zoo-code/blob/main/apps/vscode-e2e/AGENTS.md Use this command to record SSE events from the real xAI API. Ensure you have an XAI_API_KEY set. This populates the gitignored `fixtures/xai.json` file. ```sh XAI_API_KEY= XAI_RECORD=true TEST_FILE=providers/xai.test.js pnpm --filter @roo-code/vscode-e2e test:run ``` -------------------------------- ### CLI Architecture Diagram Source: https://github.com/zoo-code-org/zoo-code/blob/main/apps/cli/README.md A visual representation of the Zoo CLI's internal architecture, showing the flow from the CLI entry point to the ExtensionHost and its interaction with VSCode and the Extension Bundle. ```text ┌─────────────────┐ │ CLI Entry │ │ (index.ts) │ └────────┬────────┘ │ ▼ ┌─────────────────┐ │ ExtensionHost │ │ (extension- │ │ host.ts) │ └────────┬────────┘ │ ┌────┴────┐ │ │ ▼ ▼ ┌───────┐ ┌──────────┐ │vscode │ │Extension │ │-shim │ │ Bundle │ └───────┘ └──────────┘ ``` -------------------------------- ### Record Fixtures with OpenRouter Source: https://github.com/zoo-code-org/zoo-code/blob/main/apps/vscode-e2e/AGENTS.md Record E2E test fixtures using an OpenRouter API key. This command filters the recording to a specific test file to avoid re-recording unrelated tests. ```sh OPENROUTER_API_KEY= pnpm --filter @roo-code/vscode-e2e test:record ``` -------------------------------- ### Lint CLI Code Source: https://github.com/zoo-code-org/zoo-code/blob/main/apps/cli/README.md Apply linting rules to the CLI codebase using pnpm lint. ```bash # Linting pnpm lint ``` -------------------------------- ### Record Fixtures for a Specific Test File Source: https://github.com/zoo-code-org/zoo-code/blob/main/apps/vscode-e2e/AGENTS.md Record fixtures for a single test file by specifying the TEST_FILE environment variable. This helps to isolate recording to the relevant tests. ```sh OPENROUTER_API_KEY= TEST_FILE=my-feature.test.js pnpm --filter @roo-code/vscode-e2e test:record ``` -------------------------------- ### CloseTask Source: https://github.com/zoo-code-org/zoo-code/blob/main/packages/ipc/README.md Closes a task and performs cleanup. This command is used to terminate a task and execute any necessary cleanup procedures. ```APIDOC ## CloseTask ### Description Closes a task and performs cleanup. ### Parameters - **data** (string) - Required - Task ID to close ``` -------------------------------- ### Record DeepSeek V4 Fixtures Source: https://github.com/zoo-code-org/zoo-code/blob/main/apps/vscode-e2e/AGENTS.md Record fixtures for DeepSeek V4 by proxying OpenAI-compatible traffic through aimock. Ensure you have a DEEPSEEK_API_KEY set. This generates `openai-*.json` files that should be converted to stable named fixtures. ```sh DEEPSEEK_API_KEY= TEST_FILE=deepseek-v4.test pnpm --filter @roo-code/vscode-e2e test:record ``` -------------------------------- ### Run Roo Code CLI in Print Mode Source: https://github.com/zoo-code-org/zoo-code/blob/main/apps/cli/README.md Executes the Roo Code CLI for non-interactive, machine-readable output. A prompt is required. ```bash # Prompt is required roo --print "Summarize this repository" ``` ```bash # Create a new task with a specific session ID (UUID) roo --print --create-with-session-id 018f7fc8-7c96-7f7c-98aa-2ec4ff7f6d87 "Summarize this repository" ``` -------------------------------- ### Record Fixtures with Anthropic Provider Source: https://github.com/zoo-code-org/zoo-code/blob/main/apps/vscode-e2e/AGENTS.md Record fixtures for tests that use the Anthropic provider directly. Both OpenRouter and Anthropic API keys are required, and the test file can be specified. ```sh OPENROUTER_API_KEY= ANTHROPIC_API_KEY= TEST_FILE=my-anthropic-test.test.js pnpm --filter @roo-code/vscode-e2e test:record ``` -------------------------------- ### Gemini Mock Mode Test Command Source: https://github.com/zoo-code-org/zoo-code/blob/main/apps/vscode-e2e/AGENTS.md Command to verify Gemini tests in mock mode. This does not require a key and uses the recorded fixtures. ```sh TEST_FILE=providers/gemini.test pnpm --filter @roo-code/vscode-e2e test:ci:mock ``` -------------------------------- ### Z.ai GLM Test Commands Source: https://github.com/zoo-code-org/zoo-code/blob/main/apps/vscode-e2e/AGENTS.md Commands to run Z.ai GLM tests. The default mode uses a fetch interceptor. To bypass the interceptor and hit the real API, set the ZAI_API_KEY environment variable. ```sh # Mock mode (default — no key needed, interceptor active) pnpm --filter @roo-code/vscode-e2e test:ci:mock ``` ```sh # Live mode — bypasses interceptor, calls real Z.ai API ZAI_API_KEY= TEST_FILE=zai.test pnpm --filter @roo-code/vscode-e2e test:ci ``` -------------------------------- ### Build CLI Tarball for Current Platform Source: https://github.com/zoo-code-org/zoo-code/blob/main/apps/cli/README.md Generate a platform-specific tarball of the CLI application using the local build script. This is useful for testing builds outside of the CI environment. ```bash # Build tarball for your current platform ./apps/cli/scripts/build.sh ``` -------------------------------- ### Find Auto-Recorded Fixture File Source: https://github.com/zoo-code-org/zoo-code/blob/main/apps/vscode-e2e/AGENTS.md Search for the auto-recorded fixture file corresponding to your test by using grep with a unique text string from your prompt. ```sh grep -l "your unique prompt text" apps/vscode-e2e/fixtures/openai-*.json ``` -------------------------------- ### Clean Stale Fixture Files Source: https://github.com/zoo-code-org/zoo-code/blob/main/apps/vscode-e2e/AGENTS.md Use this command to remove any old auto-recorded fixture files before recording new ones. The -x flag is necessary to clean gitignored files. ```sh git clean -fx apps/vscode-e2e/fixtures/ ``` -------------------------------- ### Configure Non-Default Anthropic Provider Source: https://github.com/zoo-code-org/zoo-code/blob/main/apps/vscode-e2e/AGENTS.md Use this configuration when your tests call `api.setConfiguration` with `apiProvider: "anthropic"`. Ensure `anthropicBaseUrl` is provided to point aimock at the Anthropic endpoint. Remember to restore the default OpenRouter config in `suiteTeardown`. ```typescript await api.setConfiguration({ apiProvider: "anthropic" as const, apiKey: aimockUrl && !isRecord ? "mock-key" : process.env.ANTHROPIC_API_KEY!, apiModelId: "claude-opus-4-7", ...(aimockUrl && { anthropicBaseUrl: aimockUrl }), }) ``` -------------------------------- ### Run Roo Code CLI in Approval-Required Mode Source: https://github.com/zoo-code-org/zoo-code/blob/main/apps/cli/README.md Executes the Roo Code CLI requiring manual approval for tools, commands, browser, and MCP actions. ```bash roo "Refactor the utils.ts file" --require-approval -w ~/Documents/my-project ``` -------------------------------- ### Clone Zoo Code Repository Source: https://github.com/zoo-code-org/zoo-code/blob/main/README.md Use this command to clone the Zoo Code repository from GitHub to your local machine. ```sh git clone https://github.com/Zoo-Code-Org/Zoo-Code.git ``` -------------------------------- ### Enable and View Debug Logging Source: https://github.com/zoo-code-org/zoo-code/blob/main/apps/cli/docs/AGENT_LOOP.md Enable debug logging for the CLI using the '-d' flag. Logs are stored in '~/.roo/cli-debug.log' and can be monitored in real-time. ```bash roo -d -P "Build something" --no-tui ``` ```bash tail -f ~/.roo/cli-debug.log ``` -------------------------------- ### Perform CLI Type Checking Source: https://github.com/zoo-code-org/zoo-code/blob/main/apps/cli/README.md Check the TypeScript types of the CLI project using pnpm check-types. ```bash # Type checking pnpm check-types ``` -------------------------------- ### Gemini Record Mode Test Command Source: https://github.com/zoo-code-org/zoo-code/blob/main/apps/vscode-e2e/AGENTS.md Command to record fixtures for Gemini tests. This requires a GEMINI_API_KEY and will proxy to the real Gemini API. After recording, inspect and extract response blocks into fixtures/gemini.json. ```sh GEMINI_API_KEY= TEST_FILE=providers/gemini.test pnpm --filter @roo-code/vscode-e2e test:record ``` -------------------------------- ### Add Programmatic Fixture with RegExp Match Source: https://github.com/zoo-code-org/zoo-code/blob/main/apps/vscode-e2e/AGENTS.md Add programmatic fixtures in `src/runTest.ts` using `mock.addFixture()` with a `RegExp` match for requests that cannot be matched by a stable substring. These fixtures are only available in replay mode and are not recorded. ```typescript mock.addFixture() ``` -------------------------------- ### Run Roo Code CLI in Interactive Mode Source: https://github.com/zoo-code-org/zoo-code/blob/main/apps/cli/README.md Executes the Roo Code CLI in interactive TUI mode with auto-approval for actions and commands. Requires OPENROUTER_API_KEY to be set. ```bash export OPENROUTER_API_KEY=sk-or-v1-... roo "What is this project?" -w ~/Documents/my-project ``` ```bash roo -w ~/Documents/my-project ``` -------------------------------- ### API Methods Source: https://github.com/zoo-code-org/zoo-code/blob/main/packages/types/npm/README.md This section details the methods available in the Zoo Code API for interacting with the extension. ```APIDOC ## API Methods ### Description This section details the methods available in the Zoo Code API for interacting with the extension. ### Methods - **startNewTask**(message: string, images?: string[]): Promise - Description: Starts a new task with an optional initial message and a list of images. - Parameters: - `message` (string) - Required - The initial message for the new task. - `images` (string[]) - Optional - A list of image URIs to include with the task. - **sendMessage**(message: string): Promise - Description: Sends a message to the current task. - Parameters: - `message` (string) - Required - The message to send. - **pressPrimaryButton**(): Promise - Description: Simulates pressing the primary button in the chat interface (e.g., 'Save' or 'Proceed While Running'). - **pressSecondaryButton**(): Promise - Description: Simulates pressing the secondary button in the chat interface (e.g., 'Reject'). ``` -------------------------------- ### VS Code E2E Agent Test Commands Source: https://github.com/zoo-code-org/zoo-code/blob/main/apps/vscode-e2e/AGENTS.md These commands are used to run end-to-end tests for the VS Code agent in different modes: replay, record, and live API. ```sh pnpm --filter @roo-code/vscode-e2e test:ci:mock ``` ```sh OPENROUTER_API_KEY= pnpm --filter @roo-code/vscode-e2e test:record ``` ```sh OPENROUTER_API_KEY= pnpm --filter @roo-code/vscode-e2e test:ci ``` -------------------------------- ### StateStore Interface Definition Source: https://github.com/zoo-code-org/zoo-code/blob/main/apps/cli/docs/AGENT_LOOP.md Defines the structure for storing the agent's state, including messages, computed state information, initialization status, and the current mode. ```typescript interface StoreState { messages: ClineMessage[] // The raw message array agentState: AgentStateInfo // Computed state isInitialized: boolean // Have we received any state? currentMode: string | undefined // Current mode (e.g., "code", "architect") } ``` -------------------------------- ### ResumeTask Source: https://github.com/zoo-code-org/zoo-code/blob/main/packages/ipc/README.md Resumes a task from history. This command allows for the continuation of a previously executed task by referencing its ID. ```APIDOC ## ResumeTask ### Description Resumes a task from history. ### Parameters - **data** (string) - Required - Task ID to resume ``` -------------------------------- ### Import and Use Zoo Code API Source: https://github.com/zoo-code-org/zoo-code/blob/main/packages/types/npm/README.md Import the RooCodeAPI type and load the Zoo Code extension to access its functionalities. Ensure the extension is active before using the API. ```typescript import { RooCodeAPI } from "@roo-code/types" const extension = vscode.extensions.getExtension("ZooCodeOrganization.zoo-code") if (!extension?.isActive) { throw new Error("Extension is not activated") } const api = extension.exports if (!api) { throw new Error("API is not available") } // Start a new task with an initial message. await api.startNewTask("Hello, Zoo Code API! Let's make a new project...") // Start a new task with an initial message and images. await api.startNewTask("Use this design language", ["data:image/webp;base64,..."]) // Send a message to the current task. await api.sendMessage("Can you fix the @problems?") // Simulate pressing the primary button in the chat interface (e.g. 'Save' or 'Proceed While Running'). await api.pressPrimaryButton() // Simulate pressing the secondary button in the chat interface (e.g. 'Reject'). await api.pressSecondaryButton() ``` -------------------------------- ### Upgrade Roo Code CLI Source: https://github.com/zoo-code-org/zoo-code/blob/main/apps/cli/README.md Upgrades the Roo Code CLI using the built-in upgrade command. ```bash roo upgrade ``` -------------------------------- ### Check Legacy Roo Auth Token Status Source: https://github.com/zoo-code-org/zoo-code/blob/main/apps/cli/README.md Checks if a legacy Roo auth token is stored on the system. ```bash roo auth status ``` -------------------------------- ### Type Guards for Message Categorization Source: https://github.com/zoo-code-org/zoo-code/blob/main/apps/cli/docs/AGENT_LOOP.md Utilize type guards from '@roo-code/types' to categorize incoming agent messages. This helps in determining the state and required action for the agent. ```typescript import { isIdleAsk, isInteractiveAsk, isResumableAsk, isNonBlockingAsk } from "@roo-code/types" const ask = message.ask if (isInteractiveAsk(ask)) { // Needs approval: tool, command, followup, etc. } else if (isIdleAsk(ask)) { // Task stopped: completion_result, api_req_failed, etc. } else if (isResumableAsk(ask)) { // Task paused: resume_task } else if (isNonBlockingAsk(ask)) { // Command running: command_output } ``` -------------------------------- ### Streaming Detection Logic Source: https://github.com/zoo-code-org/zoo-code/blob/main/apps/cli/docs/AGENT_LOOP.md This pseudocode function determines if the agent is currently streaming a response. It checks for a `partial: true` flag on the last message or an incomplete API request indicated by `cost: undefined`. ```typescript function isStreaming(messages) { const lastMessage = messages.at(-1) // Check partial flag (primary indicator) if (lastMessage?.partial === true) { return true } // Check for in-progress API request const apiReq = messages.findLast((m) => m.say === "api_req_started") if (apiReq?.text) { const data = JSON.parse(apiReq.text) if (data.cost === undefined) { return true // API request not yet complete } } return false } ``` -------------------------------- ### ClineMessage Interface Definition Source: https://github.com/zoo-code-org/zoo-code/blob/main/apps/cli/docs/AGENT_LOOP.md Defines the structure of messages exchanged between the agent and the client, including timestamp, type, and content details. ```typescript interface ClineMessage { ts: number // Unique timestamp identifier type: "ask" | "say" // Message category ask?: ClineAsk // Specific ask type (when type="ask") say?: ClineSay // Specific say type (when type="say") text?: string // Message content partial?: boolean // Is this message still streaming? } ``` -------------------------------- ### Remove Legacy Roo Auth Token Source: https://github.com/zoo-code-org/zoo-code/blob/main/apps/cli/README.md Logs out and removes any old stored Roo auth token from the system. ```bash roo auth logout ``` -------------------------------- ### CancelTask Source: https://github.com/zoo-code-org/zoo-code/blob/main/packages/ipc/README.md Cancels a running task. This command is used to stop an ongoing task by providing its unique identifier. ```APIDOC ## CancelTask ### Description Cancels a running task. ### Parameters - **data** (string) - Required - Task ID to cancel ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.