Add workspace support: create/link into a workspace, workspace list, workspace move#567
Open
netanelgilad wants to merge 6 commits into
Open
Add workspace support: create/link into a workspace, workspace list, workspace move#567netanelgilad wants to merge 6 commits into
workspace list, workspace move#567netanelgilad wants to merge 6 commits into
Conversation
Apps created via the CLI previously always landed in the caller's personal workspace, and there was no way to target or move between workspaces. The backend already supports both; this wires the CLI surface up to it. - `create` / `link --create`: new `-w, --workspace <id>` flag (with `--org` alias) forwards `organization_id` to `POST /api/apps`. Interactive mode prompts for a workspace when the user belongs to more than one. - `workspace list`: lists the user's workspaces (personal first) with roles; supports `--json`. - `workspace move [id]`: moves the current/`--app-id` app to another workspace via the metadata move-to-workspace endpoint, with a confirmation prompt, `--yes`, and `--disconnect-integrations`. - New `core/workspace` module (listWorkspaces, moveAppToWorkspace) plus a `getApp` helper to read an app's current workspace; Zod-validated responses. - Tests for list, move, and create/link `--workspace` (validation, permission, JSON output) plus core schema unit tests. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0171Y6jogaAWB1suBYaEULp1
Contributor
🚀 Package Preview Available!Install this PR's preview build with npm: npm i @base44-preview/cli@0.1.4-pr.567.a56c290Prefer not to change any import paths? Install using npm alias so your code still imports npm i "base44@npm:@base44-preview/cli@0.1.4-pr.567.a56c290"Or add it to your {
"dependencies": {
"base44": "npm:@base44-preview/cli@0.1.4-pr.567.a56c290"
}
}
Preview published to npm registry — try new features instantly! |
It's only used inside schema.ts by canCreateAppsInWorkspace; exporting it tripped the knip unused-exports check in CI. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0171Y6jogaAWB1suBYaEULp1
- `base44 workspace get <id>`: show a single workspace's details by ID (name, role, tier) without scanning the full list. Backed by the existing listWorkspaces endpoint via a new core getWorkspace() helper. - `base44 workspace list --can-create`: only workspaces you can create/move apps into (owner/admin/editor). - `base44 workspace list --role <role>`: exact-role filter. Both support --json. Adds CLI specs for get + the new filters. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0171Y6jogaAWB1suBYaEULp1
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0171Y6jogaAWB1suBYaEULp1
netanelgilad
commented
Jul 15, 2026
… unit tests Per review feedback, match the web builder's move UX (useMoveToWorkspaceEligibility) and stop replicating server permission logic client-side: - Remove client-side role validation/filtering: drop canCreateAppsInWorkspace and the `workspace list --can-create` filter (kept the pure `--role` data filter). create/link pickers now list all your workspaces and pass an explicit --workspace straight through; the server authorizes and returns a clear error. - `workspace move`: fetch workspaces + current app only in interactive mode (for the picker + confirm). Destination list is every workspace except the current one, no role filter. An explicit target is not pre-validated — the server's block reason is surfaced (e.g. "Only workspace admins and owners can move apps out of this workspace"). - Consolidate toJsonStdout into cli/utils (it duplicated sandbox/shared.ts); workspace/shared.ts keeps only workspaceTag. - Remove the tests/core/workspace.spec.ts unit test; rely on product-facing CLI specs. Switch the workspace specs' deterministic (json/success) assertions to exact toEqual/toBe. - Tidy the getApp doc comment. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0171Y6jogaAWB1suBYaEULp1
Matches the existing convention (functions/list, delete, pull, deploy all
inline the `${n} thing${n !== 1 ? "s" : ""}` pattern); there is no shared
pluralization util in the codebase and it's not worth adding for one call site.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0171Y6jogaAWB1suBYaEULp1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Note
Description
Adds first-class workspace (organization) support to the Base44 CLI. Introduces a new
base44 workspacecommand group (list,get,move) and letscreate/linktarget a specific workspace via--workspace/--org, defaulting to the caller's personal workspace. Workspace selection is server-authoritative: the CLI passes IDs straight through and surfaces the backend's authorization errors rather than pre-validating roles client-side.Related Issue
None
Type of Change
Changes Made
base44 workspacecommand group wired into the program:list(with a--rolefilter),get <workspace-id>, andmove [workspace-id](with--disconnect-integrationsand-y/--yes).core/workspaceSDK module withlistWorkspaces,getWorkspace, andmoveAppToWorkspace, plus Zod schemas that transform the server's snake_case payload to camelCase. The first workspace returned is flaggedisPersonal.createandlinkgain-w/--workspace <id>(with a hidden--orgalias) and a sharedresolveWorkspaceIdhelper: pass an explicit ID through, prompt interactively when the user belongs to more than one workspace, otherwise default to the personal workspace with no extra API call.createProjectnow accepts anorganizationIdand sendsorganization_idonly when targeting a specific workspace.getAppAPI +AppDetailSchemato resolve an app's current workspace for the interactive move flow.toJsonStdoutinto a sharedcli/utils/json.tsso sandbox and workspace commands share one--jsonserializer; all workspace commands honor the global--jsonflag.TestAPIServer.Testing
npm test)Checklist
docs/(AGENTS.md) if I made architectural changesAdditional Notes
Move and workspace-targeted creation are intentionally server-authoritative — the CLI does not filter by role but relies on the backend to authorize and return clear block reasons, matching the web builder.
getWorkspaceis backed bylistWorkspacessince there is no per-workspace GET the CLI principal is authorized for.🤖 Generated by Claude | 2026-07-15 15:07 UTC | a56c290