From e24d2ab05918e419a5ed5abe971640a0ded7d396 Mon Sep 17 00:00:00 2001 From: Afirium Date: Sat, 26 Jul 2025 11:43:28 +0300 Subject: [PATCH] feat(mcp): Force update sources.tar --- mcp/docs.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/mcp/docs.ts b/mcp/docs.ts index 498646a..ed73f0d 100644 --- a/mcp/docs.ts +++ b/mcp/docs.ts @@ -39,6 +39,8 @@ export async function ensureDocs( if (!isMcpMode) console.log(`Updating documentation for Zig version: ${zigVersion}`); const builtinFunctions = await extractBuiltinFunctions(zigVersion, isMcpMode); + await downloadSourcesTar(zigVersion, isMcpMode, true); + const dir = path.dirname(metadataPath); if (!fs.existsSync(dir)) { fs.mkdirSync(dir, { recursive: true }); @@ -77,12 +79,13 @@ export async function ensureDocs( export async function downloadSourcesTar( zigVersion: string, isMcpMode: boolean = false, + forceUpdate: boolean = false, ): Promise { const paths = envPaths("zig-mcp", { suffix: "" }); const versionCacheDir = path.join(paths.cache, zigVersion); const sourcesPath = path.join(versionCacheDir, "sources.tar"); - if (fs.existsSync(sourcesPath)) { + if (fs.existsSync(sourcesPath) && !forceUpdate) { if (!isMcpMode) console.log(`Using cached sources.tar from ${sourcesPath}`); return new Uint8Array(fs.readFileSync(sourcesPath)); }