Skip to content

feat(qoder): write directory-scoped rules to <dir>/.qoder/rules - #3980

Merged
dyoshikawa merged 3 commits into
mainfrom
resolve-issue-3421-qoder-subproject-rules
Nov 26, 2026
Merged

dyoshikawa merged 3 commits into
mainfrom
resolve-issue-3421-qoder-subproject-rules

Conversation

@dyoshikawa

@dyoshikawa dyoshikawa commented Nov 26, 2026 •

Copy link
Copy Markdown
Owner

Summary

Follows the last open item of the Qoder upstream re-check in #3421: agentsmd.subprojectPath was ignored for Qoder rules, so a directory-scoped rule landed in the root .qoder/rules/. Qoder's memory docs ("Subdirectory memory", checked 2026-11-26) say <subdir>/.qoder/rules/**/*.md is not preloaded and is loaded on demand once Qoder reads a file under that subdirectory (example: /repo/packages/app/.qoder/rules/*.md).

Changes

  • QoderRule.fromRulesyncRule: a non-root, project-scope rule with agentsmd.subprojectPath (explicit or derived from globs) is written to <subprojectPath>/.qoder/rules/<name>.md, mirroring TraeRule (feat(trae): write directory-scoped rules to nested .trae/rules/ #3258).
  • QoderRule.getNestedFilePatterns: imports nested **/.qoder/rules/**/*.md (root .qoder/rules/, hidden directories and the shared nested-scan exclusions skipped; ownedDirPath so the **/.qoder/rules/ gitignore entry does not hide them).
  • QoderRule.fromFile: a nested directory is recognised before the root-file dispatch (which treats every directory other than .qoder/rules as a root-file location) and split into the subproject rules dir plus the inner path; toRulesyncRule writes targets: ["qoder"] and agentsmd.subprojectPath back.
  • Unit tests in qoder-rule.test.ts, an import/generate round-trip e2e test in e2e-rules.spec.ts, the Qoder note in docs/reference/file-formats.md (+ regenerated docs-content.ts), and the factory comment.

Design decisions

  • Same shape as the Trae and Antigravity precedents: project scope only (no workspace tree in global scope); the root rule and qoder.channel: output-style rules never nest; "" / . / ./ are treated as the project root.
  • Imported nested rules target qoder only, so the next generate does not create nested files for other tools or fold the rule into their root files.
  • Globs are rebased: Qoder matches project-rule globs "relative to the project directory containing the .qoder/ directory", so a nested rule's canonical (project-relative) globs lose the <subprojectPath>/ prefix on generate (packages/app/**/* becomes always_on), a glob outside the subproject is written as is with a warning, and import puts the prefix back so round-trips are stable. An explicit qoder.glob is tool-native and written verbatim.
  • An existing rule with subprojectPath moves from .qoder/rules/ to <dir>/.qoder/rules/; the docs say to run generate --delete once to drop the old copy.
  • Import-only nested scan: generate --delete never removes nested .qoder/rules/ files (same as every other nested scan).
  • Nested AGENTS.md / AGENTS.local.md, which Qoder also loads on demand, stay with the agentsmd target; not duplicated here.

Skipped

Verification

pnpm cicheck passes except for three time-budget tests (glob.test.ts, shell-command-categories.test.ts, opencode-hooks.test.ts) that time out on this machine (load average ~70 from parallel runs); they are unrelated to this change and shell-command-categories passes when rerun alone. The new e2e test passes.

Closes #3421

🤖 Generated with Claude Code

https://claude.ai/code/session_01JdNNKCxxrKAMDANMGDEGP4

dyoshikawa and others added 3 commits November 26, 2026 16:35
Qoder loads .qoder/rules/**/*.md in any project subdirectory on demand
once it reads a file under that directory. A non-root rule carrying
agentsmd.subprojectPath is now written to <subprojectPath>/.qoder/rules/
in project scope (mirroring Trae), and nested .qoder/rules/ folders are
imported back with targets: [qoder] and the subprojectPath carried.

Refs #3421

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01JdNNKCxxrKAMDANMGDEGP4
Qoder matches a project rule's globs relative to the directory that holds
its .qoder/ folder, so a nested rule's project-relative globs now lose the
<subprojectPath>/ prefix on generate (with a warning for globs outside the
subproject) and get it back on import. qoder.glob stays verbatim. Docs
note the move of existing subproject rules and the glob rebase.

Refs #3421

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01JdNNKCxxrKAMDANMGDEGP4
…der-subproject-rules

# Conflicts:
#	src/generated/docs-content.ts
@dyoshikawa
dyoshikawa merged commit 927d3f4 into main Nov 26, 2026
10 checks passed
@dyoshikawa
dyoshikawa deleted the resolve-issue-3421-qoder-subproject-rules branch November 26, 2026 08:08
superbiche pushed a commit to superbiche/rulesync that referenced this pull request Nov 29, 2026
Keep the Qoder nested subproject rules from dyoshikawa#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
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.

Follow up Qoder upstream updates: output styles and non-permissions settings keys unauthorable

1 participant