pnpm-catalog-updates 0.5.7 → 0.6.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (224) hide show
  1. package/bin/pcu.js +1 -1
  2. package/dist/index.js +9559 -32
  3. package/dist/index.js.map +1 -1
  4. package/package.json +61 -103
  5. package/src/cli/commands/checkCommand.ts +227 -0
  6. package/src/cli/commands/initCommand.ts +394 -0
  7. package/src/cli/commands/securityCommand.ts +569 -0
  8. package/src/cli/commands/updateCommand.ts +245 -0
  9. package/src/cli/formatters/outputFormatter.ts +830 -0
  10. package/src/cli/formatters/progressBar.ts +700 -0
  11. package/src/cli/index.ts +565 -0
  12. package/src/cli/interactive/interactivePrompts.ts +517 -0
  13. package/src/cli/options/globalOptions.ts +380 -0
  14. package/src/cli/options/index.ts +5 -0
  15. package/src/cli/themes/colorTheme.ts +379 -0
  16. package/src/cli/validators/commandValidator.ts +395 -0
  17. package/src/cli/validators/index.ts +5 -0
  18. package/src/index.ts +4 -0
  19. package/LICENSE +0 -21
  20. package/README.ja.md +0 -587
  21. package/README.md +0 -694
  22. package/README.zh-CN.md +0 -634
  23. package/dist/application/services/CatalogUpdateService.d.ts +0 -209
  24. package/dist/application/services/CatalogUpdateService.d.ts.map +0 -1
  25. package/dist/application/services/CatalogUpdateService.js +0 -839
  26. package/dist/application/services/CatalogUpdateService.js.map +0 -1
  27. package/dist/application/services/WorkspaceService.d.ts +0 -139
  28. package/dist/application/services/WorkspaceService.d.ts.map +0 -1
  29. package/dist/application/services/WorkspaceService.js +0 -340
  30. package/dist/application/services/WorkspaceService.js.map +0 -1
  31. package/dist/cli/commands/CheckCommand.d.ts +0 -40
  32. package/dist/cli/commands/CheckCommand.d.ts.map +0 -1
  33. package/dist/cli/commands/CheckCommand.js +0 -177
  34. package/dist/cli/commands/CheckCommand.js.map +0 -1
  35. package/dist/cli/commands/InitCommand.d.ts +0 -53
  36. package/dist/cli/commands/InitCommand.d.ts.map +0 -1
  37. package/dist/cli/commands/InitCommand.js +0 -338
  38. package/dist/cli/commands/InitCommand.js.map +0 -1
  39. package/dist/cli/commands/SecurityCommand.d.ts +0 -113
  40. package/dist/cli/commands/SecurityCommand.d.ts.map +0 -1
  41. package/dist/cli/commands/SecurityCommand.js +0 -410
  42. package/dist/cli/commands/SecurityCommand.js.map +0 -1
  43. package/dist/cli/commands/UpdateCommand.d.ts +0 -44
  44. package/dist/cli/commands/UpdateCommand.d.ts.map +0 -1
  45. package/dist/cli/commands/UpdateCommand.js +0 -189
  46. package/dist/cli/commands/UpdateCommand.js.map +0 -1
  47. package/dist/cli/formatters/OutputFormatter.d.ts +0 -116
  48. package/dist/cli/formatters/OutputFormatter.d.ts.map +0 -1
  49. package/dist/cli/formatters/OutputFormatter.js +0 -664
  50. package/dist/cli/formatters/OutputFormatter.js.map +0 -1
  51. package/dist/cli/formatters/ProgressBar.d.ts +0 -195
  52. package/dist/cli/formatters/ProgressBar.d.ts.map +0 -1
  53. package/dist/cli/formatters/ProgressBar.js +0 -622
  54. package/dist/cli/formatters/ProgressBar.js.map +0 -1
  55. package/dist/cli/index.d.ts +0 -12
  56. package/dist/cli/index.d.ts.map +0 -1
  57. package/dist/cli/index.js +0 -492
  58. package/dist/cli/index.js.map +0 -1
  59. package/dist/cli/interactive/InteractivePrompts.d.ts +0 -85
  60. package/dist/cli/interactive/InteractivePrompts.d.ts.map +0 -1
  61. package/dist/cli/interactive/InteractivePrompts.js +0 -434
  62. package/dist/cli/interactive/InteractivePrompts.js.map +0 -1
  63. package/dist/cli/options/GlobalOptions.d.ts +0 -117
  64. package/dist/cli/options/GlobalOptions.d.ts.map +0 -1
  65. package/dist/cli/options/GlobalOptions.js +0 -278
  66. package/dist/cli/options/GlobalOptions.js.map +0 -1
  67. package/dist/cli/options/index.d.ts +0 -5
  68. package/dist/cli/options/index.d.ts.map +0 -1
  69. package/dist/cli/options/index.js +0 -5
  70. package/dist/cli/options/index.js.map +0 -1
  71. package/dist/cli/themes/ColorTheme.d.ts +0 -211
  72. package/dist/cli/themes/ColorTheme.d.ts.map +0 -1
  73. package/dist/cli/themes/ColorTheme.js +0 -267
  74. package/dist/cli/themes/ColorTheme.js.map +0 -1
  75. package/dist/cli/validators/CommandValidator.d.ts +0 -60
  76. package/dist/cli/validators/CommandValidator.d.ts.map +0 -1
  77. package/dist/cli/validators/CommandValidator.js +0 -319
  78. package/dist/cli/validators/CommandValidator.js.map +0 -1
  79. package/dist/cli/validators/index.d.ts +0 -5
  80. package/dist/cli/validators/index.d.ts.map +0 -1
  81. package/dist/cli/validators/index.js +0 -5
  82. package/dist/cli/validators/index.js.map +0 -1
  83. package/dist/common/config/Config.d.ts +0 -142
  84. package/dist/common/config/Config.d.ts.map +0 -1
  85. package/dist/common/config/Config.js +0 -382
  86. package/dist/common/config/Config.js.map +0 -1
  87. package/dist/common/config/ConfigLoader.d.ts +0 -49
  88. package/dist/common/config/ConfigLoader.d.ts.map +0 -1
  89. package/dist/common/config/ConfigLoader.js +0 -180
  90. package/dist/common/config/ConfigLoader.js.map +0 -1
  91. package/dist/common/config/PackageFilterConfig.d.ts +0 -56
  92. package/dist/common/config/PackageFilterConfig.d.ts.map +0 -1
  93. package/dist/common/config/PackageFilterConfig.js +0 -94
  94. package/dist/common/config/PackageFilterConfig.js.map +0 -1
  95. package/dist/common/config/index.d.ts +0 -8
  96. package/dist/common/config/index.d.ts.map +0 -1
  97. package/dist/common/config/index.js +0 -8
  98. package/dist/common/config/index.js.map +0 -1
  99. package/dist/common/error-handling/ErrorTracker.d.ts +0 -48
  100. package/dist/common/error-handling/ErrorTracker.d.ts.map +0 -1
  101. package/dist/common/error-handling/ErrorTracker.js +0 -93
  102. package/dist/common/error-handling/ErrorTracker.js.map +0 -1
  103. package/dist/common/error-handling/UserFriendlyErrorHandler.d.ts +0 -74
  104. package/dist/common/error-handling/UserFriendlyErrorHandler.d.ts.map +0 -1
  105. package/dist/common/error-handling/UserFriendlyErrorHandler.js +0 -703
  106. package/dist/common/error-handling/UserFriendlyErrorHandler.js.map +0 -1
  107. package/dist/common/error-handling/index.d.ts +0 -11
  108. package/dist/common/error-handling/index.d.ts.map +0 -1
  109. package/dist/common/error-handling/index.js +0 -9
  110. package/dist/common/error-handling/index.js.map +0 -1
  111. package/dist/common/logger/Logger.d.ts +0 -110
  112. package/dist/common/logger/Logger.d.ts.map +0 -1
  113. package/dist/common/logger/Logger.js +0 -289
  114. package/dist/common/logger/Logger.js.map +0 -1
  115. package/dist/common/logger/index.d.ts +0 -6
  116. package/dist/common/logger/index.d.ts.map +0 -1
  117. package/dist/common/logger/index.js +0 -6
  118. package/dist/common/logger/index.js.map +0 -1
  119. package/dist/common/types/cli.d.ts +0 -265
  120. package/dist/common/types/cli.d.ts.map +0 -1
  121. package/dist/common/types/cli.js +0 -5
  122. package/dist/common/types/cli.js.map +0 -1
  123. package/dist/common/types/core.d.ts +0 -270
  124. package/dist/common/types/core.d.ts.map +0 -1
  125. package/dist/common/types/core.js +0 -32
  126. package/dist/common/types/core.js.map +0 -1
  127. package/dist/common/types/index.d.ts +0 -8
  128. package/dist/common/types/index.d.ts.map +0 -1
  129. package/dist/common/types/index.js +0 -8
  130. package/dist/common/types/index.js.map +0 -1
  131. package/dist/common/utils/VersionChecker.d.ts +0 -54
  132. package/dist/common/utils/VersionChecker.d.ts.map +0 -1
  133. package/dist/common/utils/VersionChecker.js +0 -180
  134. package/dist/common/utils/VersionChecker.js.map +0 -1
  135. package/dist/common/utils/async.d.ts +0 -74
  136. package/dist/common/utils/async.d.ts.map +0 -1
  137. package/dist/common/utils/async.js +0 -228
  138. package/dist/common/utils/async.js.map +0 -1
  139. package/dist/common/utils/format.d.ts +0 -32
  140. package/dist/common/utils/format.d.ts.map +0 -1
  141. package/dist/common/utils/format.js +0 -121
  142. package/dist/common/utils/format.js.map +0 -1
  143. package/dist/common/utils/git.d.ts +0 -44
  144. package/dist/common/utils/git.d.ts.map +0 -1
  145. package/dist/common/utils/git.js +0 -147
  146. package/dist/common/utils/git.js.map +0 -1
  147. package/dist/common/utils/index.d.ts +0 -12
  148. package/dist/common/utils/index.d.ts.map +0 -1
  149. package/dist/common/utils/index.js +0 -12
  150. package/dist/common/utils/index.js.map +0 -1
  151. package/dist/common/utils/string.d.ts +0 -56
  152. package/dist/common/utils/string.d.ts.map +0 -1
  153. package/dist/common/utils/string.js +0 -134
  154. package/dist/common/utils/string.js.map +0 -1
  155. package/dist/common/utils/validation.d.ts +0 -88
  156. package/dist/common/utils/validation.d.ts.map +0 -1
  157. package/dist/common/utils/validation.js +0 -308
  158. package/dist/common/utils/validation.js.map +0 -1
  159. package/dist/domain/entities/Catalog.d.ts +0 -117
  160. package/dist/domain/entities/Catalog.d.ts.map +0 -1
  161. package/dist/domain/entities/Catalog.js +0 -240
  162. package/dist/domain/entities/Catalog.js.map +0 -1
  163. package/dist/domain/entities/Package.d.ts +0 -143
  164. package/dist/domain/entities/Package.d.ts.map +0 -1
  165. package/dist/domain/entities/Package.js +0 -272
  166. package/dist/domain/entities/Package.js.map +0 -1
  167. package/dist/domain/entities/Workspace.d.ts +0 -95
  168. package/dist/domain/entities/Workspace.d.ts.map +0 -1
  169. package/dist/domain/entities/Workspace.js +0 -173
  170. package/dist/domain/entities/Workspace.js.map +0 -1
  171. package/dist/domain/repositories/WorkspaceRepository.d.ts +0 -41
  172. package/dist/domain/repositories/WorkspaceRepository.d.ts.map +0 -1
  173. package/dist/domain/repositories/WorkspaceRepository.js +0 -8
  174. package/dist/domain/repositories/WorkspaceRepository.js.map +0 -1
  175. package/dist/domain/value-objects/CatalogCollection.d.ts +0 -106
  176. package/dist/domain/value-objects/CatalogCollection.d.ts.map +0 -1
  177. package/dist/domain/value-objects/CatalogCollection.js +0 -230
  178. package/dist/domain/value-objects/CatalogCollection.js.map +0 -1
  179. package/dist/domain/value-objects/PackageCollection.d.ts +0 -122
  180. package/dist/domain/value-objects/PackageCollection.d.ts.map +0 -1
  181. package/dist/domain/value-objects/PackageCollection.js +0 -263
  182. package/dist/domain/value-objects/PackageCollection.js.map +0 -1
  183. package/dist/domain/value-objects/Version.d.ts +0 -141
  184. package/dist/domain/value-objects/Version.d.ts.map +0 -1
  185. package/dist/domain/value-objects/Version.js +0 -268
  186. package/dist/domain/value-objects/Version.js.map +0 -1
  187. package/dist/domain/value-objects/WorkspaceConfig.d.ts +0 -144
  188. package/dist/domain/value-objects/WorkspaceConfig.d.ts.map +0 -1
  189. package/dist/domain/value-objects/WorkspaceConfig.js +0 -357
  190. package/dist/domain/value-objects/WorkspaceConfig.js.map +0 -1
  191. package/dist/domain/value-objects/WorkspaceId.d.ts +0 -51
  192. package/dist/domain/value-objects/WorkspaceId.d.ts.map +0 -1
  193. package/dist/domain/value-objects/WorkspaceId.js +0 -104
  194. package/dist/domain/value-objects/WorkspaceId.js.map +0 -1
  195. package/dist/domain/value-objects/WorkspacePath.d.ts +0 -75
  196. package/dist/domain/value-objects/WorkspacePath.d.ts.map +0 -1
  197. package/dist/domain/value-objects/WorkspacePath.js +0 -128
  198. package/dist/domain/value-objects/WorkspacePath.js.map +0 -1
  199. package/dist/index.d.ts +0 -25
  200. package/dist/index.d.ts.map +0 -1
  201. package/dist/infrastructure/cache/Cache.d.ts +0 -161
  202. package/dist/infrastructure/cache/Cache.d.ts.map +0 -1
  203. package/dist/infrastructure/cache/Cache.js +0 -398
  204. package/dist/infrastructure/cache/Cache.js.map +0 -1
  205. package/dist/infrastructure/cache/index.d.ts +0 -6
  206. package/dist/infrastructure/cache/index.d.ts.map +0 -1
  207. package/dist/infrastructure/cache/index.js +0 -6
  208. package/dist/infrastructure/cache/index.js.map +0 -1
  209. package/dist/infrastructure/external-services/NpmRegistryService.d.ts +0 -153
  210. package/dist/infrastructure/external-services/NpmRegistryService.d.ts.map +0 -1
  211. package/dist/infrastructure/external-services/NpmRegistryService.js +0 -511
  212. package/dist/infrastructure/external-services/NpmRegistryService.js.map +0 -1
  213. package/dist/infrastructure/file-system/FileSystemService.d.ts +0 -120
  214. package/dist/infrastructure/file-system/FileSystemService.d.ts.map +0 -1
  215. package/dist/infrastructure/file-system/FileSystemService.js +0 -663
  216. package/dist/infrastructure/file-system/FileSystemService.js.map +0 -1
  217. package/dist/infrastructure/repositories/FileWorkspaceRepository.d.ts +0 -57
  218. package/dist/infrastructure/repositories/FileWorkspaceRepository.d.ts.map +0 -1
  219. package/dist/infrastructure/repositories/FileWorkspaceRepository.js +0 -179
  220. package/dist/infrastructure/repositories/FileWorkspaceRepository.js.map +0 -1
  221. package/dist/infrastructure/utils/NpmrcParser.d.ts +0 -40
  222. package/dist/infrastructure/utils/NpmrcParser.d.ts.map +0 -1
  223. package/dist/infrastructure/utils/NpmrcParser.js +0 -157
  224. package/dist/infrastructure/utils/NpmrcParser.js.map +0 -1
@@ -0,0 +1,380 @@
1
+ /**
2
+ * Global CLI Options
3
+ *
4
+ * Defines standardized option definitions for all CLI commands.
5
+ * Provides consistent option parsing and validation.
6
+ */
7
+
8
+ import { Option } from 'commander';
9
+
10
+ export interface GlobalCliOptions {
11
+ workspace?: string;
12
+ verbose?: boolean;
13
+ color?: boolean;
14
+ registry?: string;
15
+ timeout?: number;
16
+ config?: string;
17
+ }
18
+
19
+ export interface CheckCliOptions extends GlobalCliOptions {
20
+ catalog?: string;
21
+ format?: 'table' | 'json' | 'yaml' | 'minimal';
22
+ target?: 'latest' | 'greatest' | 'minor' | 'patch' | 'newest';
23
+ prerelease?: boolean;
24
+ include?: string[];
25
+ exclude?: string[];
26
+ }
27
+
28
+ export interface UpdateCliOptions extends CheckCliOptions {
29
+ interactive?: boolean;
30
+ dryRun?: boolean;
31
+ force?: boolean;
32
+ createBackup?: boolean;
33
+ }
34
+
35
+ export interface AnalyzeCliOptions extends GlobalCliOptions {
36
+ format?: 'table' | 'json' | 'yaml' | 'minimal';
37
+ }
38
+
39
+ export interface WorkspaceCliOptions extends GlobalCliOptions {
40
+ validate?: boolean;
41
+ stats?: boolean;
42
+ info?: boolean;
43
+ format?: 'table' | 'json' | 'yaml' | 'minimal';
44
+ }
45
+
46
+ /**
47
+ * Global options available to all commands
48
+ */
49
+ export const globalOptions = [
50
+ new Option('-w, --workspace <path>', 'workspace directory path').env('PCU_WORKSPACE'),
51
+
52
+ new Option('-v, --verbose', 'enable verbose logging').env('PCU_VERBOSE'),
53
+
54
+ new Option('--no-color', 'disable colored output').env('PCU_NO_COLOR'),
55
+
56
+ new Option('--registry <url>', 'NPM registry URL').env('PCU_REGISTRY'),
57
+
58
+ new Option('--timeout <ms>', 'request timeout in milliseconds')
59
+ .argParser(parseInt)
60
+ .env('PCU_TIMEOUT'),
61
+
62
+ new Option('--config <path>', 'path to configuration file').env('PCU_CONFIG'),
63
+ ];
64
+
65
+ /**
66
+ * Check command specific options
67
+ */
68
+ export const checkOptions = [
69
+ ...globalOptions,
70
+
71
+ new Option('--catalog <name>', 'check specific catalog only').env('PCU_CATALOG'),
72
+
73
+ new Option('-f, --format <type>', 'output format')
74
+ .choices(['table', 'json', 'yaml', 'minimal'])
75
+ .default('table')
76
+ .env('PCU_OUTPUT_FORMAT'),
77
+
78
+ new Option('-t, --target <type>', 'update target')
79
+ .choices(['latest', 'greatest', 'minor', 'patch', 'newest'])
80
+ .default('latest')
81
+ .env('PCU_UPDATE_TARGET'),
82
+
83
+ new Option('--prerelease', 'include prerelease versions').env('PCU_PRERELEASE'),
84
+
85
+ new Option('--include <pattern...>', 'include packages matching pattern').env('PCU_INCLUDE'),
86
+
87
+ new Option('--exclude <pattern...>', 'exclude packages matching pattern').env('PCU_EXCLUDE'),
88
+ ];
89
+
90
+ /**
91
+ * Update command specific options
92
+ */
93
+ export const updateOptions = [
94
+ ...checkOptions,
95
+
96
+ new Option('-i, --interactive', 'interactive mode to choose updates').env('PCU_INTERACTIVE'),
97
+
98
+ new Option('-d, --dry-run', 'preview changes without writing files').env('PCU_DRY_RUN'),
99
+
100
+ new Option('--force', 'force updates even if risky').env('PCU_FORCE'),
101
+
102
+ new Option('--create-backup', 'create backup files before updating').env('PCU_CREATE_BACKUP'),
103
+ ];
104
+
105
+ /**
106
+ * Analyze command specific options
107
+ */
108
+ export const analyzeOptions = [
109
+ ...globalOptions,
110
+
111
+ new Option('-f, --format <type>', 'output format')
112
+ .choices(['table', 'json', 'yaml', 'minimal'])
113
+ .default('table')
114
+ .env('PCU_OUTPUT_FORMAT'),
115
+ ];
116
+
117
+ /**
118
+ * Workspace command specific options
119
+ */
120
+ export const workspaceOptions = [
121
+ ...globalOptions,
122
+
123
+ new Option('--validate', 'validate workspace configuration'),
124
+
125
+ new Option('--stats', 'show workspace statistics'),
126
+
127
+ new Option('--info', 'show workspace information'),
128
+
129
+ new Option('-f, --format <type>', 'output format')
130
+ .choices(['table', 'json', 'yaml', 'minimal'])
131
+ .default('table')
132
+ .env('PCU_OUTPUT_FORMAT'),
133
+ ];
134
+
135
+ /**
136
+ * Option groups for better help organization
137
+ */
138
+ export const optionGroups = {
139
+ global: {
140
+ title: 'Global Options',
141
+ options: globalOptions,
142
+ },
143
+ output: {
144
+ title: 'Output Options',
145
+ options: [
146
+ new Option('-f, --format <type>', 'output format')
147
+ .choices(['table', 'json', 'yaml', 'minimal'])
148
+ .default('table'),
149
+ new Option('--no-color', 'disable colored output'),
150
+ new Option('-v, --verbose', 'enable verbose logging'),
151
+ ],
152
+ },
153
+ filtering: {
154
+ title: 'Filtering Options',
155
+ options: [
156
+ new Option('--catalog <name>', 'check specific catalog only'),
157
+ new Option('--include <pattern...>', 'include packages matching pattern'),
158
+ new Option('--exclude <pattern...>', 'exclude packages matching pattern'),
159
+ ],
160
+ },
161
+ update: {
162
+ title: 'Update Options',
163
+ options: [
164
+ new Option('-t, --target <type>', 'update target')
165
+ .choices(['latest', 'greatest', 'minor', 'patch', 'newest'])
166
+ .default('latest'),
167
+ new Option('--prerelease', 'include prerelease versions'),
168
+ new Option('-i, --interactive', 'interactive mode'),
169
+ new Option('-d, --dry-run', 'preview changes only'),
170
+ new Option('--force', 'force updates'),
171
+ new Option('--create-backup', 'create backup files'),
172
+ ],
173
+ },
174
+ registry: {
175
+ title: 'Registry Options',
176
+ options: [
177
+ new Option('--registry <url>', 'NPM registry URL'),
178
+ new Option('--timeout <ms>', 'request timeout').argParser(parseInt),
179
+ ],
180
+ },
181
+ };
182
+
183
+ /**
184
+ * Utility functions for option handling
185
+ */
186
+ export class OptionUtils {
187
+ /**
188
+ * Parse and validate global options
189
+ */
190
+ static parseGlobalOptions(options: any): GlobalCliOptions {
191
+ const parsed: GlobalCliOptions = {};
192
+
193
+ if (options.workspace) {
194
+ parsed.workspace = String(options.workspace).trim();
195
+ }
196
+
197
+ if (options.verbose !== undefined) {
198
+ parsed.verbose = Boolean(options.verbose);
199
+ }
200
+
201
+ if (options.color !== undefined) {
202
+ parsed.color = Boolean(options.color);
203
+ }
204
+
205
+ if (options.registry) {
206
+ parsed.registry = String(options.registry).trim();
207
+ }
208
+
209
+ if (options.timeout) {
210
+ const timeout = parseInt(String(options.timeout), 10);
211
+ if (!isNaN(timeout) && timeout > 0) {
212
+ parsed.timeout = timeout;
213
+ }
214
+ }
215
+
216
+ if (options.config) {
217
+ parsed.config = String(options.config).trim();
218
+ }
219
+
220
+ return parsed;
221
+ }
222
+
223
+ /**
224
+ * Parse check command options
225
+ */
226
+ static parseCheckOptions(options: any): CheckCliOptions {
227
+ const global = this.parseGlobalOptions(options);
228
+ const check: CheckCliOptions = { ...global };
229
+
230
+ if (options.catalog) {
231
+ check.catalog = String(options.catalog).trim();
232
+ }
233
+
234
+ if (options.format && typeof options.format === 'string') {
235
+ check.format = options.format as Exclude<CheckCliOptions['format'], undefined>;
236
+ }
237
+
238
+ if (options.target && typeof options.target === 'string') {
239
+ check.target = options.target as Exclude<CheckCliOptions['target'], undefined>;
240
+ }
241
+
242
+ if (options.prerelease !== undefined) {
243
+ check.prerelease = Boolean(options.prerelease);
244
+ }
245
+
246
+ if (options.include) {
247
+ check.include = Array.isArray(options.include)
248
+ ? options.include.map((p: any) => String(p).trim()).filter(Boolean)
249
+ : [String(options.include).trim()].filter(Boolean);
250
+ }
251
+
252
+ if (options.exclude) {
253
+ check.exclude = Array.isArray(options.exclude)
254
+ ? options.exclude.map((p: any) => String(p).trim()).filter(Boolean)
255
+ : [String(options.exclude).trim()].filter(Boolean);
256
+ }
257
+
258
+ return check;
259
+ }
260
+
261
+ /**
262
+ * Parse update command options
263
+ */
264
+ static parseUpdateOptions(options: any): UpdateCliOptions {
265
+ const check = this.parseCheckOptions(options);
266
+ const update: UpdateCliOptions = { ...check };
267
+
268
+ if (options.interactive !== undefined) {
269
+ update.interactive = Boolean(options.interactive);
270
+ }
271
+
272
+ if (options.dryRun !== undefined) {
273
+ update.dryRun = Boolean(options.dryRun);
274
+ }
275
+
276
+ if (options.force !== undefined) {
277
+ update.force = Boolean(options.force);
278
+ }
279
+
280
+ if (options.createBackup !== undefined) {
281
+ update.createBackup = Boolean(options.createBackup);
282
+ }
283
+
284
+ return update;
285
+ }
286
+
287
+ /**
288
+ * Parse analyze command options
289
+ */
290
+ static parseAnalyzeOptions(options: any): AnalyzeCliOptions {
291
+ const global = this.parseGlobalOptions(options);
292
+ const analyze: AnalyzeCliOptions = { ...global };
293
+
294
+ if (options.format && typeof options.format === 'string') {
295
+ analyze.format = options.format as Exclude<AnalyzeCliOptions['format'], undefined>;
296
+ }
297
+
298
+ return analyze;
299
+ }
300
+
301
+ /**
302
+ * Parse workspace command options
303
+ */
304
+ static parseWorkspaceOptions(options: any): WorkspaceCliOptions {
305
+ const global = this.parseGlobalOptions(options);
306
+ const workspace: WorkspaceCliOptions = { ...global };
307
+
308
+ if (options.validate !== undefined) {
309
+ workspace.validate = Boolean(options.validate);
310
+ }
311
+
312
+ if (options.stats !== undefined) {
313
+ workspace.stats = Boolean(options.stats);
314
+ }
315
+
316
+ if (options.info !== undefined) {
317
+ workspace.info = Boolean(options.info);
318
+ }
319
+
320
+ if (options.format && typeof options.format === 'string') {
321
+ workspace.format = options.format as Exclude<WorkspaceCliOptions['format'], undefined>;
322
+ }
323
+
324
+ return workspace;
325
+ }
326
+
327
+ /**
328
+ * Generate help text for option group
329
+ */
330
+ static generateHelpText(groupName: keyof typeof optionGroups): string {
331
+ const group = optionGroups[groupName];
332
+ if (!group) return '';
333
+
334
+ const lines = [`${group.title}:`];
335
+
336
+ for (const option of group.options) {
337
+ const flags = option.flags;
338
+ const description = option.description || '';
339
+ const choices = option.argChoices ? ` (choices: ${option.argChoices.join(', ')})` : '';
340
+ const defaultValue = option.defaultValue ? ` (default: ${option.defaultValue})` : '';
341
+
342
+ lines.push(` ${flags.padEnd(30)} ${description}${choices}${defaultValue}`);
343
+ }
344
+
345
+ return lines.join('\n');
346
+ }
347
+
348
+ /**
349
+ * Validate option combinations
350
+ */
351
+ static validateOptionCombinations(command: string, options: any): string[] {
352
+ const errors: string[] = [];
353
+
354
+ switch (command) {
355
+ case 'update':
356
+ if (options.interactive && options.dryRun) {
357
+ errors.push('Cannot use --interactive with --dry-run');
358
+ }
359
+ break;
360
+
361
+ case 'workspace':
362
+ const actionCount = [options.validate, options.stats, options.info].filter(Boolean).length;
363
+ if (actionCount > 1) {
364
+ errors.push('Cannot use multiple workspace actions simultaneously');
365
+ }
366
+ if (actionCount === 0) {
367
+ // Default to info
368
+ options.info = true;
369
+ }
370
+ break;
371
+ }
372
+
373
+ // Global validations
374
+ if (options.verbose && options.silent) {
375
+ errors.push('Cannot use both --verbose and --silent');
376
+ }
377
+
378
+ return errors;
379
+ }
380
+ }
@@ -0,0 +1,5 @@
1
+ /**
2
+ * CLI Options Entry Point
3
+ */
4
+
5
+ export * from './globalOptions.js';