mirror of
https://gitee.com/pnoker/iot-dc3.git
synced 2026-11-01 02:31:46 +08:00
AGENTS.md stays lean with always-relevant rules and a task routing
table; the deep per-area conventions move to
dc3/agents/{backend,frontend,cli,testing}.md to be read on demand.
CONTRIBUTING.md documents the changelog-only commit rule and the
generated-CHANGE.md editing policy.
Co-Authored-By: Claude Code <noreply@anthropic.com>
2.3 KiB
2.3 KiB
Frontend conventions
Read this when changing dc3-web/. Entry point and cross-cutting rules: AGENTS.md.
Executable configuration is the source of truth:
- dependencies, package-manager version, and scripts:
dc3-web/package.jsonandpnpm-lock.yaml; - TypeScript behaviour:
dc3-web/tsconfig.json; - Vite, proxy, environment, and SCSS behaviour:
dc3-web/vite.config.ts; - test configuration:
dc3-web/vitest.config.tsandplaywright.config.ts; - container toolchain pins:
dc3-web/Dockerfile.
Use pnpm only; do not create npm or Yarn lockfiles. Keep package-manager pins aligned between package.json and the
Dockerfile.
Key rules:
verbatimModuleSyntaxis enabled. Useimport typefor every type-only import; Vue components, functions, and icons remain normal value imports.- Use
<Entity>Formfor create/update payloads and<Entity>Recordfor read responses. - Represent Java 64-bit IDs as strings. The backend emits identifiers as JSON strings on the HTTP contract, so standard JSON parsing (no JSONBigInt) is sufficient.
- API wrappers mirror backend cardinality:
getXxxfor one value,listXxxfor collections/maps/pages, andaddXxx/updateXxx/deleteXxxfor mutations. - Reuse CRUD helpers from
src/api/common.tsand API bases fromsrc/config/constant/api.ts; keep API wrappers thin. - Prefer
<script setup>, Composition API, setup-style Pinia stores, and existing composables. - Every router-guard branch must settle navigation. Prefer return-style guards for new code and cover guard changes with tests.
- Axios interceptors own authentication headers and 401 handling; do not duplicate that logic in feature APIs.
- Vite dotenv files live under
src/config/env/and use theAPP_prefix. - Global Element Plus variables are injected by Vite; do not duplicate their
@usedirectives in components. - Menu changes may require synchronized backend seed data,
settingsNav.ts, router definitions, i18n locales,Layout.vue, andSettings.vuechanges.
Checks, run from dc3-web/:
pnpm check
pnpm lint:check
pnpm test:guard
pnpm test:ci
pnpm build
Use affected Vitest suites for focused changes and Playwright for browser-level workflows. Coverage thresholds belong in
vitest.config.ts; do not duplicate their numbers here.