@leviyuan/lodestar 0.12.2 → 0.12.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.
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import{spawn as b}from"node:child_process";import{existsSync as g}from"node:fs";import{homedir as d}from"node:os";import{join as o}from"node:path";var r=d(),a=process.platform==="win32";function $(e,l,m){if(e)return e;if(l)return o(l,"lodestar");return m}function y(){if(a)return o(process.env.APPDATA??o(r,"AppData","Roaming"),"Lodestar");return o(r,".config","lodestar")}function C(){if(a)return o(process.env.LOCALAPPDATA??o(r,"AppData","Local"),"Lodestar");return o(r,".local","share","lodestar")}var u=$(process.env.LODESTAR_CONFIG_DIR,process.env.XDG_CONFIG_HOME,y()),t=$(process.env.LODESTAR_DATA_DIR,process.env.XDG_DATA_HOME,C()),K=process.env.LODESTAR_CONFIG??o(u,"config.toml"),n=o(t,"daemon.pid"),f=o(t,"daemon.log"),S=o(t,"session-chat-map.json"),q=o(t,"session-resume-map.json"),z=o(t,"session-turns-map.json"),J=o(t,"session-model-map.json"),Q=o(t,"tasklist-map.json"),Y=o(t,"notify-callbacks.json"),Z=o(t,"alive-on-shutdown.json"),i=o(t,"inbox"),W=o(t,"debug.sock"),X=o(t,"debug-context.json");var s={reset:"\x1B[0m",bold:"\x1B[1m",cyan:"\x1B[36m",green:"\x1B[32m",yellow:"\x1B[33m",red:"\x1B[31m",dim:"\x1B[2m"},p=["@leviyuan/lodestar@latest","@openai/codex@latest","@anthropic-ai/claude-code@latest","@anthropic-ai/claude-agent-sdk@latest","@anthropic-ai/sdk@latest"];function w(){let e=process.platform==="win32"?"npm.cmd":"npm";return new Promise((l)=>{let m=b(e,["install","-g",...p],{stdio:"inherit",shell:process.platform==="win32"});m.on("exit",(c)=>l(c??1)),m.on("error",(c)=>{console.error(`${s.red}spawn npm 失败:${s.reset} ${c.message}`),l(1)})})}async function x(){console.log(`${s.bold}更新 Lodestar + Codex CLI + Claude Code / SDK${s.reset}`),console.log(`${s.dim}npm i -g ${p.join(" ")}${s.reset}
2
+ import{spawn as b}from"node:child_process";import{existsSync as g}from"node:fs";import{homedir as d}from"node:os";import{join as o}from"node:path";var r=d(),a=process.platform==="win32";function n(e,l,m){if(e)return e;if(l)return o(l,"lodestar");return m}function y(){if(a)return o(process.env.APPDATA??o(r,"AppData","Roaming"),"Lodestar");return o(r,".config","lodestar")}function u(){if(a)return o(process.env.LOCALAPPDATA??o(r,"AppData","Local"),"Lodestar");return o(r,".local","share","lodestar")}var C=n(process.env.LODESTAR_CONFIG_DIR,process.env.XDG_CONFIG_HOME,y()),t=n(process.env.LODESTAR_DATA_DIR,process.env.XDG_DATA_HOME,u()),K=process.env.LODESTAR_CONFIG??o(C,"config.toml"),$=o(t,"daemon.pid"),f=o(t,"daemon.log"),S=o(t,"session-chat-map.json"),i=o(t,"session-resume-map.json"),q=o(t,"session-turns-map.json"),z=o(t,"session-model-map.json"),J=o(t,"tasklist-map.json"),Q=o(t,"notify-callbacks.json"),Y=o(t,"alive-on-shutdown.json"),Z=o(t,"inbox"),W=o(t,"debug.sock"),X=o(t,"debug-context.json");var s={reset:"\x1B[0m",bold:"\x1B[1m",cyan:"\x1B[36m",green:"\x1B[32m",yellow:"\x1B[33m",red:"\x1B[31m",dim:"\x1B[2m"},p=["@leviyuan/lodestar@latest","@openai/codex@latest","@anthropic-ai/claude-code@latest","@anthropic-ai/claude-agent-sdk@latest","@anthropic-ai/sdk@latest"];function w(){let e=process.platform==="win32"?"npm.cmd":"npm";return new Promise((l)=>{let m=b(e,["install","-g","--include=optional",...p],{stdio:"inherit",shell:process.platform==="win32"});m.on("exit",(c)=>l(c??1)),m.on("error",(c)=>{console.error(`${s.red}spawn npm 失败:${s.reset} ${c.message}`),l(1)})})}async function x(){console.log(`${s.bold}更新 Lodestar + Codex CLI + Claude Code / SDK${s.reset}`),console.log(`${s.dim}npm i -g ${p.join(" ")}${s.reset}
3
3
  `);let e=await w();if(e!==0)console.error(`
4
4
  ${s.red}更新失败 (npm exit ${e})${s.reset}`),process.exit(e);if(console.log(`
5
- ${s.green}✓ 更新完成${s.reset}`),g(n))console.log(),console.log(`${s.yellow}检测到 daemon 仍在跑老版本进程, 用新版本需要重启:${s.reset}`),console.log(` ${s.dim}# systemd / Windows 后台托管的:${s.reset}`),console.log(` ${s.cyan}systemctl --user restart lodestar${s.reset} ${s.dim}# Linux/macOS${s.reset}`),console.log(` ${s.dim}# 或手动重启:${s.reset}`),console.log(` ${s.cyan}lodestar-stop && lodestar-daemon${s.reset}`)}x().catch((e)=>{console.error(`${s.red}lodestar-update:${s.reset} ${e?.message??e}`),process.exit(1)});
5
+ ${s.green}✓ 更新完成${s.reset}`),g($))console.log(),console.log(`${s.yellow}检测到 daemon 仍在跑老版本进程, 用新版本需要重启:${s.reset}`),console.log(` ${s.dim}# systemd / Windows 后台托管的:${s.reset}`),console.log(` ${s.cyan}systemctl --user restart lodestar${s.reset} ${s.dim}# Linux/macOS${s.reset}`),console.log(` ${s.dim}# 或手动重启:${s.reset}`),console.log(` ${s.cyan}lodestar-stop && lodestar-daemon${s.reset}`)}x().catch((e)=>{console.error(`${s.red}lodestar-update:${s.reset} ${e?.message??e}`),process.exit(1)});