feat(cli): implement context show and context clear CLI commands for ACMS - Closes #9586 #9675

Merged
HAL9000 merged 10 commits from feat/v3.4.0-context-show-clear-cli into master 2026-06-03 15:42:01 +00:00

10 Commits

Author SHA1 Message Date
HAL9000 40e589eb55 test(e2e): add edge case scenarios for ACMS context CLI commands
CI / lint (pull_request) Successful in 39s
CI / push-validation (pull_request) Successful in 39s
CI / quality (pull_request) Successful in 55s
CI / helm (pull_request) Successful in 41s
CI / build (pull_request) Successful in 48s
CI / typecheck (pull_request) Successful in 1m13s
CI / security (pull_request) Successful in 1m18s
CI / unit_tests (pull_request) Successful in 4m43s
CI / docker (pull_request) Successful in 1m49s
CI / integration_tests (pull_request) Successful in 10m12s
CI / coverage (pull_request) Successful in 11m2s
CI / status-check (pull_request) Successful in 3s
Covers uncovered paths in acms_context.py:
- Empty view name rejection (context show error path)
- Clear without filters warning and auto-confirmation path

This improves code coverage by exercising the following functions:
- acms_context_show empty view validation branch (line 91-93)
- acms_context_clear no-filters warning with confirmation bypass (line 215-219)

Closes #9586
2026-06-03 11:24:21 -04:00
HAL9000 c9cf18d300 chore(contributors): add ACMS context CLI contribution entry 2026-06-03 11:24:21 -04:00
HAL9000 1ff0a904db chore(changelog): add ACMS context CLI entry for issue #9586 2026-06-03 11:24:21 -04:00
HAL9000 fc9afae9c0 fix(acms-context): correct CLI path, fix budget labels, simplify lock handling
- Fix acms CLI command hierarchy: nested acms_context.app under main.py
  'acms' Typer as 'context' sub-command to form canonical path
   (was incorrectly at ).
- Warm/cold tier budget labels now say 'decisions' instead of fragments
  for clarity (warm/cold use decision budgets, not token budgets).
- Simplify _remove_fragments: ContextTierService is already thread-safe
  with RLock; manual lock detection/holding was unnecessary and fragile.
- Update CHANGELOG to clarify warm/cold tiers use decision budget limits.
2026-06-03 11:24:21 -04:00
CleverAgents Bot a32ea46297 fix(ci): resolve ruff lint issues in ACMS context benchmark
- Move contextlib import to top of file (E402 fix)
- Use contextlib.suppress(SystemExit) instead of try/except/pass blocks
2026-06-03 11:24:21 -04:00
HAL9000 15c4138aa3 fix(cli): add per-tier budget utilization breakdown to context show
Extends the budget utilization summary in `context show` to display
hot/warm/cold tier utilization percentages individually, satisfying
the spec requirement for a per-tier breakdown. Previously only hot
tier utilization was shown.

- Hot tier: tokens used vs. max_tokens_hot budget
- Warm tier: fragment count vs. max_decisions_warm budget
- Cold tier: fragment count vs. max_decisions_cold budget

Also updates Robot Framework helper to verify per-tier breakdown
is present in output, and updates CHANGELOG/CONTRIBUTORS.

ISSUES CLOSED: #9586
2026-06-03 11:24:21 -04:00
HAL9000 662e269485 fix(cli): resolve CI failures and reviewer feedback for ACMS context CLI commands
- Fix integration test failure: Context Show Validates Empty View Name
  - typer.Exit is click.Exit (RuntimeError subclass), not SystemExit
  - Robot helper now catches typer.Exit using exit_code attribute
  - Helper path insertion now always places clone src at sys.path[0]
    to prevent /app/src from shadowing the PR branch source
- Fix information disclosure: CleverAgentsError handler now logs
  exception internally via _logger.exception() and shows generic
  user-facing message instead of str(e)
- Fix budget utilization: use actual per-tier token counts instead
  of hot_count * 100 (fragment count * arbitrary factor)
- Fix type safety: _remove_fragments now uses _TierServiceProtocol
  instead of object, enabling proper static type checking
- Fix overly broad except: cancellation handled with early return
  instead of catching typer.Exit(0) in the except block
- Add broad glob pattern warning when --path matches > 50 entries
- Remove duplicate HAL 9000 entry from CONTRIBUTORS.md
- Fix Behave steps to catch typer.Exit in addition to SystemExit

ISSUES CLOSED: #9586
2026-06-03 11:24:21 -04:00
HAL9000 ea25627051 feat(cli): wire up ACMS context sub-app to main CLI entry point
The ACMS context CLI commands ('context show' / 'context clear') were fully
implemented in 'acms_context.py' with comprehensive tests, mocks, benchmarks,
and documentation — but the module was never imported or registered in
'cli/main.py'. This commit wires up the 'acms_context.app' Typer sub-app
so that 'agents acms context show' and 'agents acms context clear' are
actually accessible from the CLI.

Changes:
- Import acms_context in _register_subcommands()
- Register acms_context.app as the 'acms' sub-app on the main Typer app
- Add 'acms' to valid_cmds list in main() for fast-path validation
- Add 'acms context' entry to _print_basic_help() output
- Minor formatting cleanup applied by ruff

ISSUES CLOSED: #9586
Refs: #9675
2026-06-03 11:24:21 -04:00
HAL9000 c65a0726a8 feat(cli): implement context show and context clear CLI commands for ACMS - Closes #9586
- Rewrote production CLI to use real ContextTierService (get_scoped_view, get_all_fragments, evict_lru) instead of non-existent ACMSService
- Removed unused imports (Path, Panel, ScopedView) from production code
- Fixed all lint issues: trailing whitespace, import ordering, nested with statements
- Replaced typer.Abort() with typer.Exit(code=1) for error exits
- Added input validation for empty/whitespace view parameter
- Fixed error handling to use str(e) instead of e.message
- Added guards against negative budget values in _format_budget_utilization
- Added warning when clearing context with no filters (clear ALL)
- Removed module-level console side effect
- Moved mocks to features/mocks/acms_context_mocks.py per CONTRIBUTING.md
- Fixed test assertions to capture real CLI output (not placeholder)
- Fixed duplicate step definitions (AmbiguousStep errors)
- Fixed feature file step mismatch for tier count parameter
- Added Robot Framework integration tests in robot/acms_context_cli.robot
- Added performance benchmarks in benchmarks/acms_context_cli_bench.py
- Updated CHANGELOG.md with ACMS context CLI feature entry
- Updated CONTRIBUTORS.md with ACMS context CLI contribution

ISSUES CLOSED: #9586
2026-06-03 11:24:21 -04:00
HAL9000 acb484cf49 feat(cli): implement context show and context clear CLI commands for ACMS
ISSUES CLOSED: #9586
2026-06-03 11:24:21 -04:00