fix(codex): treat a literal null from the CLI as an empty list, not a 500
This commit is contained in:
@@ -258,8 +258,10 @@ async function mcpRemove(name) {
|
||||
*/
|
||||
async function pluginList() {
|
||||
const result = await runCodex(["plugin", "list", "--json"]);
|
||||
// `data` is null when stdout was the literal `null` — JSON that parses to
|
||||
// nothing. Guard it: a CLI's output must never reach the route as a 500.
|
||||
if (result.data !== undefined && !Array.isArray(result.data)) {
|
||||
result.data = Array.isArray(result.data.installed) ? result.data.installed : [];
|
||||
result.data = Array.isArray(result.data?.installed) ? result.data.installed : [];
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@@ -283,7 +285,7 @@ async function pluginRemove(spec) {
|
||||
async function marketplaceList() {
|
||||
const result = await runCodex(["plugin", "marketplace", "list", "--json"]);
|
||||
if (result.data !== undefined && !Array.isArray(result.data)) {
|
||||
result.data = Array.isArray(result.data.marketplaces) ? result.data.marketplaces : [];
|
||||
result.data = Array.isArray(result.data?.marketplaces) ? result.data.marketplaces : [];
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user