feat(commands): 实现命令 CRUD 完整功能

Core:
- 新增 CommandManager 类,支持创建、更新、删除命令
- 验证命令名称防止路径遍历攻击
- 自动生成 Markdown 文件(含 YAML frontmatter)
- 内置命令保护(不可修改/删除)

Server:
- POST /api/commands - 创建命令
- GET /api/commands/:name/content - 获取命令完整内容
- PUT /api/commands/:name - 更新命令
- DELETE /api/commands/:name - 删除命令

UI:
- 新增 createCommand、updateCommand、deleteCommand、getCommandContent 函数
- 新增 CreateCommandInput、UpdateCommandInput、CommandContent 类型
This commit is contained in:
2025-12-12 18:51:38 +08:00
parent db711648e0
commit f0385ef221
7 changed files with 780 additions and 3 deletions
+10 -2
View File
@@ -33,8 +33,16 @@ export { SessionStorage } from './session/storage.js';
export type { SessionData, SessionSummary } from './session/types.js';
// Commands
export { getCommandRegistry, createCommandExecutor } from './commands/index.js';
export type { Command, CommandInput, CommandExecutionResult } from './commands/index.js';
export { getCommandRegistry, createCommandExecutor, createCommandManager } from './commands/index.js';
export type {
Command,
CommandInput,
CommandExecutionResult,
CreateCommandInput,
UpdateCommandInput,
CommandContent,
CommandOperationResult,
} from './commands/index.js';
const program = new Command();