feat: add Easy Code as a supported AI tool#1352
Conversation
- Register 'easycode' in AI_TOOLS (config.ts) with skillsDir '.easycode' - Add EasycodeAdapter (easycode.ts): generates TOML commands at .easycode/commands/opsx/<id>.toml, matching Easy Code's native format - Export easycodeAdapter from adapters/index.ts - Register easycodeAdapter in CommandAdapterRegistry Easy Code (https://easycode.ai) is a terminal-based AI coding assistant. Its commands use TOML with a description field and a prompt multiline literal string, distinct from the Markdown/YAML frontmatter format used by most other tools. Tested locally: `openspec init --tools easycode` generates 5 SKILL.md files and 5 .toml command files in the expected directory structure.
📝 WalkthroughWalkthroughAdds Easy Code as a configured AI tool and introduces a registered adapter that generates ChangesEasy Code command support
Estimated code review effort: 2 (Simple) | ~10 minutes Sequence Diagram(s)sequenceDiagram
participant CommandGenerator
participant CommandAdapterRegistry
participant easycodeAdapter
participant EasyCodeFile
CommandGenerator->>CommandAdapterRegistry: resolve easycode adapter
CommandAdapterRegistry->>easycodeAdapter: format command content
easycodeAdapter->>EasyCodeFile: write escaped TOML command file
Possibly related issues
Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with 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.
Inline comments:
In `@src/core/command-generation/adapters/easycode.ts`:
- Around line 23-25: Update formatFile to serialize both description and body
with TOML-safe encoding that preserves arbitrary content, including backslashes
and control characters in description and triple single quotes in the prompt
body. Replace the manual escaping and vulnerable literal construction with the
project’s existing TOML serializer if available, and add coverage for all three
cases.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: e6d23291-6e2c-4e6c-996b-6237e0fb710c
📒 Files selected for processing (4)
src/core/command-generation/adapters/easycode.tssrc/core/command-generation/adapters/index.tssrc/core/command-generation/registry.tssrc/core/config.ts
Per code review: the original formatFile had unsafe manual escaping
that would corrupt output for descriptions containing backslashes or
control characters, and prompt bodies containing triple-single-quotes.
Changes:
- Add src/core/command-generation/toml.ts with two helpers:
escapeTOMLBasicString — escapes \, ", \n, \r, \t for TOML
basic strings (double-quoted)
escapeTOMLMultilineString — escapes \ and \r, and breaks any
run of 3+ consecutive " (lookahead match)
for TOML basic multiline strings
- Switch prompt block from triple-single-quote literal string (''')
to triple-double-quote basic multiline string ("""), which allows
full escape sequence support and handles arbitrary body content
- Update easycode.ts to use both helpers
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with 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.
Inline comments:
In `@src/core/command-generation/toml.ts`:
- Around line 18-25: Update both TOML escaping functions, including
escapeTOMLBasicString and its multiline counterpart, to replace every remaining
disallowed control character with a TOML \uXXXX escape. Preserve existing
backslash, quote, newline, carriage-return, and tab handling, while covering
U+0000–U+0008, U+000B–U+000C, U+000E–U+001F, and U+007F according to each string
mode’s allowed characters.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 2363f698-df0b-4038-a8be-406ee3219017
📒 Files selected for processing (2)
src/core/command-generation/adapters/easycode.tssrc/core/command-generation/toml.ts
🚧 Files skipped from review as they are similar to previous changes (1)
- src/core/command-generation/adapters/easycode.ts
Per code review: TOML basic strings forbid U+0000-U+0008, U+000B-U+000C, U+000E-U+001F, and U+007F. Add escapeControlChars() helper that replaces these with \uXXXX sequences, and apply it in both escapeTOMLBasicString and escapeTOMLMultilineString after their named-escape passes.
Summary
Adds Easy Code as a supported AI tool in OpenSpec.
Easy Code is a terminal-based AI coding assistant that uses a project-local
.easycode/directory. Its slash commands are stored as TOML files (not Markdown), which required a dedicated adapter.Changes
src/core/config.tseasycodeinAI_TOOLSwithskillsDir: '.easycode'src/core/command-generation/adapters/easycode.tssrc/core/command-generation/adapters/index.tseasycodeAdaptersrc/core/command-generation/registry.tseasycodeAdaptersrc/core/command-generation/toml.tsCommand format
Easy Code commands use TOML with a
descriptionbasic string and apromptbasic multiline string:Triple-double-quote (
""") is used instead of triple-single-quote (''') because basic multiline strings support escape sequences, making it safe to embed arbitrary content (backslashes, control characters, sequences of double quotes).TOML serialization
src/core/command-generation/toml.tsprovides two helpers:escapeTOMLBasicString— escapes\\,",\n,\r,\t, and all disallowed control characters (U+0000–U+0008, U+000B–U+000C, U+000E–U+001F, U+007F) as\uXXXXescapeTOMLMultilineString— same control-character coverage, preserves real newlines, and escapes runs of 3+ consecutive"to prevent premature block terminationTesting
Tested locally against the compiled package:
Output:
.easycode/commands/opsx/{propose,explore,apply,sync,archive}.toml— correct TOML format.easycode/skills/openspec-{propose,explore,apply-change,sync-specs,archive-change}/SKILL.md— standard SKILL.md formatopenspec/config.yamlcreatedBuild:
pnpm run buildcompletes with zero TypeScript errors.