feat: 初始化前后端Node.js控制台项目基础架构

- 创建项目核心文件:package.json、vite.config.js、.gitignore
- 添加前后端基础依赖和开发工具配置
- 完善OpenSpec模块,包括项目文档和核心能力规格
- 配置ESLint和Prettier代码规范
- 创建基本目录结构
- 实现前端Vue3应用框架和路由
- 添加后端Express服务器和基础路由
- 编写README项目说明文档
This commit is contained in:
2026-01-08 11:46:34 +08:00
commit 5f0fa79606
29 changed files with 6181 additions and 0 deletions

View File

@@ -0,0 +1,97 @@
# Command Capability Specification
## Overview
This specification defines the command capability for the BLS Project Console, which allows users to send console commands to Redis queues for other programs to read and execute.
## Requirements
### Requirement: Command Sending to Redis
The system SHALL send commands to a Redis queue.
#### Scenario: Sending a command to Redis queue
- **WHEN** the user enters a command in the console
- **AND** clicks the "Send" button
- **THEN** the command SHALL be sent to the Redis queue
- **AND** the user SHALL receive a success confirmation
### Requirement: Command Validation
The system SHALL validate commands before sending them to Redis.
#### Scenario: Validating an empty command
- **WHEN** the user tries to send an empty command
- **THEN** the system SHALL display an error message
- **AND** the command SHALL NOT be sent to Redis
#### Scenario: Validating a command with invalid characters
- **WHEN** the user tries to send a command with invalid characters
- **THEN** the system SHALL display an error message
- **AND** the command SHALL NOT be sent to Redis
### Requirement: Command History
The system SHALL maintain a history of sent commands.
#### Scenario: Viewing command history
- **WHEN** the user opens the command history
- **THEN** the system SHALL display a list of previously sent commands
- **AND** the user SHALL be able to select a command from the history to resend
### Requirement: Command Response Handling
The system SHALL handle responses from commands sent to Redis.
#### Scenario: Receiving a command response
- **WHEN** a command response is received from Redis
- **THEN** the system SHALL display the response in the console
- **AND** the response SHALL be associated with the original command
## Data Model
### Command
```json
{
"id": "string",
"content": "string",
"timestamp": "ISO-8601 string",
"status": "string" // e.g., sent, processing, completed, failed
}
```
### Command Response
```json
{
"id": "string",
"commandId": "string",
"timestamp": "ISO-8601 string",
"status": "string", // e.g., success, failure
"result": "string" // command execution result
}
```
## API Endpoints
### POST /api/commands
- **Description**: Send a command to the Redis queue
- **Request Body**:
```json
{
"content": "string" // the command to send
}
```
- **Response**:
```json
{
"success": true,
"message": "Command sent successfully",
"commandId": "string"
}
```
### GET /api/commands/history
- **Description**: Get command history
- **Query Parameters**:
- `limit`: Maximum number of commands to return (default: 50)
- `offset`: Offset for pagination (default: 0)
- **Response**: Array of command objects
### GET /api/commands/:id/response
- **Description**: Get response for a specific command
- **Response**: Command response object