AGENTS.md 2.4 KB

AGENTS.md — ui_template

Tech stack

Vue 3 (<script setup>, Composition API) + TypeScript 5.8 + Vite 6 + Element Plus 2.13 + Pinia 3 + Vue Router 4 + Axios. No preprocessor (plain CSS + scoped styles). No test framework. No ESLint. npm (lockfile v3). Node >=18.

Commands

Command What it does
npm run dev Vite dev server (proxies /apihttp://localhost:8080, strips prefix)
npm run build vue-tsc -b && vite build — type-check must pass before build
npm run preview Vite preview of built output
npm run api:gen Runs Orval — requires backend at localhost:8080 with /v3/api-docs

Format only with npx prettier --write . (no config file, uses Prettier defaults).

Key constraints

  • src/api/ is auto-generated by Orval. Never hand-edit files under src/api/ or src/api/models/. Edit the OpenAPI spec (backend) instead, then re-run npm run api:gen.
  • @/ path alias maps to ./src/ (configured in both tsconfig and vite).
  • npm run build runs vue-tsc -b first — unused locals/params (noUnusedLocals, noUnusedParameters) cause build failure.
  • erasableSyntaxOnly: true — no enums, no namespaces, no constructor parameter properties.
  • Pinia persistence via pinia-plugin-persistedstate — both stores (meta, user) have persist: true (localStorage). Auth token is persisted there, not manually in localStorage.
  • Axios interceptor reads token from Pinia user store (injected as Bearer header). 401 response auto-redirects to /login.

Architecture notes

  • Entry: src/main.ts → creates Vue app, installs Pinia → Router → ElementPlus → mounts #app.
  • Router: history mode. Route meta requiresAdmin: true gates admin routes via beforeEach guard.
  • API layer: Orval-generated factories (getAuthController, getUserController) use custom Axios instance from src/util/axios-instance.ts.
  • Views: LoginView (auth), UserView (admin CRUD), HomeView, AboutView.
  • Layouts: UserLayout (public, horizontal nav), AdminLayout (sidebar + header).
  • No unit/e2e tests exist — no test dependencies, no test runner config.

Git remote

Remote URL Push allowed?
gogs git@git.anyi.space:gdit/lt_ui.git Yes — team repo, always push here
origin git@git.anyi.space:yangyi/ui_template.git No — personal fork, never push

Always use git push gogs. Never push to origin.