varlock 0.8.0 → 0.8.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.
Files changed (74) hide show
  1. package/dist/auto-load.js +3 -3
  2. package/dist/{chunk-CPD4LFCM.js → chunk-5224KHFW.js} +4 -4
  3. package/dist/{chunk-CPD4LFCM.js.map → chunk-5224KHFW.js.map} +1 -1
  4. package/dist/{chunk-U72DN4YC.js → chunk-6W4P3ESY.js} +5 -5
  5. package/dist/{chunk-U72DN4YC.js.map → chunk-6W4P3ESY.js.map} +1 -1
  6. package/dist/{chunk-FHMYVMQZ.js → chunk-CAJTCWYA.js} +5 -5
  7. package/dist/{chunk-FHMYVMQZ.js.map → chunk-CAJTCWYA.js.map} +1 -1
  8. package/dist/{chunk-LM7YKESH.js → chunk-CZ7QQE6H.js} +5 -5
  9. package/dist/{chunk-LM7YKESH.js.map → chunk-CZ7QQE6H.js.map} +1 -1
  10. package/dist/{chunk-YBJQXCZE.js → chunk-CZXCAKEV.js} +5 -5
  11. package/dist/{chunk-YBJQXCZE.js.map → chunk-CZXCAKEV.js.map} +1 -1
  12. package/dist/{chunk-XYBJ2DUJ.js → chunk-FOA6LP5C.js} +4716 -4850
  13. package/dist/chunk-FOA6LP5C.js.map +1 -0
  14. package/dist/{chunk-6SU7GLJM.js → chunk-I2BC7NCA.js} +3 -3
  15. package/dist/{chunk-6SU7GLJM.js.map → chunk-I2BC7NCA.js.map} +1 -1
  16. package/dist/{chunk-PXR36IUP.js → chunk-JA2AIGGX.js} +14 -6
  17. package/dist/chunk-JA2AIGGX.js.map +1 -0
  18. package/dist/{chunk-SZ6MVAAJ.js → chunk-NUSBE7ZT.js} +4 -4
  19. package/dist/{chunk-SZ6MVAAJ.js.map → chunk-NUSBE7ZT.js.map} +1 -1
  20. package/dist/{chunk-UROBADYQ.js → chunk-PBBUUBNG.js} +4 -4
  21. package/dist/{chunk-UROBADYQ.js.map → chunk-PBBUUBNG.js.map} +1 -1
  22. package/dist/{chunk-P6RTPTWC.js → chunk-VH76CEVH.js} +4 -4
  23. package/dist/{chunk-P6RTPTWC.js.map → chunk-VH76CEVH.js.map} +1 -1
  24. package/dist/{chunk-UWINGOPT.js → chunk-WG4YIOKM.js} +4 -4
  25. package/dist/{chunk-UWINGOPT.js.map → chunk-WG4YIOKM.js.map} +1 -1
  26. package/dist/{chunk-Q44UUWKJ.js → chunk-YK3J3EOI.js} +6 -6
  27. package/dist/{chunk-Q44UUWKJ.js.map → chunk-YK3J3EOI.js.map} +1 -1
  28. package/dist/{chunk-J6GN4T2B.js → chunk-YUPV6MIL.js} +3 -3
  29. package/dist/{chunk-J6GN4T2B.js.map → chunk-YUPV6MIL.js.map} +1 -1
  30. package/dist/{chunk-JUCPBCOK.js → chunk-Z5OLYLN5.js} +5 -5
  31. package/dist/{chunk-JUCPBCOK.js.map → chunk-Z5OLYLN5.js.map} +1 -1
  32. package/dist/{chunk-FKC5YJXL.js → chunk-ZH3NIFSS.js} +6 -6
  33. package/dist/{chunk-FKC5YJXL.js.map → chunk-ZH3NIFSS.js.map} +1 -1
  34. package/dist/cli/cli-executable.js +25 -25
  35. package/dist/cli/cli-executable.js.map +1 -1
  36. package/dist/config-item-SR7HN6CU.js +5 -0
  37. package/dist/{config-item-YZNLESF2.js.map → config-item-SR7HN6CU.js.map} +1 -1
  38. package/dist/dotenv-compat.js +3 -3
  39. package/dist/{env-graph-BnquQhm-.d.ts → env-graph-DaF8Aebq.d.ts} +3 -3
  40. package/dist/explain.command-AQR6BA2T.js +12 -0
  41. package/dist/{explain.command-P32BEQ3G.js.map → explain.command-AQR6BA2T.js.map} +1 -1
  42. package/dist/index.d.ts +2 -2
  43. package/dist/index.js +6 -6
  44. package/dist/init.command-7YURBLWN.js +11 -0
  45. package/dist/{init.command-NFFZQLKP.js.map → init.command-7YURBLWN.js.map} +1 -1
  46. package/dist/install-plugin.command-PQTP6RHA.js +11 -0
  47. package/dist/{install-plugin.command-LDLVV67L.js.map → install-plugin.command-PQTP6RHA.js.map} +1 -1
  48. package/dist/load.command-R2HLBFAO.js +12 -0
  49. package/dist/{load.command-RJIWAOYQ.js.map → load.command-R2HLBFAO.js.map} +1 -1
  50. package/dist/plugin-lib.d.ts +2 -2
  51. package/dist/printenv.command-U7ULTREK.js +12 -0
  52. package/dist/{printenv.command-DLXXBGFW.js.map → printenv.command-U7ULTREK.js.map} +1 -1
  53. package/dist/run.command-COOPCDSU.js +13 -0
  54. package/dist/{run.command-6PRXLKAI.js.map → run.command-COOPCDSU.js.map} +1 -1
  55. package/dist/runtime/env.d.ts +1 -1
  56. package/dist/scan.command-OUVXZFQD.js +13 -0
  57. package/dist/{scan.command-HNFGUVZD.js.map → scan.command-OUVXZFQD.js.map} +1 -1
  58. package/dist/telemetry.command-LI6PESQP.js +11 -0
  59. package/dist/{telemetry.command-WQDTIW3U.js.map → telemetry.command-LI6PESQP.js.map} +1 -1
  60. package/dist/typegen.command-INHZ55RL.js +12 -0
  61. package/dist/{typegen.command-MNJ2FPRL.js.map → typegen.command-INHZ55RL.js.map} +1 -1
  62. package/package.json +2 -2
  63. package/dist/chunk-PXR36IUP.js.map +0 -1
  64. package/dist/chunk-XYBJ2DUJ.js.map +0 -1
  65. package/dist/config-item-YZNLESF2.js +0 -5
  66. package/dist/explain.command-P32BEQ3G.js +0 -12
  67. package/dist/init.command-NFFZQLKP.js +0 -11
  68. package/dist/install-plugin.command-LDLVV67L.js +0 -11
  69. package/dist/load.command-RJIWAOYQ.js +0 -12
  70. package/dist/printenv.command-DLXXBGFW.js +0 -12
  71. package/dist/run.command-6PRXLKAI.js +0 -13
  72. package/dist/scan.command-HNFGUVZD.js +0 -13
  73. package/dist/telemetry.command-WQDTIW3U.js +0 -11
  74. package/dist/typegen.command-MNJ2FPRL.js +0 -12
package/dist/auto-load.js CHANGED
@@ -1,8 +1,8 @@
1
- import './chunk-CPD4LFCM.js';
2
- import './chunk-YHOWSHVH.js';
1
+ import './chunk-5224KHFW.js';
2
+ import './chunk-LVZSZAKN.js';
3
3
  import './chunk-MYHVSJ3X.js';
4
+ import './chunk-YHOWSHVH.js';
4
5
  import './chunk-BC7LU4LG.js';
5
- import './chunk-LVZSZAKN.js';
6
6
  import './chunk-IMB5QAZS.js';
7
7
  import './chunk-XLYSNOR3.js';
8
8
  import './chunk-6PEHRAEP.js';
@@ -1,7 +1,7 @@
1
- import { execSyncVarlock } from './chunk-YHOWSHVH.js';
1
+ import { patchGlobalResponse } from './chunk-LVZSZAKN.js';
2
2
  import { patchGlobalServerResponse } from './chunk-MYHVSJ3X.js';
3
+ import { execSyncVarlock } from './chunk-YHOWSHVH.js';
3
4
  import { patchGlobalConsole } from './chunk-BC7LU4LG.js';
4
- import { patchGlobalResponse } from './chunk-LVZSZAKN.js';
5
5
  import { initVarlockEnv } from './chunk-IMB5QAZS.js';
6
6
 
7
7
  // src/auto-load.ts
@@ -18,5 +18,5 @@ initVarlockEnv();
18
18
  patchGlobalConsole();
19
19
  patchGlobalServerResponse();
20
20
  patchGlobalResponse();
21
- //# sourceMappingURL=chunk-CPD4LFCM.js.map
22
- //# sourceMappingURL=chunk-CPD4LFCM.js.map
21
+ //# sourceMappingURL=chunk-5224KHFW.js.map
22
+ //# sourceMappingURL=chunk-5224KHFW.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/auto-load.ts"],"names":[],"mappings":";;;;;;;AAaA,IAAM,UAAA,GAAa,gBAAgB,mCAAA,EAAqC;AAAA,EACtE,WAAA,EAAa,IAAA;AAAA,EACb,eAAA,EAAiB,IAAA;AAAA;AAAA;AAAA;AAAA,EAIjB,SAAA,EAAW,YAAY,OAAA,IAAW,IAAI,IAAI,GAAA,EAAK,MAAA,CAAA,IAAA,CAAY,GAAG,CAAA,CAAE;AAClE,CAAC,CAAA;AACD,OAAA,CAAQ,IAAI,aAAA,GAAgB,UAAA;AAG5B,cAAA,EAAe;AAEf,kBAAA,EAAmB;AACnB,yBAAA,EAA0B;AAC1B,mBAAA,EAAoB","file":"chunk-CPD4LFCM.js","sourcesContent":["import { execSyncVarlock } from './lib/exec-sync-varlock';\n\nimport { initVarlockEnv } from './runtime/env';\nimport { patchGlobalConsole } from './runtime/patch-console';\nimport { patchGlobalServerResponse } from './runtime/patch-server-response';\nimport { patchGlobalResponse } from './runtime/patch-response';\n\n// The varlock loading process uses async calls, but we need this to run synchronously.\n// because even with top level await, we run into hoisting issues where things happen out of order\n// so we call out to the CLI using execSync\n// this also isolates the varlock loading process from the end user process\n\n\nconst execResult = execSyncVarlock('load --format json-full --compact', {\n exitOnError: true,\n showLogsOnError: true,\n // Pass the directory of this module so that in monorepos the binary search\n // starts from inside the varlock package (e.g. apps/web/node_modules/varlock)\n // rather than from process.cwd(), which may be an unrelated workspace root.\n callerDir: import.meta.dirname ?? new URL('.', import.meta.url).pathname,\n});\nprocess.env.__VARLOCK_ENV = execResult;\n\n// initialize varlock and patch globals as necessary\ninitVarlockEnv();\n// these will be no-ops if these are disabled by settings\npatchGlobalConsole();\npatchGlobalServerResponse();\npatchGlobalResponse();\n\n"]}
1
+ {"version":3,"sources":["../src/auto-load.ts"],"names":[],"mappings":";;;;;;;AAaA,IAAM,UAAA,GAAa,gBAAgB,mCAAA,EAAqC;AAAA,EACtE,WAAA,EAAa,IAAA;AAAA,EACb,eAAA,EAAiB,IAAA;AAAA;AAAA;AAAA;AAAA,EAIjB,SAAA,EAAW,YAAY,OAAA,IAAW,IAAI,IAAI,GAAA,EAAK,MAAA,CAAA,IAAA,CAAY,GAAG,CAAA,CAAE;AAClE,CAAC,CAAA;AACD,OAAA,CAAQ,IAAI,aAAA,GAAgB,UAAA;AAG5B,cAAA,EAAe;AAEf,kBAAA,EAAmB;AACnB,yBAAA,EAA0B;AAC1B,mBAAA,EAAoB","file":"chunk-5224KHFW.js","sourcesContent":["import { execSyncVarlock } from './lib/exec-sync-varlock';\n\nimport { initVarlockEnv } from './runtime/env';\nimport { patchGlobalConsole } from './runtime/patch-console';\nimport { patchGlobalServerResponse } from './runtime/patch-server-response';\nimport { patchGlobalResponse } from './runtime/patch-response';\n\n// The varlock loading process uses async calls, but we need this to run synchronously.\n// because even with top level await, we run into hoisting issues where things happen out of order\n// so we call out to the CLI using execSync\n// this also isolates the varlock loading process from the end user process\n\n\nconst execResult = execSyncVarlock('load --format json-full --compact', {\n exitOnError: true,\n showLogsOnError: true,\n // Pass the directory of this module so that in monorepos the binary search\n // starts from inside the varlock package (e.g. apps/web/node_modules/varlock)\n // rather than from process.cwd(), which may be an unrelated workspace root.\n callerDir: import.meta.dirname ?? new URL('.', import.meta.url).pathname,\n});\nprocess.env.__VARLOCK_ENV = execResult;\n\n// initialize varlock and patch globals as necessary\ninitVarlockEnv();\n// these will be no-ops if these are disabled by settings\npatchGlobalConsole();\npatchGlobalServerResponse();\npatchGlobalResponse();\n\n"]}
@@ -1,7 +1,7 @@
1
1
  import { define } from './chunk-4A54P4EM.js';
2
- import { checkForSchemaErrors, checkForNoEnvFiles } from './chunk-UROBADYQ.js';
3
- import { loadVarlockEnvGraph } from './chunk-UWINGOPT.js';
4
- import { CliExitError } from './chunk-6SU7GLJM.js';
2
+ import { checkForSchemaErrors, checkForNoEnvFiles } from './chunk-PBBUUBNG.js';
3
+ import { loadVarlockEnvGraph } from './chunk-WG4YIOKM.js';
4
+ import { CliExitError } from './chunk-I2BC7NCA.js';
5
5
  import { __name } from './chunk-6PEHRAEP.js';
6
6
 
7
7
  // src/cli/commands/typegen.command.ts
@@ -45,5 +45,5 @@ var commandFn = /* @__PURE__ */ __name(async (ctx) => {
45
45
  }, "commandFn");
46
46
 
47
47
  export { commandFn, commandSpec };
48
- //# sourceMappingURL=chunk-U72DN4YC.js.map
49
- //# sourceMappingURL=chunk-U72DN4YC.js.map
48
+ //# sourceMappingURL=chunk-6W4P3ESY.js.map
49
+ //# sourceMappingURL=chunk-6W4P3ESY.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/cli/commands/typegen.command.ts"],"names":[],"mappings":";;;;;;;AAOO,IAAM,cAAc,MAAA,CAAO;AAAA,EAChC,IAAA,EAAM,SAAA;AAAA,EACN,WAAA,EAAa,gDAAA;AAAA,EACb,IAAA,EAAM;AAAA,IACJ,IAAA,EAAM;AAAA,MACJ,IAAA,EAAM,QAAA;AAAA,MACN,KAAA,EAAO,GAAA;AAAA,MACP,QAAA,EAAU,IAAA;AAAA,MACV,WAAA,EAAa;AAAA;AACf,GACF;AAAA,EACA,QAAA,EAAU;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAAA;AAAA;AAAA;AAAA,CAAA,CAWV,IAAA;AACF,CAAC;AAGM,IAAM,SAAA,iCAA6D,GAAA,KAAQ;AAChF,EAAA,MAAM,QAAA,GAAW,MAAM,mBAAA,CAAoB;AAAA,IACzC,cAAA,EAAgB,IAAI,MAAA,CAAO;AAAA,GAC5B,CAAA;AACD,EAAA,oBAAA,CAAqB,QAAQ,CAAA;AAC7B,EAAA,kBAAA,CAAmB,QAAQ,CAAA;AAG3B,EAAA,MAAM,iBAAiB,MAAM,QAAA,CAAS,sBAAsB,EAAE,eAAA,EAAiB,MAAM,CAAA;AAErF,EAAA,IAAI,mBAAmB,CAAA,EAAG;AACxB,IAAA,MAAM,IAAI,aAAa,kDAAA,EAAoD;AAAA,MACzE,UAAA,EAAY;AAAA,KACb,CAAA;AAAA,EACH;AAEA,EAAA,OAAA,CAAQ,IAAI,qCAAgC,CAAA;AAC9C,CAAA,EAjBmE,WAAA","file":"chunk-U72DN4YC.js","sourcesContent":["import { define } from 'gunshi';\n\nimport { loadVarlockEnvGraph } from '../../lib/load-graph';\nimport { checkForNoEnvFiles, checkForSchemaErrors } from '../helpers/error-checks';\nimport { CliExitError } from '../helpers/exit-error';\nimport { type TypedGunshiCommandFn } from '../helpers/gunshi-type-utils';\n\nexport const commandSpec = define({\n name: 'typegen',\n description: 'Generate TypeScript types from your env schema',\n args: {\n path: {\n type: 'string',\n short: 'p',\n multiple: true,\n description: 'Path to a specific .env file or directory to use as the entry point (can be specified multiple times)',\n },\n },\n examples: `\nGenerates TypeScript type definitions from your .env schema files.\nUses only non-environment-specific schema info, so output is deterministic\nregardless of which environment is active.\n\nThis is useful when you have \\`@generateTypes(lang=ts, path=env.d.ts, auto=false)\\`\nin your schema to disable automatic type generation during \\`varlock load\\` or \\`varlock run\\`.\n\nExamples:\n varlock typegen # Generate types using default schema\n varlock typegen --path .env.prod # Generate types from a specific .env file\n`.trim(),\n});\n\n\nexport const commandFn: TypedGunshiCommandFn<typeof commandSpec> = async (ctx) => {\n const envGraph = await loadVarlockEnvGraph({\n entryFilePaths: ctx.values.path,\n });\n checkForSchemaErrors(envGraph);\n checkForNoEnvFiles(envGraph);\n\n // Force type generation even if auto=false is set\n const generatedCount = await envGraph.generateTypesIfNeeded({ ignoreAutoFalse: true });\n\n if (generatedCount === 0) {\n throw new CliExitError('No @generateTypes decorator found in your schema', {\n suggestion: 'Add `@generateTypes(lang=ts, path=env.d.ts)` to your .env.schema file.',\n });\n }\n\n console.log('✅ Types generated successfully');\n};\n"]}
1
+ {"version":3,"sources":["../src/cli/commands/typegen.command.ts"],"names":[],"mappings":";;;;;;;AAOO,IAAM,cAAc,MAAA,CAAO;AAAA,EAChC,IAAA,EAAM,SAAA;AAAA,EACN,WAAA,EAAa,gDAAA;AAAA,EACb,IAAA,EAAM;AAAA,IACJ,IAAA,EAAM;AAAA,MACJ,IAAA,EAAM,QAAA;AAAA,MACN,KAAA,EAAO,GAAA;AAAA,MACP,QAAA,EAAU,IAAA;AAAA,MACV,WAAA,EAAa;AAAA;AACf,GACF;AAAA,EACA,QAAA,EAAU;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAAA;AAAA;AAAA;AAAA,CAAA,CAWV,IAAA;AACF,CAAC;AAGM,IAAM,SAAA,iCAA6D,GAAA,KAAQ;AAChF,EAAA,MAAM,QAAA,GAAW,MAAM,mBAAA,CAAoB;AAAA,IACzC,cAAA,EAAgB,IAAI,MAAA,CAAO;AAAA,GAC5B,CAAA;AACD,EAAA,oBAAA,CAAqB,QAAQ,CAAA;AAC7B,EAAA,kBAAA,CAAmB,QAAQ,CAAA;AAG3B,EAAA,MAAM,iBAAiB,MAAM,QAAA,CAAS,sBAAsB,EAAE,eAAA,EAAiB,MAAM,CAAA;AAErF,EAAA,IAAI,mBAAmB,CAAA,EAAG;AACxB,IAAA,MAAM,IAAI,aAAa,kDAAA,EAAoD;AAAA,MACzE,UAAA,EAAY;AAAA,KACb,CAAA;AAAA,EACH;AAEA,EAAA,OAAA,CAAQ,IAAI,qCAAgC,CAAA;AAC9C,CAAA,EAjBmE,WAAA","file":"chunk-6W4P3ESY.js","sourcesContent":["import { define } from 'gunshi';\n\nimport { loadVarlockEnvGraph } from '../../lib/load-graph';\nimport { checkForNoEnvFiles, checkForSchemaErrors } from '../helpers/error-checks';\nimport { CliExitError } from '../helpers/exit-error';\nimport { type TypedGunshiCommandFn } from '../helpers/gunshi-type-utils';\n\nexport const commandSpec = define({\n name: 'typegen',\n description: 'Generate TypeScript types from your env schema',\n args: {\n path: {\n type: 'string',\n short: 'p',\n multiple: true,\n description: 'Path to a specific .env file or directory to use as the entry point (can be specified multiple times)',\n },\n },\n examples: `\nGenerates TypeScript type definitions from your .env schema files.\nUses only non-environment-specific schema info, so output is deterministic\nregardless of which environment is active.\n\nThis is useful when you have \\`@generateTypes(lang=ts, path=env.d.ts, auto=false)\\`\nin your schema to disable automatic type generation during \\`varlock load\\` or \\`varlock run\\`.\n\nExamples:\n varlock typegen # Generate types using default schema\n varlock typegen --path .env.prod # Generate types from a specific .env file\n`.trim(),\n});\n\n\nexport const commandFn: TypedGunshiCommandFn<typeof commandSpec> = async (ctx) => {\n const envGraph = await loadVarlockEnvGraph({\n entryFilePaths: ctx.values.path,\n });\n checkForSchemaErrors(envGraph);\n checkForNoEnvFiles(envGraph);\n\n // Force type generation even if auto=false is set\n const generatedCount = await envGraph.generateTypesIfNeeded({ ignoreAutoFalse: true });\n\n if (generatedCount === 0) {\n throw new CliExitError('No @generateTypes decorator found in your schema', {\n suggestion: 'Add `@generateTypes(lang=ts, path=env.d.ts)` to your .env.schema file.',\n });\n }\n\n console.log('✅ Types generated successfully');\n};\n"]}
@@ -1,8 +1,8 @@
1
- import { fmt } from './chunk-P6RTPTWC.js';
1
+ import { fmt } from './chunk-VH76CEVH.js';
2
2
  import { define } from './chunk-4A54P4EM.js';
3
3
  import { gracefulExit } from './chunk-CHQDS2PI.js';
4
- import { CliExitError } from './chunk-6SU7GLJM.js';
5
- import { getUserVarlockDir } from './chunk-XYBJ2DUJ.js';
4
+ import { CliExitError } from './chunk-I2BC7NCA.js';
5
+ import { getUserVarlockDir } from './chunk-FOA6LP5C.js';
6
6
  import { __name } from './chunk-6PEHRAEP.js';
7
7
  import { join } from 'path';
8
8
  import { mkdir, readFile, writeFile } from 'fs/promises';
@@ -63,5 +63,5 @@ var commandFn = /* @__PURE__ */ __name(async (ctx) => {
63
63
  }, "commandFn");
64
64
 
65
65
  export { commandFn, commandSpec };
66
- //# sourceMappingURL=chunk-FHMYVMQZ.js.map
67
- //# sourceMappingURL=chunk-FHMYVMQZ.js.map
66
+ //# sourceMappingURL=chunk-CAJTCWYA.js.map
67
+ //# sourceMappingURL=chunk-CAJTCWYA.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/cli/commands/telemetry.command.ts"],"names":[],"mappings":";;;;;;;;;;AAWO,IAAM,cAAc,MAAA,CAAO;AAAA,EAChC,IAAA,EAAM,WAAA;AAAA,EACN,WAAA,EAAa,0CAAA;AAAA,EACb,IAAA,EAAM;AAAA,IACJ,IAAA,EAAM;AAAA,MACJ,IAAA,EAAM,YAAA;AAAA,MACN,WAAA,EAAa;AAAA;AACf,GACF;AAAA,EACA,QAAA,EAAU;AAAA;AAAA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;AAAA,EAAA,CAAA,CAWR,IAAA;AACJ,CAAC;AAEM,IAAM,SAAA,iCAA6D,GAAA,KAAQ;AAEhF,EAAA,IAAI,CAAC,CAAC,QAAA,EAAU,SAAS,EAAE,QAAA,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AAO,aAAa,CAAC,CAAA;AAAA,EACvB;AACF,CAAA,EAvCmE,WAAA","file":"chunk-FHMYVMQZ.js","sourcesContent":["import { join } from 'node:path';\nimport { mkdir, writeFile, readFile } from 'node:fs/promises';\nimport { existsSync } from 'node:fs';\nimport { define } from 'gunshi';\nimport { type TypedGunshiCommandFn } from '../helpers/gunshi-type-utils';\nimport { gracefulExit } from 'exit-hook';\nimport { fmt } from '../helpers/pretty-format';\nimport { CliExitError } from '../helpers/exit-error';\nimport { getUserVarlockDir } from '../../lib/user-config-dir';\n\n\nexport const commandSpec = define({\n name: 'telemetry',\n description: 'Enable/disable anonymous usage analytics',\n args: {\n mode: {\n type: 'positional',\n description: '\"enable\" or \"disable\"',\n },\n },\n examples: `\nOpts in/out of anonymous usage analytics. This command creates/updates a configuration\nfile at $XDG_CONFIG_HOME/varlock/config.json (or ~/.config/varlock/config.json) saving\nyour preference.\n\nExamples:\n varlock telemetry disable # Opt out of telemetry\n varlock telemetry enable # Opt in to telemetry\n\n💡 Tip: You can also temporarily opt out by setting VARLOCK_TELEMETRY_DISABLED=1\nFor more information, visit https://varlock.dev/guides/telemetry/\n `.trim(),\n});\n\nexport const commandFn: TypedGunshiCommandFn<typeof commandSpec> = async (ctx) => {\n // TODO: remove this when gunshi supports types/validation for positional args\n if (!['enable', 'disable'].includes(ctx.values.mode)) {\n throw new CliExitError('additional arg must be \"enable\" or \"disable\"', {\n forceExit: true,\n });\n }\n\n const configDir = getUserVarlockDir();\n const configPath = join(configDir, 'config.json');\n\n try {\n // Create .varlock directory if it doesn't exist\n if (!existsSync(configDir)) {\n await mkdir(configDir, { recursive: true });\n }\n\n // Read existing config if it exists\n let config: Record<string, any> = {};\n if (existsSync(configPath)) {\n const configContent = await readFile(configPath, 'utf-8');\n config = JSON.parse(configContent);\n }\n\n // update config `telemetryDisabled` setting\n if (ctx.values.mode === 'disable') config.telemetryDisabled = true;\n else delete config.telemetryDisabled;\n await writeFile(configPath, JSON.stringify(config, null, 2));\n\n if (ctx.values.mode === 'enable') {\n console.log('✅ Successfully enabled anonymous usage analytics');\n } else {\n console.log('✅ Successfully disabled anonymous usage analytics');\n }\n console.log('> saved in:', fmt.filePath(configPath));\n } catch (error) {\n console.error('Failed to opt out of analytics:', error);\n return gracefulExit(1);\n }\n};\n"]}
1
+ {"version":3,"sources":["../src/cli/commands/telemetry.command.ts"],"names":[],"mappings":";;;;;;;;;;AAWO,IAAM,cAAc,MAAA,CAAO;AAAA,EAChC,IAAA,EAAM,WAAA;AAAA,EACN,WAAA,EAAa,0CAAA;AAAA,EACb,IAAA,EAAM;AAAA,IACJ,IAAA,EAAM;AAAA,MACJ,IAAA,EAAM,YAAA;AAAA,MACN,WAAA,EAAa;AAAA;AACf,GACF;AAAA,EACA,QAAA,EAAU;AAAA;AAAA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;AAAA,EAAA,CAAA,CAWR,IAAA;AACJ,CAAC;AAEM,IAAM,SAAA,iCAA6D,GAAA,KAAQ;AAEhF,EAAA,IAAI,CAAC,CAAC,QAAA,EAAU,SAAS,EAAE,QAAA,CAAS,GAAA,CAAI,MAAA,CAAO,IAAI,CAAA,EAAG;AACpD,IAAA,MAAM,IAAI,aAAa,8CAAA,EAAgD;AAAA,MACrE,SAAA,EAAW;AAAA,KACZ,CAAA;AAAA,EACH;AAEA,EAAA,MAAM,YAAY,iBAAA,EAAkB;AACpC,EAAA,MAAM,UAAA,GAAa,IAAA,CAAK,SAAA,EAAW,aAAa,CAAA;AAEhD,EAAA,IAAI;AAEF,IAAA,IAAI,CAAC,UAAA,CAAW,SAAS,CAAA,EAAG;AAC1B,MAAA,MAAM,KAAA,CAAM,SAAA,EAAW,EAAE,SAAA,EAAW,MAAM,CAAA;AAAA,IAC5C;AAGA,IAAA,IAAI,SAA8B,EAAC;AACnC,IAAA,IAAI,UAAA,CAAW,UAAU,CAAA,EAAG;AAC1B,MAAA,MAAM,aAAA,GAAgB,MAAM,QAAA,CAAS,UAAA,EAAY,OAAO,CAAA;AACxD,MAAA,MAAA,GAAS,IAAA,CAAK,MAAM,aAAa,CAAA;AAAA,IACnC;AAGA,IAAA,IAAI,GAAA,CAAI,MAAA,CAAO,IAAA,KAAS,SAAA,SAAkB,iBAAA,GAAoB,IAAA;AAAA,gBAClD,MAAA,CAAO,iBAAA;AACnB,IAAA,MAAM,UAAU,UAAA,EAAY,IAAA,CAAK,UAAU,MAAA,EAAQ,IAAA,EAAM,CAAC,CAAC,CAAA;AAE3D,IAAA,IAAI,GAAA,CAAI,MAAA,CAAO,IAAA,KAAS,QAAA,EAAU;AAChC,MAAA,OAAA,CAAQ,IAAI,uDAAkD,CAAA;AAAA,IAChE,CAAA,MAAO;AACL,MAAA,OAAA,CAAQ,IAAI,wDAAmD,CAAA;AAAA,IACjE;AACA,IAAA,OAAA,CAAQ,GAAA,CAAI,aAAA,EAAe,GAAA,CAAI,QAAA,CAAS,UAAU,CAAC,CAAA;AAAA,EACrD,SAAS,KAAA,EAAO;AACd,IAAA,OAAA,CAAQ,KAAA,CAAM,mCAAmC,KAAK,CAAA;AACtD,IAAA,OAAO,aAAa,CAAC,CAAA;AAAA,EACvB;AACF,CAAA,EAvCmE,WAAA","file":"chunk-CAJTCWYA.js","sourcesContent":["import { join } from 'node:path';\nimport { mkdir, writeFile, readFile } from 'node:fs/promises';\nimport { existsSync } from 'node:fs';\nimport { define } from 'gunshi';\nimport { type TypedGunshiCommandFn } from '../helpers/gunshi-type-utils';\nimport { gracefulExit } from 'exit-hook';\nimport { fmt } from '../helpers/pretty-format';\nimport { CliExitError } from '../helpers/exit-error';\nimport { getUserVarlockDir } from '../../lib/user-config-dir';\n\n\nexport const commandSpec = define({\n name: 'telemetry',\n description: 'Enable/disable anonymous usage analytics',\n args: {\n mode: {\n type: 'positional',\n description: '\"enable\" or \"disable\"',\n },\n },\n examples: `\nOpts in/out of anonymous usage analytics. This command creates/updates a configuration\nfile at $XDG_CONFIG_HOME/varlock/config.json (or ~/.config/varlock/config.json) saving\nyour preference.\n\nExamples:\n varlock telemetry disable # Opt out of telemetry\n varlock telemetry enable # Opt in to telemetry\n\n💡 Tip: You can also temporarily opt out by setting VARLOCK_TELEMETRY_DISABLED=1\nFor more information, visit https://varlock.dev/guides/telemetry/\n `.trim(),\n});\n\nexport const commandFn: TypedGunshiCommandFn<typeof commandSpec> = async (ctx) => {\n // TODO: remove this when gunshi supports types/validation for positional args\n if (!['enable', 'disable'].includes(ctx.values.mode)) {\n throw new CliExitError('additional arg must be \"enable\" or \"disable\"', {\n forceExit: true,\n });\n }\n\n const configDir = getUserVarlockDir();\n const configPath = join(configDir, 'config.json');\n\n try {\n // Create .varlock directory if it doesn't exist\n if (!existsSync(configDir)) {\n await mkdir(configDir, { recursive: true });\n }\n\n // Read existing config if it exists\n let config: Record<string, any> = {};\n if (existsSync(configPath)) {\n const configContent = await readFile(configPath, 'utf-8');\n config = JSON.parse(configContent);\n }\n\n // update config `telemetryDisabled` setting\n if (ctx.values.mode === 'disable') config.telemetryDisabled = true;\n else delete config.telemetryDisabled;\n await writeFile(configPath, JSON.stringify(config, null, 2));\n\n if (ctx.values.mode === 'enable') {\n console.log('✅ Successfully enabled anonymous usage analytics');\n } else {\n console.log('✅ Successfully disabled anonymous usage analytics');\n }\n console.log('> saved in:', fmt.filePath(configPath));\n } catch (error) {\n console.error('Failed to opt out of analytics:', error);\n return gracefulExit(1);\n }\n};\n"]}
@@ -1,8 +1,8 @@
1
1
  import { define } from './chunk-4A54P4EM.js';
2
- import { checkForSchemaErrors } from './chunk-UROBADYQ.js';
3
- import { loadVarlockEnvGraph } from './chunk-UWINGOPT.js';
2
+ import { checkForSchemaErrors } from './chunk-PBBUUBNG.js';
3
+ import { loadVarlockEnvGraph } from './chunk-WG4YIOKM.js';
4
4
  import { gracefulExit } from './chunk-CHQDS2PI.js';
5
- import { CliExitError } from './chunk-6SU7GLJM.js';
5
+ import { CliExitError } from './chunk-I2BC7NCA.js';
6
6
  import { __name } from './chunk-6PEHRAEP.js';
7
7
 
8
8
  // src/cli/commands/printenv.command.ts
@@ -66,5 +66,5 @@ var commandFn = /* @__PURE__ */ __name(async (ctx) => {
66
66
  }, "commandFn");
67
67
 
68
68
  export { commandFn, commandSpec };
69
- //# sourceMappingURL=chunk-LM7YKESH.js.map
70
- //# sourceMappingURL=chunk-LM7YKESH.js.map
69
+ //# sourceMappingURL=chunk-CZ7QQE6H.js.map
70
+ //# sourceMappingURL=chunk-CZ7QQE6H.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/cli/commands/printenv.command.ts"],"names":[],"mappings":";;;;;;;;AAQO,IAAM,cAAc,MAAA,CAAO;AAAA,EAChC,IAAA,EAAM,UAAA;AAAA,EACN,WAAA,EAAa,2DAAA;AAAA,EACb,IAAA,EAAM;AAAA,IACJ,IAAA,EAAM;AAAA,MACJ,IAAA,EAAM,QAAA;AAAA,MACN,KAAA,EAAO,GAAA;AAAA,MACP,QAAA,EAAU,IAAA;AAAA,MACV,WAAA,EAAa;AAAA;AACf,GACF;AAAA,EACA,QAAA,EAAU;AAAA;AAAA;;AAAA;AAAA;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAAA;AAAA;AAAA,EAAA,CAAA,CAeR,IAAA;AACJ,CAAC;AAEM,IAAM,SAAA,iCAA6D,GAAA,KAAQ;AAGhF,EAAA,MAAM,WAAA,GAAA,CAAe,IAAI,WAAA,IAAe,IAAI,KAAA,CAAM,GAAA,CAAI,WAAA,EAAa,MAAA,IAAU,CAAC,CAAA;AAC9E,EAAA,IAAI,CAAC,YAAY,MAAA,EAAQ;AACvB,IAAA,MAAM,IAAI,aAAa,0CAAA,EAA4C;AAAA,MACjE,UAAA,EAAY;AAAA,KACb,CAAA;AAAA,EACH;AACA,EAAA,MAAM,OAAA,GAAU,YAAY,CAAC,CAAA;AAE7B,EAAA,MAAM,QAAA,GAAW,MAAM,mBAAA,CAAoB;AAAA,IACzC,cAAA,EAAgB,IAAI,MAAA,CAAO;AAAA,GAC5B,CAAA;AACD,EAAA,oBAAA,CAAqB,QAAQ,CAAA;AAE7B,EAAA,IAAI,EAAE,OAAA,IAAW,QAAA,CAAS,YAAA,CAAA,EAAe;AACvC,IAAA,MAAM,IAAI,YAAA,CAAa,CAAA,UAAA,EAAa,OAAO,CAAA,qBAAA,CAAuB,CAAA;AAAA,EACpE;AAGA,EAAA,MAAM,QAAA,CAAS,oBAAoB,OAAO,CAAA;AAE1C,EAAA,MAAM,IAAA,GAAO,QAAA,CAAS,YAAA,CAAa,OAAO,CAAA;AAC1C,EAAA,IAAI,IAAA,CAAK,oBAAoB,OAAA,EAAS;AACpC,IAAA,KAAA,MAAW,GAAA,IAAO,KAAK,MAAA,EAAQ;AAC7B,MAAA,OAAA,CAAQ,KAAA,CAAM,CAAA,UAAA,EAAM,GAAA,CAAI,OAAO,CAAA,CAAE,CAAA;AAAA,IACnC;AACA,IAAA,OAAO,aAAa,CAAC,CAAA;AAAA,EACvB;AAEA,EAAA,MAAM,QAAQ,IAAA,CAAK,aAAA;AACnB,EAAA,IAAI,KAAA,KAAU,MAAA,IAAa,KAAA,KAAU,IAAA,EAAM;AACzC,IAAA,OAAA,CAAQ,IAAI,EAAE,CAAA;AAAA,EAChB,CAAA,MAAO;AACL,IAAA,OAAA,CAAQ,GAAA,CAAI,MAAA,CAAO,KAAK,CAAC,CAAA;AAAA,EAC3B;AACF,CAAA,EArCmE,WAAA","file":"chunk-LM7YKESH.js","sourcesContent":["import { define } from 'gunshi';\nimport { gracefulExit } from 'exit-hook';\n\nimport { loadVarlockEnvGraph } from '../../lib/load-graph';\nimport { checkForSchemaErrors } from '../helpers/error-checks';\nimport { type TypedGunshiCommandFn } from '../helpers/gunshi-type-utils';\nimport { CliExitError } from '../helpers/exit-error';\n\nexport const commandSpec = define({\n name: 'printenv',\n description: 'Print the resolved value of a single environment variable',\n args: {\n path: {\n type: 'string',\n short: 'p',\n multiple: true,\n description: 'Path to a specific .env file or directory (with trailing slash) to use as the entry point (can be specified multiple times)',\n },\n },\n examples: `\nPrints the resolved value of a single environment variable.\nUseful within larger shell commands where you need a single env var value.\n\nExamples:\n varlock printenv MY_VAR # Print the value of MY_VAR\n varlock printenv --path .env.prod MY_VAR # Use a specific .env file\n varlock printenv --path ./config/ MY_VAR # Use a specific directory\n varlock printenv -p ./envs -p ./overrides MY_VAR # Use multiple directories\n\n📍 Note: Use sh -c to embed this in shell commands, e.g.:\n sh -c 'do-something --token $(varlock printenv MY_TOKEN)'\n\n💡 Tip: Unlike \\`varlock run -- echo $MY_VAR\\`, this works because the shell\n expansion happens after varlock has printed the value.\n `.trim(),\n});\n\nexport const commandFn: TypedGunshiCommandFn<typeof commandSpec> = async (ctx) => {\n // ctx.positionals includes the subcommand name(s) themselves, so we skip them\n // by slicing off ctx.commandPath.length entries (e.g. skips 'printenv' at index 0)\n const positionals = (ctx.positionals ?? []).slice(ctx.commandPath?.length ?? 0);\n if (!positionals.length) {\n throw new CliExitError('Missing required argument: variable name', {\n suggestion: 'Run `varlock printenv MY_VAR` to print the value of MY_VAR',\n });\n }\n const varName = positionals[0];\n\n const envGraph = await loadVarlockEnvGraph({\n entryFilePaths: ctx.values.path,\n });\n checkForSchemaErrors(envGraph);\n\n if (!(varName in envGraph.configSchema)) {\n throw new CliExitError(`Variable \"${varName}\" not found in schema`);\n }\n\n // Resolve only the requested item and its transitive dependencies\n await envGraph.resolveItemWithDeps(varName);\n\n const item = envGraph.configSchema[varName];\n if (item.validationState === 'error') {\n for (const err of item.errors) {\n console.error(`🚨 ${err.message}`);\n }\n return gracefulExit(1);\n }\n\n const value = item.resolvedValue;\n if (value === undefined || value === null) {\n console.log('');\n } else {\n console.log(String(value));\n }\n};\n"]}
1
+ {"version":3,"sources":["../src/cli/commands/printenv.command.ts"],"names":[],"mappings":";;;;;;;;AAQO,IAAM,cAAc,MAAA,CAAO;AAAA,EAChC,IAAA,EAAM,UAAA;AAAA,EACN,WAAA,EAAa,2DAAA;AAAA,EACb,IAAA,EAAM;AAAA,IACJ,IAAA,EAAM;AAAA,MACJ,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A;AAAA,IACnC;AACA,IAAA,OAAO,aAAa,CAAC,CAAA;AAAA,EACvB;AAEA,EAAA,MAAM,QAAQ,IAAA,CAAK,aAAA;AACnB,EAAA,IAAI,KAAA,KAAU,MAAA,IAAa,KAAA,KAAU,IAAA,EAAM;AACzC,IAAA,OAAA,CAAQ,IAAI,EAAE,CAAA;AAAA,EAChB,CAAA,MAAO;AACL,IAAA,OAAA,CAAQ,GAAA,CAAI,MAAA,CAAO,KAAK,CAAC,CAAA;AAAA,EAC3B;AACF,CAAA,EArCmE,WAAA","file":"chunk-CZ7QQE6H.js","sourcesContent":["import { define } from 'gunshi';\nimport { gracefulExit } from 'exit-hook';\n\nimport { loadVarlockEnvGraph } from '../../lib/load-graph';\nimport { checkForSchemaErrors } from '../helpers/error-checks';\nimport { type TypedGunshiCommandFn } from '../helpers/gunshi-type-utils';\nimport { CliExitError } from '../helpers/exit-error';\n\nexport const commandSpec = define({\n name: 'printenv',\n description: 'Print the resolved value of a single environment variable',\n args: {\n path: {\n type: 'string',\n short: 'p',\n multiple: true,\n description: 'Path to a specific .env file or directory (with trailing slash) to use as the entry point (can be specified multiple times)',\n },\n },\n examples: `\nPrints the resolved value of a single environment variable.\nUseful within larger shell commands where you need a single env var value.\n\nExamples:\n varlock printenv MY_VAR # Print the value of MY_VAR\n varlock printenv --path .env.prod MY_VAR # Use a specific .env file\n varlock printenv --path ./config/ MY_VAR # Use a specific directory\n varlock printenv -p ./envs -p ./overrides MY_VAR # Use multiple directories\n\n📍 Note: Use sh -c to embed this in shell commands, e.g.:\n sh -c 'do-something --token $(varlock printenv MY_TOKEN)'\n\n💡 Tip: Unlike \\`varlock run -- echo $MY_VAR\\`, this works because the shell\n expansion happens after varlock has printed the value.\n `.trim(),\n});\n\nexport const commandFn: TypedGunshiCommandFn<typeof commandSpec> = async (ctx) => {\n // ctx.positionals includes the subcommand name(s) themselves, so we skip them\n // by slicing off ctx.commandPath.length entries (e.g. skips 'printenv' at index 0)\n const positionals = (ctx.positionals ?? []).slice(ctx.commandPath?.length ?? 0);\n if (!positionals.length) {\n throw new CliExitError('Missing required argument: variable name', {\n suggestion: 'Run `varlock printenv MY_VAR` to print the value of MY_VAR',\n });\n }\n const varName = positionals[0];\n\n const envGraph = await loadVarlockEnvGraph({\n entryFilePaths: ctx.values.path,\n });\n checkForSchemaErrors(envGraph);\n\n if (!(varName in envGraph.configSchema)) {\n throw new CliExitError(`Variable \"${varName}\" not found in schema`);\n }\n\n // Resolve only the requested item and its transitive dependencies\n await envGraph.resolveItemWithDeps(varName);\n\n const item = envGraph.configSchema[varName];\n if (item.validationState === 'error') {\n for (const err of item.errors) {\n console.error(`🚨 ${err.message}`);\n }\n return gracefulExit(1);\n }\n\n const value = item.resolvedValue;\n if (value === undefined || value === null) {\n console.log('');\n } else {\n console.log(String(value));\n }\n};\n"]}
@@ -1,8 +1,8 @@
1
1
  import { define } from './chunk-4A54P4EM.js';
2
- import { checkForSchemaErrors, checkForNoEnvFiles, checkForConfigErrors, showPluginWarnings } from './chunk-UROBADYQ.js';
3
- import { loadVarlockEnvGraph } from './chunk-UWINGOPT.js';
2
+ import { checkForSchemaErrors, checkForNoEnvFiles, checkForConfigErrors, showPluginWarnings } from './chunk-PBBUUBNG.js';
3
+ import { loadVarlockEnvGraph } from './chunk-WG4YIOKM.js';
4
4
  import { gracefulExit } from './chunk-CHQDS2PI.js';
5
- import { getItemSummary } from './chunk-6SU7GLJM.js';
5
+ import { getItemSummary } from './chunk-I2BC7NCA.js';
6
6
  import { __name } from './chunk-6PEHRAEP.js';
7
7
 
8
8
  // src/cli/commands/load.command.ts
@@ -117,5 +117,5 @@ var commandFn = /* @__PURE__ */ __name(async (ctx) => {
117
117
  }, "commandFn");
118
118
 
119
119
  export { commandFn, commandSpec, formatShellValue };
120
- //# sourceMappingURL=chunk-YBJQXCZE.js.map
121
- //# sourceMappingURL=chunk-YBJQXCZE.js.map
120
+ //# sourceMappingURL=chunk-CZXCAKEV.js.map
121
+ //# sourceMappingURL=chun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AG,GAAG,CAAA,CAAA,EAAI,QAAQ,CAAA,CAAE,CAAA;AAAA,IAC3C;AAAA,EACF,CAAA,MAAO;AACL,IAAA,MAAM,IAAI,KAAA,CAAM,CAAA,gBAAA,EAAmB,MAAM,CAAA,CAAE,CAAA;AAAA,EAC7C;AACF,CAAA,EA3EmE,WAAA","file":"chunk-YBJQXCZE.js","sourcesContent":["import { define } from 'gunshi';\nimport { gracefulExit } from 'exit-hook';\n\nimport { loadVarlockEnvGraph } from '../../lib/load-graph';\nimport { getItemSummary } from '../../lib/formatting';\nimport {\n checkForConfigErrors, checkForNoEnvFiles, checkForSchemaErrors, showPluginWarnings,\n} from '../helpers/error-checks';\nimport { type TypedGunshiCommandFn } from '../helpers/gunshi-type-utils';\n\nexport const commandSpec = define({\n name: 'load',\n description: 'Load env according to schema and resolve values',\n args: {\n format: {\n type: 'enum',\n short: 'f',\n choices: ['pretty', 'json', 'env', 'shell', 'json-full'],\n description: 'Format of output',\n default: 'pretty',\n },\n compact: {\n type: 'boolean',\n description: 'Use compact format (for json-full: no indentation, for env/shell: skip undefined values)',\n },\n 'show-all': {\n type: 'boolean',\n description: 'When load is failing, show all items rather than only failing items',\n },\n env: {\n type: 'string',\n description: 'Set the environment (e.g., production, development, etc) - will be overridden by @currentEnv in the schema if present',\n },\n path: {\n type: 'string',\n short: 'p',\n multiple: true,\n description: 'Path to a specific .env file or directory to use as the entry point (can be specified multiple times)',\n },\n },\n examples: `\nLoads and validates environment variables according to your .env files, and prints the results.\nUseful for debugging locally, and in CI to print out a summary of env vars.\n\nExamples:\n varlock load # Load and validate with pretty output\n varlock load --format json # Output in JSON format\n eval \"$(varlock load --format shell)\" # Load vars into current shell (useful with direnv)\n varlock load --show-all # Show all items when validation fails\n varlock load --path .env.prod # Load from a specific .env file\n varlock load -p ./envs -p ./overrides # Load from multiple directories\n varlock load --compact # Use compact format - skips undefined values, no indentation for json-full\n varlock load --env production # Load for a specific environment (⚠️ ignored if using @currentEnv!)\n`.trim(),\n});\n\n\n/**\n * Formats a string value for safe use in a shell export statement.\n * Uses single-quoted strings to prevent shell injection via backticks, `$`, etc.\n * Single quotes within the value are escaped using the `'\\''` sequence.\n */\nexport function formatShellValue(value: string): string {\n return `'${value.replaceAll(\"'\", \"'\\\\''\")}'`;\n}\n\nexport const commandFn: TypedGunshiCommandFn<typeof commandSpec> = async (ctx) => {\n const { format, compact, 'show-all': showAll } = ctx.values;\n\n const envGraph = await loadVarlockEnvGraph({\n currentEnvFallback: ctx.values.env,\n entryFilePaths: ctx.values.path,\n });\n\n // For json-full, always output the serialized graph — it includes `errors` and\n // `configErrors` fields so consumers can handle failures gracefully.\n // For all other formats, exit on errors as before.\n if (format !== 'json-full') {\n checkForSchemaErrors(envGraph);\n checkForNoEnvFiles(envGraph);\n }\n\n if (!envGraph.rootDataSource) throw new Error('expected root data source to be set');\n\n // Generate types before resolving values — uses only non-env-specific schema info\n await envGraph.generateTypesIfNeeded();\n\n await envGraph.resolveEnvValues();\n\n if (format === 'json-full') {\n checkForConfigErrors(envGraph, { showAll, noThrow: true });\n } else {\n checkForConfigErrors(envGraph, { showAll });\n }\n\n if (format === 'pretty') {\n showPluginWarnings(envGraph);\n for (const itemKey of envGraph.sortedConfigKeys) {\n const item = envGraph.configSchema[itemKey];\n console.log(getItemSummary(item));\n }\n } else if (format === 'json') {\n console.log(JSON.stringify(envGraph.getResolvedEnvObject(), null, 2));\n } else if (format === 'json-full') {\n const indent = compact ? 0 : 2;\n const serialized = envGraph.getSerializedGraph();\n console.log(JSON.stringify(serialized, null, indent));\n // Output JSON to stdout even on failure (so consumers can parse err.stdout),\n // but still exit non-zero so execSync callers know something is wrong\n if (serialized.errors) {\n gracefulExit(1);\n }\n } else if (format === 'env' || format === 'shell') {\n const resolvedEnv = envGraph.getResolvedEnvObject();\n const skipUndefined = compact === true;\n const prefix = format === 'shell' ? 'export ' : '';\n\n for (const key in resolvedEnv) {\n const value = resolvedEnv[key];\n\n if (value === undefined && skipUndefined) {\n continue;\n }\n\n let strValue: string;\n if (value === undefined) {\n strValue = '';\n } else if (typeof value === 'string') {\n if (format === 'shell') {\n strValue = formatShellValue(value);\n } else {\n strValue = `\"${value.replaceAll('\"', '\\\\\"').replaceAll('\\n', '\\\\n')}\"`;\n }\n } else {\n strValue = JSON.stringify(value);\n }\n console.log(`${prefix}${key}=${strValue}`);\n }\n } else {\n throw new Error(`Unknown format: ${format}`);\n }\n};\n"]}
1
+ {"version":3,"sources":["../src/cli/commands/load.command.ts"],"names":[],"mappings":";;;;;;;;AAUO,IAAM,cAAc,MAAA,CAAO;AAAA,EAChC,IAAA,EAAM,MAAA;AAAA,EACN,WAAA,EAAa,iDAAA;AAAA,EACb,IAAA,EAAM;AAAA,IACJ,MAAA,EAAQ;AAAA,MACN,IAAA,EAAM,MAAA;AAAA,MACN,KAAA,EAAO,GAAA;AAAA,MACP,SAAS,CAAC,QAAA,EAAU,MAAA,EAAQ,KAAA,EAAO,SAAS,WAAW,CAAA;AAAA,MACvD,WAAA,EAAa,kBAAA;AAAA,MACb,OAAA,EAAS;AAAA,KACX;AAAA,IACA,OAAA,EAAS;AAAA,MACP,IAAA,EAAM,SAAA;AAAA,MACN,WAAA,EAAa;AAAA,KACf;AAAA,IACA,UAAA,EAAY;AAAA,MACV,IAAA,EAAM,SAAA;AAAA,MACN,WAAA,EAAa;AAAA,KACf;AAAA,IACA,GAAA,EAAK;AAAA,MACH,IAAA,EAAM,QAAA;AAAA,MACN,WAAA,EAAa;AAAA,KACf;AAAA,IACA,IAAA,EAAM;AAAA,MACJ,IAAA,EAAM,QAAA;AAAA,MACN,KAAA,EAAO,GAAA;AAAA,MACP,QAAA,EAAU,IAAA;AAAA,MACV,WAAA,EAAa;AAAA;AACf,GACF;AAAA,EACA,QAAA,EAAU;AAAA;AAAA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,CAAA,CAaV,IAAA;AACF,CAAC;AAQM,SAAS,iBAAiB,KAAA,EAAuB;AAC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GAAA,EAAK,KAAK,CAAA,CAAE,UAAA,CAAW,IAAA,EAAM,KAAK,CAAC,CAAA,CAAA,CAAA;AAAA,QACrE;AAAA,MACF,CAAA,MAAO;AACL,QAAA,QAAA,GAAW,IAAA,CAAK,UAAU,KAAK,CAAA;AAAA,MACjC;AACA,MAAA,OAAA,CAAQ,IAAI,CAAA,EAAG,MAAM,GAAG,GAAG,CAAA,CAAA,EAAI,QAAQ,CAAA,CAAE,CAAA;AAAA,IAC3C;AAAA,EACF,CAAA,MAAO;AACL,IAAA,MAAM,IAAI,KAAA,CAAM,CAAA,gBAAA,EAAmB,MAAM,CAAA,CAAE,CAAA;AAAA,EAC7C;AACF,CAAA,EA3EmE,WAAA","file":"chunk-CZXCAKEV.js","sourcesContent":["import { define } from 'gunshi';\nimport { gracefulExit } from 'exit-hook';\n\nimport { loadVarlockEnvGraph } from '../../lib/load-graph';\nimport { getItemSummary } from '../../lib/formatting';\nimport {\n checkForConfigErrors, checkForNoEnvFiles, checkForSchemaErrors, showPluginWarnings,\n} from '../helpers/error-checks';\nimport { type TypedGunshiCommandFn } from '../helpers/gunshi-type-utils';\n\nexport const commandSpec = define({\n name: 'load',\n description: 'Load env according to schema and resolve values',\n args: {\n format: {\n type: 'enum',\n short: 'f',\n choices: ['pretty', 'json', 'env', 'shell', 'json-full'],\n description: 'Format of output',\n default: 'pretty',\n },\n compact: {\n type: 'boolean',\n description: 'Use compact format (for json-full: no indentation, for env/shell: skip undefined values)',\n },\n 'show-all': {\n type: 'boolean',\n description: 'When load is failing, show all items rather than only failing items',\n },\n env: {\n type: 'string',\n description: 'Set the environment (e.g., production, development, etc) - will be overridden by @currentEnv in the schema if present',\n },\n path: {\n type: 'string',\n short: 'p',\n multiple: true,\n description: 'Path to a specific .env file or directory to use as the entry point (can be specified multiple times)',\n },\n },\n examples: `\nLoads and validates environment variables according to your .env files, and prints the results.\nUseful for debugging locally, and in CI to print out a summary of env vars.\n\nExamples:\n varlock load # Load and validate with pretty output\n varlock load --format json # Output in JSON format\n eval \"$(varlock load --format shell)\" # Load vars into current shell (useful with direnv)\n varlock load --show-all # Show all items when validation fails\n varlock load --path .env.prod # Load from a specific .env file\n varlock load -p ./envs -p ./overrides # Load from multiple directories\n varlock load --compact # Use compact format - skips undefined values, no indentation for json-full\n varlock load --env production # Load for a specific environment (⚠️ ignored if using @currentEnv!)\n`.trim(),\n});\n\n\n/**\n * Formats a string value for safe use in a shell export statement.\n * Uses single-quoted strings to prevent shell injection via backticks, `$`, etc.\n * Single quotes within the value are escaped using the `'\\''` sequence.\n */\nexport function formatShellValue(value: string): string {\n return `'${value.replaceAll(\"'\", \"'\\\\''\")}'`;\n}\n\nexport const commandFn: TypedGunshiCommandFn<typeof commandSpec> = async (ctx) => {\n const { format, compact, 'show-all': showAll } = ctx.values;\n\n const envGraph = await loadVarlockEnvGraph({\n currentEnvFallback: ctx.values.env,\n entryFilePaths: ctx.values.path,\n });\n\n // For json-full, always output the serialized graph — it includes `errors` and\n // `configErrors` fields so consumers can handle failures gracefully.\n // For all other formats, exit on errors as before.\n if (format !== 'json-full') {\n checkForSchemaErrors(envGraph);\n checkForNoEnvFiles(envGraph);\n }\n\n if (!envGraph.rootDataSource) throw new Error('expected root data source to be set');\n\n // Generate types before resolving values — uses only non-env-specific schema info\n await envGraph.generateTypesIfNeeded();\n\n await envGraph.resolveEnvValues();\n\n if (format === 'json-full') {\n checkForConfigErrors(envGraph, { showAll, noThrow: true });\n } else {\n checkForConfigErrors(envGraph, { showAll });\n }\n\n if (format === 'pretty') {\n showPluginWarnings(envGraph);\n for (const itemKey of envGraph.sortedConfigKeys) {\n const item = envGraph.configSchema[itemKey];\n console.log(getItemSummary(item));\n }\n } else if (format === 'json') {\n console.log(JSON.stringify(envGraph.getResolvedEnvObject(), null, 2));\n } else if (format === 'json-full') {\n const indent = compact ? 0 : 2;\n const serialized = envGraph.getSerializedGraph();\n console.log(JSON.stringify(serialized, null, indent));\n // Output JSON to stdout even on failure (so consumers can parse err.stdout),\n // but still exit non-zero so execSync callers know something is wrong\n if (serialized.errors) {\n gracefulExit(1);\n }\n } else if (format === 'env' || format === 'shell') {\n const resolvedEnv = envGraph.getResolvedEnvObject();\n const skipUndefined = compact === true;\n const prefix = format === 'shell' ? 'export ' : '';\n\n for (const key in resolvedEnv) {\n const value = resolvedEnv[key];\n\n if (value === undefined && skipUndefined) {\n continue;\n }\n\n let strValue: string;\n if (value === undefined) {\n strValue = '';\n } else if (typeof value === 'string') {\n if (format === 'shell') {\n strValue = formatShellValue(value);\n } else {\n strValue = `\"${value.replaceAll('\"', '\\\\\"').replaceAll('\\n', '\\\\n')}\"`;\n }\n } else {\n strValue = JSON.stringify(value);\n }\n console.log(`${prefix}${key}=${strValue}`);\n }\n } else {\n throw new Error(`Unknown format: ${format}`);\n }\n};\n"]}