refactor(cli): rename plan lifecycle-list and lifecycle-apply to match specification #1188

Merged
freemo merged 7 commits from feature/m3-plan-cmd-names into master 2026-04-02 19:09:05 +00:00

7 Commits

Author SHA1 Message Date
freemo 8f1cdcc5a1 fix(e2e): update lifecycle-list/lifecycle-apply references to match renamed commands
CI / benchmark-publish (pull_request) Has been skipped
CI / build (pull_request) Successful in 15s
CI / helm (pull_request) Successful in 22s
CI / typecheck (pull_request) Successful in 56s
CI / lint (pull_request) Successful in 3m16s
CI / quality (pull_request) Successful in 3m42s
CI / security (pull_request) Successful in 4m12s
CI / unit_tests (pull_request) Failing after 5m43s
CI / docker (pull_request) Has been skipped
CI / e2e_tests (pull_request) Failing after 14m14s
CI / coverage (pull_request) Successful in 12m34s
CI / integration_tests (pull_request) Successful in 24m14s
CI / status-check (pull_request) Failing after 1s
CI / benchmark-regression (pull_request) Successful in 55m6s
After merging master, several newly added E2E test files and docs
still referenced the old lifecycle-list and lifecycle-apply command
names. Update all references to use the canonical plan list and
plan apply command names.
2026-04-01 00:32:14 +00:00
freemo ecc003078d feat(config): implement three-scope config resolution with local config file support
Implement three-scope configuration resolution (local > project > global)
with deep merge. Add ConfigScope enum, project-root discovery, and
config.local.toml file support.

Changes:
- Add LOCAL to ConfigLevel enum and new ConfigScope enum (GLOBAL, PROJECT, LOCAL)
- Implement discover_project_root() walking up from CWD for cleveragents.toml/.cleveragents
- Implement config.local.toml file loading in ConfigService
- Implement three-scope deep merge via _deep_merge() helper
- Add read_project_config(), read_local_config(), read_merged_config() methods
- Add write_scoped_config() for writing to any scope file
- Update set_value() to accept optional scope parameter
- Update resolve() with six-level precedence chain (CLI > env > local > project > global > default)
- Update CLI config set with --scope flag (global/project/local)
- Add config.local.toml to .gitignore and DEFAULT_IGNORE_PATTERNS
- Add Behave BDD scenarios for three-scope resolution, deep merge, and project-root discovery

ISSUES CLOSED: #937
2026-04-01 00:32:14 +00:00
freemo 3e332351b3 feat(correction): wire checkpoint rollback into correction service revert flow
Implement the full correction-checkpoint rollback pipeline:

- Workspace snapshots: CheckpointService.create_workspace_snapshot()
  creates diff-based checkpoints before decision execution, storing
  only changed file paths in metadata.extra["diff_paths"]

- CorrectionService.revert_decisions(): new high-level entry point
  that creates a correction, computes impact, invokes checkpoint
  rollback, and archives artifacts in a single call

- Physical artifact archival: CheckpointService.archive_artifacts()
  moves files to .cleveragents/archived_artifacts/ instead of just
  flagging metadata. CorrectionService._archive_decision_artifacts()
  delegates to this during revert execution

- Selective rollback: CheckpointService.selective_rollback() wraps
  rollback_to_checkpoint with atomic semantics — captures HEAD before
  rollback and recovers on failure

- Diff-based storage: _compute_diff_snapshot() computes changed paths
  between checkpoints via git diff; snapshots store diff manifest and
  SHA-256 hash in metadata

- CLI: plan rollback now accepts --to-checkpoint <id> in addition to
  the positional checkpoint_id argument; uses selective_rollback for
  atomic execution

- DI wiring: Container now injects checkpoint_service into
  CorrectionService; CLI correct command uses container-provided
  service instead of ad-hoc instance (fixes bug #986)

- Checkpoint model: pre_decision added to allowed checkpoint_type
  values

- TDD: Removed @tdd_expected_fail from wiring test feature since the
  DI bug is now fixed

ISSUES CLOSED: #943
2026-04-01 00:32:14 +00:00
freemo 8f83ee6bd8 feat(cli): implement missing output element types and handles
Implement LiveMaterializationStrategy as the third materialization
strategy type (alongside sequential_buffer and accumulate) per spec
§26456-26492.  The live strategy renders element updates in-place at
~15 fps by tracking a dirty-element set and coalescing updates into
frame redraws.

RichMaterializer now extends LiveMaterializationStrategy instead of
_BaseBufferStrategy, enabling supports_incremental_updates=True.
Element rendering still delegates to the colour renderer for visual
formatting, maintaining backward compatibility.

Changes:
- Add _LiveMaterializationStrategy class with frame-rate throttling,
  dirty-element tracking, and per-frame composition in declaration
  order
- Update RichMaterializer to extend _LiveMaterializationStrategy
- Export LiveMaterializationStrategy from materializers.py and
  __init__.py
- Update SD-2 and SD-7 documentation in __init__.py
- Add vulture whitelist entry for LiveMaterializationStrategy
- Add 5 Behave scenarios covering live strategy rendering, incremental
  update support, dirty-element coalescing, all-element-type rendering,
  and frame rate validation
- Add step definitions for the new scenarios

ISSUES CLOSED: #903
2026-04-01 00:32:14 +00:00
freemo dd1ecf3a2a feat(cli): add actor context remove, export, and import commands
Implement three new actor context subcommands as specified in the v3
CLI specification:

- `agents actor context remove [--yes|-y] (--all|-a|<NAME>)`:
  Remove a named context or all contexts with interactive confirmation.
  Supports --all for bulk removal and --yes to skip prompts.

- `agents actor context export (--output|-o) <FILE> <NAME>`:
  Export a named context to JSON or YAML (detected from file extension).
  Includes sha256 integrity checksum in output metadata.

- `agents actor context import [--update] (--input|-i) <FILE> [<NAME>]`:
  Import a context from JSON or YAML. Name is inferred from file metadata
  if omitted. Refuses to overwrite existing contexts unless --update is
  specified.

All commands:
- Support 6 output formats (json, yaml, plain, table, rich, color) via
  the shared format_output framework
- Use ContextManager for persistence (messages, metadata, state,
  global_context)
- Follow existing error handling patterns (typer.Exit for user errors)
- Are wired as `agents actor context` subcommand group via add_typer

New files:
- src/cleveragents/cli/commands/actor_context.py (command module)
- features/actor_context_cmds.feature (Behave BDD scenarios)
- features/steps/actor_context_cmds_steps.py (BDD step definitions)
- robot/actor_context_export_import.robot (Robot integration test)

ISSUES CLOSED: #869
2026-04-01 00:32:14 +00:00
freemo 15abae3a10 fix(cli): derive actor name from config file instead of positional argument
Remove the <NAME> positional argument from `actor add` command. The actor
name is now derived from the `name` field inside the config YAML file, per
the specification: `agents actor add (--config|-c) <FILE> [--update]`.
Updated all BDD and integration tests to pass name via config file.

ISSUES CLOSED: #914
2026-04-01 00:32:14 +00:00
freemo 6c36ce52d5 refactor(cli): rename plan lifecycle-list and lifecycle-apply to match specification
Rename `plan lifecycle-list` to `plan list` and `plan lifecycle-apply` to
`plan apply` to align with the specification's canonical command names.
Legacy V2 plan commands removed to resolve naming conflicts. All BDD and
integration tests updated.

ISSUES CLOSED: #881
2026-04-01 00:32:14 +00:00