Files
webUI/AGENTS.md
2025-11-04 19:25:16 +08:00

2.4 KiB

Repository Guidelines

Project Structure & Module Organization

  • Source: src/ (entry src/main.js, app shell src/App.vue).
  • Pages: src/pages/** with Uni-App routing in src/pages.json (e.g., pages/index/index.vue).
  • UI Components: src/components/ (reusable, app-agnostic).
  • State: src/stores/ (Pinia stores).
  • Utilities: src/utils/; Styles: src/styles/, global src/uni.scss.
  • Assets: src/static/.
  • Build output: dist/; temp and logs: temp/, logs/.
  • Tooling: vite.config.js, manifest.json, index.html.

Build, Test, and Development Commands

  • Install: npm install
  • Dev (H5): npm run dev:h5 — start Vite + Uni dev server.
  • Dev (Weixin Mini Program): npm run dev:mp-weixin
  • Build (H5): npm run build:h5
  • Build (Weixin Mini Program): npm run build:mp-weixin
  • Custom target: npm run dev:custom -- -p <platform> (e.g., mp-alipay).
  • Output is written to dist/.

Coding Style & Naming Conventions

  • Indentation: 2 spaces; trailing spaces trimmed.
  • Vue 3 SFCs: prefer <script setup> for new code; keep existing style consistent nearby.
  • Components: PascalCase filenames in src/components/ (e.g., UserCard.vue).
  • Pages: lowercase directory + index.vue (e.g., pages/chat/index.vue).
  • JS naming: camelCase for variables/functions; PascalCase for classes; SCSS/CSS files kebab-case.
  • State: one Pinia store per domain in src/stores/ (e.g., useUserStore).

Testing Guidelines

  • Automated tests are not configured. If adding, use @dcloudio/uni-automator and place specs under tests/**/*.spec.{js,ts}.
  • For changes, provide a manual test plan covering H5 and at least one mini-program target (e.g., Weixin).

Commit & Pull Request Guidelines

  • Commits: follow Conventional Commits where possible (e.g., feat: add chat history panel, fix: debounce voice upload).
  • PRs must include: purpose/summary, linked issues, screenshots or screen recordings for UI, test plan (platforms, steps), and any config changes.
  • Keep diffs focused; avoid noisy refactors in feature PRs.

Security & Configuration Tips

  • Do not commit secrets; prefer environment config via Vite (import.meta.env) and platform-specific secure storage.
  • logs/ and temp/ are ephemeral; keep them out of commits.

Agent-Specific Instructions

  • Respect structure and naming above; avoid file moves unless requested.
  • Scope changes to the smallest relevant area; update docs when paths or commands change.