refactor(cli): relocate context commands under actor context hierarchy per specification #888

Closed
opened 2026-03-13 23:27:00 +00:00 by freemo · 4 comments
Owner

Metadata

  • Commit Message: refactor(cli): move context commands to actor context subgroup
  • Branch: feature/m4-actor-context-hierarchy

Background and Context

The specification defines actor context management commands under agents actor context:

agents actor context remove [--yes|-y] (--all|-a|<NAME>)
agents actor context list [<REGEX>]
agents actor context show <NAME>
agents actor context export (--output|-o) <FILE> <NAME>
agents actor context import [--update] (--input|-i) <FILE> [<NAME>]
agents actor context clear [--yes|-y] (--all|-a|<NAME>)

The current implementation places these commands under a top-level agents context group (in src/cleveragents/cli/commands/context.py) instead of under agents actor context. Additionally, the remove command is named rm (not remove as the spec requires).

This structural mismatch means:

  • agents actor context list (spec) → agents context list (code)
  • agents actor context remove (spec) → agents context rm (code)
  • Users following the spec will get "unknown command" errors

Note: Issue #869 tracks adding the missing actor context remove/export/import commands but does not address the hierarchy relocation or the rmremove rename.

Expected Behavior

Context commands should be accessible under both agents actor context (canonical spec path) and potentially as aliases at the top level for backward compatibility.

Acceptance Criteria

  • agents actor context list is a valid command path
  • agents actor context show is a valid command path
  • agents actor context remove is a valid command path (not rm)
  • agents actor context export is a valid command path
  • agents actor context import is a valid command path
  • agents actor context clear is a valid command path
  • Command behavior is identical regardless of invocation path
  • agents context * remains as a deprecated alias (with deprecation warning) for one release cycle

Subtasks

  • Register context as a sub-app of actor in main.py
  • Add deprecation wrapper for top-level agents context commands
  • Rename rm subcommand to remove (add rm as alias with deprecation warning)
  • Update command help text to reflect new hierarchy
  • Tests (Behave): Verify commands work at new path
  • Tests (Behave): Verify deprecated aliases still work with warning
  • Verify coverage >= 97% via nox -s coverage_report
  • Run nox (all default sessions), fix any errors

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.
## Metadata - **Commit Message**: `refactor(cli): move context commands to actor context subgroup` - **Branch**: `feature/m4-actor-context-hierarchy` ## Background and Context The specification defines actor context management commands under `agents actor context`: ``` agents actor context remove [--yes|-y] (--all|-a|<NAME>) agents actor context list [<REGEX>] agents actor context show <NAME> agents actor context export (--output|-o) <FILE> <NAME> agents actor context import [--update] (--input|-i) <FILE> [<NAME>] agents actor context clear [--yes|-y] (--all|-a|<NAME>) ``` The current implementation places these commands under a **top-level** `agents context` group (in `src/cleveragents/cli/commands/context.py`) instead of under `agents actor context`. Additionally, the `remove` command is named `rm` (not `remove` as the spec requires). This structural mismatch means: - `agents actor context list` (spec) → `agents context list` (code) - `agents actor context remove` (spec) → `agents context rm` (code) - Users following the spec will get "unknown command" errors Note: Issue #869 tracks adding the missing `actor context remove/export/import` commands but does not address the hierarchy relocation or the `rm` → `remove` rename. ## Expected Behavior Context commands should be accessible under both `agents actor context` (canonical spec path) and potentially as aliases at the top level for backward compatibility. ## Acceptance Criteria - [ ] `agents actor context list` is a valid command path - [ ] `agents actor context show` is a valid command path - [ ] `agents actor context remove` is a valid command path (not `rm`) - [ ] `agents actor context export` is a valid command path - [ ] `agents actor context import` is a valid command path - [ ] `agents actor context clear` is a valid command path - [ ] Command behavior is identical regardless of invocation path - [ ] `agents context *` remains as a deprecated alias (with deprecation warning) for one release cycle ## Subtasks - [ ] Register `context` as a sub-app of `actor` in `main.py` - [ ] Add deprecation wrapper for top-level `agents context` commands - [ ] Rename `rm` subcommand to `remove` (add `rm` as alias with deprecation warning) - [ ] Update command help text to reflect new hierarchy - [ ] Tests (Behave): Verify commands work at new path - [ ] Tests (Behave): Verify deprecated aliases still work with warning - [ ] Verify coverage >= 97% via `nox -s coverage_report` - [ ] Run `nox` (all default sessions), fix any errors ## 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.
freemo added this to the v3.4.0 milestone 2026-03-13 23:30:31 +00:00
Author
Owner

Dependencies / Related Issues:

  • Depends on: #869 (implement missing actor context commands — the commands must exist before they can be relocated)
  • This issue handles the hierarchy relocation and rmremove rename that #869 does not cover.
**Dependencies / Related Issues:** - Depends on: #869 (implement missing actor context commands — the commands must exist before they can be relocated) - This issue handles the hierarchy relocation and `rm` → `remove` rename that #869 does not cover.
freemo self-assigned this 2026-03-29 02:30:29 +00:00
Author
Owner

Implementation Notes

PR: #1194 | Branch: feature/m4-actor-context-hierarchy | Commit: db40bd794e4997a516ac19baed0756036647c011

Changes

  1. src/cleveragents/cli/main.py — Registered context.app as a sub-app of actor.app for the canonical agents actor context path. Top-level agents context kept as deprecated alias via Typer's deprecated=True flag.

  2. src/cleveragents/cli/commands/context.py:

    • @app.command("rm") renamed to @app.command("remove") on context_remove()
    • Added @app.command("rm", hidden=True) as context_rm_deprecated() that prints deprecation warning then delegates to context_remove()
    • Programmatic rm_command() deprecated in favor of remove_command()
    • Help text updated from agents context to agents actor context
  3. Tests updated:

    • Behave: features/cli_plan_context_commands.featurecontext rmactor context remove
    • Behave: features/steps/context_unit_tests_steps.py["rm", ...]["remove", ...], programmatic calls use remove_command()
    • Behave: features/steps/cli_commands_coverage_steps.py — Updated rmremove invocation and case-insensitive help assertion
    • Robot: robot/cli_plan_context_commands.robotcontext rmactor context remove

Nox Results

Session Result
lint pass
typecheck pass (0 errors, 0 warnings)
unit_tests 495 features, 12731 scenarios, 0 failures
integration_tests 1818/1819 pass (1 pre-existing failure in core_cli_commands.robot project-status-without-project test — unrelated)
coverage_report 97%

Backward Compatibility

  • agents context list/show/add/clear/export/import/remove still works (deprecated, Typer shows deprecation marker)
  • agents context rm still works (hidden, prints explicit deprecation warning)
  • Programmatic rm_command() still works (emits DeprecationWarning)
## Implementation Notes **PR**: #1194 | **Branch**: `feature/m4-actor-context-hierarchy` | **Commit**: `db40bd794e4997a516ac19baed0756036647c011` ### Changes 1. **`src/cleveragents/cli/main.py`** — Registered `context.app` as a sub-app of `actor.app` for the canonical `agents actor context` path. Top-level `agents context` kept as deprecated alias via Typer's `deprecated=True` flag. 2. **`src/cleveragents/cli/commands/context.py`**: - `@app.command("rm")` renamed to `@app.command("remove")` on `context_remove()` - Added `@app.command("rm", hidden=True)` as `context_rm_deprecated()` that prints deprecation warning then delegates to `context_remove()` - Programmatic `rm_command()` deprecated in favor of `remove_command()` - Help text updated from `agents context` to `agents actor context` 3. **Tests updated**: - Behave: `features/cli_plan_context_commands.feature` — `context rm` → `actor context remove` - Behave: `features/steps/context_unit_tests_steps.py` — `["rm", ...]` → `["remove", ...]`, programmatic calls use `remove_command()` - Behave: `features/steps/cli_commands_coverage_steps.py` — Updated `rm` → `remove` invocation and case-insensitive help assertion - Robot: `robot/cli_plan_context_commands.robot` — `context rm` → `actor context remove` ### Nox Results | Session | Result | |---------|--------| | lint | pass | | typecheck | pass (0 errors, 0 warnings) | | unit_tests | **495 features, 12731 scenarios, 0 failures** | | integration_tests | 1818/1819 pass (1 pre-existing failure in `core_cli_commands.robot` project-status-without-project test — unrelated) | | coverage_report | **97%** | ### Backward Compatibility - `agents context list/show/add/clear/export/import/remove` still works (deprecated, Typer shows deprecation marker) - `agents context rm` still works (hidden, prints explicit deprecation warning) - Programmatic `rm_command()` still works (emits `DeprecationWarning`)
Author
Owner

PR #1194 reviewed, approved, and merged.

Context commands are now accessible under the canonical agents actor context path per specification. The rm subcommand has been renamed to remove. Backward compatibility is maintained via deprecated aliases (agents context and rm).

PR #1194 reviewed, approved, and merged. Context commands are now accessible under the canonical `agents actor context` path per specification. The `rm` subcommand has been renamed to `remove`. Backward compatibility is maintained via deprecated aliases (`agents context` and `rm`).
Author
Owner

PR #1194 reviewed, approved, and merged. Context commands are now accessible under the canonical agents actor context path per specification, with agents context retained as a deprecated alias. The rm subcommand has been renamed to remove with rm kept as a hidden deprecated alias.

PR #1194 reviewed, approved, and merged. Context commands are now accessible under the canonical `agents actor context` path per specification, with `agents context` retained as a deprecated alias. The `rm` subcommand has been renamed to `remove` with `rm` kept as a hidden deprecated alias.
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.

Dependencies

No dependencies set.

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