fix: harden plugin manifest sync script

This commit is contained in:
ming
2026-04-02 20:15:26 +08:00
parent 16f79d6f71
commit eea9c100ba
+11 -1
View File
@@ -20,6 +20,9 @@ function writeJson(filePath, value) {
} }
function syncCodexPlugin(plugin, pkg) { function syncCodexPlugin(plugin, pkg) {
const author =
typeof plugin.author === 'object' && plugin.author ? plugin.author : {};
return { return {
...plugin, ...plugin,
name: pkg.name, name: pkg.name,
@@ -30,7 +33,7 @@ function syncCodexPlugin(plugin, pkg) {
license: pkg.license, license: pkg.license,
keywords: pkg.keywords, keywords: pkg.keywords,
author: { author: {
...(plugin.author ?? {}), ...author,
name: normalizeAuthorName(pkg.author), name: normalizeAuthorName(pkg.author),
}, },
interface: { interface: {
@@ -72,6 +75,13 @@ function normalizeRepositoryUrl(repository) {
} }
function main() { function main() {
for (const filePath of [packageJsonPath, codexPluginPath, claudePluginPath]) {
if (!fs.existsSync(filePath)) {
console.error(`Missing required file: ${filePath}`);
process.exit(1);
}
}
const pkg = readJson(packageJsonPath); const pkg = readJson(packageJsonPath);
const codexPlugin = readJson(codexPluginPath); const codexPlugin = readJson(codexPluginPath);
const claudePlugin = readJson(claudePluginPath); const claudePlugin = readJson(claudePluginPath);