envpkt 0.7.0 → 0.7.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/cli.js +65 -0
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -3574,6 +3574,68 @@ const runShellHook = (shell) => {
3574
3574
  }
3575
3575
  };
3576
3576
 
3577
+ //#endregion
3578
+ //#region src/cli/commands/upgrade.ts
3579
+ const getCurrentVersion = () => {
3580
+ try {
3581
+ return execFileSync("npm", [
3582
+ "list",
3583
+ "-g",
3584
+ "envpkt",
3585
+ "--json"
3586
+ ], {
3587
+ encoding: "utf-8",
3588
+ stdio: [
3589
+ "pipe",
3590
+ "pipe",
3591
+ "pipe"
3592
+ ]
3593
+ }).match(/"envpkt":\s*\{\s*"version":\s*"([^"]+)"/)?.[1] ?? "unknown";
3594
+ } catch {
3595
+ return "unknown";
3596
+ }
3597
+ };
3598
+ const runUpgrade = () => {
3599
+ const before = getCurrentVersion();
3600
+ console.log(`${DIM}Current version: ${before}${RESET}`);
3601
+ console.log(`${CYAN}Upgrading envpkt...${RESET}\n`);
3602
+ try {
3603
+ execFileSync("npm", [
3604
+ "install",
3605
+ "-g",
3606
+ "envpkt@latest",
3607
+ "--prefer-online"
3608
+ ], {
3609
+ stdio: "inherit",
3610
+ encoding: "utf-8"
3611
+ });
3612
+ } catch {
3613
+ console.error(`\n${RED}Error:${RESET} npm install failed. Trying with cache clean...`);
3614
+ try {
3615
+ execFileSync("npm", [
3616
+ "cache",
3617
+ "clean",
3618
+ "--force"
3619
+ ], { stdio: "inherit" });
3620
+ execFileSync("npm", [
3621
+ "install",
3622
+ "-g",
3623
+ "envpkt@latest"
3624
+ ], {
3625
+ stdio: "inherit",
3626
+ encoding: "utf-8"
3627
+ });
3628
+ } catch {
3629
+ console.error(`${RED}Error:${RESET} Upgrade failed. Try manually:`);
3630
+ console.error(` ${BOLD}sudo npm install -g envpkt@latest --prefer-online${RESET}`);
3631
+ process.exit(1);
3632
+ }
3633
+ }
3634
+ const after = getCurrentVersion();
3635
+ if (before === after && before !== "unknown") console.log(`\n${GREEN}✓${RESET} Already on latest version ${BOLD}${after}${RESET}`);
3636
+ else console.log(`\n${GREEN}✓${RESET} Upgraded ${YELLOW}${before}${RESET} → ${BOLD}${after}${RESET}`);
3637
+ };
3638
+
3577
3639
  //#endregion
3578
3640
  //#region src/cli/index.ts
3579
3641
  const program = new Command();
@@ -3615,6 +3677,9 @@ program.command("mcp").description("Start the envpkt MCP server (stdio transport
3615
3677
  });
3616
3678
  registerSecretCommands(program);
3617
3679
  registerEnvCommands(program);
3680
+ program.command("upgrade").description("Upgrade envpkt to the latest version (npm install -g envpkt@latest)").action(() => {
3681
+ runUpgrade();
3682
+ });
3618
3683
  program.command("shell-hook").description("Output shell function for ambient credential warnings on cd — combine with env export for full setup").argument("<shell>", "Shell type: zsh | bash").action((shell) => {
3619
3684
  runShellHook(shell);
3620
3685
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "envpkt",
3
- "version": "0.7.0",
3
+ "version": "0.7.1",
4
4
  "description": "Credential lifecycle and fleet management for AI agents",
5
5
  "keywords": [
6
6
  "credentials",