feat(core): add Lingma IDE support#669
Conversation
📝 WalkthroughWalkthroughThis PR introduces support for the Lingma tool by implementing a new command adapter, registering it with the existing registry, exporting it from the adapters module, adding configuration entries, updating documentation, and providing test coverage for the new functionality. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ 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.
Your free trial has ended. If you'd like to continue receiving code reviews, you can add a payment method here.
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@src/core/legacy-cleanup.ts`:
- Line 36: Remove the mistaken legacy-cleanup entry for 'lingma' that points to
'.lingma/commands/opsx' so live Lingma output isn't deleted; specifically delete
the mapping with key 'lingma' in the legacy-cleanup registry (the entry
"'lingma': { type: 'directory', path: '.lingma/commands/opsx' }") so
detectLegacySlashCommands and cleanupLegacyArtifacts no longer treat the current
Lingma adapter output (see adapters/lingma.ts) as a legacy path.
🧹 Nitpick comments (1)
src/core/command-generation/adapters/lingma.ts (1)
22-32: Align YAML value escaping with windsurf and claude adapters.The lingma adapter leaves YAML values unquoted, which fails if
name,description,category, or tags contain special characters (:,#,[,{, etc.). Other adapters in this codebase—specifically windsurf and claude—already implementescapeYamlValue()for defensive YAML formatting. Adopt the same pattern here for consistency and robustness.Example using escapeYamlValue pattern
+/** + * Escapes YAML special characters in scalar values. + */ +function escapeYamlValue(value: string): string { + if (/[:#\[\]{},&*!'"|>@`]|^[-?]/.test(value)) { + return `"${value.replace(/"/g, '\\"')}"`; + } + return value; +} + +/** + * Formats a tags array as a YAML array with proper escaping. + */ +function formatTagsArray(tags: string[]): string { + const escapedTags = tags.map((tag) => escapeYamlValue(tag)); + return `[${escapedTags.join(', ')}]`; +} + export const lingmaAdapter: ToolCommandAdapter = { toolId: 'lingma', getFilePath(commandId: string): string { return path.join('.lingma', 'commands', 'opsx', `${commandId}.md`); }, formatFile(content: CommandContent): string { - const tagsStr = content.tags.join(', '); return `--- -name: ${content.name} -description: ${content.description} -category: ${content.category} -tags: [${tagsStr}] +name: ${escapeYamlValue(content.name)} +description: ${escapeYamlValue(content.description)} +category: ${escapeYamlValue(content.category)} +tags: ${formatTagsArray(content.tags)} --- ${content.body}`; }, };

PR Description
Summary
Added Lingma IDE support to OpenSpec. Lingma IDE is an Alibaba product with millions of users in China. It recently added skills and slash command support, making OpenSpec integration essential to serve this large user base with structured AI-assisted development workflows. Official website:https://lingma.aliyun.com/
Changes
lingma.tscommand adapter with proper file path structure (.lingma/commands/opsx-<id>.md)supported-tools.mdKey Features
Generated with Qwen using Lingma IDE
Summary by CodeRabbit
New Features
Documentation
openspec initcommand.