modes.ts 664 B

123456789101112131415161718
  1. import type { SwitchableCommandCenterMode } from "./types.js";
  2. const SWITCHABLE_COMMAND_CENTER_MODES = [
  3. "plan",
  4. "build",
  5. "edit",
  6. "guarded",
  7. "yolo",
  8. ] as const satisfies readonly SwitchableCommandCenterMode[];
  9. export function formatAvailableCommandCenterModes(): string {
  10. // 菜单不再推荐 Edit;显式旧命令仍由完整值域校验,不触发模式迁移。
  11. return SWITCHABLE_COMMAND_CENTER_MODES.filter((mode) => mode !== "edit").join(", ");
  12. }
  13. export function isSwitchableCommandCenterMode(value: string): value is SwitchableCommandCenterMode {
  14. return SWITCHABLE_COMMAND_CENTER_MODES.includes(value as SwitchableCommandCenterMode);
  15. }