### Install Stack Auth Wizard Source: https://github.com/eigent-ai/eigent/blob/main/package/@stackframe/react/README.md Run this command to start the Stack Auth installation wizard. ```bash npx @stackframe/init-stack@latest ``` -------------------------------- ### Setup and Basic Presentation Source: https://github.com/eigent-ai/eigent/blob/main/resources/example-skills/pptx/pptxgenjs.md Initializes PptxGenJS, sets presentation properties, adds a slide with text, and saves the presentation to a file. Ensure 'pptxgenjs' is installed via npm. ```javascript const pptxgen = require("pptxgenjs"); let pres = new pptxgen(); pres.layout = 'LAYOUT_16x9'; // or 'LAYOUT_16x10', 'LAYOUT_4x3', 'LAYOUT_WIDE' pres.author = 'Your Name'; pres.title = 'Presentation Title'; let slide = pres.addSlide(); slide.addText("Hello World!", { x: 0.5, y: 0.5, fontSize: 36, color: "363636" }); pres.writeFile({ fileName: "Presentation.pptx" }); ``` -------------------------------- ### Clone and Run Eigent Project Source: https://github.com/eigent-ai/eigent/blob/main/CONTRIBUTING.md Steps to clone the repository, install dependencies, and start the development server for the frontend and backend. ```bash git clone https://github.com/eigent-ai/eigent.git cd eigent npm install npm run dev # In a separate terminal, start the backend server cd server docker compose up -d # Stream the logs if you needed docker compose logs -f ``` -------------------------------- ### Install Harbor CLI and Set API Key Source: https://github.com/eigent-ai/eigent/blob/main/backend/benchmark/harbor/README.md Install the Harbor CLI using 'uv tool install harbor' and set your API key for authentication. ```bash # Install Harbor CLI uv tool install harbor # Set your API key export ANTHROPIC_API_KEY=your-key-here ``` -------------------------------- ### Start Development Application Source: https://github.com/eigent-ai/eigent/blob/main/docs/get_started/self-hosting.md Start the Eigent development application. The first start may take longer due to dependency preparation. ```bash npm run dev ``` -------------------------------- ### Start Backend and Frontend Source: https://github.com/eigent-ai/eigent/blob/main/backend/benchmark/README.md Run the backend and frontend services from the main project directory. ```bash npm run dev ``` -------------------------------- ### Install Frontend Dependencies Source: https://github.com/eigent-ai/eigent/blob/main/docs/get_started/self-hosting.md Install the necessary frontend dependencies using npm. ```bash npm install ``` -------------------------------- ### Test Event Sequence for Installation Flow Source: https://github.com/eigent-ai/eigent/blob/main/test/README.md Verifies that the correct sequence of events (start, log, complete) is emitted during the dependency installation process. ```typescript it('should handle complete installation flow', async () => { const events: string[] = []; // Set up event tracking electronAPI.onInstallDependenciesStart(() => events.push('start')); electronAPI.onInstallDependenciesLog(() => events.push('log')); electronAPI.onInstallDependenciesComplete(() => events.push('complete')); // Trigger installation await electronAPI.checkAndInstallDepsOnUpdate(); // Verify event sequence expect(events).toEqual(['start', 'log', 'log', 'complete']); }); ``` -------------------------------- ### Test Handling of Concurrent Installation Attempts Source: https://github.com/eigent-ai/eigent/blob/main/test/README.md Ensures that multiple simultaneous attempts to start the installation process are handled gracefully without causing issues. ```typescript it('should handle concurrent installation attempts', async () => { const store = useInstallationStore.getState(); // Start multiple installations const promise1 = store.performInstallation(); const promise2 = store.performInstallation(); // Should handle gracefully const [result1, result2] = await Promise.all([promise1, promise2]); expect(store.state).toBe('completed'); }); ``` -------------------------------- ### Start LLaMA.cpp Server Source: https://github.com/eigent-ai/eigent/blob/main/docs/core/models/local-model.md Start the LLaMA.cpp server to host a GGUF model. Specify the model path, host, and port for the server. ```bash ./llama-server -m /path/to/model.gguf --host 0.0.0.0 --port 8080 ``` -------------------------------- ### Run Installation Tests Source: https://github.com/eigent-ai/eigent/blob/main/test/README.md Execute specific unit tests for installation-related modules. ```bash npm test test/unit/store/installationStore.test.ts npm test test/unit/hooks/useInstallationSetup.test.ts npm test test/unit/electron/install-deps.test.ts ``` -------------------------------- ### Install Mintlify CLI Source: https://github.com/eigent-ai/eigent/blob/main/docs/README.md Install the Mintlify CLI globally using npm. This is a prerequisite for running local development servers. ```bash npm install -g mintlify ``` -------------------------------- ### Test Installation Store State Transitions Source: https://github.com/eigent-ai/eigent/blob/main/test/README.md Tests the state machine of the installation store, ensuring transitions between idle, checking permissions, showing carousel, installing, error, and completed states are handled correctly. ```typescript import { useInstallationStore } from '@/store/installationStore'; it('should transition through all states', () => { const store = useInstallationStore.getState(); expect(store.state).toBe('idle'); store.startInstallation(); expect(store.state).toBe('installing'); store.setError('Installation failed'); expect(store.state).toBe('error'); store.retryInstallation(); expect(store.state).toBe('installing'); store.setSuccess(); expect(store.state).toBe('completed'); }); ``` -------------------------------- ### Quick Start: Generate and Run Harbor Tasks Source: https://github.com/eigent-ai/eigent/blob/main/backend/benchmark/harbor/README.md Navigate to the adapter directory, generate Harbor tasks, and then run them using the Harbor CLI with an oracle and an agent. ```bash cd backend/benchmark/harbor # 1. Generate Harbor tasks python run_adapter.py # 2. Verify with oracle (should score 1.0) harbor run \ -p datasets/eigent-bench \ -a oracle \ --env docker # 3. Run with an agent harbor run \ -p datasets/eigent-bench \ -a claude-code \ -m anthropic/claude-sonnet-4-20250514 \ --env docker ``` -------------------------------- ### Install and Run Eigent Locally Source: https://github.com/eigent-ai/eigent/blob/main/README.md Clone the repository, install Node.js dependencies, and run the development server for a cloud-connected preview. This mode requires account registration and connects to Eigent cloud services. ```bash git clone https://github.com/eigent-ai/eigent.git cd eigent npm install npm run dev ``` -------------------------------- ### Test Uvicorn Startup with Dependency Installation Source: https://github.com/eigent-ai/eigent/blob/main/test/README.md Ensures that Uvicorn can detect missing dependencies during startup and trigger the necessary installation process. ```typescript it('should handle uvicorn starting with dependency installation', async () => { // Simulate uvicorn detecting missing dependencies TestScenarios.uvicornDepsInstall(electronAPI); // Trigger uvicorn startup electronAPI.simulateUvicornStartup(); // Wait for installation events await waitFor(() => { expect(mockInstallationStore.startInstallation).toHaveBeenCalled(); }); }); ``` -------------------------------- ### Simulate Electron Installation Events Source: https://github.com/eigent-ai/eigent/blob/main/test/README.md Simulates various installation events and system changes using the mocked Electron API. Use these to test how the application responds to different states. ```typescript // Simulate installation events electronAPI.simulateInstallationStart(); electronAPI.simulateInstallationLog('stdout', 'Installing packages...'); electronAPI.simulateInstallationComplete(true); // or false for failure // Simulate system changes electronAPI.simulateVersionChange('2.0.0'); electronAPI.simulateVenvRemoval(); electronAPI.simulateUvicornStartup(); ``` -------------------------------- ### Start Chrome with Remote Debugging Source: https://github.com/eigent-ai/eigent/blob/main/docs/browser/connections.md Use this command to start Chrome or Chromium with the remote debugging port enabled, allowing Eigent to connect to it. The executable name may vary based on your operating system and installation. ```bash google-chrome --remote-debugging-port=9222 ``` -------------------------------- ### Running the EigenT AI Backend Source: https://github.com/eigent-ai/eigent/blob/main/backend/README.md Three options for starting the backend server using 'uv'. If 'uv run' hangs, consider using the virtual environment directly or deleting lock files. ```bash # Option 1: Start with uvicorn directly uv run uvicorn main:api --port 5001 ``` ```bash # Option 2: Standalone mode (no Electron dependency) uv run python main.py ``` ```bash # Option 3: If uv run hangs, delete lock files and retry, or use venv directly: .venv/bin/python main.py # or .venv/bin/uvicorn main:api --port 5001 --host 0.0.0.0 ``` ```bash # If uv hangs, delete lock files first: rm -f uv_installing.lock uv_installed.lock ``` -------------------------------- ### Markdown Skill Structure Example Source: https://github.com/eigent-ai/eigent/blob/main/resources/example-skills/skill-creator/SKILL.md Illustrates a high-level guide pattern for a skill, linking to separate reference files for advanced features like form filling or API documentation. This keeps the main SKILL.md concise. ```markdown # PDF Processing ## Quick start Extract text with pdfplumber: [code example] ## Advanced features - **Form filling**: See [FORMS.md](FORMS.md) for complete guide - **API reference**: See [REFERENCE.md](REFERENCE.md) for all methods - **Examples**: See [EXAMPLES.md](EXAMPLES.md) for common patterns ``` -------------------------------- ### Commit Message Examples Source: https://github.com/eigent-ai/eigent/blob/main/resources/example-skills/skill-creator/references/output-patterns.md Provide input/output pairs to guide the generation of commit messages. Follow the specified style for type, scope, and description. ```markdown feat(auth): implement JWT-based authentication Add login endpoint and token validation middleware ``` ```markdown fix(reports): correct date formatting in timezone conversion Use UTC timestamps consistently across report generation ``` -------------------------------- ### Start Eigen-ai Server with Docker Source: https://github.com/eigent-ai/eigent/blob/main/server/README_EN.md Use this command to start the Eigen-ai server and its associated PostgreSQL database using Docker Compose. Ensure you have a .env file configured. ```bash cd server # Copy .env.example to .env(or create .env according to .env.example) cp .env.example .env # Environment variables from .env are automatically passed to Docker images docker-compose up --build -d ``` -------------------------------- ### SKILL.md Frontmatter Example Source: https://github.com/eigent-ai/eigent/blob/main/resources/example-skills/skill-creator/SKILL.md Illustrates the required YAML frontmatter for a SKILL.md file, including 'name' and 'description'. The 'license' field is optional. ```yaml name: skill-creator description: Guide for creating effective skills. license: Proprietary. LICENSE.txt has complete terms ``` -------------------------------- ### Initialize Document and Packer with docx-js Source: https://github.com/eigent-ai/eigent/blob/main/resources/example-skills/docx/SKILL.md Sets up a new Document object and configures the Packer to write the document to a file. Ensure 'docx' is installed via npm. ```javascript const { Document, Packer, Paragraph, TextRun, Table, TableRow, TableCell, ImageRun, Header, Footer, AlignmentType, PageOrientation, LevelFormat, ExternalHyperlink, TableOfContents, HeadingLevel, BorderStyle, WidthType, ShadingType, VerticalAlign, PageNumber, PageBreak } = require('docx'); const doc = new Document({ sections: [{ children: [/* content */] }] }); Packer.toBuffer(doc).then(buffer => fs.writeFileSync("doc.docx", buffer)); ``` -------------------------------- ### Common Insecure Configuration Examples Source: https://github.com/eigent-ai/eigent/blob/main/resources/example-skills/skill-security-auditor/SKILL.md Examples of common misconfigurations in application settings that can pose security risks. These should be avoided in production environments. ```yaml # Common misconfigurations to flag: DEBUG: true # Debug mode in production ALLOWED_HOSTS: ["*"] # Unrestricted host access CORS_ALLOW_ALL_ORIGINS: true # Open CORS policy SECRET_KEY: "default" # Default or weak secret key SSL_VERIFY: false # Disabled TLS verification ``` -------------------------------- ### Setup Electron Mocks and Environment Source: https://github.com/eigent-ai/eigent/blob/main/test/README.md Sets up Electron API mocks and the mock environment for testing. This is typically done in a `beforeEach` block in test suites. ```typescript import { setupElectronMocks, TestScenarios } from '../mocks/electronMocks'; import { setupMockEnvironment } from '../mocks/environmentMocks'; describe('My Installation Test', () => { let electronAPI: MockedElectronAPI; let mockEnv: ReturnType; beforeEach(() => { // Set up mocks const { electronAPI: api } = setupElectronMocks(); electronAPI = api; mockEnv = setupMockEnvironment(); }); it('should handle version update', async () => { // Apply scenario TestScenarios.versionUpdate(electronAPI); // Your test code here }); }); ``` -------------------------------- ### Benchmark JSON Configuration Source: https://github.com/eigent-ai/eigent/blob/main/backend/benchmark/README.md Example structure for a benchmark dataset JSON file. Includes data, metadata, model arguments, and test script paths. ```json { "data": { "name": "", "question": "Your task description", "env": {} }, "metadata": { "difficulty": "easy|medium|hard", "description": "Brief description of what this benchmark tests", "tags": ["tag1", "tag2"] }, "model_kwargs": { "model_platform": "openai", "model_type": "gpt-4o" }, "tests": { "grader": ["benchmark/grader/.py"], "checker": ["benchmark/checker/.py"] } } ``` -------------------------------- ### Serve Model with vLLM Source: https://github.com/eigent-ai/eigent/blob/main/docs/core/models/local-model.md Use vLLM to serve a model, making it compatible with OpenAI-compatible servers. Ensure vLLM is installed and the model path is correct. ```bash vllm serve Qwen/Qwen2.5-1.5B-Instruct ``` -------------------------------- ### Stop and Start All Docker Containers Source: https://github.com/eigent-ai/eigent/blob/main/server/README_EN.md Commands to stop and then start all services managed by Docker Compose, including the API and PostgreSQL. ```bash docker compose stop docker compose start ``` -------------------------------- ### Framework-Specific Skill Organization Example Source: https://github.com/eigent-ai/eigent/blob/main/resources/example-skills/skill-creator/SKILL.md Shows organizing a skill that supports multiple frameworks by variant. The main SKILL.md includes workflow and provider selection, while separate reference files detail patterns for each provider (e.g., AWS, GCP, Azure). ```directory cloud-deploy/ ├── SKILL.md (workflow + provider selection) └── references/ ├── aws.md (AWS deployment patterns) ├── gcp.md (GCP deployment patterns) └── azure.md (Azure deployment patterns) ``` -------------------------------- ### Stop and Start API Container Source: https://github.com/eigent-ai/eigent/blob/main/server/README_EN.md Commands to stop and then start only the Eigen-ai API container, while keeping the database container running. ```bash docker stop eigent_api docker start eigent_api ``` -------------------------------- ### Test UI Feedback for Installation States Source: https://github.com/eigent-ai/eigent/blob/main/test/README.md Validates that the user interface accurately reflects the current state of the installation process, including visibility and error messages. ```typescript it('should show correct UI for each installation state', () => { const { result } = renderHook(() => useInstallationStore()); // Test idle state expect(result.current.state).toBe('idle'); expect(result.current.isVisible).toBe(false); // Test installing state act(() => result.current.startInstallation()); expect(result.current.state).toBe('installing'); expect(result.current.isVisible).toBe(true); // Test error state act(() => result.current.setError('Installation failed')); expect(result.current.state).toBe('error'); expect(result.current.error).toBe('Installation failed'); // Test completed state act(() => result.current.setSuccess()); expect(result.current.state).toBe('completed'); expect(result.current.progress).toBe(100); }); ``` -------------------------------- ### Configuring RemoteHands for EigenT AI Source: https://github.com/eigent-ai/eigent/blob/main/backend/README.md Example commands to set up and enable RemoteHands mode for the EigenT AI backend. Ensure the configuration file path is correctly set. ```bash cp backend/config/hands_clusters.example.toml ~/.eigent/hands_clusters.toml export EIGENT_HANDS_MODE=remote export EIGENT_HANDS_CLUSTER_CONFIG_FILE=~/.eigent/hands_clusters.toml ``` -------------------------------- ### Environment State Test Scenarios Source: https://github.com/eigent-ai/eigent/blob/main/test/README.md Predefined scenarios for testing various environment states using the mock environment utilities. These cover different installation conditions like fresh installs, updates, and network issues. ```typescript // Fresh installation mockEnv.scenarios.freshInstall(); // Version update mockEnv.scenarios.versionUpdate('0.9.0', '1.0.0'); // .venv removed mockEnv.scenarios.venvRemoved(); // Network issues mockEnv.scenarios.networkIssues(); // Complete failure mockEnv.scenarios.completeFailure(); // Uvicorn startup installation mockEnv.scenarios.uvicornStartupInstall(); // Installation in progress mockEnv.scenarios.installationInProgress(); ``` -------------------------------- ### Pull Model with Ollama Source: https://github.com/eigent-ai/eigent/blob/main/docs/core/models/local-model.md Use Ollama to download a specific model. Ensure Ollama is installed and configured. ```bash ollama pull qwen2.5:7b ``` -------------------------------- ### Setup for Rendering Icons to PNG Source: https://github.com/eigent-ai/eigent/blob/main/resources/example-skills/pptx/pptxgenjs.md Provides utility functions to render React icons as SVG markup and then rasterize them into PNG format using the 'sharp' library. Requires 'react', 'react-dom/server', and 'sharp'. ```javascript const React = require("react"); const ReactDOMServer = require("react-dom/server"); const sharp = require("sharp"); const { FaCheckCircle, FaChartLine } = require("react-icons/fa"); function renderIconSvg(IconComponent, color = "#000000", size = 256) { return ReactDOMServer.renderToStaticMarkup( React.createElement(IconComponent, { color, size: String(size) }) ); } async function iconToBase64Png(IconComponent, color, size = 256) { const svg = renderIconSvg(IconComponent, color, size); const pngBuffer = await sharp(Buffer.from(svg)).png().toBuffer(); return "image/png;base64," + pngBuffer.toString("base64"); } ``` -------------------------------- ### Domain-Specific Skill Organization Example Source: https://github.com/eigent-ai/eigent/blob/main/resources/example-skills/skill-creator/SKILL.md Demonstrates organizing a skill with multiple domains into a directory structure, where the main SKILL.md provides an overview and navigation, and separate files in a 'reference/' directory handle domain-specific details. This ensures only relevant context is loaded. ```directory bigquery-skill/ ├── SKILL.md (overview and navigation) └── reference/ ├── finance.md (revenue, billing metrics) ├── sales.md (opportunities, pipeline) ├── product.md (API usage, features) └── marketing.md (campaigns, attribution) ``` -------------------------------- ### Python Docstring Args Section Example Source: https://github.com/eigent-ai/eigent/blob/main/CONTRIBUTING.md Document parameters in the 'Args:' section for constructors or functions. Each line should not exceed 79 characters, and continuation lines should be indented by 4 spaces. Specify parameter name, type, description, and default value if applicable. ```python Args: system_message (BaseMessage): The system message for initializing the agent's conversation context. model (BaseModelBackend, optional): The model backend to use for response generation. Defaults to :obj:`OpenAIModel` with `GPT_4O_MINI`. (default: :obj:`OpenAIModel` with `GPT_4O_MINI`) ``` -------------------------------- ### Create New Excel File with Formulas and Formatting Source: https://github.com/eigent-ai/eigent/blob/main/resources/example-skills/xlsx/SKILL.md Example using openpyxl to create a new Excel workbook, add data, insert a formula, and apply basic formatting and column width adjustments. ```python # Using openpyxl for formulas and formatting from openpyxl import Workbook from openpyxl.styles import Font, PatternFill, Alignment wb = Workbook() sheet = wb.active # Add data sheet['A1'] = 'Hello' sheet['B1'] = 'World' sheet.append(['Row', 'of', 'data']) # Add formula sheet['B2'] = '=SUM(A1:A10)' # Formatting sheet['A1'].font = Font(bold=True, color='FF0000') sheet['A1'].fill = PatternFill('solid', start_color='FFFF00') sheet['A1'].alignment = Alignment(horizontal='center') # Column width sheet.column_dimensions['A'].width = 20 wb.save('output.xlsx') ``` -------------------------------- ### Advanced PDF Cropping using pypdf Source: https://github.com/eigent-ai/eigent/blob/main/resources/example-skills/pdf/reference.md Initializes PDF reader and writer objects for advanced PDF manipulation, specifically demonstrating the setup for PDF cropping operations. Requires pypdf. ```python from pypdf import PdfWriter, PdfReader reader = PdfReader("input.pdf") writer = PdfWriter() ``` -------------------------------- ### Preview Locally with Mintlify Source: https://github.com/eigent-ai/eigent/blob/main/docs/README.md Run the Mintlify development server from the 'docs/' directory to preview the documentation locally. This enables hot reloading for faster development cycles. ```bash cd docs mintlify dev ``` -------------------------------- ### Build Distributable Application Source: https://github.com/eigent-ai/eigent/blob/main/docs/get_started/self-hosting.md Run the general build script for your application. ```bash npm run build ``` -------------------------------- ### Test Installation Error Recovery Source: https://github.com/eigent-ai/eigent/blob/main/test/README.md Checks if the system can recover from installation errors by retrying the process after the environment is corrected. ```typescript it('should recover from installation errors', async () => { // Set up error scenario TestScenarios.installationError(electronAPI); const store = useInstallationStore.getState(); // Trigger installation await store.performInstallation(); expect(store.state).toBe('error'); // Simulate retry TestScenarios.allGood(electronAPI); // Fix the environment store.retryInstallation(); await waitFor(() => { expect(store.state).toBe('completed'); }); }); ``` -------------------------------- ### Initialize a New Skill Source: https://github.com/eigent-ai/eigent/blob/main/resources/example-skills/skill-creator/SKILL.md Use this script to generate a new skill template. It creates the necessary directory structure and boilerplate files. Run this from the skill-creator skill directory. ```bash python scripts/init_skill.py --path ``` -------------------------------- ### Configure Development Environment Source: https://github.com/eigent-ai/eigent/blob/main/CONTRIBUTING.md Instructions for configuring the `.env.development` file for local development, including proxy settings. ```bash # Configure .env.development: # Set VITE_USE_LOCAL_PROXY=true # Set VITE_PROXY_URL=http://localhost:3001 ``` -------------------------------- ### Launch SGLang Server Source: https://github.com/eigent-ai/eigent/blob/main/docs/core/models/local-model.md Launch a local server using SGLang to serve a specified model. This script handles server startup, waits for it to become available, and prints the server address. It includes logic to adapt import paths based on whether the code is run in a CI environment. ```python from sglang.test.test_utils import is_in_ci if is_in_ci(): from patch import launch_server_cmd else: from sglang.utils import launch_server_cmd from sglang.utils import wait_for_server, print_highlight, terminate_process server_process, port = launch_server_cmd( "python3 -m sglang.launch_server --model-path qwen/qwen2.5-0.5b-instruct --host 0.0.0.0 --mem-fraction-static 0.8" ) wait_for_server(f"http://localhost:{port}") print(f"Server started on http://localhost:{port}") ``` -------------------------------- ### Get Current State Source: https://github.com/eigent-ai/eigent/blob/main/src/lib/themeTokens/README.md Retrieves the current state of the theme engine, including active theme and contrast. ```APIDOC ## getState ### Description Retrieves the current state of the theme engine. ### Method `window.__eigentThemeV2.getState()` ### Returns An object representing the current theme state, likely including mode, theme name, and contrast level. ``` -------------------------------- ### Read/Analyze PPTX Content Source: https://github.com/eigent-ai/eigent/blob/main/resources/example-skills/pptx/SKILL.md Use this command to extract text content from a .pptx file. Ensure the markitdown Python module is installed. ```bash python -m markitdown presentation.pptx ``` -------------------------------- ### Run Benchmarks Source: https://github.com/eigent-ai/eigent/blob/main/backend/benchmark/README.md Execute benchmarks from the backend/ directory. Use the first command to run all benchmarks, or the second to run a specific benchmark defined by a JSON file. ```bash python3 -m benchmark.main ``` ```bash python3 -m benchmark.main benchmark/dataset/0.json ``` -------------------------------- ### Hex Color Format Source: https://github.com/eigent-ai/eigent/blob/main/resources/example-skills/pptx/pptxgenjs.md Use hex colors without the '#' prefix to avoid file corruption. This example shows the correct and incorrect usage. ```javascript color: "FF0000" // ✅ CORRECT color: "#FF0000" // ❌ WRONG ``` -------------------------------- ### Custom Cron Expression Example Source: https://github.com/eigent-ai/eigent/blob/main/docs/automation/scheduled-triggers.md This is a standard five-part cron expression format. Use visual schedule options for validation and previews when possible. ```text minute hour day-of-month month day-of-week ``` ```text 0 9 * * 1-5 ``` -------------------------------- ### Regular Expression Search Example Source: https://github.com/eigent-ai/eigent/blob/main/backend/README.md A simple bash command demonstrating a regular expression search for the word 'error' that is not followed by a closing bracket. ```bash # regular search \berror\b(?!\}) ``` -------------------------------- ### Initialize TracerProvider on FastAPI Startup Source: https://github.com/eigent-ai/eigent/blob/main/backend/app/utils/telemetry/README.md This code snippet demonstrates how to initialize the TracerProvider once during FastAPI startup to ensure efficient telemetry processing and prevent resource leaks. ```python @api.on_event("startup") async def startup_event(): from app.utils.telemetry.workforce_metrics import initialize_tracer_provider initialize_tracer_provider() ``` -------------------------------- ### Accept Tracked Changes in DOCX Source: https://github.com/eigent-ai/eigent/blob/main/resources/example-skills/docx/SKILL.md Accepts all tracked changes within a DOCX file, producing a clean output document. Requires LibreOffice to be installed. ```bash python scripts/accept_changes.py input.docx output.docx ``` -------------------------------- ### Build Platform-Specific Applications Source: https://github.com/eigent-ai/eigent/blob/main/docs/get_started/self-hosting.md Use platform-specific scripts to build your application for macOS, Windows, or Linux. ```bash npm run build:mac ``` ```bash npm run build:win ``` ```bash npm run build:linux ``` -------------------------------- ### Identify Project Languages and Dependencies Source: https://github.com/eigent-ai/eigent/blob/main/resources/example-skills/skill-security-auditor/SKILL.md Commands to help understand the project's technology stack. The `find` command lists source files, while `cat` displays package manifest files. ```bash # Identify languages, frameworks, and entry points find . -type f -name "*.py" -o -name "*.js" -o -name "*.ts" -o -name "*.go" -o -name "*.java" | head -20 cat package.json pyproject.toml requirements.txt go.mod pom.xml 2>/dev/null ``` -------------------------------- ### Configure Frontend for Local Backend Source: https://github.com/eigent-ai/eigent/blob/main/server/README_EN.md Configure your frontend application to use the local Eigen-ai backend by setting specific environment variables in `.env.development`. ```bash VITE_BASE_URL=/api VITE_USE_LOCAL_PROXY=true VITE_PROXY_URL=http://localhost:3001 ``` -------------------------------- ### Log Mock State for Debugging Source: https://github.com/eigent-ai/eigent/blob/main/test/README.md Provides examples of how to log the current state of mock objects for the Electron API and environment, aiding in debugging test failures. ```typescript // Log current mock state console.log('Electron API State:', electronAPI.mockState); console.log('Environment State:', mockEnv.mockState); // Check what functions were called console.log( 'checkAndInstallDepsOnUpdate calls:', electronAPI.checkAndInstallDepsOnUpdate.mock.calls ); ``` -------------------------------- ### Initialize Amplitude with Session Replay Plugin Source: https://github.com/eigent-ai/eigent/blob/main/index.html Initializes Amplitude analytics and adds the session replay plugin. Configure with your Amplitude API key and enable element interactions for autocapture. ```javascript window.amplitude.add(window.sessionReplay.plugin({sampleRate: 1}));window.amplitude.init('87ce6adbb14b24ffe1703d18bf405e40', {"autocapture":{"elementInteractions":true}}); ``` -------------------------------- ### Electron API Test Scenarios Source: https://github.com/eigent-ai/eigent/blob/main/test/README.md Predefined scenarios for testing various Electron API interactions during installation flows. Use these to quickly set up common or edge-case states. ```typescript // Fresh installation - no .venv, no version file TestScenarios.freshInstall(electronAPI); // Version update - version file exists but version changed TestScenarios.versionUpdate(electronAPI); // .venv removed - version file exists but .venv is missing TestScenarios.venvRemoved(electronAPI); // Installation in progress - when user opens app during installation TestScenarios.installationInProgress(electronAPI); // Installation error scenario TestScenarios.installationError(electronAPI); // Uvicorn startup with dependency installation TestScenarios.uvicornDepsInstall(electronAPI); // All good - no installation needed TestScenarios.allGood(electronAPI); ``` -------------------------------- ### Using the Host Abstraction Layer Source: https://github.com/eigent-ai/eigent/blob/main/src/host/README.md Import and use the `useHost` hook to access host functionalities. Check for specific environment APIs like `electronAPI` before calling them, as they might be null in Web environments. ```tsx import { useHost } from '@/host'; function MyComponent() { const host = useHost(); // host.electronAPI / host.ipcRenderer 在 Web 下为 null if (host?.electronAPI?.someMethod) { host.electronAPI.someMethod(); } } ``` -------------------------------- ### MCP Server Configuration JSON Source: https://github.com/eigent-ai/eigent/blob/main/backend/benchmark/README.md This JSON payload configures an MCP server, specifying the environment file for credentials and the details for the installed MCP server, such as the command and arguments. ```json { "data": { "name": "1", "question": "List all Notion pages", "env": { "env_file": "benchmark/envs/1.env", "installed_mcp": { "mcpServers": { "notion": { "command": "npx", "args": ["@modelcontextprotocol/server-notion"] } } } } }, "tests": { "checker": ["benchmark/checker/1.py"] } } ``` -------------------------------- ### Benchmark Results CSV Format Source: https://github.com/eigent-ai/eigent/blob/main/backend/benchmark/README.md Example format of the results CSV file generated after benchmarks complete. It includes benchmark name, model, type, script, and result. ```csv benchmark,model,type,script,result 0,openai/gpt-5.2,checker,benchmark/checker/0.py,FAIL 0,openai/gpt-5.2,grader,benchmark/grader/0.py,7/7 ```