diff --git a/features/tool_cli.feature b/features/tool_cli.feature index f02607e21..86ee674f3 100644 --- a/features/tool_cli.feature +++ b/features/tool_cli.feature @@ -215,7 +215,7 @@ Feature: Tool and Validation CLI commands Given a mocked validation exists for attaching When I run validation CLI attach "resource/r1" "local/test-val" Then the validation CLI attach should succeed - And the validation CLI output should contain "Attached validation" + And the validation CLI output should contain "Validation Attached" Scenario: Attach validation with project scope Given a mocked validation exists for attaching diff --git a/src/cleveragents/cli/commands/validation.py b/src/cleveragents/cli/commands/validation.py index eb2bb65c1..e27f426fc 100644 --- a/src/cleveragents/cli/commands/validation.py +++ b/src/cleveragents/cli/commands/validation.py @@ -351,11 +351,37 @@ def attach( return att_id = att_data.get("attachment_id", "") - console.print( - f"[green]Attached validation:[/green] {validation_name} -> " - f"{resource} (id: {att_id})" + mode = att_data.get("mode", "required") + + # Build the structured panel content + panel_content = ( + f"[bold]Attachment ID:[/bold] {att_id}\n" + f"[bold]Validation:[/bold] {validation_name}\n" + f"[bold]Mode:[/bold] {mode}\n" + f"[bold]Resource:[/bold] {resource}" ) + # Add scope field + if project: + panel_content += f"\n[bold]Scope:[/bold] project {project}" + elif plan_id: + panel_content += f"\n[bold]Scope:[/bold] plan {plan_id}" + else: + panel_content += "\n[bold]Scope:[/bold] direct (always active)" + + # Display the structured panel + console.print(Panel(panel_content, title="Validation Attached", expand=False)) + + # Add informational note for direct (unscoped) attachments + if not project and not plan_id: + console.print( + "[dim]This validation will run for ALL plans/projects" + " that access this resource.[/dim]" + ) + + # Add success indicator + console.print("[green]✓ OK Validation attached[/green]") + except NotFoundError as exc: console.print(f"[red]Validation not found:[/red] {validation_name}") raise typer.Abort() from exc