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

Method runInteractiveByType

src/commands/show.ts:74–102  ·  view source on GitHub ↗
(
    type: ItemType,
    options: ShowExecuteOptions,
    root: ResolvedOpenSpecRoot
  )

Source from the content-addressed store, hash-verified

72 }
73
74 private async runInteractiveByType(
75 type: ItemType,
76 options: ShowExecuteOptions,
77 root: ResolvedOpenSpecRoot
78 ): Promise<void> {
79 const { select } = await import('@inquirer/prompts');
80 if (type === 'change') {
81 const changes = await getActiveChangeIds(root.path);
82 if (changes.length === 0) {
83 console.error('No changes found.');
84 process.exitCode = 1;
85 return;
86 }
87 const picked = await select<string>({ message: 'Pick a change', choices: changes.map(id => ({ name: id, value: id })) });
88 const cmd = new ChangeCommand(root.path);
89 await cmd.show(picked, this.delegateOptions(root, options) as any);
90 return;
91 }
92
93 const specs = await getSpecIds(root.path);
94 if (specs.length === 0) {
95 console.error('No specs found.');
96 process.exitCode = 1;
97 return;
98 }
99 const picked = await select<string>({ message: 'Pick a spec', choices: specs.map(id => ({ name: id, value: id })) });
100 const cmd = new SpecCommand(root.path);
101 await cmd.show(picked, this.delegateOptions(root, options) as any);
102 }
103
104 private async showDirect(
105 itemName: string,

Callers 1

executeMethod · 0.95

Calls 4

showMethod · 0.95
delegateOptionsMethod · 0.95
getActiveChangeIdsFunction · 0.85
getSpecIdsFunction · 0.85

Tested by

no test coverage detected