@co0ontty/wand 1.1.0 → 1.1.1

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/dist/server.js +7 -3
  2. package/package.json +1 -1
package/dist/server.js CHANGED
@@ -19,11 +19,15 @@ const PKG_NODE_REQ = PKG_JSON.engines?.node ?? ">=22.5.0";
19
19
  const PKG_REPO_URL = "https://github.com/co0ontty/wand";
20
20
  // ── Update check cache ──
21
21
  let cachedLatestVersion = null;
22
- async function checkNpmLatestVersion() {
23
- if (!cachedLatestVersion) {
22
+ let cacheTimestamp = 0;
23
+ const CACHE_TTL_MS = 10 * 60 * 1000; // 10 minutes
24
+ async function checkNpmLatestVersion(forceRefresh = false) {
25
+ const now = Date.now();
26
+ if (forceRefresh || !cachedLatestVersion || (now - cacheTimestamp > CACHE_TTL_MS)) {
24
27
  try {
25
28
  const { stdout } = await execAsync(`npm view ${PKG_NAME} version`, { timeout: 15000 });
26
29
  cachedLatestVersion = stdout.trim();
30
+ cacheTimestamp = now;
27
31
  }
28
32
  catch {
29
33
  cachedLatestVersion = null;
@@ -460,7 +464,7 @@ export async function startServer(config, configPath) {
460
464
  });
461
465
  app.get("/api/check-update", async (_req, res) => {
462
466
  try {
463
- const result = await checkNpmLatestVersion();
467
+ const result = await checkNpmLatestVersion(true);
464
468
  res.json(result);
465
469
  }
466
470
  catch (error) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@co0ontty/wand",
3
- "version": "1.1.0",
3
+ "version": "1.1.1",
4
4
  "description": "A web terminal for local CLI tools like Claude.",
5
5
  "type": "module",
6
6
  "bin": {