MCPcopy
hub / github.com/Fission-AI/OpenSpec / execute

Method execute

src/commands/validate.ts:40–71  ·  view source on GitHub ↗
(itemName: string | undefined, options: ExecuteOptions = {})

Source from the content-addressed store, hash-verified

38
39export 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;

Callers

nothing calls this directly

Calls 8

runBulkValidationMethod · 0.95
normalizeTypeMethod · 0.95
validateDirectItemMethod · 0.95
resolveRootForCommandFunction · 0.85
isInteractiveFunction · 0.85
resolveNoInteractiveFunction · 0.85

Tested by

no test coverage detected