feat
This commit is contained in:
25
.kilocode/rules-architect/AGENTS.md
Normal file
25
.kilocode/rules-architect/AGENTS.md
Normal file
@@ -0,0 +1,25 @@
|
||||
# Architect Mode Rules (Non-Obvious Only)
|
||||
|
||||
## Architecture Overview
|
||||
- Vue 3 SPA with dynamic route loading from server
|
||||
- Pinia stores: `app`, `user`, `tab-bar` (see [`src/store/`](src/store/))
|
||||
- Two-layer route guard: user login check + permission check
|
||||
|
||||
## Dynamic Route System
|
||||
- Server menu fetched in [`app store`](src/store/modules/app/index.ts) via `fetchServerMenuConfig()`
|
||||
- Routes registered dynamically in [`permission.ts`](src/router/guard/permission.ts)
|
||||
- Uses `isMenuLoading`/`isMenuLoaded` flags to prevent duplicate loads
|
||||
|
||||
## API Architecture
|
||||
- Two axios instances for different auth patterns:
|
||||
- [`request.ts`](src/api/request.ts): Workspace header + custom token format
|
||||
- [`interceptor.ts`](src/api/interceptor.ts): Bearer token + code 20000 validation
|
||||
- Choose based on backend API requirements
|
||||
|
||||
## State Management
|
||||
- [`SafeStorage`](src/utils/safeStorage.ts) required for all localStorage access
|
||||
- Supports TTL expiry and type-safe keys via enum
|
||||
|
||||
## Component Patterns
|
||||
- Global components registered in [`components/index.ts`](src/components/index.ts)
|
||||
- ECharts modules manually imported for bundle size optimization
|
||||
19
.kilocode/rules-ask/AGENTS.md
Normal file
19
.kilocode/rules-ask/AGENTS.md
Normal file
@@ -0,0 +1,19 @@
|
||||
# Ask Mode Rules (Non-Obvious Only)
|
||||
|
||||
## Project Structure
|
||||
- Vue 3 + Arco Design admin template with Pinia state management
|
||||
- Vite config files located in `config/` directory (not root)
|
||||
|
||||
## Key Directories
|
||||
- `src/api/` - API layer with two axios instances
|
||||
- `src/views/ops/` - Main business modules (kb, netarch, asset, etc.)
|
||||
- `src/router/guard/` - Route guards including dynamic menu loading
|
||||
- `src/store/modules/app/` - App store with server menu fetching
|
||||
|
||||
## Documentation References
|
||||
- Arco Design Vue: https://arco.design/vue
|
||||
- Vue Flow (for topology): https://vueflow.dev/
|
||||
|
||||
## API Patterns
|
||||
- Use [`request.ts`](src/api/request.ts) for workspace-aware requests
|
||||
- Use [`interceptor.ts`](src/api/interceptor.ts) for standard Bearer token auth
|
||||
13
.kilocode/rules-code/AGENTS.md
Normal file
13
.kilocode/rules-code/AGENTS.md
Normal file
@@ -0,0 +1,13 @@
|
||||
# Code Mode Rules (Non-Obvious Only)
|
||||
|
||||
## API Layer
|
||||
- Two axios instances exist: [`request.ts`](src/api/request.ts) (custom with workspace header) and [`interceptor.ts`](src/api/interceptor.ts) (global with Bearer token). Choose based on whether you need workspace support.
|
||||
|
||||
## Storage
|
||||
- Always use [`SafeStorage`](src/utils/safeStorage.ts) with `AppStorageKey` enum - never use localStorage directly. Supports TTL via third parameter.
|
||||
|
||||
## useRequest Hook
|
||||
- [`useRequest()`](src/hooks/request.ts) invokes API immediately - does NOT work in async functions. Pass params via `.bind(null, params)` pattern.
|
||||
|
||||
## Dynamic Routes
|
||||
- Routes loaded from server in [`permission.ts`](src/router/guard/permission.ts) using `isMenuLoading`/`isMenuLoaded` flags. Don't modify these flags manually.
|
||||
17
.kilocode/rules-debug/AGENTS.md
Normal file
17
.kilocode/rules-debug/AGENTS.md
Normal file
@@ -0,0 +1,17 @@
|
||||
# Debug Mode Rules (Non-Obvious Only)
|
||||
|
||||
## API Response Codes
|
||||
- [`interceptor.ts`](src/api/interceptor.ts) expects `code: 20000` for success. Other codes trigger error messages.
|
||||
- Token expiry codes: 50008, 50012, 50014 trigger logout modal.
|
||||
|
||||
## Token Storage
|
||||
- Tokens stored via [`SafeStorage`](src/utils/safeStorage.ts) with key `AppStorageKey.TOKEN`.
|
||||
- Token expiry redirects to `/auth/login` (not `/login`).
|
||||
|
||||
## Route Loading Issues
|
||||
- If routes not loading, check `isMenuLoading`/`isMenuLoaded` flags in [`permission.ts`](src/router/guard/permission.ts).
|
||||
- Server menu fetched via [`fetchServerMenuConfig()`](src/store/modules/app/index.ts).
|
||||
|
||||
## Environment
|
||||
- Dev config: `.env.development`, Prod config: `.env.production`
|
||||
- API base URL: `VITE_API_BASE_URL`, Workspace: `VITE_APP_WORKSPACE`
|
||||
36
AGENTS.md
Normal file
36
AGENTS.md
Normal file
@@ -0,0 +1,36 @@
|
||||
# AGENTS.md
|
||||
|
||||
This file provides guidance to agents when working with code in this repository.
|
||||
|
||||
## Build Commands
|
||||
- `pnpm dev` - Start dev server (config: `config/vite.config.dev.ts`)
|
||||
- `pnpm build` - Production build (config: `config/vite.config.prod.ts`)
|
||||
- `pnpm lint` - Run ESLint + Prettier
|
||||
- No test framework configured
|
||||
|
||||
## Critical Architecture Notes
|
||||
|
||||
### Vite Config Location
|
||||
Config files are in `config/` directory, NOT root. All vite commands reference `./config/vite.config.*.ts`.
|
||||
|
||||
### Two Axios Instances
|
||||
- [`src/api/request.ts`](src/api/request.ts) - Custom instance with workspace header support and `needWorkspace` param
|
||||
- [`src/api/interceptor.ts`](src/api/interceptor.ts) - Global instance with Bearer token and code 20000 validation
|
||||
|
||||
### Storage Pattern
|
||||
Use [`SafeStorage`](src/utils/safeStorage.ts) instead of localStorage directly. Supports TTL expiry and type-safe keys via `AppStorageKey` enum.
|
||||
|
||||
### Dynamic Route Loading
|
||||
Routes are loaded from server via [`fetchServerMenuConfig()`](src/store/modules/app/index.ts) with permission guard in [`permission.ts`](src/router/guard/permission.ts). Uses flags `isMenuLoading`/`isMenuLoaded` to prevent duplicate loads.
|
||||
|
||||
### useRequest Hook Limitation
|
||||
[`useRequest()`](src/hooks/request.ts) does NOT work in async functions - it immediately invokes the API. Use `.bind(null, params)` to pass arguments.
|
||||
|
||||
## Code Style
|
||||
- No semicolons (Prettier enforced)
|
||||
- Single quotes, trailing commas (es5)
|
||||
- Print width: 140 characters
|
||||
- Path alias: `@/` → `src/`
|
||||
|
||||
## Vue/i18n Aliases Required
|
||||
Vite config includes aliases for `vue-i18n/dist/vue-i18n.cjs.js` and `vue/dist/vue.esm-bundler.js` - don't remove these.
|
||||
Reference in New Issue
Block a user