### TOML Configuration for VT Code Session Onboarding Source: https://github.com/vinhnx/vtcode/blob/main/docs/user-guide/getting-started.md This TOML configuration block defines the session onboarding behavior for VT Code. It enables introductory text, includes project and language summaries, highlights guidelines, and sets usage tips and recommended actions to guide the user at the start of a session. ```toml [agent.onboarding] enabled = true intro_text = "Welcome! I preloaded workspace context so you can focus on decisions." include_project_overview = true include_language_summary = true include_guideline_highlights = true guideline_highlight_limit = 4 usage_tips = [ "Share the outcome you need or ask for a quick /status summary.", "Reference AGENTS.md expectations before changing files.", "Prefer targeted reads (read_file, grep_search) before editing.", ] recommended_actions = [ "Request a workspace orientation or describe the task you want to tackle.", "Confirm priorities or blockers so I can suggest next steps.", ] chat_placeholder = "Implement {feature}..." ``` -------------------------------- ### Test Homebrew Installation and Version (Bash) Source: https://github.com/vinhnx/vtcode/blob/main/docs/project/homebrew-setup-guide.md Demonstrates testing the installation of a Homebrew formula locally. It installs the formula from a Ruby file, checks the installed version of the `vtcode` command, and then uninstalls it to clean up. ```bash # Test installation brew install --build-from-source vtcode.rb # Test functionality vtcode --version # Clean up brew uninstall vtcode ``` -------------------------------- ### Test Homebrew Formula Installation (Bash) Source: https://github.com/vinhnx/vtcode/blob/main/docs/project/homebrew-setup-guide.md Installs a Homebrew formula from a local file, using `--build-from-source` which can be useful for testing. It then verifies the installation by running the `vtcode --version` command and finally uninstalls the package. ```bash # Test the formula brew install --build-from-source vtcode.rb # Verify installation vtcode --version # Uninstall for testing brew uninstall vtcode ``` -------------------------------- ### Rust Tool Execution Examples - vtcode Source: https://github.com/vinhnx/vtcode/blob/main/docs/MIGRATION_GUIDE.md Provides examples of how to execute tools using the vtcode system. It shows both the standard, unchanged usage and the new mode-based execution for search, file, and command tools. ```rust // Standard usage (unchanged) let result = tool_registry.execute("rp_search", args).await?; // New mode-based usage let result = search_tool.execute_mode("fuzzy", args).await?; let result = file_tool.execute_mode("recursive", args).await?; let result = cmd_tool.execute_mode("streaming", args).await?; ``` -------------------------------- ### Start an Interactive VT Code Session Source: https://github.com/vinhnx/vtcode/blob/main/docs/user-guide/getting-started.md This command launches an interactive chat session with VT Code, allowing you to converse with the AI agent within your project context. ```bash # Start interactive chat ../vtcode/target/release/vtcode chat # Or with the script /path/to/vtcode/run.sh chat ``` -------------------------------- ### VT Code Homebrew Formula (Ruby) Source: https://github.com/vinhnx/vtcode/blob/main/docs/project/homebrew-setup-guide.md Defines a Homebrew formula for the VT Code application. It specifies the download URL for macOS binaries (differentiated by architecture) and their SHA256 checksums. The `install` method places the binary in the user's PATH, and the `test` block verifies the installation. ```ruby class Vtcode < Formula desc "A Rust-based terminal coding agent with modular architecture" homepage "https://github.com/vinhnx/vtcode" version "0.8.1" on_macos do if Hardware::CPU.arm? url "https://github.com/vinhnx/vtcode/releases/download/v#{version}/vtcode-v#{version}-aarch64-apple-darwin.tar.gz" sha256 "CALCULATE_THIS_SHA256_HASH" else url "https://github.com/vinhnx/vtcode/releases/download/v#{version}/vtcode-v#{version}-x86_64-apple-darwin.tar.gz" sha256 "CALCULATE_THIS_SHA256_HASH" end end def install bin.install "vtcode" end test do system "#{bin}/vtcode", "--version" end end ``` -------------------------------- ### Markdown Example: AGENTS.md for a Rust Project Source: https://github.com/vinhnx/vtcode/blob/main/docs/INIT_COMMAND_GUIDE.md An example of the generated AGENTS.md file for a Rust project utilizing conventional commits. It includes sections for repository guidelines, project structure, build commands, coding style, and commit practices. ```markdown # Repository Guidelines This document serves as a contributor guide for the my-rust-app repository. ## Project Structure & Module Organization - `src/` - Source code - `tests/` - Integration tests - `examples/` - Usage examples ## Build, Test, and Development Commands - `cargo build` - Build project - `cargo test` - Run tests - `cargo run` - Run application ## Coding Style & Naming Conventions - **Indentation:** 4 spaces - **Naming:** snake_case functions, PascalCase types - **Formatting:** `cargo fmt` ## Commit & Pull Request Guidelines - Use conventional commit format: `type(scope): description` - Types: `feat`, `fix`, `docs`, `refactor`, `test`, `chore` - Link issues with `Fixes #123` or `Closes #123` - Ensure tests pass before submitting PRs ## Agent-Specific Instructions - Follow established patterns above - Include tests for new functionality - Update documentation for API changes ``` -------------------------------- ### Alternative Install Command (Bash) Source: https://github.com/vinhnx/vtcode/blob/main/docs/project/homebrew-setup-guide.md An alternative command for installing VT Code, assuming the tap name is 'homebrew-tap'. This simplifies the installation command if the tap has a common name. ```bash brew tap YOUR_USERNAME/homebrew-tap brew install vtcode ``` -------------------------------- ### Initialize VT Code in a Project Source: https://github.com/vinhnx/vtcode/blob/main/docs/user-guide/getting-started.md This command initializes VT Code within a project directory. It creates necessary configuration files like `vtcode.toml` and `.vtcodegitignore`. ```bash # Navigate to your project cd /path/to/your/project # Initialize VT Code (creates vtcode.toml and .vtcodegitignore) ../vtcode/target/release/vtcode init # Or if using scripts /path/to/vtcode/run.sh init ``` -------------------------------- ### Run VT Code with Provided Scripts Source: https://github.com/vinhnx/vtcode/blob/main/docs/user-guide/getting-started.md This snippet shows how to use the provided shell scripts to build and run VT Code. `run.sh` is for production mode, and `run-debug.sh` is for development mode. ```bash # Clone and build using the production script git clone https://github.com/vinhnx/vtcode.git cd vtcode # Build and run in production mode ./run.sh # Or build and run in development mode ./run-debug.sh ``` -------------------------------- ### Test VT Code npm Package Installation Source: https://github.com/vinhnx/vtcode/blob/main/docs/NPM_PACKAGE_SETUP.md Installs the VT Code package locally within a test directory and then checks its functionality by running the help command. This is useful for verifying the installation process and basic package behavior. ```bash cd test-npm npm install npx vtcode --help ``` -------------------------------- ### VS Code Extension Development - Basic Setup Source: https://github.com/vinhnx/vtcode/blob/main/docs/project/TODO.md This code demonstrates the basic structure for creating a 'Hello World' VS Code extension. It involves defining activation events and commands, providing a starting point for developing custom editor functionalities. ```typescript const vscode = require('vscode'); function activate(context) { let disposable = vscode.commands.registerCommand('vtcode.helloWorld', () => { vscode.window.showInformationMessage('Hello World from vtcode!'); }); context.subscriptions.push(disposable); } function deactivate() {} module.exports = { activate, deactivate } ``` -------------------------------- ### Add and Install VT Code from Tap (Bash) Source: https://github.com/vinhnx/vtcode/blob/main/docs/project/homebrew-setup-guide.md Commands to add a custom Homebrew tap to the user's system and then install a formula named 'vtcode' from that tap. This is how users would typically install software distributed via a private or custom Homebrew repository. ```bash # Add your tap brew tap YOUR_USERNAME/homebrew-tap # Install VT Code brew install YOUR_USERNAME/homebrew-tap/vtcode ``` -------------------------------- ### Check Rust and Cargo Version Source: https://github.com/vinhnx/vtcode/blob/main/docs/user-guide/getting-started.md Displays the installed versions of the Rust compiler (rustc) and the Cargo build tool. This is useful for verifying the development environment setup. No specific inputs or outputs other than version strings are produced. ```bash rustc --version cargo --version ``` -------------------------------- ### Setup Development Environment with setup.sh Source: https://github.com/vinhnx/vtcode/blob/main/scripts/README.md The setup.sh script configures the development environment by checking and updating the Rust toolchain, installing necessary components and development tools, and optionally setting up git hooks. It verifies that all installations are successful. ```bash # Basic setup ./scripts/setup.sh # Setup with git hooks ./scripts/setup.sh --with-hooks # Show help ./scripts/setup.sh --help ``` -------------------------------- ### Install VHS on macOS and Linux Source: https://github.com/vinhnx/vtcode/blob/main/docs/demo-vhs-guide.md Installs the VHS tool, a command-line tool for generating terminal GIF recordings. The installation method varies between macOS (using Homebrew) and Linux (using a curl script). ```bash # On macOS brew install charmbracelet/tap/vhs # On Linux curl -fsSL https://get.vhs.dev | bash ``` -------------------------------- ### Install VT Code Globally Source: https://github.com/vinhnx/vtcode/blob/main/docs/NPM_PACKAGE_SETUP.md Installs the VT Code package globally on the system, making the 'vtcode' command available system-wide. It then verifies the installation by checking the help command. ```bash npm install -g vtcode-ai vtcode --help ``` -------------------------------- ### Build VT Code with Cargo Source: https://github.com/vinhnx/vtcode/blob/main/docs/user-guide/getting-started.md This snippet demonstrates how to clone the VT Code repository and build the project using Cargo, Rust's package manager. The `--release` flag optimizes the build for production. ```bash git clone https://github.com/vinhnx/vtcode.git cd vtcode cargo build --release # The binary will be available at target/release/vtcode ``` -------------------------------- ### Execute VT Code Release Script Source: https://github.com/vinhnx/vtcode/blob/main/docs/project/DISTRIBUTION_SETUP_GUIDE.md Commands to run the VT Code release script for publishing to various distribution channels. Supports options for versioning, skipping channels, and dry runs. ```bash # Full release (all channels) ./scripts/release.sh --patch # Release with specific version ./scripts/release.sh 1.0.0 # Skip certain channels ./scripts/release.sh --minor --skip-npm --skip-homebrew # Dry run to see what would happen ./scripts/release.sh --patch --dry-run ``` -------------------------------- ### Language and Framework Detection Guidelines Source: https://github.com/vinhnx/vtcode/blob/main/docs/INIT_COMMAND_GUIDE.md This section outlines the automatic detection of programming languages and associated build tools or style guides. It maps common languages to their respective ecosystems and conventions. ```text Rust → Cargo, clippy, rustfmt guidelines JavaScript/TypeScript → npm/yarn, Prettier, ESLint Python → pip/poetry, Black, pytest, PEP 8 Go → Go modules, gofmt, go vet Java/Kotlin → Maven/Gradle, standard conventions ``` -------------------------------- ### Verify vtcode Installation Source: https://github.com/vinhnx/vtcode/blob/main/docs/demo-vhs-guide.md Checks if the vtcode command-line tool is installed and accessible in the system's PATH by running the version command. ```bash vtcode --version ``` -------------------------------- ### Login and Verify npm Account Source: https://github.com/vinhnx/vtcode/blob/main/docs/project/DISTRIBUTION_SETUP_GUIDE.md Logs into the npm registry and verifies the current logged-in user. This is necessary for publishing Node.js packages. ```bash # Login to npm npm login # Verify login npm whoami ``` -------------------------------- ### Troubleshoot npm Publishing Source: https://github.com/vinhnx/vtcode/blob/main/docs/project/DISTRIBUTION_SETUP_GUIDE.md Commands to help diagnose and resolve issues related to publishing Node.js packages to npm. Includes checking login status, configuration, and performing dry runs. ```bash # Check login status npm whoami # Check npm configuration npm config list # Test publishing (dry run) cd npm && npm publish --dry-run ``` -------------------------------- ### Initialize npm Package Configuration Source: https://github.com/vinhnx/vtcode/blob/main/docs/project/DISTRIBUTION_SETUP.md This `package.json` file configures the npm package for VT Code. It includes metadata, dependencies, and scripts for installation and uninstallation. ```json { "name": "vtcode", "version": "0.1.0", "description": "A command-line tool for VT Code distribution.", "main": "index.js", "bin": { "vtcode": "bin/vtcode" }, "scripts": { "postinstall": "node scripts/postinstall.js", "preuninstall": "node scripts/preuninstall.js" }, "keywords": [ "vtcode" ], "author": "Your Name", "license": "MIT", "dependencies": { "node-fetch": "^2.6.7" } } ``` -------------------------------- ### Bash Setup Script for VT Code Environment Source: https://github.com/vinhnx/vtcode/blob/main/docs/guides/codex-cloud-setup.md Installs system build dependencies, Rust toolchain, clippy, rustfmt, cargo-nextest, and cargo-audit. It also fetches cargo dependencies to enable caching. ```bash #!/usr/bin/env bash set -euxo pipefail apt-get update apt-get install -y build-essential pkg-config libssl-dev ustup update stable rustup default stable rustup component add clippy rustfmt cargo install cargo-nextest --locked cargo install cargo-audit --locked || true cargo fetch --locked ``` -------------------------------- ### Example Automated Homebrew Formula Update Script (Bash) Source: https://github.com/vinhnx/vtcode/blob/main/docs/project/homebrew-setup-guide.md A bash script designed to automate the updating of a Homebrew formula. It handles cloning or updating the tap repository and includes a placeholder for updating the formula content with new version and SHA256 hashes, which would typically be integrated into a CI/CD pipeline. ```bash #!/bin/bash # Update Homebrew formula update_homebrew_formula() { local version=$1 local tap_repo="YOUR_USERNAME/homebrew-tap" local formula_path="vtcode.rb" # Clone or update tap repository if [ ! -d "homebrew-tap" ]; then git clone "https://github.com/$tap_repo.git" homebrew-tap fi cd homebrew-tap # Update formula with new version and SHA256 # This would require calculating SHA256 hashes automatically # Implementation depends on your CI/CD setup cd .. } ``` -------------------------------- ### Example Implementation Context Content Source: https://github.com/vinhnx/vtcode/blob/main/prompts/coder_system.md Provides an example of how to structure detailed implementation documentation within the 'contexts_created' section of the reporting format. It includes sections for overview, files modified, key components, and configuration. ```markdown ```` # Feature Implementation: User Authentication ## Overview Implemented complete user authentication system with JWT tokens and session management. ## Files Modified - `src/auth/mod.rs` - Main authentication module - `src/auth/jwt.rs` - JWT token handling - `src/auth/middleware.rs` - Authentication middleware - `src/models/user.rs` - User model extensions - `Cargo.toml` - Added authentication dependencies ## Key Components Added ### JWT Token Service (`src/auth/jwt.rs`) - Token generation with configurable expiration - Token validation with signature verification - Refresh token mechanism for security ### Authentication Middleware (`src/auth/middleware.rs`) - Request authentication checking - Protected route enforcement - User context injection ### Database Schema Updates - Added `users` table with authentication fields - Implemented password hashing with bcrypt - Added session tracking capability ## Configuration Required ````toml [auth] jwt_secret = "your-secret-key" token_expiration_hours = 24 bcrypt_cost = 12 ```` ``` -------------------------------- ### Perform Project Analysis with VT Code (Bash) Source: https://github.com/vinhnx/vtcode/blob/main/docs/user-guide/getting-started.md These bash commands are used for project-level analysis with VT Code. `vtcode analyze` performs a comprehensive analysis, `vtcode info` retrieves detailed information about the project, and `vtcode summary` generates a project overview. ```bash # Comprehensive project analysis vtcode analyze # Get detailed information vtcode info # Generate project summary vtcode summary ``` -------------------------------- ### Example Usage: Next.js Application Source: https://github.com/vinhnx/vtcode/blob/main/docs/ENHANCED_INIT_COMMAND.md Bash commands demonstrating how to navigate to a Next.js application directory and initiate the `vtcode` command. ```Bash cd /path/to/nextjs-app vtcode ``` -------------------------------- ### Display Badges for docs.rs Documentation Source: https://github.com/vinhnx/vtcode/blob/main/docs/project/DISTRIBUTION_SETUP_GUIDE.md Markdown snippets to integrate badges for your VT Code documentation hosted on docs.rs. These badges provide a visual link to the latest API documentation. ```markdown [![docs.rs](https://img.shields.io/docsrs/vtcode)](https://docs.rs/vtcode) [![docs.rs](https://img.shields.io/docsrs/vtcode-core)](https://docs.rs/vtcode-core) ``` -------------------------------- ### Login to crates.io with Cargo Source: https://github.com/vinhnx/vtcode/blob/main/docs/project/DISTRIBUTION_SETUP_GUIDE.md Logs into crates.io using your API token, which is then stored locally in `~/.cargo/credentials.toml`. This is a prerequisite for publishing Rust packages. ```bash # Login to crates.io (this stores your token locally) carpenter login # When prompted, paste your API token # The token will be stored in ~/.cargo/credentials.toml ``` -------------------------------- ### Clone Homebrew Tap Repository (Bash) Source: https://github.com/vinhnx/vtcode/blob/main/docs/project/homebrew-setup-guide.md Clones a GitHub repository intended for Homebrew taps. Assumes the repository already exists on GitHub. This is the first step in creating or managing a Homebrew distribution. ```bash git clone https://github.com/YOUR_USERNAME/homebrew-tap.git cd homebrew-tap ``` -------------------------------- ### Install Rust and Set Up Environment Source: https://github.com/vinhnx/vtcode/blob/main/scripts/README.md Instructions to install Rust using the official script and source the environment variables. This is a troubleshooting step for 'Rust not found' errors. ```bash curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh source ~/.cargo/env ``` -------------------------------- ### Rust Test Function Examples Source: https://github.com/vinhnx/vtcode/blob/main/docs/development/testing.md Demonstrates standard and asynchronous test function definitions in Rust using the built-in testing framework and the Tokio runtime. These examples illustrate descriptive naming conventions for tests. ```rust #[test] fn test_descriptive_name() { // Test implementation } #[tokio::test] async fn test_async_functionality() { // Async test implementation } ``` -------------------------------- ### Clean and Build Rust Project (Bash) Source: https://github.com/vinhnx/vtcode/blob/main/docs/user-guide/getting-started.md This bash snippet shows commands for managing a Rust project built with Cargo. `cargo clean` removes previous build artifacts, and `cargo build --release` compiles the project in release mode for optimized performance. ```bash # Clean and rebuild carpenter clean carpenter build --release ``` -------------------------------- ### Homebrew Formula for VT Code Source: https://github.com/vinhnx/vtcode/blob/main/docs/project/DISTRIBUTION_SETUP.md This Ruby script defines the Homebrew formula for installing VT Code on macOS. It specifies the source URL, checksums, and installation instructions. ```ruby class Vtcode < Formula desc "A command-line tool for VT Code." homepage "https://github.com/vinhnx/vtcode" version "0.11.1" url "https://github.com/vinhnx/vtcode/releases/download/v#{version}/vtcode-macos-x64" sha256 "YOUR_SHA256_HASH_HERE" # Replace with actual SHA256 hash # Add other platform URLs and SHA256 hashes if needed # For ARM64, Windows, Linux etc. def install bin.install "vtcode-macos-x64" => "vtcode" end test do system "vtcode", "--version" end end ``` -------------------------------- ### Troubleshoot Cargo Publishing Source: https://github.com/vinhnx/vtcode/blob/main/docs/project/DISTRIBUTION_SETUP_GUIDE.md Commands to help diagnose and resolve issues related to publishing Rust packages to crates.io. Includes checking login status, verifying tokens, and performing dry runs. ```bash # Check if you're logged in cargo login --help # Verify your token cat ~/.cargo/credentials.toml # Test publishing (dry run) cargo publish --dry-run ``` -------------------------------- ### Install VT Code Package via npm Source: https://github.com/vinhnx/vtcode/blob/main/docs/project/DISTRIBUTION_SETUP.md This command installs the VT Code package globally using npm. It relies on a postinstall script within the npm package to download platform-specific binaries. ```bash npm install -g vtcode ``` -------------------------------- ### Run VT Code Chat Session (Bash) Source: https://github.com/vinhnx/vtcode/blob/main/docs/user-guide/getting-started.md This bash command initiates a chat session with the VT Code agent. After execution, the agent will greet the user and await instructions for tasks such as code analysis, refactoring, or feature implementation. ```bash vtcode chat ``` -------------------------------- ### Rust Test Isolation Example Source: https://github.com/vinhnx/vtcode/blob/main/docs/development/testing.md Shows a basic example of ensuring test isolation in Rust by creating a fresh environment for each test function. This is crucial for preventing tests from interfering with each other. ```rust #[test] fn test_independent_functionality() { let env = TestEnv::new(); // Fresh environment for each test // Test implementation } ``` -------------------------------- ### Set LLM API Keys for VT Code Source: https://github.com/vinhnx/vtcode/blob/main/docs/user-guide/getting-started.md These commands set the API keys for different LLM providers (Gemini, OpenAI, Anthropic) as environment variables. This is a prerequisite for using VT Code's AI capabilities. ```bash # For Gemini (recommended) export GEMINI_API_KEY=your_api_key_here # For OpenAI export OPENAI_API_KEY=your_api_key_here # For Anthropic export ANTHROPIC_API_KEY=your_api_key_here ``` -------------------------------- ### Clone Repository and Setup Environment Source: https://github.com/vinhnx/vtcode/blob/main/scripts/README.md Standard commands to clone the vtcode repository and set up the development environment, including applying git hooks for pre-commit checks. ```bash git clone cd vtcode ./scripts/setup.sh --with-hooks ``` -------------------------------- ### Rust Content Prioritization Algorithm Example Source: https://github.com/vinhnx/vtcode/blob/main/docs/ENHANCED_INIT_COMMAND.md Outlines the algorithm for prioritizing content based on its importance and commonality within a project. This helps in structuring and generating relevant documentation. ```rust Priority Level 1 (Always): Project structure, Agent instructions Priority Level 2 (Common): Build commands, Commit guidelines Priority Level 3 (Language-specific): Coding style, Testing Priority Level 4 (Optional): Security tips, Architecture notes ``` -------------------------------- ### Run VT Code Quickstart Source: https://github.com/vinhnx/vtcode/blob/main/npm/README.md Executes the VT Code agent after installation. This is the primary command to launch the terminal coding agent. ```shell vtcode ``` -------------------------------- ### Post-installation Script for npm Package Source: https://github.com/vinhnx/vtcode/blob/main/docs/project/DISTRIBUTION_SETUP.md This Node.js script is executed after the VT Code npm package is installed. Its primary function is to download the correct platform-specific binary from GitHub Releases. ```javascript const fs = require('fs'); const path = require('path'); const fetch = require('node-fetch'); const version = '0.11.1'; // Replace with actual version detection const platform = process.platform; const arch = process.arch; let binaryUrl = ''; if (platform === 'linux' && arch === 'x64') { binaryUrl = `https://github.com/vinhnx/vtcode/releases/download/v${version}/vtcode-linux-x64`; } else if (platform === 'darwin' && arch === 'x64') { binaryUrl = `https://github.com/vinhnx/vtcode/releases/download/v${version}/vtcode-macos-x64`; } else if (platform === 'darwin' && arch === 'arm64') { binaryUrl = `https://github.com/vinhnx/vtcode/releases/download/v${version}/vtcode-macos-arm64`; } else if (platform === 'win32' && arch === 'x64') { binaryUrl = `https://github.com/vinhnx/vtcode/releases/download/v${version}/vtcode-windows-x64.exe`; } if (!binaryUrl) { console.error('Unsupported platform or architecture.'); process.exit(1); } const destPath = path.join(__dirname, '../bin/vtcode'); fetch(binaryUrl) .then(res => { if (!res.ok) throw new Error(`HTTP error! status: ${res.status}`); const fileStream = fs.createWriteStream(destPath); res.body.pipe(fileStream); fileStream.on('finish', () => { fs.chmodSync(destPath, 0o755); // Make executable console.log('VT Code binary downloaded successfully.'); }); }) .catch(err => { console.error('Error downloading VT Code binary:', err); process.exit(1); }); ``` -------------------------------- ### Benchmark Structure in Rust with Criterion Source: https://github.com/vinhnx/vtcode/blob/main/docs/development/testing.md An example of setting up performance benchmarks using the Criterion crate. It includes defining benchmark functions and using `criterion_group` and `criterion_main` macros. ```rust use criterion::{black_box, criterion_group, criterion_main, Criterion}; fn benchmark_function(c: &mut Criterion) { // Benchmark setup and execution } criterion_group!(benches, benchmark_function); criterion_main!(benches); ``` -------------------------------- ### Main Entry Point for npm Package Source: https://github.com/vinhnx/vtcode/blob/main/docs/project/DISTRIBUTION_SETUP.md This `index.js` file serves as the main entry point for the VT Code npm package. It typically resolves the path to the executable binary and executes it. ```javascript const path = require('path'); const child_process = require('child_process'); const binaryPath = path.join(__dirname, 'bin/vtcode'); // Ensure the binary is executable (though postinstall should handle this) // fs.chmodSync(binaryPath, 0o755); const args = process.argv.slice(2); const child = child_process.spawn(binaryPath, args, { stdio: 'inherit' }); child.on('error', (err) => { console.error('Failed to start vtcode:', err); process.exit(1); }); child.on('exit', (code) => { process.exit(code); }); ``` -------------------------------- ### Install vtcode using Homebrew Source: https://github.com/vinhnx/vtcode/blob/main/docs/project/TODO.md This snippet shows the command to install the 'vtcode' package using Homebrew. It includes troubleshooting information for a common download error (404 Not Found), indicating a potential issue with the release URL. ```bash brew install vinhnx/tap/vtcode # Example of a common error during installation: # curl: (56) The requested URL returned error: 404 # Error: vtcode: Failed to download resource "vtcode (0.8.2)" # Download failed: https://github.com/vinhnx/vtcode/releases/download/v0.8.2/vtcode-v0.8.2-aarch64-apple-darwin.tar.gz ``` -------------------------------- ### Check and Set GEMINI API Key (Bash) Source: https://github.com/vinhnx/vtcode/blob/main/docs/user-guide/getting-started.md This bash snippet demonstrates how to check if the GEMINI API key is set in the environment and how to export it. This is a common troubleshooting step for issues related to AI model communication. ```bash # Check if API key is set echo $GEMINI_API_KEY # Set the API key export GEMINI_API_KEY=your_key_here ``` -------------------------------- ### Install rustfmt Component Source: https://github.com/vinhnx/vtcode/blob/main/docs/development/ci-cd.md Installs the rustfmt component for code formatting using the rustup toolchain manager. This is a prerequisite for using rustfmt commands. ```bash rustup component add rustfmt ``` -------------------------------- ### Rust File Analysis Pipeline Example Source: https://github.com/vinhnx/vtcode/blob/main/docs/ENHANCED_INIT_COMMAND.md Demonstrates the sequence of functions involved in analyzing a project's files and characteristics. This pipeline is crucial for understanding project structure and detecting patterns. ```rust 1. analyze_project() → ProjectAnalysis struct 2. analyze_file() → Language/framework detection 3. analyze_git_history() → Commit pattern analysis 4. analyze_project_characteristics() → Project type detection 5. generate_agents_md() → Smart content generation ``` -------------------------------- ### Basic TOML Configuration for VT Code Agent Settings Source: https://github.com/vinhnx/vtcode/blob/main/docs/user-guide/getting-started.md This snippet shows the basic TOML configuration for the VT Code agent, including model selection and conversation turn limits. It also covers security settings like human-in-the-loop confirmation and file size limits, as well as default tool policies. ```toml # Agent settings [agent] model = "gemini-2.5-flash-lite" # Your preferred model max_conversation_turns = 1000 verbose_logging = false # Security settings [security] human_in_the_loop = true confirm_destructive_actions = true max_file_size_mb = 50 # Tool policies [tools] default_policy = "prompt" [tools.policies] read_file = "allow" write_file = "prompt" run_terminal_cmd = "prompt" ``` -------------------------------- ### Automated Homebrew Formula Updates Source: https://github.com/vinhnx/vtcode/blob/main/docs/project/DISTRIBUTION_SETUP_GUIDE.md Commands to automatically update your Homebrew formula for VT Code using the release script or a dedicated update script. This simplifies distributing macOS binaries. ```bash # The release script will automatically update your Homebrew formula ./scripts/release.sh --patch # Or use the dedicated update script ./scripts/update-homebrew-formula.sh 0.8.1 vinhnx/homebrew-tap ``` -------------------------------- ### Manage Workspace Directory for VT Code Source: https://github.com/vinhnx/vtcode/blob/main/docs/user-guide/getting-started.md This snippet illustrates how to check, set, or override the `WORKSPACE_DIR` environment variable, which defines the project context for VT Code. It can be set globally or per command. ```bash # Confirm the workspace root echo "Workspace: $WORKSPACE_DIR" # Override if you need to target a different project export WORKSPACE_DIR="/path/to/your/project" # One-off override when launching commands vtcode chat --workspace-dir /path/to/your/project vtcode /path/to/your/project ``` -------------------------------- ### Rustfmt Configuration File Source: https://github.com/vinhnx/vtcode/blob/main/docs/development/ci-cd.md Example configuration for rustfmt, typically placed in `rustfmt.toml` or `.rustfmt.toml` at the project root. It defines formatting aspects like edition, line width, and tab usage. ```toml edition = "2021" max_width = 100 tab_spaces = 4 ``` -------------------------------- ### Run VT Code with OpenRouter Models (CLI) Source: https://github.com/vinhnx/vtcode/blob/main/docs/providers/openrouter.md Shows how to execute VT Code commands using specific models available through OpenRouter. This includes examples for the Grok fast coding model and the Qwen3 Coder model, both of which stream responses and work with VT Code tooling. ```bash vtcode --provider openrouter --model x-ai/grok-code-fast-1 chat ``` ```bash vtcode --provider openrouter --model qwen/qwen3-coder chat ``` -------------------------------- ### Install Pre-commit Hooks Source: https://github.com/vinhnx/vtcode/blob/main/docs/development/ci-cd.md Installs Git pre-commit hooks using the `pre-commit` framework. This ensures that code quality checks are performed automatically before each commit. ```bash pre-commit install ``` -------------------------------- ### Advanced TOML Configuration for VT Code Command Permissions and PTY Source: https://github.com/vinhnx/vtcode/blob/main/docs/user-guide/getting-started.md This snippet details advanced TOML configurations for VT Code, focusing on command permissions (allow and deny lists) and Pseudo-Terminal (PTY) settings. It allows fine-grained control over which shell commands can be executed and configures PTY behavior like dimensions and timeouts. ```toml # Command permissions [commands] allow_list = ["ls", "pwd", "cat", "git status", "cargo check"] deny_list = ["rm -rf", "sudo rm", "shutdown"] # PTY settings [pty] enabled = true default_rows = 24 default_cols = 80 command_timeout_seconds = 300 ``` -------------------------------- ### Bash Command for vtcode Initialization Source: https://github.com/vinhnx/vtcode/blob/main/docs/INIT_COMMAND_GUIDE.md These bash commands demonstrate how to navigate to a repository and execute the vtcode script to initialize the AGENTS.md file. Ensure vtcode is accessible in your PATH or provide its full path. ```bash cd /path/to/any/repository /path/to/vtcode/run.sh # or if vtcode is in PATH vtcode ``` -------------------------------- ### Publish Demo Recording with VHS Source: https://github.com/vinhnx/vtcode/blob/main/docs/demo-vhs-guide.md Uploads a VHS tape file to a sharing platform, generating a shareable URL for the demo recording. ```bash vhs publish demo.tape ``` -------------------------------- ### Navigate to Project Directory Source: https://github.com/vinhnx/vtcode/blob/main/docs/demo-vhs-guide.md Changes the current working directory to the specified vtcode project directory, preparing for demo recording. ```bash cd /Users/vinh.nguyenxuan/Developer/learn-by-doing/vtcode ``` -------------------------------- ### Test File and Directory Creation Source: https://github.com/vinhnx/vtcode/blob/main/docs/development/testing.md Illustrates how to use the `TestEnv` utility to programmatically create files and directories for testing purposes. This is crucial for setting up specific test conditions. ```rust use tests::common::TestEnv; #[test] fn test_file_operations() { let env = TestEnv::new(); // Create test files env.create_test_file("main.rs", "fn main() {}"); env.create_test_dir("src"); // Test operations } ``` -------------------------------- ### Install clippy Component Source: https://github.com/vinhnx/vtcode/blob/main/docs/development/ci-cd.md Installs the clippy component, a linter for Rust that catches common mistakes and improves code quality. Requires the rustup toolchain manager. ```bash rustup component add clippy ``` -------------------------------- ### GitHub Actions Workflow for Rust Tests Source: https://github.com/vinhnx/vtcode/blob/main/docs/development/testing.md A GitHub Actions workflow configuration that triggers on push and pull request events. It sets up a Rust environment, checks out code, installs a stable toolchain, and runs both `cargo test` and `cargo bench`. ```yaml name: Tests on: [push, pull_request] jobs: test: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - uses: dtolnay/rust-toolchain@stable - run: cargo test - run: cargo bench ``` -------------------------------- ### Commit and Push Formula Changes (Bash) Source: https://github.com/vinhnx/vtcode/blob/main/docs/project/homebrew-setup-guide.md Stages, commits, and pushes changes made to the Homebrew formula file (`vtcode.rb`) to the `main` branch of the tap repository. This is a standard Git workflow for updating the formula. ```bash git add vtcode.rb git commit -m "Add vtcode formula v0.8.1" git push origin main ``` -------------------------------- ### Calculate SHA256 Hash for Intel Mac Binary (Bash) Source: https://github.com/vinhnx/vtcode/blob/main/docs/project/homebrew-setup-guide.md Downloads the Intel (x86_64) macOS binary for VT Code using `curl` and then calculates its SHA256 checksum using `shasum`. This hash is required for the Homebrew formula to verify the integrity of the downloaded artifact. ```bash # Download the Intel binary curl -L -o vtcode-intel.tar.gz https://github.com/vinhnx/vtcode/releases/download/v0.8.1/vtcode-v0.8.1-x86_64-apple-darwin.tar.gz # Calculate SHA256 shasum -a 256 vtcode-intel.tar.gz ``` -------------------------------- ### Install VT Code using Cargo Source: https://github.com/vinhnx/vtcode/blob/main/docs/README.md Install the VT Code agent using the Cargo package manager. This is the recommended installation method for users with Rust and Cargo set up. ```bash cargo install vtcode ``` -------------------------------- ### Calculate SHA256 Hash for Apple Silicon Mac Binary (Bash) Source: https://github.com/vinhnx/vtcode/blob/main/docs/project/homebrew-setup-guide.md Downloads the Apple Silicon (aarch64) macOS binary for VT Code using `curl` and then calculates its SHA256 checksum using `shasum`. This hash is essential for the Homebrew formula to ensure the integrity of the downloaded artifact. ```bash # Download the ARM binary curl -L -o vtcode-arm.tar.gz https://github.com/vinhnx/vtcode/releases/download/v0.8.1/vtcode-v0.8.1-aarch64-apple-darwin.tar.gz # Calculate SHA256 shasum -a 256 vtcode-arm.tar.gz ``` -------------------------------- ### Validate and Reset VT Code Configuration (Bash) Source: https://github.com/vinhnx/vtcode/blob/main/docs/user-guide/getting-started.md These bash commands are used for managing VT Code's configuration. `vtcode config --validate` checks the current TOML configuration for errors, while `vtcode config --reset` reverts the configuration to its default settings. ```bash # Validate configuration vtcode config --validate # Reset to defaults vtcode config --reset ``` -------------------------------- ### Install Rustfmt (Bash) Source: https://github.com/vinhnx/vtcode/blob/main/docs/development/ci-cd.md Installs the rustfmt component, a code formatter for Rust, to resolve 'rustfmt not found' issues. This ensures consistent code formatting across the project. ```bash rustup component add rustfmt rustup update ``` -------------------------------- ### Publish VT Code npm Package Source: https://github.com/vinhnx/vtcode/blob/main/docs/NPM_PACKAGE_SETUP.md Navigates to the npm directory and publishes the VT Code package to the npm registry. This command should be run after the release is created and binaries are available. ```bash cd npm npm publish ``` -------------------------------- ### Configure API Keys with vtcode.toml Source: https://github.com/vinhnx/vtcode/blob/main/scripts/README.md Example of a `vtcode.toml` configuration file used for setting API keys. This method has lower priority than environment variables or a `.env` file but offers convenience. ```toml [agent] gemini_api_key = "your_gemini_api_key_here" anthropic_api_key = "your_anthropic_api_key_here" openai_api_key = "your_openai_api_key_here" ``` -------------------------------- ### Generate Demo GIF with VHS Source: https://github.com/vinhnx/vtcode/blob/main/docs/demo-vhs-guide.md Executes a VHS tape file named 'demo.tape' to generate a GIF recording of the vtcode demonstration. ```bash vhs demo.tape ``` -------------------------------- ### Run Release Script for VT Code Source: https://github.com/vinhnx/vtcode/blob/main/docs/NPM_PACKAGE_SETUP.md Executes the release script to prepare for a new version (e.g., v0.13.0). This script likely handles version bumping and tagging in the repository. ```bash ./scripts/release.sh --patch ``` -------------------------------- ### Example Usage: Rust Library Project Source: https://github.com/vinhnx/vtcode/blob/main/docs/ENHANCED_INIT_COMMAND.md Bash commands demonstrating how to navigate to a Rust library project directory and initiate the `vtcode` command, followed by the `/init` command in chat. Includes the expected generated markdown output for a Rust project. ```Bash cd /path/to/rust-library vtcode # In chat: /init ``` ```Markdown # Repository Guidelines This document serves as a contributor guide for the rust-library repository. ## Project Structure & Module Organization - `src/` - Source code - `tests/` - Integration tests - `examples/` - Usage examples ## Build, Test, and Development Commands - `cargo build` - Build project - `cargo test` - Run tests - `cargo clippy` - Run linting ## Coding Style & Naming Conventions - **Indentation:** 4 spaces - **Naming:** snake_case functions, PascalCase types - **Formatting:** `cargo fmt` ## Commit & Pull Request Guidelines - Use conventional commit format: `type(scope): description` - Types: `feat`, `fix`, `docs`, `refactor`, `test`, `chore` - Ensure tests pass before submitting PRs ## Agent-Specific Instructions - Follow established patterns above - Include tests for new functionality - Update documentation for API changes ``` -------------------------------- ### Get Project Structure and Configuration Source: https://github.com/vinhnx/vtcode/blob/main/prompts/coder_system.md Retrieves the project structure and configuration details. Requires the path to the workspace root to fetch project information. ```json { "tool_name": "project_overview", "parameters": { "workspace_path": "/project/root" } } ``` -------------------------------- ### Validation Commands for VT Code Environment Source: https://github.com/vinhnx/vtcode/blob/main/docs/guides/codex-cloud-setup.md Executes formatting checks, linting, and tests for the VT Code project to validate the environment setup. These commands should succeed without manual intervention. ```bash cargo fmt --all -- --check cargo clippy --workspace --all-targets --all-features cargo nextest run --workspace ``` -------------------------------- ### Rust Benchmarking Baseline Example Source: https://github.com/vinhnx/vtcode/blob/main/docs/development/testing.md An example of a Rust benchmark function using the `#[bench]` attribute, intended for establishing performance baselines. It takes a `Bencher` object to perform timed operations. ```rust // Establish performance baselines #[bench] fn bench_baseline_search(b: &mut Bencher) { // Baseline implementation } ``` -------------------------------- ### Pre-uninstallation Script for npm Package Source: https://github.com/vinhnx/vtcode/blob/main/docs/project/DISTRIBUTION_SETUP.md This Node.js script is executed before the VT Code npm package is uninstalled. It handles the cleanup of downloaded binaries and other associated files. ```javascript const fs = require('fs'); const path = require('path'); const binaryPath = path.join(__dirname, '../bin/vtcode'); if (fs.existsSync(binaryPath)) { fs.unlinkSync(binaryPath); console.log('VT Code binary removed.'); } // Add any other cleanup logic here ``` -------------------------------- ### Regenerate All Demo GIFs Source: https://github.com/vinhnx/vtcode/blob/main/docs/demo-vhs-guide.md Runs multiple VHS tape files to regenerate their corresponding GIF recordings, covering basic, TUI, and advanced TUI demonstrations of vtcode. ```bash vhs demo.tape vhs demo-tui.tape vhs demo-advanced-tui.tape ``` -------------------------------- ### Compare Rust Benchmarks Against Baseline Source: https://github.com/vinhnx/vtcode/blob/main/docs/development/testing.md Command to run Cargo benchmarks and compare the results against a previously established baseline. This is useful for detecting performance regressions. ```bash # Compare against baseline cargo bench --baseline baseline ``` -------------------------------- ### Running Specific Search Benchmark Source: https://github.com/vinhnx/vtcode/blob/main/docs/development/testing.md A command-line instruction to run a specific benchmark named `search_benchmark` using Cargo. This is useful for profiling the performance of the search functionality. ```bash cargo bench -- search_benchmark ``` -------------------------------- ### Install VT Code via Homebrew (Bash) Source: https://github.com/vinhnx/vtcode/blob/main/docs/HOMEBREW_RELEASE.md Installs VT Code for users using the Homebrew package manager. This command assumes the Homebrew tap has been set up and the formula is available. ```bash brew install vinhnx/tap/vtcode ``` -------------------------------- ### Cargo Tarpaulin for Rust Test Coverage Source: https://github.com/vinhnx/vtcode/blob/main/docs/development/testing.md Commands to install and use `cargo-tarpaulin` for generating test coverage reports in Rust projects. It covers installation, HTML report generation, and opening the report. ```bash # Install cargo-tarpaulin cargo install cargo-tarpaulin # Generate coverage report cargo tarpaulin --out Html # Open coverage report open tarpaulin-report.html ``` -------------------------------- ### Execute Distribution Validation Script Source: https://github.com/vinhnx/vtcode/blob/main/docs/project/DISTRIBUTION_SETUP.md This script is used to validate the entire VT Code distribution setup before a release. It checks the integrity and availability of packages across different channels. ```bash ./scripts/test-distribution.sh ``` -------------------------------- ### TOML Configuration for Tools Source: https://github.com/vinhnx/vtcode/blob/main/docs/config/TOOLS_CONFIG.md Example TOML configuration snippet for the 'tools' section in vtcode.toml. This demonstrates setting the default policy and the maximum number of tool loops allowed per turn. ```toml [tools] default_policy = "prompt" max_tool_loops = 100 ``` -------------------------------- ### Get Project Overview Information Source: https://github.com/vinhnx/vtcode/blob/main/prompts/explorer_system.md Retrieves high-level information about a project, likely including its structure, dependencies, and configuration. This tool aids in initial project assessment. ```json { "tool_name": "project_overview", "parameters": { "workspace_path": "/path/to/project" } } ``` -------------------------------- ### Install Cargo Udeps for Unused Dependencies Source: https://github.com/vinhnx/vtcode/blob/main/docs/development/ci-cd.md Installs the `cargo-udeps` tool, which checks for unused dependencies in the project's `Cargo.toml` file. Removing unused dependencies can reduce build times and project complexity. ```bash cargo install cargo-udeps ``` -------------------------------- ### Install Catppuccin Dependencies with Cargo Source: https://github.com/vinhnx/vtcode/blob/main/docs/guides/catppuccin-theming.md Installs the Catppuccin crate and optional integration features using the Cargo package manager. Dependencies include base Catppuccin, Ratatui color conversions, Serde for serialization, and ansi-term for ANSI color swatches. ```bash cargo add catppuccin # Optional integrations: cargo add catppuccin --features ratatui # Ratatui color conversions cargo add catppuccin --features serde # Serialize palettes cargo add catppuccin --features ansi-term # ANSI color swatches ``` -------------------------------- ### Rust Code Parsing with Tree-sitter Source: https://github.com/vinhnx/vtcode/blob/main/AGENTS.md Provides an example of using `tree-sitter` for parsing code in Rust. It outlines the basic steps of creating a parser and parsing input text. ```Rust use tree_sitter::Parser; fn main() { let mut parser = Parser::new(); // Assuming you have a language configuration for Rust // let rust_language = tree_sitter_rust::language(); // parser.set_language(rust_language); let code = "fn main() { println!(\"Hello, world!\"); }\n"; let tree = parser.parse(code, None).unwrap(); // You can now traverse the syntax tree println!("Tree root node: {:?}", tree.root_node()); } ``` -------------------------------- ### Running Basic Tests with Cargo Source: https://github.com/vinhnx/vtcode/blob/main/docs/development/testing.md These commands demonstrate how to execute various types of tests using the Cargo build tool. They cover running all tests, tests with detailed output, specific tests or modules, and running tests in release mode. ```bash # Run all tests cargo test # Run tests with detailed output cargo test -- --nocapture # Run specific test cargo test test_tool_registry # Run tests for specific module cargo test tools:: # Run tests in release mode cargo test --release ``` -------------------------------- ### Running Integration Tests with Cargo Source: https://github.com/vinhnx/vtcode/blob/main/docs/development/testing.md Commands to specifically execute integration tests within the vtcode project. This allows for focused testing of end-to-end functionality. ```bash # Run only integration tests cargo test --test integration_tests # Run integration tests with output cargo test --test integration_tests -- --nocapture ``` -------------------------------- ### Publish Crates to crates.io with GitHub Actions Source: https://github.com/vinhnx/vtcode/blob/main/docs/project/DISTRIBUTION_SETUP.md This workflow handles the automated publishing of the VT Code crate to the crates.io repository. It requires a CRATES_IO_TOKEN for authentication. ```yaml name: Publish Crates on: [push] jobs: publish: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - name: Install Rust uses: actions-rs/toolchain@v1 with: toolchain: stable - name: Publish to crates.io uses: actions-rs/cargo@v1 with: command: publish args: --all --token ${{ secrets.CRATES_IO_TOKEN }} ```