web-map/AGENTS.md

47 lines
2.1 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.

# 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
文件编码使用 UTF8