@ia-ccun/code-agent-cli 0.0.51-beta.5 → 0.0.51-beta.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -557,10 +557,10 @@ export default function aicodePlan(pi: ExtensionAPI) {
557
557
  return;
558
558
  }
559
559
 
560
- ctx.ui.setStatus(
561
- STATUS_KEY,
562
- planModeEnabled ? ctx.ui.theme.fg("warning", "⏸ 计划") : undefined,
563
- );
560
+ const statusText = planModeEnabled
561
+ ? ctx.ui.theme.fg("warning", "⏸ 计划") + ctx.ui.theme.fg("dim", " | plan (Ctrl+Shift+P)")
562
+ : undefined;
563
+ ctx.ui.setStatus(STATUS_KEY, statusText);
564
564
  updateTodoWidget(ctx);
565
565
  };
566
566
 
@@ -647,14 +647,18 @@ export default function aicodePlan(pi: ExtensionAPI) {
647
647
  }
648
648
 
649
649
  if (["status", "state", "状态"].includes(command)) {
650
- ctx.ui.notify(
650
+ const statusLines = [
651
651
  planModeEnabled
652
652
  ? "计划模式:开启(只读规划)"
653
653
  : executionMode
654
654
  ? "计划模式:关闭(正在执行已批准的计划)"
655
655
  : "计划模式:关闭(默认直接执行模式)",
656
- "info",
657
- );
656
+ ];
657
+ if (!planModeEnabled && !executionMode) {
658
+ statusLines.push("");
659
+ statusLines.push("快捷键:Alt+Shift+P 快速切换计划模式");
660
+ }
661
+ ctx.ui.notify(statusLines.join("\n"), "info");
658
662
  return;
659
663
  }
660
664
 
@@ -683,6 +687,21 @@ export default function aicodePlan(pi: ExtensionAPI) {
683
687
  },
684
688
  });
685
689
 
690
+ // 注册快捷键
691
+ pi.registerShortcut("ctrl+shift+p", {
692
+ description: "切换计划模式",
693
+ handler: async (ctx) => {
694
+ if (planModeEnabled) {
695
+ exitPlanMode(ctx, "计划模式已禁用。返回直接执行模式。", {
696
+ resetProgress: true,
697
+ });
698
+ } else {
699
+ enterPlanMode(ctx);
700
+ }
701
+ ctx.ui.notify(`计划模式已${planModeEnabled ? "禁用" : "启用"}`, "info");
702
+ },
703
+ });
704
+
686
705
  // 注册消息渲染器
687
706
  pi.registerMessageRenderer(CUSTOM_TYPE, (message, { expanded }, theme) => {
688
707
  const details = message.details as { kind?: string; message?: string } | undefined;
@@ -26,6 +26,16 @@ function getVersion() {
26
26
  }
27
27
 
28
28
  export default function (pi: ExtensionAPI) {
29
+ // Plan 模式状态(由 EventBus 更新)
30
+ let planModeEnabled = false;
31
+ let footerTui: import("@earendil-works/pi-tui").TUI | null = null;
32
+
33
+ // 监听 plan 模式变化事件(全局监听,只注册一次)
34
+ pi.events.on("aicode-plan:mode-changed", (data: any) => {
35
+ planModeEnabled = data.enabled;
36
+ footerTui?.requestRender();
37
+ });
38
+
29
39
  pi.on("session_start", async (_event, ctx) => {
30
40
  // 检查版本更新并显示通知
31
41
  const cachePath = process.env.AICODE_CLI_VERSION_CACHE;
@@ -47,6 +57,7 @@ export default function (pi: ExtensionAPI) {
47
57
  }
48
58
 
49
59
  ctx.ui.setFooter((tui, theme, footerData) => {
60
+ footerTui = tui;
50
61
  const unsub = footerData.onBranchChange(() => tui.requestRender());
51
62
 
52
63
  return {
@@ -184,6 +195,14 @@ export default function (pi: ExtensionAPI) {
184
195
  if (statsColored) segments.push(statsColored);
185
196
  segments.push(ctxColored);
186
197
  segments.push(modelColored);
198
+
199
+ // ── Plan mode segment ────────────────────────────────────
200
+ if (planModeEnabled) {
201
+ segments.push(theme.fg("success", "⏸ plan mode on"));
202
+ }else{
203
+ segments.push(theme.fg("error", "> yolo mode on"));
204
+ }
205
+
187
206
  segments.push(theme.fg("muted", quote));
188
207
 
189
208
  // ── Version segment (rightmost) ─────────────────────────
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ia-ccun/code-agent-cli",
3
- "version": "0.0.51-beta.5",
3
+ "version": "0.0.51-beta.6",
4
4
  "description": "AI Coding Agent CLI - 基于OpenClaw🦞底层Agent(pi)原理封装的编码智能体(供学习使用)。",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",