Repository navigation
feat(rules): write qwencode output-style rules to .qwen/output-styles - #3993
Merged
Merged
Conversation
A non-root rule with qwencode.channel: output-style is written as a Qwen Code custom output style (.qwen/output-styles/<name>.md, project and global) with name / description / keep-coding-instructions frontmatter, and imported back from that directory. Styles Qwen Code would skip (reserved "default" name, empty body, over 25 kB, nested source rule) are refused at generate time. Closes #2668 Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01JdNNKCxxrKAMDANMGDEGP4
A hand-written style in .qwen/output-styles/ with a name over 64 characters, a reserved name, an empty body or a size over 25 kB used to fail the whole import. It is now skipped with a warning through a new ToolRule#getImportSkipReason hook. Generate also checks the 64-character limit and control characters on the effective style name (file stem fallback), using the shared constants. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01JdNNKCxxrKAMDANMGDEGP4
…en-output-styles # Conflicts: # src/generated/docs-content.ts
Contributor
|
@dyoshikawa The CI checks on this pull request are currently failing. Please review the failing checks and push a fix. If you need help, leave a comment and a maintainer will follow up. |
…en-output-styles # Conflicts: # src/generated/docs-content.ts
…tripping Replace the single-pass `<!-- ... -->` regex removal (CodeQL js/incomplete-multi-character-sanitization) with an indexOf scan that checks the text between comments in place. Behaviour is unchanged. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01JdNNKCxxrKAMDANMGDEGP4
…en-output-styles # Conflicts: # src/generated/docs-content.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds the last open item of #2668: Qwen Code custom output style files. A non-root rule with
qwencode.channel: output-styleis now written to.qwen/output-styles/<rule file name>.md(project) /~/.qwen/output-styles/<rule file name>.md(global) instead of.qwen/rules/.rulesync import --targets qwencodereads those files back as output-style rules. Together with theqwencode.general.outputStylepermissions override (#3384), a repo can now ship a style and select it through rulesync.Upstream contract (checked against primary sources):
docs/users/features/output-styles.mdand the loaderpackages/core/src/core/output-style-files.ts. A style is a Markdown body with optionalname/description/keep-coding-instructionsfrontmatter. Only the direct*.mdchildren of the directory are read. Qwen Code skips a file with an empty body, a name that isdefault(case-insensitive) or longer than 64 characters, or a size over 25,000 bytes.Changes
src/features/rules/rulesync-rule.ts: newqwencodefrontmatter section withchannel: "output-style",name(trimmed, 1-64 chars) andkeep-coding-instructions(boolean).src/features/rules/qwencode-rule.ts: the output-style write path (buildOutputStyle), import throughfromFile/toRulesyncRule,forDeletion,getExtraFixedFiles(import-only*.mdglob) andgetRuleOptionWarnings. These reuse the shared helpers inoutput-style-paths.ts, which Qoder and Factory Droid already use.src/constants/qwencode-paths.ts: directory, reserved name and size/name limits.src/features/rules/output-style-paths.ts:qwencodeadded to the warning helper's target union.qwencode-rule.test.tscovers both scopes, bare and full frontmatter,keep-coding-instructions: false, a root rule ignoring the channel, nested / reserved / empty / oversized / long-name refusals, import round trip and warnings.rules-processor.test.tscovers import enumeration (only direct.mdchildren, never deletion) and generation into.qwen/output-stylesinstead of.qwen/rulesat both scopes.e2e-rules.spec.tsadds a generate + import round trip.docs/reference/file-formats.md. The permissions note no longer says that rulesync does not write the style files. Also updated the rulesync-feature-research qwencode reference and regenerated the docs content.Design decisions
.rulesync/rules/is refused. The output file is named after the rule file, andqwencode.namesets only the frontmattername.~/.qwen/output-styles/. rulesync cannot tell those from its own files, so--deleteleaves the directory alone. Qoder and Factory Droid already work this way. The triage plan mentioned "orphan deletion limited to output-style files rulesync owns". Rulesync has no ownership tracking for this, so I followed the existing precedent instead.defaultis refused at generate time, not in the schema. The check covers bothqwencode.nameand the file stem, because a file nameddefault.mdwith nonameis reserved too. This matches Factory Droid's reserved-name check. The triage plan proposed a schema-level rejection, which would have missed the stem case.qwencode.name, or else the file stem) that isdefault, longer than 64 characters or contains control characters, an empty body, and a file over 25,000 bytes. The checks mirror the upstream loader and avoid an output file that silently does nothing..qwen/output-styles/holds hand-written files, and before this change one bad style failed the wholerulesync import --targets qwencode. A newToolRule#getImportSkipReason()hook (defaultundefined) is checked forimportOnlyextra files in the rules processor.QwencodeRuleuses it so that import, then generate, round-trips.keep-coding-instructionsis written only when set. Upstream inherits a value from a built-in style of the same name when the key is absent, so rulesync never adds a default. Setting it without the channel prints a warning, the same way a strayqwencode.namedoes.qwencode.general.outputStylepermissions override. This PR does not wire the two together automatically.Skipped items (declined, with reasons)
.qwen/fork-profiles/*.md): frontmatter only, and Qwen Code rejects a body. They only restrict a forked context's tools and do not map onto rulesync subagents, which are defined by their body prompt (decision recorded after feat: add Qwen Code checks, MCP allow/deny lists and by-product gitignore entries #3275)..qwen/workflows/: still has nodocs/users/page upstream. The file contract is documented only in the bundledworkflow-creatorskill, so this stays deferred, as with qwencode: import should also read the Claude-parity project .mcp.json (v0.18.1, code-only surface) #2525.Every other item on this issue was already resolved by earlier PRs (#3275, #3306, #3325, #3370, #3384, #3467, #3677, #3809 and the
tools.lspEnabledcommit).Closes #2668
🤖 Generated with Claude Code
https://claude.ai/code/session_01JdNNKCxxrKAMDANMGDEGP4