Skip to content

Conversation

@TabishB
Copy link
Contributor

@TabishB TabishB commented Nov 19, 2025

Fixes #293. Qwen Code requires TOML format for custom commands. This PR updates the Qwen configurator to generate TOML files instead of Markdown, reusing logic from the Gemini configurator.

Summary by CodeRabbit

Release Notes

  • Refactor
    • Unified slash command configuration format: all AI tool integrations now use TOML format instead of Markdown for improved consistency and maintainability.
    • Configuration metadata, descriptions, and command prompts are now standardized through a unified TOML-based structure.
    • Template file extensions updated from .md to .toml across all supported tool integrations including Qwen, Gemini, Windsurf, Claude, Cursor, and OpenCode.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 19, 2025

Walkthrough

The changes introduce a unified TOML-based infrastructure for slash command configurators. A new abstract TomlSlashCommandConfigurator base class is created to encapsulate TOML-specific logic for file generation and marker-based updates. The Gemini and Qwen configurators are refactored to extend this base class, eliminating duplicate TOML handling code. Tests are updated to reflect the migration from Markdown to TOML format.

Changes

Cohort / File(s) Summary
TOML Base Infrastructure
src/core/configurators/slash/toml-base.ts
New abstract base class extending SlashCommandConfigurator that implements TOML-specific logic: generateAll method for batch file generation/updates, generateTOML helper for TOML content formatting with description and prompt fields wrapped with OpenSpec markers, updateBody for in-place marker-based body replacement with validation, and abstract getDescription method for subclass implementation.
Configurators Refactored to TOML
src/core/configurators/slash/gemini.ts,
src/core/configurators/slash/qwen.ts
Both classes migrated to extend TomlSlashCommandConfigurator instead of SlashCommandConfigurator. Removed custom TOML generation, frontmatter handling, and file update logic (now inherited from base class). Introduced DESCRIPTIONS constant mapping and getDescription method. File paths updated to reference .toml files instead of .md.
Test Updates
test/core/init.test.ts,
test/core/update.test.ts
Updated test expectations to reflect TOML-based slash command templates: file extensions changed from .md to .toml, content assertions updated to verify TOML syntax (description fields, prompt blocks), and log message expectations adjusted for new file paths.

Sequence Diagram(s)

sequenceDiagram
    participant Caller
    participant Configurator as Concrete Configurator<br/>(Gemini/Qwen)
    participant Base as TomlSlashCommandConfigurator
    participant FS as File System
    
    Caller->>Configurator: generateAll()
    Configurator->>Base: generateAll()
    
    loop for each target
        Base->>FS: file exists?
        
        alt File exists
            Base->>FS: read file
            Base->>Base: updateBody()<br/>validate & replace<br/>OpenSpec markers
            Base->>FS: write updated file
        else File not found
            Configurator->>Base: getDescription(id)
            Configurator->>Configurator: compute body
            Base->>Base: generateTOML()<br/>format with description<br/>& prompt block
            Base->>FS: write new TOML file
        end
        
        Base->>Base: collect file path
    end
    
    Base-->>Caller: return touched paths
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

  • Key areas requiring attention:
    • New TomlSlashCommandConfigurator abstract base class logic, particularly the updateBody method's marker validation and replacement logic to ensure correct error handling when markers are missing or misordered
    • generateTOML helper method to verify proper TOML formatting and marker placement around the prompt body
    • Inheritance chain in Gemini and Qwen configurators to ensure proper method overriding and that getDescription is correctly implemented
    • Test assertions for TOML syntax compliance across both init and update test files to verify format consistency

Possibly related PRs

Poem

🐰 Configurators hop to TOML today,
No more markdown tangled every way!
Base class wisdom shared with care,
Gemini, Qwen—a pattern fair! ✨

Pre-merge checks and finishing touches

✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'fix: generate TOML commands for Qwen Code' directly summarizes the main change: updating Qwen configurator to generate TOML format instead of Markdown.
Linked Issues check ✅ Passed The PR successfully addresses issue #293 by implementing TOML generation for Qwen Code commands, matching the requirement that Qwen Code requires TOML-based command files.
Out of Scope Changes check ✅ Passed The PR includes changes to Gemini and a new TomlSlashCommandConfigurator base class. While broader than just Qwen, these are necessary supporting refactorings to enable TOML generation across configurators and avoid code duplication.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/qwen-toml-commands

📜 Recent review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 1050e57 and 7d5d0ea.

📒 Files selected for processing (5)
  • src/core/configurators/slash/gemini.ts (2 hunks)
  • src/core/configurators/slash/qwen.ts (3 hunks)
  • src/core/configurators/slash/toml-base.ts (1 hunks)
  • test/core/init.test.ts (3 hunks)
  • test/core/update.test.ts (4 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
src/core/configurators/slash/toml-base.ts (2)
src/utils/file-system.ts (1)
  • FileSystemUtils (44-187)
src/core/config.ts (1)
  • OPENSPEC_MARKERS (3-6)
🔇 Additional comments (16)
src/core/configurators/slash/qwen.ts (4)

8-8: LGTM! Class inheritance updated correctly.

The migration to extend TomlSlashCommandConfigurator is correct and aligns with the PR objective to generate TOML format for Qwen Code.

Also applies to: 36-36


15-19: LGTM! File paths updated to TOML format.

The file paths have been correctly updated from .md to .toml extensions, addressing the issue where Qwen Code requires TOML format for custom commands.


21-25: LGTM! Descriptions are clear and consistent.

The descriptions are well-written and consistent with other TOML-based configurators in the codebase.


52-54: LGTM! getDescription implementation is correct.

The method correctly implements the abstract getDescription method from the base class and returns the appropriate description for each command ID.

src/core/configurators/slash/toml-base.ts (5)

1-10: LGTM! Imports and base class structure are correct.

The imports are appropriate and the class correctly extends SlashCommandConfigurator to provide TOML-specific behavior.


12-12: LGTM! Abstract method appropriately defined.

The abstract getDescription method correctly requires subclasses to provide command-specific descriptions.


15-33: LGTM! generateAll method logic is correct.

The method correctly handles both creating new TOML files and updating existing ones, returning the list of affected paths for logging purposes.


35-48: LGTM! TOML generation is correctly formatted.

The method properly constructs TOML content with:

  • A description field using double quotes
  • A multi-line prompt field using triple quotes (TOML spec compliant)
  • OpenSpec markers embedded within the prompt value

51-65: LGTM! Marker-based update logic is correct.

The updateBody method correctly:

  • Reads existing file content
  • Locates OpenSpec markers
  • Validates marker presence and order
  • Replaces content between markers while preserving surrounding content
  • Writes the updated content back to the file

The string slicing logic is correct: the before variable includes the start marker, and the after variable includes the end marker, with the new body inserted between them.

src/core/configurators/slash/gemini.ts (2)

1-2: LGTM! Gemini configurator successfully migrated to TOML base class.

The migration to extend TomlSlashCommandConfigurator eliminates code duplication by reusing the common TOML generation logic from the base class.

Also applies to: 16-16


24-26: LGTM! getDescription implementation is correct.

The method correctly implements the abstract getDescription method from the base class.

test/core/init.test.ts (3)

53-53: Trivial formatting change.

The space added between the empty braces has no functional impact. This is a stylistic change.


427-436: LGTM! Test file paths updated correctly.

The test paths have been correctly updated to .toml extensions, matching the implementation changes in the Qwen configurator.


449-459: LGTM! Test expectations correctly updated to TOML format.

The tests now correctly verify:

  • TOML description fields with proper syntax (description = "...")
  • TOML prompt fields with triple-quoted strings (prompt = """..."""")
  • OpenSpec markers within the prompt content
  • Command-specific content
test/core/update.test.ts (2)

152-189: LGTM! Qwen refresh test correctly updated for TOML format.

The test correctly:

  • Creates a TOML file with proper structure
  • Verifies the description and prompt fields are preserved
  • Confirms the body content is updated within the markers
  • Expects the correct .toml path in log messages

191-227: LGTM! Test correctly verifies update-only behavior.

The test confirms that the update command only refreshes existing TOML files and does not create new ones, which is the expected behavior. File paths are correctly updated to .toml extensions.

Tip

📝 Customizable high-level summaries are now available in beta!

You can now customize how CodeRabbit generates the high-level summary in your pull requests — including its content, structure, tone, and formatting.

  • Provide your own instructions using the high_level_summary_instructions setting.
  • Format the summary however you like (bullet lists, tables, multi-section layouts, contributor stats, etc.).
  • Use high_level_summary_in_walkthrough to move the summary from the description to the walkthrough section.

Example instruction:

"Divide the high-level summary into five sections:

  1. 📝 Description — Summarize the main change in 50–60 words, explaining what was done.
  2. 📓 References — List relevant issues, discussions, documentation, or related PRs.
  3. 📦 Dependencies & Requirements — Mention any new/updated dependencies, environment variable changes, or configuration updates.
  4. 📊 Contributor Summary — Include a Markdown table showing contributions:
    | Contributor | Lines Added | Lines Removed | Files Changed |
  5. ✔️ Additional Notes — Add any extra reviewer context.
    Keep each section concise (under 200 words) and use bullet or numbered lists for clarity."

Note: This feature is currently in beta for Pro-tier users, and pricing will be announced later.


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.

@TabishB
Copy link
Contributor Author

TabishB commented Nov 19, 2025

@coderabbitai review

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 19, 2025

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

1 similar comment
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 19, 2025

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@TabishB TabishB merged commit b5a7d09 into main Nov 19, 2025
7 checks passed
Balancor pushed a commit to Balancor/OpenSpec that referenced this pull request Nov 29, 2025
fenghaitao pushed a commit to fenghaitao/OpenSpec that referenced this pull request Dec 10, 2025
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.

the command is not working in Qwen code

2 participants