### Clone Repository and Install Dependencies (Development Setup) Source: https://aiderdesk.hotovo.com/docs/index This section outlines the initial steps for setting up the AiderDesk development environment. It involves cloning the project repository from GitHub and installing the necessary Node.js dependencies using npm. ```shell # Clone the repository $ git clone https://github.com/hotovo/aider-desk.git $ cd aider-desk # Install dependencies $ npm install ``` -------------------------------- ### Start Project and Run Prompt with cURL Source: https://aiderdesk.hotovo.com/docs/features/rest-api Provides command-line examples using cURL to interact with the Aiderdesk API for starting a project and running a prompt. These examples demonstrate sending JSON payloads with POST requests to the respective API endpoints. They are useful for testing API functionality directly from the terminal. ```bash # Start a project curl -X POST http://localhost:24337/api/project/start \ -H "Content-Type: application/json" \ -d '{"projectDir": "/path/to/project"}' # Run a prompt curl -X POST http://localhost:24337/api/run-prompt \ -H "Content-Type: application/json" \ -d '{ "projectDir": "/path/to/project", "prompt": "Create a hello world function", "mode": "code" }' ``` -------------------------------- ### Start Development Server (Development Setup) Source: https://aiderdesk.hotovo.com/docs/index This command initiates the development server for AiderDesk. It allows developers to run the application in development mode, facilitating rapid iteration and debugging during the development process. ```shell # Run in development mode $ npm run dev ``` -------------------------------- ### Manage AiderDesk Projects (TypeScript) Source: https://aiderdesk.hotovo.com/docs/features/browser-api Provides TypeScript examples for managing AiderDesk projects. Includes starting a new project, stopping a running project, and retrieving a list of all currently open projects. ```typescript // Starts a new AiderDesk project. await api.startProject('/path/to/project'); // Stops a running project. await api.stopProject('/path/to/project'); // Retrieves all open projects. const projects = await api.getOpenProjects(); console.log('Open projects:', projects.length); ``` -------------------------------- ### AiderDesk Integration Example (JavaScript) Source: https://aiderdesk.hotovo.com/docs/features/browser-api A comprehensive example demonstrating how to integrate with AiderDesk using the Browser API. It covers initialization, setting up event listeners, running prompts, managing files, executing commands, and cleanup. ```javascript import { BrowserApi } from './browser-api'; class AiderDeskIntegration { constructor() { this.api = new BrowserApi(); this.currentProject = null; } async initialize(projectPath) { await this.api.initialize(); // Start the project await this.api.startProject(projectPath); this.currentProject = projectPath; // Setup real-time listeners this.setupEventListeners(); } setupEventListeners() { // Response streaming this.api.addResponseChunkListener(this.currentProject, (data) => { this.onResponseChunk(data); }); // Response completion this.api.addResponseCompletedListener(this.currentProject, (data) => { this.onResponseComplete(data); }); // Context updates this.api.addContextFilesUpdatedListener(this.currentProject, (data) => { this.onContextUpdate(data); }); // Error handling this.api.addLogListener(this.currentProject, (data) => { if (data.level === 'error') { this.onError(data); } }); } async runPrompt(prompt, mode = 'code') { try { await this.api.runPrompt(this.currentProject, prompt, mode); } catch (error) { console.error('Failed to run prompt:', error); throw error; } } async addFileToContext(filePath) { await this.api.addFile(this.currentProject, filePath); } async executeCommand(command) { await this.api.runCommand(this.currentProject, command); } // Event handlers onResponseChunk(data) { // Handle streaming response console.log('AI:', data.chunk); } onResponseComplete(data) { // Handle completion console.log('Response complete. Usage:', data.usage); } onContextUpdate(data) { // Handle context changes console.log('Context updated:', data.contextFiles.length, 'files'); } onError(data) { // Handle errors console.error('Error:', data.message); } async cleanup() { if (this.currentProject) { await this.api.stopProject(this.currentProject); } } } // Usage const integration = new AiderDeskIntegration(); await integration.initialize('/path/to/my/project'); await integration.runPrompt('Create a user authentication system'); ``` -------------------------------- ### Build Executables with npm (Development Setup) Source: https://aiderdesk.hotovo.com/docs/index These commands are used to build executable versions of the AiderDesk application for different operating systems. They are part of the development setup process, allowing developers to create distributable applications from the source code. ```shell # Build executables # For Windows $ npm run build:win # For macOS $ npm run build:mac # For Linux $ npm run build:linux ``` -------------------------------- ### Install Browser API Dependencies Source: https://aiderdesk.hotovo.com/docs/features/browser-api Installs the necessary npm packages for using the Browser API, including axios for HTTP requests, socket.io-client for real-time communication, and uuid for generating unique identifiers. ```bash npm install axios socket.io-client uuid ``` -------------------------------- ### Get Addable Files Request (AiderDesk API) Source: https://aiderdesk.hotovo.com/docs/features/rest-api Example JSON request body for fetching a list of files within a project that can be added to the AiderDesk context. It takes the project directory and an optional search regex for filtering files. ```json { "projectDir": "/path/to/your/project", "searchRegex": ".*\\.ts$" } ``` -------------------------------- ### Subagent System Prompt Example Source: https://aiderdesk.hotovo.com/docs/agent-mode/subagents This example demonstrates a system prompt for a senior code reviewer subagent. It outlines the subagent's role, specific actions to take upon invocation (like running git diff and focusing on modified files), and a detailed review checklist covering code quality, security, and best practices. ```text You are a senior code reviewer ensuring high standards of code quality and security. When invoked: 1. Run git diff to see recent changes 2. Focus on modified files 3. Begin review immediately Review checklist: - Code is simple and readable - Functions and variables are well-named - No duplicated code - Proper error handling - No exposed secrets or API keys - Input validation implemented - Good test coverage - Performance considerations addressed ``` -------------------------------- ### Get Context Files Request (AiderDesk API) Source: https://aiderdesk.hotovo.com/docs/features/rest-api Example JSON request body for retrieving all files currently within the AiderDesk project's context. Only the project directory is required as a parameter. The response will contain an array of context files. ```json { "projectDir": "/path/to/your/project" } ``` -------------------------------- ### Install New Package (Bash) Source: https://aiderdesk.hotovo.com/docs/advanced/extra-python-packages Demonstrates how to install a new Python package, such as `scikit-learn`, into AiderDesk's environment by specifying it in the AIDER_DESK_EXTRA_PYTHON_PACKAGES variable. ```bash export AIDER_DESK_EXTRA_PYTHON_PACKAGES="scikit-learn" ``` -------------------------------- ### Project Management API Source: https://aiderdesk.hotovo.com/docs/features/browser-api Manage AiderDesk projects, including starting, stopping, and retrieving information about open projects. ```APIDOC ## POST /startProject ### Description Starts a new AiderDesk project in the specified directory. ### Method POST ### Endpoint `/startProject` ### Parameters #### Path Parameters - **baseDir** (string) - Required - The base directory of the project. ### Request Example ```javascript // Assuming 'api' is an instance of BrowserApi await api.startProject('/path/to/project'); ``` ## DELETE /stopProject ### Description Stops a running AiderDesk project. ### Method DELETE ### Endpoint `/stopProject` ### Parameters #### Path Parameters - **baseDir** (string) - Required - The base directory of the project to stop. ### Request Example ```javascript // Assuming 'api' is an instance of BrowserApi await api.stopProject('/path/to/project'); ``` ## GET /openProjects ### Description Retrieves a list of all currently open AiderDesk projects. ### Method GET ### Endpoint `/openProjects` ### Parameters None ### Response #### Success Response (200) - **projects** (array) - An array of ProjectData objects, each containing information about an open project. ### Response Example ```json { "projects": [ { "baseDir": "/path/to/project1", "name": "Project Alpha" }, { "baseDir": "/path/to/project2", "name": "Project Beta" } ] } ``` ``` -------------------------------- ### Combine Multiple Packages (Bash) Source: https://aiderdesk.hotovo.com/docs/advanced/extra-python-packages Shows how to install or override multiple Python packages simultaneously by providing a comma-separated list to the AIDER_DESK_EXTRA_PYTHON_PACKAGES environment variable. This includes specific versions and git repository installations. ```bash export AIDER_DESK_EXTRA_PYTHON_PACKAGES="scikit-learn==1.0.2,pandas,git+https://github.com/pygments/pygments.git@master" ``` -------------------------------- ### Start Project and Run Prompt with JavaScript/Node.js Source: https://aiderdesk.hotovo.com/docs/features/rest-api Demonstrates how to initiate a project and execute a prompt using the Aiderdesk API with Node.js and the axios library. This involves making POST requests to the '/project/start' and '/run-prompt' endpoints. It requires the 'axios' package for making HTTP requests. ```javascript const axios = require('axios'); const AIDER_API_BASE = 'http://localhost:24337/api'; // Start a project async function startProject(projectDir) { const response = await axios.post(`${AIDER_API_BASE}/project/start`, { projectDir: projectDir }); return response.data; } // Run a prompt async function runPrompt(projectDir, prompt) { const response = await axios.post(`${AIDER_API_BASE}/run-prompt`, { projectDir: projectDir, prompt: prompt, mode: 'code' }); return response.data; } // Usage const projectDir = '/path/to/my/project'; await startProject(projectDir); const result = await runPrompt(projectDir, 'Create a hello world function'); ``` -------------------------------- ### Specify Aider Version from Local Path (Windows) Source: https://aiderdesk.hotovo.com/docs/advanced/custom-aider-version Example of setting the AIDER_DESK_AIDER_VERSION variable to install 'aider-chat' from a local directory clone on Windows. This is useful for testing local changes. Ensure the specified path contains a valid Aider setup.py or pyproject.toml file. ```cmd AIDER_DESK_AIDER_VERSION=C:\path\to\your\local\aider\clone ``` -------------------------------- ### Initialize and Use Browser API (TypeScript) Source: https://aiderdesk.hotovo.com/docs/features/browser-api Demonstrates basic usage of the Browser API in TypeScript. It covers initializing the API, connecting to AiderDesk, starting and running a project, executing a prompt, and listening for real-time AI response chunks. ```typescript import { BrowserApi } from './browser-api'; // Initialize the API const api = new BrowserApi(); // Connect to AiderDesk (default port 24337) await api.initialize(); // Start a project await api.startProject('/path/to/your/project'); // Run a prompt await api.runPrompt('/path/to/your/project', 'Create a hello world function'); // Listen to real-time events const unsubscribe = api.addResponseChunkListener('/path/to/your/project', (data) => { console.log('AI Response:', data.chunk); }); // Cleanup unsubscribe(); ``` -------------------------------- ### GET /api/project/settings Source: https://aiderdesk.hotovo.com/docs/features/rest-api Retrieves settings for a specific project. ```APIDOC ## GET /api/project/settings ### Description Retrieves settings for a specific project. ### Method GET ### Endpoint `/api/project/settings` ### Parameters #### Query Parameters - **projectDir** (string) - Required - The directory of the project whose settings are to be retrieved. ### Response #### Success Response (200 OK) - Returns the project settings object. #### Response Example (Returns project settings object) ``` -------------------------------- ### Answer Question Request (AiderDesk API) Source: https://aiderdesk.hotovo.com/docs/features/rest-api Example JSON request body for submitting an answer to a question posed by the AI within AiderDesk. Requires the project directory and the answer content. ```json { "projectDir": "/path/to/your/project", "answer": "React" } ``` -------------------------------- ### Project Management API Source: https://aiderdesk.hotovo.com/docs/features/rest-api Endpoints for managing AiderDesk projects, including starting, stopping, and retrieving project information. ```APIDOC ## GET /api/projects ### Description Retrieves all open projects managed by AiderDesk. ### Method GET ### Endpoint /api/projects ### Response #### Success Response (200) - **projects** (array) - An array of open projects. ## POST /api/project/start ### Description Starts a new AiderDesk project in the specified directory. ### Method POST ### Endpoint /api/project/start ### Parameters #### Request Body - **projectDir** (string) - Required - The absolute path to the project directory to start. ### Request Example ```json { "projectDir": "/path/to/your/project" } ``` ### Response #### Success Response (200) - **message** (string) - Confirmation message. #### Response Example ```json { "message": "Project started" } ``` ## POST /api/project/stop ### Description Stops a running AiderDesk project. ### Method POST ### Endpoint /api/project/stop ### Parameters #### Request Body - **projectDir** (string) - Required - The absolute path to the project directory to stop. ### Request Example ```json { "projectDir": "/path/to/your/project" } ``` ### Response #### Success Response (200) - **message** (string) - Confirmation message. #### Response Example ```json { "message": "Project stopped" } ``` ``` -------------------------------- ### Configure Puppeteer MCP Server for Web Browsing Source: https://aiderdesk.hotovo.com/docs/agent-mode/mcp-servers This JSON configuration sets up a Puppeteer-based MCP server for web browsing capabilities. It specifies the command to run (`npx`) and the package to install and execute (`@modelcontextprotocol/server-puppeteer`). ```json { "mcpServers": { "puppeteer": { "command": "npx", "args": [ "-y", "@modelcontextprotocol/server-puppeteer" ] } } } ``` -------------------------------- ### Run Prompt Request (AiderDesk API) Source: https://aiderdesk.hotovo.com/docs/features/rest-api Example JSON request body for executing an AI prompt within a specified AiderDesk project. It includes the project directory, the prompt text, and the desired mode (e.g., 'code'). ```json { "projectDir": "/path/to/your/project", "prompt": "Create a user authentication system", "mode": "code" } ``` -------------------------------- ### Specify Aider Version from Local Path (Linux/macOS) Source: https://aiderdesk.hotovo.com/docs/advanced/custom-aider-version Example of setting the AIDER_DESK_AIDER_VERSION variable to install 'aider-chat' from a local directory clone on Linux or macOS. This allows testing local modifications. The path must point to a valid Aider source directory with setup.py or pyproject.toml. ```shell AIDER_DESK_AIDER_VERSION=/path/to/your/local/aider/clone ``` -------------------------------- ### Execute Prompts with AiderDesk API (TypeScript) Source: https://aiderdesk.hotovo.com/docs/features/browser-api Illustrates how to execute AI prompts using the Browser API. Examples show running a simple prompt and executing a prompt with a specified mode. ```typescript // Simple prompt await api.runPrompt('/path/to/project', 'Create a login component'); // With specific mode await api.runPrompt('/path/to/project', 'Review this code', 'ask'); // Re-executes the last user prompt with optional modifications. await api.redoLastUserPrompt('/path/to/project', 'code', 'Add error handling'); ``` -------------------------------- ### Get Project Settings API Source: https://aiderdesk.hotovo.com/docs/features/rest-api Retrieves settings for a specific project via the GET /api/project/settings endpoint. The project directory is provided as a query parameter. The endpoint returns a 200 OK status with the project settings object. ```HTTP GET /api/project/settings?projectDir=/path/to/project ``` -------------------------------- ### Project-specific Langfuse Configuration (.env file) Source: https://aiderdesk.hotovo.com/docs/advanced/open-telemetry Sets Langfuse API keys and host for a specific AiderDesk project by creating a `.env` file in the project's root directory. AiderDesk automatically loads these variables, providing granular control over configuration for different projects. This method isolates environment variables to the project scope. ```dotenv LANGFUSE_PUBLIC_KEY="pk_YOUR_PUBLIC_KEY" LANGFUSE_SECRET_KEY="sk_YOUR_SECRET_KEY" LANGFUSE_HOST="https://cloud.langfuse.com" ``` -------------------------------- ### GET /api/settings Source: https://aiderdesk.hotovo.com/docs/features/rest-api Retrieves the global application settings. ```APIDOC ## GET /api/settings ### Description Retrieves application settings. ### Method GET ### Endpoint `/api/settings` ### Response #### Success Response (200 OK) - Returns the application settings object. #### Response Example (returns settings object) ``` -------------------------------- ### Configure Aider Settings with .aider.conf.yml Source: https://aiderdesk.hotovo.com/docs/configuration/aider-configuration Defines project-specific or global settings for Aider using a YAML configuration file. This allows customization of the AI model, editing format, and automation features like auto-commits. ```yaml model: openai/gpt-4.1 weak-model: openai/gpt-4o-mini edit-format: diff auto-commits: false ``` -------------------------------- ### Specify Aider Version from Git Repository Commit Hash Source: https://aiderdesk.hotovo.com/docs/advanced/custom-aider-version Example of setting the AIDER_DESK_AIDER_VERSION variable to install 'aider-chat' from a specific commit hash in a Git repository. This provides precise control for testing exact code states. Replace the placeholder URL and commit hash accordingly. ```shell AIDER_DESK_AIDER_VERSION=git+https://github.com/user/aider.git@abcdef1234567890 ``` -------------------------------- ### Get Application Settings API Source: https://aiderdesk.hotovo.com/docs/features/rest-api Retrieves the current application settings using the GET /api/settings endpoint. This endpoint does not require a request body and returns a 200 OK status with the settings object. ```HTTP GET /api/settings ``` -------------------------------- ### Add Context File Request (AiderDesk API) Source: https://aiderdesk.hotovo.com/docs/features/rest-api Example JSON request body for adding a file to the AiderDesk project context. Requires the project directory path, file path, and a readOnly flag. The response indicates success. ```json { "projectDir": "/path/to/your/project", "path": "src/main.ts", "readOnly": false } ``` -------------------------------- ### AiderDesk Diff Format Example Source: https://aiderdesk.hotovo.com/docs/features/reviewing-code-changes This is the raw format AiderDesk uses internally to represent code changes before rendering them in the diff viewer. It clearly separates original code from new code. ```text <<<<<<< SEARCH // Original code to be replaced ======= // New code to insert >>>>>>> REPLACE ``` -------------------------------- ### Set Extra Python Packages (macOS/Linux) Source: https://aiderdesk.hotovo.com/docs/advanced/extra-python-packages Demonstrates how to set the AIDER_DESK_EXTRA_PYTHON_PACKAGES environment variable on macOS or Linux using the `export` command before launching AiderDesk. This allows for the installation of specific packages or versions. ```bash export AIDER_DESK_EXTRA_PYTHON_PACKAGES="package1,package2==1.2.3" ./AiderDesk-*.AppImage ``` -------------------------------- ### Redo Last User Prompt Request (AiderDesk API) Source: https://aiderdesk.hotovo.com/docs/features/rest-api Example JSON request body for re-executing the last user prompt in AiderDesk, with an option to provide an updated prompt. Requires the project directory and mode. ```json { "projectDir": "/path/to/your/project", "mode": "code", "updatedPrompt": "Add error handling to the authentication system" } ``` -------------------------------- ### Set Extra Python Packages (Windows Command Prompt) Source: https://aiderdesk.hotovo.com/docs/advanced/extra-python-packages Shows how to set the AIDER_DESK_EXTRA_PYTHON_PACKAGES environment variable in the Windows Command Prompt using the `set` command. This enables custom package installations for AiderDesk. ```batch set AIDER_DESK_EXTRA_PYTHON_PACKAGES="package1,package2==1.2.3" AiderDesk.exe ``` -------------------------------- ### Manage Sessions with AiderDesk API (TypeScript) Source: https://aiderdesk.hotovo.com/docs/features/browser-api Provides examples for session management in AiderDesk using the Browser API. Covers saving the current session, listing all saved sessions, and loading session messages. ```typescript // Saves the current session. const success = await api.saveSession('/path/to/project', 'feature-login'); // Lists all saved sessions. const sessions = await api.listSessions('/path/to/project'); // Loads session messages. await api.loadSessionMessages('/path/to/project', 'feature-login'); ``` -------------------------------- ### GET /api/models Source: https://aiderdesk.hotovo.com/docs/features/rest-api Retrieves information about available AI models. ```APIDOC ## GET /api/models ### Description Retrieves information about available AI models. ### Method GET ### Endpoint `/api/models` ### Response #### Success Response (200 OK) - Returns an object containing information about available AI models. #### Response Example (returns models info object) ``` -------------------------------- ### GET /api/system/env-var Source: https://aiderdesk.hotovo.com/docs/features/rest-api Retrieves the effective value of a system environment variable, potentially scoped to a project directory. ```APIDOC ## GET /api/system/env-var ### Description Retrieves the effective value of an environment variable. ### Method GET ### Endpoint `/api/system/env-var` ### Parameters #### Query Parameters - **key** (string) - Required - The name of the environment variable. - **baseDir** (string) - Optional - The base directory to resolve the environment variable from, if project-specific resolution is needed. ### Response #### Success Response (200 OK) - Returns an object containing the environment variable's key and its effective value. #### Response Example (returns environment variable object) ``` -------------------------------- ### Override Dependency with Git Repository (Bash) Source: https://aiderdesk.hotovo.com/docs/advanced/extra-python-packages Example of overriding Aider's `Pygments` dependency with the latest version directly from its GitHub repository using the `git+https` URL format. This is achieved by setting the AIDER_DESK_EXTRA_PYTHON_PACKAGES variable. ```bash export AIDER_DESK_EXTRA_PYTHON_PACKAGES="git+https://github.com/pygments/pygments.git@master" ``` -------------------------------- ### Setting Langfuse Environment Variables (Windows PowerShell) Source: https://aiderdesk.hotovo.com/docs/advanced/open-telemetry Configures Langfuse API keys and host as system-wide environment variables in Windows using PowerShell. This method sets the variables for the current session and can be made permanent through system properties. Ensure to restart AiderDesk for changes to take effect. ```powershell $env:LANGFUSE_PUBLIC_KEY="pk_YOUR_PUBLIC_KEY" $env:LANGFUSE_SECRET_KEY="sk_YOUR_SECRET_KEY" $env:LANGFUSE_HOST="https://cloud.langfuse.com" ``` -------------------------------- ### Setting Langfuse Environment Variables (Linux/macOS) Source: https://aiderdesk.hotovo.com/docs/advanced/open-telemetry Configures Langfuse API keys and host as system-wide environment variables in Linux or macOS by adding them to shell configuration files like .bashrc or .zshrc. This makes the variables globally available to applications. Ensure to restart the terminal or AiderDesk for changes to take effect. ```shell export LANGFUSE_PUBLIC_KEY="pk_YOUR_PUBLIC_KEY" export LANGFUSE_SECRET_KEY="sk_YOUR_SECRET_KEY" export LANGFUSE_HOST="https://cloud.langfuse.com" ``` -------------------------------- ### Set AIDER_DESK_AIDER_VERSION Environment Variable (Windows CMD) Source: https://aiderdesk.hotovo.com/docs/advanced/custom-aider-version Sets the AIDER_DESK_AIDER_VERSION environment variable for the current Command Prompt session on Windows. AiderDesk uses this to determine the 'aider-chat' package version for installation. Launch AiderDesk from the same Command Prompt session after setting the variable. ```cmd set AIDER_DESK_AIDER_VERSION="your_version_specifier" # Then launch AiderDesk from the same Command Prompt session ``` -------------------------------- ### Specify Specific Aider Version Number Source: https://aiderdesk.hotovo.com/docs/advanced/custom-aider-version Example of setting the AIDER_DESK_AIDER_VERSION variable to install a specific released version of the 'aider-chat' package. This method ensures a known stable version is used. Replace '0.36.1' with the desired version number. ```shell AIDER_DESK_AIDER_VERSION=0.36.1 ``` -------------------------------- ### Specify Aider Version from Git Repository Branch Source: https://aiderdesk.hotovo.com/docs/advanced/custom-aider-version Example of setting the AIDER_DESK_AIDER_VERSION variable to install 'aider-chat' from a specific branch in a Git repository. This is useful for testing features under development. Ensure to replace the placeholder URL and branch name with actual values. ```shell AIDER_DESK_AIDER_VERSION=git+https://github.com/user/aider.git@my-feature-branch ``` -------------------------------- ### Settings and Configuration API Source: https://aiderdesk.hotovo.com/docs/features/browser-api Load and save application-wide and project-specific settings. ```APIDOC ## GET /loadSettings ### Description Loads the global application settings. ### Method GET ### Endpoint `/loadSettings` ### Parameters None ### Response #### Success Response (200) - **settings** (object) - An object containing the application settings (SettingsData). ### Response Example ```json { "theme": "dark", "fontSize": 14 } ``` ## POST /saveSettings ### Description Saves the provided application settings. ### Method POST ### Endpoint `/saveSettings` ### Parameters #### Request Body - **settings** (object) - Required - The new settings object (SettingsData) to save. ### Response #### Success Response (200) - **settings** (object) - The updated settings object. ### Request Example ```javascript const newSettings = { theme: 'light', fontSize: 16 }; const updatedSettings = await api.saveSettings(newSettings); ``` ## GET /projectSettings ### Description Retrieves the settings specific to a given project. ### Method GET ### Endpoint `/projectSettings` ### Parameters #### Path Parameters - **baseDir** (string) - Required - The base directory of the project. ### Response #### Success Response (200) - **projectSettings** (object) - An object containing the project-specific settings (ProjectSettings). ### Response Example ```json { "language": "typescript", "lintingEnabled": true } ``` ``` -------------------------------- ### Manage Settings with AiderDesk API (TypeScript) Source: https://aiderdesk.hotovo.com/docs/features/browser-api Demonstrates how to manage application and project settings using the Browser API. Includes loading general settings, saving updated settings, and retrieving project-specific settings. ```typescript // Loads application settings. const settings = await api.loadSettings(); // Saves application settings. const updatedSettings = await api.saveSettings(newSettings); // Gets project-specific settings. const projectSettings = await api.getProjectSettings('/path/to/project'); ``` -------------------------------- ### Configure Custom MCP Server with Project Directory Variable Source: https://aiderdesk.hotovo.com/docs/agent-mode/mcp-servers This JSON configuration demonstrates how to set up a custom MCP server, utilizing the `${projectDir}` placeholder within the arguments. AiderDesk will automatically resolve this placeholder to the absolute path of the current project directory. ```json { "mcpServers": { "my-custom-tool": { "command": "node", "args": [ "/path/to/my/tool.js", "--project-root", "${projectDir}" ] } } } ``` -------------------------------- ### Get Models Info API Source: https://aiderdesk.hotovo.com/docs/features/rest-api Retrieves information about available AI models. This is done using the GET /api/models endpoint, which returns a 200 OK status along with the models information object. ```HTTP GET /api/models ``` -------------------------------- ### POST /api/project/restart Source: https://aiderdesk.hotovo.com/docs/features/rest-api Restarts a project with an optional startup mode. ```APIDOC ## POST /api/project/restart ### Description Restarts a project with optional mode. ### Method POST ### Endpoint `/api/project/restart` ### Parameters #### Request Body - **projectDir** (string) - Required - The directory of the project to restart. - **startupMode** (string) - Optional - The startup mode for the project (e.g., "architect"). ### Request Example ```json { "projectDir": "/path/to/your/project", "startupMode": "architect" } ``` ### Response #### Success Response (200 OK) - **message** (string) - A confirmation message indicating the project has been restarted. #### Response Example ```json { "message": "Project restarted" } ``` ``` -------------------------------- ### POST /api/mcp/tools Source: https://aiderdesk.hotovo.com/docs/features/rest-api Loads tools from an MCP (Model Context Protocol) server with specified configuration. ```APIDOC ## POST /api/mcp/tools ### Description Loads tools from an MCP server. ### Method POST ### Endpoint `/api/mcp/tools` ### Parameters #### Request Body - **serverName** (string) - Required - The name of the MCP server. - **config** (object) - Required - The configuration for the MCP server. - **command** (string) - Required - The command to execute for the server. - **args** (array) - Required - An array of arguments for the command. ### Request Example ```json { "serverName": "filesystem", "config": { "command": "npx", "args": ["-y", "@modelcontextprotocol/server-filesystem", "/tmp"] } } ``` ### Response #### Success Response (200 OK) - Returns an array of tools loaded from the MCP server. #### Response Example (returns tools array) ``` -------------------------------- ### Get Effective Environment Variable API Source: https://aiderdesk.hotovo.com/docs/features/rest-api Retrieves the effective value of an environment variable for a project. The GET /api/system/env-var endpoint requires the variable key and the base directory as query parameters. It returns a 200 OK status with the environment variable object. ```HTTP GET /api/system/env-var?key=OPENAI_API_KEY&baseDir=/path/to/project ``` -------------------------------- ### Connect and Subscribe to SocketIO Events in JavaScript Source: https://aiderdesk.hotovo.com/docs/features/socketio-events This snippet demonstrates how to establish a connection to the AiderDesk SocketIO server using the 'socket.io-client' library. It shows how to subscribe to multiple event types including 'response-chunk', 'response-completed', 'log', and 'context-files-updated'. Ensure the SocketIO server is running on the specified port. ```javascript import io from 'socket.io-client'; // Connect to AiderDesk const socket = io('http://localhost:24337', { autoConnect: true, forceNew: true, }); // Subscribe to events socket.on('connect', () => { socket.emit('message', { action: 'subscribe-events', eventTypes: ['response-chunk', 'response-completed', 'log', 'context-files-updated'] }); }); ``` -------------------------------- ### GET /api/project/sessions Source: https://aiderdesk.hotovo.com/docs/features/rest-api Lists all saved sessions for a specific project. ```APIDOC ## GET /api/project/sessions ### Description Lists all saved sessions for a project. ### Method GET ### Endpoint `/api/project/sessions` ### Parameters #### Query Parameters - **projectDir** (string) - Required - The directory of the project to list sessions for. ### Response #### Success Response (200 OK) - Returns an array of saved sessions. #### Response Example (returns sessions array) ``` -------------------------------- ### Configure AiderDesk MCP Server for macOS Source: https://aiderdesk.hotovo.com/docs/features/aider-mcp-server This JSON configuration snippet is for setting up AiderDesk as an MCP server in your MCP client's settings on macOS. It defines the Node.js executable, necessary arguments including the AiderDesk MCP server script path and project directory, and environment variables. Replace '/path/to/home' with your home directory path. ```json { "mcpServers": { "aider-desk": { "command": "node", "args": ["/path/to/home/Library/Application Support/aider-desk/mcp-server/aider-desk-mcp-server.js", "/path/to/project"], "env": { "AIDER_DESK_API_BASE_URL": "http://localhost:24337/api" } } } } ``` -------------------------------- ### GET /api/usage Source: https://aiderdesk.hotovo.com/docs/features/rest-api Retrieves usage data for a specified date range. ```APIDOC ## GET /api/usage ### Description Retrieves usage data for a specific date range. ### Method GET ### Endpoint `/api/usage` ### Parameters #### Query Parameters - **from** (string) - Required - The start date for the usage data query (YYYY-MM-DD). - **to** (string) - Required - The end date for the usage data query (YYYY-MM-DD). ### Response #### Success Response (200 OK) - Returns an array of usage data objects. #### Response Example (returns usage data array) ``` -------------------------------- ### Commands and Execution API Source: https://aiderdesk.hotovo.com/docs/features/browser-api Execute shell commands and custom commands within the project environment. ```APIDOC ## POST /runCommand ### Description Executes a standard shell command within the project's environment. ### Method POST ### Endpoint `/runCommand` ### Parameters #### Path Parameters - **baseDir** (string) - Required - The base directory of the project. - **command** (string) - Required - The shell command to execute. ### Request Example ```javascript await api.runCommand('/path/to/project', 'npm install'); ``` ## GET /customCommands ### Description Retrieves a list of all available custom commands configured for the project. ### Method GET ### Endpoint `/customCommands` ### Parameters #### Path Parameters - **baseDir** (string) - Required - The base directory of the project. ### Response #### Success Response (200) - **commands** (array) - An array of CustomCommand objects, each detailing an available custom command. ### Response Example ```json { "commands": [ { "name": "format-code", "description": "Formats code files" }, { "name": "lint", "description": "Runs code linting" } ] } ``` ## POST /runCustomCommand ### Description Executes a custom command defined for the project. ### Method POST ### Endpoint `/runCustomCommand` ### Parameters #### Path Parameters - **baseDir** (string) - Required - The base directory of the project. - **commandName** (string) - Required - The name of the custom command to execute. - **args** (array) - Required - An array of string arguments to pass to the command. - **mode** (string) - Required - The mode in which to run the custom command. ### Request Example ```javascript await api.runCustomCommand('/path/to/project', 'format-code', ['src/'], 'code'); ``` ``` -------------------------------- ### Prompt Execution API Source: https://aiderdesk.hotovo.com/docs/features/browser-api Execute AI prompts within a specified project and manage prompt execution flow. ```APIDOC ## POST /runPrompt ### Description Executes an AI prompt in the specified project. ### Method POST ### Endpoint `/runPrompt` ### Parameters #### Path Parameters - **baseDir** (string) - Required - The base directory of the project. - **prompt** (string) - Required - The AI prompt to execute. - **mode** (string) - Optional - The mode for prompt execution (e.g., 'code', 'ask'). ### Request Example ```javascript // Simple prompt await api.runPrompt('/path/to/project', 'Create a login component'); // With specific mode await api.runPrompt('/path/to/project', 'Review this code', 'ask'); ``` ## POST /redoLastUserPrompt ### Description Re-executes the last user prompt, optionally with updated prompt text. ### Method POST ### Endpoint `/redoLastUserPrompt` ### Parameters #### Path Parameters - **baseDir** (string) - Required - The base directory of the project. - **mode** (string) - Required - The mode of the previous prompt execution. - **updatedPrompt** (string) - Optional - Modified prompt text for re-execution. ### Request Example ```javascript await api.redoLastUserPrompt('/path/to/project', 'code', 'Add error handling'); ``` ``` -------------------------------- ### POST /api/project/run-command Source: https://aiderdesk.hotovo.com/docs/features/rest-api Executes a shell command within the context of a specified project directory. ```APIDOC ## POST /api/project/run-command ### Description Executes a shell command in the project. ### Method POST ### Endpoint `/api/project/run-command` ### Parameters #### Request Body - **projectDir** (string) - Required - The directory of the project where the command should be executed. - **command** (string) - Required - The shell command to execute. ### Request Example ```json { "projectDir": "/path/to/project", "command": "npm install" } ``` ### Response #### Success Response (200 OK) - **message** (string) - A confirmation message indicating the command execution status. #### Response Example ```json { "message": "Command executed" } ``` ``` -------------------------------- ### Context Management API Source: https://aiderdesk.hotovo.com/docs/features/browser-api Manage the context of a project by adding or removing files and retrieving addable files. ```APIDOC ## POST /addFile ### Description Adds a file to the project's context, making it available for AI processing. ### Method POST ### Endpoint `/addFile` ### Parameters #### Path Parameters - **baseDir** (string) - Required - The base directory of the project. - **filePath** (string) - Required - The path to the file to add. - **readOnly** (boolean) - Optional - Specifies if the file should be added in read-only mode. Defaults to false. ### Request Example ```javascript await api.addFile('/path/to/project', 'src/main.ts'); await api.addFile('/path/to/project', 'config.json', true); // Read-only ``` ## DELETE /dropFile ### Description Removes a file from the project's context. ### Method DELETE ### Endpoint `/dropFile` ### Parameters #### Path Parameters - **baseDir** (string) - Required - The base directory of the project. - **path** (string) - Required - The path of the file to remove from context. ### Request Example ```javascript await api.dropFile('/path/to/project', 'src/utils.ts'); ``` ## GET /addableFiles ### Description Retrieves a list of all files within the project directory that can be added to the context. ### Method GET ### Endpoint `/addableFiles` ### Parameters #### Path Parameters - **baseDir** (string) - Required - The base directory of the project. ### Response #### Success Response (200) - **files** (array) - An array of strings, where each string is the path to an addable file. ### Response Example ```json { "files": [ "src/index.js", "src/components/Button.js" ] } ``` ``` -------------------------------- ### Set Extra Python Packages (Windows PowerShell) Source: https://aiderdesk.hotovo.com/docs/advanced/extra-python-packages Illustrates how to set the AIDER_DESK_EXTRA_PYTHON_PACKAGES environment variable in Windows PowerShell using the `$env:` scope modifier. This facilitates the installation of additional Python libraries for AiderDesk. ```powershell $env:AIDER_DESK_EXTRA_PYTHON_PACKAGES="package1,package2==1.2.3" .\AiderDesk.exe ``` -------------------------------- ### Execute Commands with AiderDesk API (TypeScript) Source: https://aiderdesk.hotovo.com/docs/features/browser-api Shows how to execute shell commands and custom commands within an AiderDesk project using the Browser API. Includes running a standard shell command, retrieving custom commands, and executing a custom command with arguments. ```typescript // Executes a shell command in the project. await api.runCommand('/path/to/project', 'npm install'); // Retrieves available custom commands. const commands = await api.getCustomCommands('/path/to/project'); // Executes a custom command. await api.runCustomCommand('/path/to/project', 'format-code', ['src/'], 'code'); ``` -------------------------------- ### Configure AiderDesk MCP Server for Windows Source: https://aiderdesk.hotovo.com/docs/features/aider-mcp-server This JSON configuration snippet sets up AiderDesk as an MCP server within your MCP client's settings for Windows. It specifies the Node.js command, arguments including the path to the AiderDesk MCP server script and the project directory, and environment variables like the API base URL. Ensure 'path-to-appdata' is replaced with your actual AppData directory path. ```json { "mcpServers": { "aider-desk": { "command": "node", "args": ["path-to-appdata/aider-desk/mcp-server/aider-desk-mcp-server.js", "/path/to/project"], "env": { "AIDER_DESK_API_BASE_URL": "http://localhost:24337/api" } } } } ``` -------------------------------- ### List Sessions API Source: https://aiderdesk.hotovo.com/docs/features/rest-api Retrieves a list of all saved sessions for a given project. This is achieved through a GET request to /api/project/sessions, with the project directory specified as a query parameter. The response includes an array of sessions. ```HTTP GET /api/project/sessions?projectDir=/path/to/project ``` -------------------------------- ### Configure AiderDesk MCP Server for Linux Source: https://aiderdesk.hotovo.com/docs/features/aider-mcp-server This JSON configuration allows you to set up AiderDesk as an MCP server for your MCP client on Linux systems. It specifies the Node.js command, arguments for the server script and project path, and environment variables. Users must replace '/path/to/home' with their actual home directory path. ```json { "mcpServers": { "aider-desk": { "command": "node", "args": ["/path/to/home/.config/aider-desk/mcp-server/aider-desk-mcp-server.js", "/path/to/project"], "env": { "AIDER_DESK_API_BASE_URL": "http://localhost:24337/api" } } } } ``` -------------------------------- ### Manage Project Context with AiderDesk API (TypeScript) Source: https://aiderdesk.hotovo.com/docs/features/browser-api Demonstrates context management within AiderDesk projects using the Browser API. Includes adding and dropping files from the project context, with an option for read-only files, and retrieving a list of addable files. ```typescript // Adds a file to the project's context. await api.addFile('/path/to/project', 'src/main.ts'); await api.addFile('/path/to/project', 'config.json', true); // Read-only // Removes a file from the project's context. await api.dropFile('/path/to/project', 'src/utils.ts'); // Gets all files that can be added to context. const files = await api.getAddableFiles('/path/to/project'); ``` -------------------------------- ### Configure Custom HTTP Client with Axios Source: https://aiderdesk.hotovo.com/docs/features/browser-api Shows how to create a custom BrowserApi instance with specific configurations using Axios. This includes setting the base URL, request timeout, and authorization headers for enhanced API interaction. ```javascript import axios from 'axios'; const customApi = new BrowserApi({ baseURL: 'http://localhost:3000/api', timeout: 30000, headers: { 'Authorization': 'Bearer token' } }); ``` -------------------------------- ### Query Usage Data API Source: https://aiderdesk.hotovo.com/docs/features/rest-api Retrieves usage data for a specified date range. Uses the GET /api/usage endpoint with 'from' and 'to' query parameters. Returns a 200 OK status with an array of usage data. ```HTTP GET /api/usage?from=2025-01-01&to=2025-01-31 ``` -------------------------------- ### Listen to System Events (JavaScript) Source: https://aiderdesk.hotovo.com/docs/features/browser-api Sets up listeners for system-level events, specifically logs and tool executions. It logs messages with their severity levels and the names of executed tools. ```javascript const unsubscribeLog = api.addLogListener('/path/to/project', (data) => { console.log(`[${data.level}] ${data.message}`); }); const unsubscribeTool = api.addToolListener('/path/to/project', (data) => { console.log('Tool executed:', data.toolName); }); ```