shenxiang-ai-cli 0.5.2 → 0.5.4

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/index.js +62 -20
  2. package/package.json +64 -54
package/dist/index.js CHANGED
@@ -730,24 +730,6 @@ var theme = {
730
730
  tokenLabel: chalk.hex("#6B7280"),
731
731
  tokenValue: chalk.hex("#A78BFA")
732
732
  };
733
- function banner() {
734
- const p = theme.brand;
735
- const b = theme.brandBold;
736
- const d = theme.dim;
737
- const m = theme.muted;
738
- const y = chalk.hex("#FBBF24");
739
- const r = chalk.hex("#F87171");
740
- const w = chalk.white.bold;
741
- const lines = [
742
- ``,
743
- ` ${p("/\\_/\\")} ${b("\u6C88\u7FD4\u7684AI\u52A9\u624B")} ${m("v0.5.2")}`,
744
- ` ${p("(")} ${y("o")}${p(".")}${y("o")} ${p(")")} ${d("\u7EC8\u7AEF\u91CC\u7684AI\u5168\u6808\u5F00\u53D1\u642D\u6863")}`,
745
- ` ${p("> ")}${r("^")}${p(" <")}`,
746
- ` ${p("/|")}${p(" |")}${p("\\")} ${d("\u4F60\u7684\u7F16\u7A0B\u597D\u4F19\u4F34")} ${chalk.hex("#A78BFA")("\u{1F43E}")}`,
747
- ` ${p("(_| |_)")}`
748
- ];
749
- return lines.join("\n");
750
- }
751
733
  function separator() {
752
734
  return theme.dim("\u2500".repeat(40));
753
735
  }
@@ -2236,6 +2218,66 @@ ${truncated}
2236
2218
  }
2237
2219
  };
2238
2220
 
2221
+ // src/ui/banner.ts
2222
+ import boxen from "boxen";
2223
+ import chalk3 from "chalk";
2224
+ import stripAnsi from "strip-ansi";
2225
+ function showBanner() {
2226
+ console.clear();
2227
+ const p = chalk3.hex("#A78BFA");
2228
+ const w = chalk3.white;
2229
+ const version = "v0.5.4";
2230
+ const avatarLines = [
2231
+ ` ${p("\u2584\u2580\u2580\u2580\u2584")}`,
2232
+ ` ${p("\u2588")} ${w("\u2580")} ${w("\u2580")} ${p("\u2588")}`,
2233
+ ` ${p("\u2588")} ${w("\u2580")} ${p("\u2588")}`,
2234
+ ` ${p("\u2580\u2584\u2584\u2584\u2584\u2584\u2580")}`,
2235
+ ` ${p("\u2580")} ${p("\u2580")}`
2236
+ ];
2237
+ const terminalWidth = process.stdout.columns || 80;
2238
+ const boxWidth = Math.max(60, Math.min(terminalWidth - 4, 120));
2239
+ const leftColWidth = Math.floor(boxWidth * 0.45);
2240
+ const leftContent = [
2241
+ "",
2242
+ " Welcome back!",
2243
+ "",
2244
+ ...avatarLines,
2245
+ "",
2246
+ ` ${theme.brandBold("DevPilot")} ${theme.dim(version)}`,
2247
+ ` ${chalk3.dim(process.cwd().length > leftColWidth - 2 ? "..." + process.cwd().slice(-(leftColWidth - 5)) : process.cwd())}`,
2248
+ ""
2249
+ ];
2250
+ const rightContent = [
2251
+ theme.brand("Tips for getting started"),
2252
+ `Run ${theme.code("/help")} for a list of commands`,
2253
+ "",
2254
+ theme.brand("Recent activity"),
2255
+ "No recent activity",
2256
+ "",
2257
+ "",
2258
+ ""
2259
+ ];
2260
+ const maxLines = Math.max(leftContent.length, rightContent.length);
2261
+ const lines = [];
2262
+ for (let i = 0; i < maxLines; i++) {
2263
+ const left = leftContent[i] || "";
2264
+ const leftVisible = stripAnsi(left).length;
2265
+ const leftPadding = " ".repeat(Math.max(0, leftColWidth - leftVisible));
2266
+ const right = rightContent[i] || "";
2267
+ lines.push(`${left}${leftPadding} ${theme.dim("\u2502")} ${right}`);
2268
+ }
2269
+ const content = lines.join("\n");
2270
+ console.log(boxen(content, {
2271
+ padding: { top: 0, bottom: 0, left: 1, right: 1 },
2272
+ margin: 0,
2273
+ borderStyle: "round",
2274
+ borderColor: "#A78BFA",
2275
+ title: chalk3.hex("#A78BFA")(" \u6C88\u7FD4\u7684AI\u7F16\u7A0B\u52A9\u7406 "),
2276
+ titleAlignment: "left",
2277
+ width: boxWidth
2278
+ }));
2279
+ }
2280
+
2239
2281
  // src/commands/chat.ts
2240
2282
  async function chatCommand(options = {}) {
2241
2283
  const config3 = getConfig();
@@ -2253,7 +2295,7 @@ async function chatCommand(options = {}) {
2253
2295
  console.error(theme.error(`
2254
2296
  \u26A0 \u672A\u6355\u83B7\u9519\u8BEF: ${err.message}`));
2255
2297
  });
2256
- console.log(banner());
2298
+ showBanner();
2257
2299
  if (isYoloMode()) {
2258
2300
  console.log(theme.warning(" \u26A1 \u81EA\u52A8\u6A21\u5F0F (YOLO) \u2014 \u6240\u6709\u64CD\u4F5C\u81EA\u52A8\u6267\u884C\uFF0C\u65E0\u9700\u786E\u8BA4"));
2259
2301
  }
@@ -3328,7 +3370,7 @@ function fmtTokens3(n) {
3328
3370
  var program = new Command();
3329
3371
  var config2 = getConfig();
3330
3372
  setLocale(config2.locale);
3331
- program.name("sxai").description(t("description")).version("0.5.2");
3373
+ program.name("sxai").description(t("description")).version("0.5.4");
3332
3374
  program.command("chat", { isDefault: true }).description("\u542F\u52A8\u4EA4\u4E92\u5F0FAI\u5BF9\u8BDD\uFF08\u9ED8\u8BA4\u547D\u4EE4\uFF09").option("-m, --model <model>", "\u6307\u5B9AAI\u6A21\u578B", config2.model).option("-y, --yolo", "\u81EA\u52A8\u6A21\u5F0F\uFF1A\u8DF3\u8FC7\u6240\u6709\u786E\u8BA4\uFF0C\u8BA9AI\u81EA\u4E3B\u6267\u884C").action(async (options) => {
3333
3375
  if (options.model && options.model !== config2.model) {
3334
3376
  setConfig("model", options.model);
package/package.json CHANGED
@@ -1,54 +1,64 @@
1
- {
2
- "name": "shenxiang-ai-cli",
3
- "version": "0.5.2",
4
- "description": "沈翔的AI助手 - 终端里的AI全栈开发搭档",
5
- "type": "module",
6
- "bin": {
7
- "sxai": "./dist/index.js"
8
- },
9
- "main": "./dist/index.js",
10
- "files": [
11
- "dist",
12
- "README.md"
13
- ],
14
- "repository": {
15
- "type": "git",
16
- "url": ""
17
- },
18
- "engines": {
19
- "node": ">=18.0.0"
20
- },
21
- "scripts": {
22
- "dev": "tsx watch src/index.ts",
23
- "build": "tsup src/index.ts --format esm --clean",
24
- "start": "node dist/index.js",
25
- "clean": "rimraf dist",
26
- "prepublishOnly": "npm run build"
27
- },
28
- "keywords": ["ai", "cli", "coding", "assistant", "devpilot", "fullstack", "chinese", "developer-tools"],
29
- "license": "MIT",
30
- "dependencies": {
31
- "chalk": "^5.3.0",
32
- "commander": "^12.1.0",
33
- "conf": "^13.0.1",
34
- "glob": "^11.0.0",
35
- "inquirer": "^9.3.0",
36
- "marked": "^14.0.0",
37
- "marked-terminal": "^7.2.0",
38
- "ora": "^8.1.0",
39
- "simple-git": "^3.27.0",
40
- "openai": "^4.70.0",
41
- "undici": "^6.21.0",
42
- "cli-highlight": "^2.1.11",
43
- "diff": "^7.0.0",
44
- "strip-ansi": "^7.1.0"
45
- },
46
- "devDependencies": {
47
- "@types/node": "^22.0.0",
48
- "@types/diff": "^6.0.0",
49
- "tsup": "^8.3.0",
50
- "tsx": "^4.19.0",
51
- "typescript": "^5.6.0",
52
- "rimraf": "^6.0.0"
53
- }
54
- }
1
+ {
2
+ "name": "shenxiang-ai-cli",
3
+ "version": "0.5.4",
4
+ "description": "沈翔的AI助手 - 终端里的AI全栈开发搭档",
5
+ "type": "module",
6
+ "bin": {
7
+ "sxai": "./dist/index.js"
8
+ },
9
+ "main": "./dist/index.js",
10
+ "files": [
11
+ "dist",
12
+ "README.md"
13
+ ],
14
+ "repository": {
15
+ "type": "git",
16
+ "url": ""
17
+ },
18
+ "engines": {
19
+ "node": ">=18.0.0"
20
+ },
21
+ "scripts": {
22
+ "dev": "tsx watch src/index.ts",
23
+ "build": "tsup src/index.ts --format esm --clean",
24
+ "start": "node dist/index.js",
25
+ "clean": "rimraf dist",
26
+ "prepublishOnly": "npm run build"
27
+ },
28
+ "keywords": [
29
+ "ai",
30
+ "cli",
31
+ "coding",
32
+ "assistant",
33
+ "devpilot",
34
+ "fullstack",
35
+ "chinese",
36
+ "developer-tools"
37
+ ],
38
+ "license": "MIT",
39
+ "dependencies": {
40
+ "boxen": "^8.0.1",
41
+ "chalk": "^5.3.0",
42
+ "cli-highlight": "^2.1.11",
43
+ "commander": "^12.1.0",
44
+ "conf": "^13.0.1",
45
+ "diff": "^7.0.0",
46
+ "glob": "^11.0.0",
47
+ "inquirer": "^9.3.0",
48
+ "marked": "^14.0.0",
49
+ "marked-terminal": "^7.2.0",
50
+ "openai": "^4.70.0",
51
+ "ora": "^8.1.0",
52
+ "simple-git": "^3.27.0",
53
+ "strip-ansi": "^7.1.0",
54
+ "undici": "^6.21.0"
55
+ },
56
+ "devDependencies": {
57
+ "@types/diff": "^6.0.0",
58
+ "@types/node": "^22.0.0",
59
+ "rimraf": "^6.0.0",
60
+ "tsup": "^8.3.0",
61
+ "tsx": "^4.19.0",
62
+ "typescript": "^5.6.0"
63
+ }
64
+ }