fix(installer): guard automator registry lookups

This commit is contained in:
bmad 2026-05-05 02:17:45 -03:00
parent 6b60599e3b
commit 146416e987
No known key found for this signature in database
GPG Key ID: D5BF902A907D3EB6
2 changed files with 25 additions and 4 deletions

View File

@ -217,8 +217,15 @@ class ConfigDrivenIdeSetup {
const { ExternalModuleManager } = require('../modules/external-manager');
this.externalModuleManager = this.externalModuleManager || new ExternalModuleManager();
let targets = null;
try {
const moduleInfo = await this.externalModuleManager.getModuleByCode(moduleName);
const targets = moduleInfo?.installTargets?.length ? moduleInfo.installTargets : null;
targets = moduleInfo?.installTargets?.length ? moduleInfo.installTargets : null;
} catch (error) {
await prompts.log.warn(
`ExternalModuleManager.getModuleByCode failed for module '${moduleName}' while installing ${this.name}; installing skill anyway. ${error.message}`,
);
}
this.moduleTargetCache.set(moduleName, targets);
return !targets || targets.includes(this.name);

View File

@ -961,7 +961,14 @@ class UI {
async showSelectedExternalModuleNotes(selectedModuleIds, externalModules = null) {
if (!externalModules) {
const externalManager = new ExternalModuleManager();
try {
externalModules = await externalManager.listAvailable();
} catch (error) {
await prompts.log.warn(
`ExternalModuleManager.listAvailable failed while loading module notes; continuing without external module notes. ${error.message}`,
);
externalModules = [];
}
}
const notes = externalModules
@ -975,7 +982,14 @@ class UI {
async showSelectedModuleIdeWarnings(selectedModuleIds, selectedIdes = []) {
const externalManager = new ExternalModuleManager();
const externalModules = await externalManager.listAvailable();
let externalModules = [];
try {
externalModules = await externalManager.listAvailable();
} catch (error) {
await prompts.log.warn(
`ExternalModuleManager.listAvailable failed while loading IDE compatibility warnings; continuing without external module warnings. ${error.message}`,
);
}
for (const mod of externalModules) {
if (!selectedModuleIds.includes(mod.code) || !mod.installTargets || mod.installTargets.length === 0) {