()
| 262 | } |
| 263 | |
| 264 | export async function promptPrompts() { |
| 265 | const addPrompts = await confirm({ |
| 266 | message: |
| 267 | "Does your MCP Server provide prompts you want to advertise (optional)?", |
| 268 | default: false, |
| 269 | }); |
| 270 | |
| 271 | const prompts: Array<{ |
| 272 | name: string; |
| 273 | description?: string; |
| 274 | arguments?: string[]; |
| 275 | text: string; |
| 276 | }> = []; |
| 277 | let promptsGenerated = false; |
| 278 | |
| 279 | if (addPrompts) { |
| 280 | let addMore = true; |
| 281 | while (addMore) { |
| 282 | const promptName = await input({ |
| 283 | message: "Prompt name:", |
| 284 | validate: (value) => |
| 285 | value.trim().length > 0 || "Prompt name is required", |
| 286 | }); |
| 287 | const promptDescription = await input({ |
| 288 | message: "Prompt description (optional):", |
| 289 | }); |
| 290 | |
| 291 | // Ask about arguments |
| 292 | const hasArguments = await confirm({ |
| 293 | message: "Does this prompt have arguments?", |
| 294 | default: false, |
| 295 | }); |
| 296 | |
| 297 | const argumentNames: string[] = []; |
| 298 | if (hasArguments) { |
| 299 | let addMoreArgs = true; |
| 300 | while (addMoreArgs) { |
| 301 | const argName = await input({ |
| 302 | message: "Argument name:", |
| 303 | validate: (value) => { |
| 304 | if (!value.trim()) return "Argument name is required"; |
| 305 | if (argumentNames.includes(value)) { |
| 306 | return "Argument names must be unique"; |
| 307 | } |
| 308 | return true; |
| 309 | }, |
| 310 | }); |
| 311 | argumentNames.push(argName); |
| 312 | |
| 313 | addMoreArgs = await confirm({ |
| 314 | message: "Add another argument?", |
| 315 | default: false, |
| 316 | }); |
| 317 | } |
| 318 | } |
| 319 | |
| 320 | // Prompt for the text template |
| 321 | const promptText = await input({ |
no outgoing calls
no test coverage detected
searching dependent graphs…