Commit graph

42 commits

Author SHA1 Message Date
Shunsuke Hayashi
25d358f96e feat: Add config system, agent mode, and session management
- Add comprehensive Config system with TOML support (~/.miyabi/config.toml)
- Add Agent module for autonomous task execution with tool approval
- Add Session management for conversation persistence
- Extend CLI with new commands: init, sessions, agent, version
- Add CLI flags: --model, --max-tokens, --thinking, --config, --session
- Fix all clippy warnings (16 → 0)
- Improve code quality with collapsible pattern matching

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-22 22:22:11 +09:00
Shunsuke Hayashi
af281f1ed0 feat: Integrate MainView into App for complete TUI support
- Update App to use MainView for rendering and key handling
- Enable all integrated components: ChatComposer, CommandPopup, HelpViewer, etc.
- Add keyboard shortcuts: Ctrl+P (commands), F1 (help), Ctrl+B (sidebar)
- Support streaming mode with proper UI updates
- Add execute_command for command handling

Closes #30

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-22 19:28:37 +09:00
Shunsuke Hayashi
e0207e8649 feat: Add comprehensive test coverage and fix tests
Sprint 9-10 changes:
- Add 42 tests for help.rs (HelpViewer, CheatSheet, QuickRef)
- Add 55 tests for resume_picker.rs (SessionEntry, ResumePicker, SessionManager)
- Add 73 tests for ui.rs (colors, styles, layout, Modal, Toast, Breadcrumb, etc.)
- Fix markdown_stream tests (proper markdown paragraph separation)
- Add help.rs and ui.rs modules to miyabi-tui

Total: 585 tests passing across all crates

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-22 19:24:05 +09:00
Shunsuke Hayashi
2f6b8ed089 test: Add comprehensive tests for overlay components
Sprint 8 - Test coverage for UI overlays:

Issue #33 - approval_overlay.rs (38 tests):
- RiskLevel (color, label, icon)
- ApprovalRequest (builder pattern)
- ApprovalOverlay (show/hide, key handling, queue)
- ApprovalBuilder (shell_command, file_write, file_edit)
- BatchApproval (approve/reject, mixed approvals)

Issue #34 - command_popup.rs (34 tests):
- Command (creation, builder methods)
- CommandPopup (show/hide, navigation, filtering)
- fuzzy_match algorithm
- CommandCategory and CommandBuilder

Issue #35 - pager_overlay.rs (39 tests):
- PagerContent (Plain, Markdown, Code, Styled)
- PagerOverlay (scrolling, search, key handling)
- PagerBuilder (help, log, code)

Total tests: 331 (111 new tests added)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-22 19:06:48 +09:00
Shunsuke Hayashi
81027daa4a fix(views): Fix compilation errors and add notification tests
Sprint 7 changes:
- Fixed 25 compilation errors in views.rs:
  - Fixed API mismatches for Spinner, Breadcrumb, StatusBar, StatusItem
  - Fixed PagerOverlay content method usage
  - Fixed render method signatures for overlays
  - Fixed ApprovalAction and ResumePickerAction enum variants
  - Fixed ChatComposer method names (get_input vs get_content)
  - Fixed Layout split return type compatibility
- Added 60 tests for notification.rs covering:
  - NotificationPriority (3 tests)
  - Notification (8 tests)
  - NotificationAction (3 tests)
  - NotificationPanel (15 tests)
  - Banner (5 tests)
  - AlertType, AlertButton (4 tests)
  - Alert (12 tests)
  - NotificationCenter (11 tests)

Total tests: 220

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-22 18:58:31 +09:00
Shunsuke Hayashi
2f91bfa8ce test(shimmer): Add comprehensive test suite
Add 34 tests covering shimmer animation components:
- ShimmerState: creation, duration, looping, progress, reset
- SkeletonLoader: creation, widths, effect, colors
- Spinner: creation, style, label, color, frames
- ProgressBar: creation, clamp, label, show_percent, chars
- TypingIndicator: creation, label
- Countdown: creation, label, remaining
- LoadingState: is_loading, is_complete, is_error
- LoadingOverlay: creation, show, show_progress, hide, complete, error
- blend_colors: RGB blending, non-RGB fallback

Note: Tests cannot be run due to pre-existing compilation errors
in views.rs which has API mismatches with other modules.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-22 18:49:46 +09:00
Shunsuke Hayashi
f1dd7d4164 test(textarea): Add comprehensive test suite and fix bug
Add 29 tests covering TextArea functionality:
- Basic operations: creation, text manipulation, char insertion
- Cursor movement (left/right/up/down, home/end, word navigation)
- Selection and clipboard (copy/cut/paste)
- Undo/redo operations
- Line deletion (word backward, to line start/end)
- Configuration (placeholder, tab width, viewport)
- Unicode support and multiline editing

Fix overflow bug in delete_to_line_start where undo position
was calculated after text modification.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-22 18:47:52 +09:00
Shunsuke Hayashi
2da467f877 test(chat_composer): Add comprehensive test suite
Add 23 tests covering ChatComposer functionality:
- Basic operations: creation, char insertion, backspace, delete
- Submit and cancel actions
- Multiline input with Shift+Enter
- Cursor movement (left/right, home/end)
- Command history navigation (up/down arrows)
- Command mode (/ prefix)
- Ctrl key shortcuts (u=clear, k=kill, w=delete word)
- Unicode character support
- Placeholder and max_history configuration
- Focus state management

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-22 18:44:15 +09:00
Shunsuke Hayashi
b3898dc45e feat(diff_viewer): Add scrollable diff view with navigation
Integrate ScrollState for viewport-based diff navigation.
- Add scroll_up, scroll_down, page_up, page_down methods
- Add scroll_to_top, scroll_to_bottom, scroll_to_line methods
- Add visible_lines() for viewport-based rendering
- Add scroll_offset, scroll_percentage, is_at_top, is_at_bottom getters
- Set viewport_height to control scroll behavior
- Update scroll state total_lines on parse
- Add 9 tests for scroll functionality

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-22 18:42:44 +09:00
Shunsuke Hayashi
384867632c feat(diff_viewer): Add syntax highlighting for diff content
Integrate SyntaxHighlighter to provide code-aware coloring in diff views.
- Add enable_syntax_highlighting option to DiffViewerOptions
- Extract file extension from diff file paths for language detection
- Apply syntax highlighting to addition/deletion/context lines
- Preserve diff background colors while using syntax colors for text
- Add 7 new tests for syntax highlighting functionality

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-22 18:39:27 +09:00
Shunsuke Hayashi
62d312796a feat(core): add tool result formatting methods
- Add ToolOutput formatting methods:
  - format_display(): Format output for display
  - summary(max_len): Truncated summary with ...
  - as_text(): Extract text from common fields
  - format_duration(): Human-readable duration (ms/s)
  - status_indicator(): ✓/✗ indicator
  - has_error_code(): Check for non-zero exit code

- Handle different content types (string, object, array)
- Pretty print JSON objects and arrays
- Add 10 comprehensive tests for formatting

Closes #28

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-22 18:31:42 +09:00
Shunsuke Hayashi
84f57e1431 feat(core): add configurable RetryConfig for API requests
- Add RetryConfig struct with configurable:
  - max_retries, base_delay_ms, max_delay_ms
  - retry_on_network_error, retry_on_rate_limit
  - Builder pattern methods

- Add delay_for_attempt() for exponential backoff
- Export RetryConfig from lib.rs
- Add 7 tests for retry configuration
  - Default values, builder, no retries
  - Delay calculation with exponential backoff
  - Delay capping at max
  - Error types validation
  - Tool definition serialization

Closes #23

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-22 18:29:54 +09:00
Shunsuke Hayashi
4755023c43 feat(tui): add cursor and scroll position tracking
- Add CursorPosition struct for tracking line/column
- Add ScrollState struct with viewport management:
  - scroll_up/down, page_up/down
  - scroll_to_top/bottom
  - Auto-scroll on new content
  - Scroll percentage calculation
  - Viewport height configuration

- Update MarkdownStream to use new scroll system
- Track cursor position on content push
- Update render() to update total_lines
- Export ScrollState and CursorPosition from lib.rs
- Add 6 tests for scroll and cursor functionality

Closes #13

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-22 18:27:48 +09:00
Shunsuke Hayashi
c82ad45b36 feat(core): implement Glob and Grep search tools
- Add GlobTool for finding files matching glob patterns
  - Supports ** recursive patterns
  - Configurable max results (default 1000)
  - Base directory support

- Add GrepTool for searching file contents with regex
  - Regex pattern matching
  - Case insensitive option
  - File glob filtering
  - Directory recursive search
  - Max matches limit (default 100)

- Add glob and regex dependencies to workspace
- Export GlobTool and GrepTool from lib.rs
- Update create_file_tool_registry (5 tools)
- Update create_standard_tool_registry (6 tools)
- Add 7 tests for Glob and Grep tools

Closes #27

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-22 18:25:00 +09:00
Shunsuke Hayashi
d6ac8c8273 feat(core): add comprehensive tool definition tests
- Export anthropic::Tool as ApiTool for API tool definitions
- Add 6 comprehensive tests for tool schema validation:
  - test_tool_schema_format: JSON Schema format validation
  - test_tool_schema_required_params: required/optional param handling
  - test_to_anthropic_tools: Anthropic API format conversion
  - test_registry_schemas: ToolRegistry::schemas() method
  - test_standard_registry_has_all_tools: all 4 tools registered
  - test_tool_default_values_in_schema: default value handling

Closes #22

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-22 18:20:39 +09:00
Shunsuke Hayashi
554b2f7f99 feat(core): implement Bash tool with sandboxing
- Add BashTool struct with timeout, working directory, and output truncation
- Implement dangerous command checking (rm -rf /, format, mkfs, etc.)
- Add tokio::select! for timeout handling
- Add create_standard_tool_registry() including BashTool
- Export BashTool and create_standard_tool_registry from lib.rs
- Add 5 tests for bash functionality

Closes #26

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-22 18:17:45 +09:00
Shunsuke Hayashi
277d0e4858 feat(core): implement token counting and context window management
Add token.rs with:
- TokenCounter for estimating token usage
- ModelLimits for Claude model configurations
- ContextManager for automatic context pruning
- TokenUsage and ContextUsage statistics
- Support for 200k context window
- Automatic oldest message pruning
- 10 unit tests

Closes #21

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-22 18:13:44 +09:00
Shunsuke Hayashi
04f7bc897e feat(tui): implement syntax highlighting for code blocks
Add syntax.rs with syntect integration:
- SyntaxHighlighter with configurable themes
- Support for Rust, Python, JavaScript, TypeScript, etc.
- Language alias normalization (js→JavaScript, py→Python)
- highlight_code() and render_code_block() helpers
- Global syntax/theme sets with lazy loading
- Fallback for unknown languages
- 10 unit tests

Dependencies added: syntect, once_cell

Closes #12

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-22 18:10:39 +09:00
Shunsuke Hayashi
29d1335c7e feat(core): implement file operation tools (Read, Write, Edit)
Add tools.rs with:
- ReadTool - Read files with offset/limit, line numbers
- WriteTool - Write files with auto directory creation
- EditTool - Replace text with replace_all option
- Security checks for path traversal
- Base directory configuration
- create_file_tool_registry() helper
- 10 unit tests with tempfile

Closes #25

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-22 18:07:51 +09:00
Shunsuke Hayashi
5aae11a0cb feat(core): implement conversation state and message history
Add conversation.rs with:
- Conversation struct with full state management
- ConversationMessage with timestamps and metadata
- ConversationMetadata (title, tags, model, tokens)
- ConversationManager for handling multiple conversations
- System prompt support
- Serialization/deserialization for persistence
- Truncate and clear functionality
- File save/load operations
- 14 unit tests

Closes #20

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-22 18:05:28 +09:00
Shunsuke Hayashi
9f869f93fa feat(tui): implement diff visualization with colors and indicators
Add diff_viewer.rs with enhanced diff display:
- DiffColors with GitHub-inspired color scheme (#2ea043, #f85149)
- DiffViewer widget with configurable options
- Line number columns (old/new)
- Gutter indicators (+/-)
- File headers with path display
- Multiple color schemes (default, minimal, high-contrast)
- Helper functions render_diff() and render_diff_minimal()
- 11 unit tests

Closes #16

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-22 18:03:27 +09:00
Shunsuke Hayashi
e24069ca79 feat(tui): implement incremental markdown parser with pulldown-cmark
Add markdown_parser.rs with:
- MarkdownParser with caching for efficient re-rendering
- pulldown-cmark integration with full options
- EventRenderer for converting markdown to styled Ratatui lines
- Support for headings, code blocks, lists, emphasis, links
- Blockquotes, horizontal rules, task lists
- Graceful handling of incomplete/malformed markdown
- 14 unit tests covering all features

Dependencies added: pulldown-cmark

Closes #11

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-22 18:01:43 +09:00
Shunsuke Hayashi
4440302e3b feat(core): implement Tool trait and registry system
Add tool.rs with complete tool abstraction:
- Tool trait with async_trait for tool definitions
- ToolRegistry for managing and executing tools
- ParameterDef for declarative parameter schemas
- Automatic JSON schema generation
- Input validation before execution
- Integration with Anthropic tool format
- ToolOutput for structured results
- Comprehensive error types (NotFound, ValidationError, etc.)
- 12 unit tests covering registration, lookup, execution

Dependencies added: async-trait

Closes #24

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-22 17:58:31 +09:00
Shunsuke Hayashi
8d7a7a6099 feat(core): implement Anthropic API client with streaming
Add anthropic.rs with complete Claude API integration:
- AnthropicClient with builder pattern configuration
- Message types (Role, ContentBlock, Tool, etc.)
- Non-streaming message() method with retry logic
- Streaming message_stream() with SSE parsing
- Comprehensive error types (AuthError, RateLimited, ApiError)
- Exponential backoff for transient errors
- 8 unit tests for client and parsing

Dependencies added: reqwest (with stream), futures

Closes #19

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-22 17:56:33 +09:00
Shunsuke Hayashi
bed65b23b2 feat(tui): implement DiffRender for git diff parsing
Add diff_render.rs with complete unified diff parsing support:
- DiffLineType enum (Context, Addition, Deletion, HunkHeader, FileHeader)
- DiffLine, DiffHunk, FileDiff structs for structured representation
- DiffRender with parse() and render() methods
- Line number tracking for both old/new files
- Styled Ratatui Line output with syntax highlighting
- 5 comprehensive unit tests

Closes #15

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-22 17:53:44 +09:00
Shunsuke Hayashi
e096f5eea8 feat: Implement MarkdownStream core structure (#10)
- Add StreamState enum (Idle, Streaming, Complete)
- Add StreamBuffer for content accumulation
- Add MarkdownStream with state management
- Implement push_str() for streaming chunks
- Implement render() returning Ratatui Lines
- Add basic markdown styling (headers, code, lists)
- Add cursor indicator during streaming
- Add comprehensive unit tests (5 tests)

Closes #10

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-22 17:50:30 +09:00
Shunsuke Hayashi
00d5d4d4e9 chore: Initialize Miyabi project with full planning
- Add .claude/ configuration (agents, commands, prompts, templates)
- Add comprehensive documentation:
  - WBS.md - Work Breakdown Structure
  - SPRINT_PLANNING.md - 4-sprint detailed plan
  - OPERATION_PLAN.md - Execution procedures
  - PRODUCT_SPEC.md - Product requirements
  - PREPARATION_OPS.md - Pre-sprint checklist
- Add PlantUML diagrams (wbs-diagram, gantt-chart)
- Configure Miyabi (.miyabi.yml)
- Set up Rust workspace structure

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-22 17:45:08 +09:00
Shunsuke Hayashi
0eb74b7af1 chore: Add workflow weekly-report.yml 2025-11-22 17:07:21 +09:00
Shunsuke Hayashi
30f97a118b chore: Add workflow weekly-kpi-report.yml 2025-11-22 17:07:20 +09:00
Shunsuke Hayashi
4d3c1c4a9d chore: Add workflow webhook-handler.yml 2025-11-22 17:07:19 +09:00
Shunsuke Hayashi
0e3a7a2760 chore: Add workflow webhook-event-router.yml 2025-11-22 17:07:18 +09:00
Shunsuke Hayashi
b3832f3a64 chore: Add workflow update-project-status.yml 2025-11-22 17:07:17 +09:00
Shunsuke Hayashi
dbab13fe6c chore: Add workflow state-machine.yml 2025-11-22 17:07:17 +09:00
Shunsuke Hayashi
91b85e095b chore: Add workflow project-sync.yml 2025-11-22 17:07:16 +09:00
Shunsuke Hayashi
8d69c037d2 chore: Add workflow pr-opened.yml 2025-11-22 17:07:15 +09:00
Shunsuke Hayashi
3bd00f35f7 chore: Add workflow label-sync.yml 2025-11-22 17:07:14 +09:00
Shunsuke Hayashi
40d8824f1e chore: Add workflow issue-opened.yml 2025-11-22 17:07:13 +09:00
Shunsuke Hayashi
31fe696e5a chore: Add workflow economic-circuit-breaker.yml 2025-11-22 17:07:12 +09:00
Shunsuke Hayashi
f6312eb3c4 chore: Add workflow deploy-pages.yml 2025-11-22 17:07:11 +09:00
Shunsuke Hayashi
4b9ff6875a chore: Add workflow autonomous-agent.yml 2025-11-22 17:07:11 +09:00
Shunsuke Hayashi
582ca39084 chore: Add workflow auto-add-to-project.yml 2025-11-22 17:07:10 +09:00
Shunsuke Hayashi
23e56596c6
Initial commit 2025-11-22 17:06:52 +09:00