@openxiaobu/codexl 0.1.9 → 0.1.10

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 (2) hide show
  1. package/dist/cli.js +15 -2
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -72,14 +72,27 @@ async function handleInteractiveToggle() {
72
72
  const accounts = [...config.accounts].sort((a, b) => a.name.localeCompare(b.name));
73
73
  let cursor = 0;
74
74
  let changed = false;
75
+ let renderedLines = 0;
75
76
  const render = () => {
76
- console.log("\n空格切换选中账号启用状态,回车确认,q 退出:\n");
77
+ const lines = [];
78
+ lines.push("空格切换选中账号启用状态,回车确认,q 退出:");
77
79
  for (let i = 0; i < accounts.length; i += 1) {
78
80
  const account = accounts[i];
79
81
  const prefix = i === cursor ? ">" : " ";
80
82
  const checkbox = account.enabled ? "[x]" : "[ ]";
81
- console.log(`${prefix} ${checkbox} ${account.name} (${account.codex_home})`);
83
+ lines.push(`${prefix} ${checkbox} ${account.name} (${account.codex_home})`);
82
84
  }
85
+ // 首次渲染时先换一行,避免粘在上一行输出后面。
86
+ if (renderedLines === 0) {
87
+ process.stdout.write("\n");
88
+ }
89
+ else {
90
+ // 将光标移动到上一轮渲染块的起始行。
91
+ process.stdout.write(`\x1b[${renderedLines}A`);
92
+ }
93
+ renderedLines = lines.length;
94
+ process.stdout.write(lines.join("\n"));
95
+ process.stdout.write("\n");
83
96
  };
84
97
  const applyChanges = () => {
85
98
  if (!changed)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openxiaobu/codexl",
3
- "version": "0.1.9",
3
+ "version": "0.1.10",
4
4
  "description": "本地 Codex 多账号切换与状态管理工具",
5
5
  "type": "commonjs",
6
6
  "main": "dist/cli.js",