@shenvy/cli 0.1.8 → 0.1.10

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
@@ -4,21 +4,21 @@
4
4
  # This file was generated by GoReleaser. DO NOT EDIT.
5
5
  class Shenvy < Formula
6
6
  desc "Securely manage environment variables with E2EE."
7
- homepage "https://shenvy.dev"
8
- version "0.1.7"
7
+ homepage "https://shenvy.net"
8
+ version "0.1.10"
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.7/shenvy_darwin_amd64.tar.gz"
13
- sha256 "ee1e6c19ad873bdd734d198ef0eebca4888713fe8b3c84a6c374bce17962a3f4"
12
+ url "https://github.com/Shenvy/shenvy-cli-dist/releases/download/v0.1.10/shenvy_darwin_amd64.tar.gz"
13
+ sha256 "5d956c18f91e51fdae17a9f74bf00a803962da0edeedb0562956fe271d5ea29d"
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.7/shenvy_darwin_arm64.tar.gz"
21
- sha256 "fed746ba5b3dc583813e3723878567fb65f82f5e0f5e62c5fe880ab19263ef74"
20
+ url "https://github.com/Shenvy/shenvy-cli-dist/releases/download/v0.1.10/shenvy_darwin_arm64.tar.gz"
21
+ sha256 "ec879d7cc90c1549533c2a6d23ffe53723fa6320950a0a620ed990ae6accd268"
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.7/shenvy_linux_amd64.tar.gz"
32
- sha256 "7bafe1011b8a6cbf819251f8be90dd16a6786b84f07a0b7bcc5dbd8100209cca"
31
+ url "https://github.com/Shenvy/shenvy-cli-dist/releases/download/v0.1.10/shenvy_linux_amd64.tar.gz"
32
+ sha256 "3c36d7bdc6217554da21bf41082d4912fedca4eae03423e17e189dc665b497d7"
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.7/shenvy_linux_arm64.tar.gz"
39
- sha256 "315503c0f9d62637b2dd405a25fa85d19647b86e0a159d91c570029b6295279f"
38
+ url "https://github.com/Shenvy/shenvy-cli-dist/releases/download/v0.1.10/shenvy_linux_arm64.tar.gz"
39
+ sha256 "c7ef8ea771a06673efb8175f7109173f9b8a5fd72f0225acf96929b9a0900bc1"
40
40
  define_method(:install) do
41
41
  bin.install "shenvy"
42
42
  end
package/bin/README.md ADDED
@@ -0,0 +1,345 @@
1
+ # Shenvy CLI
2
+
3
+ CLI to manage projects, teams, members, and environment variables securely with end-to-end encryption.
4
+
5
+ ## Installation
6
+
7
+ Shenvy CLI can be installed through several package managers for easy management and updates.
8
+
9
+ ### NPM (Node.js)
10
+ The easiest way for web developers to install Shenvy CLI:
11
+ ```bash
12
+ npm install -g @shenvy/cli
13
+ ```
14
+
15
+ ### Homebrew (macOS & Linux)
16
+ Add our official tap and install the formula:
17
+ ```bash
18
+ brew install Shenvy/tap/shenvy
19
+ ```
20
+
21
+ ### Scoop (Windows)
22
+ Add our bucket and install:
23
+ ```bash
24
+ scoop bucket add shenvy https://github.com/Shenvy/shenvy-cli-dist.git
25
+ scoop install shenvy
26
+ ```
27
+
28
+ ### Direct Binary
29
+ Download the latest binary for your platform from the [GitHub Releases](https://github.com/Shenvy/shenvy-cli-dist/releases) page and add it to your PATH.
30
+
31
+ ### Build from Source
32
+ If you have Go installed, you can build it manually:
33
+ ```bash
34
+ go build -o shenvy.exe
35
+ ```
36
+
37
+ ## Authentication
38
+
39
+ ### `login`
40
+ Log in via browser (Google, GitHub, or email).
41
+
42
+ ```bash
43
+ shenvy login
44
+ ```
45
+
46
+ ### `logout`
47
+ Log out of the current session.
48
+
49
+ ```bash
50
+ shenvy logout
51
+ ```
52
+
53
+ ### `user_info`
54
+ Display information about the authenticated user.
55
+
56
+ ```bash
57
+ shenvy user_info
58
+ ```
59
+
60
+ ## Project Management
61
+
62
+ ### `init`
63
+ Initialize a shenvy repository in the current directory.
64
+
65
+ ```bash
66
+ shenvy init
67
+ ```
68
+
69
+ ### `project list`
70
+ List all projects you have access to.
71
+
72
+ ```bash
73
+ shenvy project list
74
+ ```
75
+
76
+ ### `project info [projectId]`
77
+ Display details of a project. If no ID is provided, it uses the current project.
78
+
79
+ ```bash
80
+ shenvy project info
81
+ shenvy project info <projectId>
82
+ ```
83
+
84
+ ### `project update [projectId]`
85
+ Update the name or description of a project.
86
+
87
+ ```bash
88
+ shenvy project update --name "New Name" --desc "New description"
89
+ shenvy project update <projectId> --name "New Name"
90
+ ```
91
+
92
+ ### `project delete [projectId]`
93
+ Delete a project (soft delete).
94
+
95
+ ```bash
96
+ shenvy project delete
97
+ shenvy project delete <projectId>
98
+ ```
99
+
100
+ ### `project restore <projectId>`
101
+ Restore a deleted project.
102
+
103
+ ```bash
104
+ shenvy project restore <projectId>
105
+ ```
106
+
107
+ ### `status`
108
+ Display the current project status, tracked files, and pending changes.
109
+
110
+ ```bash
111
+ shenvy status
112
+ ```
113
+
114
+ ## Team Management
115
+
116
+ ### `team create <name>`
117
+ Create a new team.
118
+
119
+ ```bash
120
+ shenvy team create "My Team"
121
+ ```
122
+
123
+ ### `team info [teamId]`
124
+ Display details of a team. Without an ID, it lists all your teams.
125
+
126
+ ```bash
127
+ shenvy team info
128
+ shenvy team info <teamId>
129
+ ```
130
+
131
+ ### `team delete <teamId>`
132
+ Permanently delete a team.
133
+
134
+ ```bash
135
+ shenvy team delete <teamId>
136
+ ```
137
+
138
+ ### `team transfer <teamId> <newOwnerId>`
139
+ Transfer team ownership to another user.
140
+
141
+ ```bash
142
+ shenvy team transfer <teamId> <newOwnerId>
143
+ ```
144
+
145
+ ## Member Management
146
+
147
+ ### `member invite <teamId> <email> [role]`
148
+ Invite a user to the team. Roles: `MEMBER` (default), `ADMIN`, `READER`.
149
+
150
+ ```bash
151
+ shenvy member invite <teamId> user@example.com
152
+ shenvy member invite <teamId> user@example.com ADMIN
153
+ ```
154
+
155
+ ### `member list <teamId>`
156
+ List all members of a team.
157
+
158
+ ```bash
159
+ shenvy member list <teamId>
160
+ ```
161
+
162
+ ### `member update <teamId> <userId> <role>`
163
+ Update a member's role.
164
+
165
+ ```bash
166
+ shenvy member update <teamId> <userId> ADMIN
167
+ ```
168
+
169
+ ### `member remove <teamId> <userId>`
170
+ Remove a member from the team.
171
+
172
+ ```bash
173
+ shenvy member remove <teamId> <userId>
174
+ ```
175
+
176
+ ## Device Management
177
+
178
+ ### `registerdevice`
179
+ Register the current device as a recipient for the project.
180
+
181
+ ```bash
182
+ shenvy registerdevice
183
+ ```
184
+
185
+ ### `unregisterdevice`
186
+ Unregister the current device and remove the local identity.
187
+
188
+ ```bash
189
+ shenvy unregisterdevice
190
+ ```
191
+
192
+ ### `device list`
193
+ List all devices registered in the current project.
194
+
195
+ ```bash
196
+ shenvy device list
197
+ ```
198
+
199
+ ### `reset`
200
+ Reset the device identity.
201
+
202
+ ```bash
203
+ shenvy reset
204
+ ```
205
+
206
+ ## Environment Variable Management
207
+
208
+ ### `add <filename>`
209
+ Add a file to track.
210
+
211
+ ```bash
212
+ shenvy add .env
213
+ shenvy add .env.production
214
+ ```
215
+
216
+ ### `push`
217
+ Encrypt and upload all tracked files.
218
+
219
+ ```bash
220
+ shenvy push
221
+ ```
222
+
223
+ ### `pull`
224
+ Download, decrypt, and restore all tracked files.
225
+
226
+ ```bash
227
+ shenvy pull
228
+ ```
229
+
230
+ ### `run`
231
+ Execute a command with the environment variables loaded.
232
+
233
+ ```bash
234
+ # Load variables from the default environment
235
+ shenvy run -- npm start
236
+
237
+ # Load variables from a specific environment
238
+ shenvy run -e development -- npm start
239
+ ```
240
+
241
+ ### `plan`
242
+ Display information about the current subscription plan and its limits.
243
+
244
+ ```bash
245
+ shenvy plan
246
+ ```
247
+
248
+ ### `timeline`
249
+ Display the project's change history.
250
+
251
+ ```bash
252
+ shenvy timeline
253
+ ```
254
+
255
+ ### `env delete <envName>`
256
+ Delete a variable file (soft delete).
257
+
258
+ ```bash
259
+ shenvy env delete .env.production
260
+ ```
261
+
262
+ ### `env restore <envId>`
263
+ Restore a deleted variable file.
264
+
265
+ ```bash
266
+ shenvy env restore <envId>
267
+ ```
268
+
269
+ ### `env versions <envName>`
270
+ List all versions of a variable file.
271
+
272
+ ```bash
273
+ shenvy env versions .env.production
274
+ ```
275
+
276
+ ### `env rollback <envName> <version>`
277
+ Roll back a file to a specific version.
278
+
279
+ ```bash
280
+ shenvy env rollback .env.production 3
281
+ ```
282
+
283
+ ## Autocomplete
284
+
285
+ Generate autocomplete scripts for your shell:
286
+
287
+ ### PowerShell
288
+ ```powershell
289
+ shenvy completion powershell | Out-String | Invoke-Expression
290
+ ```
291
+
292
+ To make it permanent, add it to your `$PROFILE`:
293
+ ```powershell
294
+ shenvy completion powershell | Out-String | Invoke-Expression
295
+ ```
296
+
297
+ ### Bash
298
+ ```bash
299
+ shenvy completion bash > /etc/bash_completion.d/shenvy
300
+ ```
301
+
302
+ ### Zsh
303
+ ```bash
304
+ shenvy completion zsh > "${fpath[1]}/_shenvy"
305
+ ```
306
+
307
+ ## Typical Workflow
308
+
309
+ 1. **Initialize project**:
310
+ ```bash
311
+ shenvy login
312
+ shenvy init
313
+ ```
314
+
315
+ 2. **Add environment files**:
316
+ ```bash
317
+ shenvy add .env
318
+ shenvy add .env.production
319
+ ```
320
+
321
+ 3. **Register device**:
322
+ ```bash
323
+ shenvy registerdevice
324
+ ```
325
+
326
+ 4. **Encrypt and upload**:
327
+ ```bash
328
+ shenvy push
329
+ ```
330
+
331
+ 5. **Download on another device**:
332
+ ```bash
333
+ shenvy login
334
+ cd <project>
335
+ shenvy registerdevice
336
+ # An admin must run 'shenvy push' to include the new device
337
+ shenvy pull
338
+ ```
339
+
340
+ ## Security Notes
341
+
342
+ - **Zero Knowledge**: The server never knows your secrets.
343
+ - **End-to-End Encryption**: Uses Age (X25519) + ChaCha20-Poly1305.
344
+ - **Devices**: Each device has its own key. An admin must re-encrypt to include new devices.
345
+ - **Soft Deletes**: Projects and variable files are soft-deleted and can be restored.
package/bin/install.js CHANGED
@@ -41,10 +41,17 @@ function download(url, dest) {
41
41
  const file = fs.createWriteStream(dest);
42
42
  https.get(url, (response) => {
43
43
  if (response.statusCode === 302 || response.statusCode === 301) {
44
- return download(response.headers.location, dest).then(resolve).catch(reject);
44
+ // Close the write stream BEFORE recursing — on Windows, open handles
45
+ // block PowerShell's Expand-Archive even after file.close() is called.
46
+ file.close(() => {
47
+ download(response.headers.location, dest).then(resolve).catch(reject);
48
+ });
49
+ return;
45
50
  }
46
51
  if (response.statusCode !== 200) {
47
- reject(new Error(`Failed to download: ${response.statusCode}`));
52
+ file.close(() => {
53
+ reject(new Error(`Failed to download: ${response.statusCode}`));
54
+ });
48
55
  return;
49
56
  }
50
57
  response.pipe(file);
@@ -52,8 +59,10 @@ function download(url, dest) {
52
59
  file.close(() => resolve());
53
60
  });
54
61
  }).on('error', (err) => {
55
- fs.unlink(dest, () => {});
56
- reject(err);
62
+ file.close(() => {
63
+ fs.unlink(dest, () => {});
64
+ reject(err);
65
+ });
57
66
  });
58
67
  });
59
68
  }
@@ -63,8 +72,8 @@ const wait = (ms) => new Promise(r => setTimeout(r, ms));
63
72
  async function ensureFileReady(filePath) {
64
73
  for (let i = 0; i < 10; i++) {
65
74
  try {
66
- // Try to open file for appending to check if it's locked
67
- const fd = fs.openSync(filePath, 'r+');
75
+ // Open read-only to check if the OS has fully released the file handle
76
+ const fd = fs.openSync(filePath, 'r');
68
77
  fs.closeSync(fd);
69
78
  return true;
70
79
  } catch (e) {
package/bin/shenvy CHANGED
@@ -2,13 +2,13 @@
2
2
  basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
3
3
 
4
4
  case `uname` in
5
- *CYGWIN*|*MINGW*|*MSYS*) exe_ext=.exe ;;
6
- *) exe_ext= ;;
5
+ *CYGWIN*|*MINGW*|*MSYS*) bin_name="shenvy.exe" ;;
6
+ *) bin_name="shenvy-bin" ;;
7
7
  esac
8
8
 
9
- if [ -x "$basedir/shenvy-bin" ]; then
10
- "$basedir/shenvy-bin" "$@"
9
+ if [ -x "$basedir/$bin_name" ]; then
10
+ "$basedir/$bin_name" "$@"
11
11
  else
12
12
  # Fallback if binary is not yet downloaded
13
- node "$basedir/install.js" && "$basedir/shenvy-bin" "$@"
13
+ node "$basedir/install.js" && "$basedir/$bin_name" "$@"
14
14
  fi
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shenvy/cli",
3
- "version": "0.1.8",
3
+ "version": "0.1.10",
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
@@ -1,22 +1,22 @@
1
1
  {
2
- "version": "0.1.7",
2
+ "version": "0.1.10",
3
3
  "architecture": {
4
4
  "64bit": {
5
- "url": "https://github.com/Shenvy/shenvy-cli-dist/releases/download/v0.1.7/shenvy_windows_amd64.zip",
5
+ "url": "https://github.com/Shenvy/shenvy-cli-dist/releases/download/v0.1.10/shenvy_windows_amd64.zip",
6
6
  "bin": [
7
7
  "shenvy.exe"
8
8
  ],
9
- "hash": "22304a00ee345b6d5a9a3971cc308cadd1530cb3859f2f2ab8a23a9539c50f1a"
9
+ "hash": "812fd386d8a32a7ee674db31b5d2ebf79082591728f9fd37322ecc7fc3ea39ae"
10
10
  },
11
11
  "arm64": {
12
- "url": "https://github.com/Shenvy/shenvy-cli-dist/releases/download/v0.1.7/shenvy_windows_arm64.zip",
12
+ "url": "https://github.com/Shenvy/shenvy-cli-dist/releases/download/v0.1.10/shenvy_windows_arm64.zip",
13
13
  "bin": [
14
14
  "shenvy.exe"
15
15
  ],
16
- "hash": "0e1daa2744d72e2ed8aaaae758a4501a2ae05cb72b14591a06a4d7803566fd68"
16
+ "hash": "47239c53f91fc16dc017897ecce22ee0374d0897de9fbd39d95471b082983e1b"
17
17
  }
18
18
  },
19
- "homepage": "https://shenvy.dev",
19
+ "homepage": "https://shenvy.net",
20
20
  "license": "MIT",
21
21
  "description": "Securely manage environment variables with E2EE."
22
22
  }