feat(push): confirm before destructive resource push - #573
Conversation
entities/agents/connectors push overwrite the app's resources and delete any not present locally — previously with no warning. Add a shared confirmPush guard that mirrors `base44 deploy`: warn + confirm interactively, `-y/--yes` to skip, and require `--yes` in non-interactive mode (throws, so `--json`/CI never hang waiting on a prompt). BREAKING CHANGE: non-interactive `base44 entities|agents|connectors push` now require `--yes`, consistent with `base44 deploy`. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
Reviewed (agent Non-blocking nits: flag help text "Skip the confirmation prompt" vs deploy's "Skip confirmation prompt" — worth aligning; and a follow-up (not this PR) could refactor 🤖 Generated with Claude Code |
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
🚀 Package Preview Available!Install this PR's preview build with npm: npm i @base44-preview/cli@0.1.5-pr.573.99fe0bbPrefer not to change any import paths? Install using npm alias so your code still imports npm i "base44@npm:@base44-preview/cli@0.1.5-pr.573.99fe0bb"Or add it to your {
"dependencies": {
"base44": "npm:@base44-preview/cli@0.1.5-pr.573.99fe0bb"
}
}
Preview published to npm registry — try new features instantly! |
The new non-interactive confirm guard requires --yes. authorization.spec and env-token-auth.spec drive entities/agents push to test token refresh and workspace-key auth, and ran push without --yes — so the guard short-circuited them. Add --yes so they reach the real auth/API path (the token-refresh-failure case now exercises the actual failure instead of the guard). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Harden the token-refresh-failure test to assert the actual "Unauthorized" error, not just a non-zero exit — a bare toFail() let today's --yes guard false-pass it. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Match the house convention for consequence warnings (deploy.ts, auth push/sso): "This will <verb> ... and <verb> any not present locally." Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
guyofeck
left a comment
There was a problem hiding this comment.
I think the convention should be --force and not --yes, but it's kind of a product decision.
wdyt guys? @davidsu @netanelgilad
guyofeck
left a comment
There was a problem hiding this comment.
--yes is the right flag (not --force). It matches the established convention: project deploy, site deploy, auth push, project eject, and workspace move all expose -y, --yes with the same "Skip confirmation prompt" label, and this PR throws the identical "--yes is required in non-interactive mode" message they do. --force exists on exactly one command (functions deploy) where it means something behaviorally different — "Delete remote functions not found locally" — so reusing it here would be semantically confusing. Keep --yes.
Dropping the non-main-branch gating is correct. base44 create doesn't git init and a project isn't required to be a git repo, so there's no reliable branch signal to key confirmation off of. Gating on branch would be fragile and surprising.
Env var to make --yes permanent (à la dangerously-skip-permissions) is a reasonable ask but out of scope for this PR — fine to track separately. If added, it should be global across all the --yes commands, not push-specific.
Non-blocking follow-up: nice that confirmPush() is a shared helper. The pre-existing destructive commands (project deploy, site deploy, auth push) still duplicate their own inline --yes/throw logic — worth migrating them onto this helper in a later PR so there's one source of truth for the destructive-push confirmation pattern.
#573) Main added confirmPush + -y/--yes to the resource push commands; mirror it on agent-skills push so it prompts (and requires --yes non-interactively) like agents.
#573) Main added confirmPush + -y/--yes to the resource push commands; mirror it on agent-skills push so it prompts (and requires --yes non-interactively) like agents.
Note
Description
The
pushcommands for agents, entities, and connectors are destructive — they overwrite an app's remote resources with the local copy and delete anything not present locally. This PR adds a confirmation guard before any of those pushes runs. Interactively, the user sees a warning describing exactly what will be replaced/deleted and must confirm; in non-interactive mode (--json/CI) a new-y, --yesflag is required, so the commands fail fast instead of hanging on a prompt.Related Issue
None
Type of Change
Changes Made
confirmPush()helper (packages/cli/src/cli/utils/confirm-push.ts) that warns and prompts interactively, requires--yesin non-interactive mode (throwsInvalidInputErrorotherwise), and returnsfalsewhen the user declines.confirmPushfrom the CLI utils barrel (utils/index.ts).agents push,entities push, andconnectors pushcommands, each with a resource-specific warning message and a-y, --yes"Skip confirmation prompt" option; a declined prompt returns aPush cancelledoutro.deploy's phrasing.--yeswhere auth/push flows are exercised, and added tests asserting each command fails with "--yes is required in non-interactive mode" when the flag is omitted.Testing
Checklist
Additional Notes
The guard mirrors the existing
deploycommand's--yesbehavior for consistency across destructive commands. Non-interactive callers (CI,--json) must now pass--yes; this is the intended safety behavior rather than a regression.🤖 Generated by Claude | 2026-07-23 09:20 UTC | 99fe0bb