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:
parent
d680e88e35
commit
38a98d46db
|
|
@ -44,7 +44,7 @@ class IdeManager {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Dynamically load all IDE handlers
|
* 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
|
* 2. Load config-driven handlers from platform-codes.yaml
|
||||||
*/
|
*/
|
||||||
async loadHandlers() {
|
async loadHandlers() {
|
||||||
|
|
|
||||||
|
|
@ -82,6 +82,8 @@ class OpenCodeSetup extends BaseIdeSetup {
|
||||||
agents: agentCount,
|
agents: agentCount,
|
||||||
workflows: workflowCommandCount,
|
workflows: workflowCommandCount,
|
||||||
workflowCounts,
|
workflowCounts,
|
||||||
|
tasks,
|
||||||
|
tools,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -145,7 +147,7 @@ class OpenCodeSetup extends BaseIdeSetup {
|
||||||
parseFrontmatter(content) {
|
parseFrontmatter(content) {
|
||||||
const match = content.match(/^---\s*\n([\s\S]*?)\n---\s*\n?/);
|
const match = content.match(/^---\s*\n([\s\S]*?)\n---\s*\n?/);
|
||||||
if (!match) {
|
if (!match) {
|
||||||
return { data: {}, body: content };
|
return { frontmatter: {}, body: content };
|
||||||
}
|
}
|
||||||
|
|
||||||
const body = content.slice(match[0].length);
|
const body = content.slice(match[0].length);
|
||||||
|
|
@ -162,10 +164,9 @@ class OpenCodeSetup extends BaseIdeSetup {
|
||||||
|
|
||||||
stringifyFrontmatter(frontmatter) {
|
stringifyFrontmatter(frontmatter) {
|
||||||
const yamlText = yaml
|
const yamlText = yaml
|
||||||
.dump(frontmatter, {
|
.stringify(frontmatter, {
|
||||||
indent: 2,
|
indent: 2,
|
||||||
lineWidth: -1,
|
lineWidth: -1,
|
||||||
noRefs: true,
|
|
||||||
sortKeys: false,
|
sortKeys: false,
|
||||||
})
|
})
|
||||||
.trimEnd();
|
.trimEnd();
|
||||||
|
|
@ -225,11 +226,12 @@ class OpenCodeSetup extends BaseIdeSetup {
|
||||||
|
|
||||||
await this.ensureDir(agentsDir);
|
await this.ensureDir(agentsDir);
|
||||||
|
|
||||||
const launcherContent = `---
|
const launcherFrontmatter = {
|
||||||
name: '${agentName}'
|
name: agentName,
|
||||||
description: '${metadata.title || agentName} agent'
|
description: `${metadata.title || agentName} agent`,
|
||||||
mode: 'primary'
|
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.
|
You must fully embody this agent's persona and follow all activation instructions exactly as specified. NEVER break character until given an exit command.
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue