Skip to content

Carlys17/claw-codes

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

9 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Claw Code - Qwen Edition

GitHub License: MIT Python 3.8+ Security

AI Coding Assistant that supports both Claude and Qwen (Alibaba Cloud) πŸš€


✨ Key Features

Feature Description
πŸ€– Multi-LLM Support Claude (Anthropic) and Qwen (Alibaba Cloud)
πŸ› οΈ 207 Commands Ready-to-use commands for various tasks
πŸ”§ 184 Tools File ops, search, git, MCP, and more
🐍 Python Easy to modify and extend
πŸ¦€ Rust (WIP) Rust implementation for higher performance
πŸ”Œ MCP Support Integrate with MCP servers

πŸš€ Quick Start

1. Clone Repository

git clone https://github.com/Carlys17/claw-codes.git
cd claw-codes

2. Choose LLM Provider

Using Qwen (Alibaba Cloud / DashScope)

# Set API key
export QWEN_API_KEY="your-dashscope-api-key"
export QWEN_MODEL="qwen-max"  # optional: qwen-turbo, qwen-plus, qwen-max

Get API Key at: Alibaba Cloud DashScope

Using Claude (Anthropic)

export ANTHROPIC_API_KEY="your-anthropic-api-key"

3. Run

# View project summary
python -m src.main summary

# List available commands
python -m src.main commands --limit 20

# List available tools
python -m src.main tools --limit 20

# Run turn loop with AI
python -m src.main turn-loop "Explain this project structure" --max-turns 3

πŸ“– Documentation

Command Line Usage

# Check active provider
python -m src.main summary

# Choose provider explicitly
python -m src.main turn-loop "Hello" --provider qwen
python -m src.main turn-loop "Hello" --provider claude

# Bootstrap AI session
python -m src.main bootstrap "Create a simple REST API"

# Run tests
python -m unittest discover -s tests -v

Environment Variables

Variable Description Default
QWEN_API_KEY API key for Qwen/DashScope -
QWEN_BASE_URL Qwen API endpoint Auto-detect
QWEN_MODEL Qwen model to use qwen-max
QWEN_API_MODE API mode: dashscope, openai, anthropic Auto-detect
ANTHROPIC_API_KEY API key for Claude -
ANTHROPIC_BASE_URL Claude API endpoint https://api.anthropic.com

πŸ“¦ Project Structure

claw-codes/
β”œβ”€β”€ src/                          # Python source code
β”‚   β”œβ”€β”€ qwen_client.py           # Qwen API client
β”‚   β”œβ”€β”€ query_engine.py          # Multi-provider query engine
β”‚   β”œβ”€β”€ main.py                  # CLI entrypoint
β”‚   β”œβ”€β”€ models.py                # Data structures
β”‚   β”œβ”€β”€ tools.py                 # Tool definitions
β”‚   β”œβ”€β”€ commands.py              # Command handlers
β”‚   β”œβ”€β”€ runtime.py               # Runtime logic
β”‚   └── ...
β”œβ”€β”€ rust/                         # Rust implementation (WIP)
β”‚   β”œβ”€β”€ crates/
β”‚   β”‚   β”œβ”€β”€ api/                 # API client
β”‚   β”‚   β”œβ”€β”€ runtime/             # Core runtime
β”‚   β”‚   └── rusty-claude-cli/    # CLI application
β”‚   └── ...
β”œβ”€β”€ tests/                        # Python tests
β”œβ”€β”€ QWEN_SETUP.md                 # Complete Qwen setup guide
β”œβ”€β”€ SECURITY.md                   # Security policy
β”œβ”€β”€ LICENSE                       # MIT License
└── README.md

πŸ”§ Available Models

Qwen Models (via DashScope)

Model Context Best For
qwen-turbo 8K Fast tasks, prototyping
qwen-plus 32K Balanced performance
qwen-max 32K Complex reasoning, coding
qwen-max-longcontext 256K Large documents

Claude Models

Model Context Best For
claude-3-haiku 200K Fast, cheap tasks
claude-3-sonnet 200K Balanced
claude-3-opus 200K Complex tasks

🎯 Use Cases

1. Code Generation

python -m src.main bootstrap "Create a Flask REST API for todo app"

2. Code Review

python -m src.main turn-loop "Review src/main.py and suggest improvements"

3. Debugging

python -m src.main turn-loop "Why is this test failing? Explain and provide fix"

4. Refactoring

python -m src.main bootstrap "Refactor this function to be cleaner"

πŸ§ͺ Development

Run Tests

python -m unittest discover -s tests -v

Test Qwen Connection

python -c "
from src.qwen_client import QwenClient, QwenRequest, QwenMessage

try:
    client = QwenClient.from_env()
    request = QwenRequest(messages=[QwenMessage(role='user', content='Hello')])
    response = client.send_message(request)
    print(f'Connected! Model: {response.model}')
    print(f'Response: {response.content}')
except Exception as e:
    print(f'Error: {e}')
"

πŸ” Security

⚠️ Important: Never Commit API Keys!

# βœ… DO: Use environment variables
export QWEN_API_KEY="your-key-here"

# ❌ DON'T: Hardcode in source files
api_key = "sk-xxxxx"  # NEVER DO THIS

Sensitive Files to Exclude

The following should NEVER be committed:

File/Pattern Reason
.env Contains secrets
*.key, *.pem Private keys
credentials.json Authentication data
.claude/settings.local.json Local settings

See SECURITY.md for full security policy.


πŸ“ License

MIT License - see LICENSE for details.


πŸ™ Credits


🀝 Contributing

Contributions welcome! Please:

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

Before Submitting PR

  • No API keys or secrets in code
  • Code follows project style
  • Tests pass (python -m unittest discover -s tests -v)
  • Documentation updated

πŸ“¬ Contact


Star ⭐ this repo if you find it helpful!

About

Claude Code rewrite with Qwen/Alibaba Cloud API support

Topics

Resources

License

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors