fix(cli): resolve --force/-f short form conflict on project delete #911

Closed
opened 2026-03-13 23:58:44 +00:00 by freemo · 5 comments
Owner

Background

The specification defines project delete with --force/-f (spec line 3418):

agents project delete [--force|-f] [--yes|-y] <NAME>

However, in the current implementation (src/cleveragents/cli/commands/project.py:919), --force has no -f short form because -f is already claimed by --format on the same command (project.py:928).

The spec does not define --format/-f on project delete — the --format flag is a per-command convention added during implementation that conflicts with the spec's -f for --force.

Acceptance Criteria

  • project delete --force has the -f short alias per specification
  • The --format flag on project delete either uses a different short form (e.g. --format only, no short alias) or the conflict is resolved in alignment with the global output format convention
  • Existing tests pass and any affected test fixtures are updated
  • CLI --help output for project delete matches the specification

Metadata

  • Suggested commit message: fix(cli): add -f short form to project delete --force
  • Suggested branch name: fix/project-delete-force-short-form

Definition of Done

Code merged to main, --force/-f works on project delete, no other command's -f binding is broken.

## Background The specification defines `project delete` with `--force/-f` ([spec line 3418](../docs/specification.md)): ``` agents project delete [--force|-f] [--yes|-y] <NAME> ``` However, in the current implementation (`src/cleveragents/cli/commands/project.py:919`), `--force` has no `-f` short form because `-f` is already claimed by `--format` on the same command (`project.py:928`). The spec does **not** define `--format/-f` on `project delete` — the `--format` flag is a per-command convention added during implementation that conflicts with the spec's `-f` for `--force`. ## Acceptance Criteria - [x] `project delete --force` has the `-f` short alias per specification - [x] The `--format` flag on `project delete` either uses a different short form (e.g. `--format` only, no short alias) or the conflict is resolved in alignment with the global output format convention - [x] Existing tests pass and any affected test fixtures are updated - [x] CLI `--help` output for `project delete` matches the specification ## Metadata - **Suggested commit message:** `fix(cli): add -f short form to project delete --force` - **Suggested branch name:** `fix/project-delete-force-short-form` ## Definition of Done Code merged to `main`, `--force/-f` works on `project delete`, no other command's `-f` binding is broken.
freemo added this to the v3.4.0 milestone 2026-03-13 23:59:37 +00:00
Author
Owner

Related issues:

  • #904 — also fixes CLI flag mismatches (resource/lsp commands)
  • #884 — output envelope alignment may affect how --format is handled globally
**Related issues:** - #904 — also fixes CLI flag mismatches (resource/lsp commands) - #884 — output envelope alignment may affect how `--format` is handled globally
Member

Implementation Notes

Changes Made

src/cleveragents/cli/commands/project.py:

  1. Added -f short alias to --force on the delete command (typer.Option("--force", "-f", ...)).
  2. Removed the -f short alias from --format on the delete command — it now has only the long form --format. This resolves the conflict since the spec does not define --format on project delete at all; the --format flag was an implementation convenience.
  3. Updated the module docstring to show [--force|-f] [--yes|-y] matching the specification.

features/project_cli_commands.feature:
4. Added new scenario "delete command accepts -f short form for --force" that creates a project with linked resources and invokes project delete using -f (short form) via CliRunner, verifying it maps to --force and the delete succeeds.

features/steps/project_cli_commands_steps.py:
5. Added step I invoke project-delete for "{name}" with yes and short force flag which uses typer.testing.CliRunner to invoke the actual CLI with ["delete", name, "--yes", "-f"]. This tests the CLI argument parser binding, not just the function signature.

Design Decisions

  • Kept --format without a short form rather than removing it entirely. The --format flag is useful for scripting (e.g., --format json) and is present on all other project subcommands. Removing the short form -f from --format is the minimal change to resolve the conflict while preserving backwards compatibility for users who use --format (long form) on project delete.
  • Used CliRunner for the new test because the existing _capture() helper calls the Python function directly with keyword arguments, which doesn't exercise the Typer argument parser's flag-to-parameter mapping. Only CliRunner can validate that -f resolves to --force and not --format.

Quality Gates

All 11 nox sessions passed:

  • lint
  • format
  • typecheck (0 errors, 0 warnings)
  • security_scan
  • dead_code
  • unit_tests-3.13
  • integration_tests-3.13
  • docs
  • build-3.13
  • benchmark
  • coverage_report (99%, threshold: 97%)
## Implementation Notes ### Changes Made **`src/cleveragents/cli/commands/project.py`**: 1. Added `-f` short alias to `--force` on the `delete` command (`typer.Option("--force", "-f", ...)`). 2. Removed the `-f` short alias from `--format` on the `delete` command — it now has only the long form `--format`. This resolves the conflict since the spec does not define `--format` on `project delete` at all; the `--format` flag was an implementation convenience. 3. Updated the module docstring to show `[--force|-f] [--yes|-y]` matching the specification. **`features/project_cli_commands.feature`**: 4. Added new scenario "delete command accepts -f short form for --force" that creates a project with linked resources and invokes `project delete` using `-f` (short form) via `CliRunner`, verifying it maps to `--force` and the delete succeeds. **`features/steps/project_cli_commands_steps.py`**: 5. Added step `I invoke project-delete for "{name}" with yes and short force flag` which uses `typer.testing.CliRunner` to invoke the actual CLI with `["delete", name, "--yes", "-f"]`. This tests the CLI argument parser binding, not just the function signature. ### Design Decisions - **Kept `--format` without a short form** rather than removing it entirely. The `--format` flag is useful for scripting (e.g., `--format json`) and is present on all other project subcommands. Removing the short form `-f` from `--format` is the minimal change to resolve the conflict while preserving backwards compatibility for users who use `--format` (long form) on `project delete`. - **Used `CliRunner` for the new test** because the existing `_capture()` helper calls the Python function directly with keyword arguments, which doesn't exercise the Typer argument parser's flag-to-parameter mapping. Only `CliRunner` can validate that `-f` resolves to `--force` and not `--format`. ### Quality Gates All 11 nox sessions passed: - ✅ lint - ✅ format - ✅ typecheck (0 errors, 0 warnings) - ✅ security_scan - ✅ dead_code - ✅ unit_tests-3.13 - ✅ integration_tests-3.13 - ✅ docs - ✅ build-3.13 - ✅ benchmark - ✅ coverage_report (99%, threshold: 97%)
freemo self-assigned this 2026-04-02 06:13:53 +00:00
Author
Owner

PR #1263 reviewed, approved, and merged.

Review summary: The fix correctly reassigns -f to --force on project delete (per spec) and removes the -f short alias from --format on that command. A new BDD scenario validates the fix via CliRunner. All quality gates passed. No issues found.

PR #1263 reviewed, approved, and merged. **Review summary**: The fix correctly reassigns `-f` to `--force` on `project delete` (per spec) and removes the `-f` short alias from `--format` on that command. A new BDD scenario validates the fix via CliRunner. All quality gates passed. No issues found.
Author
Owner

PR #1263 reviewed, approved, and merged.

The --force/-f short form conflict on project delete has been resolved. The -f flag now correctly maps to --force per the specification, and --format on this command is long-form only.

PR #1263 reviewed, approved, and merged. The `--force/-f` short form conflict on `project delete` has been resolved. The `-f` flag now correctly maps to `--force` per the specification, and `--format` on this command is long-form only.
Author
Owner

PR #1263 reviewed, approved, and merged. The -f short form now correctly maps to --force on project delete, aligning with the specification.

PR #1263 reviewed, approved, and merged. The `-f` short form now correctly maps to `--force` on `project delete`, aligning with the specification.
Sign in to join this conversation.
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
cleveragents/cleveragents-core#911
No description provided.