From 6634d0f6679770a7d544f3a2bc8ef3272c1ef15c Mon Sep 17 00:00:00 2001 From: ldraney Date: Wed, 28 Jan 2026 12:25:01 -0700 Subject: [PATCH] fix: read CLI version from package.json instead of hardcoded value The --version flag was reporting 0.1.0 because it was hardcoded in src/index.ts. Now reads from package.json so it stays in sync. Fixes #74 Co-Authored-By: Claude Opus 4.5 --- src/index.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/index.ts b/src/index.ts index 544b77b..525a487 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,16 +1,23 @@ #!/usr/bin/env node import { Command } from 'commander'; +import { readFileSync } from 'fs'; +import { fileURLToPath } from 'url'; +import { dirname, join } from 'path'; import { getToken, login, logout, getAuthStatus } from './auth/oauth-flow.js'; import { startServer } from './server.js'; import { ToolGenerator, PRESETS, DEFAULT_PRESET } from './tools/generator.js'; +const __filename = fileURLToPath(import.meta.url); +const __dirname = dirname(__filename); +const pkg = JSON.parse(readFileSync(join(__dirname, '..', 'package.json'), 'utf-8')); + const program = new Command(); program .name('github-mcp') .description('GitHub MCP server with OAuth authentication') - .version('0.1.0'); + .version(pkg.version); // Default command: start server program