WYN360 - An intelligent AI coding assistant CLI tool powered by Anthropic Claude
Project description
WYN360 CLI
An intelligent AI coding assistant CLI tool powered by Anthropic Claude.
๐ฏ Overview
WYN360 CLI is an AI-powered coding assistant that helps you build projects, generate code, and improve your codebase through natural language conversations. Built with pydantic-ai and Anthropic Claude, it provides intelligent file operations, command execution, and context-aware assistance.
๐๏ธ System Architecture
graph TB
subgraph "User Interface Layer"
CLI[CLI Interface<br/>click + prompt-toolkit]
Input[User Input<br/>Multi-line support]
Output[Rich Console Output<br/>Markdown rendering]
end
subgraph "Agent Layer"
Agent[WYN360Agent<br/>pydantic-ai]
Model[Anthropic Claude<br/>claude-sonnet-4]
Prompt[System Prompt<br/>Intent recognition]
end
subgraph "Tool Layer"
ReadFile[read_file<br/>Read file contents]
WriteFile[write_file<br/>Create/update files]
ListFiles[list_files<br/>Scan directory]
ProjectInfo[get_project_info<br/>Project summary]
ExecCmd[execute_command<br/>Run shell commands]
end
subgraph "Utility Layer"
FileOps[File Operations<br/>Safe read/write]
Scanner[Directory Scanner<br/>Categorize files]
CmdExec[Command Executor<br/>subprocess + timeout]
CodeExt[Code Extractor<br/>Parse markdown blocks]
end
Input --> CLI
CLI --> Agent
Agent --> Model
Agent --> Prompt
Agent --> ReadFile
Agent --> WriteFile
Agent --> ListFiles
Agent --> ProjectInfo
Agent --> ExecCmd
ReadFile --> FileOps
WriteFile --> FileOps
ListFiles --> Scanner
ProjectInfo --> Scanner
ExecCmd --> CmdExec
Model --> Output
CLI --> Output
style Agent fill:#e1f5ff
style Model fill:#fff3e0
style CLI fill:#f3e5f5
style ExecCmd fill:#ffebee
๐ฆ Installation
pip install wyn360-cli
๐ Quick Start
1. Set up your Anthropic API key (choose one method):
Option 1: Environment variable
export ANTHROPIC_API_KEY=your_key_here
Option 2: .env file (recommended for local development)
# Create a .env file in your project directory
echo "ANTHROPIC_API_KEY=your_key_here" > .env
Option 3: Command-line argument
wyn360 --api-key your_key_here
2. Run the CLI:
wyn360
3. Start chatting:
You: Build a Streamlit app for data visualization
WYN360: I'll create a Streamlit app for you...
[Generates complete code and saves to app.py]
โจ Features
Core Capabilities
- ๐ค Interactive AI Assistant - Natural language conversations with Claude
- ๐ Code Generation - Generate production-ready Python code from descriptions
- ๐ Project Analysis - Understand and improve existing codebases
- ๐ Smart File Operations - Context-aware file creation and updates
- โก Command Execution - Run Python scripts, UV commands, shell scripts, any CLI tool
- โจ๏ธ Multi-line Input - Press Enter to submit, Shift+Enter for newline
- ๐ Safety First - Confirmation prompts before executing commands
Intelligent Features (v0.2.x)
- ๐ง Intent Recognition - Understands "update" vs "create new" from natural language
- ๐ Context-Aware Updates - Reads files before modifying them
- ๐ Self-Correcting - Smart retry mechanism with 3 attempts
- โฑ๏ธ Timeout Protection - Prevents infinite loops (5 min default)
- ๐ Comprehensive Output - Captures stdout, stderr, and exit codes
Context Management (v0.2.8)
- ๐ฌ Conversation History - Maintains context across multiple interactions
- ๐ Token Tracking - Real-time monitoring of API usage and costs
- ๐พ Session Save/Load - Preserve conversations for later continuation
- ๐ฏ Slash Commands - Quick access to history, stats, and session management
๐ฎ Usage Examples
Starting a New Project
You: Create a FastAPI app with authentication
WYN360:
- Generates main.py with FastAPI setup
- Creates auth middleware
- Adds example routes
- Provides setup instructions
Updating Existing Code
You: Add logging to my script.py
WYN360:
- Reads current script.py
- Adds logging configuration
- Updates functions with log statements
- Preserves existing functionality
Executing Commands
You: Run the analysis script
WYN360: [Generates the command to run]
======================================================================
โ ๏ธ COMMAND EXECUTION CONFIRMATION
======================================================================
Command: python analysis.py
Directory: /current/working/directory
Permissions: Full user permissions
======================================================================
>>> WAITING FOR YOUR RESPONSE <<<
Execute this command? (y/N): y
โ
Command executed successfully
[Shows output]
Note: When you see the confirmation prompt, the "thinking" spinner may still appear in the background. This is normal - just type y and press Enter to proceed, or N to cancel.
๐ฏ Commands
Chat Commands
| Command | Description |
|---|---|
<message> |
Chat with the AI assistant |
Enter |
Submit your message |
Ctrl+Enter |
Add a new line (multi-line input) |
exit or quit |
End the session |
Slash Commands (v0.2.8)
Slash commands provide quick access to context management features:
| Command | Description | Example |
|---|---|---|
/clear |
Clear conversation history and reset token counters | /clear |
/history |
Display conversation history in a table | /history |
/save <file> |
Save current session to JSON file | /save my_session.json |
/load <file> |
Load session from JSON file | /load my_session.json |
/tokens |
Show detailed token usage statistics and costs | /tokens |
/help |
Display help message with all commands | /help |
Example Usage:
You: Write a data analysis script
WYN360: [Creates analysis.py]
You: /tokens
[Shows token usage: 1,500 input tokens, 800 output tokens, $0.02 cost]
You: /save my_analysis_session.json
โ Session saved to: my_analysis_session.json
You: /clear
โ Conversation history cleared. Token counters reset.
You: /load my_analysis_session.json
โ Session loaded from: my_analysis_session.json
๐ Documentation
For comprehensive documentation including:
- Detailed use cases and examples
- Tool descriptions and capabilities
- UV workflow integration
- Best practices and tips
See: USE_CASES.md
๐ ๏ธ Development & Testing
Prerequisites
- Python >= 3.10
- Poetry (package manager)
- Anthropic API key
Setting Up Development Environment
- Clone the repository:
git clone https://github.com/yiqiao-yin/wyn360-cli.git
cd wyn360-cli
- Install Poetry (if not already installed):
curl -sSL https://install.python-poetry.org | python3 -
- Install dependencies:
poetry install
This will:
- Create a virtual environment
- Install all production dependencies from
pyproject.toml - Install development dependencies (pytest, pytest-asyncio, pytest-mock)
- Install the package in editable mode
Running Tests
Run all tests with verbose output:
# Skip command confirmation prompts in tests
WYN360_SKIP_CONFIRM=1 poetry run pytest tests/ -v
Run tests with short traceback:
WYN360_SKIP_CONFIRM=1 poetry run pytest tests/ -v --tb=short
Run specific test file:
poetry run pytest tests/test_agent.py -v
Run specific test class:
poetry run pytest tests/test_utils.py::TestExecuteCommandSafe -v
Run with coverage report:
poetry run pytest tests/ --cov=wyn360_cli --cov-report=html
Test Structure
tests/
โโโ __init__.py
โโโ test_agent.py # Agent and tool tests (29 tests)
โโโ test_cli.py # CLI and slash command tests (18 tests)
โโโ test_utils.py # Utility function tests (29 tests)
# Total: 76 tests
Expected Output
When all tests pass, you should see:
============================= test session starts ==============================
platform linux -- Python 3.10.12, pytest-8.4.2, pluggy-1.6.0
cachedir: .pytest_cache
rootdir: /home/workbench/wyn360-cli/wyn360-cli
configfile: pyproject.toml
plugins: asyncio-1.2.0, mock-3.15.1
collected 76 items
tests/test_agent.py::TestWYN360Agent::test_agent_initialization PASSED [ 1%]
tests/test_agent.py::TestHistoryManagement::test_clear_history PASSED [ 25%]
tests/test_cli.py::TestSlashCommands::test_clear_command PASSED [ 39%]
...
tests/test_utils.py::TestExecuteCommandSafe::test_execute_python_script PASSED [100%]
============================== 76 passed in 1.78s
Building and Publishing
Build the package:
poetry build
This creates:
dist/wyn360_cli-X.Y.Z.tar.gz(source distribution)dist/wyn360_cli-X.Y.Z-py3-none-any.whl(wheel)
Publish to PyPI:
poetry publish
Build and publish in one command:
poetry build && poetry publish
Version Management
Update version in these files:
pyproject.toml-version = "X.Y.Z"wyn360_cli/__init__.py-__version__ = "X.Y.Z"USE_CASES.md- Update changelog and version number
Development Workflow
- Create a feature branch:
git checkout -b feature/your-feature-name
- Make changes and test:
# Make your changes
WYN360_SKIP_CONFIRM=1 poetry run pytest tests/ -v
- Update version and documentation:
# Update version in pyproject.toml, __init__.py, USE_CASES.md
- Commit and push:
git add .
git commit -m "feat: your feature description"
git push origin feature/your-feature-name
- Build and publish:
poetry build && poetry publish
git push origin main
๐งช Environment Variables
| Variable | Description | Default |
|---|---|---|
ANTHROPIC_API_KEY |
Anthropic API key (required) | None |
WYN360_SKIP_CONFIRM |
Skip command execution confirmations | 0 (disabled) |
Set WYN360_SKIP_CONFIRM=1 to skip confirmation prompts (useful for testing or automation).
๐ Requirements
- Python >= 3.10
- Dependencies (automatically installed):
click>=8.1.0- CLI frameworkpydantic-ai>=0.0.1- AI agent frameworkanthropic>=0.39.0- Anthropic API clientrich>=13.0.0- Terminal formattingpython-dotenv>=1.2.1- Environment variable managementprompt-toolkit>=3.0.0- Advanced input handling
๐ค Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Run tests (
WYN360_SKIP_CONFIRM=1 poetry run pytest tests/ -v) - Commit your changes (
git commit -m 'feat: add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
๐ License
This project is licensed under the MIT License - see the LICENSE file for details.
๐ค Author
Yiqiao Yin
- Email: yiqiao.yin@wyn-associates.com
- GitHub: @yiqiao-yin
๐ Acknowledgments
- Built with Anthropic Claude - Advanced AI assistant
- Powered by pydantic-ai - Python agent framework
- CLI framework by Click
- Terminal UI by Rich
๐ Links
- PyPI: https://pypi.org/project/wyn360-cli/
- GitHub: https://github.com/yiqiao-yin/wyn360-cli
- Documentation: USE_CASES.md
- Get API Key: https://console.anthropic.com/
Current Version: 0.2.9 Last Updated: January 2025
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file wyn360_cli-0.2.9.tar.gz.
File metadata
- Download URL: wyn360_cli-0.2.9.tar.gz
- Upload date:
- Size: 21.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.2.1 CPython/3.10.12 Linux/6.6.87.2-microsoft-standard-WSL2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6dd01495620b1f7676caba930d61db8a8e0dde85451e13d4f63fa83aa2c4df21
|
|
| MD5 |
460dd7f64c9cbc80a764603a2b5f9734
|
|
| BLAKE2b-256 |
096f135df741962b1de3fbcaca8d77739058fea83d261e2139b419ff61666c3c
|
File details
Details for the file wyn360_cli-0.2.9-py3-none-any.whl.
File metadata
- Download URL: wyn360_cli-0.2.9-py3-none-any.whl
- Upload date:
- Size: 19.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.2.1 CPython/3.10.12 Linux/6.6.87.2-microsoft-standard-WSL2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4316103bdc93b3f56562889fe14cd9292079c4c47d33302a1619991d5ab8178e
|
|
| MD5 |
5d2bea223b35ac1212e46d4234f2bde2
|
|
| BLAKE2b-256 |
d66d6c6776b8833c6b171708969dab6d26b5590e1d67a92f7328ff931098f9c0
|