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

Merged
freemo merged 1 commits 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 added the
Type
Feature
label 2026-03-29 06:03:01 +00:00
freemo force-pushed feature/m4-actor-context-cmds from 12ac191dce to ca3fed4353 2026-03-29 21:52:03 +00:00 Compare
freemo reviewed 2026-03-30 04:22:47 +00:00
freemo left a comment
Author
Owner

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 reviewed 2026-03-30 04:49:42 +00:00
freemo left a comment
Author
Owner

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 requested review from CoreRasurae 2026-03-30 05:14:13 +00:00
freemo requested review from brent.edwards 2026-03-30 05:14:13 +00:00
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 to 297823c291 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 Label
Type
Feature
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: cleveragents/cleveragents-core#1190