Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/core/command-generation/adapters/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ export { codebuddyAdapter } from './codebuddy.js';
export { continueAdapter } from './continue.js';
export { costrictAdapter } from './costrict.js';
export { crushAdapter } from './crush.js';
export { kuramaAdapter } from './kurama.js';
export { cursorAdapter } from './cursor.js';
export { factoryAdapter } from './factory.js';
export { geminiAdapter } from './gemini.js';
Expand Down
34 changes: 34 additions & 0 deletions src/core/command-generation/adapters/kurama.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/**
* Kurama Command Adapter
*
* Formats commands for Kurama following its frontmatter specification.
*/

import path from 'path';
import type { CommandContent, ToolCommandAdapter } from '../types.js';

/**
* Kurama adapter for command generation.
* File path: .kurama/skills/<id>.md
* Frontmatter: name, description, category, tags
*/
export const kuramaAdapter: ToolCommandAdapter = {
toolId: 'kurama',

getFilePath(commandId: string): string {
return path.join('.kurama', 'skills', `${commandId}.md`);
},

formatFile(content: CommandContent): string {
const tagsStr = content.tags.join(', ');
return `---
name: ${content.name}
description: ${content.description}
category: ${content.category}
tags: [${tagsStr}]
---

${content.body}
`;
Comment on lines +22 to +32

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
rg -n "escapeYamlValue|formatFile" src/core/command-generation/adapters

Repository: Fission-AI/OpenSpec

Length of output: 5186


🏁 Script executed:

#!/bin/bash
set -euo pipefail

for f in \
  src/core/command-generation/adapters/kurama.ts \
  src/core/command-generation/adapters/claude.ts \
  src/core/command-generation/adapters/cursor.ts \
  src/core/command-generation/adapters/windsurf.ts \
  src/core/command-generation/adapters/trae.ts \
  src/core/command-generation/adapters/yaml.ts \
  src/core/command-generation/adapters/yaml.js
do
  if [ -f "$f" ]; then
    echo "===== $f ====="
    wc -l "$f"
    cat -n "$f"
    echo
  fi
done

Repository: Fission-AI/OpenSpec

Length of output: 7672


🏁 Script executed:

#!/bin/bash
set -euo pipefail

ruby -v >/dev/null 2>&1 || { echo "ruby unavailable"; exit 0; }

ruby <<'RUBY'
require 'psych'

samples = [
  ["simple", "ok", "dev", ["a", "b"]],
  ["colon", "a: b", "c", ["x"]],
  ["hash", "a # b", "c", ["x"]],
  ["comma", "a,b", "c", ["x,y"]],
  ["brackets", "[a]", "c", ["x]y"]],
  ["newline", "a\nb", "c", ["x\ny"]],
]

samples.each do |name, desc, category, tags|
  yaml = <<~YAML
  ---
  name: #{name}
  description: #{desc}
  category: #{category}
  tags: [#{tags.join(', ')}]
  ---
  YAML

  begin
    doc = Psych.load(yaml)
    puts "OK #{name}: #{doc.inspect}"
  rescue => e
    puts "ERR #{name}: #{e.class}: #{e.message}"
  end
end
RUBY

Repository: Fission-AI/OpenSpec

Length of output: 766


Escape Kurama frontmatter values before interpolation.
name, description, category, and each tag need YAML escaping here; unquoted values with :, #, [], or newlines can break the generated frontmatter. Reuse the existing escapeYamlValue helper and escape tags before joining them.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/core/command-generation/adapters/kurama.ts` around lines 22 - 32, Update
formatFile to apply the existing escapeYamlValue helper to content.name,
content.description, content.category, and every content.tags element before
interpolating or joining them. Preserve the current frontmatter structure while
ensuring all YAML values are safely escaped.

Source: Learnings

},
};
2 changes: 2 additions & 0 deletions src/core/command-generation/registry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import { codebuddyAdapter } from './adapters/codebuddy.js';
import { continueAdapter } from './adapters/continue.js';
import { costrictAdapter } from './adapters/costrict.js';
import { crushAdapter } from './adapters/crush.js';
import { kuramaAdapter } from './adapters/kurama.js';
import { cursorAdapter } from './adapters/cursor.js';
import { factoryAdapter } from './adapters/factory.js';
import { geminiAdapter } from './adapters/gemini.js';
Expand Down Expand Up @@ -54,6 +55,7 @@ export class CommandAdapterRegistry {
CommandAdapterRegistry.register(continueAdapter);
CommandAdapterRegistry.register(costrictAdapter);
CommandAdapterRegistry.register(crushAdapter);
CommandAdapterRegistry.register(kuramaAdapter);
CommandAdapterRegistry.register(cursorAdapter);
CommandAdapterRegistry.register(factoryAdapter);
CommandAdapterRegistry.register(geminiAdapter);
Expand Down
1 change: 1 addition & 0 deletions src/core/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ export const AI_TOOLS: AIToolOption[] = [
{ name: 'Continue', value: 'continue', available: true, successLabel: 'Continue (VS Code / JetBrains / Cli)', skillsDir: '.continue' },
{ name: 'CoStrict', value: 'costrict', available: true, successLabel: 'CoStrict', skillsDir: '.cospec' },
{ name: 'Crush', value: 'crush', available: true, successLabel: 'Crush', skillsDir: '.crush' },
{ name: 'Kurama', value: 'kurama', available: true, successLabel: 'Kurama', skillsDir: '.kurama' },
{ name: 'Cursor', value: 'cursor', available: true, successLabel: 'Cursor', skillsDir: '.cursor' },
{ name: 'Factory Droid', value: 'factory', available: true, successLabel: 'Factory Droid', skillsDir: '.factory' },
{ name: 'Gemini CLI', value: 'gemini', available: true, successLabel: 'Gemini CLI', skillsDir: '.gemini' },
Expand Down