Skip to content

sswym/SRcode

Repository files navigation

SRcode

AI-Powered Terminal Assistant — Understands your codebase, edits files, runs commands, and automates development workflows.

Overview

SRcode is a powerful AI-powered terminal assistant designed to supercharge your development workflow. Built with modern TypeScript and React/Ink, it provides an intelligent CLI experience that deeply understands your project context, executes tasks autonomously, and integrates seamlessly with Claude Desktop via the Model Context Protocol (MCP).

Key Capabilities

  • Intelligent Code Understanding — Deep awareness of your project structure, dependencies, and codebase
  • Autonomous Task Execution — Executes complex development tasks with intelligent planning
  • Tool Ecosystem — 18+ built-in tools for file operations, command execution, web search, and more
  • Multi-Model Support — Works with OpenAI, Anthropic Claude, and other LLM providers
  • MCP Integration — Native integration with Claude Desktop for enhanced AI capabilities
  • Security First — Sandboxed execution with multi-layer permission controls
  • Extensible — Plugin and skill system for custom extensions

Installation

Prerequisites

  • Node.js >= 20.18.1
  • Bun (recommended for development)
  • npm or yarn (for installation)

Quick Install

# Install via npm
npm install -g srcode

# Or via bun
bun install -g srcode

Verify Installation

srcode --version

Getting Started

Interactive Mode

Start an interactive session in your terminal:

srcode

MCP Server Mode

Connect to Claude Desktop by running as an MCP server:

srcode mcp

Command Line Usage

# Ask a question
srcode "How does authentication work in this project?"

# Edit files
srcode "Fix the bug in user.ts"

# Run commands
srcode "Run the test suite"

Core Concepts

Tools System

SRcode provides 18+ built-in tools organized into categories:

Category Tools
File Operations FileRead, FileWrite, FileEdit, MultiEdit, Glob, Grep, ls
System Execution Bash, Task, Architect, Memory
Development NotebookRead, NotebookEdit, TodoRead, TodoWrite
Web & Network WebFetch, WebSearch
AI & Agents AskExpert, Task, Skill
MCP Integration MCPTool

Permission System

SRcode implements a multi-layer permission system for security:

  1. Tool-level — Each tool declares its own permission requirements
  2. Session-level — Trust level based on project configuration
  3. Command-level — Whitelist/blacklist for specific commands
  4. Filesystem-level — Directory boundary checks

Skill System

Extend SRcode capabilities with skills — reusable instruction sets in the Agent Skills format:

# Install a skill from GitHub
npx add-skill owner/repo -a srcode

# Use a skill
/skill-name

Configuration

API Keys

SRcode supports multiple AI providers. Configure via environment variables:

# Anthropic Claude
export ANTHROPIC_API_KEY=sk-ant-...

# OpenAI
export OPENAI_API_KEY=sk-...

# OpenRouter (for diverse models)
export OPENROUTER_API_KEY=...

Project Configuration

Create .srcode.json in your project root:

{
  "model": "claude-sonnet-4-20250514",
  "temperature": 0.7,
  "trustProjects": ["./my-trusted-project"],
  "allowedCommands": ["git", "npm", "bun"]
}

Model Selection

# Switch model interactively
srcode model

# Or set in config
srcode config set model claude-opus-4-20250514

Development

Setup

# Clone the repository
git clone https://github.com/shareAI-lab/SRcode.git
cd SRcode

# Install dependencies
bun install

# Run in development mode
bun run dev

Build

# Build for npm distribution
bun run build

# Or build standalone binary
bun run build:binary

Testing

# Run all tests
bun test

# Run specific test suites
bun test:unit      # Unit tests
bun test:integration  # Integration tests
bun test:e2e       # End-to-end tests

Code Quality

# Type check
bun run typecheck

# Lint
bun run lint

# Format
bun run format

Project Structure

srcode/
├── src/
│   ├── entrypoints/      # CLI & MCP entry points
│   ├── commands/        # CLI commands
│   ├── tools/           # Tool implementations (18+ tools)
│   ├── services/       # Core services (AI, auth, MCP, etc.)
│   ├── ui/             # React/Ink components
│   └── utils/          # Utilities
├── tests/              # Test suites
├── docs/               # Documentation
└── scripts/            # Build & utility scripts

Architecture

SRcode uses a Dual-Drive Architecture:

  • CLI Mode — Interactive terminal with React/Ink UI
  • MCP Mode — JSON-RPC server for Claude Desktop integration

Both modes share the same core business logic, tool system, and state management, achieving ~85% code reuse.

Key Technologies

  • Runtime: Bun + Node.js
  • UI Framework: React + Ink
  • Language: TypeScript (strict mode)
  • AI Integration: OpenAI SDK + Anthropic SDK
  • Protocol: Model Context Protocol (MCP)

Contributing

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

Development Workflow

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Make your changes
  4. Run tests (bun test)
  5. Commit your changes
  6. Push to the branch
  7. Create a Pull Request

License

Licensed under the Apache License 2.0. See LICENSE for details.

Support


Star us on GitHub ⭐ | Join our Discord 💬 | Follow us 🐦

About

No description, website, or topics provided.

Resources

License

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages