@ia-ccun/code-agent-cli 0.0.26 → 0.0.27
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,26 @@ 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
|
+
ctx.ui.showStatus(
|
|
40
|
+
`发现新版本 v${cache.localVersion} → v${cache.latestVersion},运行 npm install -g @ia-ccun/code-agent-cli 更新`
|
|
41
|
+
);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
} catch (e) {
|
|
45
|
+
// 忽略
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
29
49
|
ctx.ui.setFooter((tui, theme, footerData) => {
|
|
30
50
|
const unsub = footerData.onBranchChange(() => tui.requestRender());
|
|
31
51
|
|