Roo-Code/.roo/rules/monorepo.md
KJ7LNW 17b18e3f47
docs: add monorepo management rules (#4296)
Co-authored-by: Eric Wheeler <roo-code@z.ewheeler.org>
2025-06-03 15:12:33 -07:00

1.7 KiB
Raw Permalink Blame History

Monorepo (pnpm)

  • Work primarily in:
    • src/
    • webview-ui/package
    • packages/types (shared DTOs)
  • Other workspaces (modify only if instructed):
    • evals/
    • packages//
    • apps/
    /
    • [others]
  • To install deps:
    → run pnpm add <package> in <cwd>workspace/directory</cwd> (updates <workspace>/package.json)
  • ⚠️ DO NOT run pnpm in root (root only holds CLI dev-tools in devDependencies, e.g. prettier)

Turborepo

  • ❌ Don’t modify turbo config without instruction
  • ✅ You may propose config changes when:
    1. Adding a shared, cacheable npm task
    2. Declaring an internal-package dependency that affects the extension build

Running tests

  • Always execute commands using <cwd>workspace/directory</cwd> when running any test command
  • To fix failures:
    1. Target one failing test:
      → npx vitest relative/path/__tests__/name.spec.ts -t "substring"
    2. Verify all tests in that module pass:
      → npx vitest relative/path/__tests__/name.spec.ts
  • File conventions:
    • .spec.ts → vitest
    • .test.ts → jest (deprecated)
  • If a test in .test.ts fails:
    → delete it & recreate in .spec.ts
  • Keep passing tests in .test.ts
  • Use npx jest <file> -t "substring" for deprecated test execution using the same strategy above
  • Run all tests in the root workspace:
    → pnpm test

Creating tests

  • Use vitest (native ESM, jest-compatible)
  • Steps:
    1. Create path/to/__tests__/name.spec.ts (must be .spec.ts)
    2. Omit ESM mocks unless necessary
    3. Run via vitest
  • For modules with existing .test.ts:
    1. Move any failing tests → name.spec.ts
    2. Add new tests → name.spec.ts
    3. Leave successful tests in .test.ts