@envpilot/cli 1.3.0 → 1.3.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/index.js +50 -2
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -9,7 +9,7 @@ function initSentry() {
9
9
  Sentry.init({
10
10
  dsn,
11
11
  environment: "cli",
12
- release: true ? "1.3.0" : "0.0.0",
12
+ release: true ? "1.3.1" : "0.0.0",
13
13
  // Free tier: disable performance monitoring
14
14
  tracesSampleRate: 0,
15
15
  beforeSend(event) {
@@ -2252,10 +2252,55 @@ var usageCommand = new Command9("usage").description("Show plan usage and limits
2252
2252
  }
2253
2253
  });
2254
2254
 
2255
+ // src/lib/version-check.ts
2256
+ import chalk11 from "chalk";
2257
+ import Conf2 from "conf";
2258
+ var CLI_VERSION = "1.3.1";
2259
+ var CHECK_INTERVAL = 60 * 60 * 1e3;
2260
+ var _cache = null;
2261
+ function getCache() {
2262
+ if (!_cache) {
2263
+ _cache = new Conf2({
2264
+ projectName: "envpilot",
2265
+ configName: "version-cache"
2266
+ });
2267
+ }
2268
+ return _cache;
2269
+ }
2270
+ function checkForUpdate() {
2271
+ const cache = getCache();
2272
+ const lastCheck = cache.get("lastVersionCheck");
2273
+ if (lastCheck && Date.now() - lastCheck < CHECK_INTERVAL) return;
2274
+ const apiUrl = getApiUrl();
2275
+ fetch(`${apiUrl}/api/version`, { signal: AbortSignal.timeout(5e3) }).then((res) => {
2276
+ if (!res.ok) return;
2277
+ return res.json();
2278
+ }).then((data) => {
2279
+ if (!data?.cli) return;
2280
+ cache.set("lastVersionCheck", Date.now());
2281
+ if (data.cli !== CLI_VERSION) {
2282
+ console.log();
2283
+ console.log(
2284
+ chalk11.yellow(" Update available:"),
2285
+ chalk11.dim(CLI_VERSION),
2286
+ chalk11.yellow("\u2192"),
2287
+ chalk11.green(data.cli)
2288
+ );
2289
+ console.log(
2290
+ chalk11.dim(" Run"),
2291
+ chalk11.cyan("npm update -g @envpilot/cli"),
2292
+ chalk11.dim("to update")
2293
+ );
2294
+ console.log();
2295
+ }
2296
+ }).catch(() => {
2297
+ });
2298
+ }
2299
+
2255
2300
  // src/index.ts
2256
2301
  initSentry();
2257
2302
  var program = new Command10();
2258
- program.name("envpilot").description("Envpilot CLI - Sync, secure, and share environment variables").version("1.3.0");
2303
+ program.name("envpilot").description("Envpilot CLI - Sync, secure, and share environment variables").version("1.3.1");
2259
2304
  program.addCommand(loginCommand);
2260
2305
  program.addCommand(logoutCommand);
2261
2306
  program.addCommand(initCommand);
@@ -2265,4 +2310,7 @@ program.addCommand(switchCommand);
2265
2310
  program.addCommand(listCommand);
2266
2311
  program.addCommand(configCommand);
2267
2312
  program.addCommand(usageCommand);
2313
+ program.hook("postAction", () => {
2314
+ checkForUpdate();
2315
+ });
2268
2316
  program.parse();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@envpilot/cli",
3
- "version": "1.3.0",
3
+ "version": "1.3.1",
4
4
  "description": "Envpilot CLI — sync and manage environment variables from the terminal",
5
5
  "type": "module",
6
6
  "bin": {