diff --git a/src/bin/focus.ts b/src/bin/focus.ts index 23e7318..a77bceb 100644 --- a/src/bin/focus.ts +++ b/src/bin/focus.ts @@ -50,7 +50,9 @@ async function main(argv: string[]): Promise { }); if (values['version']) { - process.stdout.write('@focusmcp/cli 0.0.0\n'); + process.stdout.write( + `@focusmcp/cli ${process.env['CLI_VERSION'] ?? '0.0.0'} (core ${process.env['CORE_VERSION'] ?? '0.0.0'})\n`, + ); return 0; } diff --git a/tsup.config.ts b/tsup.config.ts index a78fbfc..ef06cf0 100644 --- a/tsup.config.ts +++ b/tsup.config.ts @@ -1,8 +1,14 @@ // SPDX-FileCopyrightText: 2026 FocusMCP contributors // SPDX-License-Identifier: MIT +import { readFileSync } from 'node:fs'; import { defineConfig } from 'tsup'; +const cliPkg = JSON.parse(readFileSync('package.json', 'utf-8')) as { version: string }; +const corePkg = JSON.parse(readFileSync('../core/packages/core/package.json', 'utf-8')) as { + version: string; +}; + export default defineConfig({ entry: { index: 'src/index.ts', @@ -19,6 +25,10 @@ export default defineConfig({ dts: { entry: { index: 'src/index.ts' }, }, + define: { + 'process.env.CLI_VERSION': JSON.stringify(cliPkg.version), + 'process.env.CORE_VERSION': JSON.stringify(corePkg.version), + }, sourcemap: true, clean: true, splitting: false,