lobehub/scripts
rdmclin2 1f1df6d4eb 🔥 refactor: strip Personal Workspace shell, route all workspace logic through business slots (LOBE-7490)
Per product boundary decision on LOBE-5499, Personal Workspace should
stay in community only as "a rename of the current single-user
experience" — the actual workspace feature surface lives in Cloud. This
cuts away the community-side Personal Workspace shell that was adding
zero value: switching UI for a one-workspace user, a TRPC middleware
that always resolved to the single personal workspace, and a Zustand
store keeping an active-workspace pointer that never needed to change.

Community now ships four empty business slots so Cloud can override:
- `src/business/client/trpc-headers.ts` — injects `X-Workspace-Id` in Cloud
- `src/business/client/WorkspaceContextSlot.tsx` — wraps children, Cloud
  hydrates workspace list + restores active workspace from storage
- `src/business/client/features/User/UserPanelWorkspaceSection.tsx` —
  user-panel workspace switcher
- `src/business/client/BusinessSettingPages/Workspace.tsx` — settings
  body (`WorkspaceSettings` in Cloud)

Plus: settings tab is gated on `enableBusinessFeatures`, so community
builds don't show it. Cloud flips it on via server config.

Deleted:
- `packages/database/src/{schemas,models}/workspace.ts` + workspace-init
  migration + `scripts/migrateWorkspace/` + `db:migrate-workspace` npm
  script
- `src/libs/trpc/lambda/middleware/workspace.ts`
  (`workspaceAuth` / `requireWorkspaceRole`) — Cloud ships its own
  `cloudWorkspaceAuth` backed by cloudDB
- `src/server/utils/workspacePermissions.ts` — Cloud already owns this
  at the same path
- `src/server/routers/lambda/workspace.ts` — now an empty router stub
  under business/
- `src/features/{WorkspaceContext,WorkspaceSwitcher,WorkspaceSettings}/`
- `src/features/User/UserPanel/WorkspaceSection.tsx`
- `src/store/workspace/`
- `src/hooks/useFetchWorkspaces.ts`, `src/services/workspace.ts`
- `src/routes/(main)/settings/workspace/`

Kept (invariants per LOBE-7469 + plan):
- `workspace_id` column on 12 resource tables
- Model constructors' optional `workspaceId` param + `scopeWorkspace()`
- Resource routers still read `ctx.workspaceId` (field retained in
  context.ts, header parsing stays as harmless no-op when Cloud isn't
  injecting)

Added migration `0100_drop_workspace_tables.sql` (DROP CASCADE on the 4
workspace tables from 0099) + regenerated snapshot/journal via
`bun run db:generate`.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-21 13:45:53 +08:00
..
_shared 🐛 fix: hide password features when AUTH_DISABLE_EMAIL_PASSWORD is set (#12023) 2026-02-02 14:17:10 +08:00
buildSitemapIndex 🔧 chore: update eslint v2 configuration and suppressions (#12133) 2026-02-11 13:04:48 +08:00
cdnWorkflow 🌐 chore: translate non-English comments to English in scripts (#13690) 2026-04-09 14:38:29 +08:00
changelogWorkflow 👷 build(ci): fix changelog auto-generation in release workflow (#12763) 2026-03-06 17:08:47 +08:00
clerk-to-betterauth 🌐 chore: translate non-English comments to English in scripts (#13690) 2026-04-09 14:38:29 +08:00
dbmlWorkflow 🔧 chore: update eslint v2 configuration and suppressions (#12133) 2026-02-11 13:04:48 +08:00
docsWorkflow 🌐 chore: translate non-English comments to English in scripts (#13690) 2026-04-09 14:38:29 +08:00
electronWorkflow 🌐 chore: translate non-English comments to English in scripts (#13690) 2026-04-09 14:38:29 +08:00
hotfixWorkflow Sync main branch to canary branch (#12267) 2026-02-11 23:51:35 +08:00
i18nWorkflow 🔧 chore: update eslint v2 configuration and suppressions (#12133) 2026-02-11 13:04:48 +08:00
mdxWorkflow 🔧 chore: update eslint v2 configuration and suppressions (#12133) 2026-02-11 13:04:48 +08:00
migrateServerDB ♻️ refactor: migrate frontend from Next.js App Router to Vite SPA (#12404) 2026-02-28 00:01:01 +08:00
mobileSpaWorkflow ♻️ refactor: migrate frontend from Next.js App Router to Vite SPA (#12404) 2026-02-28 00:01:01 +08:00
nextauth-to-betterauth 🔧 chore: update eslint v2 configuration and suppressions (#12133) 2026-02-11 13:04:48 +08:00
readmeWorkflow 🔧 chore: update eslint v2 configuration and suppressions (#12133) 2026-02-11 13:04:48 +08:00
releaseWorkflow Sync main branch to canary branch (#12267) 2026-02-11 23:51:35 +08:00
serverLauncher feat: support Discord IM bot intergration (#12517) 2026-03-01 19:54:38 +08:00
checkConsoleLog.mts 🔧 chore: update eslint v2 configuration and suppressions (#12133) 2026-02-11 13:04:48 +08:00
copySpaBuild.mts ♻️ refactor: serve Vite SPA static assets under /_spa (#13409) 2026-03-30 21:54:20 +08:00
countEnWord.ts 🌐 chore: translate non-English comments to English in scripts (#13690) 2026-04-09 14:38:29 +08:00
devStartupSequence.mts 🔨 chore: improve start up scripts (#13318) 2026-03-27 00:49:23 +08:00
dockerPrebuild.mts ♻️ refactor: migrate frontend from Next.js App Router to Vite SPA (#12404) 2026-02-28 00:01:01 +08:00
generate-oidc-jwk.mjs 🐛 fix(desktop): resolve onboarding navigation issues after logout (#11628) 2026-01-20 01:04:03 +08:00
generateSpaTemplates.mts ♻️ refactor: migrate frontend from Next.js App Router to Vite SPA (#12404) 2026-02-28 00:01:01 +08:00
migrate-spa-navigation.ts 🔧 chore: update eslint v2 configuration and suppressions (#12133) 2026-02-11 13:04:48 +08:00
registerDesktopEnv.cjs ♻️ refactor: migrate frontend from Next.js App Router to Vite SPA (#12404) 2026-02-28 00:01:01 +08:00
replaceComponentImports.ts 🌐 chore: translate non-English comments to English in scripts (#13690) 2026-04-09 14:38:29 +08:00
runNextDesktop.mts ♻️ refactor: migrate frontend from Next.js App Router to Vite SPA (#12404) 2026-02-28 00:01:01 +08:00
setup-test-postgres-db.sh 🔧 chore: update eslint v2 configuration and suppressions (#12133) 2026-02-11 13:04:48 +08:00
vercelIgnoredBuildStep.js 🐛 fix: fix skill search not found (#12432) 2026-02-23 00:28:10 +08:00