mirror of
https://github.com/obra/episodic-memory.git
synced 2026-09-14 13:43:14 +08:00
18a9b120c4
The hardcoded version: '1.0.0' in src/mcp-server.ts had been stale since at least 1.0.0 — every MCP client probing our server identity saw the wrong number regardless of what we shipped. The fix is structural so it can't recur: - scripts/generate-version.js writes src/version.ts from package.json at prebuild and pretest time. mcp-server.ts imports VERSION from there. Single source: package.json. The generated file is gitignored. - test/version-consistency.test.ts asserts the three manifest files (package.json, .claude-plugin/plugin.json, marketplace.json) all agree. Drift becomes a CI failure. - scripts/bump-version.sh + .version-bump.json bump all declared files in one command, with --check for drift detection and --audit for repo-wide grep against stragglers in undeclared files. Used the new tooling for this release: bump-version.sh 1.1.1 cleanly updated all three manifests; audit runs clean.
17 lines
718 B
JavaScript
17 lines
718 B
JavaScript
#!/usr/bin/env node
|
|
/**
|
|
* Generate src/version.ts from package.json so source code can reference the
|
|
* package's declared version without hardcoding it. Run as the prebuild step.
|
|
*/
|
|
import { readFileSync, writeFileSync } from 'fs';
|
|
import { dirname, join } from 'path';
|
|
import { fileURLToPath } from 'url';
|
|
|
|
const REPO_ROOT = join(dirname(fileURLToPath(import.meta.url)), '..');
|
|
const pkg = JSON.parse(readFileSync(join(REPO_ROOT, 'package.json'), 'utf-8'));
|
|
const out = `// This file is generated by scripts/generate-version.js.
|
|
// Do not edit by hand — change package.json and rebuild.
|
|
export const VERSION = ${JSON.stringify(pkg.version)};
|
|
`;
|
|
writeFileSync(join(REPO_ROOT, 'src', 'version.ts'), out, 'utf-8');
|