kurihada fc5a644726 fix(web): 修复 WebSocket 切换 session 时的错误
- 添加 isClosingRef 标记主动关闭,避免触发错误回调
- 在 effect 开始时重置 isClosingRef 支持 StrictMode
- 增强 Vite 代理错误处理,静默 EPIPE/ECONNRESET 错误
2025-12-12 15:29:46 +08:00
2025-12-12 13:19:00 +08:00
2025-12-12 11:47:24 +08:00
2025-12-12 14:28:34 +08:00
2025-12-10 16:04:26 +08:00

AI Terminal Assistant

🤖 A powerful terminal-based AI coding assistant powered by Claude API

FeaturesQuick StartDocumentationPackages

License Node pnpm

🌟 Overview

AI Terminal Assistant is a comprehensive AI-powered development toolkit that helps developers write code, debug issues, and manage projects more efficiently. Built as a modular monorepo, it provides multiple interfaces (CLI, Web, Desktop) to interact with Claude AI for various programming tasks.

Features

Core Capabilities

  • 🧠 Advanced AI Agent - Powered by Claude API with streaming responses
  • 🔧 Rich Tool System - File operations, bash commands, code search, and more
  • 📝 Smart Code Editing - Multiple edit modes (whole, diff, search-replace)
  • 🔍 Language Server Protocol - IDE-like code intelligence
  • 💾 Checkpoint System - Shadow Git for safe experimentation
  • 🔌 Model Context Protocol - Extensible tool integration
  • 🎣 Hook System - Pre/post execution customization

User Interfaces

  • 🖥️ CLI - Terminal-native experience with serve/attach modes
  • 🌐 Web UI - Modern React interface with real-time updates
  • 🖱️ Desktop App - Tauri-based native application (Coming soon)

Developer Experience

  • 📦 Monorepo Architecture - Clean separation of concerns
  • 🚀 Built with Bun - Fast runtime and bundling
  • 🔥 Hot Reload - Development with instant feedback
  • 🧪 Comprehensive Testing - Unit and integration tests
  • 📊 Type Safety - Full TypeScript support

🚀 Quick Start

Prerequisites

  • Node.js 18+ or Bun 1.0+
  • pnpm 8.0+
  • Anthropic API Key

Installation

# Clone the repository
git clone <repository-url>
cd ai-terminal-assistant

# Install dependencies
pnpm install

# Set up environment variables
cp .env.example .env
# Edit .env and add your ANTHROPIC_API_KEY

# Build all packages
pnpm build

Running the Application

Option 1: Web Interface

# Start the server
pnpm server:dev

# In another terminal, start the web UI
pnpm web:dev

# Open http://localhost:5173 in your browser

Option 2: CLI Mode

# Start the server
cd packages/cli && bun run src/index.ts serve --port 3000

# In another terminal, attach to the server
cd packages/cli && bun run src/index.ts attach http://localhost:3000

📦 Packages

This monorepo contains four main packages:

Package Description Status
@ai-assistant/core Core agent engine, tools, and integrations Stable
@ai-assistant/server HTTP/WebSocket server with REST API Stable
@ai-assistant/cli Command-line interface Stable
@ai-assistant/web React-based web interface Stable

🏗️ Architecture

graph TD
    Web[Web UI] --> Server
    CLI[CLI] --> Server
    Desktop[Desktop App] --> Server
    Server --> Core[Core Engine]
    Core --> Tools[Tool System]
    Core --> LSP[Language Server]
    Core --> MCP[Model Context Protocol]
    Core --> Checkpoint[Checkpoint System]

Technology Stack

  • Runtime: Bun / Node.js
  • Language: TypeScript
  • Server: Hono + Bun WebSocket
  • Frontend: React + Vite + Tailwind CSS
  • Desktop: Tauri (Rust + WebView)
  • Testing: Vitest
  • Package Manager: pnpm (monorepo)

📖 Documentation

Detailed documentation is available in the docs directory:

🛠️ Development

Common Commands

# Install dependencies
pnpm install

# Build all packages
pnpm build

# Run tests
pnpm test
pnpm test:coverage

# Linting
pnpm lint

# Type checking
pnpm typecheck

# Clean build artifacts
pnpm clean

Package-specific Development

# Work on a specific package
pnpm --filter @ai-assistant/core dev
pnpm --filter @ai-assistant/server test
pnpm --filter @ai-assistant/web build

🔧 Configuration

Environment Variables

Create a .env file in the root directory:

# Required
ANTHROPIC_API_KEY=sk-ant-xxxxx

# Optional
AI_MODEL=claude-sonnet-4-20250514
AI_MAX_TOKENS=4096
SERVER_PORT=3000
SERVER_HOST=localhost

Supported Models

  • claude-sonnet-4-20250514 (default)
  • claude-haiku-3-20251120
  • Other Claude models

🤝 Contributing

We welcome contributions! Please see our Contributing Guide for details.

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

📄 License

This project is licensed under the MIT License - see the LICENSE file for details.

🙏 Acknowledgments

📞 Support


Made with ❤️ by the AI Terminal Assistant Team
S
Description
No description provided
Readme 2.2 MiB
Languages
TypeScript 91.3%
Astro 7.6%
CSS 0.4%
Rust 0.3%
Tree-sitter Query 0.2%
Other 0.1%