Skip to content

feat: add visibility config field (public/private) to CLI#370

Open
base44-os-gremlins[bot] wants to merge 6 commits intomainfrom
feat/visibility-config
Open

feat: add visibility config field (public/private) to CLI#370
base44-os-gremlins[bot] wants to merge 6 commits intomainfrom
feat/visibility-config

Conversation

@base44-os-gremlins
Copy link

@base44-os-gremlins base44-os-gremlins bot commented Mar 8, 2026

Note

Description

Adds a visibility field to ProjectConfigSchema that lets users declare app visibility (public, private, or workspace) in their base44/config.jsonc. During deploy, if the field is present, a PUT /api/apps/{id} call syncs the visibility to the API. Also changes the default visibility for newly created projects from public_without_login to private_with_login.

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

  • Added VisibilitySchema (Zod enum: "public" | "private" | "workspace") and exported Visibility type from core/project/schema.ts
  • Added optional visibility field to ProjectConfigSchema
  • Added updateProjectVisibility() API function that maps Visibility values to public_settings strings and calls PUT /api/apps/{id}
  • Wired updateProjectVisibility() into deployAll() — called when project.visibility is defined
  • Changed default public_settings for createProject() from "public_without_login" to "private_with_login"
  • Added with-visibility test fixture with a config declaring visibility: "public"
  • Added mockUpdateAppVisibility / mockUpdateAppVisibilityError helpers to TestAPIServer
  • Added CLI integration tests covering: visibility PUT sent on deploy, API error propagation, and no PUT when visibility is omitted
  • Added unit tests for ProjectConfigSchema visibility field validation

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

The visibility field is optional and backward-compatible — projects without it are unaffected during deploy. The mapping from friendly names to API values (public_settings) is encapsulated in VISIBILITY_TO_PUBLIC_SETTINGS in api.ts.


🤖 Generated by Claude | 2026-03-22 16:33 UTC

@github-actions
Copy link
Contributor

github-actions bot commented Mar 8, 2026

🚀 Package Preview Available!


Install this PR's preview build with npm:

npm i @base44-preview/cli@0.0.47-pr.370.d2e964f

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.0.47-pr.370.d2e964f"

Or add it to your package.json dependencies:

{
  "dependencies": {
    "base44": "npm:@base44-preview/cli@0.0.47-pr.370.d2e964f"
  }
}

Preview published to npm registry — try new features instantly!

Copy link
Collaborator

@kfirstri kfirstri left a comment

Choose a reason for hiding this comment

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

Small change for the api.ts,
And I want to also think and take into consideration the link / create commands from a template.. can we have templates that are private by default and not public as default?

visibility: Visibility,
): Promise<void> {
try {
await base44Client.patch(`api/apps/${projectId}`, {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Use 'getAppClient' to get an app scoped http client, no need to pass the appid arg

Copy link
Contributor

Choose a reason for hiding this comment

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

Investigated this — getAppClient().put("") doesn't work because getAppClient() sets prefixUrl to /api/apps/{id}/ (with trailing slash), but the server's PUT route is /api/apps/{item_id} (no trailing slash). The trailing slash causes a 404. Using base44Client.put(\api/apps/${id}`)with the explicit path works correctly. Also fixed the HTTP method from PATCH to PUT and theprivatemapping toprivate_with_login` (which is what the server validates against).

export async function updateProjectVisibility(
projectId: string,
visibility: Visibility,
): Promise<void> {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Maybe we also want to support this somewhere son the create / link commands?
Do we want to support this config in our templates?

@base44-os-gremlins
Copy link
Author

Thanks for the review! Changes pushed in 2c6c99b:

Addressed:

  • api.ts: removed projectId arg, now uses getAppClient() internally — no more arg passing
  • deploy.ts: removed getAppConfig() call (no longer needed), fixed import order for Biome
  • schema.ts: fixed inline formatting for Biome formatter
  • createProject: changed default public_settings from public_without_login to private (per your question about templates defaulting to private)
  • README.md: reverted (removed the config reference table)

On templates/create/link: The createProject default is now private. For explicit visibility support in base44 create or base44 link, that could be a follow-up — happy to add it in this PR or a separate one, whichever you prefer.

@kfirstri
Copy link
Collaborator

This needs to be rebased after the monorepo change

@kfirstri
Copy link
Collaborator

@netanelgilad you own this?

@netanelgilad
Copy link
Contributor

yes

@netanelgilad
Copy link
Contributor

@claude merge the main branch in and resolve conflicts after the monorepo change

@claude
Copy link

claude bot commented Mar 17, 2026

Claude finished @netanelgilad's task in 7m 37s —— View job


Merged main into feat/visibility-config ✓

The monorepo restructure on main was an orphan commit (completely new git history). The branch was reset to origin/main and all visibility changes were re-applied to the new packages/cli/ paths.

What changed:

  • Old paths (src/, tests/) → New paths (packages/cli/src/, packages/cli/tests/)
  • Base44APIMock.ts (MSW-based) was replaced by TestAPIServer.ts (Express-based) — adapted mock helpers accordingly
  • Added "PATCH" to the Method type in TestAPIServer

Files updated:

File Change
packages/cli/src/core/project/schema.ts Added VisibilitySchema + Visibility type
packages/cli/src/core/project/api.ts Added updateProjectVisibility(), default private
packages/cli/src/core/project/deploy.ts Calls updateProjectVisibility when visibility set
packages/cli/tests/cli/testkit/TestAPIServer.ts Added PATCH support + mock helpers
packages/cli/tests/cli/deploy.spec.ts 3 new visibility sync integration tests
packages/cli/tests/core/project-schema.spec.ts New unit test file (created)
packages/cli/tests/fixtures/with-visibility/ New test fixture (created)

Typecheck passes. Force-pushed to feat/visibility-config.

- Add VisibilitySchema and Visibility type to packages/cli/src/core/project/schema.ts
- Add updateProjectVisibility() API function in packages/cli/src/core/project/api.ts
- Change default public_settings for new projects from public_without_login to private
- Integrate visibility sync into deployAll() in packages/cli/src/core/project/deploy.ts
- Add PATCH support and mockUpdateAppVisibility helpers to TestAPIServer
- Add project-schema unit tests and with-visibility fixture
- Add integration tests for visibility sync in deploy.spec.ts

Rebased onto monorepo structure (packages/cli/).

Co-authored-by: Netanel Gilad <netanelgilad@users.noreply.github.com>
@claude claude bot force-pushed the feat/visibility-config branch from fffe95b to 899d5c8 Compare March 17, 2026 08:16
@kfirstri kfirstri moved this from Ready to In review in CLI Development Mar 18, 2026
netanelgilad and others added 3 commits March 22, 2026 09:44
… mapping

The platform exposes PUT (not PATCH) for app updates, and expects
"private_with_login" rather than "private" for the public_settings field.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Keep Visibility type import from feature branch alongside new functions
(getAppUserToken, getSiteUrl) from main.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Adds "workspace" as a valid visibility value mapping to
`workspace_with_login` (apps visible only to workspace members).
This completes coverage of the platform's 4 visibility levels:
public, private, and workspace.

Adds a unit test for the new enum value.
@base44-os-gremlins
Copy link
Author

Pushed an update to add "workspace" as a third valid visibility value (maps to workspace_with_login).

Why: The platform has 4 visibility levels — the PR originally only covered 2. Workspace visibility is a real, commonly-used setting for teams on Business plans (visible to all workspace members, not the public).

Changes:

  • schema.ts: z.enum(["public", "private", "workspace"]) with updated error message
  • api.ts: Added workspace: "workspace_with_login" to VISIBILITY_TO_PUBLIC_SETTINGS
  • tests/core/project-schema.spec.ts: Added test for visibility: "workspace"

Note: public_with_login (public but login required) is a 4th platform value, but it's an uncommon intermediate state not exposed in most UIs. I've left it out for now — "public" maps to the more permissive public_without_login which is what most users expect. Happy to add it if needed.

base44-os-gremlins bot pushed a commit to base44/skills that referenced this pull request Mar 22, 2026
Add `visibility` field ("public" | "private" | "workspace") to the
base44-cli skill documentation — config example and property table.
This corresponds to the CLI change in base44/cli#370.

Goal: https://github.com/base44-dev/gremlins/issues/797
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: In review

Development

Successfully merging this pull request may close these issues.

2 participants