Skip to content

feat(monorepo): apps/* aware worktrees, preflight, and gx watch#606

Merged
NagyVikt merged 1 commit into
mainfrom
agent/claude/monorepo-helpers-2026-05-27
May 27, 2026
Merged

feat(monorepo): apps/* aware worktrees, preflight, and gx watch#606
NagyVikt merged 1 commit into
mainfrom
agent/claude/monorepo-helpers-2026-05-27

Conversation

@NagyVikt
Copy link
Copy Markdown
Collaborator

Summary

Four wins for repos with apps/<pkg> monorepos (storefront + backend like the Medusa shops) where the root worktree stays on the protected base so dev servers visualize merged state:

  • Env symlink + auto port on worktree creationprepareAgentWorktree() symlinks root apps/<pkg>/.env into every spawned agent worktree and writes .env.local with a free PORT=N (storefront pool 5174+, backend pool 9101+).
  • AGENTS.md monorepo block on gx setuptemplates/AGENTS.monorepo-apps.md auto-detected via apps/<pkg>/package.json.
  • Pre-ship typecheck + lint preflight — runs touched workspace packages' typecheck + lint before opening the PR. Bypass with --skip-preflight.
  • gx watch live TUI — alternate-screen dashboard refreshing every 2s with last commit, dirty count, dev server port(s), PR status.

Test plan

🤖 Generated with Claude Code

Four wins for repos with apps/<pkg> (storefront + backend monorepos
like the Medusa shops) where the root worktree stays on the protected
base so dev servers visualize merged state:

1. Env symlink + auto port on worktree creation
   prepareAgentWorktree() symlinks root apps/<pkg>/.env into every
   spawned agent worktree and writes a .env.local with a free PORT=N
   (storefront pool 5174+, backend pool 9101+).

2. AGENTS.md monorepo block on gx setup
   templates/AGENTS.monorepo-apps.md with the per-task loop and
   cross-app guardrails. Auto-detected via apps/<pkg>/package.json.

3. Pre-ship typecheck + lint preflight
   runPreflight() walks the diff against the base, finds touched
   apps/<pkg> workspace packages, runs typecheck + lint scripts.
   Blocks the PR on any failure. Bypass with --skip-preflight.

4. gx watch — live TUI for agent worktrees
   Alternate-screen dashboard refreshing every 2s with last commit,
   dirty count, dev server port(s), and PR status (when gh present).

Zero new test failures (38 pass / 6 fail baseline preserved).

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@NagyVikt NagyVikt merged commit 6f808a7 into main May 27, 2026
2 of 3 checks passed
@NagyVikt NagyVikt deleted the agent/claude/monorepo-helpers-2026-05-27 branch May 27, 2026 18:51
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