UAT: agents invariant add and agents invariant list missing -p shorthand for --project flag — spec requires it #3996

Open
opened 2026-04-06 08:23:15 +00:00 by freemo · 0 comments
Owner

Metadata

  • Branch: fix/backlog-invariant-project-shorthand
  • Commit Message: fix(invariant): add -p shorthand for --project flag in invariant commands
  • Milestone: None (Backlog)
  • Parent Epic: #3370

Summary

The agents invariant add and agents invariant list commands are missing the -p shorthand for the --project flag. The specification command synopsis shows [(-p|--project) PROJECT] for both commands, indicating -p should be a valid alias for --project.

Backlog note: This issue was discovered during autonomous UAT operation. It does not block milestone completion and has been placed in the backlog for human review and future milestone assignment.

Current Behavior

In src/cleveragents/cli/commands/invariant.py, the --project option is defined without a -p shorthand:

# In add() command:
project: Annotated[
    str | None, typer.Option("--project", help="Project name")
] = None,

# In list_invariants() command:
project: Annotated[
    str | None, typer.Option("--project", help="Filter by project")
] = None,

Running agents invariant add -p myapp "some constraint" fails with an unrecognized option error.

Expected Behavior

Per spec command synopsis:

  • agents invariant add [--global] [(-p|--project) PROJECT] [--plan PLAN_ID]... [--action ACTION]... <INVARIANT_TEXT>
  • agents invariant list [--global] [(-p|--project) PROJECT] [--plan PLAN_ID] [--action ACTION] [--effective] [<REGEX>]

Running agents invariant add -p myapp "some constraint" should work identically to agents invariant add --project myapp "some constraint".

Steps to Reproduce

  1. Run: agents invariant add -p myapp "All APIs need tests"
  2. Observe: Error — unrecognized option -p
  3. Expected: Invariant created with project scope myapp

Code Location

  • File: src/cleveragents/cli/commands/invariant.py
  • Functions: add() (line ~117) and list_invariants() (line ~155)
  • Fix: Add "-p" to the typer.Option() call for the project parameter in both commands

Subtasks

  • Add -p shorthand to --project option in add() command
  • Add -p shorthand to --project option in list_invariants() command
  • Add Behave BDD tests verifying -p works as alias for --project
  • Verify existing --project tests still pass

Definition of Done

  • agents invariant add -p myapp "text" works identically to agents invariant add --project myapp "text"
  • agents invariant list -p myapp works identically to agents invariant list --project myapp
  • Unit tests cover the -p shorthand
  • Code passes nox -e typecheck and nox -e unit_tests
  • All nox stages pass
  • Coverage >= 97%

Automated by CleverAgents Bot
Supervisor: UAT Testing | Agent: ca-new-issue-creator

## Metadata - **Branch**: `fix/backlog-invariant-project-shorthand` - **Commit Message**: `fix(invariant): add -p shorthand for --project flag in invariant commands` - **Milestone**: None (Backlog) - **Parent Epic**: #3370 ## Summary The `agents invariant add` and `agents invariant list` commands are missing the `-p` shorthand for the `--project` flag. The specification command synopsis shows `[(-p|--project) PROJECT]` for both commands, indicating `-p` should be a valid alias for `--project`. > **Backlog note:** This issue was discovered during autonomous UAT operation. It does not block milestone completion and has been placed in the backlog for human review and future milestone assignment. ## Current Behavior In `src/cleveragents/cli/commands/invariant.py`, the `--project` option is defined without a `-p` shorthand: ```python # In add() command: project: Annotated[ str | None, typer.Option("--project", help="Project name") ] = None, # In list_invariants() command: project: Annotated[ str | None, typer.Option("--project", help="Filter by project") ] = None, ``` Running `agents invariant add -p myapp "some constraint"` fails with an unrecognized option error. ## Expected Behavior Per spec command synopsis: - `agents invariant add [--global] [(-p|--project) PROJECT] [--plan PLAN_ID]... [--action ACTION]... <INVARIANT_TEXT>` - `agents invariant list [--global] [(-p|--project) PROJECT] [--plan PLAN_ID] [--action ACTION] [--effective] [<REGEX>]` Running `agents invariant add -p myapp "some constraint"` should work identically to `agents invariant add --project myapp "some constraint"`. ## Steps to Reproduce 1. Run: `agents invariant add -p myapp "All APIs need tests"` 2. Observe: Error — unrecognized option `-p` 3. Expected: Invariant created with project scope `myapp` ## Code Location - **File**: `src/cleveragents/cli/commands/invariant.py` - **Functions**: `add()` (line ~117) and `list_invariants()` (line ~155) - **Fix**: Add `"-p"` to the `typer.Option()` call for the `project` parameter in both commands ## Subtasks - [ ] Add `-p` shorthand to `--project` option in `add()` command - [ ] Add `-p` shorthand to `--project` option in `list_invariants()` command - [ ] Add Behave BDD tests verifying `-p` works as alias for `--project` - [ ] Verify existing `--project` tests still pass ## Definition of Done - [ ] `agents invariant add -p myapp "text"` works identically to `agents invariant add --project myapp "text"` - [ ] `agents invariant list -p myapp` works identically to `agents invariant list --project myapp` - [ ] Unit tests cover the `-p` shorthand - [ ] Code passes `nox -e typecheck` and `nox -e unit_tests` - All nox stages pass - Coverage >= 97% --- **Automated by CleverAgents Bot** Supervisor: UAT Testing | Agent: ca-new-issue-creator
HAL9000 added this to the v3.5.0 milestone 2026-04-09 03:12:13 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
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#3996
No description provided.