Skip to content

feat(push): confirm before destructive resource push - #573

Merged
davidsu merged 5 commits into
mainfrom
feat/push-confirm
Jul 23, 2026
Merged

feat(push): confirm before destructive resource push#573
davidsu merged 5 commits into
mainfrom
feat/push-confirm

Conversation

@davidsu

@davidsu davidsu commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

Note

Description

The push commands 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, --yes flag is required, so the commands fail fast instead of hanging on a prompt.

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 a shared confirmPush() helper (packages/cli/src/cli/utils/confirm-push.ts) that warns and prompts interactively, requires --yes in non-interactive mode (throws InvalidInputError otherwise), and returns false when the user declines.
  • Exported confirmPush from the CLI utils barrel (utils/index.ts).
  • Wired the guard into the agents push, entities push, and connectors push commands, each with a resource-specific warning message and a -y, --yes "Skip confirmation prompt" option; a declined prompt returns a Push cancelled outro.
  • Used future-tense ("This will …") wording in the warnings to match deploy's phrasing.
  • Updated push specs to pass --yes where 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.
  • Tightened the token-refresh-failure test to assert the real "Unauthorized" reason rather than just a non-zero exit.

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 guard mirrors the existing deploy command's --yes behavior 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

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>
@davidsu

davidsu commented Jul 23, 2026

Copy link
Copy Markdown
Contributor Author

Reviewed (agent exec-flags): approved. Verified against the agreed design — confirmPush mirrors deploy's guard exactly (incl. InvalidInputError in non-interactive mode; isNonInteractive includes --json, so JSON/CI can never hang on the prompt), all three destructive pushes are wired with -y/--yes, the connectors warning names remote removal, the entities confirm sits after the zero-entities early return, and each command has a non-interactive-without---yes failure test.

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 project/deploy.ts to reuse confirmPush.

🤖 Generated with Claude Code

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@davidsu davidsu closed this Jul 23, 2026
@davidsu davidsu reopened this Jul 23, 2026
@github-actions

github-actions Bot commented Jul 23, 2026

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.573.99fe0bb

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.573.99fe0bb"

Or add it to your package.json dependencies:

{
  "dependencies": {
    "base44": "npm:@base44-preview/cli@0.1.5-pr.573.99fe0bb"
  }
}

Preview published to npm registry — try new features instantly!

@davidsu davidsu closed this Jul 23, 2026
@davidsu davidsu reopened this Jul 23, 2026
davidsu and others added 3 commits July 23, 2026 11:17
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>
Comment thread packages/cli/src/cli/commands/agents/push.ts

@guyofeck guyofeck left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think the convention should be --force and not --yes, but it's kind of a product decision.
wdyt guys? @davidsu @netanelgilad

@guyofeck
guyofeck self-requested a review July 23, 2026 12:39

@guyofeck guyofeck left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

--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.

@davidsu
davidsu merged commit bbce793 into main Jul 23, 2026
18 checks passed
@davidsu
davidsu deleted the feat/push-confirm branch July 23, 2026 12:40
yardend-wix added a commit that referenced this pull request Jul 28, 2026
#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.
yardend-wix added a commit that referenced this pull request Jul 28, 2026
#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.
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