@@ -7,6 +7,10 @@ const __dirname = dirname(fileURLToPath(import.meta.url));
77const source = resolve ( __dirname , '..' , '..' , 'skills' ) ;
88const dest = resolve ( __dirname , '..' , 'skills' ) ;
99
10+ // Read the canonical version from package.json
11+ const packageJson = JSON . parse ( readFileSync ( resolve ( __dirname , '..' , 'package.json' ) , 'utf-8' ) ) ;
12+ const version = packageJson . version ;
13+
1014if ( ! existsSync ( source ) ) {
1115 console . error ( 'Error: skills/ directory not found at' , source ) ;
1216 process . exit ( 1 ) ;
@@ -17,21 +21,58 @@ removeSync(dest);
1721copySync ( source , dest ) ;
1822console . log ( `Copied skills from ${ source } to ${ dest } ` ) ;
1923
20- // Also regenerate installer/plugins/syncable-cli-skills/skills/
21- // so the Claude Code marketplace plugin stays in sync with the source skills.
24+ // ── Sync version across all files that reference it ─────────────────
25+
26+ // 1. installer/plugins/syncable-cli-skills/.claude-plugin/plugin.json
27+ const pluginJsonPath = resolve ( __dirname , '..' , 'plugins' , 'syncable-cli-skills' , '.claude-plugin' , 'plugin.json' ) ;
28+ if ( existsSync ( pluginJsonPath ) ) {
29+ const pluginJson = JSON . parse ( readFileSync ( pluginJsonPath , 'utf-8' ) ) ;
30+ pluginJson . version = version ;
31+ writeFileSync ( pluginJsonPath , JSON . stringify ( pluginJson , null , 2 ) + '\n' ) ;
32+ console . log ( `Synced plugin.json version to ${ version } ` ) ;
33+ }
34+
35+ // 2. .claude-plugin/marketplace.json (repo root)
36+ const marketplacePath = resolve ( __dirname , '..' , '..' , '.claude-plugin' , 'marketplace.json' ) ;
37+ if ( existsSync ( marketplacePath ) ) {
38+ const marketplace = JSON . parse ( readFileSync ( marketplacePath , 'utf-8' ) ) ;
39+ if ( marketplace . metadata ) marketplace . metadata . version = version ;
40+ if ( marketplace . plugins ) {
41+ for ( const plugin of marketplace . plugins ) {
42+ if ( plugin . name === 'syncable-cli-skills' ) {
43+ plugin . version = version ;
44+ }
45+ }
46+ }
47+ writeFileSync ( marketplacePath , JSON . stringify ( marketplace , null , 2 ) + '\n' ) ;
48+ console . log ( `Synced marketplace.json version to ${ version } ` ) ;
49+ }
50+
51+ // 3. PLUGIN_VERSION constant in src/transformers/claude.ts
52+ const claudeTsPath = resolve ( __dirname , '..' , 'src' , 'transformers' , 'claude.ts' ) ;
53+ if ( existsSync ( claudeTsPath ) ) {
54+ let claudeTs = readFileSync ( claudeTsPath , 'utf-8' ) ;
55+ claudeTs = claudeTs . replace (
56+ / c o n s t P L U G I N _ V E R S I O N = ' [ ^ ' ] + ' ; / ,
57+ `const PLUGIN_VERSION = '${ version } ';`
58+ ) ;
59+ writeFileSync ( claudeTsPath , claudeTs ) ;
60+ console . log ( `Synced PLUGIN_VERSION to ${ version } ` ) ;
61+ }
62+
63+ // ── Regenerate plugin skills ────────────────────────────────────────
64+
2265const pluginSkillsDir = resolve ( __dirname , '..' , 'plugins' , 'syncable-cli-skills' , 'skills' ) ;
2366removeSync ( pluginSkillsDir ) ;
2467
2568function transformSkillFile ( filePath ) {
2669 const raw = readFileSync ( filePath , 'utf-8' ) ;
27- // Parse YAML frontmatter (---\n...\n---\n)
2870 const match = raw . match ( / ^ - - - \n ( [ \s \S ] * ?) \n - - - \n ( [ \s \S ] * ) $ / ) ;
2971 if ( ! match ) return null ;
3072
3173 const frontmatterRaw = match [ 1 ] ;
3274 const body = match [ 2 ] ;
3375
34- // Extract description value (handles multi-line descriptions with quotes)
3576 const descMatch = frontmatterRaw . match ( / ^ d e s c r i p t i o n : \s * ( .+ ) $ / m) ;
3677 if ( ! descMatch ) return null ;
3778
0 commit comments