import type { CommandResolver as CommandResolverType } from './che_상업투자.js'; export type DomesticCommandKey = 'che_상업투자'; export type DomesticCommandImporter = () => Promise<{ CommandResolver: typeof CommandResolverType; }>; const defaultImporters: Record = { che_상업투자: async () => import('./che_상업투자.js'), }; export class DomesticCommandLoader { constructor( private readonly importers: Record< DomesticCommandKey, DomesticCommandImporter > = defaultImporters ) {} async load( key: DomesticCommandKey ): Promise<{ CommandResolver: typeof CommandResolverType }> { const importer = this.importers[key]; if (!importer) { throw new Error(`Unknown domestic command key: ${key}`); } return importer(); } async create(key: DomesticCommandKey, ...args: unknown[]): Promise { const { CommandResolver } = await this.load(key); return new CommandResolver(...args); } }