Skip to content

feat(qodercn): add Qoder CN target with the ~/.qoder-cn/ user root - #4000

Merged
dyoshikawa merged 9 commits into
mainfrom
resolve-issue-3674-qodercn-target
Nov 26, 2026
Merged

dyoshikawa merged 9 commits into
mainfrom
resolve-issue-3674-qodercn-target

Conversation

@dyoshikawa

Copy link
Copy Markdown
Owner

Summary

Adds a qodercn target for Qoder CN, the China-region edition of Qoder (Qoder CLI CN and the Qoder CN desktop app). Qoder CN reads the same project files as Qoder, but its user-level root is ~/.qoder-cn/, not ~/.qoder/, so qoder --global output never reached it.

Upstream (checked against docs.qoder.cn on 2026-11-26):

  • config scope: user ~/.qoder-cn/settings.json, project .qoder/settings.json, .qoder/rules/, .qoder/skills/; QODERCN_CONFIG_DIR relocates the user dir.
  • memory: ~/.qoder-cn/AGENTS.md, ~/.qoder-cn/rules/**/*.md, project AGENTS.md, .qoder/rules/, AGENTS.local.md.
  • MCP: user mcpServers in ~/.qoder-cn/settings.json, project .mcp.json or .qoder/settings.json.
  • IDE rules: .qoder/rules/ and ~/.qoder-cn/rules/. The .lingma/ tree that the issue describes no longer appears in the CN docs.

Changes

  • New target qodercn ("Qoder CN") for rules, commands, subagents, skills, hooks, permissions and MCP, at project and global scope.
  • No logic is duplicated. Each qodercn class (src/features/*/qodercn-*.ts) subclasses its qoder class and only overrides globalConfigDir (.qoder-cn) and, where targets matching needs it, the target name. The qoder classes now read the global directory and their own target name from overridable statics instead of hardcoding .qoder / "qoder". They also build instances with new this(...), so subclasses round-trip as themselves.
  • QoderRule: the topic-rules and output-styles directories are resolved per scope. The root-file and output-style checks used at deletion time accept both spellings. Nested subproject rules from feat(qoder): write directory-scoped rules to <dir>/.qoder/rules #3980 work unchanged for qodercn; an import keeps targets: ["qodercn"].
  • FrontmatterMarkdownToolCommand: new getSectionKey() hook. It defaults to the tool target, and qodercn returns qoder.
  • getOutputStyleRuleOptionWarnings: now takes sectionKey, the target being generated, and the set of targets that write the same output style. As a result, targets: ["qoder", "qodercn"] no longer warns that the style "also targets other tools".
  • Override aliases qodercn → qoder in hooks (HOOKS_OVERRIDE_KEY_ALIASES), permissions (PERMISSION_OVERRIDE_KEY_ALIASES) and MCP (MCP_BLOCK_KEY_ALIASES). In project mode qodercn joins the shared root .mcp.json group.
  • The Qoder settings declaration moved into a single QODER_SETTINGS_DECLARATION, used for both .qoder/settings.json and .qoder-cn/settings.json. .qoder-cn/settings.json is a shared user-managed config, so an empty global generate does not create {}.
  • Hooks: the qoder factory entry became qoderHooksFactory(cls), so both targets share the event and matcher table.
  • Docs: a "Qoder CN note" in docs/reference/file-formats.md. The supported-tools tables and docs-content.ts are regenerated, and qodercn is added to cspell.
  • Tests: unit tests for every qodercn class (global paths, project parity with qoder, targeting, qoder section and block reuse, global import, nested rules). E2E happy-path rows were added to the rules, commands, subagents, skills, MCP, hooks and permissions matrices (project and global). A global-permissions e2e test checks that qodercn reads the qoder block and leaves ~/.qoder/ alone. The qoder global non-root rule e2e now runs for both targets.

Design decisions

  • A variant target, not a .lingma/ target or a qoder option. The CN docs now put the IDE, plugins, CLI and desktop app on the .qoder/ project tree, so only the user root differs. Rulesync picks tool homes per target, as with the kiro-cli/kiro-ide pair, so this is a separate target that reuses the qoder classes. This follows the triage plan.
  • qodercn reads Qoder's sections and blocks. These are the qoder: frontmatter section and the qoder hooks, permissions and MCP override blocks. The file format is Qoder's, and the two targets write the same project files, so separate blocks would make the shared files depend on generation order. This is the same reason the Kiro targets share kiro. targets: ["qodercn"] still selects the target on its own.
  • Both targets are allowed together and both are in *. In project mode they write byte-identical files, so selecting both is harmless (like kiro-cli + kiro-ide) and is not listed in CONFLICTING_TARGET_PAIRS. The docs tell users to pick the one for their edition.
  • No ignore support. .qoderignore is not documented for Qoder CN.
  • QODERCN_CONFIG_DIR is not followed. This changes the triage plan, which suggested honoring it. qoder does not follow QODER_CONFIG_DIR either, and supporting a home override touches the output-root resolution, shared-config keys and the import root (compare the KIMI_CODE_HOME wiring). It is better done for both Qoder targets together in a follow-up. The docs state this.
  • The project-mode qoder.autoMode warning now names both user files.

Skipped items

  • .lingma/ tree: no longer documented upstream (see above).
  • A Qoder CN IDE-specific MCP file path: not documented. The CLI's .mcp.json and settings.json paths are covered.
  • QODERCN_CONFIG_DIR: see Design decisions.

Closes #3674. Also resolves open question 2 of #2949, which pointed here.

🤖 Generated with Claude Code

https://claude.ai/code/session_01JdNNKCxxrKAMDANMGDEGP4

dyoshikawa and others added 9 commits November 26, 2026 17:31
Qoder CN (Qoder CLI CN and the Qoder CN desktop app) reads the same
project files as Qoder but keeps user-level files under ~/.qoder-cn/
instead of ~/.qoder/, so `qoder --global` output never reached it.

Add a `qodercn` target for rules, commands, subagents, skills, hooks,
permissions and MCP. Each feature subclasses the qoder class and only
swaps the global config directory; the qoder classes now read that
directory (and their target name) from an overridable static instead of
hardcoding `.qoder`. `qodercn` reads the `qoder` frontmatter section and
the `qoder` hooks/permissions/MCP blocks, and joins the shared project
`.mcp.json` group.

Closes #3674

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01JdNNKCxxrKAMDANMGDEGP4
Keep the Qoder nested subproject rules from #3980 working for qodercn:
resolve the rules directory and the imported target from the class.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01JdNNKCxxrKAMDANMGDEGP4
# Conflicts:
#	src/generated/docs-content.ts
…block

qoder and qodercn read the shared qoder override block from different
user files, so a qodercn import no longer replaces or deletes it: keys
only the existing block has are kept, a qoder.permission pattern both
define keeps the stricter action, and other overwritten values warn.
Also warn about an ignored qodercn hooks block and document the qodercn
aliases in the MCP, permissions, hooks and output-style references.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01JdNNKCxxrKAMDANMGDEGP4
Replace the semantic merge with a simpler rule: a qodercn permissions
import imports only the canonical rules, leaves the shared qoder
override block (or its absence) untouched, and warns which Qoder CN
override keys it did not import. Qoder CN values therefore never reach
qoder output, and a qoder import keeps replacing its own block.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01JdNNKCxxrKAMDANMGDEGP4
@dyoshikawa
dyoshikawa merged commit cab280e into main Nov 26, 2026
10 checks passed
@dyoshikawa
dyoshikawa deleted the resolve-issue-3674-qodercn-target branch November 26, 2026 11:13
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.

Propose a Qoder CN target: .lingma/ rules, commands, agents, skills and hooks plus ~/.qoder-cn/

1 participant