@expressots/cli 3.0.0 โ†’ 4.0.0-preview.3

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 (194) hide show
  1. package/README.md +41 -95
  2. package/bin/cicd/cli.d.ts +6 -0
  3. package/bin/cicd/cli.js +128 -0
  4. package/bin/cicd/form.d.ts +29 -0
  5. package/bin/cicd/form.js +346 -0
  6. package/bin/cicd/generators/azure-devops.d.ts +2 -0
  7. package/bin/cicd/generators/azure-devops.js +370 -0
  8. package/bin/cicd/generators/bitbucket.d.ts +2 -0
  9. package/bin/cicd/generators/bitbucket.js +217 -0
  10. package/bin/cicd/generators/circleci.d.ts +2 -0
  11. package/bin/cicd/generators/circleci.js +274 -0
  12. package/bin/cicd/generators/github-actions.d.ts +14 -0
  13. package/bin/cicd/generators/github-actions.js +426 -0
  14. package/bin/cicd/generators/gitlab-ci.d.ts +2 -0
  15. package/bin/cicd/generators/gitlab-ci.js +237 -0
  16. package/bin/cicd/generators/index.d.ts +6 -0
  17. package/bin/cicd/generators/index.js +15 -0
  18. package/bin/cicd/generators/jenkins.d.ts +2 -0
  19. package/bin/cicd/generators/jenkins.js +248 -0
  20. package/bin/cicd/generators/template-loader.d.ts +17 -0
  21. package/bin/cicd/generators/template-loader.js +128 -0
  22. package/bin/cicd/index.d.ts +1 -0
  23. package/bin/cicd/index.js +5 -0
  24. package/bin/cli.d.ts +1 -5
  25. package/bin/cli.js +72 -7
  26. package/bin/commands/project.commands.d.ts +19 -6
  27. package/bin/commands/project.commands.js +602 -66
  28. package/bin/config/index.d.ts +5 -0
  29. package/bin/config/index.js +10 -0
  30. package/bin/config/manager.d.ts +98 -0
  31. package/bin/config/manager.js +222 -0
  32. package/bin/containerize/analyzers/bootstrap-analyzer.d.ts +46 -0
  33. package/bin/containerize/analyzers/bootstrap-analyzer.js +187 -0
  34. package/bin/containerize/analyzers/project-analyzer.d.ts +20 -0
  35. package/bin/containerize/analyzers/project-analyzer.js +150 -0
  36. package/bin/containerize/cli.d.ts +4 -0
  37. package/bin/containerize/cli.js +113 -0
  38. package/bin/containerize/form.d.ts +15 -0
  39. package/bin/containerize/form.js +152 -0
  40. package/bin/containerize/generators/ci-generator.d.ts +31 -0
  41. package/bin/containerize/generators/ci-generator.js +940 -0
  42. package/bin/containerize/generators/docker-compose-generator.d.ts +8 -0
  43. package/bin/containerize/generators/docker-compose-generator.js +187 -0
  44. package/bin/containerize/generators/dockerfile-generator.d.ts +8 -0
  45. package/bin/containerize/generators/dockerfile-generator.js +657 -0
  46. package/bin/containerize/generators/kubernetes-generator.d.ts +8 -0
  47. package/bin/containerize/generators/kubernetes-generator.js +134 -0
  48. package/bin/containerize/generators/template-loader.d.ts +36 -0
  49. package/bin/containerize/generators/template-loader.js +129 -0
  50. package/bin/containerize/index.d.ts +4 -0
  51. package/bin/containerize/index.js +13 -0
  52. package/bin/containerize/presets/preset-registry.d.ts +20 -0
  53. package/bin/containerize/presets/preset-registry.js +102 -0
  54. package/bin/costs/cli.d.ts +5 -0
  55. package/bin/costs/cli.js +185 -0
  56. package/bin/costs/form.d.ts +44 -0
  57. package/bin/costs/form.js +412 -0
  58. package/bin/costs/index.d.ts +4 -0
  59. package/bin/costs/index.js +25 -0
  60. package/bin/costs/pricing-manager.d.ts +84 -0
  61. package/bin/costs/pricing-manager.js +342 -0
  62. package/bin/costs/providers/index.d.ts +32 -0
  63. package/bin/costs/providers/index.js +153 -0
  64. package/bin/costs/sources/api-source.d.ts +10 -0
  65. package/bin/costs/sources/api-source.js +32 -0
  66. package/bin/costs/sources/index.d.ts +6 -0
  67. package/bin/costs/sources/index.js +15 -0
  68. package/bin/costs/sources/local-json-source.d.ts +23 -0
  69. package/bin/costs/sources/local-json-source.js +59 -0
  70. package/bin/costs/sources/remote-json-source.d.ts +11 -0
  71. package/bin/costs/sources/remote-json-source.js +53 -0
  72. package/bin/costs/types.d.ts +53 -0
  73. package/bin/costs/types.js +5 -0
  74. package/bin/dev/cli.d.ts +4 -0
  75. package/bin/dev/cli.js +136 -0
  76. package/bin/dev/form.d.ts +36 -0
  77. package/bin/dev/form.js +254 -0
  78. package/bin/dev/index.d.ts +1 -0
  79. package/bin/dev/index.js +5 -0
  80. package/bin/generate/cli.d.ts +1 -1
  81. package/bin/generate/cli.js +29 -2
  82. package/bin/generate/form.d.ts +5 -1
  83. package/bin/generate/form.js +3 -3
  84. package/bin/generate/templates/nonopinionated/config.tpl +12 -0
  85. package/bin/generate/templates/nonopinionated/event.tpl +10 -0
  86. package/bin/generate/templates/nonopinionated/guard.tpl +18 -0
  87. package/bin/generate/templates/nonopinionated/handler.tpl +12 -0
  88. package/bin/generate/templates/nonopinionated/interceptor.tpl +27 -0
  89. package/bin/generate/templates/opinionated/config.tpl +47 -0
  90. package/bin/generate/templates/opinionated/entity.tpl +1 -8
  91. package/bin/generate/templates/opinionated/event.tpl +15 -0
  92. package/bin/generate/templates/opinionated/guard.tpl +41 -0
  93. package/bin/generate/templates/opinionated/handler.tpl +23 -0
  94. package/bin/generate/templates/opinionated/interceptor.tpl +50 -0
  95. package/bin/generate/utils/command-utils.d.ts +20 -5
  96. package/bin/generate/utils/command-utils.js +145 -48
  97. package/bin/generate/utils/nonopininated-cmd.d.ts +10 -1
  98. package/bin/generate/utils/nonopininated-cmd.js +100 -1
  99. package/bin/generate/utils/opinionated-cmd.d.ts +10 -1
  100. package/bin/generate/utils/opinionated-cmd.js +128 -16
  101. package/bin/generate/utils/string-utils.d.ts +6 -0
  102. package/bin/generate/utils/string-utils.js +13 -1
  103. package/bin/help/cli.d.ts +1 -1
  104. package/bin/help/command-help-registry.d.ts +23 -0
  105. package/bin/help/command-help-registry.js +303 -0
  106. package/bin/help/command-help.d.ts +36 -0
  107. package/bin/help/command-help.js +56 -0
  108. package/bin/help/form.js +127 -22
  109. package/bin/help/main-help.d.ts +8 -0
  110. package/bin/help/main-help.js +126 -0
  111. package/bin/help/render.d.ts +32 -0
  112. package/bin/help/render.js +46 -0
  113. package/bin/info/cli.d.ts +1 -1
  114. package/bin/info/form.d.ts +1 -1
  115. package/bin/info/form.js +11 -11
  116. package/bin/migrate/analyzers/platform-detector.d.ts +14 -0
  117. package/bin/migrate/analyzers/platform-detector.js +116 -0
  118. package/bin/migrate/cli.d.ts +6 -0
  119. package/bin/migrate/cli.js +98 -0
  120. package/bin/migrate/form.d.ts +25 -0
  121. package/bin/migrate/form.js +348 -0
  122. package/bin/migrate/generators/compose-to-k8s.d.ts +2 -0
  123. package/bin/migrate/generators/compose-to-k8s.js +324 -0
  124. package/bin/migrate/generators/compose-to-railway.d.ts +2 -0
  125. package/bin/migrate/generators/compose-to-railway.js +138 -0
  126. package/bin/migrate/generators/compose-to-render.d.ts +2 -0
  127. package/bin/migrate/generators/compose-to-render.js +148 -0
  128. package/bin/migrate/generators/generic-migration.d.ts +9 -0
  129. package/bin/migrate/generators/generic-migration.js +221 -0
  130. package/bin/migrate/generators/heroku-to-fly.d.ts +2 -0
  131. package/bin/migrate/generators/heroku-to-fly.js +291 -0
  132. package/bin/migrate/generators/heroku-to-railway.d.ts +2 -0
  133. package/bin/migrate/generators/heroku-to-railway.js +283 -0
  134. package/bin/migrate/generators/heroku-to-render.d.ts +2 -0
  135. package/bin/migrate/generators/heroku-to-render.js +148 -0
  136. package/bin/migrate/generators/index.d.ts +7 -0
  137. package/bin/migrate/generators/index.js +17 -0
  138. package/bin/migrate/generators/template-loader.d.ts +21 -0
  139. package/bin/migrate/generators/template-loader.js +59 -0
  140. package/bin/migrate/index.d.ts +1 -0
  141. package/bin/migrate/index.js +5 -0
  142. package/bin/new/cli.d.ts +5 -1
  143. package/bin/new/cli.js +77 -14
  144. package/bin/new/form.d.ts +27 -4
  145. package/bin/new/form.js +605 -75
  146. package/bin/profile/analyzers/dockerfile-analyzer.d.ts +27 -0
  147. package/bin/profile/analyzers/dockerfile-analyzer.js +122 -0
  148. package/bin/profile/analyzers/image-analyzer.d.ts +19 -0
  149. package/bin/profile/analyzers/image-analyzer.js +85 -0
  150. package/bin/profile/cli.d.ts +4 -0
  151. package/bin/profile/cli.js +94 -0
  152. package/bin/profile/form.d.ts +56 -0
  153. package/bin/profile/form.js +401 -0
  154. package/bin/profile/index.d.ts +1 -0
  155. package/bin/profile/index.js +5 -0
  156. package/bin/profile/optimizers/index.d.ts +19 -0
  157. package/bin/profile/optimizers/index.js +137 -0
  158. package/bin/providers/add/form.d.ts +1 -1
  159. package/bin/providers/add/form.js +27 -6
  160. package/bin/providers/create/form.js +53 -3
  161. package/bin/scripts/form.js +27 -5
  162. package/bin/studio/cli.d.ts +15 -0
  163. package/bin/studio/cli.js +172 -0
  164. package/bin/studio/index.d.ts +5 -0
  165. package/bin/studio/index.js +9 -0
  166. package/bin/templates/cache.d.ts +54 -0
  167. package/bin/templates/cache.js +180 -0
  168. package/bin/templates/cli.d.ts +8 -0
  169. package/bin/templates/cli.js +294 -0
  170. package/bin/templates/fetcher.d.ts +49 -0
  171. package/bin/templates/fetcher.js +208 -0
  172. package/bin/templates/index.d.ts +11 -0
  173. package/bin/templates/index.js +37 -0
  174. package/bin/templates/manager.d.ts +116 -0
  175. package/bin/templates/manager.js +323 -0
  176. package/bin/templates/renderer.d.ts +49 -0
  177. package/bin/templates/renderer.js +204 -0
  178. package/bin/templates/types.d.ts +51 -0
  179. package/bin/templates/types.js +5 -0
  180. package/bin/utils/add-module-to-container.d.ts +14 -3
  181. package/bin/utils/add-module-to-container.js +327 -98
  182. package/bin/utils/cli-ui.d.ts +49 -3
  183. package/bin/utils/cli-ui.js +133 -13
  184. package/bin/utils/index.d.ts +4 -0
  185. package/bin/utils/index.js +4 -0
  186. package/bin/utils/input-validation.d.ts +50 -0
  187. package/bin/utils/input-validation.js +143 -0
  188. package/bin/utils/package-manager-commands.d.ts +24 -0
  189. package/bin/utils/package-manager-commands.js +50 -0
  190. package/bin/utils/safe-spawn.d.ts +35 -0
  191. package/bin/utils/safe-spawn.js +51 -0
  192. package/bin/utils/update-tsconfig-paths.d.ts +35 -0
  193. package/bin/utils/update-tsconfig-paths.js +326 -0
  194. package/package.json +165 -156
@@ -0,0 +1,303 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.COMMAND_HELP_SPECS = exports.tryPrintCommandHelp = exports.resolveCommandHelpSpec = void 0;
4
+ const command_help_1 = require("./command-help");
5
+ /**
6
+ * Structured help specs for the subcommands whose option-heavy `--help` would
7
+ * otherwise render as yargs' sprawling default table. Keeping them here lets
8
+ * the central interceptor in `cli.ts` render a refined, grouped screen that
9
+ * matches the rest of the CLI without touching each command's yargs builder.
10
+ *
11
+ * NOTE: these mirror the option definitions in each command's `cli.ts`. When
12
+ * an option/choice/default changes there, update the matching entry here.
13
+ */
14
+ const SPECS = [
15
+ {
16
+ name: "costs",
17
+ aliases: ["cost", "pricing"],
18
+ usage: "expressots costs <action> [options]",
19
+ description: "Estimate and compare cloud deployment costs.",
20
+ groups: [
21
+ {
22
+ title: "Actions",
23
+ entries: [
24
+ (0, command_help_1.helpEntry)("estimate", "Estimate cost for a provider/service"),
25
+ (0, command_help_1.helpEntry)("compare", "Compare costs across providers"),
26
+ (0, command_help_1.helpEntry)("optimize", "Suggest cost optimizations"),
27
+ (0, command_help_1.helpEntry)("pricing", "Show current pricing data"),
28
+ (0, command_help_1.helpEntry)("update", "Refresh pricing data from remote"),
29
+ (0, command_help_1.helpEntry)("info", "Show pricing system status & providers"),
30
+ ],
31
+ },
32
+ {
33
+ title: "Options",
34
+ entries: [
35
+ (0, command_help_1.helpEntry)("-p, --provider", "Cloud provider", "aws, gcp, azure, railway, render, fly, digitalocean, heroku"),
36
+ (0, command_help_1.helpEntry)("-s, --service", "Service type", "ecs, eks, lambda, cloudrun, gke, aci, aks, web-service"),
37
+ (0, command_help_1.helpEntry)("-i, --instances", "Instances / replicas", "default: 1"),
38
+ (0, command_help_1.helpEntry)("-c, --cpu", "vCPUs per instance", "default: 1"),
39
+ (0, command_help_1.helpEntry)("-m, --memory", "Memory (GB) per instance", "default: 1"),
40
+ (0, command_help_1.helpEntry)("--storage", "Storage in GB", "default: 10"),
41
+ (0, command_help_1.helpEntry)("--bandwidth", "Bandwidth GB/month", "default: 100"),
42
+ (0, command_help_1.helpEntry)("-r, --region", "Cloud region", "default: us-east-1"),
43
+ (0, command_help_1.helpEntry)("--hours", "Running hours/month", "default: 720"),
44
+ (0, command_help_1.helpEntry)("--format", "Output format", "text, json, markdown ยท default: text"),
45
+ (0, command_help_1.helpEntry)("-o, --output", "Write output to a file"),
46
+ ],
47
+ },
48
+ ],
49
+ },
50
+ {
51
+ name: "cicd",
52
+ aliases: ["ci", "pipeline"],
53
+ usage: "expressots cicd <action> [platform] [options]",
54
+ description: "Generate and manage CI/CD pipeline configurations.",
55
+ groups: [
56
+ {
57
+ title: "Actions",
58
+ entries: [
59
+ (0, command_help_1.helpEntry)("init", "Interactive pipeline setup"),
60
+ (0, command_help_1.helpEntry)("generate", "Generate pipeline configuration"),
61
+ (0, command_help_1.helpEntry)("list", "List supported platforms"),
62
+ (0, command_help_1.helpEntry)("validate", "Validate existing pipelines"),
63
+ ],
64
+ },
65
+ {
66
+ title: "Arguments",
67
+ entries: [
68
+ (0, command_help_1.helpEntry)("platform", "CI/CD platform", "github, gitlab, circleci, jenkins, bitbucket, azure, all"),
69
+ ],
70
+ },
71
+ {
72
+ title: "Options",
73
+ entries: [
74
+ (0, command_help_1.helpEntry)("-s, --strategy", "Pipeline strategy", "basic, comprehensive, security-focused ยท default: comprehensive"),
75
+ (0, command_help_1.helpEntry)("--include-security", "Security scanning (Trivy, Snyk)", "default: true"),
76
+ (0, command_help_1.helpEntry)("--include-e2e", "End-to-end tests", "default: false"),
77
+ (0, command_help_1.helpEntry)("--include-coverage", "Coverage reporting", "default: true"),
78
+ (0, command_help_1.helpEntry)("-r, --docker-registry", "Docker registry URL", "e.g. ghcr.io, docker.io"),
79
+ (0, command_help_1.helpEntry)("--deploy-target", "Deploy target", "kubernetes, ecs, cloudrun, railway, render, fly, none ยท default: none"),
80
+ (0, command_help_1.helpEntry)("-b, --branch", "Trigger branch", "default: main"),
81
+ (0, command_help_1.helpEntry)("--node-version", "Node.js version", "default: 20"),
82
+ (0, command_help_1.helpEntry)("-o, --output-dir", "Output directory"),
83
+ ],
84
+ },
85
+ ],
86
+ },
87
+ {
88
+ name: "migrate",
89
+ aliases: ["migration", "mig"],
90
+ usage: "expressots migrate <action> [options]",
91
+ description: "Generate migration scripts between cloud platforms.",
92
+ groups: [
93
+ {
94
+ title: "Actions",
95
+ entries: [
96
+ (0, command_help_1.helpEntry)("init", "Interactive migration setup"),
97
+ (0, command_help_1.helpEntry)("generate", "Generate migration scripts"),
98
+ (0, command_help_1.helpEntry)("list", "List supported platforms"),
99
+ (0, command_help_1.helpEntry)("analyze", "Analyze a migration path"),
100
+ ],
101
+ },
102
+ {
103
+ title: "Options",
104
+ entries: [
105
+ (0, command_help_1.helpEntry)("-f, --from", "Source platform", "heroku, docker-compose, vercel, aws-ecs, gcp-cloudrun, azure-container"),
106
+ (0, command_help_1.helpEntry)("-t, --to", "Target platform", "railway, render, fly, kubernetes, aws-ecs, gcp-cloudrun, azure-container"),
107
+ (0, command_help_1.helpEntry)("--include-data", "Include data migration", "default: false"),
108
+ (0, command_help_1.helpEntry)("--include-secrets", "Include secrets/env migration", "default: true"),
109
+ (0, command_help_1.helpEntry)("--dry-run", "Preview without writing files", "default: false"),
110
+ (0, command_help_1.helpEntry)("-o, --output-dir", "Output directory", "default: ./migration"),
111
+ ],
112
+ },
113
+ ],
114
+ },
115
+ {
116
+ name: "profile",
117
+ aliases: ["prof", "analyze"],
118
+ usage: "expressots profile <action> [target] [options]",
119
+ description: "Analyze and optimize container configurations.",
120
+ groups: [
121
+ {
122
+ title: "Actions",
123
+ entries: [
124
+ (0, command_help_1.helpEntry)("container", "Analyze a container configuration"),
125
+ (0, command_help_1.helpEntry)("image", "Analyze a Docker image"),
126
+ (0, command_help_1.helpEntry)("optimize", "Suggest Dockerfile optimizations"),
127
+ (0, command_help_1.helpEntry)("report", "Show the latest profile report"),
128
+ ],
129
+ },
130
+ {
131
+ title: "Arguments",
132
+ entries: [(0, command_help_1.helpEntry)("target", "Dockerfile path or image name")],
133
+ },
134
+ {
135
+ title: "Options",
136
+ entries: [
137
+ (0, command_help_1.helpEntry)("-f, --dockerfile", "Path to Dockerfile", "default: Dockerfile"),
138
+ (0, command_help_1.helpEntry)("--format", "Output format", "text, json, html ยท default: text"),
139
+ (0, command_help_1.helpEntry)("--severity", "Minimum severity", "low, medium, high, critical ยท default: low"),
140
+ (0, command_help_1.helpEntry)("--auto-fix", "Apply safe optimizations", "default: false"),
141
+ (0, command_help_1.helpEntry)("-o, --output", "Output file for report"),
142
+ (0, command_help_1.helpEntry)("--include-security", "Security vulnerability scan", "default: true"),
143
+ (0, command_help_1.helpEntry)("--include-size", "Size analysis", "default: true"),
144
+ ],
145
+ },
146
+ ],
147
+ },
148
+ {
149
+ name: "containerize",
150
+ aliases: ["ctr"],
151
+ usage: "expressots containerize [target] [environment] [options]",
152
+ description: "Generate container configurations for your ExpressoTS application.",
153
+ groups: [
154
+ {
155
+ title: "Arguments",
156
+ entries: [
157
+ (0, command_help_1.helpEntry)("target", "Target platform", "docker, kubernetes, k8s, compose ยท default: docker"),
158
+ (0, command_help_1.helpEntry)("environment", "Target environment", "development, staging, production, all ยท default: production"),
159
+ ],
160
+ },
161
+ {
162
+ title: "Options",
163
+ entries: [
164
+ (0, command_help_1.helpEntry)("--preset", "Container preset", "minimal, secure, fast-startup, dev, multi-arch, standard ยท default: standard"),
165
+ (0, command_help_1.helpEntry)("--analyze", "Analyze project before generating", "default: true"),
166
+ (0, command_help_1.helpEntry)("--skip-compose", "Skip docker-compose.yml", "default: false"),
167
+ (0, command_help_1.helpEntry)("--include-ci", "Include CI/CD pipeline", "default: false"),
168
+ (0, command_help_1.helpEntry)("--ci-platform", "CI/CD platform", "github, gitlab, circleci, jenkins, bitbucket, azure, all ยท default: github"),
169
+ (0, command_help_1.helpEntry)("--ci-strategy", "CI/CD strategy", "basic, comprehensive, security-focused ยท default: comprehensive"),
170
+ (0, command_help_1.helpEntry)("--include-security-scans", "Security scanning (Trivy, Snyk)", "default: true"),
171
+ (0, command_help_1.helpEntry)("--include-e2e", "End-to-end tests in CI", "default: false"),
172
+ ],
173
+ },
174
+ ],
175
+ },
176
+ {
177
+ name: "container-dev",
178
+ aliases: ["cdev", "docker-dev"],
179
+ usage: "expressots container-dev [action] [options]",
180
+ description: "Develop inside Docker containers with hot reload.",
181
+ groups: [
182
+ {
183
+ title: "Actions",
184
+ entries: [
185
+ (0, command_help_1.helpEntry)("start", "Start the dev container (default)"),
186
+ (0, command_help_1.helpEntry)("stop", "Stop the dev container"),
187
+ (0, command_help_1.helpEntry)("attach", "Attach to the running container"),
188
+ (0, command_help_1.helpEntry)("shell", "Open a shell in the container"),
189
+ (0, command_help_1.helpEntry)("status", "Show container status"),
190
+ (0, command_help_1.helpEntry)("logs", "Show container logs"),
191
+ ],
192
+ },
193
+ {
194
+ title: "Options",
195
+ entries: [
196
+ (0, command_help_1.helpEntry)("-c, --container", "Run dev inside Docker", "default: false"),
197
+ (0, command_help_1.helpEntry)("-s, --service", "Compose service name", "default: app"),
198
+ (0, command_help_1.helpEntry)("-f, --compose-file", "docker-compose file", "default: docker-compose.development.yml"),
199
+ (0, command_help_1.helpEntry)("-b, --build", "Rebuild before starting", "default: false"),
200
+ (0, command_help_1.helpEntry)("-d, --detach", "Run in background", "default: false"),
201
+ (0, command_help_1.helpEntry)("-p, --port", "Override application port"),
202
+ (0, command_help_1.helpEntry)("--debug-port", "Node inspector port", "default: 9229"),
203
+ (0, command_help_1.helpEntry)("-w, --watch", "File watching / hot reload", "default: true"),
204
+ (0, command_help_1.helpEntry)("--follow", "Follow logs (logs action)", "default: true"),
205
+ (0, command_help_1.helpEntry)("--tail", "Log lines to show", "default: 100"),
206
+ ],
207
+ },
208
+ ],
209
+ },
210
+ {
211
+ name: "templates",
212
+ aliases: ["tpl"],
213
+ usage: "expressots templates <action> [args...] [options]",
214
+ description: "Manage CLI templates for CI/CD, Docker, and Kubernetes.",
215
+ groups: [
216
+ {
217
+ title: "Actions",
218
+ entries: [
219
+ (0, command_help_1.helpEntry)("list", "List available templates"),
220
+ (0, command_help_1.helpEntry)("update", "Update template cache from remote"),
221
+ (0, command_help_1.helpEntry)("clear", "Clear local template cache"),
222
+ (0, command_help_1.helpEntry)("info", "Show template info (info <category> <platform>)"),
223
+ (0, command_help_1.helpEntry)("repo", "View / set / reset template repository"),
224
+ (0, command_help_1.helpEntry)("status", "Show template system status"),
225
+ ],
226
+ },
227
+ {
228
+ title: "Options",
229
+ entries: [
230
+ (0, command_help_1.helpEntry)("-c, --category", "Filter by category", "cicd, docker, kubernetes, migrations"),
231
+ (0, command_help_1.helpEntry)("-p, --platform", "Filter by platform", "github, gitlab, ..."),
232
+ ],
233
+ },
234
+ ],
235
+ notes: [
236
+ "Examples:",
237
+ " expressots templates list",
238
+ " expressots templates info cicd github",
239
+ " expressots templates repo set https://github.com/org/templates",
240
+ ],
241
+ },
242
+ {
243
+ name: "dev",
244
+ usage: "expressots dev [options]",
245
+ description: "Start the development server.",
246
+ groups: [
247
+ {
248
+ title: "Options",
249
+ entries: [
250
+ (0, command_help_1.helpEntry)("-c, --container", "Run dev inside Docker", "default: false"),
251
+ (0, command_help_1.helpEntry)("-b, --build", "Rebuild container before starting", "with --container"),
252
+ (0, command_help_1.helpEntry)("-d, --detach", "Run container in background", "with --container"),
253
+ ],
254
+ },
255
+ ],
256
+ },
257
+ ];
258
+ exports.COMMAND_HELP_SPECS = SPECS;
259
+ /**
260
+ * Index every spec by its canonical name and aliases for O(1) lookup.
261
+ */
262
+ const SPEC_INDEX = (() => {
263
+ const index = new Map();
264
+ for (const spec of SPECS) {
265
+ index.set(spec.name, spec);
266
+ for (const alias of spec.aliases ?? []) {
267
+ index.set(alias, spec);
268
+ }
269
+ }
270
+ return index;
271
+ })();
272
+ /**
273
+ * Resolve a command token (name or alias) to its help spec, if any.
274
+ */
275
+ function resolveCommandHelpSpec(token) {
276
+ return SPEC_INDEX.get(token);
277
+ }
278
+ exports.resolveCommandHelpSpec = resolveCommandHelpSpec;
279
+ /**
280
+ * Detect a `<command> --help` / `<command> -h` invocation and, if the command
281
+ * has a registered spec, render the refined help screen.
282
+ *
283
+ * @returns `true` when custom help was printed (caller should exit), else `false`.
284
+ */
285
+ function tryPrintCommandHelp(args, version) {
286
+ const command = args[0];
287
+ if (!command || command.startsWith("-")) {
288
+ return false;
289
+ }
290
+ const wantsHelp = args
291
+ .slice(1)
292
+ .some((arg) => arg === "--help" || arg === "-h");
293
+ if (!wantsHelp) {
294
+ return false;
295
+ }
296
+ const spec = resolveCommandHelpSpec(command);
297
+ if (!spec) {
298
+ return false;
299
+ }
300
+ (0, command_help_1.printCommandHelp)(spec, version);
301
+ return true;
302
+ }
303
+ exports.tryPrintCommandHelp = tryPrintCommandHelp;
@@ -0,0 +1,36 @@
1
+ import { type HelpEntry, type HelpGroup } from "./render";
2
+ /**
3
+ * A structured description of a single command's help surface. Rendered by
4
+ * {@link printCommandHelp} so every subcommand `--help` shares the exact visual
5
+ * language of the top-level help screen (see `main-help.ts`) and the command
6
+ * reference (`help/form.ts`), instead of yargs' sprawling default table.
7
+ */
8
+ export interface CommandHelpSpec {
9
+ /** Canonical command name, e.g. `costs`. */
10
+ name: string;
11
+ /** Command aliases, e.g. `["cost", "pricing"]`. */
12
+ aliases?: string[];
13
+ /** Usage line, e.g. `expressots costs <action> [options]`. */
14
+ usage: string;
15
+ /** One-line description (matches the yargs `describe`). */
16
+ description: string;
17
+ /** Titled groups of entries (Arguments, Actions, Options, ...). */
18
+ groups: HelpGroup[];
19
+ /** Optional trailing notes / examples (rendered dim). */
20
+ notes?: string[];
21
+ /** Optional docs URL. */
22
+ docs?: string;
23
+ }
24
+ /**
25
+ * Build an option/argument entry with an optional dim "hint" (choices,
26
+ * defaults, examples) appended to the description. Keeps the help compact while
27
+ * still surfacing the metadata yargs would otherwise sprawl across the line.
28
+ */
29
+ export declare function helpEntry(name: string, desc: string, hint?: string): HelpEntry;
30
+ /**
31
+ * Print a refined, grouped, column-aligned help screen for a single command.
32
+ *
33
+ * Each group is rendered with its own column width so short action names and
34
+ * long option flags both stay tightly aligned.
35
+ */
36
+ export declare function printCommandHelp(spec: CommandHelpSpec, version?: string): void;
@@ -0,0 +1,56 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.printCommandHelp = exports.helpEntry = void 0;
7
+ const chalk_1 = __importDefault(require("chalk"));
8
+ const process_1 = require("process");
9
+ const render_1 = require("./render");
10
+ const DEFAULT_DOCS = "https://doc.expresso-ts.com/docs/category/cli";
11
+ /**
12
+ * Build an option/argument entry with an optional dim "hint" (choices,
13
+ * defaults, examples) appended to the description. Keeps the help compact while
14
+ * still surfacing the metadata yargs would otherwise sprawl across the line.
15
+ */
16
+ function helpEntry(name, desc, hint) {
17
+ return { name, desc: hint ? `${desc} ${chalk_1.default.dim(`(${hint})`)}` : desc };
18
+ }
19
+ exports.helpEntry = helpEntry;
20
+ /**
21
+ * Print a refined, grouped, column-aligned help screen for a single command.
22
+ *
23
+ * Each group is rendered with its own column width so short action names and
24
+ * long option flags both stay tightly aligned.
25
+ */
26
+ function printCommandHelp(spec, version) {
27
+ const title = version
28
+ ? `๐ŸŽ ExpressoTS CLI v${version}`
29
+ : "๐ŸŽ ExpressoTS CLI";
30
+ const lines = [
31
+ "",
32
+ chalk_1.default.bold.green(title),
33
+ "",
34
+ `${chalk_1.default.bold("Usage:")} ${spec.usage}`,
35
+ "",
36
+ spec.description,
37
+ ];
38
+ if (spec.aliases && spec.aliases.length > 0) {
39
+ lines.push("", `${chalk_1.default.bold("Aliases:")} ${spec.aliases
40
+ .map((a) => chalk_1.default.green(a))
41
+ .join(", ")}`);
42
+ }
43
+ // Render each group independently so columns stay tight per-section.
44
+ for (const group of spec.groups) {
45
+ lines.push(...(0, render_1.renderHelpGroups)([group]));
46
+ }
47
+ if (spec.notes && spec.notes.length > 0) {
48
+ lines.push("");
49
+ for (const note of spec.notes) {
50
+ lines.push(chalk_1.default.dim(note));
51
+ }
52
+ }
53
+ lines.push("", chalk_1.default.dim("Global: -h, --help ยท -V, --version"), "", `๐Ÿ“ ${chalk_1.default.dim("Docs:")} ${chalk_1.default.green(spec.docs ?? DEFAULT_DOCS)}`, "");
54
+ process_1.stdout.write(`${lines.join("\n")}\n`);
55
+ }
56
+ exports.printCommandHelp = printCommandHelp;
package/bin/help/form.js CHANGED
@@ -5,28 +5,133 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.helpForm = void 0;
7
7
  const chalk_1 = __importDefault(require("chalk"));
8
- const cli_table3_1 = __importDefault(require("cli-table3"));
9
- const helpForm = async () => {
10
- const table = new cli_table3_1.default({
11
- head: [
12
- chalk_1.default.green("Name"),
13
- chalk_1.default.green("Alias"),
14
- chalk_1.default.green("Description"),
8
+ const process_1 = require("process");
9
+ const render_1 = require("./render");
10
+ /**
11
+ * The full command + schematics reference. Shares the exact visual
12
+ * language of the top-level help screen (see `main-help.ts`) via the
13
+ * common `renderHelpGroups` helper, but goes deeper: it enumerates every
14
+ * `generate` schematic and provider sub-command.
15
+ */
16
+ const RESOURCE_GROUPS = [
17
+ {
18
+ title: "Project",
19
+ entries: [
20
+ {
21
+ name: "new",
22
+ desc: "Generate a new project (application or micro)",
23
+ },
24
+ { name: "dev", desc: "Start the development server" },
25
+ { name: "build", desc: "Build the project for production" },
26
+ { name: "prod", desc: "Run in production mode" },
27
+ { name: "info", alias: "i", desc: "Display project information" },
28
+ { name: "scripts", desc: "Run scripts list or specific scripts" },
29
+ { name: "help", alias: "h", desc: "Show command help" },
30
+ ],
31
+ },
32
+ {
33
+ title: "Generate",
34
+ entries: [
35
+ {
36
+ name: "service",
37
+ alias: "g s",
38
+ desc: "Service [controller, usecase, dto, module]",
39
+ },
40
+ { name: "controller", alias: "g c", desc: "Controller" },
41
+ { name: "usecase", alias: "g u", desc: "Use case" },
42
+ { name: "dto", alias: "g d", desc: "DTO" },
43
+ { name: "entity", alias: "g e", desc: "Entity" },
44
+ { name: "module", alias: "g mo", desc: "Module" },
45
+ { name: "middleware", alias: "g mi", desc: "Middleware" },
46
+ {
47
+ name: "interceptor",
48
+ alias: "g i",
49
+ desc: "Interceptor (--priority)",
50
+ },
51
+ { name: "event", alias: "g ev", desc: "Type-safe event" },
52
+ {
53
+ name: "handler",
54
+ alias: "g h",
55
+ desc: "Event handler (--event, --priority)",
56
+ },
57
+ { name: "guard", alias: "g gu", desc: "Authorization guard" },
58
+ { name: "config", alias: "g cfg", desc: "Config module" },
59
+ ],
60
+ },
61
+ {
62
+ title: "Providers",
63
+ entries: [
64
+ {
65
+ name: "provider",
66
+ alias: "g p",
67
+ desc: "Generate internal provider",
68
+ },
69
+ {
70
+ name: "add",
71
+ desc: "Add provider to the project (-d for devDependency)",
72
+ },
73
+ { name: "remove", desc: "Remove provider from the project" },
74
+ { name: "create", desc: "Create external provider" },
15
75
  ],
16
- colWidths: [15, 15, 60],
17
- });
18
- table.push(["new project", "new", "Generate a new project"], ["info", "i", "Provides project information"], ["resources", "r", "Displays cli commands and resources"], ["scripts", "scripts", "Run scripts list or specific scripts"], ["help", "h", "Show command help"], [
19
- "service",
20
- "g s",
21
- "Generate a service [controller, usecase, dto, module]",
22
- ], ["controller", "g c", "Generate a controller"], ["usecase", "g u", "Generate a usecase"], ["dto", "g d", "Generate a dto"], ["entity", "g e", "Generate an entity"], ["provider", "g p", "Generate internal provider"], [
23
- "provider",
24
- "add",
25
- "Add provider to the project. Use -d to add as dev dependency",
26
- ], ["provider", "remove", "Remove provider from the project"], ["provider", "create", "Create external provider"], ["module", "g mo", "Generate a module"], ["middleware", "g mi", "Generate a middleware"]);
27
- console.log(chalk_1.default.bold.white("ExpressoTS:", `${chalk_1.default.green("Resources List")}`));
28
- console.log(chalk_1.default.whiteBright(table.toString()));
29
- console.log(chalk_1.default.bold.white(`๐Ÿ“ More info: ${chalk_1.default.green("https://doc.expresso-ts.com/docs/category/cli")}`));
30
- console.log("\n");
76
+ },
77
+ {
78
+ title: "DevOps",
79
+ entries: [
80
+ {
81
+ name: "containerize",
82
+ alias: "ctr",
83
+ desc: "Generate Docker / Kubernetes / Compose configs",
84
+ },
85
+ {
86
+ name: "cicd",
87
+ alias: "ci",
88
+ desc: "Generate and manage CI/CD pipelines",
89
+ },
90
+ {
91
+ name: "migrate",
92
+ alias: "mig",
93
+ desc: "Generate migration scripts between platforms",
94
+ },
95
+ {
96
+ name: "profile",
97
+ alias: "prof",
98
+ desc: "Analyze and optimize container configs",
99
+ },
100
+ {
101
+ name: "container-dev",
102
+ alias: "cdev",
103
+ desc: "Develop inside Docker with hot reload",
104
+ },
105
+ {
106
+ name: "costs",
107
+ alias: "cost",
108
+ desc: "Estimate and compare cloud deployment costs",
109
+ },
110
+ {
111
+ name: "templates",
112
+ alias: "tpl",
113
+ desc: "Manage CI/CD, Docker, and Kubernetes templates",
114
+ },
115
+ ],
116
+ },
117
+ {
118
+ title: "Studio & Help",
119
+ entries: [
120
+ { name: "studio", desc: "Launch ExpressoTS Studio" },
121
+ { name: "resources", alias: "r", desc: "Show this reference" },
122
+ { name: "completion", desc: "Generate a shell completion script" },
123
+ ],
124
+ },
125
+ ];
126
+ const helpForm = async () => {
127
+ const lines = [
128
+ "",
129
+ `${chalk_1.default.bold.green("๐ŸŽ ExpressoTS CLI")} ${chalk_1.default.dim("ยท Command Reference")}`,
130
+ ...(0, render_1.renderHelpGroups)(RESOURCE_GROUPS),
131
+ "",
132
+ `๐Ÿ“ ${chalk_1.default.dim("Docs:")} ${chalk_1.default.green("https://doc.expresso-ts.com/docs/category/cli")}`,
133
+ "",
134
+ ];
135
+ process_1.stdout.write(`${lines.join("\n")}\n`);
31
136
  };
32
137
  exports.helpForm = helpForm;
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Print a refined, grouped, column-aligned top-level help screen.
3
+ *
4
+ * Unlike the default yargs help, this drops the repeated `expressots`
5
+ * prefix on every line and renders aliases inline, keeping the whole
6
+ * reference compact while still listing every command.
7
+ */
8
+ export declare function printMainHelp(version?: string): void;