MCPcopy Index your code
hub / github.com/codeceptjs/CodeceptJS / prompt

Function prompt

lib/command/generate.js:307–337  ·  view source on GitHub ↗
(promptName, genPath)

Source from the content-addressed store, hash-verified

305}
306
307export async function prompt(promptName, genPath) {
308 if (!promptName) {
309 output.error('Please specify prompt name: writeStep, healStep, or generatePageObject')
310 output.print('Usage: npx codeceptjs generate:prompt <promptName>')
311 return
312 }
313
314 const validPrompts = ['writeStep', 'healStep', 'generatePageObject']
315 if (!validPrompts.includes(promptName)) {
316 output.error(`Invalid prompt name: ${promptName}`)
317 output.print(`Valid prompts: ${validPrompts.join(', ')}`)
318 return
319 }
320
321 const testsPath = getTestRoot(genPath)
322
323 const promptsDir = path.join(testsPath, 'prompts')
324 if (!fileExists(promptsDir)) {
325 mkdirp.sync(promptsDir)
326 }
327
328 const templatePath = path.join(__dirname, `../template/prompts/${promptName}.js`)
329 const promptContent = fs.readFileSync(templatePath, 'utf8')
330
331 const promptFile = path.join(promptsDir, `${promptName}.${extension}`)
332 if (!safeFileWrite(promptFile, promptContent)) return
333
334 output.success(`Prompt ${promptName} was created in ${promptFile}`)
335 output.print('Customize this prompt to fit your needs.')
336 output.print('This prompt will be automatically loaded when AI features are enabled.')
337}

Callers 1

generate_test.jsFile · 0.90

Calls 4

getTestRootFunction · 0.90
fileExistsFunction · 0.90
safeFileWriteFunction · 0.90
includesMethod · 0.80

Tested by

no test coverage detected