@ia-ccun/code-agent-cli 0.0.26 → 0.0.29
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.
|
@@ -26,6 +26,25 @@ function getVersion() {
|
|
|
26
26
|
|
|
27
27
|
export default function (pi: ExtensionAPI) {
|
|
28
28
|
pi.on("session_start", async (_event, ctx) => {
|
|
29
|
+
// 检查版本更新并显示通知
|
|
30
|
+
const cachePath = process.env.AICODE_CLI_VERSION_CACHE;
|
|
31
|
+
if (cachePath) {
|
|
32
|
+
try {
|
|
33
|
+
const { existsSync, readFileSync } = await import("fs");
|
|
34
|
+
if (existsSync(cachePath)) {
|
|
35
|
+
const cache = JSON.parse(readFileSync(cachePath, 'utf-8'));
|
|
36
|
+
// 缓存有效期 1 小时
|
|
37
|
+
if (cache.needsUpdate && Date.now() - cache.timestamp < 3600000) {
|
|
38
|
+
// 在输入框上方显示版本更新提示
|
|
39
|
+
const msg = `\x1b[38;2;243;139;168m⚠️ 发现新版本 v${cache.localVersion} → v${cache.latestVersion}\x1b[0m \x1b[36mnpm install -g @ia-ccun/code-agent-cli\x1b[0m`;
|
|
40
|
+
ctx.ui.setWidget("version-update", [msg], { placement: "aboveEditor" });
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
} catch (e) {
|
|
44
|
+
// 忽略
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
29
48
|
ctx.ui.setFooter((tui, theme, footerData) => {
|
|
30
49
|
const unsub = footerData.onBranchChange(() => tui.requestRender());
|
|
31
50
|
|