(itemName: string | undefined, options: ExecuteOptions = {})
| 38 | |
| 39 | export class ValidateCommand { |
| 40 | async execute(itemName: string | undefined, options: ExecuteOptions = {}): Promise<void> { |
| 41 | const root = await resolveRootForCommand(options, { json: options.json }); |
| 42 | if (!root) { |
| 43 | return; |
| 44 | } |
| 45 | |
| 46 | const interactive = isInteractive(options); |
| 47 | |
| 48 | // Handle bulk flags first |
| 49 | if (options.all || options.changes || options.specs) { |
| 50 | await this.runBulkValidation(root, { |
| 51 | changes: !!options.all || !!options.changes, |
| 52 | specs: !!options.all || !!options.specs, |
| 53 | }, { strict: !!options.strict, json: !!options.json, concurrency: options.concurrency, noInteractive: resolveNoInteractive(options) }); |
| 54 | return; |
| 55 | } |
| 56 | |
| 57 | // No item and no flags |
| 58 | if (!itemName) { |
| 59 | if (interactive) { |
| 60 | await this.runInteractiveSelector(root, { strict: !!options.strict, json: !!options.json, concurrency: options.concurrency }); |
| 61 | return; |
| 62 | } |
| 63 | this.printNonInteractiveHint(root); |
| 64 | process.exitCode = 1; |
| 65 | return; |
| 66 | } |
| 67 | |
| 68 | // Direct item validation with type detection or override |
| 69 | const typeOverride = this.normalizeType(options.type); |
| 70 | await this.validateDirectItem(root, itemName, { typeOverride, strict: !!options.strict, json: !!options.json }); |
| 71 | } |
| 72 | |
| 73 | private normalizeType(value?: string): ItemType | undefined { |
| 74 | if (!value) return undefined; |
nothing calls this directly
no test coverage detected