From ddc902d568b46d6f19eca3030694f6c6447a0cc4 Mon Sep 17 00:00:00 2001 From: hermes Date: Thu, 15 Oct 2026 05:34:37 +0000 Subject: [PATCH] fix(web): read the version via a ?raw import, independent of cwd Co-Authored-By: Claude Opus 5.5 --- web/src/pages/index.astro | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/web/src/pages/index.astro b/web/src/pages/index.astro index b1acdb0..abb3b5c 100644 --- a/web/src/pages/index.astro +++ b/web/src/pages/index.astro @@ -4,11 +4,12 @@ import '@fontsource/ibm-plex-sans/600.css'; import '@fontsource/ibm-plex-sans/700.css'; import '@fontsource/jetbrains-mono/400.css'; import '@fontsource/jetbrains-mono/700.css'; -import { readFileSync } from 'node:fs'; +import cargoToml from '../../../Cargo.toml?raw'; import { mcpClients, smokeTestedLabels } from '../data/mcp-clients'; -// The released version, from the workspace Cargo.toml (builds run in web/). -const version = readFileSync('../Cargo.toml', 'utf8').match(/^version = "([^"]+)"/m)?.[1] ?? ''; +// The released version, from the workspace Cargo.toml (resolved at bundle time, +// relative to this file, so the build's working directory doesn't matter). +const version = cargoToml.match(/^\[workspace\.package\][\s\S]*?^version = "([^"]+)"/m)?.[1] ?? ''; const agentPrompt = 'Install idx-cli and its MCP server for me by following https://idx.rasyidanaf.com/agents/install.md, then show me that it works.';