forked from cleveragents/cleveragents-core
ff42d59d6d
Wire all four project context CLI commands (inspect, simulate, set, show) to live ACMS pipeline services via ContextTierService and CRP models. - context inspect: queries ContextTierService for tier metrics and per-project fragments with filtering by strategy/focus/breadth/depth - context simulate: dry-run context assembly using CRP models with configurable token budget and assembly strategies - context set: 12 new ACMS pipeline options (hot_max_tokens, warm_max_decisions, cold_max_decisions, summary_max_tokens, temporal_scope, auto_refresh, focus_area, breadth, depth, assembly_strategy, retrieval_strategy, summary_strategy) - context show: displays ACMS pipeline configuration alongside policy - `context inspect` displayed global tier fragment counts (hot/warm/cold) across all projects instead of counts for the target project only. Add `ContextTierService.get_scoped_metrics(project_names)` which uses `ScopedBackendView` to filter fragment counts to the specified projects while keeping hit/miss counters as global service-level cache metrics. Update `context_inspect()` to call `get_scoped_metrics([project])` instead of `get_metrics()`. - `context simulate --focus` accepted focus URIs and passed them to the `ContextRequest` model but never used them to filter the fragment list, making the `--focus` flag a no-op. Add focus URI filtering in `_simulate_context_assembly()` after `get_scoped_view()` — filters `project_fragments` by matching each fragment's `resource_id` against the supplied focus URIs. Also fixes redaction false positives for hot_max_tokens and summary_max_tokens keys, and Rich Console line-wrapping in test output that caused JSON parse failures. Includes 28 new Behave BDD scenarios for wiring coverage, updated Robot Framework integration tests, and reference documentation. ISSUES CLOSED: #499
115 lines
5.8 KiB
Gherkin
115 lines
5.8 KiB
Gherkin
Feature: Project context CLI commands (B2.cli)
|
|
As a CleverAgents user
|
|
I want to manage project context policies via CLI commands
|
|
So that I can control what resources and files are visible per ACMS phase
|
|
|
|
Background:
|
|
Given a project context CLI in-memory database is initialized
|
|
And a project "local/ctx-app" exists for context CLI
|
|
|
|
# ── context set basic options ────────────────────────────────
|
|
|
|
Scenario: Set default view with include resources
|
|
When I run context set on "local/ctx-app" with view "default" and include-resource "db-*"
|
|
Then the context set command should succeed
|
|
And the stored policy default view should include resource "db-*"
|
|
|
|
Scenario: Set default view with exclude resources
|
|
When I run context set on "local/ctx-app" with view "default" and exclude-resource "db-test"
|
|
Then the context set command should succeed
|
|
And the stored policy default view should exclude resource "db-test"
|
|
|
|
Scenario: Set default view with include paths
|
|
When I run context set on "local/ctx-app" with view "default" and include-path "src/**/*.py"
|
|
Then the context set command should succeed
|
|
And the stored policy default view should include path "src/**/*.py"
|
|
|
|
Scenario: Set default view with exclude paths
|
|
When I run context set on "local/ctx-app" with view "default" and exclude-path "*.pyc"
|
|
Then the context set command should succeed
|
|
And the stored policy default view should exclude path "*.pyc"
|
|
|
|
Scenario: Set default view with max file size
|
|
When I run context set on "local/ctx-app" with view "default" and max-file-size 1048576
|
|
Then the context set command should succeed
|
|
And the stored policy default view max file size should be 1048576
|
|
|
|
Scenario: Set default view with max total size
|
|
When I run context set on "local/ctx-app" with view "default" and max-total-size 10485760
|
|
Then the context set command should succeed
|
|
And the stored policy default view max total size should be 10485760
|
|
|
|
Scenario: Set strategize view
|
|
When I run context set on "local/ctx-app" with view "strategize" and include-resource "cache-*"
|
|
Then the context set command should succeed
|
|
And the stored policy strategize view should include resource "cache-*"
|
|
|
|
Scenario: Set invalid view name fails
|
|
When I run context set on "local/ctx-app" with invalid view "bogus"
|
|
Then the context set command should fail
|
|
|
|
Scenario: Set view on nonexistent project fails
|
|
When I run context set on "local/no-such-project" with view "default" and include-resource "x"
|
|
Then the context set command should fail
|
|
|
|
# ── context set --clear ─────────────────────────────────────
|
|
|
|
Scenario: Clear a view resets it to inherit
|
|
Given I have set a strategize view on "local/ctx-app" with defaults
|
|
When I run context set on "local/ctx-app" with view "strategize" and clear flag
|
|
Then the context set command should succeed
|
|
And the stored policy strategize view should be None
|
|
|
|
# ── context show ─────────────────────────────────────────────
|
|
|
|
Scenario: Show displays the policy for a project
|
|
Given I have set a default view on "local/ctx-app" with include-resource "db-*"
|
|
When I run context show on "local/ctx-app" without options
|
|
Then the context show command should succeed
|
|
|
|
Scenario: Show with view displays resolved view
|
|
Given I have set a default view on "local/ctx-app" with include-resource "db-*"
|
|
When I run context show on "local/ctx-app" with view "default"
|
|
Then the context show command should succeed
|
|
|
|
Scenario: Show on nonexistent project fails
|
|
When I run context show on "local/nonexistent-proj" without options
|
|
Then the context show command should fail
|
|
|
|
# ── inspect now wired to ACMS tier service ─────────────────
|
|
|
|
Scenario: Inspect succeeds and shows tier state
|
|
When I run context inspect on "local/ctx-app"
|
|
Then the context inspect command should succeed
|
|
|
|
# ── simulate now wired to ACMS tier service ────────────────
|
|
|
|
Scenario: Simulate succeeds and shows assembly result
|
|
When I run context simulate on "local/ctx-app"
|
|
Then the context simulate command should succeed
|
|
|
|
# ── view inheritance ─────────────────────────────────────────
|
|
|
|
Scenario: Execute inherits from strategize when not overridden
|
|
Given I have set a strategize view on "local/ctx-app" with include-resource "strat-res"
|
|
When I run context show on "local/ctx-app" with view "execute"
|
|
Then the resolved view should include resource "strat-res"
|
|
|
|
Scenario: Apply inherits from execute when not overridden
|
|
Given I have set an execute view on "local/ctx-app" with include-resource "exec-res"
|
|
When I run context show on "local/ctx-app" with view "apply"
|
|
Then the resolved view should include resource "exec-res"
|
|
|
|
Scenario: Strategize inherits from default when not overridden
|
|
Given I have set a default view on "local/ctx-app" with include-resource "def-res"
|
|
When I run context show on "local/ctx-app" with view "strategize"
|
|
Then the resolved view should include resource "def-res"
|
|
|
|
# ── JSON format output ──────────────────────────────────────
|
|
|
|
Scenario: Show with JSON format returns valid JSON
|
|
Given I have set a default view on "local/ctx-app" with include-resource "db-*"
|
|
When I run context show on "local/ctx-app" with format "json"
|
|
Then the context show command should succeed
|
|
And the context output should be valid JSON
|