fix: skip invalid YAML skills and enable Planner-Sisyphus in Tab selector
- Skip skills with invalid YAML frontmatter using new parseError flag - Add mode: "primary" to Planner-Sisyphus agent config for visibility - Prevents silent failures when loading skills with malformed YAML 🤖 GENERATED WITH ASSISTANCE OF [OhMyOpenCode](https://github.com/code-yeongyu/oh-my-opencode)
This commit is contained in:
@@ -78,7 +78,9 @@ export async function loadSkillFromPathAsync(
|
||||
): Promise<LoadedSkill | null> {
|
||||
try {
|
||||
const content = await readFile(skillPath, "utf-8")
|
||||
const { data, body } = parseFrontmatter<SkillMetadata>(content)
|
||||
const { data, body, parseError } = parseFrontmatter<SkillMetadata>(content)
|
||||
if (parseError) return null
|
||||
|
||||
const frontmatterMcp = parseSkillMcpConfigFromFrontmatter(content)
|
||||
const mcpJsonMcp = await loadMcpJsonFromDirAsync(resolvedPath)
|
||||
const mcpConfig = mcpJsonMcp || frontmatterMcp
|
||||
|
||||
@@ -152,10 +152,13 @@ export function createConfigHandler(deps: ConfigHandlerDeps) {
|
||||
if (builderEnabled) {
|
||||
const { name: _buildName, ...buildConfigWithoutName } =
|
||||
configAgent?.build ?? {};
|
||||
const migratedBuildConfig = migrateAgentConfig(
|
||||
buildConfigWithoutName as Record<string, unknown>
|
||||
);
|
||||
const openCodeBuilderOverride =
|
||||
pluginConfig.agents?.["OpenCode-Builder"];
|
||||
const openCodeBuilderBase = {
|
||||
...buildConfigWithoutName,
|
||||
...migratedBuildConfig,
|
||||
description: `${configAgent?.build?.description ?? "Build agent"} (OpenCode default)`,
|
||||
};
|
||||
|
||||
@@ -167,10 +170,14 @@ export function createConfigHandler(deps: ConfigHandlerDeps) {
|
||||
if (plannerEnabled) {
|
||||
const { name: _planName, ...planConfigWithoutName } =
|
||||
configAgent?.plan ?? {};
|
||||
const migratedPlanConfig = migrateAgentConfig(
|
||||
planConfigWithoutName as Record<string, unknown>
|
||||
);
|
||||
const plannerSisyphusOverride =
|
||||
pluginConfig.agents?.["Planner-Sisyphus"];
|
||||
const plannerSisyphusBase = {
|
||||
...planConfigWithoutName,
|
||||
...migratedPlanConfig,
|
||||
mode: "primary",
|
||||
prompt: PLAN_SYSTEM_PROMPT,
|
||||
permission: PLAN_PERMISSION,
|
||||
description: `${configAgent?.plan?.description ?? "Plan agent"} (OhMyOpenCode version)`,
|
||||
@@ -197,6 +204,25 @@ export function createConfigHandler(deps: ConfigHandlerDeps) {
|
||||
)
|
||||
: {};
|
||||
|
||||
const migratedBuild = configAgent?.build
|
||||
? migrateAgentConfig(configAgent.build as Record<string, unknown>)
|
||||
: {};
|
||||
const migratedPlan = configAgent?.plan
|
||||
? migrateAgentConfig(configAgent.plan as Record<string, unknown>)
|
||||
: {};
|
||||
|
||||
const planDemoteConfig = replacePlan
|
||||
? { disable: true }
|
||||
: undefined;
|
||||
|
||||
log("DEBUG plan demotion", {
|
||||
replacePlan,
|
||||
plannerEnabled,
|
||||
hasPlannerSisyphus: !!agentConfig["Planner-Sisyphus"],
|
||||
planDemoteConfig,
|
||||
configAgentPlan: configAgent?.plan,
|
||||
});
|
||||
|
||||
config.agent = {
|
||||
...agentConfig,
|
||||
...Object.fromEntries(
|
||||
@@ -206,10 +232,8 @@ export function createConfigHandler(deps: ConfigHandlerDeps) {
|
||||
...projectAgents,
|
||||
...pluginAgents,
|
||||
...filteredConfigAgents,
|
||||
build: { ...configAgent?.build, mode: "subagent" },
|
||||
...(replacePlan
|
||||
? { plan: { ...configAgent?.plan, mode: "subagent" } }
|
||||
: {}),
|
||||
build: { ...migratedBuild, mode: "subagent", hidden: true },
|
||||
...(planDemoteConfig ? { plan: planDemoteConfig } : {}),
|
||||
};
|
||||
} else {
|
||||
config.agent = {
|
||||
|
||||
Reference in New Issue
Block a user