From 85ddc6ac8be46f4016949a2c15672e2ae1650aa4 Mon Sep 17 00:00:00 2001 From: xudan Date: Fri, 17 Oct 2025 11:23:42 +0800 Subject: [PATCH] =?UTF-8?q?docs:=20=E6=9B=B4=E6=96=B0=20AGENTS.md=20?= =?UTF-8?q?=E6=96=87=E4=BB=B6=EF=BC=8C=E6=B7=BB=E5=8A=A0=E9=A1=B9=E7=9B=AE?= =?UTF-8?q?=E6=8C=87=E5=8D=97=E3=80=81=E7=BB=93=E6=9E=84=E3=80=81=E6=9E=84?= =?UTF-8?q?=E5=BB=BA=E4=B8=8E=E6=B5=8B=E8=AF=95=E8=AF=B4=E6=98=8E=E3=80=81?= =?UTF-8?q?=E4=BB=A3=E7=A0=81=E9=A3=8E=E6=A0=BC=E8=A7=84=E8=8C=83=E5=8F=8A?= =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=B8=8E=E5=90=88=E5=B9=B6=E8=AF=B7=E6=B1=82?= =?UTF-8?q?=E8=A6=81=E6=B1=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- AGENTS.md | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/AGENTS.md b/AGENTS.md index a8eec6a..596b3a6 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -1,2 +1,46 @@ +# Repository Guidelines + +本仓库为基于 Vite + Vue 3 + TypeScript 的前端项目,依赖 Ant Design Vue、Pinia、Axios 等。统一使用 UTF-8 编码。 + +## 项目结构与模块组织 + +- 源码:`src/`(`components/`、`pages/`、`services/`、`apis/`、`stores/`、`hooks/`、`assets/`) +- 静态资源:`public/` +- 接口模拟:`mocks/`(本地联调示例数据) +- 文档:`docs/` +- 配置:`vite.config.ts`、`tsconfig*.json`、`eslint.config.js` + +## 构建、测试与本地运行 + +- 本地开发:`pnpm start` 或 `npm run start`(启动 Vite 开发服务器) +- 生产构建:`pnpm build` 或 `npm run build`(先 TypeCheck 再打包) +- 本地预览:`pnpm preview` 或 `npm run preview` +- 代码检查:`npx eslint . --ext .ts,.vue` +- 样式检查:`npx stylelint "src/**/*.{vue,scss,css}"` +- 格式化:`npx prettier -w .` + +## 代码风格与命名约定 + +- TypeScript + Vue SFC,缩进 2 空格;单引号;必须分号;`max-len` 120。 +- 组件命名采用帕斯卡命名(例:`RobotLabels.vue`);忽略名:`index.vue`、`exception.vue`。 +- 导入排序使用 `eslint-plugin-simple-import-sort`。 +- 样式使用 SCSS,按 `stylelint` 推荐与 Recess Order。 + +## 测试规范 + +当前未集成单测框架。建议后续采用 Vitest + Vue Test Utils,测试文件命名 `*.spec.ts`,位置 `src/**/__tests__/` 或与源码同级。 + +## 提交与合并请求 + +- 提交遵循 Conventional Commits:`feat|fix|refactor(scope?): 简要中文描述`。 + - 示例:`feat(editor): 新增导入场景模态框` +- PR 需包含:变更说明、影响范围、操作步骤/截图(UI 变更)、关联 Issue、风险与回滚方案。 +- 在提交前确保:通过构建与 ESLint/Stylelint/Prettier 检查。 + +## 安全与配置提示 + +- 后端地址与令牌从环境变量读取:`ENV_HTTP_BASE`、`ENV_DEV_TOKEN`、`ENV_DEV_TENANT_ID`(见 `src/services/http.ts`)。请在 `.env.development`/`.env.production` 配置。 +- 避免将敏感信息写入仓库;调试日志仅限开发环境。 + -Always reply to me in Chinese 文件编码使用 UTF‑8