fix(ci): restore typecheck on main

This commit is contained in:
Peter Steinberger
2026-04-04 09:05:12 +01:00
parent da50b492c8
commit 8cec7c68b9
5 changed files with 28 additions and 8 deletions

View File

@@ -1,3 +1,4 @@
import { createJiti } from "jiti";
import { describeAccountSnapshot } from "openclaw/plugin-sdk/account-helpers";
import { formatAllowFromLowercase } from "openclaw/plugin-sdk/allow-from";
import { adaptScopedAccountAccessor } from "openclaw/plugin-sdk/channel-config-helpers";
@@ -19,20 +20,31 @@ export const DISCORD_CHANNEL = "discord" as const;
type DiscordDoctorModule = typeof import("./doctor.js");
let discordDoctorModulePromise: Promise<DiscordDoctorModule> | undefined;
let discordDoctorLoader: ReturnType<typeof createJiti> | undefined;
let cachedDiscordDoctorModule: DiscordDoctorModule | undefined;
async function loadDiscordDoctorModule(): Promise<DiscordDoctorModule> {
discordDoctorModulePromise ??= import("./doctor.js");
return await discordDoctorModulePromise;
}
function loadDiscordDoctorModuleSync(): DiscordDoctorModule {
if (cachedDiscordDoctorModule) {
return cachedDiscordDoctorModule;
}
discordDoctorLoader ??= createJiti(import.meta.url, { interopDefault: true });
cachedDiscordDoctorModule = discordDoctorLoader("./doctor.js") as DiscordDoctorModule;
return cachedDiscordDoctorModule;
}
const discordDoctor: ChannelDoctorAdapter = {
dmAllowFromMode: "topOrNested",
groupModel: "route",
groupAllowFromFallbackToAllowFrom: false,
warnOnEmptyGroupSenderAllowlist: false,
legacyConfigRules: DISCORD_LEGACY_CONFIG_RULES,
normalizeCompatibilityConfig: async (params) =>
(await loadDiscordDoctorModule()).discordDoctor.normalizeCompatibilityConfig?.(params) ?? {
normalizeCompatibilityConfig: (params) =>
loadDiscordDoctorModuleSync().discordDoctor.normalizeCompatibilityConfig?.(params) ?? {
config: params.cfg,
changes: [],
},
@@ -40,8 +52,8 @@ const discordDoctor: ChannelDoctorAdapter = {
(await loadDiscordDoctorModule()).discordDoctor.collectPreviewWarnings?.(params) ?? [],
collectMutableAllowlistWarnings: async (params) =>
(await loadDiscordDoctorModule()).discordDoctor.collectMutableAllowlistWarnings?.(params) ?? [],
repairConfig: async (params) =>
(await loadDiscordDoctorModule()).discordDoctor.repairConfig?.(params) ?? {
repairConfig: (params) =>
loadDiscordDoctorModuleSync().discordDoctor.repairConfig?.(params) ?? {
config: params.cfg,
changes: [],
},