Skip to content

Move files from repo root into .config folder#180

Merged
ejfine merged 16 commits into
mainfrom
move-config-files
Jul 10, 2026
Merged

Move files from repo root into .config folder#180
ejfine merged 16 commits into
mainfrom
move-config-files

Conversation

@ejfine

@ejfine ejfine commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Why is this change necessary?

The repository root was cluttered with a large number of tool config files, dotfiles, and copier metadata. This moves many of them out of the root — into .config/ for tool configs and copier metadata, .github/ for community-health docs, and .claude/ for the Claude entrypoint — to keep the root lean and group related files together. The change is applied consistently across the base template and the child/grandchild template layers it generates.

How does this change address the issue?

Moved into .config/ (tool configs — each pointed at its new path via the tool's explicit config flag in .pre-commit-config.yaml, and mirror symlinks in the child/grandchild templates recreated at the new depth):

  • .coveragerc (pytest.ini --cov-config)
  • pylintrc.toml (--rcfile)
  • ruff.toml + ruff-non-src.toml (--config for ruff, ruff-format; devcontainer ruff.configuration; copier.yaml sed task)
  • pyrefly.toml and pyrefly.mutmut.toml (-c; internal project-includes/project-excludes/search-path rewritten with ../ since pyrefly resolves them relative to the config file's directory; devcontainer python.pyrefly.configPath)
  • _typos.toml (--config)
  • .prettierrc (--config; devcontainer prettier.configPath)

Moved into .github/ (GitHub auto-detects these locations):

  • CONTRIBUTING.md (relative links to README/LICENSE updated to ../)
  • CODE_OF_CONDUCT.md

Moved into .claude/:

  • CLAUDE.md.claude/CLAUDE.md (a documented, equivalent auto-load location); its import updated @AGENTS.md@../AGENTS.md.

Copier metadata moved into .config/:

  • .copier-answers.yml — grandparent _answers_file set to .config/.copier-answers.yml; the copier_answers_directory question is baked into the generated child's _answers_file; provenance parent-src discovery reads .config/ with a root fallback; the README update command carries --answers-file .config/.copier-answers.yml.
  • .copier-managed-files.jsoncopier_provenance.py now writes/reads it in .config/ (with a .config-first, root-fallback helper for mixed chains); the provenance comment stamped into managed files, AGENTS.md, and .coderabbit.yaml updated to the new path.

Not moved (for now...ran into funkiness): biome.jsonc stays at the root — Biome v2 requires its root config at the project root, and relocating it either errors (--config-path) or silently disables the config ("root": false). pyrightconfig.json and pytest.ini also stay (pyright/pytest resolve them from the root).

What side effects does this change have?

  • Existing downstream repos need a one-time manual migration (copier does not relocate existing files on update):

    • git mv .copier-answers.yml .config/.copier-answers.yml
  • copier update must always pass --answers-file .config/.copier-answers.yml — copier's update ignores _answers_file and defaults to the root path. This flag is baked into the README's documented update command; a bare copier update will fail to find the answers file.

  • IDE config auto-discovery for ruff/pyrefly/prettier is preserved via explicit *.configPath/*.configuration settings in devcontainer.json (and its jinja template).

How is this change tested?

  • pre-commit run for every affected hook against the new paths: ruff (src/non-src), ruff-format, pylint, pyrefly, biome-check, prettier, typos — all pass; verified each config is actually loaded (not vacuously passing) via -v/--dump-config/debug output.
  • Unit tests: tests/unit/copier_tasks/test_copier_provenance.py (53 pass, incl. new tests for .config-first and root-fallback manifest/answers discovery) and the full tests/unit suite (70 pass); ruff/pyright clean.
  • End-to-end copier runs from a working-tree copy: generated a child and a grandchild, confirming both .copier-answers.yml and .copier-managed-files.json land in .config/; and confirmed copier update --answers-file .config/.copier-answers.yml succeeds while a bare copier update fails.
  • Also tested in copier-nuxt-python-app and copier-python-package (and downstream grandchildren)

Other

All mirror symlinks in the template/ and template/template/ layers were recreated at the correct relative depth (and relocated into .config//.github/ sub-dirs to match). The child .claude symlink already points at the root .claude, so CLAUDE.md propagates through it without a separate symlink.

Summary by CodeRabbit

  • New Features

    • Template and project setup now consistently use a shared .config directory for editor, linting, formatting, and coverage settings.
    • Generated templates now point to centralized configuration files and updated answers/managed-files locations.
  • Bug Fixes

    • Improved schema simplification so nullable combinations are only collapsed when all branches agree, avoiding accidental data loss.
    • Updated provenance tracking and generated file headers to match the new config-based locations.
  • Documentation

    • Refreshed contributor and setup guidance to match the new project layout.

@coderabbitai

coderabbitai Bot commented Jul 9, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

This PR relocates shared configuration files (pyrefly, ruff, pylint, coverage, typos, prettier) into a .config/ directory, updates all referencing tooling (pre-commit, pytest, devcontainer, CI, Copier tasks) accordingly, moves Copier answers/provenance manifest paths under .config/, mirrors shared files via template symlinks, bumps several dependency versions, fixes documentation links, and hardens the OpenAPI anyOf collapse logic against conflicting merges.

Changes

Config directory migration and Copier provenance relocation

Layer / File(s) Summary
Relocate pyrefly configs
.config/pyrefly.mutmut.toml, .config/pyrefly.toml
Include/exclude and search paths rewritten with ../ prefixes to anchor at the repo root.
Update tooling references
.pre-commit-config.yaml, pytest.ini, pyproject.toml, .devcontainer/devcontainer.json, .github/workflows/ci.yaml
Pre-commit hooks, pytest coverage config, pyrefly mutmut path, devcontainer settings/extension versions, and CI answers-file check/cleanup all point to .config/.
Relocate answers file and provenance manifest
copier.yaml, src/copier_base_template/copier_tasks/copier_provenance.py, .coderabbit.yaml, AGENTS.md, template/README.md.jinja-base, template/copier.yml.jinja-base, tests/unit/copier_tasks/test_copier_provenance.py
Copier answers directory defaults to .config, provenance manifest/header logic and tests use .config/.copier-managed-files.json and .config/.copier-answers.yml.
Add template symlinks
template/.config/*, template/template/.config/*, template/.github/*, template/template/.github/*, template/template/.claude/CLAUDE.md
Template config/docs files are converted to symlinks pointing at shared repo-root files.
Update devcontainer/CI template files
template/.devcontainer/devcontainer.json.jinja-base, template/.github/workflows/ci.yaml.jinja-base
Extension versions bumped and settings paths updated; CI cleanup removes .config.
Bump dependency versions
extensions/context.py, template/extensions/context.py.jinja-base, pyproject.toml
FastAPI, Uvicorn, Starlette, faker versions updated in the context hook and dependency list.
Fix documentation links
.claude/CLAUDE.md, .github/CONTRIBUTING.md
Corrected relative link paths and added AGENTS.md reference.

Estimated code review effort: 3 (Moderate) | ~25 minutes

OpenAPI anyOf Collapse Safety Fix

Layer / File(s) Summary
Conflict-safe anyOf merge
src/copier_base_template/openapi/openapi_schema_simplifier.py, tests/unit/openapi/test_openapi_schema_simplifier.py
Added _merge_typed_members to detect key conflicts across typed anyOf branches and skip collapsing when merges would be lossy; new test covers conflicting format values.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

Suggested reviewers: zendern

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 4.35% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly describes the main change: moving repository files out of the root into a config directory.
Description check ✅ Passed The description covers the required change rationale, implementation, side effects, testing, and other notes; only the issue link section is missing.

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@template/template/.config/.prettierrc`:
- Line 1: The nested Prettier symlink points to the wrong target and resolves
inside the template instead of the repo-root config. Update the symbolic link
for .prettierrc under template/.config so it references the root-level
.config/.prettierrc, keeping the template aligned with the shared Prettier
configuration.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 669ffbc3-7981-4d49-be4d-e11496453cbd

📥 Commits

Reviewing files that changed from the base of the PR and between bc9dc5d and ddb4a81.

⛔ Files ignored due to path filters (1)
  • uv.lock is excluded by !**/*.lock
📒 Files selected for processing (71)
  • .claude/CLAUDE.md
  • .coderabbit.yaml
  • .config/.coveragerc
  • .config/.prettierrc
  • .config/_typos.toml
  • .config/pylintrc.toml
  • .config/pyrefly.mutmut.toml
  • .config/pyrefly.toml
  • .config/ruff-non-src.toml
  • .config/ruff.toml
  • .devcontainer/devcontainer.json
  • .github/CODE_OF_CONDUCT.md
  • .github/CONTRIBUTING.md
  • .github/workflows/ci.yaml
  • .pre-commit-config.yaml
  • AGENTS.md
  • CLAUDE.md
  • copier.yaml
  • extensions/context.py
  • pyproject.toml
  • pytest.ini
  • src/copier_base_template/copier_tasks/copier_provenance.py
  • src/copier_base_template/openapi/openapi_schema_simplifier.py
  • template/.config/.coveragerc
  • template/.config/.prettierrc
  • template/.config/_typos.toml
  • template/.config/pylintrc.toml
  • template/.config/pyrefly.toml
  • template/.config/ruff-non-src.toml
  • template/.config/ruff.toml
  • template/.coveragerc
  • template/.devcontainer/devcontainer.json.jinja-base
  • template/.github/CODE_OF_CONDUCT.md
  • template/.github/CONTRIBUTING.md
  • template/.github/workflows/ci.yaml.jinja-base
  • template/.prettierrc
  • template/CODE_OF_CONDUCT.md
  • template/CONTRIBUTING.md
  • template/README.md.jinja-base
  • template/_typos.toml
  • template/copier.yml.jinja-base
  • template/extensions/context.py.jinja-base
  • template/pylintrc.toml
  • template/pyrefly.toml
  • template/ruff-non-src.toml
  • template/ruff.toml
  • template/template/.claude/CLAUDE.md
  • template/template/.config/.prettierrc
  • template/template/.config/_typos.toml
  • template/template/.config/{% if template_uses_python %}.coveragerc{% endif %}
  • template/template/.config/{% if template_uses_python %}pylintrc.toml{% endif %}
  • template/template/.config/{% if template_uses_python %}pyrefly.mutmut.toml{% endif %}
  • template/template/.config/{% if template_uses_python %}pyrefly.toml{% endif %}
  • template/template/.config/{% if template_uses_python %}ruff-non-src.toml{% endif %}
  • template/template/.config/{% if template_uses_python %}ruff.toml{% endif %}
  • template/template/.github/CONTRIBUTING.md
  • template/template/.github/{% raw %}{% if is_open_source %}CODE_OF_CONDUCT.md{% endif %}{% endraw %}
  • template/template/.prettierrc
  • template/template/CLAUDE.md
  • template/template/CONTRIBUTING.md
  • template/template/_typos.toml
  • template/template/{% if template_uses_python %}.coveragerc{% endif %}
  • template/template/{% if template_uses_python %}pylintrc.toml{% endif %}
  • template/template/{% if template_uses_python %}pyrefly.mutmut.toml{% endif %}
  • template/template/{% if template_uses_python %}pyrefly.toml{% endif %}
  • template/template/{% if template_uses_python %}ruff-non-src.toml{% endif %}
  • template/template/{% if template_uses_python %}ruff.toml{% endif %}
  • template/template/{% raw %}{% if is_open_source %}CODE_OF_CONDUCT.md{% endif %}{% endraw %}
  • template/{% if install_claude_cli %}CLAUDE.md{% endif %}
  • tests/unit/copier_tasks/test_copier_provenance.py
  • tests/unit/openapi/test_openapi_schema_simplifier.py
💤 Files with no reviewable changes (22)
  • template/template/CONTRIBUTING.md
  • template/template/{% if template_uses_python %}ruff.toml{% endif %}
  • template/template/.prettierrc
  • template/template/{% raw %}{% if is_open_source %}CODE_OF_CONDUCT.md{% endif %}{% endraw %}
  • template/ruff.toml
  • template/CONTRIBUTING.md
  • template/ruff-non-src.toml
  • template/template/_typos.toml
  • template/template/{% if template_uses_python %}pylintrc.toml{% endif %}
  • template/template/{% if template_uses_python %}.coveragerc{% endif %}
  • template/pyrefly.toml
  • template/template/{% if template_uses_python %}ruff-non-src.toml{% endif %}
  • template/_typos.toml
  • template/template/CLAUDE.md
  • template/CODE_OF_CONDUCT.md
  • template/.prettierrc
  • template/{% if install_claude_cli %}CLAUDE.md{% endif %}
  • template/template/{% if template_uses_python %}pyrefly.mutmut.toml{% endif %}
  • template/.coveragerc
  • CLAUDE.md
  • template/pylintrc.toml
  • template/template/{% if template_uses_python %}pyrefly.toml{% endif %}

@@ -0,0 +1 @@
../../.config/.prettierrc No newline at end of file

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Fix the nested Prettier symlink path.

This currently resolves to template/.config/.prettierrc instead of the repo-root .config/.prettierrc, so the nested template will point at the wrong file.

Proposed fix
-../../.config/.prettierrc
+../../../.config/.prettierrc
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
../../.config/.prettierrc
[Symbolic link → ../../../.config/.prettierrc]
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@template/template/.config/.prettierrc` at line 1, The nested Prettier symlink
points to the wrong target and resolves inside the template instead of the
repo-root config. Update the symbolic link for .prettierrc under
template/.config so it references the root-level .config/.prettierrc, keeping
the template aligned with the shared Prettier configuration.

Comment thread CLAUDE.md

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://code.claude.com/docs/en/claude-directory#file-reference so based on this it seems it really wants CLAUDE.md to be at the root to apply at the fully project. But im guessing you didn't notice any difference b/c AGENTS.md is staying at the root and it likely picks that one up. Just something to think about if we do another pass and try to move more things from that root location.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image

@ejfine ejfine marked this pull request as ready for review July 10, 2026 17:10
@ejfine ejfine merged commit 64d80cd into main Jul 10, 2026
7 checks passed
@ejfine ejfine deleted the move-config-files branch July 10, 2026 20:01
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.

2 participants