fix: address CodeRabbit review feedback

- Fix parseFrontmatter to return consistent {frontmatter} key (was {data})
- Replace yaml.dump with yaml.stringify for yaml v2 compatibility
- Add tasks and tools to setup() return value
- Use stringifyFrontmatter for safe YAML generation in launcher
- Update manager.js comment to include opencode.js
This commit is contained in:
Adit Tanu 2026-02-06 16:28:20 +07:00
parent d680e88e35
commit 38a98d46db
2 changed files with 11 additions and 9 deletions

View File

@ -44,7 +44,7 @@ class IdeManager {
/**
* Dynamically load all IDE handlers
* 1. Load custom installer files first (codex.js, kilo.js, kiro-cli.js)
* 1. Load custom installer files first (codex.js, kilo.js, kiro-cli.js, opencode.js)
* 2. Load config-driven handlers from platform-codes.yaml
*/
async loadHandlers() {

View File

@ -82,6 +82,8 @@ class OpenCodeSetup extends BaseIdeSetup {
agents: agentCount,
workflows: workflowCommandCount,
workflowCounts,
tasks,
tools,
};
}
@ -145,7 +147,7 @@ class OpenCodeSetup extends BaseIdeSetup {
parseFrontmatter(content) {
const match = content.match(/^---\s*\n([\s\S]*?)\n---\s*\n?/);
if (!match) {
return { data: {}, body: content };
return { frontmatter: {}, body: content };
}
const body = content.slice(match[0].length);
@ -162,10 +164,9 @@ class OpenCodeSetup extends BaseIdeSetup {
stringifyFrontmatter(frontmatter) {
const yamlText = yaml
.dump(frontmatter, {
.stringify(frontmatter, {
indent: 2,
lineWidth: -1,
noRefs: true,
sortKeys: false,
})
.trimEnd();
@ -225,11 +226,12 @@ class OpenCodeSetup extends BaseIdeSetup {
await this.ensureDir(agentsDir);
const launcherContent = `---
name: '${agentName}'
description: '${metadata.title || agentName} agent'
mode: 'primary'
---
const launcherFrontmatter = {
name: agentName,
description: `${metadata.title || agentName} agent`,
mode: 'primary',
};
const launcherContent = `${this.stringifyFrontmatter(launcherFrontmatter)}
You must fully embody this agent's persona and follow all activation instructions exactly as specified. NEVER break character until given an exit command.