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()
if (removedLayout) {
const memberPaneIds = runtimeState.members
.filter((member) => member.agentType !== "leader" && member.tmuxPaneId)
.map((member) => member.tmuxPaneId!)
.flatMap((member) => (
member.agentType !== "leader" && member.tmuxPaneId
? [member.tmuxPaneId]
: []
))
const cleanupTarget = runtimeState.tmuxLayout
? {
@@ -43,8 +43,8 @@ export async function applyCommandConfig(params: {
const includeClaudeSkills = params.pluginConfig.claude_code?.skills ?? true;
const externalSkillPlugin = detectExternalSkillPlugin(params.ctx.directory);
if (includeClaudeSkills && externalSkillPlugin.detected) {
log(getSkillPluginConflictWarning(externalSkillPlugin.pluginName!));
if (includeClaudeSkills && externalSkillPlugin.detected && externalSkillPlugin.pluginName) {
log(getSkillPluginConflictWarning(externalSkillPlugin.pluginName));
}
const [
+2 -2
View File
@@ -101,8 +101,8 @@ export function createSessionHooks(args: {
if (isHookEnabled("session-notification")) {
const forceEnable = pluginConfig.notification?.force_enable ?? false
const externalNotifier = detectExternalNotificationPlugin(ctx.directory)
if (externalNotifier.detected && !forceEnable) {
log(getNotificationConflictWarning(externalNotifier.pluginName!))
if (externalNotifier.detected && externalNotifier.pluginName && !forceEnable) {
log(getNotificationConflictWarning(externalNotifier.pluginName))
} else {
sessionNotification = safeHook("session-notification", () => createSessionNotification(ctx))
}
@@ -16,7 +16,7 @@ export function logLegacyPluginStartupWarning(deps: LogLegacyPluginStartupWarnin
const migrateLegacyPluginEntryFn = deps.migrateLegacyPluginEntry ?? migrateLegacyPluginEntry
const result = checkForLegacyPluginEntryFn()
if (!result.hasLegacyEntry) {
if (!result.hasLegacyEntry || !result.configPath) {
return
}
@@ -34,7 +34,7 @@ export function logLegacyPluginStartupWarning(deps: LogLegacyPluginStartupWarnin
+ ` Attempting auto-migration...`,
)
const migrated = migrateLegacyPluginEntryFn(result.configPath!)
const migrated = migrateLegacyPluginEntryFn(result.configPath)
if (migrated) {
console.warn(`[oh-my-openagent] Auto-migrated opencode.json: ${result.legacyEntries.join(", ")} -> ${suggestedEntries.join(", ")}`)
} else {