### Start OpenDia Server Source: https://github.com/aeonfun/opendia/blob/main/opendia-extension/src/popup/popup.html Command to initialize the server with auto-discovery enabled. ```bash npx opendia ``` -------------------------------- ### Install OpenDia via Grok CLI Source: https://github.com/aeonfun/opendia/blob/main/plugins/opendia/README.md Commands to add and install the OpenDia plugin from the marketplace or a specific repository branch. ```bash # After this PR merges into aeonfun/opendia: grok plugin marketplace add aeonfun/opendia grok plugin install opendia --trust # Or install the plugin folder directly (works from a fork/branch too): grok plugin install aeonfun/opendia#plugins/opendia --trust ``` -------------------------------- ### Initialize OpenDia MCP Development Environment Source: https://github.com/aeonfun/opendia/blob/main/opendia-mcp/README.md Commands to clone the repository, install dependencies, and launch the server. ```bash git clone https://github.com/aeonfun/opendia.git cd opendia # Start the server cd opendia-mcp npm install npm start # Load extension in your browser # Go to chrome://extensions/ → Developer mode → Load unpacked: ./opendia-extension ``` -------------------------------- ### Development and Build Commands Source: https://github.com/aeonfun/opendia/blob/main/opendia-extension/README.md Use these npm scripts to manage dependencies, build the extension for specific browsers, and create distribution packages. ```bash # Install dependencies npm install # Build for all browsers npm run build # Build for specific browser npm run build:chrome npm run build:firefox # Create distribution packages npm run package:chrome npm run package:firefox # Test builds node test-extension.js ``` -------------------------------- ### Package for Firefox Add-ons Source: https://github.com/aeonfun/opendia/blob/main/opendia-extension/README.md Builds the extension and creates a zip file for Firefox distribution. ```bash # Build and package npm run package:firefox # Upload dist/opendia-firefox.zip to addons.mozilla.org ``` -------------------------------- ### Package for Chrome Web Store Source: https://github.com/aeonfun/opendia/blob/main/opendia-extension/README.md Builds the extension and creates a zip file for Chrome distribution. ```bash # Build and package npm run package:chrome # Upload dist/opendia-chrome.zip to Chrome Web Store ``` -------------------------------- ### Configure Claude Desktop for OpenDia Source: https://github.com/aeonfun/opendia/blob/main/opendia-mcp/README.md Add the OpenDia MCP server configuration to the Claude Desktop settings file. ```json { "mcpServers": { "opendia": { "command": "npx", "args": ["opendia"] } } } ``` -------------------------------- ### Project Directory Structure Source: https://github.com/aeonfun/opendia/blob/main/opendia-extension/README.md Overview of the project file hierarchy including source code, build outputs, and configuration files. ```text opendia-extension/ ├── src/ │ ├── background/ │ │ └── background.js # Cross-browser background script │ ├── content/ │ │ └── content.js # Content script with polyfill │ ├── popup/ │ │ ├── popup.html # Extension popup │ │ └── popup.js # Popup logic with browser APIs │ └── polyfill/ │ └── browser-polyfill.min.js # WebExtension polyfill ├── icons/ # Extension icons ├── dist/ # Build output │ ├── chrome/ # Chrome MV3 build │ ├── firefox/ # Firefox MV2 build │ ├── opendia-chrome.zip # Chrome package │ └── opendia-firefox.zip # Firefox package ├── manifest-chrome.json # Chrome MV3 manifest ├── manifest-firefox.json # Firefox MV2 manifest ├── build.js # Build system ├── test-extension.js # Test suite └── package.json # Dependencies and scripts ``` -------------------------------- ### Configure Browser Builds Source: https://github.com/aeonfun/opendia/blob/main/opendia-extension/README.md Asynchronous function to copy source files, browser-specific manifests, and polyfills to the build directory. ```javascript // build.js async function buildForBrowser(browser) { // Copy common files await fs.copy('src', path.join(buildDir, 'src')); // Copy browser-specific manifest await fs.copy(`manifest-${browser}.json`, path.join(buildDir, 'manifest.json')); // Copy WebExtension polyfill await fs.copy('node_modules/webextension-polyfill/dist/browser-polyfill.min.js', path.join(buildDir, 'src/polyfill/browser-polyfill.min.js')); } ``` -------------------------------- ### Configure Custom Ports Source: https://github.com/aeonfun/opendia/blob/main/plugins/opendia/skills/opendia-harness/SKILL.md Command to launch OpenDia with custom WebSocket and HTTP ports. ```bash npx opendia --ws-port=5555 --http-port=5556 ``` -------------------------------- ### Cut a release for opendia Source: https://github.com/aeonfun/opendia/blob/main/RELEASING.md Commands to bump the package version and create a git tag from the repository root. ```bash cd opendia-mcp && npm version patch --no-git-tag-version cd .. git commit -am "chore(release): X.Y.Z" git tag vX.Y.Z git push --follow-tags ``` -------------------------------- ### Run Debug and Validation Commands Source: https://github.com/aeonfun/opendia/blob/main/opendia-extension/README.md Commands for checking server status, validating builds, and testing extension compatibility. ```bash # Check server status curl http://localhost:5556/ping # Validate builds node build.js validate # Test extension compatibility node test-extension.js # Check extension logs # Chrome: chrome://extensions -> OpenDia -> service worker # Firefox: about:debugging -> OpenDia -> Inspect ``` -------------------------------- ### Configure OpenDia MCP Server Manually Source: https://github.com/aeonfun/opendia/blob/main/plugins/opendia/README.md Configuration block for ~/.grok/config.toml to define the OpenDia MCP server command and arguments. ```toml [mcp_servers.opendia] command = "npx" args = ["-y", "opendia"] enabled = true # First cold start may download the npm package startup_timeout_sec = 60 ``` -------------------------------- ### Connection Management Strategies Source: https://github.com/aeonfun/opendia/blob/main/opendia-extension/README.md Demonstrates the difference between Chrome's temporary service worker connections and Firefox's persistent background page connections. ```javascript // Chrome MV3: Temporary connections class ServiceWorkerManager { async ensureConnection() { // Create fresh connection for each operation await this.createTemporaryConnection(); } } // Firefox MV2: Persistent connections class BackgroundPageManager { constructor() { this.persistentSocket = null; this.setupPersistentConnection(); } } ``` -------------------------------- ### Package for GitHub Releases Source: https://github.com/aeonfun/opendia/blob/main/opendia-extension/README.md Generates packages for both Chrome and Firefox for release on GitHub. ```bash # Create both packages npm run package:chrome npm run package:firefox # Upload both files to GitHub releases ``` -------------------------------- ### Verify OpenDia Plugin Status Source: https://github.com/aeonfun/opendia/blob/main/plugins/opendia/README.md Commands to list plugins and MCP servers, and run diagnostics for the OpenDia integration. ```bash grok plugin list grok mcp list grok mcp doctor opendia ``` -------------------------------- ### Execute Automated Tests Source: https://github.com/aeonfun/opendia/blob/main/opendia-extension/README.md Commands to run the full test suite or isolate specific extension components. ```bash # Run comprehensive tests node test-extension.js # Test specific components node test-extension.js --manifest node test-extension.js --background node test-extension.js --content ``` -------------------------------- ### Configure OpenDia for Claude Code Source: https://github.com/aeonfun/opendia/blob/main/plugins/opendia/README.md JSON configuration snippet for integrating the OpenDia MCP server into Claude Code environments. ```json { "mcpServers": { "opendia": { "command": "npx", "args": ["-y", "opendia"] } } } ``` -------------------------------- ### Run Doctor Commands Source: https://github.com/aeonfun/opendia/blob/main/plugins/opendia/skills/opendia-harness/SKILL.md Diagnostic commands to verify MCP server status and plugin details. ```bash grok mcp list grok mcp doctor opendia grok plugin details opendia ``` -------------------------------- ### Browser Environment Detection Source: https://github.com/aeonfun/opendia/blob/main/opendia-extension/README.md Detects the current browser environment and manifest version to handle cross-browser implementation differences. ```javascript // Detect browser environment const browserInfo = { isFirefox: typeof browser !== 'undefined' && browser.runtime.getManifest().applications?.gecko, isChrome: typeof chrome !== 'undefined' && !browser.runtime.getManifest().applications?.gecko, isServiceWorker: typeof importScripts === 'function', manifestVersion: browser.runtime.getManifest().manifest_version }; // Handle differences if (browserInfo.isServiceWorker) { // Chrome MV3 service worker behavior } else { // Firefox MV2 background page behavior } ``` -------------------------------- ### MCP Server Port Discovery Source: https://github.com/aeonfun/opendia/blob/main/opendia-extension/README.md Fetches port information from the local MCP server using a predefined list of common ports. ```javascript // Port discovery const commonPorts = [5556, 5557, 5558, 3001, 6001, 6002, 6003]; const response = await fetch(`http://localhost:${port}/ports`); const portInfo = await response.json(); ``` -------------------------------- ### Validate Build Integrity Source: https://github.com/aeonfun/opendia/blob/main/opendia-extension/README.md Commands to validate all builds or target specific browser builds. ```bash # Validate all builds npm run build && node build.js validate # Check specific browser node build.js validate chrome node build.js validate firefox ``` -------------------------------- ### Cross-Browser API Polyfill Source: https://github.com/aeonfun/opendia/blob/main/opendia-extension/README.md Ensures consistent API usage across browsers by aliasing the chrome namespace to browser when necessary. ```javascript // Polyfill setup if (typeof browser === 'undefined' && typeof chrome !== 'undefined') { globalThis.browser = chrome; } // Unified API usage const tabs = await browser.tabs.query({active: true, currentWindow: true}); ``` -------------------------------- ### Safety Mode CSS Styles Source: https://github.com/aeonfun/opendia/blob/main/opendia-extension/src/popup/popup.html Defines the visual transition for the safety mode toggle and the hover effect for the slider container. ```css input:checked + .safety-slider:before { transform: translateX(26px); } .safety-slider:hover { box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15); } ``` -------------------------------- ### Background Tab Messaging Source: https://github.com/aeonfun/opendia/blob/main/opendia-extension/README.md Sends a message to a specific browser tab to trigger page analysis. ```javascript // Target specific tab await browser.tabs.sendMessage(tabId, { action: 'page_analyze', data: { intent_hint: 'login', tab_id: 12345 } }); ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.