### System-Specific Package Installation Source: https://github.com/dngriffin/whispercode/blob/dev/packages/docs/ai-tools/cursor.mdx Commands to install Node.js and npm packages across macOS, Windows, and Linux environments. ```bash # macOS brew install node npm install -g package-name ``` ```powershell # Windows choco install nodejs npm install -g package-name ``` ```bash # Linux sudo apt install nodejs npm npm install -g package-name ``` -------------------------------- ### Request and Response Examples Source: https://github.com/dngriffin/whispercode/blob/dev/packages/docs/ai-tools/cursor.mdx Standard formats for documenting API request payloads and the corresponding successful JSON response structures. ```bash curl -X POST 'https://api.example.com/users' \ -H 'Content-Type: application/json' \ -d '{"name": "John Doe", "email": "john@example.com"}' ``` ```json { "id": "user_123", "name": "John Doe", "email": "john@example.com", "created_at": "2024-01-15T10:30:00Z" } ``` -------------------------------- ### Install Bun and Run Tauri Development Server Source: https://github.com/dngriffin/whispercode/blob/dev/packages/desktop/README.md Installs project dependencies using Bun and starts the Tauri development server for the desktop application. This command is executed from the repository root. ```bash bun install bun run --cwd packages/desktop tauri dev ``` -------------------------------- ### Perform API Requests Across Languages Source: https://github.com/dngriffin/whispercode/blob/dev/packages/docs/ai-tools/cursor.mdx Examples of how to execute a GET request to an API endpoint using Node.js, Python, and cURL. ```javascript const response = await fetch('/api/endpoint', { headers: { Authorization: `Bearer ${apiKey}` } }); ``` ```python import requests response = requests.get('/api/endpoint', headers={'Authorization': f'Bearer {api_key}'}) ``` ```bash curl -X GET '/api/endpoint' \ -H 'Authorization: Bearer YOUR_API_KEY' ``` -------------------------------- ### Opencode GitHub Action Installation Command Source: https://github.com/dngriffin/whispercode/blob/dev/github/README.md This command initiates the installation process for the Opencode GitHub Action directly from the terminal within a GitHub repository. It guides the user through installing the GitHub app, setting up the workflow, and configuring necessary secrets. ```bash opencode github install ``` -------------------------------- ### Card Component Examples (HTML/JSX) Source: https://github.com/dngriffin/whispercode/blob/dev/packages/docs/ai-tools/cursor.mdx Illustrates the use of Card components for highlighting information, with options for icons, links, and layouts. This includes single cards and card groups arranged in columns. ```html Complete walkthrough from installation to your first API call in under 10 minutes. Learn how to authenticate requests using API keys or JWT tokens. Understand rate limits and best practices for high-volume usage. ``` -------------------------------- ### Tooltip Component Example (HTML/JSX) Source: https://github.com/dngriffin/whispercode/blob/dev/packages/docs/ai-tools/cursor.mdx Illustrates the basic usage of the Tooltip component, showing how to attach descriptive text to an element that appears on hover. ```html API ``` -------------------------------- ### Environment Variable Configuration Source: https://github.com/dngriffin/whispercode/blob/dev/packages/docs/ai-tools/cursor.mdx Example snippet for defining environment variables within a documentation procedure. ```bash API_KEY=your_api_key_here ``` -------------------------------- ### Install and Run Mintlify CLI Source: https://github.com/dngriffin/whispercode/blob/dev/packages/docs/README.md Commands to install the Mintlify CLI globally and initiate a local development server. Prerequisites include a Node.js environment and a project directory containing a valid docs.json file. ```shell npm i -g mint ``` ```shell mint dev ``` -------------------------------- ### Install Opencode SDK Source: https://github.com/dngriffin/whispercode/blob/dev/packages/web/src/content/docs/sdk.mdx Installation instructions for the @opencode-ai/sdk package using npm. ```bash npm install @opencode-ai/sdk ``` -------------------------------- ### Define OpenCode configuration file structure Source: https://github.com/dngriffin/whispercode/blob/dev/packages/web/src/content/docs/config.mdx An example configuration file demonstrating the use of JSONC, including schema linking, model selection, and server port settings. ```jsonc { "$schema": "https://opencode.ai/config.json", "model": "anthropic/claude-sonnet-4-5", "autoupdate": true, "server": { "port": 4096 } } ``` -------------------------------- ### Accordion Component Example (JavaScript) Source: https://github.com/dngriffin/whispercode/blob/dev/packages/docs/ai-tools/cursor.mdx Demonstrates the usage of the Accordion component for creating collapsible content sections. It includes titles and expandable content areas, with one example showing advanced JavaScript configuration. ```javascript - **Firewall blocking**: Ensure ports 80 and 443 are open - **Proxy configuration**: Set HTTP_PROXY environment variable - **DNS resolution**: Try using 8.8.8.8 as DNS server ```javascript const config = { performance: { cache: true, timeout: 30000 }, security: { encryption: 'AES-256' } }; ``` ``` -------------------------------- ### Install SDK Source: https://github.com/dngriffin/whispercode/blob/dev/packages/web/src/content/docs/sdk.mdx Install the OpenAI SDK using npm. ```APIDOC ## Install SDK ### Description Install the SDK from npm. ### Method ```bash npm install @opencode-ai/sdk ``` ``` -------------------------------- ### Install OpenCode CLI for GitHub Source: https://github.com/dngriffin/whispercode/blob/dev/packages/web/src/content/docs/github.mdx Command to install the OpenCode GitHub integration. This command initiates an interactive setup process for the GitHub app, workflow creation, and secret configuration. ```bash opencode github install ``` -------------------------------- ### Create Opencode Client Instance Source: https://github.com/dngriffin/whispercode/blob/dev/packages/web/src/content/docs/sdk.mdx Initialize the opencode client to start a server and client instance or connect to an existing server. ```javascript import { createOpencode } from "@opencode-ai/sdk" const { client } = await createOpencode() ``` ```javascript import { createOpencodeClient } from "@opencode-ai/sdk" const client = createOpencodeClient({ baseUrl: "http://localhost:4096", }) ``` -------------------------------- ### Video Embedding (HTML) Source: https://github.com/dngriffin/whispercode/blob/dev/packages/docs/ai-tools/cursor.mdx Provides examples for embedding video content using the HTML video element for self-hosted videos and iframe elements for YouTube embeds. ```html ``` -------------------------------- ### Example .ignore file Source: https://github.com/dngriffin/whispercode/blob/dev/packages/web/src/content/docs/tools.mdx An example '.ignore' file demonstrating how to include files and directories that would normally be ignored by tools like 'grep' and 'glob' (which use ripgrep internally). This file explicitly allows specific paths. ```text !node_modules/ !dist/ !build/ ``` -------------------------------- ### API Response Field Documentation (HTML/JSX) Source: https://github.com/dngriffin/whispercode/blob/dev/packages/docs/ai-tools/cursor.mdx Demonstrates documenting API response fields using ResponseField components. Includes examples of basic fields, arrays, and expandable nested objects with their properties. ```html Unique identifier assigned to the newly created user. ISO 8601 formatted timestamp of when the user was created. List of permission strings assigned to this user. Complete user object with all associated data. User profile information including personal details. User's first name as entered during registration. URL to user's profile picture. Returns null if no avatar is set. ``` -------------------------------- ### Install Rust via rustup Source: https://github.com/dngriffin/whispercode/blob/dev/packages/desktop/README.md Installs the Rust toolchain using rustup, which is a prerequisite for building Tauri applications. This script is typically run in a Unix-like environment. ```bash curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh ``` -------------------------------- ### Create Opencode Client Source: https://github.com/dngriffin/whispercode/blob/dev/packages/web/src/content/docs/sdk.mdx Create an instance of the Opencode client, which starts both a server and a client. ```APIDOC ## Create Client ### Description Create an instance of opencode. This starts both a server and a client. ### Method ```javascript import { createOpencode } from "@opencode-ai/sdk" const { client } = await createOpencode() ``` ### Options | Option | Type | Description | Default | | ---------- | ------------- | ------------------------------ | ----------- | | `hostname` | `string` | Server hostname | `127.0.0.1` | | `port` | `number` | Server port | `4096` | | `signal` | `AbortSignal` | Abort signal for cancellation | `undefined` | | `timeout` | `number` | Timeout in ms for server start | `5000` | | `config` | `Config` | Configuration object | `{}` | ``` -------------------------------- ### Configure instructions Source: https://github.com/dngriffin/whispercode/blob/dev/packages/web/src/content/docs/config.mdx Defines custom instruction files or glob patterns that the model should reference to guide its output. ```json { "$schema": "https://opencode.ai/config.json", "instructions": ["CONTRIBUTING.md", "docs/guidelines.md", ".cursor/rules/*.md"] } ``` -------------------------------- ### Define MCP server settings in remote and local configs Source: https://github.com/dngriffin/whispercode/blob/dev/packages/web/src/content/docs/config.mdx Example showing how to define an MCP server in a remote configuration and subsequently override the 'enabled' status in a local project configuration. ```json { "mcp": { "jira": { "type": "remote", "url": "https://jira.example.com/mcp", "enabled": false } } } ``` ```json { "mcp": { "jira": { "type": "remote", "url": "https://jira.example.com/mcp", "enabled": true } } } ``` -------------------------------- ### Install Agents SDK Package Source: https://github.com/dngriffin/whispercode/blob/dev/packages/opencode/test/fixture/skills/agents-sdk/SKILL.md Demonstrates how to check if the 'agents' package is installed using npm and how to install it if it's missing. This is the first step before configuring and using the SDK. ```bash npm ls agents npm install agents ``` -------------------------------- ### Configure API Settings Source: https://github.com/dngriffin/whispercode/blob/dev/packages/docs/ai-tools/cursor.mdx A configuration snippet for an API client, demonstrating how to securely manage headers and environment variables. ```javascript const apiConfig = { baseURL: "https://api.example.com", timeout: 5000, headers: { Authorization: `Bearer ${process.env.API_TOKEN}`, }, } ``` -------------------------------- ### Example: Configure '@modelcontextprotocol/server-everything' Local MCP Server Source: https://github.com/dngriffin/whispercode/blob/dev/packages/web/src/content/docs/mcp-servers.mdx Provides a concrete example of configuring the '@modelcontextprotocol/server-everything' MCP server as a local server in OpenCode. It specifies the command to run the server using npx and implies its usage in prompts. ```jsonc { "$schema": "https://opencode.ai/config.json", "mcp": { "mcp_everything": { "type": "local", "command": ["npx", "-y", "@modelcontextprotocol/server-everything"] } } } ``` -------------------------------- ### Configure plugins Source: https://github.com/dngriffin/whispercode/blob/dev/packages/web/src/content/docs/config.mdx Enables the loading of custom tools, hooks, and integrations from npm or local directories. ```json { "$schema": "https://opencode.ai/config.json", "plugin": ["opencode-helicone-session", "@my-org/custom-plugin"] } ``` -------------------------------- ### Start development server Source: https://github.com/dngriffin/whispercode/blob/dev/packages/console/app/README.md Instructions for launching the local development environment. The command supports additional flags to automate opening the browser. ```bash npm run dev # or start the server and open the app in a new browser tab npm run dev -- --open ``` -------------------------------- ### Prime Number Implementation Example Source: https://github.com/dngriffin/whispercode/blob/dev/packages/opencode/src/tool/task.txt An example of a standard function implementation followed by an agent-based review process. This illustrates the workflow of writing code and then delegating the verification to a specialized subagent. ```javascript function isPrime(n) { if (n <= 1) return false for (let i = 2; i * i <= n; i++) { if (n % i === 0) return false } return true } ``` -------------------------------- ### Example Prompt for Local MCP Server Source: https://github.com/dngriffin/whispercode/blob/dev/packages/web/src/content/docs/mcp-servers.mdx Shows a sample prompt demonstrating how to invoke a configured local MCP server, specifically 'mcp_everything', to perform a task. This illustrates the practical application of adding MCP tools to the LLM's context. ```text use the mcp_everything tool to add the number 3 and 4 ``` -------------------------------- ### Initialize SolidStart project Source: https://github.com/dngriffin/whispercode/blob/dev/packages/console/app/README.md Commands to scaffold a new SolidStart application. Users can initialize in the current directory or a specific folder path. ```bash # create a new project in the current directory npm init solid@latest # create a new project in my-app npm init solid@latest my-app ``` -------------------------------- ### Run Local Documentation Preview Source: https://github.com/dngriffin/whispercode/blob/dev/packages/docs/development.mdx Starts a local development server to preview documentation. The default port is 3000, but it can be customized using the --port flag. ```bash mint dev mint dev --port 3333 ``` -------------------------------- ### Initialize Cursor Project Rules Source: https://github.com/dngriffin/whispercode/blob/dev/packages/docs/ai-tools/cursor.mdx Commands to create the directory structure for Cursor project-specific AI rules, which help enforce technical writing standards. ```bash mkdir -p .cursor ``` -------------------------------- ### Create Opencode Client with Configuration Source: https://github.com/dngriffin/whispercode/blob/dev/packages/web/src/content/docs/sdk.mdx Create an instance of Opencode with custom configuration options. ```APIDOC ## Config ### Description Pass a configuration object to customize behavior. The instance still picks up your `opencode.json`, but you can override or add configuration inline. ### Method ```javascript import { createOpencode } from "@opencode-ai/sdk" const opencode = await createOpencode({ hostname: "127.0.0.1", port: 4096, config: { model: "anthropic/claude-3-5-sonnet-20241022", }, }) console.log(`Server running at ${opencode.server.url}`) opencode.server.close() ``` ``` -------------------------------- ### Troubleshoot CLI Installation Source: https://github.com/dngriffin/whispercode/blob/dev/packages/docs/development.mdx Commands to resolve common installation or runtime errors by reinstalling the CLI or clearing cache data. ```bash npm remove -g mint npm i -g mint ``` -------------------------------- ### Print 'Hello World' in Python Source: https://github.com/dngriffin/whispercode/blob/dev/packages/opencode/src/tool/todowrite.txt A basic demonstration of outputting text to the console in Python. This snippet is provided as an example of a trivial task that does not require formal todo list tracking. ```python print("Hello World") ``` -------------------------------- ### Install @whisperopencode/push using npm Source: https://github.com/dngriffin/whispercode/blob/dev/packages/push/README.md This command installs the @whisperopencode/push package using npm. It is a prerequisite for using the plugin and its CLI functionalities. ```sh npm install @whisperopencode/push ``` -------------------------------- ### Install fastlane using Homebrew Source: https://github.com/dngriffin/whispercode/blob/dev/IOS_BEAM.md Installs the fastlane toolchain, a dependency for automating iOS deployment tasks, using the Homebrew package manager. ```bash brew install fastlane ``` -------------------------------- ### Start OpenCode TUI Source: https://github.com/dngriffin/whispercode/blob/dev/packages/web/src/content/docs/tui.mdx Commands to initiate the OpenCode terminal interface. You can start it in the current directory or specify a target project path. ```bash opencode opencode /path/to/project ``` -------------------------------- ### Switch to Plan Mode in OpenCode Source: https://github.com/dngriffin/whispercode/blob/dev/packages/web/src/content/docs/index.mdx Demonstrates how to enter 'Plan mode' in OpenCode using the Tab key. This mode disables direct code changes and focuses on generating implementation plans. No external dependencies are required. ```bash ``` -------------------------------- ### Upgrade OpenCode version Source: https://github.com/dngriffin/whispercode/blob/dev/packages/web/src/content/docs/cli.mdx Updates the OpenCode installation to the latest version or a specifically requested version tag. The --method flag specifies the original installation source. ```bash opencode upgrade opencode upgrade v0.1.48 ``` -------------------------------- ### Install Mintlify CLI via npm Source: https://github.com/dngriffin/whispercode/blob/dev/packages/docs/development.mdx Installs the global Mintlify CLI package required for documentation development. Requires Node.js version 19 or higher. ```bash npm i -g mint ``` -------------------------------- ### Start OpenCode web server Source: https://github.com/dngriffin/whispercode/blob/dev/packages/web/src/content/docs/cli.mdx Initializes a headless server with a browser-accessible web interface. Supports optional authentication via the OPENCODE_SERVER_PASSWORD environment variable. ```bash opencode web ``` -------------------------------- ### Configure OpenCode via environment variables Source: https://github.com/dngriffin/whispercode/blob/dev/packages/web/src/content/docs/config.mdx Demonstrates how to set a custom configuration file path or a custom configuration directory using shell environment variables. ```bash export OPENCODE_CONFIG=/path/to/my/custom-config.json opencode run "Hello world" ``` ```bash export OPENCODE_CONFIG_DIR=/path/to/my/config-directory opencode run "Hello world" ``` -------------------------------- ### Install Xcode Command Line Tools Source: https://github.com/dngriffin/whispercode/blob/dev/packages/ios/fastlane/README.md Installs the required Xcode command line tools necessary for Fastlane operations. This is a prerequisite step for environments where development tools are missing. ```shell xcode-select --install ``` -------------------------------- ### Install OpenCode in WSL Terminal Source: https://github.com/dngriffin/whispercode/blob/dev/packages/web/src/content/docs/windows-wsl.mdx Installs OpenCode using a curl command within the WSL terminal. This method is straightforward and suitable for most users setting up OpenCode for the first time in a Linux environment. ```bash curl -fsSL https://opencode.ai/install | bash ``` -------------------------------- ### Image Frame Component (HTML) Source: https://github.com/dngriffin/whispercode/blob/dev/packages/docs/ai-tools/cursor.mdx Explains how to use the Frame component to wrap images, providing options for captions and ensuring consistent presentation. ```html Main dashboard showing analytics overview Analytics dashboard with charts ``` -------------------------------- ### YAML Frontmatter for Documentation Pages Source: https://github.com/dngriffin/whispercode/blob/dev/packages/docs/ai-tools/cursor.mdx Shows the required YAML frontmatter structure at the beginning of each documentation page. It includes essential metadata like title and description. ```yaml --- title: "Clear, specific, keyword-rich title" description: "Concise description explaining page purpose and value" --- ``` -------------------------------- ### API Parameter Documentation (HTML/JSX) Source: https://github.com/dngriffin/whispercode/blob/dev/packages/docs/ai-tools/cursor.mdx Shows how to document API parameters using ParamField components. It covers different parameter types (path, body, query, header) and their attributes like type, required status, and default values. ```html Unique identifier for the user. Must be a valid UUID v4 format. User's email address. Must be valid and unique within the system. Maximum number of results to return. Range: 1-100. Bearer token for API authentication. Format: `Bearer YOUR_API_KEY` ``` -------------------------------- ### Create Opencode Client Only Source: https://github.com/dngriffin/whispercode/blob/dev/packages/web/src/content/docs/sdk.mdx Create a client instance to connect to an already running Opencode server. ```APIDOC ## Client only ### Description If you already have a running instance of opencode, you can create a client instance to connect to it. ### Method ```javascript import { createOpencodeClient } from "@opencode-ai/sdk" const client = createOpencodeClient({ baseUrl: "http://localhost:4096", }) ``` ### Options | Option | Type | Description | Default | | --------------- | ---------- | -------------------------------- | ----------------------- | | `baseUrl` | `string` | URL of the server | `http://localhost:4096` | | `fetch` | `function` | Custom fetch implementation | `globalThis.fetch` | | `parseAs` | `string` | Response parsing method | `auto` | | `responseStyle` | `string` | Return style: `data` or `fields` | `fields` | | `throwOnError` | `boolean` | Throw errors instead of return | `false` | ``` -------------------------------- ### Install and Configure opencode-helicone-session Plugin Source: https://github.com/dngriffin/whispercode/blob/dev/packages/web/src/content/docs/providers.mdx This configuration snippet shows how to enable session tracking for Helicone within OpenCode using the 'opencode-helicone-session' plugin. First, install the plugin globally using npm. Then, add the plugin name to your 'opencode.json' configuration file. ```bash npm install -g opencode-helicone-session ``` ```json { "plugin": ["opencode-helicone-session"] } ``` -------------------------------- ### Define Local Plugin Dependencies in package.json Source: https://github.com/dngriffin/whispercode/blob/dev/packages/web/src/content/docs/plugins.mdx Manage external npm package dependencies for local plugins by creating a package.json file in your configuration directory. OpenCode will automatically run 'bun install' to install these dependencies at startup, making them available for import in your plugins. ```json { "dependencies": { "shescape": "^2.1.0" } } ``` -------------------------------- ### Full WhisperCode Custom Theme Example (my-theme.json) Source: https://github.com/dngriffin/whispercode/blob/dev/packages/web/src/content/docs/themes.mdx This is a comprehensive example of a custom WhisperCode theme configuration. It demonstrates the use of the 'defs' section for defining a color palette (Nord theme) and the 'theme' section for applying these colors to various UI elements and syntax highlighting. ```json { "$schema": "https://opencode.ai/theme.json", "defs": { "nord0": "#2E3440", "nord1": "#3B4252", "nord2": "#434C5E", "nord3": "#4C566A", "nord4": "#D8DEE9", "nord5": "#E5E9F0", "nord6": "#ECEFF4", "nord7": "#8FBCBB", "nord8": "#88C0D0", "nord9": "#81A1C1", "nord10": "#5E81AC", "nord11": "#BF616A", "nord12": "#D08770", "nord13": "#EBCB8B", "nord14": "#A3BE8C", "nord15": "#B48EAD" }, "theme": { "primary": { "dark": "nord8", "light": "nord10" }, "secondary": { "dark": "nord9", "light": "nord9" }, "accent": { "dark": "nord7", "light": "nord7" }, "error": { "dark": "nord11", "light": "nord11" }, "warning": { "dark": "nord12", "light": "nord12" }, "success": { "dark": "nord14", "light": "nord14" }, "info": { "dark": "nord8", "light": "nord10" }, "text": { "dark": "nord4", "light": "nord0" }, "textMuted": { "dark": "nord3", "light": "nord1" }, "background": { "dark": "nord0", "light": "nord6" }, "backgroundPanel": { "dark": "nord1", "light": "nord5" }, "backgroundElement": { "dark": "nord1", "light": "nord4" }, "border": { "dark": "nord2", "light": "nord3" }, "borderActive": { "dark": "nord3", "light": "nord2" }, "borderSubtle": { "dark": "nord2", "light": "nord3" }, "diffAdded": { "dark": "nord14", "light": "nord14" }, "diffRemoved": { "dark": "nord11", "light": "nord11" }, "diffContext": { "dark": "nord3", "light": "nord3" }, "diffHunkHeader": { "dark": "nord3", "light": "nord3" }, "diffHighlightAdded": { "dark": "nord14", "light": "nord14" }, "diffHighlightRemoved": { "dark": "nord11", "light": "nord11" }, "diffAddedBg": { "dark": "#3B4252", "light": "#E5E9F0" }, "diffRemovedBg": { "dark": "#3B4252", "light": "#E5E9F0" }, "diffContextBg": { "dark": "nord1", "light": "nord5" }, "diffLineNumber": { "dark": "nord2", "light": "nord4" }, "diffAddedLineNumberBg": { "dark": "#3B4252", "light": "#E5E9F0" }, "diffRemovedLineNumberBg": { "dark": "#3B4252", "light": "#E5E9F0" }, "markdownText": { "dark": "nord4", "light": "nord0" }, "markdownHeading": { "dark": "nord8", "light": "nord10" }, "markdownLink": { "dark": "nord9", "light": "nord9" }, "markdownLinkText": { "dark": "nord7", "light": "nord7" }, "markdownCode": { "dark": "nord14", "light": "nord14" }, "markdownBlockQuote": { "dark": "nord3", "light": "nord3" }, "markdownEmph": { "dark": "nord12", "light": "nord12" }, "markdownStrong": { "dark": "nord13", "light": "nord13" }, "markdownHorizontalRule": { "dark": "nord3", "light": "nord3" }, "markdownListItem": { "dark": "nord8", "light": "nord10" }, "markdownListEnumeration": { "dark": "nord7", "light": "nord7" }, "markdownImage": { "dark": "nord9", "light": "nord9" }, "markdownImageText": { "dark": "nord7", "light": "nord7" }, "markdownCodeBlock": { "dark": "nord4", "light": "nord0" }, "syntaxComment": { "dark": "nord3", "light": "nord3" }, "syntaxKeyword": { "dark": "nord9", "light": "nord9" }, "syntaxFunction": { "dark": "nord8", "light": "nord8" }, "syntaxVariable": { "dark": "nord7", "light": "nord7" }, "syntaxString": { "dark": "nord14", "light": "nord14" }, "syntaxNumber": { "dark": "nord15", "light": "nord15" }, "syntaxType": { "dark": "nord7", "light": "nord7" }, "syntaxOperator": { "dark": "nord9", "light": "nord9" }, "syntaxPunctuation": { "dark": "nord4", "light": "nord0" } } } ``` -------------------------------- ### Manage Sessions and Send AI Prompts Source: https://github.com/dngriffin/whispercode/blob/dev/packages/web/src/content/docs/sdk.mdx Demonstrates creating sessions, listing them, and sending prompts to AI models. It also shows how to inject context without triggering a response using the noReply flag. ```javascript const session = await client.session.create({ body: { title: "My session" }, }) const sessions = await client.session.list() // Send a prompt message const result = await client.session.prompt({ path: { id: session.id }, body: { model: { providerID: "anthropic", modelID: "claude-3-5-sonnet-20241022" }, parts: [{ type: "text", text: "Hello!" }], }, }) // Inject context without triggering AI response (useful for plugins) await client.session.prompt({ path: { id: session.id }, body: { noReply: true, parts: [{ type: "text", text: "You are a helpful assistant." }], }, }) ``` -------------------------------- ### GET /session Source: https://github.com/dngriffin/whispercode/blob/dev/packages/web/src/content/docs/server.mdx Retrieve a list of all active sessions. ```APIDOC ## GET /session ### Description Returns a list of all available sessions. ### Method GET ### Endpoint /session ### Response #### Success Response (200) - **data** (Session[]) - List of session objects #### Response Example [ { "id": "1", "title": "Example Session" } ] ``` -------------------------------- ### GET /files/list Source: https://github.com/dngriffin/whispercode/blob/dev/packages/opencode/src/tool/ls.txt Lists files and directories in a given path with optional ignore patterns. ```APIDOC ## GET /files/list ### Description Lists files and directories in a given path. If no path is provided, the current workspace directory is used. ### Method GET ### Endpoint /files/list ### Parameters #### Query Parameters - **path** (string) - Optional - The absolute path to list. Defaults to current workspace if omitted. - **ignore** (array) - Optional - A list of glob patterns to exclude from the results. ### Request Example { "path": "/usr/local/project", "ignore": ["**/node_modules/**", "**/.git/**"] } ### Response #### Success Response (200) - **files** (array) - List of file and directory names found in the path. #### Response Example { "files": ["src/", "index.js", "package.json", "README.md"] } ``` -------------------------------- ### Configure and Customize Opencode Source: https://github.com/dngriffin/whispercode/blob/dev/packages/web/src/content/docs/sdk.mdx Customize server behavior by passing a configuration object during initialization. ```javascript import { createOpencode } from "@opencode-ai/sdk" const opencode = await createOpencode({ hostname: "127.0.0.1", port: 4096, config: { model: "anthropic/claude-3-5-sonnet-20241022", }, }) console.log(`Server running at ${opencode.server.url}`) opencode.server.close() ``` -------------------------------- ### Access Path and Configuration APIs Source: https://github.com/dngriffin/whispercode/blob/dev/packages/web/src/content/docs/sdk.mdx Retrieves current system path information, configuration settings, and provider/model defaults. ```javascript // Get current path information const pathInfo = await client.path.get() // Get config info const config = await client.config.get() // Get providers and default models const { providers, default: defaults } = await client.config.providers() ```