Skip to content

deepseek-cli,An open-source AI agent that brings the power of DeepSeek directly into your terminal.

License

Notifications You must be signed in to change notification settings

fenwii/deepseek-cli

Repository files navigation

DeepSeek CLI

DeepSeek CLI TypeScript Node.js License

An open-source AI agent that brings the power of DeepSeek directly into your terminal.

FeaturesQuick StartInstallationUsageExamplesDocumentation


🚀 Features

🤖 AI-Powered Intelligence

  • Interactive Chat: Real-time conversations with DeepSeek V3 and R1 models
  • Code Analysis: Intelligent codebase analysis with AI-powered insights
  • Workflow Automation: Execute complex AI-driven workflows and tasks
  • Multi-Model Support: Switch between DeepSeek V3, R1, and 32K variants

📊 Advanced Code Analysis

  • Language Detection: Support for 30+ programming languages
  • Complexity Metrics: Cyclomatic complexity analysis and recommendations
  • Code Quality: Automated issue detection and best practice suggestions
  • Architecture Insights: AI-powered codebase structure analysis

🔄 Workflow Automation

  • Task Parsing: Natural language task description to executable workflows
  • Multi-Step Execution: Complex multi-step AI workflows
  • Interactive Mode: Real-time workflow interaction and modification
  • Output Formats: JSON, Markdown, and text output support

🎨 Developer Experience

  • Theme Support: Light, dark, and auto themes with terminal detection
  • Configuration Management: Flexible configuration with environment variables
  • File Operations: Built-in file management and context loading
  • Error Handling: Comprehensive error handling and recovery

Performance & Reliability

  • Streaming Responses: Real-time response streaming for better UX
  • Connection Management: Robust API connection handling
  • Caching: Intelligent response caching and optimization
  • Logging: Comprehensive logging with configurable levels

📋 Prerequisites

  • Node.js: Version 18 or higher
  • Package Manager: npm or yarn
  • DeepSeek API Key: Get your API key from DeepSeek Platform

🛠️ Installation

Quick Start (Recommended)

# Clone and run quick start
git clone https://github.com/fenwii/deepseek-cli.git
cd deepseek-cli
./quickstart.sh

Manual Installation

Option 1: Global Installation

git clone https://github.com/fenwii/deepseek-cli.git
cd deepseek-cli
./install.sh

Option 2: Local Development

git clone https://github.com/fenwii/deepseek-cli.git
cd deepseek-cli
yarn install
yarn build
yarn link

Option 3: Direct Execution

git clone https://github.com/fenwii/deepseek-cli.git
cd deepseek-cli
yarn install
yarn dev

Configuration

Set your DeepSeek API key:

deepseek config --set apiKey=YOUR_API_KEY

🎯 Usage

Interactive Chat

Start an interactive chat session:

deepseek chat

With custom system prompt:

deepseek chat --system "You are a Python expert specializing in data science"

With context file:

deepseek chat --file context.txt --system "Analyze this codebase"

Code Analysis

Analyze your entire codebase:

deepseek analyze . --recursive

Focus on specific languages:

deepseek analyze src/ --extensions ts,js,py --recursive

Workflow Automation

Generate documentation:

deepseek workflow "Create comprehensive documentation for this project"

Security review:

deepseek workflow "Review this codebase for security vulnerabilities" --interactive

Configuration Management

# Set configuration
deepseek config --set defaultModel=v3
deepseek config --set theme=dark
deepseek config --set maxTokens=8000

# View configuration
deepseek config --list

# Get specific value
deepseek config --get apiKey

📚 Examples

Code Review & Analysis

# Comprehensive codebase analysis
deepseek analyze . --recursive

# Focus on TypeScript files
deepseek analyze src/ --extensions ts --recursive

# Generate detailed report
deepseek workflow "Analyze code quality and generate improvement recommendations"

Documentation Generation

# Generate README
deepseek workflow "Create a professional README.md for this project"

# Generate API documentation
deepseek workflow "Generate API documentation for all TypeScript interfaces"

# Create user guides
deepseek workflow "Create user documentation and installation guides"

Code Migration & Refactoring

# Migrate JavaScript to TypeScript
deepseek workflow "Help migrate this JavaScript codebase to TypeScript"

# Refactor complex code
deepseek workflow "Refactor high-complexity functions for better maintainability"

# Update dependencies
deepseek workflow "Analyze package.json and suggest dependency updates"

Testing & Quality Assurance

# Generate test suites
deepseek workflow "Create comprehensive unit tests for all functions"

# Code coverage analysis
deepseek workflow "Analyze test coverage and suggest improvements"

# Performance optimization
deepseek workflow "Identify performance bottlenecks and suggest optimizations"

🔧 Configuration

Environment Variables

Variable Description Default
DEEPSEEK_API_KEY Your DeepSeek API key -
DEEPSEEK_MODEL Default model (v3, r1, v3-32k, r1-32k) v3
DEEPSEEK_THEME Color theme (light, dark, auto) auto
DEEPSEEK_MAX_TOKENS Maximum tokens per request 4000
DEEPSEEK_TEMPERATURE Response temperature (0-2) 0.7
DEEPSEEK_TIMEOUT Request timeout in milliseconds 60000

Configuration File

Located at ~/.deepseek-cli/config.json:

{
  "apiKey": "your-api-key",
  "defaultModel": "v3",
  "theme": "auto",
  "enableLogging": false,
  "maxTokens": 4000,
  "temperature": 0.7,
  "timeout": 60000,
  "autoSave": true,
  "workspace": "./",
  "customPrompts": {
    "code_review": "You are an expert code reviewer...",
    "documentation": "You are a technical writer...",
    "testing": "You are a testing expert..."
  }
}

🤖 Models

DeepSeek V3 (Recommended)

  • Best for: Most general tasks, code analysis, documentation
  • Performance: Balanced speed and quality
  • Context: 4K tokens
  • Use cases: Code review, documentation, general assistance

DeepSeek R1 (Fast)

  • Best for: Quick tasks, simple queries
  • Performance: Fastest response times
  • Context: 4K tokens
  • Use cases: Quick questions, simple code analysis

32K Variants

  • Best for: Large codebases, complex analysis
  • Performance: Slower but more comprehensive
  • Context: 32K tokens
  • Use cases: Large file analysis, complex workflows

🏗️ Development

Project Structure

src/
├── api/           # DeepSeek API client and models
├── cli/           # Main CLI logic and commands
├── config/        # Configuration management
├── analysis/      # Code analysis tools
├── workflow/      # Workflow automation engine
├── ui/            # UI and theming system
└── utils/         # Utility functions and helpers

Building from Source

# Install dependencies
yarn install

# Build the project
yarn build

# Run in development mode
yarn dev

# Run tests
yarn test

# Lint code
yarn lint

# Format code
yarn format

Available Scripts

Script Description
yarn build Build the project for production
yarn dev Run in development mode
yarn test Run test suite
yarn lint Lint TypeScript code
yarn format Format code with Prettier
yarn clean Clean build artifacts
yarn link Create local development link
yarn demo Run demonstration script

🤝 Contributing

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

Development Setup

  1. Fork the repository
  2. Create a feature branch: git checkout -b feature/amazing-feature
  3. Make your changes and add tests
  4. Run tests: yarn test
  5. Commit your changes: git commit -m 'Add amazing feature'
  6. Push to the branch: git push origin feature/amazing-feature
  7. Open a Pull Request

Code Style

  • Follow TypeScript best practices
  • Use ESLint and Prettier for code formatting
  • Write comprehensive tests for new features
  • Update documentation for API changes

🐛 Troubleshooting

Common Issues

API Key Issues:

# Verify API key is set
deepseek config --get apiKey

# Set API key
deepseek config --set apiKey=YOUR_API_KEY

# Test connection
deepseek test

Permission Issues:

# Fix global installation permissions
sudo yarn global add .

# Or use local installation
yarn link

Build Issues:

# Clean and rebuild
yarn clean
yarn install
yarn build

Getting Help

  • 📖 Usage Guide - Detailed usage documentation
  • 🐛 Issues - Report bugs and request features
  • 💬 Discussions - Ask questions and share ideas

📄 License

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

🙏 Acknowledgments

  • DeepSeek AI for providing the powerful AI models
  • Commander.js for the excellent CLI framework
  • Chalk for beautiful terminal styling
  • Inquirer.js for interactive prompts
  • All contributors who help improve this project

📊 Project Status

GitHub stars GitHub forks GitHub issues GitHub pull requests GitHub license


Made with ❤️ by the DeepSeek CLI Team

Get StartedView on GitHubReport Bug


Author: samir.tan.it@gmail.com
Created: 2025-06-28
Last Updated: 2025-06-28

About

deepseek-cli,An open-source AI agent that brings the power of DeepSeek directly into your terminal.

Resources

License

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published