You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: Implement schema-based rendering for structured output
Add intelligent output rendering guided by schema FormatHint:
Schema-Driven Rendering:
- Validate JSON output against schema before rendering
- Use FormatHint to select rendering strategy:
- Table: Render arrays of objects as formatted tables
- List: Render arrays as bulleted lists
- Json: Pretty-print JSON with syntax highlighting
- Yaml: Render as YAML format
- Auto: Auto-detect format (fallback to existing logic)
Rendering Functions:
- render_as_table(): Extract arrays from common patterns (containers,
resources, items) and render with colored headers
- render_as_list(): Render arrays as bulleted lists with cyan bullets
- render_as_yaml(): Convert JSON to YAML format
Validation:
- Schema validation warns (not errors) when output doesn't match
- Graceful fallback to auto-detection if schema parsing fails
- Backward compatible: works without schema (None)
Example Usage:
# Pre-built schema with Table hint
aofctl run agent docker.yaml --output-schema container-list
# Pre-built schema with Table hint
aofctl run agent stats.yaml --output-schema resource-stats
# Pre-built schema with List hint
aofctl run agent list.yaml --output-schema simple-list
The format hint ensures consistent rendering regardless of LLM
output variations, providing a stable CLI experience.
Related: #74
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
0 commit comments