aaronsb_obsidian-mcp-plugin/sync-version.mjs
Aaron Bockelie 46ed67361a chore(meta): make pattern for plugin description; rewrite copy
package.json is now the single source of truth for the plugin description
(as it already effectively is for version). sync-version.mjs propagates it
into manifest.json; mcpb/manifest.json keeps its Claude-Desktop-specific
description and is intentionally not synced.

Adds scripts/set-description.mjs + 'make set-description DESC=...' so neither
JSON file is hand-edited (250-char Obsidian limit enforced).

Rewrites the word-salad description to reality-based copy naming the actual
client and mechanism:
  'Give Claude Desktop and other AI assistants semantic access to your notes
   through a built-in Model Context Protocol (MCP) server.'
2026-05-16 12:07:52 -05:00

40 lines
No EOL
1.5 KiB
JavaScript

#!/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;
// 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;
// Read and update manifest.json
const manifest = JSON.parse(readFileSync('manifest.json', 'utf-8'));
manifest.version = version;
manifest.description = description;
// Write updated manifest.json
writeFileSync('manifest.json', JSON.stringify(manifest, null, 2) + '\n');
// 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');
// 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);
console.log(`✅ Synced version ${version} + description to manifest.json (version also: mcpb/manifest.json, version.ts)`);
} catch (error) {
console.error('❌ Failed to sync version:', error.message);
process.exit(1);
}