fix(catalog): preserve channel ClawHub specs

This commit is contained in:
Vincent Koc
2026-05-03 02:59:49 -07:00
parent a4c1c28a17
commit 961575ddf7
3 changed files with 42 additions and 3 deletions

View File

@@ -9,16 +9,20 @@ export const OFFICIAL_CHANNEL_CATALOG_RELATIVE_PATH = "dist/channel-catalog.json
function toCatalogInstall(value, packageName) {
const install = isRecord(value) ? value : {};
const clawhubSpec = trimString(install.clawhubSpec);
const npmSpec = trimString(install.npmSpec) || packageName;
if (!npmSpec) {
if (!clawhubSpec && !npmSpec) {
return null;
}
const defaultChoice = trimString(install.defaultChoice);
const minHostVersion = trimString(install.minHostVersion);
const expectedIntegrity = trimString(install.expectedIntegrity);
return {
npmSpec,
...(defaultChoice === "npm" || defaultChoice === "local" ? { defaultChoice } : {}),
...(clawhubSpec ? { clawhubSpec } : {}),
...(npmSpec ? { npmSpec } : {}),
...(defaultChoice === "clawhub" || defaultChoice === "npm" || defaultChoice === "local"
? { defaultChoice }
: {}),
...(minHostVersion ? { minHostVersion } : {}),
...(expectedIntegrity ? { expectedIntegrity } : {}),
...(install.allowInvalidConfigRecovery === true ? { allowInvalidConfigRecovery: true } : {}),