Skip to content

farm: no per-worktree dependency setup hook (JS/TS node_modules absent in worktrees) #92

Closed

Description

@SUaDtL

Found during the docs-site-mvp /ca:sprint --farm run (2026-06-18).

git worktree add checks out only tracked files, so a JS/TS project's node_modules (gitignored) is absent in each task worktree. Gate commands like npx vitest / npx tsc then fail because the toolchain can't be resolved, and gate commands[0] must stay the narrow test (the mutation guard re-runs it many times), so npm ci cannot live there.

Workaround used: install the toolchain at the project root node_modules (already gitignored). Because worktrees live under .farm/worktrees/<id>/, Node resolves vitest/tsc by walking up to the project-root node_modules. Confirmed working, but it's an undocumented hack.

Perma-fix candidates:

  • A one-time-per-worktree setup hook: plan.meta.setup or FARM_SETUP (e.g. npm ci --prefer-offline) run once after worktree add, before gates, and NOT counted in mutation re-runs.
  • Or an opt-in "link node_modules from the integration checkout" step for JS/TS plans.
  • Document the project-root-node_modules resolution trick in includes/farm.md as the interim pattern.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestfeature-forgePreview-feature feedback (Feature Forge)

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions