refactor: update plugin handlers and shared utils

Minor updates to config handler, plugin detector, index entry, and builtin command templates.

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

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
justsisyphus
2026-01-22 22:48:36 +09:00
parent dda502a697
commit ff92a4caa2
5 changed files with 36 additions and 10 deletions

View File

@@ -275,8 +275,8 @@ For each generated file:
Mode: {update | create-new}
Files:
./AGENTS.md (root, {N} lines)
./src/hooks/AGENTS.md ({N} lines)
[OK] ./AGENTS.md (root, {N} lines)
[OK] ./src/hooks/AGENTS.md ({N} lines)
Dirs Analyzed: {N}
AGENTS.md Created: {N}

View File

@@ -31,7 +31,7 @@ export const START_WORK_TEMPLATE = `You are starting a Sisyphus work session.
When listing plans for selection:
\`\`\`
📋 Available Work Plans
Available Work Plans
Current Time: {ISO timestamp}
Session ID: {current session id}
@@ -44,7 +44,7 @@ Which plan would you like to work on? (Enter number or plan name)
When resuming existing work:
\`\`\`
🔄 Resuming Work Session
Resuming Work Session
Active Plan: {plan-name}
Progress: {completed}/{total} tasks
@@ -55,7 +55,7 @@ Reading plan and continuing from last incomplete task...
When auto-selecting single plan:
\`\`\`
🚀 Starting Work Session
Starting Work Session
Plan: {plan-name}
Session ID: {session_id}

View File

@@ -288,7 +288,7 @@ const OhMyOpenCodePlugin: Plugin = async (ctx) => {
: null;
const configHandler = createConfigHandler({
ctx,
ctx: { directory: ctx.directory, client: ctx.client },
pluginConfig,
modelCacheState,
});

View File

@@ -12,6 +12,10 @@ import {
loadProjectSkills,
loadOpencodeGlobalSkills,
loadOpencodeProjectSkills,
discoverUserClaudeSkills,
discoverProjectClaudeSkills,
discoverOpencodeGlobalSkills,
discoverOpencodeProjectSkills,
} from "../features/opencode-skill-loader";
import {
loadUserAgents,
@@ -31,7 +35,7 @@ import type { ModelCacheState } from "../plugin-state";
import type { CategoryConfig } from "../config/schema";
export interface ConfigHandlerDeps {
ctx: { directory: string };
ctx: { directory: string; client?: any };
pluginConfig: OhMyOpenCodeConfig;
modelCacheState: ModelCacheState;
}
@@ -116,13 +120,35 @@ export function createConfigHandler(deps: ConfigHandlerDeps) {
return AGENT_NAME_MAP[agent.toLowerCase()] ?? AGENT_NAME_MAP[agent] ?? agent
}) as typeof pluginConfig.disabled_agents
const builtinAgents = createBuiltinAgents(
const includeClaudeSkillsForAwareness = pluginConfig.claude_code?.skills ?? true;
const [
discoveredUserSkills,
discoveredProjectSkills,
discoveredOpencodeGlobalSkills,
discoveredOpencodeProjectSkills,
] = await Promise.all([
includeClaudeSkillsForAwareness ? discoverUserClaudeSkills() : Promise.resolve([]),
includeClaudeSkillsForAwareness ? discoverProjectClaudeSkills() : Promise.resolve([]),
discoverOpencodeGlobalSkills(),
discoverOpencodeProjectSkills(),
]);
const allDiscoveredSkills = [
...discoveredOpencodeProjectSkills,
...discoveredProjectSkills,
...discoveredOpencodeGlobalSkills,
...discoveredUserSkills,
];
const builtinAgents = await createBuiltinAgents(
migratedDisabledAgents,
pluginConfig.agents,
ctx.directory,
config.model as string | undefined,
pluginConfig.categories,
pluginConfig.git_master
pluginConfig.git_master,
allDiscoveredSkills,
ctx.client
);
// Claude Code agents: Do NOT apply permission migration

View File

@@ -121,7 +121,7 @@ export function detectExternalNotificationPlugin(directory: string): ExternalNot
export function getNotificationConflictWarning(pluginName: string): string {
return `[oh-my-opencode] External notification plugin detected: ${pluginName}
⚠️ Both oh-my-opencode and ${pluginName} listen to session.idle events.
Both oh-my-opencode and ${pluginName} listen to session.idle events.
Running both simultaneously can cause crashes on Windows.
oh-my-opencode's session-notification has been auto-disabled.