feat(cli): add actor context remove, export, and import commands #1190

Merged
freemo merged 1 commit from feature/m4-actor-context-cmds into master 2026-03-30 19:51:53 +00:00
Owner

Summary

Adds three missing actor context subcommands per specification: remove, export, and import.

Changes

  • src/cleveragents/cli/commands/actor_context.py (new): Implements remove (with --yes/--all), export (JSON/YAML with SHA-256 checksum), import (with --update for overwrite)
  • src/cleveragents/cli/commands/actor.py: Wires actor_context sub-Typer
  • features/actor_context_cmds.feature: 15 BDD scenarios
  • robot/actor_context_export_import.robot: Integration test for export-then-import round-trip

Approach

All commands support 6 output formats via format_output. Export writes JSON or YAML (detected from file extension) with integrity checksums. Import infers context name from file metadata or filename stem. Remove checks existence before ContextManager construction to avoid auto-creating directories.

Closes #869

## Summary Adds three missing actor context subcommands per specification: `remove`, `export`, and `import`. ## Changes - `src/cleveragents/cli/commands/actor_context.py` (new): Implements `remove` (with `--yes`/`--all`), `export` (JSON/YAML with SHA-256 checksum), `import` (with `--update` for overwrite) - `src/cleveragents/cli/commands/actor.py`: Wires `actor_context` sub-Typer - `features/actor_context_cmds.feature`: 15 BDD scenarios - `robot/actor_context_export_import.robot`: Integration test for export-then-import round-trip ## Approach All commands support 6 output formats via `format_output`. Export writes JSON or YAML (detected from file extension) with integrity checksums. Import infers context name from file metadata or filename stem. Remove checks existence before ContextManager construction to avoid auto-creating directories. Closes #869
freemo added this to the v3.4.0 milestone 2026-03-29 06:02:56 +00:00
freemo force-pushed feature/m4-actor-context-cmds from 12ac191dce
Some checks failed
CI / benchmark-publish (pull_request) Has been skipped
CI / quality (pull_request) Successful in 55s
CI / lint (pull_request) Successful in 3m20s
CI / build (pull_request) Successful in 15s
CI / integration_tests (pull_request) Successful in 3m51s
CI / helm (pull_request) Successful in 22s
CI / typecheck (pull_request) Successful in 4m14s
CI / security (pull_request) Successful in 4m17s
CI / unit_tests (pull_request) Failing after 4m38s
CI / docker (pull_request) Has been skipped
CI / e2e_tests (pull_request) Successful in 13m28s
CI / coverage (pull_request) Successful in 13m4s
CI / status-check (pull_request) Failing after 1s
CI / benchmark-regression (pull_request) Successful in 1h1m51s
to ca3fed4353
All checks were successful
CI / benchmark-publish (pull_request) Has been skipped
CI / lint (pull_request) Successful in 27s
CI / quality (pull_request) Successful in 3m47s
CI / build (pull_request) Successful in 13s
CI / typecheck (pull_request) Successful in 4m2s
CI / security (pull_request) Successful in 4m11s
CI / helm (pull_request) Successful in 51s
CI / integration_tests (pull_request) Successful in 6m17s
CI / unit_tests (pull_request) Successful in 6m22s
CI / docker (pull_request) Successful in 1m19s
CI / e2e_tests (pull_request) Successful in 10m33s
CI / coverage (pull_request) Successful in 11m35s
CI / status-check (pull_request) Successful in 1s
CI / benchmark-regression (pull_request) Successful in 55m26s
2026-03-29 21:52:03 +00:00
Compare
freemo left a comment

Review: Looks Good (self-authored — posted as comment)

Complete implementation with both BDD and Robot tests. Good export/import round-trip validation with checksum. actor_context.py at 446 lines is within limits. context_remove with --yes confirmation skip is clean.

## Review: Looks Good (self-authored — posted as comment) Complete implementation with both BDD and Robot tests. Good export/import round-trip validation with checksum. `actor_context.py` at 446 lines is within limits. `context_remove` with `--yes` confirmation skip is clean.
freemo left a comment

Updated Review (Deep Pass): Changes Required

My initial review looked good. The deep review finds CONTRIBUTING.md violations.

New Finding: Pyright suppression in step file

actor_context_cmds_steps.py line 1: # pyright: reportRedeclaration=false — This is a type checker suppression, explicitly forbidden by CONTRIBUTING.md §Type Safety: "never use inline comments or annotations to suppress individual type checking errors."

New Finding: # type: ignore[assignment] on two lines

actor_context.py lines 255 and 340 both use = ..., # type: ignore[assignment] for the Typer option pattern. Same violation.

New Finding: Imports inside function bodies

  • actor_context.py line 137: import shutil inside context_remove()
  • actor_context_cmds_steps.py line 369: import yaml inside a step function

Per CONTRIBUTING.md: "Ensure all imports are at the top of the Python file."

New Finding: Missing type annotations on step context parameters

Step function parameters use untyped context instead of context: Context.

Previous findings still apply: Good export/import round-trip, clean command structure.

## Updated Review (Deep Pass): Changes Required My initial review looked good. The deep review finds CONTRIBUTING.md violations. ### New Finding: Pyright suppression in step file `actor_context_cmds_steps.py` line 1: `# pyright: reportRedeclaration=false` — This is a **type checker suppression**, explicitly forbidden by CONTRIBUTING.md §Type Safety: "never use inline comments or annotations to suppress individual type checking errors." ### New Finding: `# type: ignore[assignment]` on two lines `actor_context.py` lines 255 and 340 both use `= ..., # type: ignore[assignment]` for the Typer option pattern. Same violation. ### New Finding: Imports inside function bodies - `actor_context.py` line 137: `import shutil` inside `context_remove()` - `actor_context_cmds_steps.py` line 369: `import yaml` inside a step function Per CONTRIBUTING.md: "Ensure all imports are at the top of the Python file." ### New Finding: Missing type annotations on step `context` parameters Step function parameters use untyped `context` instead of `context: Context`. ### Previous findings still apply: Good export/import round-trip, clean command structure.
freemo scheduled this pull request to auto merge when all checks succeed 2026-03-30 19:35:18 +00:00
freemo force-pushed feature/m4-actor-context-cmds from ca3fed4353
All checks were successful
CI / benchmark-publish (pull_request) Has been skipped
CI / lint (pull_request) Successful in 27s
CI / quality (pull_request) Successful in 3m47s
CI / build (pull_request) Successful in 13s
CI / typecheck (pull_request) Successful in 4m2s
CI / security (pull_request) Successful in 4m11s
CI / helm (pull_request) Successful in 51s
CI / integration_tests (pull_request) Successful in 6m17s
CI / unit_tests (pull_request) Successful in 6m22s
CI / docker (pull_request) Successful in 1m19s
CI / e2e_tests (pull_request) Successful in 10m33s
CI / coverage (pull_request) Successful in 11m35s
CI / status-check (pull_request) Successful in 1s
CI / benchmark-regression (pull_request) Successful in 55m26s
to 297823c291
Some checks failed
CI / benchmark-publish (pull_request) Has been skipped
CI / build (pull_request) Successful in 18s
CI / helm (pull_request) Successful in 21s
CI / lint (pull_request) Successful in 3m18s
CI / quality (pull_request) Successful in 3m42s
CI / typecheck (pull_request) Successful in 3m55s
CI / security (pull_request) Successful in 4m5s
CI / integration_tests (pull_request) Successful in 9m12s
CI / unit_tests (pull_request) Successful in 9m32s
CI / docker (pull_request) Successful in 1m33s
CI / coverage (pull_request) Successful in 11m51s
CI / e2e_tests (pull_request) Successful in 16m26s
CI / status-check (pull_request) Successful in 1s
CI / build (push) Successful in 13s
CI / helm (push) Successful in 22s
CI / lint (push) Successful in 3m17s
CI / quality (push) Successful in 3m41s
CI / typecheck (push) Successful in 3m53s
CI / benchmark-regression (push) Has been skipped
CI / security (push) Successful in 4m4s
CI / integration_tests (push) Successful in 10m44s
CI / unit_tests (push) Successful in 12m37s
CI / docker (push) Failing after 47s
CI / coverage (push) Successful in 11m53s
CI / e2e_tests (push) Has been cancelled
CI / benchmark-publish (push) Has been cancelled
CI / status-check (push) Has been cancelled
CI / benchmark-regression (pull_request) Successful in 54m46s
2026-03-30 19:35:24 +00:00
Compare
freemo merged commit 297823c291 into master 2026-03-30 19:51:53 +00:00
freemo deleted branch feature/m4-actor-context-cmds 2026-03-30 19:51:54 +00:00
Sign in to join this conversation.
No reviewers
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!1190
No description provided.