### Minimal Setup for New Developers Source: https://github.com/bobmatnyc/ai-code-review/blob/main/docs/TOOLCHAIN.md A sequence of commands to clone the repository, install dependencies, set up the local environment, and verify the installation. ```bash git clone cd ai-code-review corepack enable pnpm install cp .env.example .env.local # Add at least one AI provider API key pnpm test ``` -------------------------------- ### Command Line Usage Examples Source: https://github.com/bobmatnyc/ai-code-review/blob/main/README.md Examples demonstrating how to run the AI Code Review tool from the command line, including global and local installations. ```bash # Global installation ai-code-review [target] [options] ``` ```bash # Local installation with pnpm pnpm exec ai-code-review [target] [options] ``` ```bash # Local installation with npm npx ai-code-review [target] [options] ``` -------------------------------- ### Team Setup Example Source: https://github.com/bobmatnyc/ai-code-review/blob/main/docs/MCP_WORKFLOW_GUIDE.md Example bash commands and file structure for setting up the AI Code Review tool for team usage, emphasizing API key security. ```bash # .ai-code-review/.gitkeep (commit this) # .ai-code-review/config.json (in .gitignore) # Team README instructions: # 1. Run: ai-code-review init # 2. Enter your personal OpenRouter API key # 3. Config is stored locally and not committed ``` -------------------------------- ### Setup Environment Script Execution Source: https://github.com/bobmatnyc/ai-code-review/blob/main/README.md Execute the setup script based on your installation method (pnpm, npm, or Homebrew) to configure API keys and the .env.local file. ```bash pnpm exec @bobmatnyc/ai-code-review/scripts/setup-env.js ``` ```bash npx @bobmatnyc/ai-code-review/scripts/setup-env.js ``` ```bash node /opt/homebrew/lib/node_modules/@bobmatnyc/ai-code-review/scripts/setup-env.js ``` -------------------------------- ### Verify Git Setup and Configuration Source: https://github.com/bobmatnyc/ai-code-review/blob/main/docs/AI_DETECTION_TROUBLESHOOTING.md Ensure Git is installed and check its configuration settings. Initialize a repository and configure user details if necessary. ```bash # Verify git is working git --version git status # Check git configuration git config --list # Initialize repository if needed git init # Configure git if not set git config user.name "Your Name" git config user.email "your.email@example.com" # Add initial commit if repository is empty git add . git commit -m "Initial commit" --allow-empty ``` -------------------------------- ### Minimal Configuration File Example Source: https://github.com/bobmatnyc/ai-code-review/blob/main/docs/AI_DETECTION_TROUBLESHOOTING.md A minimal example of a configuration file for AI Code Review. This can be used to test basic functionality or as a starting point. ```yaml # minimal-config.yaml reviewType: coding-test enableAiDetection: true aiDetectionThreshold: 0.7 ``` -------------------------------- ### Quick Fix for Global Installation Environment Errors Source: https://github.com/bobmatnyc/ai-code-review/blob/main/README.md Download and run a script to fix environment errors for globally installed tools, ensuring proper setup of API keys. ```bash # Download and run the fix script curl -O https://raw.githubusercontent.com/bobmatnyc/ai-code-review/develop/scripts/global-env-fix.js node global-env-fix.js ``` ```bash # You may need to run with sudo if permission errors occur sudo node global-env-fix.js ``` -------------------------------- ### Install AI Code Review Locally Source: https://github.com/bobmatnyc/ai-code-review/blob/main/docs/QUICK_START.md Install the tool as a development dependency in your project. ```bash pnpm add -D @bobmatnyc/ai-code-review ``` ```bash npm install --save-dev @bobmatnyc/ai-code-review ``` -------------------------------- ### Install Dependencies and Build Project Source: https://github.com/bobmatnyc/ai-code-review/blob/main/tests/extract-patterns/README.md Install project dependencies using pnpm and then build the project. These steps are necessary before running tests. ```bash pnpm install pnpm build ``` -------------------------------- ### Global Installation Commands Source: https://github.com/bobmatnyc/ai-code-review/blob/main/README.md Instructions for installing the AI Code Review tool globally using pnpm or npm. ```bash # Using pnpm (recommended) pnpm add -g @bobmatnyc/ai-code-review ``` ```bash # Using npm (alternative) npm install -g @bobmatnyc/ai-code-review ``` -------------------------------- ### Example Consolidated Review Filenames Source: https://github.com/bobmatnyc/ai-code-review/blob/main/README.md Illustrative examples of consolidated review output filenames. ```bash ai-code-review-docs/openai-gpt-4o-quick-fixes-review-src-2024-04-06.md ai-code-review-docs/gemini-1.5-pro-architectural-review-src-utils-2024-04-06.md ``` -------------------------------- ### Local Git Workflow Example Source: https://github.com/bobmatnyc/ai-code-review/blob/main/docs/INSTRUCTIONS.md A typical local Git workflow demonstrating how to start from main, create a new branch, make changes, commit, keep the branch updated, and prepare for pushing. ```bash # Start from main git checkout main git pull origin main # Create a new branch git checkout -b feature/new-dashboard # Make your changes git add . git commit -m "feat(dashboard): initial layout and state setup" # Keep up to date git fetch origin git rebase origin/main # Push and open PR git push -u origin feature/new-dashboard ``` -------------------------------- ### Install AI Code Review Globally Source: https://github.com/bobmatnyc/ai-code-review/blob/main/docs/QUICK_START.md Install the tool globally for command-line access. Recommended for ease of use. ```bash pnpm add -g @bobmatnyc/ai-code-review ``` ```bash npm install -g @bobmatnyc/ai-code-review ``` -------------------------------- ### Set Up Local Environment Source: https://github.com/bobmatnyc/ai-code-review/blob/main/docs/TOOLCHAIN.md Create a local environment file from the example and add necessary API keys for integration tests. ```bash cp .env.example .env.local # Add actual API keys to .env.local ``` -------------------------------- ### GitHub Actions CI Workflow Example Source: https://github.com/bobmatnyc/ai-code-review/blob/main/docs/TOOLCHAIN.md Example GitHub Actions workflow for a CI pipeline that checks out code, sets up Node.js, installs dependencies, and runs linting, type checking, and tests. ```yaml name: CI on: [push, pull_request] jobs: test: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - uses: actions/setup-node@v3 with: node-version: 18 - run: corepack enable - run: pnpm install - run: pnpm run lint - run: pnpm run build:types - run: pnpm test ``` -------------------------------- ### Custom Prompt Template Example Source: https://github.com/bobmatnyc/ai-code-review/blob/main/README.md Example of a custom prompt template with YAML metadata and placeholders for code and instructions. ```markdown --- name: Custom Security Review description: A custom prompt template for security-focused code reviews version: 1.0.0 author: Your Name reviewType: security language: typescript tags: security, custom --- # Security Code Review Please review the following code for security vulnerabilities: {{LANGUAGE_INSTRUCTIONS}} ## Output Format Please provide your findings in the following format: 1. **Vulnerability**: Description of the vulnerability 2. **Severity**: High/Medium/Low 3. **Location**: File and line number 4. **Recommendation**: How to fix the issue {{SCHEMA_INSTRUCTIONS}} ``` -------------------------------- ### Claude Desktop MCP Configuration Example Source: https://github.com/bobmatnyc/ai-code-review/blob/main/DOCUMENTATION_INDEX.md Example configuration for Claude Desktop using MCP. This JSON file defines settings for the application. ```json { "model": "claude-3-opus-20240229", "temperature": 0.7, "max_tokens": 2048, "system": "You are a helpful AI assistant." } ``` -------------------------------- ### Clone Repository and Install Dependencies Source: https://github.com/bobmatnyc/ai-code-review/blob/main/docs/WORKFLOW.md Steps to clone the AI Code Review repository, install dependencies using pnpm, and set up local environment variables. ```bash git clone https://github.com/bobmatnyc/ai-code-review.git cd ai-code-review pnpm install cp .env.example .env.local # Edit .env.local with your API keys pnpm test pnpm run build ``` -------------------------------- ### Local Installation Commands Source: https://github.com/bobmatnyc/ai-code-review/blob/main/README.md Instructions for installing the AI Code Review tool as a development dependency locally using pnpm or npm. ```bash # Using pnpm (recommended) pnpm add -D @bobmatnyc/ai-code-review ``` ```bash # Using npm (alternative) npm install --save-dev @bobmatnyc/ai-code-review ``` -------------------------------- ### Parallel Task Execution Examples Source: https://github.com/bobmatnyc/ai-code-review/blob/main/docs/chapters/design/claude-code-best-practices.md Examples demonstrating parallel task execution for codebase exploration, independent analysis, and testing. ```bash # Codebase exploration example "Explore the codebase using 4 tasks in parallel. Each agent should explore different directories." # Independent analysis tasks "Analyze these 3 components in parallel: authentication, database layer, and API endpoints." # Testing in parallel "Run unit tests, integration tests, and linting in parallel using separate tasks." ``` -------------------------------- ### Install ESLint and TypeScript plugins Source: https://github.com/bobmatnyc/ai-code-review/blob/main/docs/chapters/design/unused-code-cleanup-strategy.md Install ESLint, the TypeScript parser, and the ESLint plugin for TypeScript as development dependencies. ```bash npm install --save-dev eslint @typescript-eslint/parser @typescript-eslint/eslint-plugin ``` -------------------------------- ### Example Scenario: Continuous Builds Source: https://github.com/bobmatnyc/ai-code-review/blob/main/docs/BUILD_NUMBER_TRACKING.md Demonstrates the sequential incrementing of build numbers during continuous development on the same version. ```text Build 1: 4.4.2 (build 0) Build 2: 4.4.2 (build 1) Build 3: 4.4.2 (build 2) ``` -------------------------------- ### Install pnpm using npm Source: https://github.com/bobmatnyc/ai-code-review/blob/main/docs/WORKFLOW.md An alternative method to install pnpm globally using npm. ```bash npm install -g pnpm ``` -------------------------------- ### Development Execution Source: https://github.com/bobmatnyc/ai-code-review/blob/main/docs/TOOLCHAIN.md Start the development server for continuous development and execution. ```bash pnpm run dev ``` -------------------------------- ### Install MCP Server Source: https://github.com/bobmatnyc/ai-code-review/blob/main/docs/MCP_WORKFLOW_GUIDE.md Installs the AI Code Review as a project-level MCP service and configures it with Claude Desktop. ```APIDOC ## `ai-code-review install` ### Description Install AI Code Review as a project-level MCP service. ### Purpose Register the MCP server with Claude Desktop and create project-level MCP configuration. ### What It Does 1. Detects project toolchain 2. Creates `.mcp.json` in project root 3. Updates Claude Desktop config (`~/Library/Application Support/Claude/claude_desktop_config.json` on macOS) 4. Registers MCP server with environment variables from project config ### Output - `.mcp.json` - Project-level MCP configuration - Claude Desktop config updated with server registration ### Example ```bash ai-code-review install ``` ### Claude Desktop Config Entry ```json { "mcpServers": { "ai-code-review-myproject": { "command": "/opt/homebrew/bin/npx", "args": ["@bobmatnyc/ai-code-review", "mcp"], "env": { "PROJECT_PATH": "/Users/username/projects/myproject", "OPENROUTER_API_KEY": "sk-or-v1-..." } } } } ``` ``` -------------------------------- ### Local Installation with pnpm Source: https://github.com/bobmatnyc/ai-code-review/blob/main/INSTALL.md Installs the AI Code Review tool as a development dependency in the current project using pnpm. ```bash pnpm add -D @bobmatnyc/ai-code-review ``` -------------------------------- ### Run Interactive Code Review Source: https://github.com/bobmatnyc/ai-code-review/blob/main/docs/QUICK_START.md Start the tool in interactive mode, which is recommended for beginners to understand the review output. ```bash ai-code-review --interactive . ``` -------------------------------- ### Start MCP Server Source: https://github.com/bobmatnyc/ai-code-review/blob/main/CLAUDE.md Start the MCP server for AI code review. Options for debug logging and custom configuration are available. ```bash # Start MCP server ai-code-review mcp # With debug logging ai-code-review mcp --debug # Custom configuration ai-code-review mcp --name "my-code-review" --max-requests 10 ``` -------------------------------- ### Verify Local Installation with npm Source: https://github.com/bobmatnyc/ai-code-review/blob/main/INSTALL.md Verifies the local installation of the AI Code Review tool using npm by executing the version command. ```bash npx ai-code-review --version ``` -------------------------------- ### Global Installation with npm Source: https://github.com/bobmatnyc/ai-code-review/blob/main/INSTALL.md Installs the AI Code Review tool globally using npm. This makes the 'ai-code-review' command available system-wide. ```bash npm install -g @bobmatnyc/ai-code-review ``` -------------------------------- ### Web Application Integration Example Source: https://github.com/bobmatnyc/ai-code-review/blob/main/DOCUMENTATION_INDEX.md Example code demonstrating library usage within Next.js and other web applications. Ensure necessary imports and configurations are in place before use. ```typescript import { Claude } from "@anthropic-ai/claude-next"; // Initialize Claude with your API key and configuration const claude = new Claude({ apiKey: process.env.CLAUDE_API_KEY, // Other configuration options can be added here }); // Example usage in a Next.js API route or server component export async function POST(request: Request) { const { prompt } = await request.json(); try { const response = await claude.completions.create({ model: "claude-3-opus-20240229", prompt: `\n\nHuman: ${prompt}\n\nAssistant:`, max_tokens: 1024, }); return new Response(JSON.stringify({ completion: response.completion }), { headers: { "Content-Type": "application/json" }, }); } catch (error) { console.error("Error calling Claude API:", error); return new Response(JSON.stringify({ error: "Failed to get completion" }), { status: 500, headers: { "Content-Type": "application/json" }, }); } } ``` -------------------------------- ### API Key Configuration Source: https://github.com/bobmatnyc/ai-code-review/blob/main/README.md Example of a .env.local file for setting up API keys for different AI models. ```dotenv # Required: Model selection AI_CODE_REVIEW_MODEL=gemini:gemini-2.5-pro # or # AI_CODE_REVIEW_MODEL=openrouter:anthropic/claude-3-opus # or # AI_CODE_REVIEW_MODEL=anthropic:claude-3-opus # Required: API key for the selected model type # For Google Gemini models AI_CODE_REVIEW_GOOGLE_API_KEY=your_google_api_key_here # For OpenRouter models (Claude, GPT-4, etc.) AI_CODE_REVIEW_OPENROUTER_API_KEY=your_openrouter_api_key_here # For direct Anthropic Claude models AI_CODE_REVIEW_ANTHROPIC_API_KEY=your_anthropic_api_key_here ``` -------------------------------- ### Web Application Integration Example (Next.js) Source: https://github.com/bobmatnyc/ai-code-review/blob/main/README.md Integrate AI Code Review into a Next.js API route. This example shows how to receive review requests via POST and return the results. ```typescript // pages/api/review.ts (Next.js) import { performCodeReview } from '@bobmatnyc/ai-code-review/lib'; export default async function handler(req, res) { try { const result = await performCodeReview({ target: req.body.target, config: { model: req.body.model, apiKeys: { openrouter: process.env.OPENROUTER_API_KEY } } }); res.json(result); } catch (error) { res.status(500).json({ error: error.message }); } } ``` -------------------------------- ### Web Integration Example Source: https://github.com/bobmatnyc/ai-code-review/blob/main/DOCUMENTATION_INDEX.md TypeScript example demonstrating web integration. This code snippet shows how to use the AI for code review in a web application context. ```typescript import { ClaudeCodeReview } from "@ai-code-review/sdk"; async function reviewCode(code: string, language: string) { const reviewer = new ClaudeCodeReview({ apiKey: "YOUR_API_KEY", }); const result = await reviewer.review({ code, language, }); console.log(result); } reviewCode("function helloWorld() { console.log('Hello, world!'); }", "javascript"); ``` -------------------------------- ### Example Test Commands Source: https://github.com/bobmatnyc/ai-code-review/blob/main/scripts/gh/pr_template.md These are example commands used for testing the AI code review tool. They cover running tests, initiating development mode with specific review types, and interactive mode for file analysis. ```bash # Example test commands you ran # pnpm test # pnpm run dev architectural some-project # ai-code-review --interactive some-file.ts ``` -------------------------------- ### Serve trusty-analyze Dashboard Source: https://github.com/bobmatnyc/ai-code-review/blob/main/docs/GITHUB_RELEASE_FINAL.md Start the trusty-analyze server to access its embedded dashboard. ```bash trusty-analyze serve ``` -------------------------------- ### GitHub Actions CI/CD Integration Example Source: https://github.com/bobmatnyc/ai-code-review/blob/main/docs/MCP_WORKFLOW_GUIDE.md Example GitHub Actions workflow step for running AI Code Review as part of a CI/CD pipeline, using an environment variable for the API key. ```yaml - name: AI Code Review env: OPENROUTER_API_KEY: ${{ secrets.OPENROUTER_API_KEY }} run: | npx @bobmatnyc/ai-code-review . --type security --no-confirm ``` -------------------------------- ### Recommended Pre-commit Setup Source: https://github.com/bobmatnyc/ai-code-review/blob/main/docs/WORKFLOW.md Execute linting, testing, and building before committing. Optionally, validate Track Down files using a Python script. ```bash pnpm run lint && pnpm run test && pnpm run build ``` ```bash python trackdown/scripts/backlog-validator.py ``` -------------------------------- ### Index Project with trusty-analyze Source: https://github.com/bobmatnyc/ai-code-review/blob/main/docs/GITHUB_RELEASE_FINAL.md After installing trusty-analyze, index your project directory to prepare it for analysis. ```bash cd /path/to/project trusty-analyze index . ``` -------------------------------- ### Get Help Source: https://github.com/bobmatnyc/ai-code-review/blob/main/docs/QUICK_START.md Display the help message for the AI Code Review tool to understand all available commands and options. ```bash ai-code-review --help ``` -------------------------------- ### Initialize Application Services and Commands Source: https://github.com/bobmatnyc/ai-code-review/blob/main/docs/chapters/design/plugin-system-design.md Sets up core services, loads plugins, registers commands, and configures the CLI. Ensure all dependencies are available before initialization. ```typescript // src/index.ts (enhanced) async function initializeApplication(): Promise { // Initialize core services const coreServices = CoreServicesProvider.getInstance(); // Initialize plugin registry const pluginRegistry = new PluginRegistry(coreServices); await pluginRegistry.discoverAndLoadPlugins(); // Register core commands const commandRegistry = new CommandRegistry(); registerCoreCommands(commandRegistry); // Register plugin commands const plugins = pluginRegistry.getLoadedPlugins(); for (const plugin of plugins) { const commands = plugin.getCommands(); for (const command of commands) { commandRegistry.registerCommand(plugin.metadata.name, command); } } // Setup CLI with registered commands setupCLI(commandRegistry); } ``` -------------------------------- ### Basic Unified Client Initialization and Usage Source: https://github.com/bobmatnyc/ai-code-review/blob/main/docs/unified-client-system.md Shows the fundamental steps for using the Unified Client System: initializing the system, creating a client for a specific model, and generating a file review. ```typescript import { createUnifiedClient, initializeUnifiedClients } from '../clients/unified'; // Initialize the system (call once at startup) initializeUnifiedClients(); // Create a client for a specific model const client = await createUnifiedClient('openai:gpt-4'); // Generate a review const result = await client.generateReview( fileContent, filePath, 'quick-fixes', projectDocs, options ); ``` -------------------------------- ### Configure AI Provider API Keys Source: https://github.com/bobmatnyc/ai-code-review/blob/main/docs/WORKFLOW.md Example configurations for `.env.local` file to set up API keys for different AI providers like Gemini, Anthropic, OpenAI, and OpenRouter. ```bash # Choose one or more providers AI_CODE_REVIEW_MODEL=gemini:gemini-2.5-pro GOOGLE_API_KEY=your_google_api_key # OR AI_CODE_REVIEW_MODEL=anthropic:claude-3.5-sonnet ANTHROPIC_API_KEY=your_anthropic_api_key # OR AI_CODE_REVIEW_MODEL=openai:gpt-4o OPENAI_API_KEY=your_openai_api_key # OR AI_CODE_REVIEW_MODEL=openrouter:anthropic/claude-3.5-sonnet OPENROUTER_API_KEY=your_openrouter_api_key ``` -------------------------------- ### GitLab CI Configuration for AI Detection Source: https://github.com/bobmatnyc/ai-code-review/blob/main/examples/ai-detection-usage-examples.md Configure GitLab CI to perform AI code detection on merge requests. This setup installs the tool, runs the analysis, and fails the pipeline if AI-generated code is detected. ```yaml # .gitlab-ci.yml ai_detection: stage: test image: node:18 before_script: - npm install -g @bobmatnyc/ai-code-review script: - | ai-code-review ./src \ --type coding-test \ --enable-ai-detection \ --ai-detection-threshold 0.75 \ --format json \ --output ai-detection-results.json - | if grep -q '"isAIGenerated": true' ai-detection-results.json; then echo "AI-generated code detected - manual review required" exit 1 fi artifacts: reports: junit: ai-detection-results.json expire_in: 1 week only: - merge_requests ``` -------------------------------- ### Initialize Project Configuration Source: https://github.com/bobmatnyc/ai-code-review/blob/main/docs/MCP_WORKFLOW_GUIDE.md Run this command in your project's root directory to set up AI Code Review. It detects your toolchain, prompts for API keys, and creates necessary configuration files. ```bash cd /path/to/your/project ai-code-review init ``` -------------------------------- ### Recess POC Configuration JSON Source: https://github.com/bobmatnyc/ai-code-review/blob/main/docs/RECESS_POC_GUIDE.md Example JSON configuration file for the Recess POC, defining assignment details and evaluation criteria weights. This structure guides the AI Code Review tool's assessment process. ```json { "assignment": { "title": "Events Platform API Development - Recess Evaluation POC", "type": "take-home", "difficulty": "senior", "timeLimit": 240 }, "evaluation": { "criteria": { "technicalImplementation": { "weight": 25 }, "codeQuality": { "weight": 20 }, "security": { "weight": 15 }, "testing": { "weight": 15 }, "architecture": { "weight": 10 }, "documentation": { "weight": 10 }, "gitWorkflow": { "weight": 5 } } } } ``` -------------------------------- ### Install ts-prune Source: https://github.com/bobmatnyc/ai-code-review/blob/main/docs/chapters/design/unused-code-cleanup-strategy.md Install ts-prune as a development dependency to detect unused exports. ```bash npm install --save-dev ts-prune ``` -------------------------------- ### Example Workflow for API Key Validation and Saving Source: https://github.com/bobmatnyc/ai-code-review/blob/main/README.md Demonstrates the interactive workflow when API key validation fails, including options to enter a new key, switch providers, continue, or exit. It also shows how to save the validated API key for future use. ```bash $ ai-code-review . 🔑 Validating API key for OpenRouter... ❌ API key validation failed: Invalid API key Options: [1] Enter a new API key [2] Switch to a different provider [3] Continue anyway (review may fail) [4] Exit Select [1-4]: 1 Enter your OpenRouter API key: sk-or-v1-xxx... 🔑 Validating new API key... ✅ API key is valid! Would you like to save this key for future use? (y/n): y 📁 Saved to .ai-code-review/config.yaml Continuing with review... ``` -------------------------------- ### Run GitHub Repository Setup Script Source: https://github.com/bobmatnyc/ai-code-review/blob/main/scripts/gh/README.md Execute the main wrapper script to automate GitHub repository configuration. This script offers a menu-driven approach to update directory structure, templates, branch protection rules, and repository settings. ```bash ./setup_github_repo.sh ``` -------------------------------- ### Install Final Version of ai-code-review Source: https://github.com/bobmatnyc/ai-code-review/blob/main/docs/GITHUB_RELEASE_FINAL.md Install the last release of the ai-code-review package globally using npm. ```bash npm install -g @bobmatnyc/ai-code-review@4.6.9 ``` -------------------------------- ### Package Preparation Script Steps Source: https://github.com/bobmatnyc/ai-code-review/blob/main/docs/WORKFLOW.md Details the sequential steps performed by the `scripts/prepare-package.sh` script for preparing the package. ```bash # Clean Previous Builds: `rm -rf dist/` # Full Test Execution: `pnpm test` (all 476 tests must pass) # TypeScript Compilation: `tsc` with type definitions # Executable Creation: Add shebang (`#!/usr/bin/env node`) to `dist/index.js` # Permission Setting: `chmod +x dist/index.js` # Version Synchronization: Embed package.json version into code # Model Map Validation: Verify all provider configurations load # Package.json Validation: Ensure publishing metadata correct ``` -------------------------------- ### Generate Sample Configuration File Source: https://github.com/bobmatnyc/ai-code-review/blob/main/README.md Generate a sample configuration file in either YAML or JSON format using the `generate-config` subcommand. Use the `--output` flag to specify the file path and `--format` for the desired format. ```bash # Generate YAML configuration ai-code-review generate-config --output .ai-code-review.yaml --format yaml ``` ```bash # Generate JSON configuration ai-code-review generate-config --output .ai-code-review.json --format json ``` -------------------------------- ### Copy Environment Sample Source: https://github.com/bobmatnyc/ai-code-review/blob/main/INSTALL.md Copies the sample environment file to '.env.local' for API key configuration. ```bash cp .env.sample .env.local ``` -------------------------------- ### Install AI Code Review Package Source: https://github.com/bobmatnyc/ai-code-review/blob/main/docs/WEB_INTEGRATION.md Install the AI Code Review package in your web application using npm. ```bash npm install @bobmatnyc/ai-code-review ``` -------------------------------- ### Quick Release Commands Source: https://github.com/bobmatnyc/ai-code-review/blob/main/docs/RELEASE.md Use these commands for a standard release: first, run pre-release validation, then create the release (patch version bump), and finally, push to trigger automated publishing. ```bash pnpm run pre-release ``` ```bash pnpm run release:patch ``` ```bash git push origin main --tags ``` -------------------------------- ### Verify Global Installation Source: https://github.com/bobmatnyc/ai-code-review/blob/main/INSTALL.md Checks if the AI Code Review tool is installed globally and accessible by running the version command. ```bash ai-code-review --version ``` -------------------------------- ### Local Installation with npm Source: https://github.com/bobmatnyc/ai-code-review/blob/main/INSTALL.md Installs the AI Code Review tool as a development dependency in the current project using npm. ```bash npm install --save-dev @bobmatnyc/ai-code-review ``` -------------------------------- ### Example Scenario: New Version Release Source: https://github.com/bobmatnyc/ai-code-review/blob/main/docs/BUILD_NUMBER_TRACKING.md Illustrates the build number behavior when a new version is released. The build number resets to 0 for the new version. ```text Current: 4.4.2 (build 15) Update package.json to 4.4.3 Next build: 4.4.3 (build 0) // Reset to 0 ``` -------------------------------- ### Prepare Executable and Fix Permissions Source: https://github.com/bobmatnyc/ai-code-review/blob/main/docs/TOOLCHAIN.md Ensure the executable is prepared by running the postbuild script and then fix its permissions. ```bash npm run postbuild chmod +x dist/index.js ``` -------------------------------- ### Markdown Output Example Source: https://github.com/bobmatnyc/ai-code-review/blob/main/docs/RECESS_POC_GUIDE.md Example of the Markdown output format for evaluation reports. This format is human-readable and suitable for direct reporting. ```markdown # Events Platform Evaluation Report **Overall Score:** 75/100 (B+) **Assessment Type:** Take-home assignment **Difficulty Level:** Senior ## Executive Summary [Comprehensive evaluation summary] ## Technical Implementation (20/25) ### Strengths - Modern tech stack implementation - Functional CRUD operations ### Areas for Improvement - Error handling needs enhancement - Input validation missing ## Recommendations 1. Implement comprehensive error handling 2. Add input validation middleware 3. Increase test coverage ``` -------------------------------- ### Simple Pricing Calculation Example Source: https://github.com/bobmatnyc/ai-code-review/blob/main/docs/chapters/features/enhanced-model-maps.md Demonstrates calculating the cost for models with flat-rate pricing, showing how input and output tokens are billed. ```typescript // Models with flat-rate pricing const cost = calculateCost('anthropic:claude-4-sonnet', 100000, 50000); // Input: 100k tokens @ $3/1M = $0.30 // Output: 50k tokens @ $15/1M = $0.75 // Total: $1.05 ``` -------------------------------- ### Install GitHub CLI on macOS Source: https://github.com/bobmatnyc/ai-code-review/blob/main/scripts/gh/README.md Install the GitHub CLI using Homebrew on macOS. This tool is required for several configuration scripts. ```bash brew install gh ``` -------------------------------- ### Troubleshoot 'Command not found' Source: https://github.com/bobmatnyc/ai-code-review/blob/main/docs/QUICK_START.md If the command is not found after installation, try restarting your terminal or using 'pnpm exec' or 'npx' for local installs. ```bash # For local install: pnpm exec ai-code-review npx ai-code-review ``` -------------------------------- ### Set Up Repository Settings Source: https://github.com/bobmatnyc/ai-code-review/blob/main/scripts/gh/README.md Manually configure repository settings using the Node.js script. This requires admin access to the repository. ```bash node node_setup_script.js ``` -------------------------------- ### Install pnpm using Corepack Source: https://github.com/bobmatnyc/ai-code-review/blob/main/docs/WORKFLOW.md Install pnpm globally using Corepack, the recommended method for managing Node.js package managers. ```bash corepack enable corepack prepare pnpm@latest --activate ``` -------------------------------- ### Using Prompt Fragments Source: https://github.com/bobmatnyc/ai-code-review/blob/main/README.md Bash commands demonstrating how to use prompt fragments with specified positions. ```bash ai-code-review src/index.ts --prompt-fragment "Focus on performance issues" ai-code-review src/index.ts --prompt-fragment "Focus on security issues" --prompt-fragment-position start ``` -------------------------------- ### Verify Local Installation with pnpm Source: https://github.com/bobmatnyc/ai-code-review/blob/main/INSTALL.md Verifies the local installation of the AI Code Review tool using pnpm by executing the version command. ```bash pnpm exec ai-code-review --version ``` -------------------------------- ### Global Installation with pnpm Source: https://github.com/bobmatnyc/ai-code-review/blob/main/INSTALL.md Installs the AI Code Review tool globally using pnpm. This makes the 'ai-code-review' command available system-wide. ```bash pnpm add -g @bobmatnyc/ai-code-review ``` -------------------------------- ### Prepare Package for Distribution Source: https://github.com/bobmatnyc/ai-code-review/blob/main/docs/WORKFLOW.md Execute the command to prepare the package, typically involving compilation and bundling, before publishing. ```bash npm run prepare-package ``` -------------------------------- ### Development and Build Commands Source: https://github.com/bobmatnyc/ai-code-review/blob/main/CLAUDE.md Common commands for local development, building the project, and running tests. ```bash # Development pnpm run dev # Run from source pnpm run build # Full build pnpm run test # Run tests ``` -------------------------------- ### Get Detailed Test Output Source: https://github.com/bobmatnyc/ai-code-review/blob/main/docs/TOOLCHAIN.md Run tests with the verbose reporter to get detailed output, useful for debugging mock failures after refactoring. ```bash pnpm test -- --reporter=verbose # Update mocks to match new import paths ``` -------------------------------- ### Create README File Source: https://github.com/bobmatnyc/ai-code-review/blob/main/docs/AI_DETECTION_TROUBLESHOOTING.md Add a basic README.md file to the project if one is missing. Some analysis tools may require documentation files. ```bash echo "# Project Description" > README.md ``` -------------------------------- ### Install AI Code Review CLI Source: https://github.com/bobmatnyc/ai-code-review/blob/main/docs/mcp/SERVER_QUICK_START.md Install the AI Code Review CLI globally using pnpm or npm. This is recommended for MCP integration. ```bash # Global installation (recommended for MCP) pnpm add -g @bobmatnyc/ai-code-review # Or with npm npm install -g @bobmatnyc/ai-code-review ``` -------------------------------- ### Profile Startup Performance Source: https://github.com/bobmatnyc/ai-code-review/blob/main/docs/TOOLCHAIN.md Use the --prof flag with Node.js to profile the startup performance of the application, useful for identifying optimization opportunities. ```bash node --prof dist/index.js --version # Optimize import structure if needed ``` -------------------------------- ### Fix Global Command Installation Source: https://github.com/bobmatnyc/ai-code-review/blob/main/CLAUDE.md Troubleshoot 'command not found' errors for global installations by either running a fix script or manually linking the package. ```bash # Fix global installation ./scripts/fix-global-command.sh ``` ```bash # Or manually link pnpm link --global which ai-code-review ``` -------------------------------- ### Configure API Keys for AI Providers Source: https://github.com/bobmatnyc/ai-code-review/blob/main/docs/MCP_INTEGRATION.md Set environment variables or create a .env.local file to configure your preferred AI provider and provide the necessary API keys. Supported providers include Gemini, Anthropic, OpenAI, and OpenRouter. ```bash # Choose your preferred AI provider AI_CODE_REVIEW_MODEL=gemini:gemini-2.5-pro # API Keys (provide for your chosen provider) AI_CODE_REVIEW_GOOGLE_API_KEY=your_google_api_key_here AI_CODE_REVIEW_ANTHROPIC_API_KEY=your_anthropic_api_key_here AI_CODE_REVIEW_OPENAI_API_KEY=your_openai_api_key_here AI_CODE_REVIEW_OPENROUTER_API_KEY=your_openrouter_api_key_here ``` -------------------------------- ### JSON Output Example Source: https://github.com/bobmatnyc/ai-code-review/blob/main/docs/RECESS_POC_GUIDE.md Example of the JSON output format, detailing metadata, summary, scores, and evaluation breakdown. This format is useful for programmatic analysis. ```json { "metadata": { "strategy": "coding-test", "timestamp": "2025-07-10T12:00:00Z", "model": "gemini-1.5-pro", "assessmentType": "take-home", "difficultyLevel": "senior" }, "summary": "Overall evaluation summary", "scores": { "overall": 75, "breakdown": { "technicalImplementation": 20, "codeQuality": 15, "security": 10 } }, "evaluation": { "strengths": ["List of strengths"], "weaknesses": ["List of weaknesses"], "recommendations": ["Improvement recommendations"] } } ``` -------------------------------- ### Verify Executable and Configurations Source: https://github.com/bobmatnyc/ai-code-review/blob/main/docs/TOOLCHAIN.md Commands to verify the project's executable and model configurations. ```bash ./dist/index.js --version ``` ```bash pnpm run validate:models ```