### Install XibeCode from Source Source: https://github.com/iotserver24/xibecode/blob/main/README.md Clone the repository, install dependencies, build, and link the CLI globally. ```bash git clone https://github.com/iotserver24/xibecode cd xibecode pnpm install pnpm run build pnpm link --global --dir packages/cli ``` -------------------------------- ### GitHub Actions CI Setup for XibeCode Source: https://github.com/iotserver24/xibecode/blob/main/DOCS.md Integrate XibeCode into a GitHub Actions workflow. This example installs XibeCode, configures it using secrets, and runs a task. ```yaml - name: Run XibeCode task env: ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }} GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | npm install -g xibecode xibecode config --set-key "$ANTHROPIC_API_KEY" xibecode config --set-url "https://api.anthropic.com" xibecode config --set-model "claude-3-7-sonnet-20250219" xibecode run "Fix lint errors across the codebase" ``` -------------------------------- ### Install MCP Server Source: https://github.com/iotserver24/xibecode/blob/main/DOCS.md Install an MCP server to provide the agent with access to external tools. Use `xibecode mcp install` followed by the package name. ```bash xibecode mcp install @smithery/mcp-postgres ``` -------------------------------- ### Minimal Sandbox Setup for XibeCode Source: https://github.com/iotserver24/xibecode/blob/main/DOCS.md Install XibeCode globally and configure it non-interactively for use in sandbox environments. This sets the API key, URL, and default model. ```bash npm install -g xibecode # Set config (non-interactive) xibecode config --set-key "$ANTHROPIC_API_KEY" xibecode config --set-url "https://api.anthropic.com" xibecode config --set-model "claude-3-7-sonnet-20250219" # Run a task xibecode run "your task" ``` -------------------------------- ### Install XibeCode CLI Source: https://github.com/iotserver24/xibecode/blob/main/docs/README.md Installs the XibeCode command-line interface globally. Use this for end-user installation. ```bash pnpm install -g xibecode ``` -------------------------------- ### Install XibeCode CLI Source: https://github.com/iotserver24/xibecode/blob/main/DOCS.md Installs the XibeCode command-line interface globally using npm or pnpm. Verify the installation by checking the version. ```bash npm install -g xibecode ``` ```bash pnpm add -g xibecode ``` ```bash xibecode -v # → 0.6.1 ``` -------------------------------- ### Start Xibecode UI Server Source: https://github.com/iotserver24/xibecode/blob/main/packages/cli/README.md Run this command in your terminal to start the Xibecode web UI server. ```bash xibecode ui ``` -------------------------------- ### Install and Build XibeCode Packages Source: https://github.com/iotserver24/xibecode/blob/main/README.md Commands to install dependencies, build all packages using Turborepo, and enable watch mode for development. ```bash pnpm install pnpm run build # Build all packages with Turborepo pnpm run dev # Watch mode for development pnpm run sync-version # Sync versions across all packages ``` -------------------------------- ### Verify Installation and Run Tests Source: https://github.com/iotserver24/xibecode/blob/main/CONTRIBUTING.md Test the command-line interface (CLI) and run the project's test suite to ensure the installation and build were successful. ```bash npm run dev -- --help ``` ```bash npm test ``` -------------------------------- ### Run Task with Postgres MCP Server Source: https://github.com/iotserver24/xibecode/blob/main/DOCS.md After installing and configuring an MCP server (e.g., Postgres), you can run tasks that utilize its tools. This example lists tables and their schemas. ```bash xibecode run "List all tables in the database and show their schemas" ``` -------------------------------- ### Start XibeCode WebUI Source: https://github.com/iotserver24/xibecode/blob/main/packages/cli/README.md Start the XibeCode WebUI in your browser. Use the --open flag to automatically open it, or specify a custom port with -p. ```bash xibecode ui # Start on localhost:3847 xibecode ui --open # Auto-open browser xibecode ui -p 8080 # Custom port ``` -------------------------------- ### Install XibeCode from Source Source: https://github.com/iotserver24/xibecode/blob/main/packages/cli/README.md Clone the XibeCode repository, install dependencies, build the project, and link it locally. This is useful for development or using the latest unreleased changes. ```bash git clone https://github.com/iotserver24/xibecode cd xibecode pnpm install pnpm run build npm link ``` -------------------------------- ### Install Project Dependencies Source: https://github.com/iotserver24/xibecode/blob/main/docs/README.md Installs all project dependencies using pnpm. Required for contributors after cloning. ```bash pnpm install ``` -------------------------------- ### MCP Server Configuration Example Source: https://github.com/iotserver24/xibecode/blob/main/DOCS.md An example JSON structure for configuring an MCP server, specifying the command, arguments, and environment variables. ```json { "my-db": { "command": "npx", "args": ["-y", "@smithery/mcp-postgres"], "env": { "DATABASE_URL": "postgres://..." } } } ``` -------------------------------- ### Workflow: Add Authentication Source: https://github.com/iotserver24/xibecode/blob/main/FEATURES.md Example of a complex development task broken down into sequential AI-assisted steps, including package installation, middleware creation, and route protection. ```bash xibecode run "Add JWT authentication: 1. Install jsonwebtoken and bcrypt 2. Create auth middleware 3. Add /login and /register endpoints 4. Protect existing routes 5. Add tests" ``` ```text Iteration 1: run_command("npm install jsonwebtoken bcrypt") Iteration 2: write_file("middleware/auth.js") # Creates middleware Iteration 3: read_file("app.js") # Understand current routes Iteration 4: edit_file("app.js") # Add auth routes Iteration 5: edit_file("app.js") # Protect routes Iteration 6: write_file("test/auth.test.js") # Add tests Iteration 7: run_command("npm test") # Verify ``` -------------------------------- ### Install XibeCode via npm Source: https://github.com/iotserver24/xibecode/blob/main/README.md Install XibeCode globally using npm or pnpm. ```bash pnpm install -g xibecode # or npm install -g xibecode ``` -------------------------------- ### Manage Configuration Settings Source: https://github.com/iotserver24/xibecode/blob/main/README.md Examples of using `xibecode config` to set API keys, models, and view current settings. ```bash xibecode config --set-key YOUR_KEY xibecode config --set-model claude-sonnet-4-5-20250929 xibecode config --show ``` -------------------------------- ### Vitest Test Organization Example Source: https://github.com/iotserver24/xibecode/blob/main/CODING_STANDARDS.md Organize tests using describe blocks for grouping and beforeEach for setup. Use 'it' blocks for individual test cases, covering happy paths, edge cases, and error conditions. ```typescript import { describe, it, expect, beforeEach } from 'vitest'; describe('FunctionName', () => { // Setup beforeEach(() => { // Reset state }); // Happy path it('should return expected result for valid input', () => { const result = functionName('valid'); expect(result).toBe('expected'); }); // Edge cases it('should handle empty input', () => { expect(() => functionName('')).toThrow(); }); it('should handle null input', () => { expect(() => functionName(null)).toThrow(); }); // Error cases it('should throw error for invalid input', () => { expect(() => functionName('invalid')).toThrow(ValidationError); }); }); ``` -------------------------------- ### Search and Install MCP Servers from Smithery Source: https://context7.com/iotserver24/xibecode/llms.txt Find and install MCP server packages from the Smithery registry. Use keywords to search. ```bash xibecode mcp search postgres ``` ```bash xibecode mcp install @modelcontextprotocol/server-postgres ``` -------------------------------- ### Build Project Source: https://github.com/iotserver24/xibecode/blob/main/docs/README.md Builds the entire XibeCode monorepo using Turborepo. Run this after installing dependencies as a contributor. ```bash pnpm run build ``` -------------------------------- ### Run Autonomous Workflow Examples Source: https://github.com/iotserver24/xibecode/blob/main/README.md Examples of using the `xibecode run` command for various tasks, including verbose output and file input. ```bash xibecode run "Build a REST API with Express" xibecode run "Fix the TypeScript errors" --verbose xibecode run --file task.txt ``` -------------------------------- ### Install Project Dependencies Source: https://github.com/iotserver24/xibecode/blob/main/CONTRIBUTING.md Install project dependencies using either npm or pnpm. This step is crucial before building or running the project. ```bash npm install ``` ```bash pnpm install ``` -------------------------------- ### SkillManager: Load, Search, and Install Skills Source: https://context7.com/iotserver24/xibecode/llms.txt Handles loading markdown skills from local directories and remote registries. Use `loadSkills` to initialize, `buildDefaultSkillsPromptForTask` to get relevant skills for a prompt, `installFromSkillsSh` to add new skills, and `learnFromDocs` to synthesize skills from URLs. ```typescript import { SkillManager } from 'xibecode-core'; const sm = new SkillManager( process.cwd(), process.env.ANTHROPIC_API_KEY, undefined, // custom base URL (optional) 'claude-sonnet-4-5-20250929', 'anthropic' ); await sm.loadSkills(); // List all loaded skills const all = sm.listSkills(); console.log(all.map(s => `${s.name} [${s.provenance}]`)); // Get task-specific bundled prompt (keyword-matched subset) const promptBlock = await sm.buildDefaultSkillsPromptForTask( 'Write Playwright E2E tests for the checkout flow', process.cwd() ); // Use promptBlock in AgentConfig.defaultSkillsPrompt // Search locally loaded skills const matches = sm.searchSkills('docker'); // Install a skill from skills.sh const installed = await sm.installFromSkillsSh('playwright-e2e'); console.log(installed.success, installed.filePath); // Learn a skill from any documentation URL (AI-synthesized) const result = await sm.learnFromDocs( 'prisma', 'https://www.prisma.io/docs', 25, (msg) => console.log(msg) ); console.log(`Scraped ${result.pagesScraped} pages → ${result.filePath}`); // Custom skill file format (.xibecode/skills/my-skill.md): /* --- name: my-skill description: Custom coding pattern for this project tags: architecture, api --- ## Rules - Always validate inputs with Zod - Use Result instead of throwing */ ``` -------------------------------- ### Auto-discover and Install Skills Source: https://github.com/iotserver24/xibecode/blob/main/DOCS.md The agent can automatically discover and install skills based on the task. It searches for relevant skills, installs them, and then uses their instructions. ```bash xibecode run "Set up a Next.js project with best practices" ``` -------------------------------- ### Start XibeCode Chat Interface Source: https://github.com/iotserver24/xibecode/blob/main/docs/README.md Launches the interactive chat interface for XibeCode. ```bash xibecode chat ``` -------------------------------- ### Install XibeCode CLI Source: https://github.com/iotserver24/xibecode/blob/main/packages/cli/README.md Install the XibeCode CLI globally using npm. This command makes the xibecode executable available in your terminal. ```bash npm install -g xibecode ``` -------------------------------- ### Start WebUI and Pentest Automation Source: https://github.com/iotserver24/xibecode/blob/main/implementation_plan.md Use these commands to start the XibeCode WebUI and the agent-browser for penetration testing automation. Ensure the WebUI is running on the specified port before launching the automation script. ```bash # Terminal 1: Start WebUI xibecode ui --port 3847 # Terminal 2: Run pentest automation agent-browser open http://localhost:3847 ``` -------------------------------- ### Event-Driven Architecture Example Source: https://github.com/iotserver24/xibecode/blob/main/ARCHITECTURE.md Example of using agent events for UI updates or error handling. Listen for 'tool_call' or 'error' events. ```typescript agent.on('tool_call', (data) => { /* Update UI */ }); agent.on('error', (error) => { /* Handle error */ }); ``` -------------------------------- ### Configure Environment Variables Source: https://github.com/iotserver24/xibecode/blob/main/CONTRIBUTING.md Copy the example environment file and add your Anthropic API key. This is necessary for certain functionalities, especially related to AI features. ```bash cp .env.example .env echo "ANTHROPIC_API_KEY=your_api_key_here" >> .env ``` -------------------------------- ### Install TypeDoc Dependencies Source: https://github.com/iotserver24/xibecode/blob/main/docs/README.md Installs TypeDoc and its Markdown plugin as development dependencies. Required for generating API documentation. ```bash pnpm add -D typedoc typedoc-plugin-markdown ``` -------------------------------- ### Plugin Pattern Example Source: https://github.com/iotserver24/xibecode/blob/main/ARCHITECTURE.md Dynamic loading of plugins and registration of their tools. Assumes `loadPlugins` and `registerTools` functions exist. ```typescript const plugins = await loadPlugins(); plugins.forEach(p => registerTools(p.tools)); ``` -------------------------------- ### Changelog Format Example Source: https://github.com/iotserver24/xibecode/blob/main/CONTRIBUTING.md Example format for the CHANGELOG.md file, detailing changes for a specific version including added, changed, fixed, deprecated, and removed items. ```markdown ## [0.3.6] - 2026-02-14 ### Added - New feature X - Tool Y support ### Changed - Improved performance of Z ### Fixed - Bug in component A - Issue with B ### Deprecated - Old API method C ### Removed - Deprecated feature D ``` -------------------------------- ### Run Autonomous Workflow with PR Creation Examples Source: https://github.com/iotserver24/xibecode/blob/main/README.md Examples of using `xibecode run-pr` for autonomous coding with automatic branch and PR creation, including specifying a branch and draft status. ```bash xibecode run-pr "Fix the TypeScript errors" xibecode run-pr "Add input validation" --branch feat/validation --draft ``` -------------------------------- ### Install and Use Browser MCP Server Source: https://github.com/iotserver24/xibecode/blob/main/DOCS.md Install and use an MCP server for browser automation, such as Playwright. This allows the agent to interact with web pages. ```bash xibecode mcp install @smithery/mcp-playwright ``` ```bash xibecode run "Take a screenshot of https://example.com and describe the layout" ``` -------------------------------- ### JSON Configuration File Example Source: https://github.com/iotserver24/xibecode/blob/main/README.md Configure API keys, models, and other settings via a JSON file located at ~/.xibecode/config.json. This provides an alternative to environment variables. ```json { "apiKey": "sk-ant-...", "model": "claude-sonnet-4-5-20250929", "provider": "anthropic", "maxIterations": 50, "costMode": "normal" } ``` -------------------------------- ### Build and Develop Project Source: https://github.com/iotserver24/xibecode/blob/main/CONTRIBUTING.md Build all packages using Turborepo or run the project in watch mode for continuous development. Ensure dependencies are installed first. ```bash pnpm install pnpm run build pnpm run dev ``` -------------------------------- ### Loop Detection Example (With Detection) Source: https://github.com/iotserver24/xibecode/blob/main/FEATURES.md Shows how XibeCode tracks actions and detects repetitive calls to prevent infinite loops. ```javascript // XibeCode tracks recent actions: History: [ { tool: "read_file", input: "app.js", time: 1000 }, { tool: "read_file", input: "app.js", time: 1100 }, { tool: "read_file", input: "app.js", time: 1200 }, ] // After 3 identical calls: ⚠️ Loop detected: read_file called 3+ times with same parameters ``` -------------------------------- ### Configure XibeCode API Key Source: https://github.com/iotserver24/xibecode/blob/main/docs/README.md Sets your API key for XibeCode. This is a required step after installation for users. ```bash xibecode config --set-key YOUR_API_KEY ``` -------------------------------- ### Façade Pattern Example Source: https://github.com/iotserver24/xibecode/blob/main/ARCHITECTURE.md Simplified public API for agent interaction. Initializes an `EnhancedAgent` and runs an agent task. ```typescript const agent = new EnhancedAgent(config); await agent.runAgent('Build a login page'); ``` -------------------------------- ### Internal Implementation Detail Example Source: https://github.com/iotserver24/xibecode/blob/main/CODING_STANDARDS.md Implementation details within private members do not require JSDoc documentation. ```typescript // OK: Implementation internals don't need JSDoc private _internalCache = new Map(); ``` -------------------------------- ### Define a Custom Plugin with a Tool Source: https://github.com/iotserver24/xibecode/blob/main/API_REFERENCE.md Example of a JavaScript plugin defining a custom tool 'analyze_performance' that takes a file path as input. ```javascript // my-custom-plugin.js export default { name: 'custom-plugin', version: '1.0.0', tools: [ { name: 'analyze_performance', description: 'Analyze code performance', input_schema: { type: 'object', properties: { file: { type: 'string' } } }, execute: async ({ file }) => { // Analysis logic return { success: true, output: 'Performance analysis results' }; } } ] }; ``` -------------------------------- ### Workflow: Refactor to TypeScript Source: https://github.com/iotserver24/xibecode/blob/main/FEATURES.md Demonstrates the AI-driven process for converting a JavaScript project to TypeScript, including dependency installation, configuration, and file conversion. ```bash xibecode run "Convert src/ to TypeScript" ``` ```text Iteration 1: search_files("src/**/*.js") # Find all JS files Iteration 2: read_file("package.json") # Check dependencies Iteration 3: run_command("npm install -D typescript @types/node") Iteration 4: write_file("tsconfig.json") # Create config Iteration 5-15: For each file: - read_file("file.js") - write_file("file.ts") # Convert with types Iteration 16: run_command("npx tsc") # Verify compilation ``` -------------------------------- ### Loop Detection Example (Without Detection) Source: https://github.com/iotserver24/xibecode/blob/main/FEATURES.md Illustrates a scenario that would lead to an infinite loop without XibeCode's loop detection mechanism. ```javascript // Without loop detection: Iteration 1: read_file("app.js") Iteration 2: read_file("app.js") // Same thing again Iteration 3: read_file("app.js") // Still doing it Iteration 4: read_file("app.js") // Infinite loop! ``` -------------------------------- ### Run Task with OpenRouter Source: https://github.com/iotserver24/xibecode/blob/main/DOCS.md Execute a task using any model available through OpenRouter. This example uses Gemini 2.5 Pro. Requires the OPENROUTER_API_KEY environment variable. ```bash xibecode run \ --provider openai \ --api-key "$OPENROUTER_API_KEY" \ --base-url "https://openrouter.ai/api/v1" \ --model "google/gemini-2.5-pro-exp-03-25" \ "your task" ``` -------------------------------- ### Tip: Be Specific About Files Source: https://github.com/iotserver24/xibecode/blob/main/FEATURES.md Illustrates the importance of specifying exact file paths for clarity and accuracy when instructing XibeCode. ```bash # Good xibecode run "Add error handling to src/api/users.js" # Less good (AI might guess wrong file) xibecode run "Add error handling to the users file" ``` -------------------------------- ### Teach Project Conventions with xibecode Source: https://github.com/iotserver24/xibecode/blob/main/DOCS.md Use this command to instruct the agent on project conventions, such as preferred libraries and file structures. Ensure the agent understands these guidelines for consistent development. ```bash xibecode run "Remember: we use Zod for validation, Prisma for DB, pnpm for packages, vitest for tests, and all API routes live in src/routes/" ``` -------------------------------- ### Conventional Commit Example: Fix Source: https://github.com/iotserver24/xibecode/blob/main/CONTRIBUTING.md Example of a bug fix commit message, detailing the issue and the solution implemented. ```bash fix(agent): prevent infinite loop in tool execution Loop detector was not correctly tracking tool calls with complex input objects. Fixed by using JSON serialization for comparison. Fixes #456 ``` -------------------------------- ### JSDoc Documentation Example Source: https://github.com/iotserver24/xibecode/blob/main/CONTRIBUTING.md Document public functions, classes, and interfaces using JSDoc comments, including descriptions, examples, parameters, and exceptions. ```typescript /** * Executes a tool with the given input * * Validates tool permissions, performs safety checks, and executes * the tool in the current mode context. * * @example * ```typescript * const result = await executeTool('read_file', { path: '/app.ts' }); * console.log(result.output); * ``` * * @param toolName - Name of the tool to execute * @param input - Tool input parameters * @returns Tool execution result * @throws {PermissionError} If tool not allowed in current mode * @throws {SafetyError} If operation deemed unsafe * * @see {@link CodingToolExecutor} for tool definitions * @since 0.3.0 * @category Tool Execution */ async function executeTool( toolName: string, input: Record ): Promise { // Implementation } ``` -------------------------------- ### Conventional Commit Example: Feature Source: https://github.com/iotserver24/xibecode/blob/main/CONTRIBUTING.md Example of a feature commit message, including a detailed body explaining the changes and a footer referencing an issue. ```bash feat(tools): add http_request tool with retry logic Add a new http_request tool that supports: - GET, POST, PUT, DELETE methods - Custom headers - Automatic retry on failure - Timeout configuration Closes #123 ``` -------------------------------- ### Build a Single XibeCode Package Source: https://github.com/iotserver24/xibecode/blob/main/README.md Commands to navigate into a specific package directory and build it individually. ```bash cd packages/core && pnpm run build cd packages/cli && pnpm run build ``` -------------------------------- ### Git Commit Message Type Examples Source: https://github.com/iotserver24/xibecode/blob/main/CODING_STANDARDS.md Examples of Git commit messages demonstrating the 'feat' and 'fix' types with scope, subject, body, and footer. ```bash feat(tools): add http_request tool with retry logic Add a new http_request tool that supports: - GET, POST, PUT, DELETE methods - Custom headers - Automatic retry on failure - Timeout configuration Closes #123 ``` ```bash fix(agent): prevent infinite loop in tool execution Loop detector was not correctly tracking tool calls with complex input objects. Fixed by using JSON serialization for comparison. Fixes #456 ``` -------------------------------- ### Show Full Instructions for a XibeCode Skill Source: https://context7.com/iotserver24/xibecode/llms.txt Display the complete instructions and usage details for a specific skill. ```bash xibecode skills show playwright-e2e ``` -------------------------------- ### Information Disclosure and Configuration Tampering via GET /api/config Source: https://github.com/iotserver24/xibecode/blob/main/pentest-report.md Exposes sensitive information like API keys and allows unauthenticated modification of configuration via GET requests. ```APIDOC ## GET /api/config ### Description Retrieves the current application configuration, potentially exposing sensitive information like API keys and base URLs. This endpoint also allows for unauthenticated configuration modification. ### Method GET ### Endpoint /api/config ### Response #### Success Response (200) - **apiKey** (string) - The current API key. - **model** (string) - The name of the AI model in use. - **baseUrl** (string) - The base URL for external API calls. #### Response Example ```json { "apiKey": "sk-sensitive-key-12345", "model": "gpt-3.5-turbo", "baseUrl": "https://api.openai.com/v1" } ``` ``` -------------------------------- ### Load Complex Tasks from File Source: https://github.com/iotserver24/xibecode/blob/main/DOCS.md For intricate tasks, define them in a text file and use the `--file` option with `xibecode run`. The `--verbose` flag provides detailed output. ```bash cat > task.txt << 'EOF' Refactor the authentication module: 1. Extract token validation into a separate utility 2. Add refresh token support 3. Write unit tests for all auth functions 4. Update the README with new auth flow docs EOF xibecode run --file task.txt --verbose ``` -------------------------------- ### Use Multiple Config Profiles Source: https://context7.com/iotserver24/xibecode/llms.txt Manage different configuration profiles for distinct environments or projects. Use the --profile flag to switch between them. ```bash xibecode config --profile work --set-key sk-... ``` ```bash xibecode run "Fix the auth bug" --profile work ``` -------------------------------- ### Clone Repository and Set Up Remotes Source: https://github.com/iotserver24/xibecode/blob/main/CONTRIBUTING.md Clone your forked repository and add the upstream remote to fetch changes from the main project. Ensure you replace YOUR_USERNAME with your GitHub username. ```bash git clone https://github.com/YOUR_USERNAME/xibecode.git cd xibecode git remote add upstream https://github.com/iotserver24/xibecode.git ``` -------------------------------- ### Initialize and Use MCPClient Source: https://github.com/iotserver24/xibecode/blob/main/API_REFERENCE.md Instantiate MCPClient and connect to an MCP server using a specified type and configuration. List available tools and execute a remote tool with parameters. ```typescript import { MCPClient } from 'xibecode'; const mcp = new MCPClient(); // Connect to MCP server await mcp.connect('filesystem', { type: 'stdio', command: 'mcp-server-filesystem', args: ['/workspace'] }); // List available tools const tools = await mcp.listTools('filesystem'); // Execute remote tool const result = await mcp.executeTool('filesystem', 'read_file', { path: '/data.json' }); ``` -------------------------------- ### Example Test Suite Output Source: https://github.com/iotserver24/xibecode/blob/main/packages/cli/README.md An example of a generated test suite using Vitest for a TypeScript function. It includes tests for successful execution, type checking, handling empty arrays, and error conditions. ```typescript import { describe, it, expect, vi } from 'vitest'; import { calculateTotal } from '../utils/helpers'; describe('calculateTotal', () => { it('should execute calculateTotal successfully', () => { expect(calculateTotal([])).toBeDefined(); }); it('should return correct type from calculateTotal', () => { expect(typeof calculateTotal([])).toBe('number'); }); it('should handle empty array', () => { expect(calculateTotal([])).toBe(0); }); it('should handle errors in calculateTotal', () => { expect(() => calculateTotal(undefined)).toThrow(); }); }); ``` -------------------------------- ### Start Interactive Terminal Chat Source: https://github.com/iotserver24/xibecode/blob/main/packages/cli/README.md Launches an interactive terminal chat session for tool use. This command also automatically starts the WebUI, accessible at http://localhost:3847, enabling real-time synchronization between the TUI and WebUI. ```bash # Start with both TUI and WebUI xibecode chat # WebUI opens automatically at http://localhost:3847 ``` -------------------------------- ### Basic Agent Initialization and Run Source: https://github.com/iotserver24/xibecode/blob/main/API_REFERENCE.md Initializes an EnhancedAgent with API key and model, then runs a task to create a React component. ```typescript import { EnhancedAgent } from 'xibecode'; const agent = new EnhancedAgent({ apiKey: process.env.ANTHROPIC_API_KEY!, model: 'claude-sonnet-4-5-20250929', mode: 'agent' }); await agent.runAgent('Create a new React component for user profile'); ``` -------------------------------- ### Simple Getter Example Source: https://github.com/iotserver24/xibecode/blob/main/CODING_STANDARDS.md Getters and setters that are obvious in their functionality do not require JSDoc documentation. ```typescript // OK: No JSDoc for simple accessors get name(): string { return this._name; } ``` -------------------------------- ### Private Helper Function Example Source: https://github.com/iotserver24/xibecode/blob/main/CODING_STANDARDS.md Private helper functions that are self-explanatory do not require JSDoc documentation. ```typescript // OK: No JSDoc needed for obvious helpers private isValid(str: string): boolean { return str.length > 0; } ``` -------------------------------- ### Tip: Break Down Huge Tasks Source: https://github.com/iotserver24/xibecode/blob/main/FEATURES.md Advises on decomposing large, complex development goals into smaller, manageable steps for more effective AI assistance. ```bash # Instead of: xibecode run "Build complete e-commerce platform" # Do: xibecode run "Create product model and CRUD endpoints" xibecode run "Add shopping cart functionality" xibecode run "Implement checkout process" ``` -------------------------------- ### Naming Conventions: Classes, Interfaces, and Types Source: https://github.com/iotserver24/xibecode/blob/main/CODING_STANDARDS.md Use PascalCase for classes, interfaces, and types. Examples include descriptive nouns for classes and specific configurations or modes for interfaces and types. ```typescript // ✅ Good: Descriptive nouns class EnhancedAgent { } class FileEditor { } class ContextManager { } // ❌ Bad: Vague or abbreviated class Agt { } class Mgr { } class Util { } ``` -------------------------------- ### Manage MCP Servers Source: https://github.com/iotserver24/xibecode/blob/main/README.md Commands for managing MCP servers, including listing, adding, searching, and installing skills. ```bash xibecode mcp list xibecode mcp add my-server --command "node" --args "server.js" xibecode mcp search # Search Smithery registry xibecode mcp install # Install from Smithery ``` -------------------------------- ### Start Interactive Chat with Specific Model Source: https://github.com/iotserver24/xibecode/blob/main/README.md Initiate an interactive chat session specifying a particular AI model. ```bash xibecode chat --model claude-opus-4-5-20251101 ``` -------------------------------- ### Cross-Platform Command Execution (Windows) Source: https://github.com/iotserver24/xibecode/blob/main/FEATURES.md Demonstrates how XibeCode executes commands on Windows, using `dir` for file listing. ```bash xibecode run "List all Python files" # AI knows it's Windows and uses: run_command({ command: "dir /s /b *.py" }) ``` -------------------------------- ### Strategy Pattern Example Source: https://github.com/iotserver24/xibecode/blob/main/ARCHITECTURE.md Runtime selection of an editing strategy based on edit type. Requires a `selectEditStrategy` function. ```typescript const strategy = selectEditStrategy(editType); await strategy.apply(file, changes); ``` -------------------------------- ### Integration Tests with Vitest Source: https://github.com/iotserver24/xibecode/blob/main/CONTRIBUTING.md Example of integration tests for the EnhancedAgent using Vitest. Verifies the complete workflow execution of the agent. ```typescript import { describe, it, expect } from 'vitest'; import { EnhancedAgent } from 'xibecode-core'; describe('EnhancedAgent Integration', () => { it('should execute complete workflow', async () => { const agent = new EnhancedAgent(config); const result = await agent.runAgent('task'); expect(result.success).toBe(true); }); }); ``` -------------------------------- ### Show Current XibeCode Configuration Source: https://github.com/iotserver24/xibecode/blob/main/DOCS.md Displays the current configuration settings for XibeCode, including API keys, URLs, and models. ```bash xibecode config --show ``` -------------------------------- ### Sensitive Data Exposure via GET /api/files/read Source: https://github.com/iotserver24/xibecode/blob/main/pentest-report.md Allows reading any file within the working directory without authentication. ```APIDOC ## GET /api/files/read ### Description Reads the content of a specified file within the working directory without requiring authentication. ### Method GET ### Endpoint /api/files/read ### Query Parameters - **path** (string) - Required - The path to the file to read. ### Response #### Success Response (200) - **content** (string) - The content of the file. #### Response Example ```json { "content": "This is the content of the file." } ``` ``` -------------------------------- ### Run XibeCode CLI Command Source: https://github.com/iotserver24/xibecode/blob/main/docs/README.md Executes a task using the XibeCode CLI. Replace 'Build a REST API' with your desired task. ```bash xibecode run "Build a REST API" ```