Skip to content

feat(exec): add --privileged and --data-env flags#570

Open
davidsu wants to merge 1 commit into
mainfrom
feat/exec-privileged-data-env
Open

feat(exec): add --privileged and --data-env flags#570
davidsu wants to merge 1 commit into
mainfrom
feat/exec-privileged-data-env

Conversation

@davidsu

@davidsu davidsu commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

Note

Description

Adds two new flags to the base44 exec command: --privileged and --data-env. --privileged runs a script with admin privileges by sending the X-Bypass-RLS header (bypassing row-level security), while --data-env targets a specific data environment via the X-Data-Env header. This lets users run maintenance/seed scripts and target dev vs. prod data directly from the CLI.

Related Issue

Ported from #435. Closes none explicitly.

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 --privileged flag to base44 exec that sets the X-Bypass-RLS header (requires app owner/editor role).
  • Added --data-env <environment> flag to base44 exec that sets the X-Data-Env header (e.g. dev, prod).
  • Threaded the new privileged and dataEnv options through execActionrunScript(), passing them to the Deno subprocess as BASE44_PRIVILEGED and BASE44_DATA_ENV env vars.
  • Updated the Deno runtime (deno-runtime/exec.ts) to read the new env vars and attach the corresponding custom headers to the SDK client.
  • Extended the command help text with a new privileged-access example.
  • Left inline QUESTION(@netanelgilad) comments flagging open backend-scoping questions (data-env validation, RLS-bypass gating at the edge).

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 --data-env value is passed through raw; the backend only honors dev/prod and silently falls through to prod for unknown values. Inline QUESTION(@netanelgilad) comments track open questions about backend scoping and whether the CLI should validate the value — these should be resolved before/after merge.


🤖 Generated by Claude | 2026-07-20 12:34 UTC | f3b8004

Faithful port of #435 (Netanel Gilad) with the renamed flags:
- --privileged sends the X-Bypass-RLS header (bypass RLS)
- --data-env <environment> sends the X-Data-Env header

Both flow exec.ts -> run-script.ts (BASE44_PRIVILEGED / BASE44_DATA_ENV
env vars) -> the Deno wrapper, which builds the SDK request headers.

Open backend questions surfaced during review (RLS-bypass exposure and
prod-edge survival, data-env value validation, and data-env scope for
backend-function invocations) are flagged inline as QUESTION(@netanelgilad)
comments for Netanel to resolve at review.

Refs #435

Co-Authored-By: Netanel Gilad <netanelg@wix.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown
Contributor

🚀 Package Preview Available!


Install this PR's preview build with npm:

npm i @base44-preview/cli@0.1.5-pr.570.f3b8004

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.5-pr.570.f3b8004"

Or add it to your package.json dependencies:

{
  "dependencies": {
    "base44": "npm:@base44-preview/cli@0.1.5-pr.570.f3b8004"
  }
}

Preview published to npm registry — try new features instantly!

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.

1 participant