Metadata-Version: 2.4
Name: fullstackgenie
Version: 0.2.0
Summary: 智能代码生成器，提升开发效率10倍+
Home-page: https://github.com/yourusername/autocode-gen
Author: AI Assistant
Author-email: AI Assistant <ai@example.com>
License: MIT
Project-URL: Homepage, https://github.com/yourusername/autocode-gen
Project-URL: Documentation, https://github.com/yourusername/autocode-gen/blob/main/README.md
Project-URL: Repository, https://github.com/yourusername/autocode-gen
Project-URL: Bug Tracker, https://github.com/yourusername/autocode-gen/issues
Keywords: code generator,fastapi,flask,django,openapi,sql,docker,kubernetes,codegen
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: Topic :: Software Development :: Code Generators
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
Classifier: Operating System :: OS Independent
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: click>=8.0.0
Requires-Dist: typer>=0.9.0
Requires-Dist: rich>=13.0.0
Requires-Dist: jinja2>=3.1.0
Requires-Dist: pydantic>=2.0.0
Requires-Dist: pyyaml>=6.0
Requires-Dist: python-dotenv>=1.0.0
Provides-Extra: dev
Requires-Dist: pytest>=7.0.0; extra == "dev"
Requires-Dist: pytest-cov>=4.0.0; extra == "dev"
Requires-Dist: pytest-asyncio>=0.21.0; extra == "dev"
Requires-Dist: black>=23.0.0; extra == "dev"
Requires-Dist: flake8>=6.0.0; extra == "dev"
Requires-Dist: mypy>=1.0.0; extra == "dev"
Requires-Dist: isort>=5.12.0; extra == "dev"
Requires-Dist: build>=0.10.0; extra == "dev"
Requires-Dist: twine>=4.0.0; extra == "dev"
Dynamic: author
Dynamic: home-page
Dynamic: license-file
Dynamic: requires-python

# AutoCode-Gen v0.2.0

🚀 **智能代码生成器，提升开发效率10倍+**

AutoCode-Gen 是一个自动化代码生成工具，能够根据 OpenAPI 规范或 SQL DDL 自动生成完整的、可运行的代码。

[![Python Version](https://img.shields.io/badge/python-3.8%2B-blue)](https://www.python.org/)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)

---

## ✨ 核心功能

- **🚀 API代码生成** - 从 OpenAPI 规范生成 FastAPI/Flask/Django 代码
- **🗄️ 模型生成** - 从 SQL DDL 生成 SQLAlchemy/Django ORM 模型
- **🐳 Docker配置** - 生成 Dockerfile 和 docker-compose.yml
- **☸️ K8s部署** - 生成 Kubernetes 部署配置
- **🔄 CI/CD流水线** - 生成 GitHub Actions 工作流

---

## 🚀 快速开始

### 安装

```bash
# 从 PyPI 安装
pip install autocode-gen

# 或者从源码安装
git clone https://github.com/yourusername/autocode-gen.git
cd autocode-gen
pip install -e .
```

### 验证安装

```bash
autocode --version
```

---

## 📖 使用示例

### 1. 从 OpenAPI 生成 API

```bash
# 生成 FastAPI 项目
autocode generate-api openapi.yaml --output ./my_api --framework fastapi

# 生成的文件结构
my_api/
├── app/
│   ├── __init__.py
│   ├── main.py              # FastAPI 主应用
│   ├── api/
│   │   ├── router.py        # API 路由
│   │   └── deps.py          # 依赖注入
│   ├── models/
│   │   └── schemas.py       # Pydantic 模型
│   └── core/
│       ├── config.py        # 配置
│       └── database.py      # 数据库
└── requirements.txt
```

### 2. 从 SQL DDL 生成模型

```bash
# 生成 SQLAlchemy 模型
autocode generate-model schema.sql --output ./my_models --orm sqlalchemy
```

### 3. 生成 Docker 配置

```bash
autocode generate-docker --project-name myapp --output ./docker
```

### 4. 生成 Kubernetes 配置

```bash
autocode generate-k8s --project-name myapp --domain api.example.com --output ./k8s
```

### 5. 生成 CI/CD 配置

```bash
autocode generate-cicd --project-name myapp --output ./.github/workflows
```

---

## 🛠️ 开发

### 环境设置

```bash
# 克隆仓库
git clone https://github.com/yourusername/autocode-gen.git
cd autocode-gen

# 创建虚拟环境
python -m venv venv
source venv/bin/activate  # Linux/Mac
# 或
venv\Scripts\activate  # Windows

# 安装开发依赖
pip install -r requirements-dev.txt
pip install -e .
```

### 运行测试

```bash
# 运行所有测试
pytest

# 运行特定测试
pytest tests/test_parsers.py -v

# 生成覆盖率报告
pytest --cov=autocode --cov-report=html
```

### 代码格式化

```bash
# 格式化代码
make format

# 代码检查
make lint
```

### 构建和发布

```bash
# 清理构建文件
make clean

# 构建包
make build

# 上传到 PyPI 测试环境
make publish-test

# 上传到正式 PyPI
make publish
```

或者使用脚本：

```bash
python build_test.py
```

---

## 📁 项目结构

```
autocode-gen/
├── autocode/              # 主包
│   ├── __init__.py
│   ├── cli.py            # CLI 入口
│   ├── parsers/          # 解析器
│   │   ├── base.py
│   │   ├── openapi.py    # OpenAPI 解析
│   │   └── sql.py        # SQL 解析
│   ├── generators/       # 生成器
│   │   ├── base.py
│   │   ├── api.py        # API 生成
│   │   ├── model.py      # 模型生成
│   │   ├── docker.py     # Docker 配置
│   │   ├── kubernetes.py # K8s 配置
│   │   └── cicd.py       # CI/CD 配置
│   └── templates/        # 模板
├── tests/                # 测试
├── examples/             # 示例
│   ├── openapi.yaml      # 示例 API 规范
│   └── demo.py           # 演示脚本
├── setup.py              # 包配置
├── pyproject.toml        # 项目配置
├── requirements.txt      # 依赖
├── requirements-dev.txt  # 开发依赖
├── Makefile              # 开发命令
├── LICENSE               # 许可证
└── README.md             # 说明文档
```

---

## 📝 示例

### OpenAPI 规范示例

```yaml
openapi: 3.0.0
info:
  title: User API
  version: 1.0.0

paths:
  /users:
    get:
      summary: List users
      responses:
        '200':
          description: Success
    post:
      summary: Create user
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/User'
      responses:
        '201':
          description: Created

components:
  schemas:
    User:
      type: object
      properties:
        id:
          type: integer
        name:
          type: string
        email:
          type: string
```

### 生成的代码示例

```python
# app/api/router.py
from fastapi import APIRouter, Depends
from typing import List

router = APIRouter()

@router.get("/users", response_model=List[UserResponse])
def list_users(skip: int = 0, limit: int = 100):
    return []

@router.post("/users", response_model=UserResponse)
def create_user(user: UserCreate):
    return user
```

---

## 🎯 路线图

### v0.2 (当前)
- ✅ OpenAPI 解析
- ✅ SQL DDL 解析
- ✅ FastAPI 代码生成
- ✅ SQLAlchemy 模型生成
- ✅ Docker 配置生成
- ✅ Kubernetes 配置生成
- ✅ CI/CD 配置生成
- ✅ CLI 界面

### v0.3 (计划中)
- Flask/Django 支持
- 前端组件生成（React/Vue）
- 更多数据库支持
- 模板市场

### v1.0 (未来)
- 可视化配置界面
- AI 智能优化
- 团队协作功能
- SaaS 服务

---

## 🤝 贡献

欢迎提交 Issue 和 PR！

1. Fork 本仓库
2. 创建你的特性分支 (`git checkout -b feature/AmazingFeature`)
3. 提交你的修改 (`git commit -m 'Add some AmazingFeature'`)
4. 推送到分支 (`git push origin feature/AmazingFeature`)
5. 打开一个 Pull Request

---

## 📄 许可证

本项目采用 MIT 许可证 - 查看 [LICENSE](LICENSE) 文件了解详情

---

## 🙏 致谢

- [FastAPI](https://fastapi.tiangolo.com/) - 现代、快速的 Web 框架
- [Typer](https://typer.tiangolo.com/) - 基于 Click 的 CLI 框架
- [Jinja2](https://jinja.palletsprojects.com/) - 强大的模板引擎

---

**Made with ❤️ by AI Assistant**

如果这个项目对你有帮助，请给我们一个 ⭐️ Star！
