Files
front/.kilocode/rules-code/AGENTS.md

22 lines
912 B
Markdown
Raw Normal View History

2026-03-21 22:47:42 +08:00
# Code Mode Rules (Non-Obvious Only)
2026-07-05 21:21:53 +08:00
## Development Constraints
- Code is not deployed yet; do not spend effort preserving backward compatibility with old code.
2026-03-21 22:47:42 +08:00
## API Layer
2026-05-02 09:59:06 +08:00
2026-03-21 22:47:42 +08:00
- 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
2026-05-02 09:59:06 +08:00
2026-03-21 22:47:42 +08:00
- Always use [`SafeStorage`](src/utils/safeStorage.ts) with `AppStorageKey` enum - never use localStorage directly. Supports TTL via third parameter.
## useRequest Hook
2026-05-02 09:59:06 +08:00
2026-03-21 22:47:42 +08:00
- [`useRequest()`](src/hooks/request.ts) invokes API immediately - does NOT work in async functions. Pass params via `.bind(null, params)` pattern.
## Dynamic Routes
2026-05-02 09:59:06 +08:00
- Routes loaded from server in [`permission.ts`](src/router/guard/permission.ts) using `isMenuLoading`/`isMenuLoaded` flags. Don't modify these flags manually.