From eea9c100ba38c0b8f3b5966d6e78a23336ea802e Mon Sep 17 00:00:00 2001 From: ming Date: Thu, 2 Apr 2026 20:15:26 +0800 Subject: [PATCH] fix: harden plugin manifest sync script --- scripts/sync-plugin-manifests.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/scripts/sync-plugin-manifests.js b/scripts/sync-plugin-manifests.js index 23c12285..3a364978 100644 --- a/scripts/sync-plugin-manifests.js +++ b/scripts/sync-plugin-manifests.js @@ -20,6 +20,9 @@ function writeJson(filePath, value) { } function syncCodexPlugin(plugin, pkg) { + const author = + typeof plugin.author === 'object' && plugin.author ? plugin.author : {}; + return { ...plugin, name: pkg.name, @@ -30,7 +33,7 @@ function syncCodexPlugin(plugin, pkg) { license: pkg.license, keywords: pkg.keywords, author: { - ...(plugin.author ?? {}), + ...author, name: normalizeAuthorName(pkg.author), }, interface: { @@ -72,6 +75,13 @@ function normalizeRepositoryUrl(repository) { } 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 codexPlugin = readJson(codexPluginPath); const claudePlugin = readJson(claudePluginPath);