Skip to content

Never stop coding. Free MIT AI gateway: one endpoint, 375 providers (150+ free), 1,400+ models Kimi, Claude, GPT, Gemini, GLM, DeepSeek, MiniMax. Works with Claude Code, Codex, Cursor, OpenCode, Cline & Copilot. Quota-aware auto-fallback, RTK+Caveman compression saves 15-95% tokens, MCP/A2A, Desktop/PWA. Built by 900+ contributors

fix(build): exclude .claude/.worktrees from tsconfig scope to stop next build OOM (#5031)

Diego Rodrigues de Sa e Souzab5c789a3b4a2
diff --git a/.dockerignore b/.dockerignore
index f0d97df70c..560d98a76e 100644
--- a/.dockerignore
+++ b/.dockerignore
@@ -77,6 +77,8 @@ bun.lock
# Agent config
.agents
.gemini
+.claude
+.source
# Misc
llm.txt
diff --git a/CLAUDE.md b/CLAUDE.md
index 75df82dab0..efc6980f6f 100644
--- a/CLAUDE.md
+++ b/CLAUDE.md
@@ -419,25 +419,33 @@ own dedicated branch, and you MUST confirm the base branch with the operator bef
`AskUserQuestion`, unless they already told you) from which branch the new worktree/branch
should be cut. Do NOT assume `main` or "whatever I'm on" — the answer is usually the active
`release/vX.Y.Z`, but it can be another feature/release branch. Get the base explicitly.
-2. **Create an isolated worktree + branch off that base** (never reuse the main checkout):
+2. **Create an isolated worktree + branch off that base** (never reuse the main checkout).
+ **🔴 MANDATORY PATH: every worktree lives under `.claude/worktrees/` — and nowhere else.**
+ This is the single canonical location (the same dir the native `EnterWorktree` tool uses). It
+ is gitignored AND in the `tsconfig.json` / `.dockerignore` excludes, so worktrees never leak
+ into the build scope. **Never** use `.worktrees/`, repo-root, or any other path — a worktree
+ outside `.claude/worktrees/` (a) escapes the build-scope excludes and poisons `next build` (the
+ `tsconfig` `include: **/*` globs ~70× the codebase → OOM; incident 2026-06-25) and (b) scatters
+ worktrees across two dirs.
```bash
BASE_BRANCH="release/vX.Y.Z" # ← the branch the operator confirmed in step 1
TASK="feat/your-feature" # feat/ fix/ refactor/ docs/ test/ chore/
git fetch origin "$BASE_BRANCH"
- git worktree add ".worktrees/${TASK##*/}" -b "$TASK" "origin/$BASE_BRANCH"
- cd ".worktrees/${TASK##*/}"
+ git worktree add ".claude/worktrees/${TASK##*/}" -b "$TASK" "origin/$BASE_BRANCH"
+ cd ".claude/worktrees/${TASK##*/}"
# symlink node_modules from the main checkout to skip a per-worktree npm install:
ln -s "$(git -C <main_checkout> rev-parse --show-toplevel)/node_modules" node_modules
```
- In Claude Code prefer the native `EnterWorktree` tool (create the worktree with the command
- above, then call `EnterWorktree` with its `path`).
+ In Claude Code prefer the native `EnterWorktree` tool (it already creates worktrees under
+ `.claude/worktrees/`): create the worktree with the command above, then call `EnterWorktree`
+ with its `path`.
3. **Work, commit, push, open the PR — all from inside the worktree.** Never `git checkout` a
different branch inside a worktree another session might share.
4. **Tear down only your own** worktree + branch when done, from the main checkout:
- `git worktree remove .worktrees/<dir>` then `git branch -D <task>`. Never blanket-delete
+ `git worktree remove .claude/worktrees/<dir>` then `git branch -D <task>`. Never blanket-delete
`fix/*`/`feat/*` — other sessions keep their own; delete only the branches you created, by name.
5. **Never touch another session's worktree, branch, or uncommitted changes.** If `git worktree
list` shows worktrees you didn't create, leave them alone. End every session with the main
diff --git a/tsconfig.json b/tsconfig.json
index 2395a0e409..05d2503ccd 100644
--- a/tsconfig.json
+++ b/tsconfig.json
@@ -55,14 +55,16 @@
"exclude": [
"node_modules",
"open-sse",
- "antigravity-manager-analysis",
- "app.__qa_backup",
- "vscode-extension",
- "vs_ideia",
+ "dist",
+ "coverage",
+ ".source",
+ ".tmp",
+ ".claude",
+ ".worktrees",
+ "@omniroute",
"_tasks",
+ "_ideia",
"_mono_repo",
- "_references",
- "omnirouteCloud",
- "omnirouteSite"
+ "_references"
]
}