forked from mengyxu/noob-components
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
80 lines
2.6 KiB
80 lines
2.6 KiB
|
3 months ago
|
# Fill plugs/api spec
|
||
|
|
|
||
|
|
## Goal
|
||
|
|
Analyze the `plugs/api/` directory and fill the coding spec with real API patterns, request/response types, and anti-patterns.
|
||
|
|
|
||
|
|
## Context
|
||
|
|
|
||
|
|
### Project Overview
|
||
|
|
- **Type**: Vue 3 Component Library (Element Plus based)
|
||
|
|
- **Framework**: Vue 3 + TypeScript + Vite
|
||
|
|
- **Key Patterns**: Composables, API Layer, Store Pattern
|
||
|
|
|
||
|
|
### Architecture
|
||
|
|
The `plugs/api/` directory provides typed API functions that wrap HTTP calls. These are used by composables and components to interact with backend services.
|
||
|
|
|
||
|
|
### Key API Modules (from GitNexus)
|
||
|
|
| Module | File | Purpose |
|
||
|
|
|--------|------|---------|
|
||
|
|
| user | plugs/api/user.ts | User CRUD operations |
|
||
|
|
| role | plugs/api/role.ts | Role management |
|
||
|
|
| permission | plugs/api/permission.ts | Permission management |
|
||
|
|
| dictionary | plugs/api/dictionary.ts | Dictionary data |
|
||
|
|
| config | plugs/api/config.ts | System config |
|
||
|
|
| log | plugs/api/log.ts | Log operations |
|
||
|
|
| public | plugs/api/public.ts | Public endpoints |
|
||
|
|
| buffer | plugs/api/buffer.ts | Buffer operations |
|
||
|
|
| base | plugs/api/base.ts | Base API utilities |
|
||
|
|
|
||
|
|
### Execution Flows
|
||
|
|
- `Get → Close` (read operations)
|
||
|
|
- `Put → Close` (update operations)
|
||
|
|
- `Post → Close` (create operations)
|
||
|
|
- `Del → Close` (delete operations)
|
||
|
|
- `Upload → Close` (file upload)
|
||
|
|
|
||
|
|
## Tools Available
|
||
|
|
|
||
|
|
### GitNexus MCP
|
||
|
|
| Tool | Purpose |
|
||
|
|
|------|---------|
|
||
|
|
| `gitnexus_query` | Find execution flows related to API calls |
|
||
|
|
| `gitnexus_context` | View API function definitions |
|
||
|
|
| `gitnexus_cypher` | Query API-related symbols |
|
||
|
|
|
||
|
|
### ABCoder MCP
|
||
|
|
| Tool | Purpose |
|
||
|
|
|------|---------|
|
||
|
|
| `get_file_structure` | Get all exports from API files |
|
||
|
|
|
||
|
|
## Files to Fill
|
||
|
|
|
||
|
|
### Primary files:
|
||
|
|
1. **plugs/api/base.ts** - Base API utilities, common patterns
|
||
|
|
2. **plugs/api/user.ts** - User API with all CRUD operations
|
||
|
|
3. **plugs/api/role.ts** - Role management API
|
||
|
|
4. **plugs/api/permission.ts** - Permission API
|
||
|
|
5. **plugs/api/dictionary.ts** - Dictionary API
|
||
|
|
6. **plugs/api/config.ts** - Config API
|
||
|
|
7. **plugs/api/log.ts** - Log API
|
||
|
|
8. **plugs/api/public.ts** - Public endpoints
|
||
|
|
9. **plugs/api/buffer.ts** - Buffer API
|
||
|
|
|
||
|
|
### Document:
|
||
|
|
- Request/response type patterns
|
||
|
|
- Error handling conventions
|
||
|
|
- URL naming conventions
|
||
|
|
- Common patterns across all API files
|
||
|
|
|
||
|
|
## Acceptance Criteria
|
||
|
|
- [ ] Real code examples with file paths
|
||
|
|
- [ ] API function signatures documented
|
||
|
|
- [ ] Type definitions captured
|
||
|
|
- [ ] Anti-patterns documented (if any)
|
||
|
|
- [ ] No placeholder text
|
||
|
|
|
||
|
|
## Technical Notes
|
||
|
|
- HTTP client: Axios (axios, axios2, axios3 variants in plugs/http/)
|
||
|
|
- Returns: Typically Promise with typed responses
|
||
|
|
- Related: plugs/http/* for HTTP client configs
|