feat: 12 UX commands - brief, vim, theme, usage, tips, env, perf, etc (Phase 4B)
New commands: - /brief: toggle concise output mode - /vim: toggle vi-mode editing - /theme: switch color theme (dark/light/auto) - /usage: detailed token/cost breakdown with visual bar - /tips: usage tips (random or /tips all) - /output-style: output format (markdown/plain/json) - /env: environment variables, config paths, system info - /performance (/perf): memory, threads, GC, session metrics - /privacy: telemetry/logging/memory opt-out settings - /feedback: save feedback to ~/.claude-code-java/feedback/ - /release-notes (/changelog): version history - /keybindings (/keys): keyboard shortcuts reference Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
@@ -0,0 +1,52 @@
|
||||
package com.claudecode.command.impl;
|
||||
|
||||
import com.claudecode.command.CommandContext;
|
||||
import com.claudecode.command.SlashCommand;
|
||||
import com.claudecode.console.AnsiStyle;
|
||||
|
||||
/**
|
||||
* /theme 命令 —— 切换主题(dark/light/auto)。
|
||||
*/
|
||||
public class ThemeCommand implements SlashCommand {
|
||||
|
||||
@Override
|
||||
public String name() { return "theme"; }
|
||||
|
||||
@Override
|
||||
public String description() { return "Switch color theme (dark/light/auto)"; }
|
||||
|
||||
@Override
|
||||
public String execute(String args, CommandContext context) {
|
||||
if (context.agentLoop() == null) {
|
||||
return AnsiStyle.red(" ✗ No active session");
|
||||
}
|
||||
|
||||
var toolCtx = context.agentLoop().getToolContext();
|
||||
String current = (String) toolCtx.get("THEME");
|
||||
if (current == null) current = "dark";
|
||||
|
||||
String trimmed = (args == null) ? "" : args.trim().toLowerCase();
|
||||
|
||||
if (trimmed.isEmpty()) {
|
||||
return "\n" + AnsiStyle.bold(" 🎨 Theme Settings\n")
|
||||
+ " " + "─".repeat(30) + "\n\n"
|
||||
+ " Current: " + AnsiStyle.cyan(current) + "\n"
|
||||
+ " Options: " + AnsiStyle.dim("dark, light, auto") + "\n"
|
||||
+ "\n" + AnsiStyle.dim(" Usage: /theme <dark|light|auto>");
|
||||
}
|
||||
|
||||
if (!trimmed.equals("dark") && !trimmed.equals("light") && !trimmed.equals("auto")) {
|
||||
return AnsiStyle.yellow(" Unknown theme: " + trimmed)
|
||||
+ "\n" + AnsiStyle.dim(" Options: dark, light, auto");
|
||||
}
|
||||
|
||||
toolCtx.set("THEME", trimmed);
|
||||
String icon = switch (trimmed) {
|
||||
case "dark" -> "🌙";
|
||||
case "light" -> "☀️";
|
||||
case "auto" -> "🔄";
|
||||
default -> "🎨";
|
||||
};
|
||||
return AnsiStyle.green(" ✓ Theme set to " + trimmed + " " + icon);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user