Skip to content

chore: convert to Turborepo monorepo (v2.9.6)#26

Merged
mattapperson merged 6 commits intomainfrom
turborepo-migration
Apr 20, 2026
Merged

chore: convert to Turborepo monorepo (v2.9.6)#26
mattapperson merged 6 commits intomainfrom
turborepo-migration

Conversation

@mattapperson
Copy link
Copy Markdown
Collaborator

@mattapperson mattapperson commented Apr 20, 2026

Summary

  • Move @openrouter/agent into packages/agent/ under a pnpm workspace, with Turborepo (2.9.6) managing build / test / test:e2e / lint / typecheck task graphs from the root.
  • Release flow generalizes: pnpm exec changeset publish walks the workspace and publishes only packages whose on-disk version differs from npm — no republishing of unchanged packages and no extra wiring needed to add packages later.
  • Biome + grit plugins stay at the root; scope globs widened to cover packages/*. Shared .env loaded from workspace root by vitest configs.

What moved where

New at root: pnpm-workspace.yaml, turbo.json (v2 tasks schema), tsconfig.base.json, a private monorepo package.json with hoisted devDeps, and a short monorepo README.md.

Into packages/agent/: src/, tests/, package.json (trimmed, adds publishConfig.provenance + repository.directory), tsconfig.json (extends base), vitest.config.ts (loads ../../.env), README.md, CHANGELOG.md, .npmignore.

Unchanged at root: .changeset/, .grit/, .husky/, biome.json (globs widened only), pnpm-lock.yaml.

Release flow (TL;DR)

  1. Author a changeset per PR: pnpm changeset.
  2. Merge to main → Release workflow opens a "Version Packages" PR (or updates an existing one).
  3. Merge the Version PR → changeset publish releases every package with a consumed changeset to npm with provenance. Unchanged packages stay put.

workflow_dispatch still supports manual version / publish with a dry-run toggle (dry-run falls back to pnpm -r publish --dry-run — commented in the workflow — since changeset publish has no native --dry-run).

CI

Kept the 4 parallel jobs (lint, typecheck, unit-tests, e2e-tests). Root scripts now route through turbo so per-job invocations get the task graph + caching automatically. The e2e job skips with a warning when OPENROUTER_API_KEY is unset.

Test plan

  • pnpm install — 2 workspace projects detected
  • pnpm run lint — biome clean (46 files)
  • pnpm run typecheck — clean; cache hit on re-run (FULL TURBO)
  • pnpm run build — emits packages/agent/esm/
  • pnpm run test — 232/232 unit tests pass
  • pnpm exec changeset status — CLI resolves the workspace package
  • pnpm run test:e2e locally with OPENROUTER_API_KEY set
  • Trigger Release workflow manually with mode: publish, dry-run: true — confirms the set of packages pnpm -r would publish

Notes

  • Dropped "LICENSE" from packages/agent/package.json#files because no LICENSE file exists in the repo; follow-up to add one.
  • .env / .env.* now in .gitignore (kept .env.example trackable).
  • publishConfig.provenance: true added per-package so changeset publishpnpm publish emits npm provenance.
  • @openrouter/sdk release coordination note preserved in the workflow; SDK is an external npm dep unchanged by this PR.

Move @openrouter/agent into packages/agent/ under a pnpm workspace with
Turborepo managing build/test/lint/typecheck task graphs at the root.

Release flow now uses `changeset publish`, which walks the workspace and
publishes only packages whose on-disk version differs from npm — the
pipeline generalizes to multiple packages with no extra wiring. CI splits
lint/typecheck/unit/e2e into parallel jobs and skips e2e when
OPENROUTER_API_KEY is unset.

Root now holds: pnpm-workspace.yaml, turbo.json (v2.9.6 tasks schema),
tsconfig.base.json, a private monorepo package.json with hoisted devDeps,
and a short monorepo README. The original package README, CHANGELOG,
.npmignore, vitest.config.ts, and tsconfig move into packages/agent/.
Biome + grit plugins stay at the root; scope globs widened to cover
packages/*. Vitest loads a shared root .env.
Copy link
Copy Markdown
Collaborator Author

@mattapperson mattapperson left a comment

Choose a reason for hiding this comment

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

2 findings: dead workflow step and shared tsconfig not tracked by turbo caches.

Comment thread .github/workflows/publish.yaml
Comment thread turbo.json
Copy link
Copy Markdown
Collaborator

@robert-j-y robert-j-y left a comment

Choose a reason for hiding this comment

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

pre-approving, obviously there are the merge conflicts, but nothing major is coming up.

- Remove dead "Check for pending changesets" step in publish.yaml;
  nothing reads steps.changesets.outputs.pending anymore.
- Add "globalDependencies": ["tsconfig.base.json"] to turbo.json so
  edits to the shared base tsconfig invalidate build/typecheck/test
  caches instead of serving stale output.
# Conflicts:
#	package.json
#	pnpm-lock.yaml
# Conflicts:
#	packages/agent/tests/unit/has-approval-tools.test-d.ts
#	packages/agent/tests/unit/server-tool-stream-narrowing.test-d.ts
#	packages/agent/tests/unit/server-tool.test.ts
@mattapperson mattapperson merged commit e3a868c into main Apr 20, 2026
4 checks passed
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