OpenSpec icon indicating copy to clipboard operation
OpenSpec copied to clipboard

fix(qwen): generate Markdown commands instead of deprecated TOML format

Open mc856 opened this issue 5 months ago β€’ 2 comments

Summary

Qwen Code has deprecated TOML custom commands in favor of Markdown files with YAML frontmatter (docs). This PR updates the Qwen adapter to emit .qwen/commands/opsx-<id>.md and registers the old opsx-*.toml files as legacy artifacts so they are cleaned up on update.

Closes #838

Changes

  • qwen adapter now generates Markdown with description frontmatter (YAML values escaped, same as the pi/claude adapters)
  • legacy-cleanup gains a .qwen/commands/opsx-*.toml pattern, following the junie/opencode precedent
  • Tests updated for the new format, plus a YAML-escaping test and a negative test ensuring new .md files are not flagged as legacy
  • docs/supported-tools.md and changeset updated

Design decisions

  • Args handling: the Markdown format supports {{args}}, but the old TOML adapter relied on Qwen's default argument appending, so this PR intentionally preserves that behavior for parity. Explicit {{args}} injection could be a follow-up.
  • Migration path: existing .qwen/commands/opsx-*.toml files are cleaned up via the same legacy-cleanup mechanism used for the junie/opencode migrations (interactive confirm on update, auto with --force). Non-interactive runs without --force warn and leave the old files in place, matching existing behavior.

Testing

  • npx vitest run β€” full suite passes (1664 tests)
  • npx eslint clean on changed files

Generated with Claude (Cowork) using claude-fable-5.

Summary by CodeRabbit

  • New Features

    • Qwen Code commands now use Markdown files with YAML frontmatter instead of TOML.
  • Bug Fixes

    • Improved detection and cleanup of legacy TOML command artifacts during updates.
  • Documentation

    • Updated docs to reflect the new Markdown-based Qwen command format and paths.
  • Tests

    • Test coverage updated to validate Markdown/YAML output and legacy detection behavior.

mc856 avatar Jun 09 '26 19:06 mc856

Review Change Stack

No actionable comments were generated in the recent review. πŸŽ‰

ℹ️ Recent review info
βš™οΈ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 76780d06-5164-4368-8faa-ce336ef25de3

πŸ“₯ Commits

Reviewing files that changed from the base of the PR and between c19d62946eabcee1ce23fef7d5c1b918eab7ee95 and 930de0cfb79ae777414a0a79e9efff16ed1f1fe0.

πŸ“’ Files selected for processing (1)
  • test/core/command-generation/registry.test.ts

πŸ“ Walkthrough

Walkthrough

This PR migrates Qwen command generation from deprecated TOML format to Markdown with YAML frontmatter, aligning with Qwen Code's current recommendations. The adapter gains a YAML-safe value escaper, legacy TOML artifacts are marked for cleanup detection, and tests are updated to validate the new format and proper character escaping.

Changes

Qwen Markdown Command Format Migration

Layer / File(s) Summary
Markdown adapter with YAML frontmatter
src/core/command-generation/adapters/qwen.ts, test/core/command-generation/adapters.test.ts
Qwen adapter now generates .md files instead of .toml. A new escapeYamlValue helper safely quotes description values with YAML-special characters. Module docs and tests updated to validate YAML frontmatter output with proper escaping.
Legacy TOML cleanup infrastructure
src/core/legacy-cleanup.ts, test/core/legacy-cleanup.test.ts
Legacy command path detection expanded to match both opsx-*.toml and openspec-*.toml patterns. Tests confirm old TOML files are flagged as legacy while new Markdown files are not.
Documentation and integration updates
.changeset/qwen-markdown-commands.md, docs/supported-tools.md, test/core/update.test.ts, test/core/command-generation/registry.test.ts
Changeset documents the format migration. Supported tools table shows .md extension. Integration and registry tests validate generated commands produce Markdown with YAML frontmatter delimiters and description: fields and adjust the no-YAML-frontmatter allowlist.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

  • Fission-AI/OpenSpec#250: Adds Qwen slash command configurators that generate .qwen/commands entries with YAML frontmatter, directly aligning with this PR's format migration.
  • Fission-AI/OpenSpec#317: Previous Qwen command-config generation logic that this PR replaces by switching from TOML to Markdown format with YAML frontmatter.
  • Fission-AI/OpenSpec#760: Related legacy-cleanup changes that allow LEGACY_SLASH_COMMAND_PATHS.pattern to be a string or array, which this PR builds upon.

Suggested reviewers

  • TabishB
  • alfred-openspec

Poem

🐰 From TOML burrows deep to Markdown's sunny glade,
YAML ribbons wrap each command we've made,
I nibble at edge-cases, escape every quote,
Now Qwen's new commands proudly skip the old noteβ€”
Hop, code, hop! The format's fresh and ready to tote.

πŸš₯ Pre-merge checks | βœ… 5
βœ… 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 accurately summarizes the main change: updating Qwen adapter to generate Markdown commands instead of deprecated TOML format, which aligns with the primary objective.
Linked Issues check βœ… Passed All coding requirements from issue #838 are met: file path changed to .md, TOML replaced with Markdown YAML frontmatter, YAML values escaped, and legacy cleanup implemented.
Out of Scope Changes check βœ… Passed All changes directly support the migration from TOML to Markdown format and legacy cleanup; no unrelated modifications detected.
Docstring Coverage βœ… Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

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

✨ Finishing Touches
πŸ§ͺ Generate unit tests (beta)
  • [ ] Create PR with unit tests

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.

coderabbitai[bot] avatar Jun 09 '26 19:06 coderabbitai[bot]

Thanks for the review! Good point on registry.test.ts β€” pushed 930de0c removing qwen from the noYamlFrontmatter list, so the registry-level test now asserts frontmatter for qwen as well. The new commit auto-dismissed the approval; re-approval appreciated when you get a chance.

mc856 avatar Jun 12 '26 02:06 mc856