### Interact with Cubic AI Comments Source: https://docs.cubic.dev/ai-review/quickstart Examples of how to interact with the cubic AI by tagging it in comments to ask follow-up questions or request fixes. ```text @cubic-dev-ai Can you explain why this is a concern? @cubic-dev-ai Can you fix this? ``` -------------------------------- ### Define Custom Agent Rule with Regex Source: https://docs.cubic.dev/ai-review/quickstart An example of defining a custom agent rule using a regular expression to enforce coding standards, specifically avoiding the 'any' type in TypeScript function parameters. ```regex Avoid using `any` type in TypeScript function parameters ``` -------------------------------- ### Install and Run Cubic CLI Source: https://docs.cubic.dev/ai-review/key-features This command installs the cubic CLI globally using pnpm and then initiates a code review. Ensure you have Node.js and pnpm installed. ```bash pnpm add -g @cubic-dev-ai/cli && cubic review ``` -------------------------------- ### Request Fix from Background Agent Source: https://docs.cubic.dev/ai-review/quickstart Shows the command to tag the cubic AI to request an automatic fix for identified issues within a pull request. ```text @cubic-dev-ai Please fix this ``` -------------------------------- ### Trigger First Review with Git Commands Source: https://docs.cubic.dev/ai-review/quickstart This snippet shows the basic Git commands to create a new branch, make changes, commit them, and push to a remote repository to trigger an automatic review by cubic. ```bash git checkout -b feature/my-feature # Make some changes git add . git commit -m "Add new feature" git push origin feature/my-feature ``` -------------------------------- ### Test Custom Agent Rule with TypeScript Source: https://docs.cubic.dev/ai-review/quickstart This TypeScript code snippet demonstrates a function that would violate the custom agent rule defined to disallow the 'any' type in function parameters, triggering a cubic review. ```typescript // This will trigger the rule function apiCall(data: any) { return fetch('/api', { body: data }) } ``` -------------------------------- ### Configure Reviews: Skip with Labels (YAML) Source: https://docs.cubic.dev/configure/cubic-yaml This YAML configuration demonstrates how to prevent Cubic AI reviews on pull requests by applying specific labels. It includes 'skip-review', 'WIP', and 'draft' as examples. ```yaml reviews: ignore: pr_labels: - skip-review - WIP - draft ``` -------------------------------- ### Get Wiki Page Source: https://docs.cubic.dev/integrations/mcp-server Retrieves the content of a specific AI-generated wiki page for a repository. ```APIDOC ## POST /get_wiki_page ### Description Retrieves the content of a specific AI-generated wiki page for a repository. ### Method POST ### Endpoint /get_wiki_page ### Parameters #### Query Parameters - **owner** (string) - Required - The owner of the repository. - **repo** (string) - Required - The name of the repository. - **pageRef** (string) - Required - The reference to the specific wiki page. ### Request Example ```json { "owner": "acme", "repo": "backend", "pageRef": "authentication-system" } ``` ### Response #### Success Response (200) - **content** (string) - The full content of the requested wiki page. #### Response Example ```json { "content": "# Authentication System\n\nThis document outlines the authentication system for the acme backend. It covers user registration, login, token management, and authorization strategies..." } ``` ``` -------------------------------- ### Custom Review Instructions with Cubic CLI Source: https://docs.cubic.dev/ai-review/cli Tailor the code review process by providing custom instructions via the `--prompt` option. This allows you to focus the analysis on specific areas like security vulnerabilities or performance concerns. ```bash cubic review --prompt "check for XSS vulnerabilities" ``` -------------------------------- ### Configure OpenCode for Cubic MCP Server Source: https://docs.cubic.dev/integrations/mcp-server This JSON configuration file, typically placed in the project root, defines the connection to the Cubic MCP server for OpenCode. It specifies the server type, URL, and authentication headers. ```json { "$schema": "https://opencode.ai/config.json", "mcp": { "cubic": { "type": "remote", "url": "https://cubic.dev/api/mcp", "headers": { "Authorization": "Bearer cbk_your_api_key_here" } } } } ``` -------------------------------- ### Cubic CLI Review Workflows Source: https://docs.cubic.dev/ai-review/cli The Cubic CLI provides flexible ways to review your code at different stages of development. The primary command is `cubic review`, which can be customized with various options. ```APIDOC ## Common Workflows The Cubic CLI adapts to different stages of your development process. ### 1. Review Uncommitted Changes (Default) Review code you are currently working on, before you commit. ```bash cubic review ``` ### 2. Review a Pull Request (Branch Review) Compare your current branch against a base branch (e.g., `main`) to catch issues before opening a PR. ```bash # Auto-detect base branch cubic review --base # Explicit base branch cubic review --base main ``` ### 3. Review a Specific Commit Analyze changes introduced by a specific commit hash or reference. ```bash cubic review --commit HEAD~1 ``` ### 4. Custom Instructions Focus the review on specific concerns like security or performance. ```bash cubic review --prompt "check for XSS vulnerabilities" ``` ## Command Reference The primary command is `cubic review`. ```bash cubic review [options] ``` ### Options | Option | Alias | Description | | ------------------------- | ----- | --------------------------------------------------------------------------------- | | `--json` | `-j` | Output results as JSON (for CI/automation) | | `--base [branch]` | `-b` | Review against a base branch (PR-style). Auto-detects base if no branch specified | | `--commit ` | `-c` | Review a specific commit | | `--prompt ` | `-p` | Custom review instructions | **Note:** `--base`, `--commit`, and `--prompt` are mutually exclusive. ## Output Formats ### Text Output (Default) Human-readable output with colored priority labels, designed for interactive use. ```text [P0] src/api/auth.ts:45 SQL injection vulnerability in user lookup User input is concatenated directly into SQL query without parameterization. ``` ### JSON Output Structured output for tools and automation. ```bash cubic review --json ``` ```json { "issues": [ { "priority": "P0", "file": "src/api/auth.ts", "line": 45, "title": "SQL injection vulnerability in user lookup", "description": "User input is concatenated directly into SQL query without parameterization." } ] } ``` ## Limitations Usage is unlimited while the CLI is in alpha, subject to rate limits to ensure fair access for all users. ``` -------------------------------- ### Configure Reviews: Skip Entire Label Categories (YAML) Source: https://docs.cubic.dev/configure/cubic-yaml This YAML snippet shows how to use wildcard patterns to ignore pull requests with labels that match a specific format. This allows for bulk skipping of reviews based on label naming conventions. ```yaml reviews: ignore: pr_labels: - 'no-ai-*' ``` -------------------------------- ### Configure Cursor for Cubic MCP Server Source: https://docs.cubic.dev/integrations/mcp-server This JSON configuration adds the Cubic MCP server to Cursor's settings. It requires an API key generated from Cubic Dev. Restart Cursor for changes to take effect. ```json { "mcpServers": { "cubic": { "url": "https://cubic.dev/api/mcp", "headers": { "Authorization": "Bearer cbk_your_api_key_here" } } } } ``` -------------------------------- ### List Wiki Pages Source: https://docs.cubic.dev/integrations/mcp-server Lists all available AI-generated wiki pages for a specified repository. ```APIDOC ## POST /list_wiki_pages ### Description Lists all available AI-generated wiki pages for a specified repository. ### Method POST ### Endpoint /list_wiki_pages ### Parameters #### Query Parameters - **owner** (string) - Required - The owner of the repository. - **repo** (string) - Required - The name of the repository. ### Request Example ```json { "owner": "acme", "repo": "backend" } ``` ### Response #### Success Response (200) - **pages** (array of strings) - A list of available wiki page references. #### Response Example ```json { "pages": [ "architecture-overview", "authentication-system", "database-schema", "api-endpoints", "deployment-guide" ] } ``` ``` -------------------------------- ### Review a Pull Request (Branch Review) with Cubic CLI Source: https://docs.cubic.dev/ai-review/cli This functionality allows you to compare your current branch against a specified base branch, simulating a pull request review. It helps catch issues before officially opening a PR. You can either let the CLI auto-detect the base branch or explicitly provide one. ```bash # Auto-detect base branch cubic review --base # Explicit base branch cubic review --base main ``` -------------------------------- ### Configure PR Descriptions in cubic.yaml Source: https://docs.cubic.dev/changelog/changelog This configuration snippet relates to the generation of PR descriptions, potentially enabling a feature that includes a link to open the PR directly in Cubic. This experimental feature can be toggled in the AI review settings or via the `cubic.yaml` file. ```yaml pr_descriptions: ``` -------------------------------- ### Review a Specific Commit with Cubic CLI Source: https://docs.cubic.dev/ai-review/cli This command enables the review of changes introduced by a particular commit. You can specify the commit using its hash or a relative reference like `HEAD~1`. ```bash cubic review --commit HEAD~1 ```