refactor: apply BaseSlashCommand to all 54 command implementations

- implements SlashCommand -> extends BaseSlashCommand (all 54 files)
- Replace CommandUtils.parseArgs/args null checks -> args(args)
- Replace agentLoop null checks -> requireAgentLoop(context)/noSession()
- Replace context.agentLoop().getToolContext() -> toolCtx(context)
- Replace CommandUtils.success/error/header/subtitle/warning/info -> instance methods
- Remove unused CommandUtils/AnsiStyle imports where applicable
- 87 tests passing, zero compilation errors

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
abel533
2026-04-05 13:16:55 +08:00
co-authored by Copilot
parent 12a443c9a9
commit 9f4023bdf0
57 changed files with 558 additions and 217 deletions
@@ -1,7 +1,7 @@
package com.claudecode.command.impl;
import com.claudecode.command.CommandContext;
import com.claudecode.command.SlashCommand;
import com.claudecode.command.BaseSlashCommand;
import com.claudecode.console.AnsiStyle;
import org.springframework.ai.chat.messages.*;
@@ -22,7 +22,7 @@ import java.util.List;
* <li>/export [路径] —— 导出到指定路径</li>
* </ul>
*/
public class ExportCommand implements SlashCommand {
public class ExportCommand extends BaseSlashCommand {
private static final DateTimeFormatter TIMESTAMP_FMT = DateTimeFormatter.ofPattern("yyyyMMdd_HHmmss");
@@ -46,7 +46,7 @@ public class ExportCommand implements SlashCommand {
}
// 确定输出路径
args = args == null ? "" : args.strip();
args = args(args);
Path outputPath;
if (!args.isEmpty()) {
outputPath = Path.of(args);