Files
rui-docs/AGENTS.md
T
vifo 509812e9b0 docs: 添加 AI 开发边界配置
明确前端 AI 的职责范围和禁止事项
2026-06-04 08:13:53 +08:00

84 lines
2.2 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# AI 开发边界配置 - 前端仓库
> **警告**:本文件定义 AI 的开发边界,AI 必须严格遵守!
## 🎯 本仓库职责
**rui-frontend** 是睿核科技的前端工程集合,包含:
- `admin-ui` - 管理后台(Vue3 + TypeScript
- `cashier-mobile` - 收银移动端
- `customer-mobile` - 顾客移动端
## 🚫 绝对禁止
1. **禁止修改后端代码** - 本仓库只有前端代码
2. **禁止修改 API 接口定义** - 接口定义在后端仓库
3. **禁止直接访问数据库** - 必须通过 REST API
4. **禁止引入后端依赖** - 如 Spring, MyBatis 等
## ✅ 允许范围
```
rui-frontend/
├── admin-ui/ ✅ 可修改
│ ├── src/
│ ├── public/
│ └── package.json
├── cashier-mobile/ ✅ 可修改
├── customer-mobile/ ✅ 可修改
├── package.json ✅ 可修改(根配置)
└── pnpm-workspace.yaml ✅ 可修改
```
## 🔗 与后端通信规范
### 1. API 调用方式
- 使用 **Axios****Fetch** 发送 HTTP 请求
- 禁止直接引用后端 Java 类
### 2. 接口地址规范
```typescript
// 正确示例
const API_BASE = '/api'; // 通过网关转发
const userApi = {
getList: () => axios.get(`${API_BASE}/user/list`),
create: (data) => axios.post(`${API_BASE}/user`, data)
};
```
### 3. 数据类型定义
- 前端自行定义 TypeScript 接口
- 与后端 DTO 保持一致(但不直接引用)
```typescript
// 前端自定义类型
interface UserDTO {
id: number;
username: string;
// ...
}
```
## 📝 编码规范
1. **框架**Vue 3 + TypeScript + Vite
2. **包管理器**pnpm(强制使用)
3. **代码风格**:遵循项目现有 ESLint 配置
4. **组件规范**:使用组合式 API(setup 语法)
## 🔔 当需要后端支持时
如果前端需要新的 API 接口:
1. **不要自己创建后端代码**
2. 在后端仓库的 Issue 中提需求
3. 等待后端提供接口后再联调
## 📞 协作方式
- **前端 AI**:只负责 rui-frontend 仓库
- **后端 AI**:负责 spring-ai 仓库提供 API
- **沟通方式**:通过 Gitea Issue / 钉钉通知
---
> **最后提醒**:AI 必须严格限制在本仓库范围内开发,禁止跨仓库修改代码!