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:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user