@openxiaobu/codexl 0.1.11 → 0.1.13

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.
Files changed (3) hide show
  1. package/README.md +2 -3
  2. package/dist/cli.js +10 -10
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -53,9 +53,8 @@ By default, `status` will:
53
53
  - A status column with local block reasons and countdowns (for example: `5h_limited(2h27m)`)
54
54
  - Enter an interactive mode where you can toggle `enabled` for accounts:
55
55
  - Up/Down: move selection
56
- - Space: toggle `[x]` enabled / `[ ]` disabled
57
- - Enter: confirm and save
58
- - `q`: quit
56
+ - Space: toggle `[x]` enabled / `[ ]` disabled and save immediately
57
+ - Enter / `q`: exit the interactive mode
59
58
 
60
59
  If you only want a non-interactive snapshot of the current state:
61
60
 
package/dist/cli.js CHANGED
@@ -62,6 +62,7 @@ async function handleInteractiveToggle() {
62
62
  const stdin = process.stdin;
63
63
  node_readline_1.default.emitKeypressEvents(stdin);
64
64
  stdin.setRawMode?.(true);
65
+ stdin.resume();
65
66
  const config = (0, config_1.loadConfig)();
66
67
  if (config.accounts.length === 0) {
67
68
  console.log("当前没有已录入账号。");
@@ -75,7 +76,7 @@ async function handleInteractiveToggle() {
75
76
  let renderedLines = 0;
76
77
  const render = () => {
77
78
  const lines = [];
78
- lines.push("空格切换选中账号启用状态,回车确认,q 退出:");
79
+ lines.push("空格切换选中账号启用状态,Enter / q 退出:");
79
80
  for (let i = 0; i < accounts.length; i += 1) {
80
81
  const account = accounts[i];
81
82
  const prefix = i === cursor ? ">" : " ";
@@ -105,6 +106,7 @@ async function handleInteractiveToggle() {
105
106
  }
106
107
  }
107
108
  (0, config_1.saveConfig)(latest);
109
+ changed = false;
108
110
  };
109
111
  render();
110
112
  const onKeypress = (_str, key) => {
@@ -121,28 +123,26 @@ async function handleInteractiveToggle() {
121
123
  if (key.name === "space") {
122
124
  accounts[cursor].enabled = !accounts[cursor].enabled;
123
125
  changed = true;
126
+ applyChanges();
124
127
  render();
125
128
  return;
126
129
  }
127
130
  if (key.name === "return" || key.name === "enter") {
128
131
  if (changed) {
129
132
  applyChanges();
130
- changed = false;
131
- render();
132
- console.log("\n已保存账号启用状态变更(按 q 退出)。");
133
133
  }
134
+ stdin.off("keypress", onKeypress);
135
+ stdin.setRawMode?.(false);
136
+ console.log("\n已退出账号启用状态编辑。");
134
137
  return;
135
138
  }
136
139
  if (key.name === "q" || (key.ctrl && key.name === "c")) {
137
- stdin.off("keypress", onKeypress);
138
- stdin.setRawMode?.(false);
139
140
  if (changed) {
140
141
  applyChanges();
141
- console.log("\n已保存账号启用状态变更。");
142
- }
143
- else {
144
- console.log("\n未做任何变更。");
145
142
  }
143
+ stdin.off("keypress", onKeypress);
144
+ stdin.setRawMode?.(false);
145
+ console.log("\n已退出账号启用状态编辑。");
146
146
  return;
147
147
  }
148
148
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openxiaobu/codexl",
3
- "version": "0.1.11",
3
+ "version": "0.1.13",
4
4
  "description": "本地 Codex 多账号切换与状态管理工具",
5
5
  "type": "commonjs",
6
6
  "main": "dist/cli.js",