@shenvy/cli 0.1.0 → 0.1.2

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.
package/Formula/shenvy.rb CHANGED
@@ -9,16 +9,16 @@ class Shenvy < Formula
9
9
 
10
10
  on_macos do
11
11
  if Hardware::CPU.intel?
12
- url "https://github.com/Shenvy/shenvy-cli-dist/releases/download/v0.1.0/shenvy-cli-dist_darwin_amd64.tar.gz"
13
- sha256 "3f486c04513381da912c86c47f1be452467503d9cf01388b6a2649f6d3481776"
12
+ url "https://github.com/Shenvy/shenvy-cli-dist/releases/download/v0.1.0/shenvy_darwin_amd64.tar.gz"
13
+ sha256 "bf74583e91bdd8fd53d943931cbf8aa6e5b643b7f4bcfec5025a830b07648e76"
14
14
 
15
15
  define_method(:install) do
16
16
  bin.install "shenvy"
17
17
  end
18
18
  end
19
19
  if Hardware::CPU.arm?
20
- url "https://github.com/Shenvy/shenvy-cli-dist/releases/download/v0.1.0/shenvy-cli-dist_darwin_arm64.tar.gz"
21
- sha256 "27a98935ba995bc06ae2e79511c1f9d84651b5b747affbbbfa83a8df27644f88"
20
+ url "https://github.com/Shenvy/shenvy-cli-dist/releases/download/v0.1.0/shenvy_darwin_arm64.tar.gz"
21
+ sha256 "924c4bb5a674b6b3f60735145a0c639649ae1ff82f435a3204e06a7ae8ade24e"
22
22
 
23
23
  define_method(:install) do
24
24
  bin.install "shenvy"
@@ -28,15 +28,15 @@ class Shenvy < Formula
28
28
 
29
29
  on_linux do
30
30
  if Hardware::CPU.intel? && Hardware::CPU.is_64_bit?
31
- url "https://github.com/Shenvy/shenvy-cli-dist/releases/download/v0.1.0/shenvy-cli-dist_linux_amd64.tar.gz"
32
- sha256 "fbe4afa3d3c854a8d3c5b8a6cda9c5111640be8363aa8f1980e97d40d1a5e8c7"
31
+ url "https://github.com/Shenvy/shenvy-cli-dist/releases/download/v0.1.0/shenvy_linux_amd64.tar.gz"
32
+ sha256 "53412ca19a768daddb73adcd33b40d633bcde3bb471acee087ce2e7b379216a0"
33
33
  define_method(:install) do
34
34
  bin.install "shenvy"
35
35
  end
36
36
  end
37
37
  if Hardware::CPU.arm? && Hardware::CPU.is_64_bit?
38
- url "https://github.com/Shenvy/shenvy-cli-dist/releases/download/v0.1.0/shenvy-cli-dist_linux_arm64.tar.gz"
39
- sha256 "59161ee5b83b34f2f2dc843e5bb5a33484043fed293e8590756243c8b0c35fdc"
38
+ url "https://github.com/Shenvy/shenvy-cli-dist/releases/download/v0.1.0/shenvy_linux_arm64.tar.gz"
39
+ sha256 "9639b4b572f9cea8c3d4fa27ac97c52407ea6bb4a8108fb3e4eb2c445bd641f8"
40
40
  define_method(:install) do
41
41
  bin.install "shenvy"
42
42
  end
package/bin/install.js CHANGED
@@ -4,10 +4,11 @@ const fs = require('fs');
4
4
  const path = require('path');
5
5
  const https = require('https');
6
6
  const os = require('os');
7
+ const { execSync } = require('child_process');
7
8
 
8
9
  const PROJECT_NAME = 'shenvy';
9
10
  const REPO = 'Shenvy/shenvy-cli-dist';
10
- const VERSION = require('../package.json').version;
11
+ const BINARY_VERSION = '0.1.0';
11
12
 
12
13
  const platform = os.platform();
13
14
  const arch = os.arch();
@@ -28,9 +29,11 @@ if (!archiveName) {
28
29
  process.exit(1);
29
30
  }
30
31
 
31
- const url = `https://github.com/${REPO}/releases/download/v${VERSION}/${PROJECT_NAME}_${archiveName}`;
32
+ const url = `https://github.com/${REPO}/releases/download/v${BINARY_VERSION}/${PROJECT_NAME}_${archiveName}`;
32
33
  const binDir = path.join(__dirname);
33
- const binPath = path.join(binDir, platform === 'win32' ? 'shenvy.exe' : 'shenvy-bin');
34
+ const tempArchive = path.join(binDir, archiveName);
35
+ const finalBinName = platform === 'win32' ? 'shenvy.exe' : 'shenvy';
36
+ const finalBinPath = path.join(binDir, platform === 'win32' ? 'shenvy.exe' : 'shenvy-bin');
34
37
 
35
38
  console.log(`Downloading ${PROJECT_NAME} for ${target} from ${url}...`);
36
39
 
@@ -57,13 +60,36 @@ function download(url, dest) {
57
60
  });
58
61
  }
59
62
 
60
- // Note: In a real production environment, we would use a library like 'tar' or 'adm-zip'
61
- // but to keep dependencies zero, we would ideally bundle them or use child_process for unzip/tar.
62
- // For this template, we assume the binary is directly downloadable or handled by a small helper.
63
- download(url, binPath)
63
+ download(url, tempArchive)
64
64
  .then(() => {
65
- if (platform !== 'win32') {
66
- fs.chmodSync(binPath, 0o755);
65
+ console.log('Extracting archive...');
66
+
67
+ // Fix for Windows tar: use forward slashes and --force-local to avoid "hostname" error
68
+ const tarArchive = tempArchive.replace(/\\/g, '/');
69
+ const tarDir = binDir.replace(/\\/g, '/');
70
+ const forceLocal = platform === 'win32' ? '--force-local ' : '';
71
+
72
+ try {
73
+ execSync(`tar ${forceLocal}-xf "${tarArchive}" -C "${tarDir}"`);
74
+ } catch (e) {
75
+ console.error('Failed to extract with tar. Trying fallback rename...');
76
+ // If tar fails, we at least have the archive
77
+ }
78
+
79
+ // Rename the extracted binary to the expected name if needed
80
+ const extractedBinPath = path.join(binDir, finalBinName);
81
+ if (fs.existsSync(extractedBinPath) && extractedBinPath !== finalBinPath) {
82
+ if (fs.existsSync(finalBinPath)) fs.unlinkSync(finalBinPath);
83
+ fs.renameSync(extractedBinPath, finalBinPath);
84
+ }
85
+
86
+ // Clean up the archive if it exists
87
+ if (fs.existsSync(tempArchive)) {
88
+ fs.unlinkSync(tempArchive);
89
+ }
90
+
91
+ if (platform !== 'win32' && fs.existsSync(finalBinPath)) {
92
+ fs.chmodSync(finalBinPath, 0o755);
67
93
  }
68
94
  console.log(`${PROJECT_NAME} installed successfully.`);
69
95
  })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shenvy/cli",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "description": "Securely manage environment variables with E2EE (Go implementation wrapper)",
5
5
  "main": "bin/install.js",
6
6
  "bin": {
package/scoop/shenvy.json CHANGED
@@ -2,18 +2,18 @@
2
2
  "version": "0.1.0",
3
3
  "architecture": {
4
4
  "64bit": {
5
- "url": "https://github.com/Shenvy/shenvy-cli-dist/releases/download/v0.1.0/shenvy-cli-dist_windows_amd64.zip",
5
+ "url": "https://github.com/Shenvy/shenvy-cli-dist/releases/download/v0.1.0/shenvy_windows_amd64.zip",
6
6
  "bin": [
7
7
  "shenvy.exe"
8
8
  ],
9
- "hash": "cf9db60fa159a42b60ad88db90f5f03863c910fbe6eaaab46216891986da384e"
9
+ "hash": "c643fca42505730c4e015d811e172bd9a6201316ebfbd513ae1608a8c97a3a77"
10
10
  },
11
11
  "arm64": {
12
- "url": "https://github.com/Shenvy/shenvy-cli-dist/releases/download/v0.1.0/shenvy-cli-dist_windows_arm64.zip",
12
+ "url": "https://github.com/Shenvy/shenvy-cli-dist/releases/download/v0.1.0/shenvy_windows_arm64.zip",
13
13
  "bin": [
14
14
  "shenvy.exe"
15
15
  ],
16
- "hash": "5fd64935a48227a2308a740f2a630682367bfa4eec0e83f5153668d4bca381fe"
16
+ "hash": "641dff0ad0fe9d06f199b07ed1b7e46db8e4253ed60892b2b31c5960dd0ead55"
17
17
  }
18
18
  },
19
19
  "homepage": "https://shenvy.dev",