refactor(plugin): remove metadata assertions

Guard optional plugin metadata and pane identifiers before passing them to cleanup and warning paths.

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
YeonGyu-Kim
2026-05-15 16:31:13 +09:00
parent 0a3d1875f7
commit a9886ccbb7
4 changed files with 11 additions and 8 deletions
@@ -103,8 +103,11 @@ export async function deleteTeam(
const removedLayout = config.tmux_visualization && tmuxMgr !== undefined && deps.canVisualize() const removedLayout = config.tmux_visualization && tmuxMgr !== undefined && deps.canVisualize()
if (removedLayout) { if (removedLayout) {
const memberPaneIds = runtimeState.members const memberPaneIds = runtimeState.members
.filter((member) => member.agentType !== "leader" && member.tmuxPaneId) .flatMap((member) => (
.map((member) => member.tmuxPaneId!) member.agentType !== "leader" && member.tmuxPaneId
? [member.tmuxPaneId]
: []
))
const cleanupTarget = runtimeState.tmuxLayout const cleanupTarget = runtimeState.tmuxLayout
? { ? {
@@ -43,8 +43,8 @@ export async function applyCommandConfig(params: {
const includeClaudeSkills = params.pluginConfig.claude_code?.skills ?? true; const includeClaudeSkills = params.pluginConfig.claude_code?.skills ?? true;
const externalSkillPlugin = detectExternalSkillPlugin(params.ctx.directory); const externalSkillPlugin = detectExternalSkillPlugin(params.ctx.directory);
if (includeClaudeSkills && externalSkillPlugin.detected) { if (includeClaudeSkills && externalSkillPlugin.detected && externalSkillPlugin.pluginName) {
log(getSkillPluginConflictWarning(externalSkillPlugin.pluginName!)); log(getSkillPluginConflictWarning(externalSkillPlugin.pluginName));
} }
const [ const [
+2 -2
View File
@@ -101,8 +101,8 @@ export function createSessionHooks(args: {
if (isHookEnabled("session-notification")) { if (isHookEnabled("session-notification")) {
const forceEnable = pluginConfig.notification?.force_enable ?? false const forceEnable = pluginConfig.notification?.force_enable ?? false
const externalNotifier = detectExternalNotificationPlugin(ctx.directory) const externalNotifier = detectExternalNotificationPlugin(ctx.directory)
if (externalNotifier.detected && !forceEnable) { if (externalNotifier.detected && externalNotifier.pluginName && !forceEnable) {
log(getNotificationConflictWarning(externalNotifier.pluginName!)) log(getNotificationConflictWarning(externalNotifier.pluginName))
} else { } else {
sessionNotification = safeHook("session-notification", () => createSessionNotification(ctx)) sessionNotification = safeHook("session-notification", () => createSessionNotification(ctx))
} }
@@ -16,7 +16,7 @@ export function logLegacyPluginStartupWarning(deps: LogLegacyPluginStartupWarnin
const migrateLegacyPluginEntryFn = deps.migrateLegacyPluginEntry ?? migrateLegacyPluginEntry const migrateLegacyPluginEntryFn = deps.migrateLegacyPluginEntry ?? migrateLegacyPluginEntry
const result = checkForLegacyPluginEntryFn() const result = checkForLegacyPluginEntryFn()
if (!result.hasLegacyEntry) { if (!result.hasLegacyEntry || !result.configPath) {
return return
} }
@@ -34,7 +34,7 @@ export function logLegacyPluginStartupWarning(deps: LogLegacyPluginStartupWarnin
+ ` Attempting auto-migration...`, + ` Attempting auto-migration...`,
) )
const migrated = migrateLegacyPluginEntryFn(result.configPath!) const migrated = migrateLegacyPluginEntryFn(result.configPath)
if (migrated) { if (migrated) {
console.warn(`[oh-my-openagent] Auto-migrated opencode.json: ${result.legacyEntries.join(", ")} -> ${suggestedEntries.join(", ")}`) console.warn(`[oh-my-openagent] Auto-migrated opencode.json: ${result.legacyEntries.join(", ")} -> ${suggestedEntries.join(", ")}`)
} else { } else {