ultraenv 1.0.0

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 (89) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +2058 -0
  3. package/bin/ultraenv.mjs +3 -0
  4. package/dist/chunk-2USZPWLZ.js +288 -0
  5. package/dist/chunk-3UV2QNJL.js +270 -0
  6. package/dist/chunk-3VYXPTYV.js +179 -0
  7. package/dist/chunk-4XUYMRK5.js +366 -0
  8. package/dist/chunk-5G2DU52U.js +189 -0
  9. package/dist/chunk-6KS56D6E.js +172 -0
  10. package/dist/chunk-AWN6ADV7.js +328 -0
  11. package/dist/chunk-CHVO6NWI.js +203 -0
  12. package/dist/chunk-CIFMBJ4H.js +3975 -0
  13. package/dist/chunk-GC7RXHLA.js +253 -0
  14. package/dist/chunk-HFXQGJY3.js +445 -0
  15. package/dist/chunk-IGFVP24Q.js +91 -0
  16. package/dist/chunk-IKPTKALB.js +78 -0
  17. package/dist/chunk-JB7RKV3C.js +66 -0
  18. package/dist/chunk-MNVFG7H4.js +611 -0
  19. package/dist/chunk-MSXMESFP.js +1910 -0
  20. package/dist/chunk-N5PAV4NM.js +127 -0
  21. package/dist/chunk-NBOABPHM.js +158 -0
  22. package/dist/chunk-OMAOROL4.js +49 -0
  23. package/dist/chunk-R7PZRSZ7.js +105 -0
  24. package/dist/chunk-TE7HPLA6.js +73 -0
  25. package/dist/chunk-TMT5KCO3.js +101 -0
  26. package/dist/chunk-UEWYFN6A.js +189 -0
  27. package/dist/chunk-WMHN5RW2.js +128 -0
  28. package/dist/chunk-XC65ORJ5.js +70 -0
  29. package/dist/chunk-YMMP4VQL.js +118 -0
  30. package/dist/chunk-YN2KGTCB.js +33 -0
  31. package/dist/chunk-YTICOB5M.js +65 -0
  32. package/dist/chunk-YVWLXFUT.js +107 -0
  33. package/dist/ci-check-sync-VBMSVWIV.js +48 -0
  34. package/dist/ci-scan-24MT5XGS.js +41 -0
  35. package/dist/ci-setup-C2NKEFRD.js +135 -0
  36. package/dist/ci-validate-7AW24LSQ.js +57 -0
  37. package/dist/cli/index.cjs +9217 -0
  38. package/dist/cli/index.d.cts +9 -0
  39. package/dist/cli/index.d.ts +9 -0
  40. package/dist/cli/index.js +339 -0
  41. package/dist/comparator-RDKX3OI7.js +13 -0
  42. package/dist/completion-MW35C2XO.js +168 -0
  43. package/dist/config-O5YRQP5Z.js +13 -0
  44. package/dist/debug-PTPXAF3K.js +131 -0
  45. package/dist/declaration-LEME4AFZ.js +10 -0
  46. package/dist/doctor-FZAUPKHS.js +129 -0
  47. package/dist/envs-compare-5K3HESX5.js +49 -0
  48. package/dist/envs-create-2XXHXMGA.js +58 -0
  49. package/dist/envs-list-NQM5252B.js +59 -0
  50. package/dist/envs-switch-6L2AQYID.js +50 -0
  51. package/dist/envs-validate-FL73Q76T.js +89 -0
  52. package/dist/fs-VH7ATUS3.js +31 -0
  53. package/dist/generator-LFZBMZZS.js +14 -0
  54. package/dist/git-BZS4DPAI.js +30 -0
  55. package/dist/help-3XJBXEHE.js +121 -0
  56. package/dist/index.cjs +12907 -0
  57. package/dist/index.d.cts +2562 -0
  58. package/dist/index.d.ts +2562 -0
  59. package/dist/index.js +3212 -0
  60. package/dist/init-Y7JQ2KYJ.js +146 -0
  61. package/dist/install-hook-SKXIV6NV.js +111 -0
  62. package/dist/json-schema-I26YNQBH.js +10 -0
  63. package/dist/key-manager-O3G55WPU.js +25 -0
  64. package/dist/middleware/express.cjs +103 -0
  65. package/dist/middleware/express.d.cts +115 -0
  66. package/dist/middleware/express.d.ts +115 -0
  67. package/dist/middleware/express.js +8 -0
  68. package/dist/middleware/fastify.cjs +91 -0
  69. package/dist/middleware/fastify.d.cts +111 -0
  70. package/dist/middleware/fastify.d.ts +111 -0
  71. package/dist/middleware/fastify.js +8 -0
  72. package/dist/module-IDIZPP4M.js +10 -0
  73. package/dist/protect-NCWPM6VC.js +161 -0
  74. package/dist/scan-TRLY36TT.js +58 -0
  75. package/dist/schema/index.cjs +4074 -0
  76. package/dist/schema/index.d.cts +1244 -0
  77. package/dist/schema/index.d.ts +1244 -0
  78. package/dist/schema/index.js +152 -0
  79. package/dist/sync-TMHMTLH2.js +186 -0
  80. package/dist/typegen-SQOSXBWM.js +80 -0
  81. package/dist/validate-IOAM5HWS.js +100 -0
  82. package/dist/vault-decrypt-U6HJZNBV.js +111 -0
  83. package/dist/vault-diff-B3ZOQTWI.js +132 -0
  84. package/dist/vault-encrypt-GUSLCSKS.js +112 -0
  85. package/dist/vault-init-GUBOTOUL.js +106 -0
  86. package/dist/vault-rekey-DAHT7JCN.js +132 -0
  87. package/dist/vault-status-GDLRU2OK.js +90 -0
  88. package/dist/vault-verify-CD76FJSF.js +102 -0
  89. package/package.json +106 -0
@@ -0,0 +1,10 @@
1
+ import {
2
+ generateDeclaration,
3
+ generateDeclarationContent
4
+ } from "./chunk-IGFVP24Q.js";
5
+ import "./chunk-3VYXPTYV.js";
6
+ import "./chunk-5G2DU52U.js";
7
+ export {
8
+ generateDeclaration,
9
+ generateDeclarationContent
10
+ };
@@ -0,0 +1,129 @@
1
+ import {
2
+ drawTable
3
+ } from "./chunk-WMHN5RW2.js";
4
+ import {
5
+ isGitRepository
6
+ } from "./chunk-R7PZRSZ7.js";
7
+ import {
8
+ bold,
9
+ cyan,
10
+ green,
11
+ red,
12
+ yellow
13
+ } from "./chunk-OMAOROL4.js";
14
+ import {
15
+ writeError,
16
+ writeJson,
17
+ writeLine
18
+ } from "./chunk-YN2KGTCB.js";
19
+ import {
20
+ exists
21
+ } from "./chunk-3VYXPTYV.js";
22
+ import "./chunk-5G2DU52U.js";
23
+
24
+ // src/cli/commands/doctor.ts
25
+ import { resolve, join } from "path";
26
+ async function run(args, ctx) {
27
+ try {
28
+ const cwd = args.flags["--cwd"] ?? ctx.cwd;
29
+ const baseDir = resolve(cwd);
30
+ writeLine(bold("\u{1F3E5} ultraenv Doctor"));
31
+ writeLine("");
32
+ writeLine(cyan(" Running self-checks..."));
33
+ writeLine("");
34
+ const checks = [];
35
+ const nodeVersion = process.version;
36
+ const major = parseInt(nodeVersion.slice(1), 10);
37
+ checks.push({
38
+ name: "Node.js version",
39
+ status: major >= 18 ? "pass" : "warn",
40
+ message: nodeVersion + (major >= 18 ? "" : " (recommended: >= 18)")
41
+ });
42
+ checks.push({
43
+ name: "Platform",
44
+ status: "pass",
45
+ message: `${process.platform} ${process.arch}`
46
+ });
47
+ const isGit = await isGitRepository(baseDir);
48
+ checks.push({
49
+ name: "Git repository",
50
+ status: isGit ? "pass" : "warn",
51
+ message: isGit ? "Detected" : "Not a git repository"
52
+ });
53
+ const envExists = await exists(join(baseDir, ".env"));
54
+ checks.push({
55
+ name: ".env file",
56
+ status: envExists ? "pass" : "warn",
57
+ message: envExists ? "Found" : "Not found"
58
+ });
59
+ const gitignoreExists = await exists(join(baseDir, ".gitignore"));
60
+ checks.push({
61
+ name: ".gitignore",
62
+ status: gitignoreExists ? "pass" : "warn",
63
+ message: gitignoreExists ? "Found" : "Not found"
64
+ });
65
+ const vaultExists = await exists(join(baseDir, ".env.vault"));
66
+ checks.push({
67
+ name: ".env.vault",
68
+ status: vaultExists ? "pass" : "warn",
69
+ message: vaultExists ? "Found" : "Not initialized"
70
+ });
71
+ const keysExists = await exists(join(baseDir, ".env.keys"));
72
+ if (vaultExists) {
73
+ checks.push({
74
+ name: ".env.keys",
75
+ status: keysExists ? "pass" : "fail",
76
+ message: keysExists ? "Found" : "Missing (vault needs keys)"
77
+ });
78
+ }
79
+ const exampleExists = await exists(join(baseDir, ".env.example"));
80
+ checks.push({
81
+ name: ".env.example",
82
+ status: exampleExists ? "pass" : "warn",
83
+ message: exampleExists ? "Found" : "Not found"
84
+ });
85
+ const { findConfig } = await import("./config-O5YRQP5Z.js");
86
+ const configPath = findConfig(baseDir);
87
+ checks.push({
88
+ name: "Configuration",
89
+ status: configPath ? "pass" : "warn",
90
+ message: configPath ?? "Not found (using defaults)"
91
+ });
92
+ const tsconfigExists = await exists(join(baseDir, "tsconfig.json"));
93
+ checks.push({
94
+ name: "TypeScript",
95
+ status: tsconfigExists ? "pass" : "warn",
96
+ message: tsconfigExists ? "tsconfig.json found" : "Not a TypeScript project"
97
+ });
98
+ const headers = ["Check", "Status", "Details"];
99
+ const rows = checks.map((check) => {
100
+ const statusIcon = check.status === "pass" ? green("\u2713") : check.status === "warn" ? yellow("\u26A0") : red("\u2717");
101
+ return [check.name, statusIcon, check.message];
102
+ });
103
+ writeLine(drawTable(headers, rows, { maxWidth: 90 }));
104
+ writeLine("");
105
+ const passed = checks.filter((c) => c.status === "pass").length;
106
+ const warnings = checks.filter((c) => c.status === "warn").length;
107
+ const failed = checks.filter((c) => c.status === "fail").length;
108
+ if (ctx.outputFormat === "json") {
109
+ writeJson({ checks, summary: { passed, warnings, failed, total: checks.length } });
110
+ return failed > 0 ? 1 : 0;
111
+ }
112
+ writeLine(cyan(` ${passed}/${checks.length} passed, ${warnings} warning(s), ${failed} failure(s)`));
113
+ writeLine("");
114
+ if (failed > 0) {
115
+ writeLine(red(bold(" Some checks failed. Fix the issues above.")));
116
+ return 1;
117
+ }
118
+ writeLine(green(bold(" \u2705 ultraenv is healthy!")));
119
+ writeLine("");
120
+ return 0;
121
+ } catch (error) {
122
+ const msg = error instanceof Error ? error.message : String(error);
123
+ writeError(red(` Doctor error: ${msg}`));
124
+ return 1;
125
+ }
126
+ }
127
+ export {
128
+ run
129
+ };
@@ -0,0 +1,49 @@
1
+ import {
2
+ compareEnvironments,
3
+ formatComparison
4
+ } from "./chunk-3UV2QNJL.js";
5
+ import "./chunk-TE7HPLA6.js";
6
+ import "./chunk-HFXQGJY3.js";
7
+ import {
8
+ bold,
9
+ red,
10
+ yellow
11
+ } from "./chunk-OMAOROL4.js";
12
+ import {
13
+ writeError,
14
+ writeLine
15
+ } from "./chunk-YN2KGTCB.js";
16
+ import "./chunk-3VYXPTYV.js";
17
+ import "./chunk-5G2DU52U.js";
18
+
19
+ // src/cli/commands/envs-compare.ts
20
+ async function run(args, ctx) {
21
+ try {
22
+ const cwd = args.flags["--cwd"] ?? ctx.cwd;
23
+ const env1 = args.positional[0] ?? args.flags["--source"];
24
+ const env2 = args.positional[1] ?? args.flags["--target"];
25
+ if (!env1 || !env2) {
26
+ writeError(red(" Two environment names required."));
27
+ writeError(yellow(" Usage: ultraenv envs compare <env1> <env2>"));
28
+ return 1;
29
+ }
30
+ writeLine(bold(`\u{1F4CA} Comparing environments: ${env1} vs ${env2}`));
31
+ writeLine("");
32
+ const comparison = await compareEnvironments(env1, env2, cwd);
33
+ writeLine(formatComparison(comparison));
34
+ writeLine("");
35
+ if (comparison.warnings.length > 0) {
36
+ writeLine(yellow(` \u26A0 ${comparison.warnings.length} warning(s) detected.`));
37
+ writeLine("");
38
+ return 1;
39
+ }
40
+ return 0;
41
+ } catch (error) {
42
+ const msg = error instanceof Error ? error.message : String(error);
43
+ writeError(red(` Error: ${msg}`));
44
+ return 1;
45
+ }
46
+ }
47
+ export {
48
+ run
49
+ };
@@ -0,0 +1,58 @@
1
+ import {
2
+ createEnvironment,
3
+ listTemplates
4
+ } from "./chunk-AWN6ADV7.js";
5
+ import "./chunk-HFXQGJY3.js";
6
+ import {
7
+ bold,
8
+ cyan,
9
+ green,
10
+ red,
11
+ yellow
12
+ } from "./chunk-OMAOROL4.js";
13
+ import {
14
+ writeError,
15
+ writeLine
16
+ } from "./chunk-YN2KGTCB.js";
17
+ import "./chunk-3VYXPTYV.js";
18
+ import "./chunk-5G2DU52U.js";
19
+
20
+ // src/cli/commands/envs-create.ts
21
+ async function run(args, ctx) {
22
+ try {
23
+ const cwd = args.flags["--cwd"] ?? ctx.cwd;
24
+ const name = args.positional[0];
25
+ if (!name) {
26
+ writeError(red(" Environment name required."));
27
+ writeError(yellow(" Usage: ultraenv envs create <name> [options]"));
28
+ writeLine("");
29
+ writeLine(cyan(" Available templates:"));
30
+ for (const t of listTemplates()) {
31
+ writeLine(` ${cyan(t.name.padEnd(12))} ${t.description}`);
32
+ }
33
+ writeLine("");
34
+ return 1;
35
+ }
36
+ const template = args.flags["--template"];
37
+ const copyFrom = args.flags["--copy"];
38
+ writeLine(bold(`\u{1F4DD} Creating environment "${name}"`));
39
+ writeLine("");
40
+ await createEnvironment(name, {
41
+ fromTemplate: template,
42
+ copyFrom,
43
+ cwd
44
+ });
45
+ writeLine(green(` \u2713 Created .env.${name}`));
46
+ writeLine("");
47
+ writeLine(cyan(" Next: Edit .env." + name + " with your environment variables"));
48
+ writeLine("");
49
+ return 0;
50
+ } catch (error) {
51
+ const msg = error instanceof Error ? error.message : String(error);
52
+ writeError(red(` Error: ${msg}`));
53
+ return 1;
54
+ }
55
+ }
56
+ export {
57
+ run
58
+ };
@@ -0,0 +1,59 @@
1
+ import {
2
+ drawTable
3
+ } from "./chunk-WMHN5RW2.js";
4
+ import {
5
+ listEnvironments
6
+ } from "./chunk-GC7RXHLA.js";
7
+ import "./chunk-HFXQGJY3.js";
8
+ import {
9
+ bold,
10
+ cyan,
11
+ red,
12
+ yellow
13
+ } from "./chunk-OMAOROL4.js";
14
+ import {
15
+ writeError,
16
+ writeJson,
17
+ writeLine
18
+ } from "./chunk-YN2KGTCB.js";
19
+ import "./chunk-3VYXPTYV.js";
20
+ import "./chunk-5G2DU52U.js";
21
+
22
+ // src/cli/commands/envs-list.ts
23
+ async function run(args, ctx) {
24
+ try {
25
+ const cwd = args.flags["--cwd"] ?? ctx.cwd;
26
+ const environments = await listEnvironments(cwd);
27
+ if (ctx.outputFormat === "json") {
28
+ writeJson({ environments });
29
+ return 0;
30
+ }
31
+ writeLine(bold("\u{1F4CB} Environments"));
32
+ writeLine("");
33
+ const existing = environments.filter((e) => e.exists);
34
+ if (existing.length === 0) {
35
+ writeLine(yellow(" No environment files found."));
36
+ writeLine(" Create one with: ultraenv envs create <name>");
37
+ writeLine("");
38
+ return 0;
39
+ }
40
+ const headers = ["Name", "File", "Variables", "Size", "Modified"];
41
+ const rows = existing.map((env) => {
42
+ const size = env.fileSize > 1024 ? `${(env.fileSize / 1024).toFixed(1)} KB` : `${env.fileSize} B`;
43
+ const modified = env.lastModified ? env.lastModified.slice(0, 19).replace("T", " ") : "-";
44
+ return [env.name, env.fileName, String(env.variableCount), size, modified];
45
+ });
46
+ writeLine(drawTable(headers, rows, { maxWidth: 100 }));
47
+ writeLine("");
48
+ writeLine(cyan(` ${existing.length} environment(s) found.`));
49
+ writeLine("");
50
+ return 0;
51
+ } catch (error) {
52
+ const msg = error instanceof Error ? error.message : String(error);
53
+ writeError(red(` Error: ${msg}`));
54
+ return 1;
55
+ }
56
+ }
57
+ export {
58
+ run
59
+ };
@@ -0,0 +1,50 @@
1
+ import {
2
+ getActiveEnvironment,
3
+ switchEnvironment
4
+ } from "./chunk-GC7RXHLA.js";
5
+ import "./chunk-HFXQGJY3.js";
6
+ import {
7
+ bold,
8
+ cyan,
9
+ green,
10
+ red,
11
+ yellow
12
+ } from "./chunk-OMAOROL4.js";
13
+ import {
14
+ writeError,
15
+ writeLine
16
+ } from "./chunk-YN2KGTCB.js";
17
+ import "./chunk-3VYXPTYV.js";
18
+ import "./chunk-5G2DU52U.js";
19
+
20
+ // src/cli/commands/envs-switch.ts
21
+ async function run(args, ctx) {
22
+ try {
23
+ const cwd = args.flags["--cwd"] ?? ctx.cwd;
24
+ const name = args.positional[0];
25
+ if (!name) {
26
+ const current = await getActiveEnvironment(cwd);
27
+ writeLine(cyan(` Current environment: ${bold(current)}`));
28
+ writeLine("");
29
+ return 0;
30
+ }
31
+ const previous = await getActiveEnvironment(cwd);
32
+ if (previous !== "base") {
33
+ writeLine(cyan(` Switching from "${previous}" to "${name}"...`));
34
+ } else {
35
+ writeLine(cyan(` Switching to "${name}"...`));
36
+ }
37
+ await switchEnvironment(name, cwd);
38
+ writeLine(green(bold(` \u2705 Switched to "${name}"`)));
39
+ writeLine(yellow(" .env.local has been updated with the environment variables."));
40
+ writeLine("");
41
+ return 0;
42
+ } catch (error) {
43
+ const msg = error instanceof Error ? error.message : String(error);
44
+ writeError(red(` Error: ${msg}`));
45
+ return 1;
46
+ }
47
+ }
48
+ export {
49
+ run
50
+ };
@@ -0,0 +1,89 @@
1
+ import {
2
+ drawTable
3
+ } from "./chunk-WMHN5RW2.js";
4
+ import {
5
+ validateAllEnvironments
6
+ } from "./chunk-GC7RXHLA.js";
7
+ import "./chunk-HFXQGJY3.js";
8
+ import {
9
+ bold,
10
+ green,
11
+ red,
12
+ yellow
13
+ } from "./chunk-OMAOROL4.js";
14
+ import {
15
+ writeError,
16
+ writeJson,
17
+ writeLine
18
+ } from "./chunk-YN2KGTCB.js";
19
+ import "./chunk-3VYXPTYV.js";
20
+ import "./chunk-5G2DU52U.js";
21
+
22
+ // src/cli/commands/envs-validate.ts
23
+ async function run(args, ctx) {
24
+ try {
25
+ const cwd = args.flags["--cwd"] ?? ctx.cwd;
26
+ writeLine(bold("\u2705 Validating all environments"));
27
+ writeLine("");
28
+ const schema = ctx.config.schema;
29
+ if (!schema) {
30
+ writeLine(yellow(" No schema defined in configuration. Basic validation only."));
31
+ writeLine("");
32
+ }
33
+ const results = await validateAllEnvironments(
34
+ ctx.config.schema?.definitions ?? {},
35
+ cwd
36
+ );
37
+ if (ctx.outputFormat === "json") {
38
+ const jsonResults = {};
39
+ for (const [name, result] of results) {
40
+ jsonResults[name] = {
41
+ valid: result.valid,
42
+ errors: result.errors.map((e) => e.message),
43
+ warnings: result.warnings.map((w) => w.message)
44
+ };
45
+ }
46
+ writeJson({ environments: jsonResults });
47
+ return [...results.values()].every((r) => r.valid) ? 0 : 1;
48
+ }
49
+ const headers = ["Environment", "Status", "Errors", "Warnings"];
50
+ const rows = [];
51
+ for (const [name, result] of results) {
52
+ const status = result.valid ? green("\u2713 Pass") : red("\u2717 Fail");
53
+ rows.push([name, status, String(result.errors.length), String(result.warnings.length)]);
54
+ }
55
+ writeLine(drawTable(headers, rows, { maxWidth: 80 }));
56
+ writeLine("");
57
+ let hasErrors = false;
58
+ for (const [name, result] of results) {
59
+ if (!result.valid) {
60
+ hasErrors = true;
61
+ writeLine(red(` ${name}:`));
62
+ for (const err of result.errors) {
63
+ writeLine(red(` \u2717 ${err.message}`));
64
+ if (err.hint) {
65
+ writeLine(yellow(` Hint: ${err.hint}`));
66
+ }
67
+ }
68
+ writeLine("");
69
+ }
70
+ if (result.warnings.length > 0) {
71
+ for (const warn of result.warnings) {
72
+ writeLine(yellow(` ${name}: \u26A0 ${warn.message}`));
73
+ }
74
+ }
75
+ }
76
+ if (!hasErrors) {
77
+ writeLine(green(bold(" \u2705 All environments passed validation")));
78
+ }
79
+ writeLine("");
80
+ return hasErrors ? 1 : 0;
81
+ } catch (error) {
82
+ const msg = error instanceof Error ? error.message : String(error);
83
+ writeError(red(` Error: ${msg}`));
84
+ return 1;
85
+ }
86
+ }
87
+ export {
88
+ run
89
+ };
@@ -0,0 +1,31 @@
1
+ import {
2
+ copyFile,
3
+ ensureDir,
4
+ exists,
5
+ existsSyncCheck,
6
+ findUp,
7
+ findUpSync,
8
+ isDirectory,
9
+ isFile,
10
+ listFiles,
11
+ readFile,
12
+ readFileSync,
13
+ removeFile,
14
+ writeFile
15
+ } from "./chunk-3VYXPTYV.js";
16
+ import "./chunk-5G2DU52U.js";
17
+ export {
18
+ copyFile,
19
+ ensureDir,
20
+ exists,
21
+ existsSyncCheck,
22
+ findUp,
23
+ findUpSync,
24
+ isDirectory,
25
+ isFile,
26
+ listFiles,
27
+ readFile,
28
+ readFileSync,
29
+ removeFile,
30
+ writeFile
31
+ };
@@ -0,0 +1,14 @@
1
+ import {
2
+ generateExampleContent,
3
+ generateExampleFile,
4
+ needsUpdate
5
+ } from "./chunk-CHVO6NWI.js";
6
+ import "./chunk-TE7HPLA6.js";
7
+ import "./chunk-HFXQGJY3.js";
8
+ import "./chunk-3VYXPTYV.js";
9
+ import "./chunk-5G2DU52U.js";
10
+ export {
11
+ generateExampleContent,
12
+ generateExampleFile,
13
+ needsUpdate
14
+ };
@@ -0,0 +1,30 @@
1
+ import {
2
+ getCommitHash,
3
+ getConfig,
4
+ getConfigAll,
5
+ getCurrentBranch,
6
+ getDiffFiles,
7
+ getFullCommitHash,
8
+ getGitRoot,
9
+ getRemoteUrl,
10
+ getStagedFiles,
11
+ getTrackedFiles,
12
+ isDirty,
13
+ isGitIgnored,
14
+ isGitRepository
15
+ } from "./chunk-R7PZRSZ7.js";
16
+ export {
17
+ getCommitHash,
18
+ getConfig,
19
+ getConfigAll,
20
+ getCurrentBranch,
21
+ getDiffFiles,
22
+ getFullCommitHash,
23
+ getGitRoot,
24
+ getRemoteUrl,
25
+ getStagedFiles,
26
+ getTrackedFiles,
27
+ isDirty,
28
+ isGitIgnored,
29
+ isGitRepository
30
+ };
@@ -0,0 +1,121 @@
1
+ import {
2
+ bold,
3
+ cyan,
4
+ dim
5
+ } from "./chunk-OMAOROL4.js";
6
+ import {
7
+ writeError,
8
+ writeLine
9
+ } from "./chunk-YN2KGTCB.js";
10
+ import {
11
+ VERSION
12
+ } from "./chunk-XC65ORJ5.js";
13
+
14
+ // src/cli/commands/help.ts
15
+ var COMMANDS = [
16
+ { name: "init", description: "Initialize ultraenv in a project", usage: "ultraenv init [options]" },
17
+ { name: "validate", description: "Validate environment against schema", usage: "ultraenv validate [options]" },
18
+ { name: "typegen", description: "Generate TypeScript types", usage: "ultraenv typegen [options]" },
19
+ { name: "sync", description: "Sync .env.example", usage: "ultraenv sync [options]" },
20
+ { name: "scan", description: "Scan for leaked secrets", usage: "ultraenv scan [options]" },
21
+ { name: "debug", description: "Show environment diagnostics", usage: "ultraenv debug [options]" },
22
+ { name: "protect", description: "Verify .gitignore protection", usage: "ultraenv protect [options]" },
23
+ { name: "vault init", description: "Initialize encrypted vault", usage: "ultraenv vault init [options]" },
24
+ { name: "vault encrypt", description: "Encrypt .env \u2192 vault", usage: "ultraenv vault encrypt [options]" },
25
+ { name: "vault decrypt", description: "Decrypt vault \u2192 .env", usage: "ultraenv vault decrypt [options]" },
26
+ { name: "vault rekey", description: "Rotate encryption keys", usage: "ultraenv vault rekey [options]" },
27
+ { name: "vault status", description: "Show vault status", usage: "ultraenv vault status [options]" },
28
+ { name: "vault diff", description: "Compare .env vs vault", usage: "ultraenv vault diff [options]" },
29
+ { name: "vault verify", description: "Verify vault integrity", usage: "ultraenv vault verify [options]" },
30
+ { name: "envs list", description: "List all environments", usage: "ultraenv envs list [options]" },
31
+ { name: "envs compare", description: "Compare two environments", usage: "ultraenv envs compare <env1> <env2>" },
32
+ { name: "envs validate", description: "Validate all environments", usage: "ultraenv envs validate [options]" },
33
+ { name: "envs create", description: "Create new environment", usage: "ultraenv envs create <name> [options]" },
34
+ { name: "envs switch", description: "Switch current environment", usage: "ultraenv envs switch <name>" },
35
+ { name: "ci validate", description: "CI validation mode", usage: "ultraenv ci validate [options]" },
36
+ { name: "ci check-sync", description: "CI sync check", usage: "ultraenv ci check-sync [options]" },
37
+ { name: "ci scan", description: "CI secret scan", usage: "ultraenv ci scan [options]" },
38
+ { name: "ci setup", description: "Generate CI config", usage: "ultraenv ci setup [options]" },
39
+ { name: "install-hook", description: "Install git pre-commit hook", usage: "ultraenv install-hook [options]" },
40
+ { name: "doctor", description: "Self-check installation", usage: "ultraenv doctor [options]" },
41
+ { name: "completion", description: "Generate shell completions", usage: "ultraenv completion <shell>" },
42
+ { name: "version", description: "Show version", usage: "ultraenv version" }
43
+ ];
44
+ async function run(args, _ctx) {
45
+ const topic = args.positional[0];
46
+ if (topic) {
47
+ const cmd = COMMANDS.find((c) => c.name === topic || c.name.startsWith(topic));
48
+ if (cmd) {
49
+ writeLine("");
50
+ writeLine(bold(` ${cmd.description}`));
51
+ writeLine("");
52
+ writeLine(` Usage: ${cmd.usage}`);
53
+ writeLine("");
54
+ const optionsMap = {
55
+ "init": ["--force", "--cwd <path>"],
56
+ "validate": ["--env-dir <path>", "--quiet"],
57
+ "typegen": ["--format <type>", "--out <path>", "--interface <name>"],
58
+ "sync": ["--mode <mode>", "--file <path>", "--out <path>", "--watch"],
59
+ "scan": ["--scope <scope>", "--format <type>", "--include <glob>", "--exclude <glob>"],
60
+ "vault init": ["--env <name>", "--force", "--key <key>"],
61
+ "vault encrypt": ["--env <name>", "--key <key>"],
62
+ "vault decrypt": ["--env <name>", "--key <key>"],
63
+ "envs create": ["--template <name>", "--copy <name>"],
64
+ "ci scan": ["--format <type>", "--git-history", "--fail-fast"]
65
+ };
66
+ const opts = optionsMap[cmd.name];
67
+ if (opts) {
68
+ writeLine(" Options:");
69
+ for (const opt of opts) {
70
+ writeLine(` ${cyan(opt)}`);
71
+ }
72
+ writeLine("");
73
+ }
74
+ return 0;
75
+ }
76
+ writeError(` Unknown command: ${topic}`);
77
+ writeLine("");
78
+ }
79
+ writeLine("");
80
+ writeLine(bold(" ultraenv \u2014 The Ultimate Environment Variable Manager"));
81
+ writeLine(` ${dim(`v${VERSION}`)}`);
82
+ writeLine("");
83
+ writeLine(" USAGE:");
84
+ writeLine(" ultraenv <command> [options] [arguments]");
85
+ writeLine("");
86
+ writeLine(" COMMANDS:");
87
+ writeLine("");
88
+ const core = COMMANDS.filter((c) => !c.name.startsWith("vault") && !c.name.startsWith("envs") && !c.name.startsWith("ci"));
89
+ const vault = COMMANDS.filter((c) => c.name.startsWith("vault"));
90
+ const envs = COMMANDS.filter((c) => c.name.startsWith("envs"));
91
+ const ci = COMMANDS.filter((c) => c.name.startsWith("ci"));
92
+ const printGroup = (title, cmds) => {
93
+ writeLine(` ${bold(title)}`);
94
+ for (const cmd of cmds) {
95
+ const paddedName = cmd.name.padEnd(20);
96
+ writeLine(` ${cyan(paddedName)} ${cmd.description}`);
97
+ }
98
+ writeLine("");
99
+ };
100
+ printGroup("Core:", core);
101
+ printGroup("Vault:", vault);
102
+ printGroup("Environments:", envs);
103
+ printGroup("CI/CD:", ci);
104
+ writeLine(" GLOBAL OPTIONS:");
105
+ writeLine("");
106
+ writeLine(" --help, -h Show help for a command");
107
+ writeLine(" --version Show version");
108
+ writeLine(" --no-color Disable colored output");
109
+ writeLine(" --verbose, -v Verbose output");
110
+ writeLine(" --quiet, -q Suppress output");
111
+ writeLine(" --strict Strict mode");
112
+ writeLine(" --debug Debug logging");
113
+ writeLine(" --cwd <path> Working directory");
114
+ writeLine(" --config <path> Config file");
115
+ writeLine(" --format <type> Output: terminal|json|silent");
116
+ writeLine("");
117
+ return 0;
118
+ }
119
+ export {
120
+ run
121
+ };