Skip to content

Commit f4ded9a

Browse files
committed
feat(cli): 增加Git提交信息和改进界面显示
- 引入并展示CLI版本及Git提交信息 - 优化退出摘要界面颜色,提升可读性 - 在会话恢复提示中添加高亮命令显示 - 在PackageInfo类型中添加gitCommit字段支持
1 parent a3952e1 commit f4ded9a

3 files changed

Lines changed: 9 additions & 5 deletions

File tree

packages/cli/src/cli.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import { setShellIfWindows, getProjectCode } from "@vegamo/deepcode-core";
77
import { checkForNpmUpdate, promptForPendingUpdate, type PackageInfo } from "./common/update-check";
88
import { AppContainer } from "./ui";
99
import { extractInitialPrompt, extractResumeSessionId } from "./cli-args";
10+
import { CLI_VERSION, GIT_COMMIT_INFO } from "./generated/git-commit";
1011

1112
const args = process.argv.slice(2);
1213
const packageInfo = readPackageInfo();
@@ -151,9 +152,10 @@ function readPackageInfo(): PackageInfo {
151152
const pkg = require("../package.json") as { name?: unknown; version?: unknown };
152153
return {
153154
name: typeof pkg.name === "string" ? pkg.name : "@vegamo/deepcode-cli",
154-
version: typeof pkg.version === "string" ? pkg.version : "",
155+
version: typeof pkg.version === "string" ? pkg.version : (CLI_VERSION ?? ""),
156+
gitCommit: GIT_COMMIT_INFO ?? "",
155157
};
156158
} catch {
157-
return { name: "@vegamo/deepcode-cli", version: "" };
159+
return { name: "@vegamo/deepcode-cli", version: CLI_VERSION ?? "", gitCommit: GIT_COMMIT_INFO ?? "" };
158160
}
159161
}

packages/cli/src/common/update-check.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import { killProcessTree } from "@vegamo/deepcode-core";
1010
export type PackageInfo = {
1111
name: string;
1212
version: string;
13+
gitCommit?: string;
1314
};
1415

1516
type UpdateState = {

packages/cli/src/ui/exit-summary.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ export function buildExitSummaryText(input: ExitSummaryInput): string {
7373
const innerWidth = 98;
7474
const contentWidth = innerWidth - 4; // "│ " prefix + " │" suffix → 4 chars padding
7575

76-
const borderColor = chalk.hex("#229ac3e6");
76+
const borderColor = chalk.dim;
7777
const titleColor = gradientString("#229ac3e6", "rgb(125 51 247 / 0.7)");
7878
const line = (text: string) => `${borderColor("│")} ${padRight(text, contentWidth)} ${borderColor("│")}`;
7979

@@ -114,7 +114,7 @@ export function buildExitSummaryText(input: ExitSummaryInput): string {
114114
padLeft("Output Tokens", colOutput) +
115115
padLeft("Cached Tokens", colCached);
116116
rows.push(chalk.bold(headerRow));
117-
rows.push(divider);
117+
rows.push(chalk.gray(divider));
118118

119119
for (const { modelName, usage } of usageRows) {
120120
const reqsStr = formatNumber(usage.totalReqs).padStart(colReqs);
@@ -136,7 +136,8 @@ export function buildExitSummaryText(input: ExitSummaryInput): string {
136136
rows.push("");
137137

138138
if (sessionId) {
139-
const resumeHint = chalk.dim(`To continue this session, run deepcode --resume ${sessionId}`);
139+
const resumeHint =
140+
chalk.dim(`To continue this session, run `) + chalk.hex("#229ac3")(`deepcode --resume ${sessionId}`);
140141
rows.push(resumeHint);
141142
rows.push("");
142143
}

0 commit comments

Comments
 (0)