fix(onboarding): surface official WeCom channel install

This commit is contained in:
Vincent Koc
2026-04-23 00:28:51 -07:00
parent 1f91af17fd
commit ce4bb8f638
11 changed files with 149 additions and 34 deletions

View File

@@ -0,0 +1,27 @@
{
"entries": [
{
"name": "@wecom/wecom-openclaw-plugin",
"description": "OpenClaw WeCom channel plugin by the Tencent WeCom team.",
"source": "external",
"kind": "channel",
"openclaw": {
"channel": {
"id": "wecom",
"label": "WeCom",
"selectionLabel": "WeCom (Enterprise WeChat)",
"detailLabel": "WeCom",
"docsPath": "/plugins/community#wecom",
"docsLabel": "wecom",
"blurb": "Enterprise WeChat bot and conversation channel.",
"aliases": ["qywx", "wework", "enterprise-wechat"],
"order": 45
},
"install": {
"npmSpec": "@wecom/wecom-openclaw-plugin",
"defaultChoice": "npm"
}
}
}
]
}

View File

@@ -1,6 +1,7 @@
import fs from "node:fs";
import path from "node:path";
import { pathToFileURL } from "node:url";
import officialExternalChannelCatalog from "./lib/official-external-channel-catalog.json" with { type: "json" };
import { isRecord, trimString } from "./lib/record-shared.mjs";
import { writeTextFileIfChanged } from "./runtime-postbuild-shared.mjs";
@@ -13,9 +14,14 @@ function toCatalogInstall(value, packageName) {
return null;
}
const defaultChoice = trimString(install.defaultChoice);
const minHostVersion = trimString(install.minHostVersion);
const expectedIntegrity = trimString(install.expectedIntegrity);
return {
npmSpec,
...(defaultChoice === "npm" || defaultChoice === "local" ? { defaultChoice } : {}),
...(minHostVersion ? { minHostVersion } : {}),
...(expectedIntegrity ? { expectedIntegrity } : {}),
...(install.allowInvalidConfigRecovery === true ? { allowInvalidConfigRecovery: true } : {}),
};
}
@@ -50,7 +56,9 @@ function buildCatalogEntry(packageJson) {
export function buildOfficialChannelCatalog(params = {}) {
const repoRoot = params.cwd ?? params.repoRoot ?? process.cwd();
const extensionsRoot = path.join(repoRoot, "extensions");
const entries = [];
const entries = Array.isArray(officialExternalChannelCatalog.entries)
? [...officialExternalChannelCatalog.entries]
: [];
if (!fs.existsSync(extensionsRoot)) {
return { entries };
}