Skip to content

chore: Add support for turborepo#546

Closed
brendan-kellam wants to merge 1 commit intomainfrom
bkellam/turbo_repo
Closed

chore: Add support for turborepo#546
brendan-kellam wants to merge 1 commit intomainfrom
bkellam/turbo_repo

Conversation

@brendan-kellam
Copy link
Copy Markdown
Contributor

@brendan-kellam brendan-kellam commented Oct 3, 2025

This PR adds support for Turborepo, which should improve our inner loop development experience.

Next up is to implement remote caching for our CI to hopefully improve our build times.

Summary by CodeRabbit

  • Chores
    • Adopted a unified Turbo-powered build/dev workflow for faster, more reliable builds.
    • Expanded cleanup to remove caches and build artifacts across the workspace.
    • Updated ignore rules to exclude new cache directories.
    • Added watch/dev scripts across multiple packages to streamline local development.
    • Introduced internal code search webserver tooling to support local runs.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Oct 3, 2025

Walkthrough

Adopts Turborepo for build/dev orchestration, updates root/package scripts to use turbo, broadens Makefile clean targets, and introduces a new zoekt package with Go build and a webserver script. Adds turbo.json, adjusts gitignore for .turbo and zoekt/bin, and aligns per-package dev/build scripts to watch-mode TypeScript workflows.

Changes

Cohort / File(s) Summary
Repo ignores and Turbo config
/.gitignore, /turbo.json
Updated gitignore header to node,yarn,turbo; added .turbo ignore. Introduced turbo.json defining build/dev/zoekt:webserver tasks, outputs, and envMode.
Root scripts and deps
/package.json
Switched build to turbo build; consolidated dev to with-env turbo dev zoekt:webserver; updated PATH in with-env; added turbo devDependency.
Workspace cleanup
/Makefile
Expanded clean target to remove .turbo, .next, bin, dist, node_modules across packages, including packages/zoekt/bin.
Per-package TypeScript script updates
packages/backend/package.json, packages/logger/package.json, packages/shared/package.json, packages/mcp/package.json, packages/schemas/package.json, packages/db/package.json, packages/crypto/package.json
Standardized build/dev: add or update tsc/tsc-watch in watch mode, set SKIP_ENV_VALIDATION via cross-env where applied; schemas adds parallel watch with npm-run-all and tsc:watch; backend dev uses tsc-watch to run node ./dist/index.js.
Zoekt package introduction
packages/zoekt/package.json, packages/zoekt/.gitignore
New package with build (Go zoekt-webserver into packages/zoekt/bin) and zoekt:webserver script (runs built binary with index/rpc). Ignores /bin.

Sequence Diagram(s)

sequenceDiagram
    autonumber
    actor Dev as Developer
    participant Turbo as Turbo CLI
    participant Pkgs as Packages (tsc/tsc-watch)
    participant Zoekt as zoekt-webserver (Go)

    Dev->>Turbo: yarn with-env turbo dev zoekt:webserver
    Turbo->>Pkgs: Run dev tasks (watch) [persistent, no cache]
    Turbo->>Zoekt: Run zoekt:webserver (build then start)
    Pkgs-->>Turbo: Emit compiled outputs (dist/**)
    Zoekt-->>Dev: Webserver running with -index .sourcebot/index -rpc
Loading
sequenceDiagram
    autonumber
    actor Dev as Developer
    participant Turbo as Turbo CLI
    participant Pkg as Workspace packages
    note over Turbo,Pkg: turbo build with outputs: .next/**, dist/**, bin/** (excl. .next/cache/**)

    Dev->>Turbo: turbo build
    Turbo->>Pkg: Topo-ordered build (dependsOn ^build)
    Pkg-->>Turbo: Produce artifacts
    Turbo-->>Dev: Build summary
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Poem

I twitch my ears at turbo’s hum,
New bins compiled, the watchers drum.
A zoekt hop, a webserver run—
Cache trails fade, the builds are one.
In tidy burrows, scripts align;
I thump: dev time—swift and fine. 🐇🚀

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The title clearly and concisely summarizes the primary change of adding Turborepo support, uses conventional commit style, and aligns with the modifications made throughout the repository.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch bkellam/turbo_repo

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.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Oct 3, 2025

@brendan-kellam your pull request is missing a changelog!

@msukkari
Copy link
Copy Markdown
Contributor

msukkari commented Oct 3, 2025

@coderabbitai review

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Oct 3, 2025

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 4

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
packages/logger/package.json (1)

7-24: Add cross-env to this package.

Both new scripts rely on cross-env, but this manifest doesn’t list it. Unless we count on an incidental hoist from another workspace package, yarn build / yarn dev here will fail with “cross-env: command not found.” Please add cross-env to devDependencies as done in other packages.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between c10010e and 1155371.

⛔ Files ignored due to path filters (1)
  • yarn.lock is excluded by !**/yarn.lock, !**/*.lock
📒 Files selected for processing (13)
  • .gitignore (3 hunks)
  • Makefile (1 hunks)
  • package.json (2 hunks)
  • packages/backend/package.json (1 hunks)
  • packages/crypto/package.json (1 hunks)
  • packages/db/package.json (1 hunks)
  • packages/logger/package.json (1 hunks)
  • packages/mcp/package.json (1 hunks)
  • packages/schemas/package.json (1 hunks)
  • packages/shared/package.json (2 hunks)
  • packages/zoekt/.gitignore (1 hunks)
  • packages/zoekt/package.json (1 hunks)
  • turbo.json (1 hunks)

Comment thread package.json
],
"scripts": {
"build": "cross-env SKIP_ENV_VALIDATION=1 yarn workspaces foreach -A run build",
"build": "turbo build",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

Use the correct Turbo CLI form.

turbo build is invalid; the CLI expects turbo run <task>. As-is, yarn build exits with “Unknown command: build.” Update the script to call turbo run build.

-        "build": "turbo build",
+        "build": "turbo run build",
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
"build": "turbo build",
"build": "turbo run build",
🤖 Prompt for AI Agents
In package.json around line 7, the npm script uses an invalid Turbo CLI command
"turbo build"; change it to use the correct form "turbo run build" so running
yarn/npm run build invokes the Turbo pipeline properly. Update the "build"
script value to "turbo run build" (no other changes needed).

Comment thread package.json
Comment on lines +9 to +10
"dev": "yarn with-env turbo dev zoekt:webserver",
"with-env": "cross-env PATH=\"$PROJECT_CWD/packages/zoekt/bin:$PATH\" dotenv -e .env.development -c --",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

Fix the dev script Turborepo invocation.

Same issue as above: turbo dev zoekt:webserver omits the required run subcommand, so yarn dev fails immediately. The intent (running both dev and zoekt:webserver) works once the CLI call is turbo run ….

-        "dev": "yarn with-env turbo dev zoekt:webserver",
+        "dev": "yarn with-env turbo run dev zoekt:webserver",
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
"dev": "yarn with-env turbo dev zoekt:webserver",
"with-env": "cross-env PATH=\"$PROJECT_CWD/packages/zoekt/bin:$PATH\" dotenv -e .env.development -c --",
"dev": "yarn with-env turbo run dev zoekt:webserver",
"with-env": "cross-env PATH=\"$PROJECT_CWD/packages/zoekt/bin:$PATH\" dotenv -e .env.development -c --",
🤖 Prompt for AI Agents
In package.json around lines 9 to 10, the dev script calls "turbo dev
zoekt:webserver" which omits the required "run" subcommand and causes yarn dev
to fail; update the script to call "turbo run dev zoekt:webserver" (i.e., insert
the "run" subcommand after "turbo") so Turbo runs the "dev" task for the
specified scope/target; keep the surrounding with-env wrapper intact.

Comment thread packages/mcp/package.json
Comment on lines 8 to 10
"build": "tsc",
"dev": "node ./dist/index.js",
"build:watch": "tsc-watch --preserveWatchOutput"
"dev": "tsc-watch --preserveWatchOutput"
},
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Restore runtime execution in dev script.

dev used to start the MCP service via node ./dist/index.js. Now it only runs tsc-watch, so yarn dev (and any turbo dev pipeline that shells out to it) never launches the binary. That regresses local development for MCP—it compiles but nothing runs—so please add an --onSuccess "node ./dist/index.js" (or an equivalent runner) back in.

🤖 Prompt for AI Agents
In packages/mcp/package.json around lines 8 to 10, the "dev" script currently
only runs tsc-watch so it compiles but does not start the MCP binary; restore
runtime execution by updating the "dev" command to run tsc-watch with an
onSuccess hook that launches the built node binary (for example add --onSuccess
"node ./dist/index.js" or equivalent), ensuring local `yarn dev` (and turbo
pipelines) both compile and start the service automatically.

Comment on lines +5 to +6
"build": "mkdir -p $PROJECT_CWD/packages/zoekt/bin/ && go build -C $PROJECT_CWD/vendor/zoekt -o $PROJECT_CWD/packages/zoekt/bin/ ./cmd/...",
"zoekt:webserver": "yarn build && ./bin/zoekt-webserver -index $PROJECT_CWD/.sourcebot/index -rpc"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

Fix the Go build invocation.

go build -o ... ./cmd/... fails because -o cannot be combined with multiple packages (the zoekt cmd tree contains several commands). As written, yarn build exits with go build: cannot use -o directory with multiple packages, so the binary never materializes and downstream tasks break. Adjust the command to build the specific binaries (e.g., the webserver) individually.

Apply this diff to unblock the build:

-        "build": "mkdir -p $PROJECT_CWD/packages/zoekt/bin/ && go build -C $PROJECT_CWD/vendor/zoekt -o $PROJECT_CWD/packages/zoekt/bin/ ./cmd/...",
+        "build": "mkdir -p $PROJECT_CWD/packages/zoekt/bin/ && go build -C $PROJECT_CWD/vendor/zoekt -o $PROJECT_CWD/packages/zoekt/bin/zoekt-webserver ./cmd/zoekt-webserver",

If other zoekt binaries are required, invoke go build once per command (without -o) so each lands in bin/.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
"build": "mkdir -p $PROJECT_CWD/packages/zoekt/bin/ && go build -C $PROJECT_CWD/vendor/zoekt -o $PROJECT_CWD/packages/zoekt/bin/ ./cmd/...",
"zoekt:webserver": "yarn build && ./bin/zoekt-webserver -index $PROJECT_CWD/.sourcebot/index -rpc"
"build": "mkdir -p $PROJECT_CWD/packages/zoekt/bin/ && go build -C $PROJECT_CWD/vendor/zoekt -o $PROJECT_CWD/packages/zoekt/bin/zoekt-webserver ./cmd/zoekt-webserver",
"zoekt:webserver": "yarn build && ./bin/zoekt-webserver -index $PROJECT_CWD/.sourcebot/index -rpc"
🤖 Prompt for AI Agents
In packages/zoekt/package.json around lines 5-6, the current go build invocation
uses -o with ./cmd/... which fails because -o cannot be used when building
multiple packages; change the build step to build specific binaries individually
(for example, run go build -o $PROJECT_CWD/packages/zoekt/bin/zoekt-webserver
./cmd/zoekt-webserver) or invoke go build once per command without a shared -o
so each produced binary is written into packages/zoekt/bin/, ensuring the
zoekt:webserver script can then run the produced webserver binary.

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.

2 participants