cli-atom 0.2.5 → 0.2.6

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/atom.js +23 -1
  2. package/package.json +1 -1
package/atom.js CHANGED
@@ -39,7 +39,7 @@ const IGNORE_EXTS = [".png", ".jpg", ".jpeg", ".gif", ".ico", ".svg", ".woff", "
39
39
  const MAX_FILE_SIZE = 15_000;
40
40
  let MODEL = "z-ai/glm-5-turbo";
41
41
  let MODEL_LABEL = "glm-5-turbo";
42
- const VERSION = "0.2.5";
42
+ const VERSION = "0.2.6";
43
43
 
44
44
  const MODELS = [
45
45
  { id: "z-ai/glm-5-turbo", label: "glm-5-turbo" },
@@ -955,6 +955,18 @@ function getDate() {
955
955
  }
956
956
 
957
957
 
958
+
959
+ async function checkForUpdate() {
960
+ try {
961
+ const res = await fetch(`https://registry.npmjs.org/cli-atom/latest`, { signal: AbortSignal.timeout(3000) });
962
+ if (!res.ok) return null;
963
+ const data = await res.json();
964
+ return data.version || null;
965
+ } catch {
966
+ return null;
967
+ }
968
+ }
969
+
958
970
  async function start() {
959
971
  console.clear();
960
972
 
@@ -966,6 +978,10 @@ async function start() {
966
978
  const now = getNow();
967
979
  const date = getDate();
968
980
 
981
+ // check for update in background
982
+ const latestVersion = await checkForUpdate();
983
+ const hasUpdate = latestVersion && latestVersion !== VERSION;
984
+
969
985
  console.log();
970
986
  console.log(rule("─"));
971
987
  console.log();
@@ -998,6 +1014,12 @@ async function start() {
998
1014
  console.log(rule("─"));
999
1015
  console.log();
1000
1016
 
1017
+ if (hasUpdate) {
1018
+ console.log(` ${t.warn}update available${t.reset} ${t.muted}v${VERSION} → ${t.accent}v${latestVersion}${t.reset}`);
1019
+ console.log(` ${t.dim}run ${t.accent}npm install -g cli-atom${t.dim} to update${t.reset}`);
1020
+ console.log();
1021
+ }
1022
+
1001
1023
  console.log(`${t.violetDim}ready${t.reset}`);
1002
1024
 
1003
1025
  askPrompt();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cli-atom",
3
- "version": "0.2.5",
3
+ "version": "0.2.6",
4
4
  "description": "ATOM - Coding Agent",
5
5
  "license": "ISC",
6
6
  "author": "Redwxll",