Skip to content

Commit d8b115e

Browse files
committed
added command line params to set prompts
1 parent 40481d0 commit d8b115e

File tree

1 file changed

+22
-1
lines changed

1 file changed

+22
-1
lines changed

src/cli/commands/init/index.ts

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,15 @@ export const makeConfigTemplate = (
3131
'*autodoc*',
3232
],
3333
filePrompt:
34+
config?.filePrompt ??
3435
'Write a detailed technical explanation of what this code does. \n\
3536
Focus on the high-level purpose of the code and how it may be used in the larger project.\n\
3637
Include code examples where appropriate. Keep you response between 100 and 300 words. \n\
3738
DO NOT RETURN MORE THAN 300 WORDS.\n\
3839
Output should be in markdown format.\n\
3940
Do not just list the methods and classes in this file.',
4041
folderPrompt:
42+
config?.folderPrompt ??
4143
'Write a technical explanation of what the code in this folder does\n\
4244
and how it might fit into the larger project or work with other parts of the project.\n\
4345
Give examples of how this code might be used. Include code examples where appropriate.\n\
@@ -108,15 +110,34 @@ export const init = async (
108110
},
109111
],
110112
},
113+
{
114+
type: 'input',
115+
name: 'filePrompt',
116+
message: chalk.yellow(
117+
`Enter the prompt you want to use for generating file-level documentation:`,
118+
),
119+
default: config.filePrompt,
120+
},
121+
{
122+
type: 'input',
123+
name: 'folderPrompt',
124+
message: chalk.yellow(
125+
`Enter the prompt you want to use for generating folder-level documentation:`,
126+
),
127+
default: config.folderPrompt,
128+
},
111129
];
112130

113-
const { name, repositoryUrl, llms } = await inquirer.prompt(questions);
131+
const { name, repositoryUrl, llms, filePrompt, folderPrompt } =
132+
await inquirer.prompt(questions);
114133

115134
const newConfig = makeConfigTemplate({
116135
...config,
117136
name,
118137
repositoryUrl,
119138
llms,
139+
filePrompt,
140+
folderPrompt,
120141
});
121142

122143
fs.writeFileSync(

0 commit comments

Comments
 (0)