2025-06-27 17:15:53 +00:00
|
|
|
#!/usr/bin/env node
|
|
|
|
|
|
|
|
|
|
import { readFileSync, writeFileSync } from 'fs';
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
// Read version from package.json
|
|
|
|
|
const packageJson = JSON.parse(readFileSync('package.json', 'utf-8'));
|
|
|
|
|
const version = packageJson.version;
|
|
|
|
|
|
2026-05-16 17:07:52 +00:00
|
|
|
// package.json is the single source of truth for both version and the
|
|
|
|
|
// plugin description. mcpb/manifest.json keeps its own Claude-Desktop
|
|
|
|
|
// specific description and is intentionally not synced here.
|
|
|
|
|
const description = packageJson.description;
|
|
|
|
|
|
2025-06-27 17:15:53 +00:00
|
|
|
// Read and update manifest.json
|
|
|
|
|
const manifest = JSON.parse(readFileSync('manifest.json', 'utf-8'));
|
|
|
|
|
manifest.version = version;
|
2026-05-16 17:07:52 +00:00
|
|
|
manifest.description = description;
|
2025-06-27 17:15:53 +00:00
|
|
|
|
|
|
|
|
// Write updated manifest.json
|
|
|
|
|
writeFileSync('manifest.json', JSON.stringify(manifest, null, 2) + '\n');
|
|
|
|
|
|
2026-05-15 16:28:58 +00:00
|
|
|
// Read and update mcpb/manifest.json (MCPB bundle for Claude Desktop)
|
|
|
|
|
const mcpbManifest = JSON.parse(readFileSync('mcpb/manifest.json', 'utf-8'));
|
|
|
|
|
mcpbManifest.version = version;
|
|
|
|
|
writeFileSync('mcpb/manifest.json', JSON.stringify(mcpbManifest, null, 2) + '\n');
|
|
|
|
|
|
2025-06-27 18:11:40 +00:00
|
|
|
// Update version.ts
|
|
|
|
|
const versionTs = `// Version is injected at build time by sync-version.mjs
|
|
|
|
|
export function getVersion(): string {
|
|
|
|
|
return '${version}';
|
|
|
|
|
}
|
|
|
|
|
`;
|
|
|
|
|
writeFileSync('src/version.ts', versionTs);
|
|
|
|
|
|
2026-05-16 17:07:52 +00:00
|
|
|
console.log(`✅ Synced version ${version} + description to manifest.json (version also: mcpb/manifest.json, version.ts)`);
|
2025-06-27 17:15:53 +00:00
|
|
|
} catch (error) {
|
|
|
|
|
console.error('❌ Failed to sync version:', error.message);
|
|
|
|
|
process.exit(1);
|
|
|
|
|
}
|