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

Closed
opened 2026-04-03 03:48:58 +00:00 by freemo · 3 comments
Owner

Metadata

  • Branch: fix/invariant-project-shorthand
  • Commit Message: fix(cli): add -p shorthand for --project in invariant add and list commands
  • Milestone: v3.7.0
  • Parent Epic: #936

Subtasks

  • Add "-p" alias to project option in add() function (invariant.py line 119)
  • Add "-p" alias to project option in list_invariants() function (invariant.py line 155)
  • Add/update tests to verify -p shorthand works for agents invariant add
  • Add/update tests to verify -p shorthand works for agents invariant list
  • Verify no regression on existing --project long-form usage

Definition of Done

This issue is complete when:

  • All subtasks above are completed and checked off.
  • A Git commit is created where the first line of the commit message matches the Commit Message in Metadata exactly, followed by a blank line, then additional lines providing relevant details about the implementation.
  • The commit is pushed to the remote on the branch matching the Branch in Metadata exactly.
  • The commit is submitted as a pull request to master, reviewed, and merged before this issue is marked done.
  • All nox stages pass.
  • Coverage >= 97%.

Background and Context

The specification (docs/specification.md lines 17794–17795 and 17970–17971) defines the -p shorthand for --project in both agents invariant add and agents invariant list commands:

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

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

The current implementation in src/cleveragents/cli/commands/invariant.py only defines --project without the -p shorthand for both commands, causing a spec deviation discovered during UAT.

Current Behavior

  • agents invariant add -p myapp "Some constraint" → exit code 2, error: "No such option: -p"
  • agents invariant list -p myapp → exit code 2, error: "No such option: -p"

Code Location:

  • src/cleveragents/cli/commands/invariant.py, add() function: project: Annotated[str | None, typer.Option("--project", ...)] (line 119) — missing "-p" alias
  • src/cleveragents/cli/commands/invariant.py, list_invariants() function: project: Annotated[str | None, typer.Option("--project", ...)] (line 155) — missing "-p" alias

Expected Behavior

Per spec, both commands must accept -p as a shorthand for --project:

  • agents invariant add -p myapp "Some constraint" → succeeds, same as --project myapp
  • agents invariant list -p myapp → succeeds, same as --project myapp

Steps to Reproduce

  1. Run: agents invariant list -p myapp
  2. Observe: "No such option: -p" error instead of filtering by project

Spec Reference

docs/specification.md lines 17794–17795 (add command) and 17970–17971 (list command) both show (--project|-p) PROJECT syntax.


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

## Metadata - **Branch**: `fix/invariant-project-shorthand` - **Commit Message**: `fix(cli): add -p shorthand for --project in invariant add and list commands` - **Milestone**: v3.7.0 - **Parent Epic**: #936 ## Subtasks - [ ] Add `"-p"` alias to `project` option in `add()` function (`invariant.py` line 119) - [ ] Add `"-p"` alias to `project` option in `list_invariants()` function (`invariant.py` line 155) - [ ] Add/update tests to verify `-p` shorthand works for `agents invariant add` - [ ] Add/update tests to verify `-p` shorthand works for `agents invariant list` - [ ] Verify no regression on existing `--project` long-form usage ## Definition of Done This issue is complete when: - All subtasks above are completed and checked off. - A Git commit is created where the **first line** of the commit message matches the Commit Message in Metadata exactly, followed by a blank line, then additional lines providing relevant details about the implementation. - The commit is pushed to the remote on the branch matching the **Branch** in Metadata exactly. - The commit is submitted as a **pull request** to `master`, reviewed, and **merged** before this issue is marked done. - All nox stages pass. - Coverage >= 97%. ## Background and Context The specification (`docs/specification.md` lines 17794–17795 and 17970–17971) defines the `-p` shorthand for `--project` in both `agents invariant add` and `agents invariant list` commands: ``` agents invariant add [--global] [(--project|-p) PROJECT] [--plan PLAN_ID]... [--action ACTION]... <INVARIANT_TEXT> agents invariant list [--global] [(--project|-p) PROJECT] [--plan PLAN_ID] [--action ACTION] [--effective] [<REGEX>] ``` The current implementation in `src/cleveragents/cli/commands/invariant.py` only defines `--project` without the `-p` shorthand for both commands, causing a spec deviation discovered during UAT. ## Current Behavior - `agents invariant add -p myapp "Some constraint"` → exit code 2, error: `"No such option: -p"` - `agents invariant list -p myapp` → exit code 2, error: `"No such option: -p"` **Code Location:** - `src/cleveragents/cli/commands/invariant.py`, `add()` function: `project: Annotated[str | None, typer.Option("--project", ...)]` (line 119) — missing `"-p"` alias - `src/cleveragents/cli/commands/invariant.py`, `list_invariants()` function: `project: Annotated[str | None, typer.Option("--project", ...)]` (line 155) — missing `"-p"` alias ## Expected Behavior Per spec, both commands must accept `-p` as a shorthand for `--project`: - `agents invariant add -p myapp "Some constraint"` → succeeds, same as `--project myapp` - `agents invariant list -p myapp` → succeeds, same as `--project myapp` ## Steps to Reproduce 1. Run: `agents invariant list -p myapp` 2. Observe: `"No such option: -p"` error instead of filtering by project ## Spec Reference `docs/specification.md` lines 17794–17795 (`add` command) and 17970–17971 (`list` command) both show `(--project|-p) PROJECT` syntax. --- **Automated by CleverAgents Bot** Supervisor: UAT Testing | Agent: ca-new-issue-creator
freemo added this to the v3.7.0 milestone 2026-04-03 03:49:14 +00:00
freemo self-assigned this 2026-04-03 16:58:10 +00:00
Author
Owner

MoSCoW classification: Should Have

Rationale: This issue addresses a spec requirement or important quality improvement. It should be included in the milestone if possible.


Automated by CleverAgents Bot
Supervisor: Project Owner | Agent: ca-project-owner

MoSCoW classification: **Should Have** Rationale: This issue addresses a spec requirement or important quality improvement. It should be included in the milestone if possible. --- **Automated by CleverAgents Bot** Supervisor: Project Owner | Agent: ca-project-owner
Author
Owner

UAT Confirmation — Duplicate Discovery

This issue was independently rediscovered during UAT testing of the CLI Commands feature area (Sat Apr 04 2026). The finding is confirmed:

  • Code location verified: src/cleveragents/cli/commands/invariant.py, add() function line 118–120 and list_invariants() function line 155–157.
  • Root cause confirmed: typer.Option("--project", ...) is missing the "-p" alias in both functions.
  • Spec reference confirmed: docs/specification.md lines 17794–17804 and 17970define(--project|-p) PROJECT` for both commands.
  • Reproduction confirmed: agents invariant add -p myapp "text" and agents invariant list -p myapp both fail with No such option: -p.

No new issue was created — this comment serves as a UAT confirmation of the existing tracked bug.


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

## UAT Confirmation — Duplicate Discovery This issue was independently rediscovered during UAT testing of the CLI Commands feature area (Sat Apr 04 2026). The finding is confirmed: - **Code location verified**: `src/cleveragents/cli/commands/invariant.py`, `add()` function line 118–120 and `list_invariants()` function line 155–157. - **Root cause confirmed**: `typer.Option("--project", ...)` is missing the `"-p"` alias in both functions. - **Spec reference confirmed**: `docs/specification.md` lines 17794–17804 and 17970` define `(--project|-p) PROJECT` for both commands. - **Reproduction confirmed**: `agents invariant add -p myapp "text"` and `agents invariant list -p myapp` both fail with `No such option: -p`. No new issue was created — this comment serves as a UAT confirmation of the existing tracked bug. --- **Automated by CleverAgents Bot** Supervisor: UAT Testing | Agent: ca-new-issue-creator
Author
Owner

Closing as duplicate of #3529.

Both issues describe the same bug: agents invariant add and agents invariant list are missing the -p shorthand for --project. Issue #3529 is the established tracking issue (v3.3.0 milestone, State/Verified). Please track this work in #3529.


Automated by CleverAgents Bot
Supervisor: Backlog Grooming | Agent: ca-backlog-groomer

Closing as duplicate of #3529. Both issues describe the same bug: `agents invariant add` and `agents invariant list` are missing the `-p` shorthand for `--project`. Issue #3529 is the established tracking issue (v3.3.0 milestone, `State/Verified`). Please track this work in #3529. --- **Automated by CleverAgents Bot** Supervisor: Backlog Grooming | Agent: ca-backlog-groomer
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#2072
No description provided.