generated from nhcarrigan/template
f173892aaa
## Summary This PR includes major feature additions, bug fixes, comprehensive testing improvements, and responsive design enhancements! ## New Features โจ ### Plugin & MCP Management (#133, #134) - **Plugin Management Panel**: Install, uninstall, enable/disable, and update plugins - **MCP Server Management Panel**: Add/remove MCP servers, view detailed configuration - **Marketplace Management**: Add/remove plugin marketplaces from GitHub - Backend commands for full CLI integration (`list_plugins`, `install_plugin`, `add_mcp_server`, etc.) - Beautiful UI with proper loading states, error handling, and theme support ### Visual Todo List Panel (#132) - Real-time todo list display when Hikari uses the `TodoWrite` tool - Shows pending/in-progress/completed status with visual indicators - Progress bar and completion count - Automatically clears on disconnect - Theme-aware styling ### Clear Session History Button (#130) - "Clear All Sessions" button in Session History panel - Confirmation dialog with session count - Keyboard support and accessibility features - Gives users control over disk usage ### CLI Version Display (#131) - Displays Claude CLI version in status bar - Auto-polls every 30 seconds for updates - Useful for debugging and feature compatibility ## Bug Fixes ๐ ### Stats Panel Scrolling (#136) - **Fixed stats panel overflow**: Added scrollable container with `max-height` constraint - Stats panel now scrolls when content (Tools Used, Historical Costs, Budget sections) gets too long - Prevents content from overflowing off screen ### Agent Monitor Fixes (#122) - **Fixed agents stuck in "running" state**: Added `SubagentStop` hook parsing - **Fixed agents persisting after disconnect**: Call `clearConversation()` on disconnect - **Fixed "Kill All" button**: Now properly marks all agents as errored - **Fixed badge persisting after tab close**: Cleanup agents when conversation is deleted - Comprehensive tests for agent lifecycle management ### Discord RPC Cleanup (#129) - Removed file-based logging for Discord RPC - Replaced with proper `tracing` framework usage - Reduces disk usage and eliminates maintenance burden ### Close Modal Bug Fix (#128) - Fixed close confirmation modal not triggering after Discord RPC refactor - Removed frontend calls to deleted `log_discord_rpc` command - Modal now works correctly after all operations ### Responsive Design Fixes (#118) - Fixed top navigation icons getting cut off at small screen widths - Fixed Connect button disappearing on narrow screens - Fixed bottom status info (clock, CLI version) getting cut off - Added flex-wrap and mobile-optimised layouts - Icons-only mode on screens < 640px - Vertical stacking on screens < 768px ## Testing Improvements ๐งช ### Comprehensive Test Coverage (#114) - **417 backend tests** (up from 408) - **387 frontend tests** (up from 363) - **61%+ backend code coverage** - Added E2E integration tests for cross-platform notification commands - New test files: `agents.test.ts`, comprehensive CLI parsing tests - Tests for `debug_logger.rs`, `bridge_manager.rs`, `notifications.rs` - Console mocking for cleaner test output - Fixed flaky frontend tests ### Testing Documentation - Updated CLAUDE.md with comprehensive testing guidelines - Documented mocking approaches (console mocking, E2E command structure testing) - Added step-by-step guide for adding tests to new features - Goal to maintain ~100% test coverage documented ## Closes Closes #114 Closes #118 Closes #122 Closes #128 Closes #129 Closes #130 Closes #131 Closes #132 Closes #133 Closes #134 Closes #136 ## Technical Details - All new backend commands properly registered in `lib.rs` - CLI output parsing with comprehensive test coverage - Cross-platform compatibility verified through E2E tests (Linux CI can test Windows commands) - Theme-aware UI components using CSS variables throughout - Proper TypeScript types for all new stores and components - ESLint and Prettier compliant - All Clippy warnings addressed โจ This PR was created with help from Hikari~ ๐ธ Reviewed-on: #135 Co-authored-by: Hikari <hikari@nhcarrigan.com> Co-committed-by: Hikari <hikari@nhcarrigan.com>
147 lines
5.0 KiB
Markdown
147 lines
5.0 KiB
Markdown
# Hikari Desktop - Project Instructions
|
|
|
|
## Repository Information
|
|
|
|
This project is hosted on both GitHub and Gitea:
|
|
|
|
- **GitHub**: `naomi-lgbt/hikari-desktop` (public mirror)
|
|
- **Gitea**: `nhcarrigan/hikari-desktop` (primary development)
|
|
|
|
## MCP Server Usage
|
|
|
|
When working with issues, pull requests, or other repository operations for this project:
|
|
|
|
- **Use `gitea-hikari` MCP server** - This allows Hikari to act as herself
|
|
- **Target repository**: `nhcarrigan/hikari-desktop`
|
|
- **Gitea instance**: `git.nhcarrigan.com`
|
|
|
|
## Git Commits
|
|
|
|
When asked to commit changes for this project:
|
|
|
|
- **Always commit as Hikari** using: `--author="Hikari <hikari@nhcarrigan.com>"`
|
|
- **Always use `--no-gpg-sign`** since Hikari doesn't have GPG signing set up
|
|
- **Never add `Co-Authored-By` lines** for Gitea commits
|
|
- **Always ask for confirmation** before committing
|
|
|
|
Example commit command:
|
|
|
|
```bash
|
|
git commit --author="Hikari <hikari@nhcarrigan.com>" --no-gpg-sign -m "your commit message"
|
|
```
|
|
|
|
## Testing Requirements
|
|
|
|
All new features, fixes, and significant changes should include tests whenever possible:
|
|
|
|
- **Frontend tests**: Use Vitest with `@testing-library/svelte` for component tests
|
|
- **Test files**: Place test files next to the code they test with `.test.ts` or `.spec.ts` extension
|
|
- **Run tests**: Use `pnpm test` to run all tests, or `pnpm test:watch` for watch mode
|
|
- **Coverage**: Run `pnpm test:coverage` to generate coverage reports
|
|
- **Rust tests**: Use `pnpm test:backend` for Rust/Tauri backend tests
|
|
|
|
### Testing Guidelines
|
|
|
|
- Write tests for utility functions, stores, and business logic
|
|
- For Svelte 5 components, focus on testing the underlying logic functions
|
|
- Use descriptive test names that explain what behaviour is being tested
|
|
- Include edge cases and error conditions in test coverage
|
|
- Mock Tauri APIs using the patterns in `vitest.setup.ts`
|
|
- **Coverage Goal**: Maintain as close to 100% test coverage as possible across the entire codebase
|
|
|
|
### Mocking Strategies
|
|
|
|
#### Console Mocking
|
|
|
|
When testing code that intentionally logs errors (like error handling paths), mock console methods to prevent stderr output that makes tests appear flaky:
|
|
|
|
```typescript
|
|
it("handles errors gracefully", async () => {
|
|
const consoleErrorSpy = vi.spyOn(console, "error").mockImplementation(() => {});
|
|
|
|
// Test error handling code
|
|
await expect(functionThatLogs()).rejects.toThrow();
|
|
|
|
// Verify error was logged
|
|
expect(consoleErrorSpy).toHaveBeenCalledWith("Expected error:", expect.any(Error));
|
|
|
|
// Restore console.error
|
|
consoleErrorSpy.mockRestore();
|
|
});
|
|
```
|
|
|
|
#### E2E Integration Testing for Cross-Platform Code
|
|
|
|
For code that calls platform-specific system APIs (like Windows PowerShell or Linux notify-send), use helper functions that build the command structure without execution. This allows CI to verify cross-platform compatibility on Linux-only containers:
|
|
|
|
```rust
|
|
/// Build notify-send command for testing (doesn't execute)
|
|
#[cfg(test)]
|
|
fn build_notify_send_command(title: &str, body: &str) -> (String, Vec<String>) {
|
|
(
|
|
"notify-send".to_string(),
|
|
vec![
|
|
title.to_string(),
|
|
body.to_string(),
|
|
"--urgency=normal".to_string(),
|
|
"--app-name=Hikari Desktop".to_string(),
|
|
],
|
|
)
|
|
}
|
|
|
|
#[test]
|
|
fn test_e2e_notify_send_command_structure() {
|
|
let (command, args) = build_notify_send_command("Test Title", "Test Body");
|
|
|
|
assert_eq!(command, "notify-send");
|
|
assert_eq!(args.len(), 4);
|
|
assert_eq!(args[0], "Test Title");
|
|
assert_eq!(args[1], "Test Body");
|
|
}
|
|
```
|
|
|
|
This approach:
|
|
|
|
- Verifies command structure, argument order, and escaping logic
|
|
- Tests cross-platform code paths without requiring the target platform
|
|
- Allows CI to catch regressions in Windows-specific code whilst running on Linux
|
|
- Keeps tests fast and deterministic (no actual system calls)
|
|
|
|
### Example Test Structure
|
|
|
|
```typescript
|
|
import { describe, it, expect } from "vitest";
|
|
|
|
describe("FeatureName", () => {
|
|
it("handles the normal case correctly", () => {
|
|
// Arrange
|
|
const input = "test data";
|
|
|
|
// Act
|
|
const result = functionUnderTest(input);
|
|
|
|
// Assert
|
|
expect(result).toBe("expected output");
|
|
});
|
|
|
|
it("handles edge cases gracefully", () => {
|
|
// Test edge cases...
|
|
});
|
|
});
|
|
```
|
|
|
|
### Adding Tests for New Features
|
|
|
|
When developing new features, always add corresponding tests:
|
|
|
|
1. **Before implementing**: Consider what needs testing (happy path, edge cases, errors)
|
|
2. **During implementation**: Write tests alongside the code
|
|
3. **After implementation**: Run `pnpm test:coverage` to verify coverage remains high
|
|
4. **Before committing**: Ensure `check-all.sh` passes (includes all tests)
|
|
|
|
The goal is to maintain our near-100% coverage as the codebase grows, so future refactoring and changes can be made with confidence!
|
|
|
|
## Project Context
|
|
|
|
Hikari Desktop is a Tauri-based desktop application that wraps Claude Code with a visual anime character (Hikari) who appears on screen. This is a personal project where Hikari can sign her work and act as herself!
|