Skip to content
This repository was archived by the owner on Apr 19, 2026. It is now read-only.

Commit f79fe74

Browse files
koki-developclaude
andcommitted
docs: update CLAUDE.md with comprehensive project guidance
- Add project architecture section describing cat chat simulator - Document Ink-based terminal UI technology stack - Add chat UI design patterns (Static component, loading states) - Document cat behavior and UX patterns - Update file structure to reflect TSX entry point - Add local testing command and development notes 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 12daf7c commit f79fe74

File tree

1 file changed

+30
-9
lines changed

1 file changed

+30
-9
lines changed

CLAUDE.md

Lines changed: 30 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,32 +8,53 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co
88
- **Lint**: `bun run lint` - Runs Biome linter checks
99
- **Format**: `bun run fmt` - Formats code using Biome with unsafe fixes
1010
- **Type check**: `bun run typecheck` - Runs TypeScript compiler without emitting files
11+
- **Test locally**: `bun run ./dist/index.js` - Run the built CLI locally
1112

12-
## Project Structure
13+
## Project Architecture
1314

14-
This is a TypeScript CLI tool using the following stack:
15+
This is a terminal-based chat UI CLI tool that simulates a conversation with a cat. The architecture consists of:
16+
17+
### Core Components
18+
- **CLI Entry Point** (`src/index.tsx`): Commander.js setup that renders the Ink app
19+
- **Chat Application** (`src/App.tsx`): React-based terminal UI using Ink framework
20+
- **Build System** (`scripts/build.ts`): Custom Bun build script that creates executable CLI binary
21+
22+
### Technology Stack
1523
- **Runtime**: Bun (primary development runtime)
1624
- **CLI Framework**: Commander.js for argument parsing
25+
- **Terminal UI**: Ink (React for CLIs) with community components:
26+
- `ink-text-input` for user input
27+
- `ink-spinner` for loading states
1728
- **Build Tool**: Custom Bun build script that creates executable CLI binary
1829
- **Linting/Formatting**: Biome (replaces ESLint + Prettier)
1930
- **Package Manager**: Bun with lockfile management
2031

21-
### Key Files
22-
- `src/index.ts` - Main entry point with Commander.js CLI setup
23-
- `scripts/build.ts` - Custom build script that outputs to `dist/` with shebang
24-
- `biome.json` - Biome configuration for linting and formatting
25-
- `tsconfig.json` - TypeScript configuration optimized for bundler mode
32+
### Chat UI Design Patterns
33+
- **Message Persistence**: Uses Ink's `<Static>` component to render chat history that doesn't re-render
34+
- **Loading States**: Displays spinner with "Thinking..." during cat response delay
35+
- **Input Management**: Disables cursor and prevents duplicate submissions during loading
36+
- **Cat Behavior**: Always responds with "ニャー" after a 500ms delay to simulate thinking
2637

2738
### Build Process
2839
The build process creates a standalone executable CLI tool:
2940
1. Removes existing `dist/` directory
30-
2. Uses Bun.build() to bundle TypeScript to JavaScript
41+
2. Uses Bun.build() to bundle TypeScript/TSX to JavaScript
3142
3. Adds Node.js shebang for CLI execution
3243
4. Makes output executable with chmod +x
3344

45+
### Key Files
46+
- `src/index.tsx` - Main entry point with Commander.js CLI setup (TSX for JSX support)
47+
- `src/App.tsx` - Main chat UI component with React hooks and Ink components
48+
- `scripts/build.ts` - Custom build script that outputs to `dist/` with shebang
49+
- `biome.json` - Biome configuration for linting and formatting
50+
- `tsconfig.json` - TypeScript configuration optimized for bundler mode with JSX support
51+
3452
## Development Notes
3553

54+
- Entry point is TSX (not TS) to support JSX syntax for Ink components
3655
- Uses `"module": "Preserve"` and `"moduleResolution": "bundler"` in tsconfig for modern bundler compatibility
3756
- Biome is configured with strict rules including unused variable/import detection
3857
- Package is configured as ESM with `"type": "module"`
39-
- Binary is published as `cat-code` command via `bin` field in package.json
58+
- Binary is published as `cat-code` command via `bin` field in package.json
59+
- Message state uses simple array with auto-incrementing IDs (length + 1/2)
60+
- Color scheme: cyan for user messages, green for cat messages, yellow for prompt

0 commit comments

Comments
 (0)