Skip to content

Commit 6491f93

Browse files
committed
fix: sync version from package.json and correct README documentation
- Read version dynamically from package.json instead of hardcoding - Fix get_technical_debt return example in README to match actual code output - Remove non-existent largeFiles field from documentation
1 parent 8ae29ff commit 6491f93

File tree

2 files changed

+13
-8
lines changed

2 files changed

+13
-8
lines changed

README.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -373,10 +373,9 @@ Identify technical debt.
373373
"staleFiles": [
374374
{ "file": "old-module.js", "daysSinceLastChange": 180 }
375375
],
376-
"largeFiles": [
377-
{ "file": "big-file.js", "sizeBytes": 50000, "churn": 25 }
378-
],
379-
"complexityHotspots": [ ... ]
376+
"complexityHotspots": [
377+
{ "file": "big-file.js", "churn": 25 }
378+
]
380379
}
381380
```
382381

src/git-metrics.ts

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,16 @@ import {
66
ListToolsRequestSchema,
77
} from "@modelcontextprotocol/sdk/types.js";
88
import { execSync } from "child_process";
9-
import { existsSync, statSync } from "fs";
10-
import { resolve } from "path";
9+
import { existsSync, statSync, readFileSync } from "fs";
10+
import { resolve, dirname } from "path";
11+
import { fileURLToPath } from "url";
1112
import * as handlers from "./handlers.js";
1213

14+
const __filename = fileURLToPath(import.meta.url);
15+
const __dirname = dirname(__filename);
16+
const packageJson = JSON.parse(readFileSync(resolve(__dirname, '../package.json'), 'utf-8'));
17+
const VERSION = packageJson.version;
18+
1319
function log(level: 'INFO' | 'ERROR' | 'WARN', message: string, meta?: any) {
1420
const timestamp = new Date().toISOString();
1521
const logEntry = { timestamp, level, message, ...meta };
@@ -22,7 +28,7 @@ const MAX_BUFFER = 10 * 1024 * 1024;
2228
const server = new Server(
2329
{
2430
name: "git-metrics-mcp-server",
25-
version: "1.1.0",
31+
version: VERSION,
2632
},
2733
{
2834
capabilities: {
@@ -267,7 +273,7 @@ async function main() {
267273
const transport = new StdioServerTransport();
268274
await server.connect(transport);
269275
log('INFO', 'Git Metrics MCP Server started', {
270-
version: '1.1.0',
276+
version: VERSION,
271277
timeout: GIT_TIMEOUT,
272278
maxBuffer: MAX_BUFFER
273279
});

0 commit comments

Comments
 (0)