fix(cli): replace one-liner with structured Rich panel in validation attach output

This commit is contained in:
2026-04-24 13:52:25 +00:00
committed by Forgejo
parent 71418081a4
commit 81019b0cf7
2 changed files with 13 additions and 2 deletions
+1 -1
View File
@@ -215,7 +215,7 @@ Feature: Tool and Validation CLI commands
Given a mocked validation exists for attaching Given a mocked validation exists for attaching
When I run validation CLI attach "resource/r1" "local/test-val" When I run validation CLI attach "resource/r1" "local/test-val"
Then the validation CLI attach should succeed 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 Scenario: Attach validation with project scope
Given a mocked validation exists for attaching Given a mocked validation exists for attaching
+12 -1
View File
@@ -361,13 +361,24 @@ def attach(
f"[bold]Resource:[/bold] {resource}" f"[bold]Resource:[/bold] {resource}"
) )
# Add scope if project is specified # Add scope field
if project: if project:
panel_content += f"\n[bold]Scope:[/bold] project {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 # Display the structured panel
console.print(Panel(panel_content, title="Validation Attached", expand=False)) 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 # Add success indicator
console.print("[green]✓ OK Validation attached[/green]") console.print("[green]✓ OK Validation attached[/green]")