Skip to content

feat(core): add Lingma IDE support#669

Open
caohuanglin wants to merge 3 commits intoFission-AI:mainfrom
caohuanglin:feature/lingma-ide-support
Open

feat(core): add Lingma IDE support#669
caohuanglin wants to merge 3 commits intoFission-AI:mainfrom
caohuanglin:feature/lingma-ide-support

Conversation

@caohuanglin
Copy link

@caohuanglin caohuanglin commented Feb 5, 2026

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

  • Added lingma.ts command adapter with proper file path structure (.lingma/commands/opsx-<id>.md)
  • Updated registry to include Lingma adapter
  • Added Lingma to legacy cleanup patterns
  • Created comprehensive tests covering all adapter functionality
  • Updated documentation in supported-tools.md

Key Features

  • Generates 10 command files with YAML frontmatter format
  • Creates proper skill directory structure
  • Supports all standard OPSX workflow commands
  • Cross-platform path handling

Generated with Qwen using Lingma IDE

Summary by CodeRabbit

  • New Features

    • Lingma is now available as a supported tool option in OpenSpec, enabling users to configure and utilize Lingma for command generation and skill management.
  • Documentation

    • Updated CLI documentation to include Lingma in the list of supported tools for the openspec init command.

@caohuanglin caohuanglin requested a review from TabishB as a code owner February 5, 2026 19:18
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 5, 2026

📝 Walkthrough

Walkthrough

This 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

Cohort / File(s) Summary
New Lingma Adapter
src/core/command-generation/adapters/lingma.ts
Implements ToolCommandAdapter for Lingma with toolId 'lingma', file path generation to .lingma/commands/opsx/, and Markdown formatting with YAML frontmatter (name, description, category, tags) followed by body content.
Adapter Registration & Export
src/core/command-generation/adapters/index.ts, src/core/command-generation/registry.ts
Exports lingmaAdapter from index and registers it in CommandAdapterRegistry's static initializer to make the adapter available to the registry.
Configuration
src/core/config.ts
Adds Lingma entry to AI_TOOLS array with name 'Lingma', value 'lingma', skillsDir '.lingma', and availability set to true.
Documentation
docs/supported-tools.md, docs/cli.md
Adds Lingma to supported tools list, directory reference table with skills and commands paths, and available tool IDs array; updates CLI documentation for openspec init command.
Tests
test/core/command-generation/adapters.test.ts
Imports lingmaAdapter and adds comprehensive test suite validating toolId, file path generation for multiple commands, and YAML frontmatter/body formatting; extends cross-platform path handling tests.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Suggested reviewers

  • TabishB

Poem

🐰 Lingma joins the adapted fold,
With commands in the opsx mold,
Frontmatter dances, YAML rings,
Registry knows all growing things! ✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'feat(core): add Lingma IDE support' directly and specifically describes the main change - adding Lingma IDE support to the codebase.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

Your free trial has ended. If you'd like to continue receiving code reviews, you can add a payment method here.

@caohuanglin
Copy link
Author

image As shown in the screenshot, the commands can be successfully triggered.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

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 implement escapeYamlValue() 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}`;
   },
 };

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant