Skip to content

feat(push): accept --yes / --no-prompt / -y as aliases for --force#1249

Draft
DaveHanns wants to merge 1 commit into
masterfrom
push-accept-npm-yes-flags-as-aliases
Draft

feat(push): accept --yes / --no-prompt / -y as aliases for --force#1249
DaveHanns wants to merge 1 commit into
masterfrom
push-accept-npm-yes-flags-as-aliases

Conversation

@DaveHanns

Copy link
Copy Markdown
Contributor

Summary

apify push already has --force to override the "your local files are older than the remote" check. But agents (and users coming from npm / apt / yum / most CLI ecosystems) reflexively type --yes, -y, --no-prompt, or --no-interactive instead — and today those all fail with "Unknown flag". That failure is misleading: --force exists and is exactly what they meant. This PR accepts all four as aliases for --force, additive and behavior-preserving.

Cross-reference: finding F25 in the agentic-actor-development sweep.

What changes

In src/commands/actors/push.ts:

  • Add three new top-level boolean flags: yes (with char: 'y'), no-prompt, and no-interactive. Each is documented as an alias for --force.
  • In run(), OR them together with this.flags.force when deciding whether to skip the "remote is newer than local" staleness check.
  • No changes to --force itself. Users who already pass --force see identical behavior.

Why not aliases: [...] on --force?

The command-framework's Flags.boolean({ aliases: [...] }) does work — but only for names that don't start with no-. The framework configures node's parseArgs with allowNegative: true, and node then consumes --no-prompt as negation of a hypothetical prompt flag before checking whether no-prompt was registered as its own option. Verified with a small parseArgs smoke script. The command-framework's own convention for --no-* flags is to declare them as top-level keys literally starting with no- (the framework strips the prefix at registration time and re-inverts the value on read), so this PR follows that path.

--yes could have been added as an aliases: ['yes'] entry on --force, but then it couldn't get its own char: 'y' short form. Keeping all four as sibling top-level flags is symmetric and keeps -y available.

Test plan

  • apify push --yes behaves the same as apify push --force (skips the "remote is newer" check).
  • apify push -y behaves the same as apify push --force.
  • apify push --no-prompt behaves the same as apify push --force.
  • apify push --no-interactive behaves the same as apify push --force.
  • apify push --force continues to work unchanged.
  • apify push --help renders the new flags in the help output.
  • tsc --noEmit and oxlint --type-aware clean on the changed file (verified locally).

Agents (and humans coming from npm/apt/yum) reflexively reach for
--yes, -y, --no-prompt, or --no-interactive to skip confirmation
prompts. On `apify push` all of these fail with "Unknown flag" —
misleading, because --force does exist and is exactly what the user
means. Register --yes/-y, --no-prompt, and --no-interactive as
top-level boolean flags on `apify push` and OR them into the same
skip-staleness-check branch as --force. No behavior change for
--force itself; the new flags are additive. Cross-reference finding
F25.

Note on implementation: aliases on --force via the framework's
`aliases: [...]` array cannot handle `no-*` names, because node's
parseArgs (which the command-framework configures with
`allowNegative: true`) consumes `--no-prompt` as negation of a
hypothetical `prompt` flag regardless of whether `no-prompt` is
also registered. The command-framework's convention for `--no-*`
flags is to declare them as top-level keys starting with `no-`, so
that path is used here.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
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