varlock 0.0.3 → 0.0.5

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 (102) hide show
  1. package/README.md +48 -25
  2. package/dist/auto-load.js +5 -6
  3. package/dist/{chunk-7UQXFWKN.js → chunk-365YVT72.js} +93 -3
  4. package/dist/chunk-365YVT72.js.map +1 -0
  5. package/dist/{chunk-CPA2D42B.js → chunk-7SCZ3YWG.js} +10 -9
  6. package/dist/chunk-7SCZ3YWG.js.map +1 -0
  7. package/dist/{chunk-RF3YMFUX.js → chunk-C2ZQAQUU.js} +3 -4
  8. package/dist/chunk-C2ZQAQUU.js.map +1 -0
  9. package/dist/chunk-EVHLEWHL.js +59 -0
  10. package/dist/chunk-EVHLEWHL.js.map +1 -0
  11. package/dist/{chunk-3KZR56NU.js → chunk-GAQWSZCY.js} +3 -4
  12. package/dist/chunk-GAQWSZCY.js.map +1 -0
  13. package/dist/{chunk-7QXRUUDC.js → chunk-GCUCCUG5.js} +29 -7
  14. package/dist/chunk-GCUCCUG5.js.map +1 -0
  15. package/dist/{chunk-2CM6PMED.js → chunk-GVAD672U.js} +15 -27
  16. package/dist/chunk-GVAD672U.js.map +1 -0
  17. package/dist/{chunk-RPLDMNWT.js → chunk-HMRN5QZL.js} +3 -3
  18. package/dist/{chunk-RPLDMNWT.js.map → chunk-HMRN5QZL.js.map} +1 -1
  19. package/dist/{chunk-TYL3Q4QG.js → chunk-K2N2TG4M.js} +1227 -1259
  20. package/dist/chunk-K2N2TG4M.js.map +1 -0
  21. package/dist/chunk-LHTLO65N.js +99 -0
  22. package/dist/chunk-LHTLO65N.js.map +1 -0
  23. package/dist/{chunk-OXV76U3Y.js → chunk-LU2R63B4.js} +3 -4
  24. package/dist/chunk-LU2R63B4.js.map +1 -0
  25. package/dist/{chunk-B4UBSMSZ.js → chunk-PUGFIZE3.js} +4 -3
  26. package/dist/chunk-PUGFIZE3.js.map +1 -0
  27. package/dist/chunk-PZE4KJJW.js +14 -0
  28. package/dist/{chunk-3EBGAOLH.js.map → chunk-PZE4KJJW.js.map} +1 -1
  29. package/dist/{chunk-RCHPHIHX.js → chunk-RZT65DRA.js} +2 -2
  30. package/dist/chunk-RZT65DRA.js.map +1 -0
  31. package/dist/chunk-UFAGBKYG.js +54 -0
  32. package/dist/chunk-UFAGBKYG.js.map +1 -0
  33. package/dist/{chunk-5HDQH7UC.js → chunk-VVJO4FC3.js} +28 -169
  34. package/dist/chunk-VVJO4FC3.js.map +1 -0
  35. package/dist/chunk-VVKXMIKQ.js +180 -0
  36. package/dist/chunk-VVKXMIKQ.js.map +1 -0
  37. package/dist/{chunk-OSSLRXKM.js → chunk-WFN3ZXGS.js} +6 -6
  38. package/dist/chunk-WFN3ZXGS.js.map +1 -0
  39. package/dist/chunk-Y7WD33L3.js +17 -0
  40. package/dist/chunk-Y7WD33L3.js.map +1 -0
  41. package/dist/{chunk-NAZPFZOO.js → chunk-Z5KNSSLC.js} +10 -8
  42. package/dist/chunk-Z5KNSSLC.js.map +1 -0
  43. package/dist/cli/cli-executable.js +702 -158
  44. package/dist/cli/cli-executable.js.map +1 -1
  45. package/dist/doctor.command-NUG3BYDQ.js +7 -0
  46. package/dist/{doctor.command-L3P5LBOW.js.map → doctor.command-NUG3BYDQ.js.map} +1 -1
  47. package/dist/dotenv-compat.js +5 -6
  48. package/dist/encrypt.command-AGHQ4KTI.js +7 -0
  49. package/dist/{encrypt.command-VGJABHNK.js.map → encrypt.command-AGHQ4KTI.js.map} +1 -1
  50. package/dist/env-B8lQt2sl.d.ts +42 -0
  51. package/dist/help.command-B7VWA53B.js +5 -0
  52. package/dist/{help.command-YZDL2VEQ.js.map → help.command-B7VWA53B.js.map} +1 -1
  53. package/dist/index.d.ts +1 -2
  54. package/dist/index.js +11 -10
  55. package/dist/index.js.map +1 -1
  56. package/dist/init.command-DHE2Q6FX.js +13 -0
  57. package/dist/{init.command-Q4YBHAEG.js.map → init.command-DHE2Q6FX.js.map} +1 -1
  58. package/dist/load.command-GGE4OANH.js +12 -0
  59. package/dist/{load.command-K22PEH3D.js.map → load.command-GGE4OANH.js.map} +1 -1
  60. package/dist/login.command-25PKQUGR.js +10 -0
  61. package/dist/{login.command-22RUZJLR.js.map → login.command-25PKQUGR.js.map} +1 -1
  62. package/dist/run.command-BLL6AL52.js +12 -0
  63. package/dist/{run.command-DUAYGL6F.js.map → run.command-BLL6AL52.js.map} +1 -1
  64. package/dist/runtime/env.d.ts +1 -27
  65. package/dist/runtime/env.js +1 -1
  66. package/dist/runtime/patch-console.js +2 -3
  67. package/dist/runtime/patch-response.js +2 -3
  68. package/dist/runtime/patch-server-response.js +2 -3
  69. package/dist/telemetry.command-MVL3E366.js +10 -0
  70. package/dist/telemetry.command-MVL3E366.js.map +1 -0
  71. package/package.json +6 -2
  72. package/dist/chunk-2CM6PMED.js.map +0 -1
  73. package/dist/chunk-3EBGAOLH.js +0 -14
  74. package/dist/chunk-3KZR56NU.js.map +0 -1
  75. package/dist/chunk-5HDQH7UC.js.map +0 -1
  76. package/dist/chunk-7QXRUUDC.js.map +0 -1
  77. package/dist/chunk-7UQXFWKN.js.map +0 -1
  78. package/dist/chunk-B4UBSMSZ.js.map +0 -1
  79. package/dist/chunk-CPA2D42B.js.map +0 -1
  80. package/dist/chunk-LQZ6ICSS.js +0 -21
  81. package/dist/chunk-LQZ6ICSS.js.map +0 -1
  82. package/dist/chunk-NAZPFZOO.js.map +0 -1
  83. package/dist/chunk-OSSLRXKM.js.map +0 -1
  84. package/dist/chunk-OXV76U3Y.js.map +0 -1
  85. package/dist/chunk-Q5P7F3WA.js +0 -107
  86. package/dist/chunk-Q5P7F3WA.js.map +0 -1
  87. package/dist/chunk-QCC3P7BT.js +0 -39
  88. package/dist/chunk-QCC3P7BT.js.map +0 -1
  89. package/dist/chunk-RCHPHIHX.js.map +0 -1
  90. package/dist/chunk-RF3YMFUX.js.map +0 -1
  91. package/dist/chunk-TYL3Q4QG.js.map +0 -1
  92. package/dist/chunk-XHOJF7U7.js +0 -12
  93. package/dist/chunk-XHOJF7U7.js.map +0 -1
  94. package/dist/doctor.command-L3P5LBOW.js +0 -6
  95. package/dist/encrypt.command-VGJABHNK.js +0 -6
  96. package/dist/help.command-YZDL2VEQ.js +0 -5
  97. package/dist/init.command-Q4YBHAEG.js +0 -11
  98. package/dist/load.command-K22PEH3D.js +0 -10
  99. package/dist/login.command-22RUZJLR.js +0 -7
  100. package/dist/opt-out.command-Y4KUQ6PQ.js +0 -5
  101. package/dist/opt-out.command-Y4KUQ6PQ.js.map +0 -1
  102. package/dist/run.command-DUAYGL6F.js +0 -10
@@ -1,24 +1,472 @@
1
- import { commandSpec as commandSpec$6 } from '../chunk-QCC3P7BT.js';
2
- import { CONFIG, commandSpec as commandSpec$7 } from '../chunk-CPA2D42B.js';
3
- import { CliExitError, commandSpec } from '../chunk-5HDQH7UC.js';
4
- import { fmt } from '../chunk-LQZ6ICSS.js';
5
- import { commandSpec as commandSpec$1 } from '../chunk-NAZPFZOO.js';
6
- import { commandSpec as commandSpec$2 } from '../chunk-2CM6PMED.js';
7
- import { commandSpec as commandSpec$3 } from '../chunk-B4UBSMSZ.js';
1
+ import { commandSpec as commandSpec$6 } from '../chunk-UFAGBKYG.js';
2
+ import { CONFIG, commandSpec as commandSpec$7 } from '../chunk-7SCZ3YWG.js';
3
+ import { commandSpec } from '../chunk-VVJO4FC3.js';
4
+ import { CliExitError, fmt } from '../chunk-VVKXMIKQ.js';
5
+ import { commandSpec as commandSpec$1 } from '../chunk-Z5KNSSLC.js';
6
+ import { commandSpec as commandSpec$2 } from '../chunk-GVAD672U.js';
7
+ import { commandSpec as commandSpec$3 } from '../chunk-PUGFIZE3.js';
8
8
  import '../chunk-DAZNZPLN.js';
9
- import { commandSpec as commandSpec$4 } from '../chunk-RPLDMNWT.js';
10
- import { commandSpec as commandSpec$5 } from '../chunk-RCHPHIHX.js';
9
+ import { commandSpec as commandSpec$4 } from '../chunk-HMRN5QZL.js';
10
+ import { commandSpec as commandSpec$5 } from '../chunk-RZT65DRA.js';
11
11
  import { cli } from '../chunk-33ROL4J5.js';
12
- import { InvalidEnvError } from '../chunk-OSSLRXKM.js';
13
- import '../chunk-Q5P7F3WA.js';
14
- import { ansis_default } from '../chunk-7UQXFWKN.js';
15
- import { EnvSourceParseError } from '../chunk-TYL3Q4QG.js';
12
+ import { InvalidEnvError } from '../chunk-WFN3ZXGS.js';
13
+ import '../chunk-Y7WD33L3.js';
14
+ import { ansis_default } from '../chunk-365YVT72.js';
15
+ import { gracefulExit, asyncExitHook } from '../chunk-LHTLO65N.js';
16
+ import '../chunk-EVHLEWHL.js';
17
+ import { EnvSourceParseError } from '../chunk-K2N2TG4M.js';
16
18
  import '../chunk-FGMXIEFA.js';
17
- import { __name } from '../chunk-XN24GZXQ.js';
18
- import { homedir } from 'os';
19
- import { join } from 'path';
20
- import { existsSync, readFileSync } from 'node:fs';
19
+ import { __commonJS, __name, __toESM } from '../chunk-XN24GZXQ.js';
20
+ import os2 from 'node:os';
21
+ import crypto, { createHash } from 'node:crypto';
22
+ import { join } from 'node:path';
23
+ import fs, { readFileSync, existsSync, mkdirSync, writeFileSync } from 'node:fs';
24
+ import Debug from 'debug';
25
+ import process2 from 'node:process';
21
26
 
27
+ // ../../node_modules/.pnpm/ci-info@4.3.0/node_modules/ci-info/vendors.json
28
+ var require_vendors = __commonJS({
29
+ "../../node_modules/.pnpm/ci-info@4.3.0/node_modules/ci-info/vendors.json"(exports, module) {
30
+ module.exports = [
31
+ {
32
+ name: "Agola CI",
33
+ constant: "AGOLA",
34
+ env: "AGOLA_GIT_REF",
35
+ pr: "AGOLA_PULL_REQUEST_ID"
36
+ },
37
+ {
38
+ name: "Appcircle",
39
+ constant: "APPCIRCLE",
40
+ env: "AC_APPCIRCLE",
41
+ pr: {
42
+ env: "AC_GIT_PR",
43
+ ne: "false"
44
+ }
45
+ },
46
+ {
47
+ name: "AppVeyor",
48
+ constant: "APPVEYOR",
49
+ env: "APPVEYOR",
50
+ pr: "APPVEYOR_PULL_REQUEST_NUMBER"
51
+ },
52
+ {
53
+ name: "AWS CodeBuild",
54
+ constant: "CODEBUILD",
55
+ env: "CODEBUILD_BUILD_ARN",
56
+ pr: {
57
+ env: "CODEBUILD_WEBHOOK_EVENT",
58
+ any: [
59
+ "PULL_REQUEST_CREATED",
60
+ "PULL_REQUEST_UPDATED",
61
+ "PULL_REQUEST_REOPENED"
62
+ ]
63
+ }
64
+ },
65
+ {
66
+ name: "Azure Pipelines",
67
+ constant: "AZURE_PIPELINES",
68
+ env: "TF_BUILD",
69
+ pr: {
70
+ BUILD_REASON: "PullRequest"
71
+ }
72
+ },
73
+ {
74
+ name: "Bamboo",
75
+ constant: "BAMBOO",
76
+ env: "bamboo_planKey"
77
+ },
78
+ {
79
+ name: "Bitbucket Pipelines",
80
+ constant: "BITBUCKET",
81
+ env: "BITBUCKET_COMMIT",
82
+ pr: "BITBUCKET_PR_ID"
83
+ },
84
+ {
85
+ name: "Bitrise",
86
+ constant: "BITRISE",
87
+ env: "BITRISE_IO",
88
+ pr: "BITRISE_PULL_REQUEST"
89
+ },
90
+ {
91
+ name: "Buddy",
92
+ constant: "BUDDY",
93
+ env: "BUDDY_WORKSPACE_ID",
94
+ pr: "BUDDY_EXECUTION_PULL_REQUEST_ID"
95
+ },
96
+ {
97
+ name: "Buildkite",
98
+ constant: "BUILDKITE",
99
+ env: "BUILDKITE",
100
+ pr: {
101
+ env: "BUILDKITE_PULL_REQUEST",
102
+ ne: "false"
103
+ }
104
+ },
105
+ {
106
+ name: "CircleCI",
107
+ constant: "CIRCLE",
108
+ env: "CIRCLECI",
109
+ pr: "CIRCLE_PULL_REQUEST"
110
+ },
111
+ {
112
+ name: "Cirrus CI",
113
+ constant: "CIRRUS",
114
+ env: "CIRRUS_CI",
115
+ pr: "CIRRUS_PR"
116
+ },
117
+ {
118
+ name: "Cloudflare Pages",
119
+ constant: "CLOUDFLARE_PAGES",
120
+ env: "CF_PAGES"
121
+ },
122
+ {
123
+ name: "Cloudflare Workers",
124
+ constant: "CLOUDFLARE_WORKERS",
125
+ env: "WORKERS_CI"
126
+ },
127
+ {
128
+ name: "Codefresh",
129
+ constant: "CODEFRESH",
130
+ env: "CF_BUILD_ID",
131
+ pr: {
132
+ any: [
133
+ "CF_PULL_REQUEST_NUMBER",
134
+ "CF_PULL_REQUEST_ID"
135
+ ]
136
+ }
137
+ },
138
+ {
139
+ name: "Codemagic",
140
+ constant: "CODEMAGIC",
141
+ env: "CM_BUILD_ID",
142
+ pr: "CM_PULL_REQUEST"
143
+ },
144
+ {
145
+ name: "Codeship",
146
+ constant: "CODESHIP",
147
+ env: {
148
+ CI_NAME: "codeship"
149
+ }
150
+ },
151
+ {
152
+ name: "Drone",
153
+ constant: "DRONE",
154
+ env: "DRONE",
155
+ pr: {
156
+ DRONE_BUILD_EVENT: "pull_request"
157
+ }
158
+ },
159
+ {
160
+ name: "dsari",
161
+ constant: "DSARI",
162
+ env: "DSARI"
163
+ },
164
+ {
165
+ name: "Earthly",
166
+ constant: "EARTHLY",
167
+ env: "EARTHLY_CI"
168
+ },
169
+ {
170
+ name: "Expo Application Services",
171
+ constant: "EAS",
172
+ env: "EAS_BUILD"
173
+ },
174
+ {
175
+ name: "Gerrit",
176
+ constant: "GERRIT",
177
+ env: "GERRIT_PROJECT"
178
+ },
179
+ {
180
+ name: "Gitea Actions",
181
+ constant: "GITEA_ACTIONS",
182
+ env: "GITEA_ACTIONS"
183
+ },
184
+ {
185
+ name: "GitHub Actions",
186
+ constant: "GITHUB_ACTIONS",
187
+ env: "GITHUB_ACTIONS",
188
+ pr: {
189
+ GITHUB_EVENT_NAME: "pull_request"
190
+ }
191
+ },
192
+ {
193
+ name: "GitLab CI",
194
+ constant: "GITLAB",
195
+ env: "GITLAB_CI",
196
+ pr: "CI_MERGE_REQUEST_ID"
197
+ },
198
+ {
199
+ name: "GoCD",
200
+ constant: "GOCD",
201
+ env: "GO_PIPELINE_LABEL"
202
+ },
203
+ {
204
+ name: "Google Cloud Build",
205
+ constant: "GOOGLE_CLOUD_BUILD",
206
+ env: "BUILDER_OUTPUT"
207
+ },
208
+ {
209
+ name: "Harness CI",
210
+ constant: "HARNESS",
211
+ env: "HARNESS_BUILD_ID"
212
+ },
213
+ {
214
+ name: "Heroku",
215
+ constant: "HEROKU",
216
+ env: {
217
+ env: "NODE",
218
+ includes: "/app/.heroku/node/bin/node"
219
+ }
220
+ },
221
+ {
222
+ name: "Hudson",
223
+ constant: "HUDSON",
224
+ env: "HUDSON_URL"
225
+ },
226
+ {
227
+ name: "Jenkins",
228
+ constant: "JENKINS",
229
+ env: [
230
+ "JENKINS_URL",
231
+ "BUILD_ID"
232
+ ],
233
+ pr: {
234
+ any: [
235
+ "ghprbPullId",
236
+ "CHANGE_ID"
237
+ ]
238
+ }
239
+ },
240
+ {
241
+ name: "LayerCI",
242
+ constant: "LAYERCI",
243
+ env: "LAYERCI",
244
+ pr: "LAYERCI_PULL_REQUEST"
245
+ },
246
+ {
247
+ name: "Magnum CI",
248
+ constant: "MAGNUM",
249
+ env: "MAGNUM"
250
+ },
251
+ {
252
+ name: "Netlify CI",
253
+ constant: "NETLIFY",
254
+ env: "NETLIFY",
255
+ pr: {
256
+ env: "PULL_REQUEST",
257
+ ne: "false"
258
+ }
259
+ },
260
+ {
261
+ name: "Nevercode",
262
+ constant: "NEVERCODE",
263
+ env: "NEVERCODE",
264
+ pr: {
265
+ env: "NEVERCODE_PULL_REQUEST",
266
+ ne: "false"
267
+ }
268
+ },
269
+ {
270
+ name: "Prow",
271
+ constant: "PROW",
272
+ env: "PROW_JOB_ID"
273
+ },
274
+ {
275
+ name: "ReleaseHub",
276
+ constant: "RELEASEHUB",
277
+ env: "RELEASE_BUILD_ID"
278
+ },
279
+ {
280
+ name: "Render",
281
+ constant: "RENDER",
282
+ env: "RENDER",
283
+ pr: {
284
+ IS_PULL_REQUEST: "true"
285
+ }
286
+ },
287
+ {
288
+ name: "Sail CI",
289
+ constant: "SAIL",
290
+ env: "SAILCI",
291
+ pr: "SAIL_PULL_REQUEST_NUMBER"
292
+ },
293
+ {
294
+ name: "Screwdriver",
295
+ constant: "SCREWDRIVER",
296
+ env: "SCREWDRIVER",
297
+ pr: {
298
+ env: "SD_PULL_REQUEST",
299
+ ne: "false"
300
+ }
301
+ },
302
+ {
303
+ name: "Semaphore",
304
+ constant: "SEMAPHORE",
305
+ env: "SEMAPHORE",
306
+ pr: "PULL_REQUEST_NUMBER"
307
+ },
308
+ {
309
+ name: "Sourcehut",
310
+ constant: "SOURCEHUT",
311
+ env: {
312
+ CI_NAME: "sourcehut"
313
+ }
314
+ },
315
+ {
316
+ name: "Strider CD",
317
+ constant: "STRIDER",
318
+ env: "STRIDER"
319
+ },
320
+ {
321
+ name: "TaskCluster",
322
+ constant: "TASKCLUSTER",
323
+ env: [
324
+ "TASK_ID",
325
+ "RUN_ID"
326
+ ]
327
+ },
328
+ {
329
+ name: "TeamCity",
330
+ constant: "TEAMCITY",
331
+ env: "TEAMCITY_VERSION"
332
+ },
333
+ {
334
+ name: "Travis CI",
335
+ constant: "TRAVIS",
336
+ env: "TRAVIS",
337
+ pr: {
338
+ env: "TRAVIS_PULL_REQUEST",
339
+ ne: "false"
340
+ }
341
+ },
342
+ {
343
+ name: "Vela",
344
+ constant: "VELA",
345
+ env: "VELA",
346
+ pr: {
347
+ VELA_PULL_REQUEST: "1"
348
+ }
349
+ },
350
+ {
351
+ name: "Vercel",
352
+ constant: "VERCEL",
353
+ env: {
354
+ any: [
355
+ "NOW_BUILDER",
356
+ "VERCEL"
357
+ ]
358
+ },
359
+ pr: "VERCEL_GIT_PULL_REQUEST_ID"
360
+ },
361
+ {
362
+ name: "Visual Studio App Center",
363
+ constant: "APPCENTER",
364
+ env: "APPCENTER_BUILD_ID"
365
+ },
366
+ {
367
+ name: "Woodpecker",
368
+ constant: "WOODPECKER",
369
+ env: {
370
+ CI: "woodpecker"
371
+ },
372
+ pr: {
373
+ CI_BUILD_EVENT: "pull_request"
374
+ }
375
+ },
376
+ {
377
+ name: "Xcode Cloud",
378
+ constant: "XCODE_CLOUD",
379
+ env: "CI_XCODE_PROJECT",
380
+ pr: "CI_PULL_REQUEST_NUMBER"
381
+ },
382
+ {
383
+ name: "Xcode Server",
384
+ constant: "XCODE_SERVER",
385
+ env: "XCS"
386
+ }
387
+ ];
388
+ }
389
+ });
390
+
391
+ // ../../node_modules/.pnpm/ci-info@4.3.0/node_modules/ci-info/index.js
392
+ var require_ci_info = __commonJS({
393
+ "../../node_modules/.pnpm/ci-info@4.3.0/node_modules/ci-info/index.js"(exports) {
394
+ var vendors = require_vendors();
395
+ var env = process.env;
396
+ Object.defineProperty(exports, "_vendors", {
397
+ value: vendors.map(function(v) {
398
+ return v.constant;
399
+ })
400
+ });
401
+ exports.name = null;
402
+ exports.isPR = null;
403
+ exports.id = null;
404
+ vendors.forEach(function(vendor) {
405
+ const envs = Array.isArray(vendor.env) ? vendor.env : [vendor.env];
406
+ const isCI2 = envs.every(function(obj) {
407
+ return checkEnv(obj);
408
+ });
409
+ exports[vendor.constant] = isCI2;
410
+ if (!isCI2) {
411
+ return;
412
+ }
413
+ exports.name = vendor.name;
414
+ exports.isPR = checkPR(vendor);
415
+ exports.id = vendor.constant;
416
+ });
417
+ exports.isCI = !!(env.CI !== "false" && // Bypass all checks if CI env is explicitly set to 'false'
418
+ (env.BUILD_ID || // Jenkins, Cloudbees
419
+ env.BUILD_NUMBER || // Jenkins, TeamCity
420
+ env.CI || // Travis CI, CircleCI, Cirrus CI, Gitlab CI, Appveyor, CodeShip, dsari, Cloudflare Pages/Workers
421
+ env.CI_APP_ID || // Appflow
422
+ env.CI_BUILD_ID || // Appflow
423
+ env.CI_BUILD_NUMBER || // Appflow
424
+ env.CI_NAME || // Codeship and others
425
+ env.CONTINUOUS_INTEGRATION || // Travis CI, Cirrus CI
426
+ env.RUN_ID || // TaskCluster, dsari
427
+ exports.name || false));
428
+ function checkEnv(obj) {
429
+ if (typeof obj === "string") return !!env[obj];
430
+ if ("env" in obj) {
431
+ return env[obj.env] && env[obj.env].includes(obj.includes);
432
+ }
433
+ if ("any" in obj) {
434
+ return obj.any.some(function(k) {
435
+ return !!env[k];
436
+ });
437
+ }
438
+ return Object.keys(obj).every(function(k) {
439
+ return env[k] === obj[k];
440
+ });
441
+ }
442
+ __name(checkEnv, "checkEnv");
443
+ function checkPR(vendor) {
444
+ switch (typeof vendor.pr) {
445
+ case "string":
446
+ return !!env[vendor.pr];
447
+ case "object":
448
+ if ("env" in vendor.pr) {
449
+ if ("any" in vendor.pr) {
450
+ return vendor.pr.any.some(function(key) {
451
+ return env[vendor.pr.env] === key;
452
+ });
453
+ } else {
454
+ return vendor.pr.env in env && env[vendor.pr.env] !== vendor.pr.ne;
455
+ }
456
+ } else if ("any" in vendor.pr) {
457
+ return vendor.pr.any.some(function(key) {
458
+ return !!env[key];
459
+ });
460
+ } else {
461
+ return checkEnv(vendor.pr);
462
+ }
463
+ default:
464
+ return null;
465
+ }
466
+ }
467
+ __name(checkPR, "checkPR");
468
+ }
469
+ });
22
470
  var VARLOCK_BANNER = [
23
471
  "",
24
472
  " \u2588\u2588\u2592 \u2588\u2593 \u2584\u2584\u2584 \u2588\u2588\u2580\u2588\u2588\u2588 \u2588\u2588\u2593 \u2592\u2588\u2588\u2588\u2588\u2588 \u2584\u2588\u2588\u2588\u2588\u2584 \u2588\u2588 \u2584\u2588\u2580",
@@ -33,45 +481,230 @@ var VARLOCK_BANNER = [
33
481
  // ' ░ ░ ',
34
482
  ].join("\n");
35
483
  var VARLOCK_BANNER_COLOR = VARLOCK_BANNER.replaceAll(/([▀▁▂▃▄▅▆▇█▉▊▋▌▍▎▏▐▔▕▖▗▘▙▚▛▜▝▞▟]+)/g, (m) => ansis_default.hex("#DD0000")(m)).replaceAll(/([▓░▒]+)/g, (m) => ansis_default.blue(m));
36
- function checkIsOptedOut() {
37
- if (process.env.PH_OPT_OUT === "true") {
484
+ var import_ci_info = __toESM(require_ci_info(), 1);
485
+ var isDockerCached;
486
+ function hasDockerEnv() {
487
+ try {
488
+ fs.statSync("/.dockerenv");
38
489
  return true;
490
+ } catch {
491
+ return false;
39
492
  }
40
- const configPath = join(homedir(), ".varlock", "config.json");
41
- if (existsSync(configPath)) {
42
- try {
43
- const configContent = readFileSync(configPath, "utf-8");
44
- const config = JSON.parse(configContent);
45
- return config.analytics_opt_out === true;
46
- } catch (error) {
47
- console.debug("Failed to read analytics config:", error);
493
+ }
494
+ __name(hasDockerEnv, "hasDockerEnv");
495
+ function hasDockerCGroup() {
496
+ try {
497
+ return fs.readFileSync("/proc/self/cgroup", "utf8").includes("docker");
498
+ } catch {
499
+ return false;
500
+ }
501
+ }
502
+ __name(hasDockerCGroup, "hasDockerCGroup");
503
+ function isDocker() {
504
+ if (isDockerCached === void 0) {
505
+ isDockerCached = hasDockerEnv() || hasDockerCGroup();
506
+ }
507
+ return isDockerCached;
508
+ }
509
+ __name(isDocker, "isDocker");
510
+ var cachedResult;
511
+ var hasContainerEnv = /* @__PURE__ */ __name(() => {
512
+ try {
513
+ fs.statSync("/run/.containerenv");
514
+ return true;
515
+ } catch {
516
+ return false;
517
+ }
518
+ }, "hasContainerEnv");
519
+ function isInsideContainer() {
520
+ if (cachedResult === void 0) {
521
+ cachedResult = hasContainerEnv() || isDocker();
522
+ }
523
+ return cachedResult;
524
+ }
525
+ __name(isInsideContainer, "isInsideContainer");
526
+
527
+ // ../../node_modules/.pnpm/is-wsl@3.1.0/node_modules/is-wsl/index.js
528
+ var isWsl = /* @__PURE__ */ __name(() => {
529
+ if (process2.platform !== "linux") {
530
+ return false;
531
+ }
532
+ if (os2.release().toLowerCase().includes("microsoft")) {
533
+ if (isInsideContainer()) {
534
+ return false;
48
535
  }
536
+ return true;
537
+ }
538
+ try {
539
+ return fs.readFileSync("/proc/version", "utf8").toLowerCase().includes("microsoft") ? !isInsideContainer() : false;
540
+ } catch {
541
+ return false;
542
+ }
543
+ }, "isWsl");
544
+ var is_wsl_default = process2.env.__IS_WSL_TEST__ ? isWsl : isWsl();
545
+
546
+ // package.json
547
+ var package_default = {
548
+ version: "0.0.5"};
549
+
550
+ // src/cli/helpers/telemetry.ts
551
+ var debug = Debug("varlock:telemetry");
552
+ var TRUE_ENV_VAR_VALUES = ["true", "1", "t"];
553
+ var varlockConfigDirPath = join(os2.homedir(), ".varlock");
554
+ var varlockConfigFilePath = join(varlockConfigDirPath, "config.json");
555
+ var varlockConfigFileContents;
556
+ function getConfigFileContents() {
557
+ if (varlockConfigFileContents) return varlockConfigFileContents;
558
+ try {
559
+ const configContent = readFileSync(varlockConfigFilePath, "utf-8");
560
+ varlockConfigFileContents = JSON.parse(configContent);
561
+ return varlockConfigFileContents;
562
+ } catch (error) {
563
+ debug("Failed to read varlock config:", error);
564
+ return {};
565
+ }
566
+ }
567
+ __name(getConfigFileContents, "getConfigFileContents");
568
+ var cachedAnonymousId;
569
+ function getAnonymousId() {
570
+ if (cachedAnonymousId) return cachedAnonymousId;
571
+ const configFileContents = getConfigFileContents();
572
+ if (configFileContents?.anonymousId) {
573
+ cachedAnonymousId = configFileContents.anonymousId;
574
+ return configFileContents.anonymousId;
575
+ }
576
+ const newAnonymousId = `${import_ci_info.isCI ? "ci-" : ""}${crypto.randomUUID()}`;
577
+ if (!existsSync(varlockConfigDirPath)) {
578
+ mkdirSync(varlockConfigDirPath, { recursive: true });
579
+ }
580
+ writeFileSync(
581
+ varlockConfigFilePath,
582
+ JSON.stringify({
583
+ ...configFileContents,
584
+ anonymousId: newAnonymousId
585
+ }, null, 2),
586
+ { flag: "w" }
587
+ );
588
+ cachedAnonymousId = newAnonymousId;
589
+ return newAnonymousId;
590
+ }
591
+ __name(getAnonymousId, "getAnonymousId");
592
+ function checkIsOptedOut() {
593
+ if (process.env.PH_OPT_OUT === "true" || TRUE_ENV_VAR_VALUES.includes((process.env.VARLOCK_TELEMETRY_DISABLED || "").toLowerCase())) {
594
+ debug("telemetry opted out - env var");
595
+ return true;
596
+ }
597
+ const varlockConfigFile = getConfigFileContents();
598
+ if (varlockConfigFile?.analytics_opt_out || varlockConfigFile?.telemetryDisabled) {
599
+ debug("telemetry opted out - config file");
600
+ return true;
49
601
  }
50
602
  return false;
51
603
  }
52
604
  __name(checkIsOptedOut, "checkIsOptedOut");
53
- var DEBUG_PH = !!process.env.DEBUG_PH;
605
+ function anonymizeValue(payload) {
606
+ if (payload === "") {
607
+ return payload;
608
+ }
609
+ const hash = createHash("sha256");
610
+ hash.update(payload);
611
+ return hash.digest("hex");
612
+ }
613
+ __name(anonymizeValue, "anonymizeValue");
614
+ function getProjectGitRemoteUrl() {
615
+ try {
616
+ let gitDirPath;
617
+ let currentDir = process.cwd();
618
+ while (currentDir && currentDir !== "/") {
619
+ const possibleGitDirPath = join(currentDir, ".git");
620
+ if (existsSync(possibleGitDirPath)) {
621
+ gitDirPath = possibleGitDirPath;
622
+ break;
623
+ }
624
+ currentDir = join(currentDir, "..");
625
+ }
626
+ if (!gitDirPath) return void 0;
627
+ const gitConfigContents = readFileSync(join(gitDirPath, "config"), "utf-8");
628
+ const remoteUpstreamPos = gitConfigContents.indexOf('[remote "upstream"]');
629
+ if (remoteUpstreamPos !== -1) {
630
+ const remoteUpstreamUrl = gitConfigContents.slice(remoteUpstreamPos).match(/url = (.+)/)?.[1];
631
+ return remoteUpstreamUrl;
632
+ }
633
+ const remoteOriginPos = gitConfigContents.indexOf('[remote "origin"]');
634
+ if (remoteOriginPos === -1) return void 0;
635
+ const remoteOriginUrl = gitConfigContents.slice(remoteOriginPos).match(/url = (.+)/)?.[1];
636
+ return remoteOriginUrl;
637
+ } catch (err) {
638
+ return void 0;
639
+ }
640
+ }
641
+ __name(getProjectGitRemoteUrl, "getProjectGitRemoteUrl");
642
+ function getAnonymousProjectId() {
643
+ const gitRemoteUrl = getProjectGitRemoteUrl();
644
+ if (!gitRemoteUrl) return null;
645
+ return anonymizeValue(gitRemoteUrl);
646
+ }
647
+ __name(getAnonymousProjectId, "getAnonymousProjectId");
648
+ var cachedTelemetryMetadata;
649
+ function getTelemetryMeta() {
650
+ if (cachedTelemetryMetadata) return cachedTelemetryMetadata;
651
+ const cpus = os2.cpus() || [];
652
+ let versionIdentifier = package_default.version;
653
+ cachedTelemetryMetadata = {
654
+ anonymous_project_id: getAnonymousProjectId(),
655
+ node_version: process.version.replace(/^v?/, ""),
656
+ varlock_version: versionIdentifier,
657
+ // TODO: pass through version info for specific integrations/plugins?
658
+ system_platform: os2.platform(),
659
+ system_release: os2.release(),
660
+ system_architecture: os2.arch(),
661
+ cpu_count: cpus.length,
662
+ cpu_model: cpus.length ? cpus[0].model : null,
663
+ cpu_speed: cpus.length ? cpus[0].speed : null,
664
+ memory_mb: Math.trunc(os2.totalmem() / 1024 ** 2),
665
+ is_docker: isDocker(),
666
+ is_tty: process.stdout.isTTY,
667
+ is_wsl: is_wsl_default,
668
+ is_ci: import_ci_info.isCI,
669
+ ci_name: import_ci_info.name,
670
+ is_sea: false
671
+ };
672
+ return cachedTelemetryMetadata;
673
+ }
674
+ __name(getTelemetryMeta, "getTelemetryMeta");
54
675
  var isOptedOut = checkIsOptedOut();
55
- if (DEBUG_PH) console.log("posthog opted out: ", isOptedOut);
676
+ var lastTelemetryReq;
56
677
  async function posthogCapture(event, properties) {
57
- if (isOptedOut) return;
678
+ const telemetryMeta = getTelemetryMeta();
58
679
  const payload = {
59
680
  api_key: CONFIG.POSTHOG_API_KEY,
60
681
  event,
61
682
  properties: {
62
683
  $process_person_profile: false,
684
+ ...telemetryMeta,
63
685
  ...properties
64
686
  },
65
- distinct_id: "anonymous"
687
+ distinct_id: getAnonymousId()
66
688
  };
67
- const res = await fetch(`${CONFIG.POSTHOG_HOST}/i/v0/e/`, {
689
+ debug(`track${isOptedOut ? " (disabled)" : ""}`, payload);
690
+ if (isOptedOut) return;
691
+ const removeExitHook = asyncExitHook(async () => {
692
+ await lastTelemetryReq;
693
+ }, { wait: 500 });
694
+ lastTelemetryReq = fetch(`${CONFIG.POSTHOG_HOST}/i/v0/e/`, {
68
695
  method: "POST",
69
696
  body: JSON.stringify(payload),
70
697
  headers: {
71
698
  "Content-Type": "application/json"
72
699
  }
700
+ }).then((res) => {
701
+ if (!res.ok) throw new Error(`HTTP error! status: ${res.status}`);
702
+ return res.text();
703
+ }).then((text) => debug("telemetry response:", text)).catch((error) => {
704
+ debug("telemetry error:", error);
705
+ }).finally(() => {
706
+ removeExitHook();
73
707
  });
74
- if (DEBUG_PH) console.log("res", await res.text());
75
708
  }
76
709
  __name(posthogCapture, "posthogCapture");
77
710
  async function trackCommand(command, properties) {
@@ -82,113 +715,8 @@ async function trackCommand(command, properties) {
82
715
  }
83
716
  __name(trackCommand, "trackCommand");
84
717
 
85
- // package.json
86
- var package_default = {
87
- name: "varlock",
88
- version: "0.0.3",
89
- description: "",
90
- main: "index.js",
91
- type: "module",
92
- author: "dmno-dev",
93
- license: "MIT",
94
- repository: {
95
- type: "git",
96
- url: "https://github.com/dmno-dev/varlock.git",
97
- directory: "packages/varlock"
98
- },
99
- scripts: {
100
- build: "tsup",
101
- "build:sea": "tsup --config tsup-sea.config.ts",
102
- dev: "tsup",
103
- test: "vitest",
104
- lint: "eslint .",
105
- "lint:fix": "pnpm run lint --fix"
106
- },
107
- keywords: [],
108
- files: [
109
- "/bin",
110
- "/dist"
111
- ],
112
- bin: {
113
- varlock: "./bin/cli.js"
114
- },
115
- engines: {
116
- node: ">=22"
117
- },
118
- exports: {
119
- ".": {
120
- "ts-src": "./src/index.ts",
121
- types: "./dist/index.d.ts",
122
- default: "./dist/index.js"
123
- },
124
- "./env": {
125
- "ts-src": "./src/runtime/env.ts",
126
- types: "./dist/runtime/env.d.ts",
127
- default: "./dist/runtime/env.js"
128
- },
129
- "./auto-load": {
130
- "ts-src": "./src/auto-load.ts",
131
- types: "./dist/auto-load.d.ts",
132
- default: "./dist/auto-load.js"
133
- },
134
- "./patch-console": {
135
- "ts-src": "./src/runtime/patch-console.ts",
136
- types: "./dist/runtime/patch-console.d.ts",
137
- default: "./dist/runtime/patch-console.js"
138
- },
139
- "./patch-response": {
140
- "ts-src": "./src/runtime/patch-response.ts",
141
- types: "./dist/runtime/patch-response.d.ts",
142
- default: "./dist/runtime/patch-response.js"
143
- },
144
- "./patch-server-response": {
145
- "ts-src": "./src/runtime/patch-server-response.ts",
146
- types: "./dist/runtime/patch-server-response.d.ts",
147
- default: "./dist/runtime/patch-server-response.js"
148
- },
149
- "./config": {
150
- "ts-src": "./src/config.ts",
151
- types: "./dist/dotenv-compat.d.ts",
152
- default: "./dist/dotenv-compat.js"
153
- },
154
- "./config.js": {
155
- "ts-src": "./src/config.ts",
156
- types: "./dist/dotenv-compat.d.ts",
157
- default: "./dist/dotenv-compat.js"
158
- }
159
- },
160
- dependencies: {
161
- "@env-spec/parser": "workspace:*",
162
- debug: "catalog:",
163
- execa: "^9.6.0",
164
- which: "^5.0.0"
165
- },
166
- devDependencies: {
167
- "@clack/core": "^0.5.0",
168
- "@clack/prompts": "^0.11.0",
169
- "@env-spec/env-graph": "workspace:*",
170
- "@env-spec/utils": "workspace:*",
171
- "@sindresorhus/is": "catalog:",
172
- "@types/debug": "catalog:",
173
- "@types/node": "catalog:",
174
- "@types/which": "^3.0.4",
175
- "@yao-pkg/pkg": "^6.5.1",
176
- ansis: "catalog:",
177
- "browser-or-node": "^3.0.0",
178
- gunshi: "^0.26.3",
179
- "is-unicode-supported": "^2.1.0",
180
- outdent: "catalog:",
181
- tsup: "catalog:",
182
- vitest: "catalog:"
183
- }
184
- };
185
-
186
718
  // src/cli/cli-executable.ts
187
- var mainCommand = {
188
- run: /* @__PURE__ */ __name(() => {
189
- console.log("Use one of the sub-commands...");
190
- }, "run")
191
- };
719
+ var versionId = package_default.version;
192
720
  function buildLazyCommand(commandSpec9, loadCommandFn) {
193
721
  const commandName = commandSpec9.name;
194
722
  return {
@@ -202,50 +730,66 @@ function buildLazyCommand(commandSpec9, loadCommandFn) {
202
730
  }
203
731
  __name(buildLazyCommand, "buildLazyCommand");
204
732
  var subCommands = /* @__PURE__ */ new Map();
205
- subCommands.set("init", buildLazyCommand(commandSpec, async () => await import('../init.command-Q4YBHAEG.js')));
206
- subCommands.set("load", buildLazyCommand(commandSpec$1, async () => await import('../load.command-K22PEH3D.js')));
207
- subCommands.set("run", buildLazyCommand(commandSpec$2, async () => await import('../run.command-DUAYGL6F.js')));
208
- subCommands.set("encrypt", buildLazyCommand(commandSpec$3, async () => await import('../encrypt.command-VGJABHNK.js')));
209
- subCommands.set("doctor", buildLazyCommand(commandSpec$4, async () => await import('../doctor.command-L3P5LBOW.js')));
210
- subCommands.set("help", buildLazyCommand(commandSpec$5, async () => await import('../help.command-YZDL2VEQ.js')));
211
- subCommands.set("opt-out", buildLazyCommand(commandSpec$6, async () => await import('../opt-out.command-Y4KUQ6PQ.js')));
212
- subCommands.set("login", buildLazyCommand(commandSpec$7, async () => await import('../login.command-22RUZJLR.js')));
733
+ subCommands.set("init", buildLazyCommand(commandSpec, async () => await import('../init.command-DHE2Q6FX.js')));
734
+ subCommands.set("load", buildLazyCommand(commandSpec$1, async () => await import('../load.command-GGE4OANH.js')));
735
+ subCommands.set("run", buildLazyCommand(commandSpec$2, async () => await import('../run.command-BLL6AL52.js')));
736
+ subCommands.set("encrypt", buildLazyCommand(commandSpec$3, async () => await import('../encrypt.command-AGHQ4KTI.js')));
737
+ subCommands.set("doctor", buildLazyCommand(commandSpec$4, async () => await import('../doctor.command-NUG3BYDQ.js')));
738
+ subCommands.set("help", buildLazyCommand(commandSpec$5, async () => await import('../help.command-B7VWA53B.js')));
739
+ subCommands.set("telemetry", buildLazyCommand(commandSpec$6, async () => await import('../telemetry.command-MVL3E366.js')));
740
+ subCommands.set("login", buildLazyCommand(commandSpec$7, async () => await import('../login.command-25PKQUGR.js')));
213
741
  (/* @__PURE__ */ __name(async function go() {
214
742
  try {
215
743
  let args = process.argv.slice(2);
216
744
  if (args[0] === "help") args = ["--help"];
217
745
  if (false) ;
218
- await cli(args, mainCommand, {
746
+ if (args[0] === "--version") {
747
+ await trackCommand("version");
748
+ }
749
+ await cli(args, {
750
+ // main command - triggered if you just run `varlock` with no args
751
+ run: /* @__PURE__ */ __name(() => {
752
+ console.log("Please run one of the sub-commands. Run `varlock --help` for more info.");
753
+ }, "run")
754
+ }, {
219
755
  name: "varlock",
220
756
  description: "Encrypt and protect your env vars",
221
- version: package_default.version,
757
+ version: versionId,
222
758
  subCommands,
223
759
  renderHeader: /* @__PURE__ */ __name(async (ctx) => {
224
760
  if (ctx.name) return "";
225
761
  return VARLOCK_BANNER_COLOR;
226
762
  }, "renderHeader")
227
763
  });
228
- process.exit(0);
764
+ gracefulExit();
229
765
  } catch (error) {
230
- if (error instanceof CliExitError || error instanceof InvalidEnvError) {
766
+ if (error instanceof Error && error.message.startsWith("Command not found: ")) {
767
+ const badCommandName = error.message.split(": ")[1];
768
+ const badCommandErr = new CliExitError(`Invalid subcommand: ${badCommandName}`, {
769
+ suggestion: `Run \`${fmt.command("varlock --help", { jsPackageManager: true })}\` for more info.`
770
+ });
771
+ console.error(badCommandErr.getFormattedOutput());
772
+ gracefulExit(1);
773
+ } else if (error instanceof CliExitError || error instanceof InvalidEnvError) {
231
774
  console.error(error.getFormattedOutput());
232
775
  } else if (error instanceof EnvSourceParseError) {
233
- console.log(`\u{1F6A8} Error encountered while loading ${error.location.path}`);
234
- console.log(error.message);
776
+ console.error(`\u{1F6A8} Error encountered while loading ${error.location.path}`);
777
+ console.error(error.message);
235
778
  const errLoc = error.location;
236
779
  const errPreview = [
237
780
  errLoc.lineStr,
238
781
  `${ansis_default.gray("-".repeat(errLoc.colNumber - 1))}${ansis_default.red("^")}`
239
782
  ].join("\n");
240
- console.log("Error parsing .env file");
241
- console.log(fmt.filePath(`${errLoc.path}:${errLoc.lineNumber}:${errLoc.colNumber}`));
242
- console.log(errPreview);
243
- process.exit(1);
783
+ console.error("Error parsing .env file");
784
+ console.error(fmt.filePath(`${errLoc.path}:${errLoc.lineNumber}:${errLoc.colNumber}`));
785
+ console.error(errPreview);
786
+ gracefulExit(1);
244
787
  } else {
245
788
  throw error;
246
789
  }
247
- process.exit(1);
790
+ gracefulExit(1);
248
791
  }
249
792
  }, "go"))();
793
+ //! this ouput is used by homebrew formula to check installed version is correct
250
794
  //# sourceMappingURL=cli-executable.js.map
251
795
  //# sourceMappingURL=cli-executable.js.map