@@ -9,6 +9,8 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co
99- ** Format** : ` bun run fmt ` - Formats code using Biome with unsafe fixes
1010- ** Type check** : ` bun run typecheck ` - Runs TypeScript compiler without emitting files
1111- ** Test locally** : ` bun run ./dist/index.js ` - Run the built CLI locally
12+ - ** Run tests** : ` bun test ` - Runs all test files (* .spec.ts)
13+ - ** Run single test** : ` bun test src/lib/util.spec.ts ` - Run specific test file
1214
1315## Project Architecture
1416
@@ -19,10 +21,13 @@ This is a terminal-based chat UI CLI tool that simulates a conversation with a c
1921- ** Chat Application** (` src/App.tsx ` ): Main state management component for messages and loading state
2022- ** UI Components** (` src/components/ ` ): Modular React components for terminal UI
2123 - ` ChatHistory.tsx ` : Message list rendering using Ink's Static component
22- - ` MessageItem.tsx ` : Individual message display component
23- - ` InputField.tsx ` : Text input with prompt styling
24+ - ` MessageItem.tsx ` : Individual message display component with multi-line indent support
25+ - ` InputField.tsx ` : Text input with prompt styling and border
2426 - ` Spinner.tsx ` : Loading indicator during cat responses
2527 - ` types.ts ` : Shared TypeScript interfaces
28+ - ** Business Logic** (` src/lib/ ` ): Core functionality and utilities
29+ - ` cat.ts ` : Cat class with async response generation
30+ - ` util.ts ` : Reusable utility functions (e.g., indent for text formatting)
2631- ** Build System** (` scripts/build.ts ` ): Custom Bun build script that creates executable CLI binary
2732
2833### Technology Stack
@@ -37,9 +42,11 @@ This is a terminal-based chat UI CLI tool that simulates a conversation with a c
3742
3843### Chat UI Design Patterns
3944- ** Message Persistence** : Uses Ink's ` <Static> ` component to render chat history that doesn't re-render
40- - ** Loading States** : Displays spinner with "Thinking..." during cat response delay
45+ - ** Loading States** : Displays cyan spinner with "Thinking..." during cat response delay
4146- ** Input Management** : Disables cursor and prevents duplicate submissions during loading
42- - ** Cat Behavior** : Always responds with "ニャー" after a 500ms delay to simulate thinking
47+ - ** Cat Behavior** : Cat class provides async responses with "ニャー" after 500ms delay
48+ - ** Message Styling** : User messages prefixed with "> " in gray, cat messages in cyan with left padding
49+ - ** Multi-line Support** : User messages use indent utility for proper 2+ line formatting
4350
4451### Build Process
4552The build process creates a standalone executable CLI tool:
@@ -50,10 +57,11 @@ The build process creates a standalone executable CLI tool:
5057
5158### Component Architecture
5259The codebase follows a modular component structure:
53- - ** State Management** : Centralized in ` App.tsx ` using React hooks
60+ - ** State Management** : Centralized in ` App.tsx ` using React hooks with Date.now() for unique message IDs
5461- ** Component Separation** : Each UI piece is a separate component with clear responsibilities
5562- ** Type Safety** : Shared types in ` components/types.ts ` for consistency
5663- ** Prop Interface** : Components receive specific props rather than accessing global state
64+ - ** Utility Functions** : Common functions in ` src/lib/util.ts ` with comprehensive test coverage
5765
5866## Development Notes
5967
@@ -62,6 +70,8 @@ The codebase follows a modular component structure:
6270- Biome is configured with strict rules including unused variable/import detection
6371- Package is configured as ESM with ` "type": "module" `
6472- Binary is published as ` cat-code ` command via ` bin ` field in package.json
65- - Message state uses simple array with auto-incrementing IDs (length + 1/2)
66- - Color scheme: cyan for user messages, green for cat messages, yellow for prompt
67- - Components are split into separate files in ` src/components/ ` for maintainability
73+ - Message state uses simple array with Date.now() IDs to prevent duplicates
74+ - Color scheme: gray for user messages, cyan for cat messages and spinner, yellow for input prompt
75+ - Components are split into separate files in ` src/components/ ` for maintainability
76+ - Test files use ` .spec.ts ` naming convention and bun: test framework
77+ - Utility functions follow options-object pattern for extensibility
0 commit comments