Skip to content

docs(worktree): fix stale rename example + document copyFiles properly#1328

Merged
Wirasm merged 1 commit intodevfrom
docs/worktree-copy-files-clarification
Apr 21, 2026
Merged

docs(worktree): fix stale rename example + document copyFiles properly#1328
Wirasm merged 1 commit intodevfrom
docs/worktree-copy-files-clarification

Conversation

@Wirasm
Copy link
Copy Markdown
Collaborator

@Wirasm Wirasm commented Apr 21, 2026

Summary

Three related fixes around worktree.copyFiles documentation. No code changes.

Context

The worktree.copyFiles primitive copies gitignored files/dirs from the canonical repo into new worktrees — exactly the mechanism that lets workflows, .env files, local plans, agent reports etc. reach isolated branches even when git worktree add alone would leave them behind. It's the right primitive for the common "team repo doesn't want `.archon/` committed" ask (see the #1144 close comment).

But the docs have three problems that make it easy to miss or misuse:

  1. Stale rename syntax example that silently does nothing. Both reference/configuration.md and getting-started/overview.md showed - .env.example -> .env # Rename during copy. The -> parser was removed in 🐛 [Bug]: Fix DOCS inside project pls #739 (2026-03-19) after it caused the stale-credentials bug in Feature Request: consider loosening (or overriding) URL validity for knowledge scraping #228 — but the docs kept advertising it. A user writing .env.example -> .env today gets parseCopyFileEntry returning {source: '.env.example -> .env', destination: '.env.example -> .env'}, stat() fails with ENOENT, and the copy silently no-ops at debug level. No error surfaced.

  2. No explanation of when or why to use it. Three mentions across all docs, all bare config snippets. No framing of the root cause (git worktree = tracked files only) or common entries beyond .env.

  3. .archon/ default described vaguely, with no mention that users don't need to list it.

Changes

  • reference/configuration.md

    • Drop the broken -> .env rename line from the main config example
    • Replace the one-line "Default behavior" note with a "Worktree file copying" subsection that explains the root cause, the .archon/ default, common entries (.env, .vscode/, .claude/, plans/, reports/, data fixtures), full semantics (source=destination, ENOENT silent skip, per-entry error isolation, path-traversal rejected), and interaction with worktree.path
  • getting-started/overview.md

    • Update the example from .env.example + .env (which implied rename) to .env + plans/
    • Add a comment noting that .archon/ is auto-copied so users don't list it

Test plan

  • bun run format:check and bun run lint green locally
  • Reviewed rendered markdown — subsection nests correctly under ## Configuration siblings, links still intact

Summary by CodeRabbit

  • Documentation
    • Updated worktree.copyFiles configuration examples in getting started guide
    • Expanded worktree.copyFiles documentation with detailed explanations of behavior, error handling, and common usage examples

Three related fixes around the `worktree.copyFiles` primitive:

1. Remove the `.env.example -> .env` rename example from
   reference/configuration.md and getting-started/overview.md. The
   `->` parser was removed in #739 (2026-03-19) because it caused
   the stale-credentials production bug in #228 — but the docs kept
   advertising it. A user writing `.env.example -> .env` today gets
   `parseCopyFileEntry` returning `{source: '.env.example -> .env',
   destination: '.env.example -> .env'}`, stat() fails with ENOENT,
   and the copy silently no-ops at debug level.

2. Replace the single-line "Default behavior: .archon/ is always
   copied" note with a proper "Worktree file copying" subsection
   that explains:
   - Why this exists (git worktree add = tracked files only; gitignored
     workflow inputs need this hook)
   - The `.archon/` default (no config needed for the common case)
   - Common entries: .env, .vscode/, .claude/, plans/, reports/,
     data fixtures
   - Semantics: source=destination, ENOENT silently skipped, per-entry
     error isolation, path-traversal rejected
   - Interaction with `worktree.path` (both layouts get the same
     treatment)

3. Update the overview example to drop the `.env.example + .env` pair
   (which implied rename semantics) in favor of `.env + plans/`, and
   call out that `.archon/` is auto-copied so users don't list it.

No code changes. `bun run format:check` and `bun run lint` green.
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 21, 2026

Caution

Review failed

Pull request was closed or merged during review

📝 Walkthrough

Walkthrough

Documentation updates for the worktree.copyFiles configuration feature: replaced .env.example with .env in examples, expanded copyFiles list to include plans/, and added comprehensive semantics documentation clarifying automatic .archon/ copying and error handling behavior.

Changes

Cohort / File(s) Summary
worktree.copyFiles Documentation
packages/docs-web/src/content/docs/getting-started/overview.md, packages/docs-web/src/content/docs/reference/configuration.md
Updated configuration examples and expanded reference documentation: changed from copying .env.example to .env, added plans/ to copyFiles list, clarified that .archon/ is copied automatically, and added detailed semantics covering gitignored file copying behavior, path handling, error management, and consistency across worktree layout types.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐰 Hops through docs with gentle care,
Configuration now crystal clear,
Plans and envs, files now fair,
Archon paths need not appear!
Semantics bloom in text so bright

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the primary change: fixing a stale rename example and properly documenting the copyFiles feature for worktrees.
Description check ✅ Passed The description is well-structured with clear sections covering summary, context, and detailed changes, though it does not follow the full template structure with UX Journey, Architecture Diagram, and other metadata sections.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch docs/worktree-copy-files-clarification

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.

@Wirasm Wirasm merged commit ba4b9b4 into dev Apr 21, 2026
3 of 4 checks passed
@Wirasm Wirasm deleted the docs/worktree-copy-files-clarification branch April 21, 2026 09:15
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.

1 participant