fix(cli): wire context_set to spec-aligned rendering helpers
CI / lint (pull_request) Successful in 46s
CI / typecheck (pull_request) Successful in 1m15s
CI / helm (pull_request) Successful in 30s
CI / build (pull_request) Successful in 34s
CI / push-validation (pull_request) Successful in 32s
CI / quality (pull_request) Successful in 1m53s
CI / security (pull_request) Successful in 1m58s
CI / integration_tests (pull_request) Successful in 9m42s
CI / unit_tests (pull_request) Failing after 16m48s
CI / coverage (pull_request) Has been cancelled
CI / docker (pull_request) Has been cancelled
CI / status-check (pull_request) Has been cancelled
CI / lint (pull_request) Successful in 46s
CI / typecheck (pull_request) Successful in 1m15s
CI / helm (pull_request) Successful in 30s
CI / build (pull_request) Successful in 34s
CI / push-validation (pull_request) Successful in 32s
CI / quality (pull_request) Successful in 1m53s
CI / security (pull_request) Successful in 1m58s
CI / integration_tests (pull_request) Successful in 9m42s
CI / unit_tests (pull_request) Failing after 16m48s
CI / coverage (pull_request) Has been cancelled
CI / docker (pull_request) Has been cancelled
CI / status-check (pull_request) Has been cancelled
The PR added build_context_set_payload / render_context_set_plain /
render_context_set_rich in cleveragents.cli.rendering.project_context_set
but context_set never called them: rich output rendered a single
"Context Policy Updated" panel and json/yaml/plain went through
format_output(data, output_format) with no envelope kwargs. The five
BDD scenarios validating the spec envelope therefore failed.
Replace the tail of context_set so rich emits the four spec panels
(Context Policy / Limits / Summarization / Other Views) plus the
"checkmark Context policy updated" line, plain calls
render_context_set_plain directly, and json/yaml flow through
format_output with command="project context set", status="ok",
exit_code=0, and messages=[{level: ok, text: "Context policy updated"}].
ISSUES CLOSED: #6319
This commit is contained in:
@@ -779,20 +779,45 @@ def context_set(
|
||||
},
|
||||
)
|
||||
|
||||
data = _policy_to_dict(policy)
|
||||
data["acms_config"] = acms
|
||||
if output_format.lower() == OutputFormat.RICH:
|
||||
console.print(
|
||||
Panel(
|
||||
f"[green]✓[/green] Context policy "
|
||||
f"'{view}' view updated for "
|
||||
f"project '{project}'.",
|
||||
title="Context Policy Updated",
|
||||
expand=False,
|
||||
)
|
||||
)
|
||||
from cleveragents.cli.rendering.project_context_set import (
|
||||
build_context_set_payload,
|
||||
render_context_set_plain,
|
||||
render_context_set_rich,
|
||||
)
|
||||
|
||||
payload = build_context_set_payload(
|
||||
project=project,
|
||||
view=view,
|
||||
policy=policy,
|
||||
acms=acms,
|
||||
default_limits={
|
||||
"hot_max_tokens": _DEFAULT_HOT_MAX_TOKENS,
|
||||
"warm_max_decisions": _DEFAULT_WARM_MAX_DECISIONS,
|
||||
"cold_max_decisions": _DEFAULT_COLD_MAX_DECISIONS,
|
||||
"query_limit": None,
|
||||
},
|
||||
)
|
||||
|
||||
success_message = "Context policy updated"
|
||||
fmt_lower = output_format.lower()
|
||||
|
||||
if fmt_lower == OutputFormat.RICH.value:
|
||||
for panel in render_context_set_rich(payload):
|
||||
console.print(panel)
|
||||
console.print(f"[green]\u2713[/green] {success_message}")
|
||||
elif fmt_lower == OutputFormat.PLAIN.value:
|
||||
console.print(render_context_set_plain(payload, success_message))
|
||||
else:
|
||||
console.print(format_output(data, output_format))
|
||||
rendered = format_output(
|
||||
payload,
|
||||
output_format,
|
||||
command="project context set",
|
||||
status="ok",
|
||||
exit_code=0,
|
||||
messages=[{"level": "ok", "text": success_message}],
|
||||
)
|
||||
if rendered:
|
||||
console.print(rendered)
|
||||
|
||||
|
||||
@app.command(name="show")
|
||||
|
||||
Reference in New Issue
Block a user