| name | monorepo-guide |
| description | Reference for navigating the Lumen turborepo โ workspace commands, where things live, cross-app imports. TRIGGER when user asks about project structure, where to put files, or how workspaces connect. |
Lumen Monorepo Guide
Turborepo + pnpm workspaces. Three apps, shared root config.
Structure
lumen/
โโโ apps/
โ โโโ cli/ lumen-kb (published) / @lumen/cli (workspace alias) โ CLI engine + MCP server
โ โโโ web/ @lumen/web โ Next.js 15 dashboard + Better Auth
โ โโโ extension/ @lumen/extension โ Browser extension (placeholder)
โโโ turbo.json โ Task pipeline (build, dev, lint, test)
โโโ pnpm-workspace.yaml
โโโ .npmrc โ node-linker=hoisted, shamefully-hoist=true
โโโ package.json โ Root workspace (turbo, prettier, husky)
Common Commands
| What | Command |
|---|
| Build everything | pnpm build |
| Dev all apps | pnpm dev |
| CLI only dev | pnpm --filter lumen-kb dev -- <command> |
| Web only dev | pnpm --filter @lumen/web dev |
| Build CLI | pnpm --filter lumen-kb build |
| Lint all | pnpm lint |
| Test CLI | pnpm --filter lumen-kb test |
| Add dep to CLI | pnpm --filter lumen-kb add <pkg> |
| Add dep to web | pnpm --filter @lumen/web add <pkg> |
Cross-App Imports
@lumen/web depends on @lumen/cli via "@lumen/cli": "workspace:*". This allows the web app to import engine functions directly:
import { searchBm25 } from '@lumen/cli/src/search/bm25.js';
This is not wired up yet โ currently the web app is UI-only. Phase 6 (Library) will make @lumen/cli properly exportable.
Gotchas
node_modules dirs are symlinks to /tmp/lumen-*/node_modules (iCloud workaround)
- After reboot or
pnpm install failure, recreate symlinks โ see CLAUDE.md
pnpm build runs turbo build which builds CLI first (it's a dependency of web)
next build crashes on Node 23 โ use next dev or Node 22
better-sqlite3 native binary must be rebuilt after Node upgrades: pnpm rebuild better-sqlite3
- Global
lumen binary is linked from apps/cli/dist/cli.js โ re-link after moving: cd apps/cli && npm link