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,6 +1,7 @@
package com.claudecode.command.impl;
import com.claudecode.command.CommandContext;
import com.claudecode.command.BaseSlashCommand;
import com.claudecode.command.SlashCommand;
import com.claudecode.console.AnsiStyle;
@@ -17,7 +18,7 @@ import java.util.stream.Collectors;
* <li>/help [command] —— 显示特定命令详情</li>
* </ul>
*/
public class HelpCommand implements SlashCommand {
public class HelpCommand extends BaseSlashCommand {
@Override
public String name() {
@@ -36,7 +37,7 @@ public class HelpCommand implements SlashCommand {
@Override
public String execute(String args, CommandContext context) {
String query = (args == null) ? "" : args.strip();
String query = args(args);
var allCommands = context.commandRegistry().getCommands();
// If a specific command name is given, show details