fix(kilo): Fix malformed YAML in .kilocodemodes file generation
ref : https://github.com/bmad-code-org/BMAD-METHOD/issues/1154 - Properly escape customInstructions content in KiloCode mode entries - Replace newlines with spaces to prevent YAML parsing errors - Escape double quotes in instruction text - Wrap customInstructions value in quotes for valid YAML format The issue was caused by direct injection of agent-command-header.md content containing unescaped newlines and special characters, resulting in malformed YAML structure with repeated "Read the full YAML from" text fragments. Fixes: Malformed .kilocodemodes YAML file generation
This commit is contained in:
parent
c18904d674
commit
b08e9da31c
|
|
@ -119,7 +119,9 @@ class KiloSetup extends BaseIdeSetup {
|
||||||
modeEntry += ` name: '${icon} ${title}'\n`;
|
modeEntry += ` name: '${icon} ${title}'\n`;
|
||||||
modeEntry += ` roleDefinition: ${roleDefinition}\n`;
|
modeEntry += ` roleDefinition: ${roleDefinition}\n`;
|
||||||
modeEntry += ` whenToUse: ${whenToUse}\n`;
|
modeEntry += ` whenToUse: ${whenToUse}\n`;
|
||||||
modeEntry += ` customInstructions: ${activationHeader} Read the full YAML from ${relativePath} start activation to alter your state of being follow startup section instructions stay in this being until told to exit this mode\n`;
|
const customInstructions = `${activationHeader} Read the full YAML from ${relativePath} start activation to alter your state of being follow startup section instructions stay in this being until told to exit this mode`;
|
||||||
|
const escapedInstructions = customInstructions.replace(/\n/g, ' ').replace(/"/g, '\\"').trim();
|
||||||
|
modeEntry += ` customInstructions: "${escapedInstructions}"\n`;
|
||||||
modeEntry += ` groups:\n`;
|
modeEntry += ` groups:\n`;
|
||||||
modeEntry += ` - read\n`;
|
modeEntry += ` - read\n`;
|
||||||
modeEntry += ` - edit\n`;
|
modeEntry += ` - edit\n`;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue