Metadata-Version: 2.4
Name: zeoncoding-cli
Version: 1.7.0
Summary: A self-thinking CLI with context memory and autonomous learning
Author-email: Zeon7744 <zeon7744@gmail.com>
License: MIT
Keywords: ai,cli,coding,memory,learning,autonomous
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: click>=8.1.0
Requires-Dist: rich>=13.0.0
Requires-Dist: pyyaml>=6.0
Requires-Dist: jsonschema>=4.17.0
Requires-Dist: colorama>=0.4.6
Provides-Extra: dev
Requires-Dist: pytest>=7.0; extra == "dev"
Requires-Dist: pytest-cov>=4.0; extra == "dev"
Requires-Dist: black>=23.0; extra == "dev"
Requires-Dist: flake8>=6.0; extra == "dev"
Requires-Dist: mypy>=1.0; extra == "dev"
Provides-Extra: ai
Requires-Dist: openai>=1.0.0; extra == "ai"
Requires-Dist: anthropic>=0.18.0; extra == "ai"
Dynamic: license-file

# 🧠 ZeonCoding CLI

> **自带上下文思考的 AI 编程助手** — 自动作业、自动思考、自动学习，拥有持久化记忆

[![GitHub Stars](https://img.shields.io/github/stars/Zeon7744/zeoncoding-cli?style=social)](https://github.com/Zeon7744/zeoncoding-cli)
[![GitHub Forks](https://img.shields.io/github/forks/Zeon7744/zeoncoding-cli?style=social)](https://github.com/Zeon7744/zeoncoding-cli/forks)
[![GitHub License](https://img.shields.io/github/license/Zeon7744/zeoncoding-cli)](https://github.com/Zeon7744/zeoncoding-cli/blob/main/LICENSE)
[![Gitee Stars](https://gitee.com/Zeon7744/zeoncoding-cli/badge/star.svg?theme=gvp)](https://gitee.com/Zeon7744/zeoncoding-cli)
[![Python 3.8+](https://img.shields.io/badge/python-3.8+-blue.svg)](https://www.python.org/)
[![Test Coverage](https://img.shields.io/badge/coverage-77%25-green.svg)](https://github.com/Zeon7744/zeoncoding-cli/actions)
[![PyPI version](https://img.shields.io/pypi/v/zeoncoding-cli.svg)](https://pypi.org/project/zeoncoding-cli/)

---

## 📌 这是 GitHub 官方主仓

> **Gitee 镜像**: [gitee.com/Zeon7744/zeoncoding-cli](https://gitee.com/Zeon7744/zeoncoding-cli)  
> **PyPI**: [pypi.org/project/zeoncoding-cli](https://pypi.org/project/zeoncoding-cli/)

Issues 和 PR 请在 GitHub 提交。

---

## ✨ 核心特性

| 特性 | 说明 |
|------|------|
| 🧠 **上下文记忆** | 三层记忆系统：会话记忆、项目上下文、长期记忆 |
| 💭 **自动思考** | 意图识别 + 假设生成 + 验证 + 结论形成 |
| 📚 **自主学习** | 从交互中学习模式，自动推荐相似解决方案 |
| 🔍 **智能搜索** | 基于相关性的记忆搜索，支持关键词和标签 |
| 📊 **统计分析** | 实时监控记忆统计、学习成功率 |
| 🔄 **跨会话持久化** | 记忆数据跨会话保留，越用越聪明 |

---

## 🚀 快速开始

### 安装

```bash
# 从 PyPI 安装
pip install zeoncoding-cli

# 或使用源码
git clone https://github.com/Zeon7744/zeoncoding-cli.git
cd zeoncoding-cli
pip install -e .
```

### 基本使用

```bash
# 初始化项目
vibe init --project ./my-project

# 提问并启用思考
vibe ask "如何优化 Python 代码性能?" --think

# 记住重要信息
vibe remember project_arch "采用微服务架构" -c architecture -t "architecture,microservice"

# 查看对话历史
vibe history -n 20

# 查看项目上下文
vibe context

# 查看长期记忆
vibe memories -d 7

# 查看系统统计
vibe stats
```

### 交互式模式

```bash
# 启动交互式 shell
vibe shell

# 在 shell 中
> ask 如何修复这个 bug? --think --learn
> remember solution "需要添加异常处理" -c bugfix
> history
> exit
```

---

## 🏗️ 架构设计

### 三层记忆系统

```
┌─────────────────────────────────────────┐
│         LongTermMemory (长期记忆)        │
│   • 跨会话持久化                        │
│   • 重要性评分                          │
│   • 标签分类                            │
└─────────────────┬───────────────────────┘
                  │
┌─────────────────▼───────────────────────┐
│        ContextMemory (项目上下文)        │
│   • 项目级配置                          │
│   • 分类管理                            │
│   • 过期机制                            │
└─────────────────┬───────────────────────┘
                  │
┌─────────────────▼───────────────────────┐
│         SessionMemory (会话记忆)         │
│   • 消息历史                            │
│   • 上下文状态                          │
│   • 临时数据                            │
└─────────────────────────────────────────┘
```

### 思考引擎流程

```
Query → 意图分析 → 假设生成 → 验证 → 结论
   ↓
上下文收集 ← 历史记忆检索
```

### 学习引擎流程

```
交互记录 → 模式检测 → 相似度匹配 → 推荐解决方案
```

---

## 📖 API 使用

### Python 代码中使用

```python
from zeoncoding.memory import SessionMemory, ContextMemory, LongTermMemory
from zeoncoding.thinking import ThinkingEngine
from zeoncoding.learning import LearningEngine

# 初始化记忆系统
session = SessionMemory()
context = ContextMemory(project_path=".")
long_term = LongTermMemory()

# 初始化工具
thinker = ThinkingEngine(session, context, long_term)
learner = LearningEngine(long_term)

# 使用思考引擎
result = thinker.think("如何实现快速排序？")
print(result["conclusion"])

# 使用学习引擎
learner.learn_from_interaction(
    query="如何实现快速排序？",
    response="快速排序...[代码]",
    success=True
)

# 获取相似解决方案
similar = learner.get_similar_solutions("排序算法优化")
```

---

## 🧪 测试

```bash
# 运行所有测试
pytest tests/ -v

# 运行测试并显示覆盖率
pytest tests/ -v --cov=zeoncoding --cov-report=term-missing

# 运行特定模块测试
pytest tests/test_memory.py -v
pytest tests/test_thinking.py -v
pytest tests/test_learning.py -v
```

---

## 📊 项目统计

| 指标 | 数值 |
|------|------|
| **代码行数** | 685 行 |
| **测试用例** | 32 个 |
| **覆盖率** | 77% |
| **通过率** | 100% |

---

## 🔧 配置

### 环境配置

创建 `~/.zeoncoding/config.yaml`：

```yaml
memory:
  storage_path: "~/.zeoncoding/data"
  auto_save: true
  max_messages: 1000

thinking:
  max_iterations: 3
  default_confidence_threshold: 0.7

learning:
  max_patterns_per_type: 100
  similarity_threshold: 0.3
```

---

## 🎯 使用场景

### 场景 1：项目初始化

```bash
# 快速记录项目关键信息
vibe remember db_host "postgres://localhost:5432/mydb" -c database
vibe remember api_key "sk-xxx" -c credentials -t "secret"
vibe remember tech_stack "FastAPI + PostgreSQL + Redis" -c architecture
```

### 场景 2：智能问答

```bash
# 带思考的回答
vibe ask "如何优化数据库查询性能?" --think

# 带学习的回答（会记住你的偏好）
vibe ask "如何设计 REST API?" --think --learn
```

### 场景 3：错误调试

```bash
# 自动分析错误
vibe ask "RuntimeError: database connection failed" --think

# 记录解决方案
vibe remember "添加重试机制和连接池配置" -c fix -t "database,error"
```

---

## 📈 版本历史

| 版本 | 日期 | 变更 |
|------|------|------|
| v1.0.0 | 2026-09-25 | 初始发布，核心功能完成 |

---

## 🤝 贡献指南

欢迎贡献！请遵循以下步骤：

1. Fork 本仓库
2. 创建特性分支 (`git checkout -b feature/amazing-feature`)
3. 提交更改 (`git commit -m 'Add amazing feature'`)
4. 推送到分支 (`git push origin feature/amazing-feature`)
5. 开启 Pull Request

### 代码规范

- 使用 `black` 格式化代码
- 保持测试覆盖率 ≥ 75%
- 遵循 PEP 8 规范

---

## ☕ 支持作者

如果这个项目对你有帮助，欢迎赞助 ☕

| 渠道 | 方式 |
|------|------|
| [爱发电](https://afdian.com/@Zeon7744) | 支付宝 / 微信支付 |
| [GitHub Sponsors](https://github.com/sponsors/Zeon7744) | PayPal / Stripe |

---

## 📄 License

MIT License

---

<div align="center">

**由 [Zeon7744](https://github.com/Zeon7744) 维护**  
*自带思考的 AI 编程助手*

⭐ 如果对你有帮助，点个 Star 鼓励一下！

</div>

## 🤖 AI 集成

ZeonCoding CLI 支持集成 OpenAI 和 Anthropic Claude API：

```bash
# 使用 OpenAI
export OPENAI_API_KEY="sk-..."
vibe ask "如何优化这段代码?" --think

# 使用 Claude  
export ANTHROPIC_API_KEY="sk-ant-..."
vibe ask "分析这个项目架构" --think
```

## 🔌 插件系统

在 `~/.zeoncoding/plugins/` 目录下创建插件：

```json
// plugin.json
{
  "name": "my-plugin",
  "version": "1.0.0",
  "description": "我的自定义插件",
  "author": "Zeon7744",
  "commands": ["mycmd"],
  "enabled": true
}
```

```python
# plugin.py
def my_command(ctx, args):
    console.print("Hello from plugin!")
```

查看已安装插件：
```bash
vibe plugins list
```

## 📊 项目统计

| 指标 | 数值 |
|------|------|
| 代码行数 | 879 行 |
| Python 文件 | 24 个 |
| 测试用例 | 43 个 |
| 覆盖率 | 74% |
| 通过率 | 100% |

## 🔗 相关链接

- **GitHub**: https://github.com/Zeon7744/vibecoding-cli
- **Release**: https://github.com/Zeon7744/vibecoding-cli/releases
- **PyPI**: https://pypi.org/project/zeoncoding-cli/

---

**License**: MIT  
**Author**: Zeon7744
