11import path from 'path'
22import React from 'react'
33
4+ import { pluralize } from '@codebuff/common/util/string'
5+
46import { formatValidationError } from './validation-error-formatting'
57import { openFileAtPath } from './open-file'
68import { TerminalLink } from '../components/terminal-link'
@@ -15,6 +17,7 @@ export interface CreateValidationErrorBlocksOptions {
1517 agents : Array < { id : string ; displayName : string ; filePath ?: string } >
1618 agentsDir : string
1719 } | null
20+ availableWidth ?: number
1821}
1922
2023/**
@@ -24,15 +27,15 @@ export interface CreateValidationErrorBlocksOptions {
2427export function createValidationErrorBlocks (
2528 options : CreateValidationErrorBlocksOptions ,
2629) : ContentBlock [ ] {
27- const { errors, loadedAgentsData } = options
30+ const { errors, loadedAgentsData, availableWidth = 80 } = options
2831 const errorCount = errors . length
2932 const blocks : ContentBlock [ ] = [ ]
3033
3134 blocks . push ( {
3235 type : 'html' ,
3336 render : ( ) => (
3437 < text style = { { fg : 'red' } } >
35- ⚠️ < b > { errorCount === 1 ? '1 agent has validation issues' : ` ${ errorCount } agents have validation issues` } </ b >
38+ ⚠️ < b > { pluralize ( errorCount , ' agent' ) } has validation issues</ b >
3639 </ text >
3740 ) ,
3841 } )
@@ -53,13 +56,12 @@ export function createValidationErrorBlocks(
5356 . replace ( / \\ / g, '/' )
5457 const filePath = agentInfo . filePath
5558
56- // Create block with clickable file path only
59+ // Simple layout: file path first, then agent ID and error
5760 blocks . push ( {
5861 type : 'html' ,
5962 render : ( { textColor } ) => (
6063 < box style = { { flexDirection : 'column' , width : '100%' } } >
6164 < box style = { { flexDirection : 'row' , gap : 0 , width : '100%' } } >
62- < text style = { { fg : textColor } } > { agentId } (</ text >
6365 < TerminalLink
6466 text = { relativePathFromRoot }
6567 containerStyle = { {
@@ -70,10 +72,15 @@ export function createValidationErrorBlocks(
7072 underlineOnHover
7173 onActivate = { ( ) => openFileAtPath ( filePath ) }
7274 />
73- < text style = { { fg : textColor } } > )</ text >
75+ < text style = { { fg : textColor } } wrap = { false } >
76+ { ' ' }
77+ • { agentId }
78+ </ text >
7479 </ box >
7580 < box style = { { paddingLeft : 2 , width : '100%' } } >
76- < text style = { { fg : textColor } } > { errorMsg } </ text >
81+ < text style = { { fg : textColor } } wrap >
82+ { errorMsg }
83+ </ text >
7784 </ box >
7885 </ box >
7986 ) ,
0 commit comments