Skip to content

feat: Add test-view command for UI component testing - #111

Merged
edenreich merged 10 commits into
mainfrom
claude/issue-108-20250823-1519
Aug 24, 2025
Merged

edenreich merged 10 commits into
mainfrom
claude/issue-108-20250823-1519

Conversation

@edenreich

Copy link
Copy Markdown
Contributor

Addresses issue #108 by adding a new infer test-view command that allows direct testing and iteration of UI components in the terminal without requiring chat mode.

Features

  • Test approval view component with sample tool data
  • Test diff renderer with Edit and MultiEdit tool previews
  • Customizable component dimensions via CLI flags
  • Sample content configuration for testing different scenarios
  • Beautiful Tokyo Night theme styling with ANSI colors
  • Multiple test cases showing different component states

Usage

# Test approval view
infer test-view approval

# Test diff renderer
infer test-view diff

# Custom dimensions
infer test-view approval --width 120 --height 40

Generated with Claude Code

Add new infer test-view command that allows direct testing and iteration
of UI components in the terminal without requiring chat mode.

Features:
- Test approval view component with sample tool data
- Test diff renderer with Edit and MultiEdit tool previews  
- Customizable component dimensions via CLI flags
- Sample content configuration for testing different scenarios
- Beautiful Tokyo Night theme styling with ANSI colors
- Multiple test cases showing different component states

This addresses the need for rapid UI development iteration mentioned
in issue #108, allowing pixel-by-pixel styling adjustments.

Co-authored-by: Eden Reich <[email protected]>
@edenreich

Copy link
Copy Markdown
Contributor Author

@claude CI is failing.

@claude

claude Bot commented Aug 23, 2025 •

Copy link
Copy Markdown
Contributor

Claude finished @edenreich's task —— View job


CI Failure Fixed! ✅

  • Check CI status and get failure details
  • Download and analyze job logs
  • Read changed files to understand the implementation
  • Identify and fix the issues causing CI failure
  • Run quality checks (task check)
  • Commit fixes to branch

Issues Resolved:

  • ✅ Fixed line length exceeding 120 characters (line 352)
  • ✅ Added missing blank lines around headings
  • ✅ Added missing blank lines around lists
  • ✅ Removed duplicate code block closing tags
  • ✅ All markdownlint rules now pass (0 issues)

Implementation Analysis: The infer test-view command adds excellent testing capabilities for UI components with proper styling and sample data. The code structure follows project patterns well with appropriate mock implementations for testing.

Commit: 06cd7fb - Fixed all markdownlint issues

The CI should now pass! 🎉

claude Bot and others added 9 commits August 23, 2025 15:48
- Fix line length exceeding 120 characters
- Add missing blank lines around headings and lists
- Remove duplicate code block closing tags
- Ensure all markdownlint rules pass

Co-authored-by: Eden Reich <[email protected]>
- Implemented a new diff rendering system for tools, allowing for better visualization of changes made during edit operations.
- Added a `DiffFormatter` interface and `DiffInfo` struct to standardize diff information across tools.
- Updated `EditTool`, `MultiEditTool`, and `WriteTool` to utilize the new diff rendering system, displaying diffs in a git-style format.
- Improved the `ApprovalComponent` to handle scrolling and content wrapping more effectively, ensuring a better user experience.
- Refactored existing diff generation logic into a dedicated `GitDiffComponent`, providing clearer separation of concerns.
- Enhanced color formatting for added, removed, and unchanged lines in diffs for better readability.
- Updated keybindings to ensure scrolling actions are available in the approval view.

Signed-off-by: Eden Reich <[email protected]>
- Updated expected fields in TestWriteTool_Definition to include new parameters.
- Improved error messages for missing required parameters in TestWriteTool_Validate.
- Removed unnecessary validation tests for parameters that are no longer required.
- Simplified error handling in TestWriteTool_Execute and TestWriteTool_ValidateDisabled.
- Added validatePathResult helper function to streamline path security checks.

Enhance approval view component styling

- Changed selected option foreground color to black for better visibility.
- Reverted unselected option background color to use shared success color.
- Cleaned up rendering logic in renderFooter and assembleContent methods for improved readability.

Remove diff_formatter and git_diff components

- Deleted diff_formatter.go and git_diff.go as they were redundant.
- Consolidated diff rendering logic into diff_renderer.go for better maintainability.

Improve diff rendering with enhanced color support

- Updated DiffRenderer to use lipgloss for colored output.
- Added new styles for additions, deletions, headers, and context lines.
- Refactored RenderEditToolArguments and RenderMultiEditToolArguments to utilize new styles.
- Enhanced RenderDiff method to handle new file and deleted file scenarios with appropriate chunk headers.

Update shared colors for diff overlays

- Introduced new vibrant background colors for added and removed lines in diffs.
- Adjusted CreateDiffAddedLine and CreateDiffRemovedLine functions to utilize new background colors.

Signed-off-by: Eden Reich <[email protected]>
…ation

- Updated FormatForUI method to display a summary of edits when applicable, including file name and number of edits.
- Improved FormatForLLM method to handle git diff rendering more effectively.
- Refactored GetDiffInfo to streamline the process of simulating edits and generating diff information.
- Added comprehensive unit tests for FormatForUI to cover various scenarios including successful edits, failed edits, and empty edits.
- Enhanced DiffRenderer to improve styling and rendering of diffs, including new methods for rendering new and deleted file content.
- Introduced new tests for DiffRenderer to validate rendering of different diff scenarios.
- Created snapshot tests for UI components to ensure consistent output across various terminal sizes and conditions.

Signed-off-by: Eden Reich <[email protected]>
- Moved color definitions from shared package to a new colors package for better organization and maintainability.
- Updated all UI components to use the new colors package for color definitions.
- Introduced a new icons package to manage status icons and their styles.
- Created a styles package to encapsulate common styles used across UI components.
- Removed the old shared colors.go file to eliminate redundancy and improve clarity.
- Ensured all components are updated to reflect the new structure, maintaining consistent theming throughout the application.

Signed-off-by: Eden Reich <[email protected]>
…add tests for ShouldCollapseArg

Signed-off-by: Eden Reich <[email protected]>
@edenreich
edenreich merged commit c5c3913 into main Aug 24, 2025
@edenreich
edenreich deleted the claude/issue-108-20250823-1519 branch August 24, 2025 02:21
inference-gateway-releaser Bot pushed a commit that referenced this pull request Aug 24, 2025
## [0.38.0](v0.37.0...v0.38.0) (2025-08-24)

### 🚀 Features

* Add test-view command for UI component testing ([#111](#111)) ([c5c3913](c5c3913)), closes [#108](#108)
@inference-gateway-releaser

Copy link
Copy Markdown
Contributor

🎉 This PR is included in version 0.38.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

released Shipped in a release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant