zignet
Version:
MCP server for Zig — AI-powered code analysis, validation, and documentation with fine-tuned LLM
1 lines • 22.2 kB
Source Map (JSON)
{"version":3,"file":"executor-ON2Rt60w.cjs","names":["detectedPlatform: Platform","detectedArch: Arch","error: unknown","diagnostics: ZigDiagnostic[]","DEFAULT_ZIG_VERSION","error: unknown","fmtError: unknown"],"sources":["../src/zig/manager.ts","../src/zig/executor.ts"],"sourcesContent":["/**\n * Zig Version Manager\n *\n * Handles downloading, caching, and managing multiple Zig versions.\n * Supports auto-detection of platform and lazy-loading of binaries.\n * Checks system PATH for existing Zig installations before downloading.\n */\n\nimport { execSync } from \"child_process\";\nimport { existsSync, mkdirSync, chmodSync } from \"fs\";\nimport { join } from \"path\";\nimport { homedir } from \"os\";\nimport { SUPPORTED_ZIG_VERSIONS, type ZigVersion } from \"../config.js\";\n\nexport { SUPPORTED_ZIG_VERSIONS, type ZigVersion };\n\n/**\n * Detect system-installed Zig version\n * @returns Zig version string (e.g., \"0.15.0\") or null if not found\n */\nexport function detectSystemZig(): string | null {\n try {\n const output = execSync(\"zig version\", {\n encoding: \"utf-8\",\n stdio: [\"pipe\", \"pipe\", \"ignore\"],\n });\n const version = output.trim();\n console.log(`🔍 Found system Zig: ${version}`);\n return version;\n } catch {\n // Zig not in PATH\n return null;\n }\n}\n\n/**\n * Get path to system Zig binary (if available)\n * @returns Absolute path to system zig binary or null\n */\nexport function getSystemZigPath(): string | null {\n try {\n const platform = process.platform;\n const command = platform === \"win32\" ? \"where zig\" : \"which zig\";\n const output = execSync(command, {\n encoding: \"utf-8\",\n stdio: [\"pipe\", \"pipe\", \"ignore\"],\n });\n return output.trim();\n } catch {\n return null;\n }\n}\n\n/**\n * Platform detection\n */\ntype Platform = \"linux\" | \"macos\" | \"windows\";\ntype Arch = \"x86_64\" | \"aarch64\";\n\ninterface PlatformInfo {\n platform: Platform;\n arch: Arch;\n ext: string;\n}\n\n/**\n * Detect current platform\n */\nfunction detectPlatform(): PlatformInfo {\n const platform = process.platform;\n const arch = process.arch;\n\n let detectedPlatform: Platform;\n let detectedArch: Arch;\n\n // Platform\n if (platform === \"linux\") {\n detectedPlatform = \"linux\";\n } else if (platform === \"darwin\") {\n detectedPlatform = \"macos\";\n } else if (platform === \"win32\") {\n detectedPlatform = \"windows\";\n } else {\n throw new Error(`Unsupported platform: ${platform}`);\n }\n\n // Architecture\n if (arch === \"x64\") {\n detectedArch = \"x86_64\";\n } else if (arch === \"arm64\") {\n detectedArch = \"aarch64\";\n } else {\n throw new Error(`Unsupported architecture: ${arch}`);\n }\n\n // Extension\n const ext = detectedPlatform === \"windows\" ? \".zip\" : \".tar.xz\";\n\n return { platform: detectedPlatform, arch: detectedArch, ext };\n}\n\n/**\n * Get Zig download URL for a specific version\n */\nfunction getZigDownloadUrl(version: ZigVersion): string {\n const { platform, arch, ext } = detectPlatform();\n\n // Map platform names to Zig's naming convention\n const platformMap: Record<Platform, string> = {\n linux: \"linux\",\n macos: \"macos\",\n windows: \"windows\",\n };\n\n const zigPlatform = platformMap[platform];\n\n // Zig changed filename format in 0.15.0:\n // - 0.13.0, 0.14.0: zig-{platform}-{arch}-{version} (e.g., zig-linux-x86_64-0.13.0)\n // - 0.15.0+: zig-{arch}-{platform}-{version} (e.g., zig-x86_64-linux-0.15.0)\n const versionNum = parseFloat(version);\n const filename =\n versionNum >= 0.15\n ? `zig-${arch}-${zigPlatform}-${version}${ext}` // New format (0.15.0+)\n : `zig-${zigPlatform}-${arch}-${version}${ext}`; // Old format (0.13.0, 0.14.0)\n\n return `https://ziglang.org/download/${version}/${filename}`;\n}\n\n/**\n * Get cache directory for Zig installations\n */\nexport function getZigCacheDir(): string {\n const cacheDir = join(homedir(), \".zignet\", \"zig-versions\");\n if (!existsSync(cacheDir)) {\n mkdirSync(cacheDir, { recursive: true });\n }\n return cacheDir;\n}\n\n/**\n * Get installation path for a specific Zig version\n */\nexport function getZigInstallPath(version: ZigVersion): string {\n return join(getZigCacheDir(), version);\n}\n\n/**\n * Get Zig binary path for a specific version\n */\nexport function getZigBinaryPath(version: ZigVersion): string {\n const installPath = getZigInstallPath(version);\n const { platform, arch } = detectPlatform();\n const binaryName = platform === \"windows\" ? \"zig.exe\" : \"zig\";\n\n const platformMap: Record<Platform, string> = {\n linux: \"linux\",\n macos: \"macos\",\n windows: \"windows\",\n };\n const zigPlatform = platformMap[platform];\n\n // Match the extraction directory format with download filename format\n const versionNum = parseFloat(version);\n const extractDir =\n versionNum >= 0.15\n ? `zig-${arch}-${zigPlatform}-${version}` // New format (0.15.0+)\n : `zig-${zigPlatform}-${arch}-${version}`; // Old format (0.13.0, 0.14.0)\n\n return join(installPath, extractDir, binaryName);\n}\n\n/**\n * Check if a specific Zig version is installed\n */\nexport function isZigInstalled(version: ZigVersion): boolean {\n const binaryPath = getZigBinaryPath(version);\n return existsSync(binaryPath);\n}\n\n/**\n * Download and install a specific Zig version\n */\nexport function installZig(version: ZigVersion): void {\n if (isZigInstalled(version)) {\n console.log(`✅ Zig ${version} already installed`);\n return;\n }\n\n console.log(`📥 Downloading Zig ${version}...`);\n\n const url = getZigDownloadUrl(version);\n const installPath = getZigInstallPath(version);\n\n // Create install directory\n if (!existsSync(installPath)) {\n mkdirSync(installPath, { recursive: true });\n }\n\n try {\n // Download and extract using platform-appropriate tools\n const { platform } = detectPlatform();\n\n if (platform === \"windows\") {\n // Windows: Download .zip and extract with tar.exe (much faster than Expand-Archive)\n const tempFile = join(installPath, `zig-${version}.zip`);\n\n // Download using PowerShell (more reliable than curl on Windows)\n console.log(`📥 Downloading ${url}...`);\n execSync(\n `powershell -Command \"(New-Object System.Net.WebClient).DownloadFile('${url}', '${tempFile}')\"`,\n { stdio: \"inherit\" },\n );\n\n // Extract using tar.exe (available in Windows 10+ 1803, 5-10x faster than Expand-Archive)\n console.log(`📦 Extracting Zig ${version}...`);\n try {\n execSync(`tar -xf \"${tempFile}\" -C \"${installPath}\"`, {\n stdio: \"inherit\",\n });\n } catch {\n // Fallback to PowerShell if tar is not available (Windows 7/8)\n console.warn(\n \"⚠️ tar.exe not found, falling back to Expand-Archive (slower)...\",\n );\n execSync(\n `powershell -Command \"Expand-Archive -Path '${tempFile}' -DestinationPath '${installPath}' -Force\"`,\n { stdio: \"inherit\" },\n );\n }\n\n // Remove temp file\n execSync(`del \"${tempFile}\"`, { stdio: \"inherit\" });\n } else {\n // Unix-like: Download .tar.xz and extract with curl + tar\n const tempFile = join(installPath, `zig-${version}.tar.xz`);\n execSync(`curl -fSL \"${url}\" -o \"${tempFile}\"`, {\n stdio: \"inherit\",\n });\n\n // Extract\n console.log(`📦 Extracting Zig ${version}...`);\n execSync(`tar -xJf \"${tempFile}\" -C \"${installPath}\"`, {\n stdio: \"inherit\",\n });\n\n // Remove temp file\n execSync(`rm \"${tempFile}\"`);\n }\n\n // Verify installation\n const binaryPath = getZigBinaryPath(version);\n if (!existsSync(binaryPath)) {\n throw new Error(\n `Installation failed: binary not found at ${binaryPath}`,\n );\n }\n\n // Make executable\n chmodSync(binaryPath, 0o755);\n\n console.log(\n `✅ Zig ${version} installed successfully at ${binaryPath}`,\n );\n } catch (error: unknown) {\n const message = error instanceof Error ? error.message : String(error);\n throw new Error(`Failed to install Zig ${version}: ${message}`);\n }\n}\n\n/**\n * Ensure a specific Zig version is installed (install if needed)\n * First checks system PATH, then falls back to downloading\n * @param version Zig version to ensure\n * @returns Absolute path to Zig binary\n */\nexport function ensureZig(version: ZigVersion): string {\n // Check if we already have it in cache\n if (isZigInstalled(version)) {\n return getZigBinaryPath(version);\n }\n\n // Check system PATH for matching version\n const systemVersion = detectSystemZig();\n if (systemVersion === version) {\n const systemPath = getSystemZigPath();\n if (systemPath) {\n console.log(`✅ Using system Zig ${version} at ${systemPath}`);\n return systemPath;\n }\n }\n\n // Not found in system or cache, download it\n console.log(`📥 Zig ${version} not found in system, downloading...`);\n installZig(version);\n return getZigBinaryPath(version);\n}\n\n/**\n * Get installed Zig version\n */\nexport function getInstalledZigVersion(binaryPath: string): string {\n try {\n const output = execSync(`\"${binaryPath}\" version`, {\n encoding: \"utf8\",\n });\n return output.trim();\n } catch (error: unknown) {\n const message = error instanceof Error ? error.message : String(error);\n throw new Error(`Failed to get Zig version: ${message}`);\n }\n}\n\n/**\n * List all installed Zig versions\n */\nexport function listInstalledVersions(): ZigVersion[] {\n return SUPPORTED_ZIG_VERSIONS.filter((version) => isZigInstalled(version));\n}\n\n/**\n * Install all supported Zig versions\n */\nexport function installAllVersions(): void {\n for (const version of SUPPORTED_ZIG_VERSIONS) {\n installZig(version);\n }\n}\n","/**\n * Zig Executor\n *\n * Executes Zig compiler commands (ast-check, fmt, etc.) with specific versions.\n * Parses compiler output and formats errors for MCP responses.\n */\n\nimport { execSync } from \"child_process\";\nimport { writeFileSync, unlinkSync, mkdtempSync, readFileSync } from \"fs\";\nimport { join } from \"path\";\nimport { tmpdir } from \"os\";\nimport { ensureZig, type ZigVersion } from \"./manager.js\";\nimport { DEFAULT_ZIG_VERSION } from \"../config.js\";\n\n/**\n * Zig compiler error/warning\n */\nexport interface ZigDiagnostic {\n message: string;\n file?: string;\n line?: number;\n column?: number;\n severity: \"error\" | \"warning\" | \"note\";\n}\n\n/**\n * Result from Zig execution\n */\nexport interface ZigResult {\n success: boolean;\n output: string;\n diagnostics: ZigDiagnostic[];\n}\n\n/**\n * Parse Zig compiler output to extract diagnostics\n *\n * Zig error format:\n * /tmp/file.zig:2:5: error: expected type 'i32', found '[]const u8'\n * return \"hello\";\n * ^~~~~~~~~~~~~~\n */\nfunction parseZigOutput(output: string): ZigDiagnostic[] {\n const diagnostics: ZigDiagnostic[] = [];\n const lines = output.split(\"\\n\");\n\n for (let i = 0; i < lines.length; i++) {\n const line = lines[i];\n\n // Match Zig error format: file:line:col: severity: message\n const match = line.match(\n /^(.+?):(\\d+):(\\d+):\\s+(error|warning|note):\\s+(.+)$/,\n );\n\n if (match) {\n const [, file, lineNum, colNum, severity, message] = match;\n diagnostics.push({\n message: message.trim(),\n file,\n line: parseInt(lineNum, 10),\n column: parseInt(colNum, 10),\n severity: severity as \"error\" | \"warning\" | \"note\",\n });\n } else if (line.trim().startsWith(\"error:\")) {\n // Generic error without location\n diagnostics.push({\n message: line.replace(/^error:\\s+/, \"\").trim(),\n severity: \"error\",\n });\n }\n }\n\n return diagnostics;\n}\n\n/**\n * Execute Zig AST check on code\n *\n * @param code - Zig source code to check\n * @param version - Zig version to use (default: from ZIG_DEFAULT env var)\n * @returns Result with success status and diagnostics\n */\nexport function zigAstCheck(\n code: string,\n version: ZigVersion = DEFAULT_ZIG_VERSION,\n): ZigResult {\n // Ensure Zig version is installed\n const zigBinary = ensureZig(version);\n\n // Create temporary file\n const tempDir = mkdtempSync(join(tmpdir(), \"zignet-\"));\n const tempFile = join(tempDir, \"check.zig\");\n\n try {\n // Write code to temp file\n writeFileSync(tempFile, code, \"utf8\");\n\n // Run zig ast-check\n try {\n const output = execSync(`\"${zigBinary}\" ast-check \"${tempFile}\"`, {\n encoding: \"utf8\",\n stdio: \"pipe\",\n });\n\n return {\n success: true,\n output: output.trim(),\n diagnostics: [],\n };\n } catch (error: unknown) {\n // ast-check failed, parse errors\n const errorObj = error as { stderr?: Buffer; stdout?: Buffer };\n const stderr = (\n errorObj.stderr ??\n errorObj.stdout ??\n Buffer.from(\"\")\n ).toString();\n const diagnostics = parseZigOutput(stderr);\n\n return {\n success: false,\n output: stderr.trim(),\n diagnostics,\n };\n }\n } finally {\n // Cleanup\n try {\n unlinkSync(tempFile);\n } catch {\n // Ignore cleanup errors\n }\n }\n}\n\n/**\n * Execute Zig format on code\n *\n * @param code - Zig source code to format\n * @param version - Zig version to use (default: from ZIG_DEFAULT env var)\n * @returns Formatted code or error\n */\nexport function zigFormat(\n code: string,\n version: ZigVersion = DEFAULT_ZIG_VERSION,\n): ZigResult {\n // Ensure Zig version is installed\n const zigBinary = ensureZig(version);\n\n // Create temporary file\n const tempDir = mkdtempSync(join(tmpdir(), \"zignet-\"));\n const tempFile = join(tempDir, \"format.zig\");\n\n try {\n // Write code to temp file\n writeFileSync(tempFile, code, \"utf8\");\n\n // Run zig fmt --check (check if formatting needed)\n try {\n execSync(`\"${zigBinary}\" fmt --check \"${tempFile}\"`, {\n encoding: \"utf8\",\n stdio: \"pipe\",\n });\n\n // No formatting needed, return original\n return {\n success: true,\n output: code,\n diagnostics: [],\n };\n } catch {\n // Formatting needed or error occurred\n // Try to format\n try {\n execSync(`\"${zigBinary}\" fmt \"${tempFile}\"`, {\n stdio: \"pipe\",\n });\n\n // Read formatted code\n const formatted = readFileSync(tempFile, \"utf8\");\n\n return {\n success: true,\n output: formatted,\n diagnostics: [],\n };\n } catch (fmtError: unknown) {\n // Format failed, parse errors\n const errorObj = fmtError as {\n stderr?: Buffer;\n stdout?: Buffer;\n };\n const stderr = (\n errorObj.stderr ??\n errorObj.stdout ??\n Buffer.from(\"\")\n ).toString();\n const diagnostics = parseZigOutput(stderr);\n\n return {\n success: false,\n output: stderr.trim(),\n diagnostics,\n };\n }\n }\n } finally {\n // Cleanup\n try {\n unlinkSync(tempFile);\n } catch {\n // Ignore cleanup errors\n }\n }\n}\n\n/**\n * Get Zig version string\n *\n * @param version - Zig version to check\n * @returns Version string (e.g., \"0.15.0\")\n */\nexport function getZigVersionString(version: ZigVersion): string {\n const zigBinary = ensureZig(version);\n\n try {\n const output = execSync(`\"${zigBinary}\" version`, {\n encoding: \"utf8\",\n stdio: \"pipe\",\n });\n\n return output.trim();\n } catch (error: unknown) {\n const message = error instanceof Error ? error.message : String(error);\n throw new Error(`Failed to get Zig version: ${message}`);\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAoBA,SAAgB,kBAAiC;AAC7C,KAAI;EAKA,MAAM,sCAJkB,eAAe;GACnC,UAAU;GACV,OAAO;IAAC;IAAQ;IAAQ;IAAS;GACpC,CAAC,CACqB,MAAM;AAC7B,UAAQ,IAAI,wBAAwB,UAAU;AAC9C,SAAO;SACH;AAEJ,SAAO;;;;;;;AAQf,SAAgB,mBAAkC;AAC9C,KAAI;AAOA,qCANiB,QAAQ,aACI,UAAU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