-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathsync-plugin-versions.mjs
More file actions
58 lines (50 loc) · 1.82 KB
/
sync-plugin-versions.mjs
File metadata and controls
58 lines (50 loc) · 1.82 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#!/usr/bin/env node
/*
* Copyright (c) 2025, Salesforce, Inc.
* SPDX-License-Identifier: Apache-2
*
* Sync the @salesforce/b2c-agent-plugins workspace package version into the
* plugin manifest files consumed by Claude Code and Codex.
*
* Runs as part of the root `version` script after `changeset version`.
*/
import {readFileSync, writeFileSync} from 'node:fs';
import {dirname, join} from 'node:path';
import {fileURLToPath} from 'node:url';
const repoRoot = join(dirname(fileURLToPath(import.meta.url)), '..');
function readJson(path) {
return JSON.parse(readFileSync(path, 'utf8'));
}
function writeJson(path, value) {
writeFileSync(path, JSON.stringify(value, null, 2) + '\n');
}
const pluginsPkg = readJson(join(repoRoot, 'skills/package.json'));
const version = pluginsPkg.version;
if (!version) {
console.error('skills/package.json has no version field');
process.exit(1);
}
// Claude Code marketplace: stamp version into each relevant plugins[] entry.
// b2c-dx-mcp is NOT part of b2c-agent-plugins — it tracks @salesforce/b2c-dx-mcp separately.
const marketplacePath = join(repoRoot, '.claude-plugin/marketplace.json');
const marketplace = readJson(marketplacePath);
const claudeTargets = new Set(['b2c-cli', 'b2c', 'storefront-next']);
for (const plugin of marketplace.plugins) {
if (claudeTargets.has(plugin.name)) {
plugin.version = version;
}
}
writeJson(marketplacePath, marketplace);
// Codex per-plugin manifests.
const codexTargets = [
'skills/b2c-cli/.codex-plugin/plugin.json',
'skills/b2c/.codex-plugin/plugin.json',
'skills/storefront-next/.codex-plugin/plugin.json',
];
for (const rel of codexTargets) {
const path = join(repoRoot, rel);
const manifest = readJson(path);
manifest.version = version;
writeJson(path, manifest);
}
console.log(`Synced plugin manifests to version ${version}`);