u1s1-cli 0.4.0 → 0.5.1

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.
package/dist/index.js CHANGED
@@ -1,12 +1,11 @@
1
1
  #!/usr/bin/env node
2
2
  import { spawnSync } from "node:child_process";
3
- import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
3
+ import { existsSync, mkdirSync, readFileSync, rmSync, writeFileSync } from "node:fs";
4
4
  import { join } from "node:path";
5
5
  import { createRequire } from "node:module";
6
6
  import { printConsoleBanner } from "./brand.js";
7
7
  import { agentDir, loadConfig, MODELS, persistPreferredModel, PROVIDER_ID, resolvePreferredModel, } from "./config.js";
8
8
  import { applyBrandUi } from "./style.js";
9
- import { DEFAULT_THEME_SETTING, ensureBrandThemes } from "./themes.js";
10
9
  const require = createRequire(import.meta.url);
11
10
  const VERSION = require("../package.json").version;
12
11
  const BRAND_APPEND = `## u1s1
@@ -39,16 +38,6 @@ function ensureDefaultSettings() {
39
38
  }
40
39
  }
41
40
  let changed = false;
42
- if (!("hideThinkingBlock" in settings)) {
43
- settings.hideThinkingBlock = true;
44
- changed = true;
45
- }
46
- // Default / leftover Pi themes → u1s1 Claude-like pair. Custom names stay put.
47
- const theme = settings.theme;
48
- if (theme === undefined || theme === "dark" || theme === "light") {
49
- settings.theme = DEFAULT_THEME_SETTING;
50
- changed = true;
51
- }
52
41
  // Pi default is one-at-a-time (one queued message per turn). u1s1 delivers
53
42
  // all queued messages together so burst typing isn't split across turns.
54
43
  // Only fill in missing keys so an explicit /settings choice still sticks.
@@ -58,9 +47,26 @@ function ensureDefaultSettings() {
58
47
  changed = true;
59
48
  }
60
49
  }
50
+ if (!("hideThinkingBlock" in settings)) {
51
+ settings["hideThinkingBlock"] = true;
52
+ changed = true;
53
+ }
54
+ // ≤0.4.0 shipped branded themes and forced them as default; the files are
55
+ // gone now, so a settings.json still pointing at them must fall back to
56
+ // pi's default theme.
57
+ if (typeof settings.theme === "string" && settings.theme.includes("u1s1-")) {
58
+ delete settings.theme;
59
+ changed = true;
60
+ }
61
61
  if (changed)
62
62
  writeFileSync(p, JSON.stringify(settings, null, 2) + "\n");
63
63
  }
64
+ /** ≤0.4.0 wrote u1s1-dark/u1s1-light into the pi themes dir; remove them. */
65
+ function cleanupBrandThemes() {
66
+ for (const name of ["u1s1-dark", "u1s1-light"]) {
67
+ rmSync(join(agentDir, "themes", `${name}.json`), { force: true });
68
+ }
69
+ }
64
70
  /**
65
71
  * tmux 默认不转发键盘修饰键,会把 Shift+Enter 当成普通回车发出去,消息没写完就被发送。
66
72
  * 只开 extended-keys 不够:默认 terminal-features 里 xterm* 没有 extkeys,tmux 根本不会
@@ -102,7 +108,7 @@ function ensureTmuxKeyboardProtocol() {
102
108
  run(["bind-key", "-n", "C-Enter", "send-keys", "-l", "\x1b[13;5u"]);
103
109
  }
104
110
  async function runAgent(cfg, args) {
105
- ensureBrandThemes();
111
+ cleanupBrandThemes();
106
112
  ensureBrandPrompt();
107
113
  ensureDefaultSettings();
108
114
  ensureTmuxKeyboardProtocol();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "u1s1-cli",
3
- "version": "0.4.0",
3
+ "version": "0.5.1",
4
4
  "description": "u1s1 — 有一说一,最省心的 AI 编程搭子。终端里用中文说需求,AI 帮你读文件、改代码、跑命令。",
5
5
  "type": "module",
6
6
  "bin": {
package/dist/themes.js DELETED
@@ -1,177 +0,0 @@
1
- import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
2
- import { join } from "node:path";
3
- import { agentDir } from "./config.js";
4
- /**
5
- * Claude Code-like: warm terracotta accent, no gray message/tool boxes,
6
- * text sits on the terminal background instead of Codex-style cards.
7
- */
8
- export const DARK_THEME = {
9
- name: "u1s1-dark",
10
- vars: {
11
- orange: "#d97757",
12
- orangeSoft: "#e8a87c",
13
- text: "#e8e4db",
14
- muted: "#9a9488",
15
- dim: "#6b665e",
16
- green: "#8fbc8f",
17
- red: "#e07a7a",
18
- yellow: "#d4a574",
19
- blue: "#89b4c4",
20
- selectedBg: "#3a342e",
21
- userMsgBg: "#34312c",
22
- },
23
- colors: {
24
- accent: "orange",
25
- border: "orangeSoft",
26
- borderAccent: "orange",
27
- borderMuted: "dim",
28
- success: "green",
29
- error: "red",
30
- warning: "yellow",
31
- muted: "muted",
32
- dim: "dim",
33
- text: "text",
34
- thinkingText: "muted",
35
- selectedBg: "selectedBg",
36
- scrollbarThumb: "selectedBg",
37
- searchMatchBg: "selectedBg",
38
- searchMatchText: "text",
39
- userMessageBg: "userMsgBg",
40
- userMessageText: "text",
41
- customMessageBg: "userMsgBg",
42
- customMessageText: "text",
43
- customMessageLabel: "orangeSoft",
44
- toolPendingBg: "",
45
- toolSuccessBg: "",
46
- toolErrorBg: "",
47
- toolTitle: "text",
48
- toolOutput: "muted",
49
- mdHeading: "orangeSoft",
50
- mdLink: "blue",
51
- mdLinkUrl: "dim",
52
- mdCode: "orangeSoft",
53
- mdCodeBlock: "text",
54
- mdCodeBlockBorder: "dim",
55
- mdQuote: "muted",
56
- mdQuoteBorder: "orange",
57
- mdHr: "dim",
58
- mdListBullet: "orange",
59
- toolDiffAdded: "green",
60
- toolDiffRemoved: "red",
61
- toolDiffContext: "muted",
62
- syntaxComment: "muted",
63
- syntaxKeyword: "orangeSoft",
64
- syntaxFunction: "orange",
65
- syntaxVariable: "text",
66
- syntaxString: "green",
67
- syntaxNumber: "yellow",
68
- syntaxType: "blue",
69
- syntaxOperator: "muted",
70
- syntaxPunctuation: "dim",
71
- thinkingOff: "dim",
72
- thinkingMinimal: "muted",
73
- thinkingLow: "blue",
74
- thinkingMedium: "orangeSoft",
75
- thinkingHigh: "orange",
76
- thinkingXhigh: "yellow",
77
- thinkingMax: "red",
78
- bashMode: "green",
79
- },
80
- export: {
81
- pageBg: "#1c1917",
82
- cardBg: "#292524",
83
- infoBg: "#3d3429",
84
- },
85
- };
86
- export const LIGHT_THEME = {
87
- name: "u1s1-light",
88
- vars: {
89
- orange: "#c45c38",
90
- orangeSoft: "#b86a45",
91
- text: "#2c2825",
92
- muted: "#6f6a63",
93
- dim: "#9a9488",
94
- green: "#3d7a4a",
95
- red: "#c45c5c",
96
- yellow: "#9a6b2f",
97
- blue: "#3d6f8a",
98
- selectedBg: "#efe8e0",
99
- userMsgBg: "#e8e4dc",
100
- },
101
- colors: {
102
- accent: "orange",
103
- border: "orangeSoft",
104
- borderAccent: "orange",
105
- borderMuted: "dim",
106
- success: "green",
107
- error: "red",
108
- warning: "yellow",
109
- muted: "muted",
110
- dim: "dim",
111
- text: "text",
112
- thinkingText: "muted",
113
- selectedBg: "selectedBg",
114
- scrollbarThumb: "selectedBg",
115
- searchMatchBg: "selectedBg",
116
- searchMatchText: "text",
117
- userMessageBg: "userMsgBg",
118
- userMessageText: "text",
119
- customMessageBg: "userMsgBg",
120
- customMessageText: "text",
121
- customMessageLabel: "orangeSoft",
122
- toolPendingBg: "",
123
- toolSuccessBg: "",
124
- toolErrorBg: "",
125
- toolTitle: "text",
126
- toolOutput: "muted",
127
- mdHeading: "orange",
128
- mdLink: "blue",
129
- mdLinkUrl: "dim",
130
- mdCode: "orangeSoft",
131
- mdCodeBlock: "text",
132
- mdCodeBlockBorder: "dim",
133
- mdQuote: "muted",
134
- mdQuoteBorder: "orange",
135
- mdHr: "dim",
136
- mdListBullet: "orange",
137
- toolDiffAdded: "green",
138
- toolDiffRemoved: "red",
139
- toolDiffContext: "muted",
140
- syntaxComment: "muted",
141
- syntaxKeyword: "orange",
142
- syntaxFunction: "orangeSoft",
143
- syntaxVariable: "text",
144
- syntaxString: "green",
145
- syntaxNumber: "yellow",
146
- syntaxType: "blue",
147
- syntaxOperator: "muted",
148
- syntaxPunctuation: "dim",
149
- thinkingOff: "dim",
150
- thinkingMinimal: "muted",
151
- thinkingLow: "blue",
152
- thinkingMedium: "orangeSoft",
153
- thinkingHigh: "orange",
154
- thinkingXhigh: "yellow",
155
- thinkingMax: "red",
156
- bashMode: "green",
157
- },
158
- export: {
159
- pageBg: "#faf7f2",
160
- cardBg: "#ffffff",
161
- infoBg: "#fff4e8",
162
- },
163
- };
164
- const THEMES = [DARK_THEME, LIGHT_THEME];
165
- export const DEFAULT_THEME_SETTING = "u1s1-light/u1s1-dark";
166
- /** Keep ~/.u1s1/agent/themes in sync so Pi picks them up as normal theme files. */
167
- export function ensureBrandThemes() {
168
- const dir = join(agentDir, "themes");
169
- mkdirSync(dir, { recursive: true });
170
- for (const theme of THEMES) {
171
- const path = join(dir, `${theme.name}.json`);
172
- const body = `${JSON.stringify(theme, null, 2)}\n`;
173
- if (!existsSync(path) || readFileSync(path, "utf8") !== body) {
174
- writeFileSync(path, body);
175
- }
176
- }
177
- }