u1s1-cli 0.16.2 → 0.16.3

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.
@@ -214,7 +214,9 @@ export default async function (pi) {
214
214
  renderResult(result, { expanded }, theme, context) {
215
215
  if (context.isError) {
216
216
  const c = result.content.find((x) => x.type === "text");
217
- return new Text(theme.fg("error", "✗ " + oneLine(c && c.type === "text" ? c.text : "error")), 0, 0);
217
+ const msg = oneLine(c && c.type === "text" ? c.text : "error");
218
+ // 低调处理:✗ 用警示色,内容用灰色弱化,避免满屏安静时红字过于扎眼
219
+ return new Text(theme.fg("warning", "✗ ") + theme.fg("muted", msg), 0, 0);
218
220
  }
219
221
  if (!expanded) return new Text("", 0, 0);
220
222
  const c = result.content.find((x) => x.type === "text");
package/dist/update.js CHANGED
@@ -1,8 +1,9 @@
1
1
  import { execSync, spawnSync } from "node:child_process";
2
- import { mkdtempSync, writeFileSync } from "node:fs";
2
+ import { mkdtempSync, readFileSync, writeFileSync } from "node:fs";
3
3
  import { createRequire } from "node:module";
4
4
  import { tmpdir } from "node:os";
5
- import { join } from "node:path";
5
+ import { dirname, join } from "node:path";
6
+ import { fileURLToPath } from "node:url";
6
7
  import { isPortableInstall } from "./config.js";
7
8
  const require = createRequire(import.meta.url);
8
9
  const pkg = require("../package.json");
@@ -106,13 +107,32 @@ async function portableSelfUpdate(latest) {
106
107
  writeFileSync(tmp, script, { mode: 0o755 });
107
108
  try {
108
109
  execSync(`bash ${JSON.stringify(tmp)}`, { stdio: "inherit" });
109
- console.log(`\n✅ 已升级到 v${latest},重新运行 u1s1 生效。`);
110
110
  }
111
111
  catch {
112
112
  console.error("\n自动升级失败。请手动运行:");
113
113
  console.error(" curl -fsSL https://u1s1.io/releases/install.sh | bash");
114
114
  process.exit(1);
115
115
  }
116
+ // 脚本退出码 0 ≠ 升级成功:安装脚本认的是官网 LATEST 版本源,它若认为
117
+ // 「已是最新」会原样退出(0.16.x 踩过:LATEST 没随发版同步,脚本说已是
118
+ // 最新,这里却报✅已升级)。以安装目录里的 VERSION 文件为准二次确认。
119
+ let installedVer;
120
+ try {
121
+ // 包根(~/.u1s1/u1s1-cli)旁边就是 install.sh 写的 VERSION
122
+ installedVer = readFileSync(join(dirname(fileURLToPath(import.meta.url)), "..", "..", "VERSION"), "utf8").trim();
123
+ }
124
+ catch {
125
+ // 老版布局没这文件,确认不了就不下结论
126
+ }
127
+ if (installedVer === latest) {
128
+ console.log(`\n✅ 已升级到 v${latest},重新运行 u1s1 生效。`);
129
+ }
130
+ else {
131
+ console.error(`\n⚠ 安装脚本跑完了,但没装上 v${latest}(官网版本源可能滞后,当前仍是 v${installedVer ?? VERSION})。`);
132
+ console.error(" 请稍后重试 u1s1 update,或手动运行:");
133
+ console.error(" curl -fsSL https://u1s1.io/releases/install.sh | bash");
134
+ process.exit(1);
135
+ }
116
136
  }
117
137
  export async function update() {
118
138
  console.log("正在检查更新…");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "u1s1-cli",
3
- "version": "0.16.2",
3
+ "version": "0.16.3",
4
4
  "description": "u1s1 — 有一说一,最省心的 AI 编程搭子。终端里用中文说需求,AI 帮你读文件、改代码、跑命令。",
5
5
  "type": "module",
6
6
  "bin": {