Skip to content

Add workspace support: create/link into a workspace, workspace list, workspace move#567

Open
netanelgilad wants to merge 6 commits into
mainfrom
claude/cli-workspaces-support-h5x81l
Open

Add workspace support: create/link into a workspace, workspace list, workspace move#567
netanelgilad wants to merge 6 commits into
mainfrom
claude/cli-workspaces-support-h5x81l

Conversation

@netanelgilad

@netanelgilad netanelgilad commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

Note

Description

Adds first-class workspace (organization) support to the Base44 CLI. Introduces a new base44 workspace command group (list, get, move) and lets create/link target 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

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Refactoring (no functional changes)
  • Other (please describe):

Changes Made

  • New base44 workspace command group wired into the program: list (with a --role filter), get <workspace-id>, and move [workspace-id] (with --disconnect-integrations and -y/--yes).
  • New core/workspace SDK module with listWorkspaces, getWorkspace, and moveAppToWorkspace, plus Zod schemas that transform the server's snake_case payload to camelCase. The first workspace returned is flagged isPersonal.
  • create and link gain -w/--workspace <id> (with a hidden --org alias) and a shared resolveWorkspaceId helper: 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.
  • createProject now accepts an organizationId and sends organization_id only when targeting a specific workspace.
  • New getApp API + AppDetailSchema to resolve an app's current workspace for the interactive move flow.
  • Extracted toJsonStdout into a shared cli/utils/json.ts so sandbox and workspace commands share one --json serializer; all workspace commands honor the global --json flag.
  • Added integration tests for the new commands and flows, plus workspace fixtures/handlers in TestAPIServer.

Testing

  • I have tested these changes locally
  • I have added/updated tests as needed
  • All tests pass (npm test)

Checklist

  • My code follows the project's style guidelines
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation (if applicable)
  • My changes generate no new warnings
  • I have updated docs/ (AGENTS.md) if I made architectural changes

Additional 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. getWorkspace is backed by listWorkspaces since there is no per-workspace GET the CLI principal is authorized for.


🤖 Generated by Claude | 2026-07-15 15:07 UTC | a56c290

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
@netanelgilad netanelgilad self-assigned this Jul 14, 2026
@github-actions

github-actions Bot commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

🚀 Package Preview Available!


Install this PR's preview build with npm:

npm i @base44-preview/cli@0.1.4-pr.567.a56c290

Prefer not to change any import paths? Install using npm alias so your code still imports base44:

npm i "base44@npm:@base44-preview/cli@0.1.4-pr.567.a56c290"

Or add it to your package.json dependencies:

{
  "dependencies": {
    "base44": "npm:@base44-preview/cli@0.1.4-pr.567.a56c290"
  }
}

Preview published to npm registry — try new features instantly!

claude added 3 commits July 14, 2026 08:56
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
Comment thread packages/cli/tests/core/workspace.spec.ts Outdated
Comment thread packages/cli/tests/core/workspace.spec.ts Outdated
Comment thread packages/cli/tests/cli/workspace_move.spec.ts Outdated
Comment thread packages/cli/src/cli/commands/project/workspace-select.ts Outdated
Comment thread packages/cli/src/cli/commands/workspace/list.ts Outdated
Comment thread packages/cli/src/cli/commands/workspace/move.ts Outdated
Comment thread packages/cli/src/cli/commands/workspace/move.ts Outdated
Comment thread packages/cli/src/cli/commands/workspace/move.ts Outdated
Comment thread packages/cli/src/cli/commands/workspace/shared.ts Outdated
Comment thread packages/cli/src/core/project/api.ts Outdated
claude added 2 commits July 15, 2026 14:47
… 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
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