Skip to content

Commit bddf7cc

Browse files
authored
Merge pull request #33 from eabdelmoneim/ea_prompt_inputs
added prompt inputs to init command
2 parents 9cdaede + 8973bb4 commit bddf7cc

File tree

2 files changed

+23
-2
lines changed

2 files changed

+23
-2
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ Run the `init` command:
126126
```
127127
doc init
128128
```
129-
You will be prompted to enter the name of your project, GitHub url, and select which GPT models you have access to. If you aren't sure which models you have access to, select the first option. This command will generate an `autodoc.config.json` file in the root of your project to store the values. This file should be checked in to git.
129+
You will be prompted to enter the name of your project, GitHub url, and select which GPT models you have access to. If you aren't sure which models you have access to, select the first option. You can also specify your own GPT file/directory prompts that will be used to summarize/analyze the code repoThis command will generate an `autodoc.config.json` file in the root of your project to store the values. This file should be checked in to git.
130130

131131
**Note:** Do not skip entering these values or indexing may not work.
132132

src/cli/commands/init/index.ts

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,15 @@ export const makeConfigTemplate = (
3434
'*autodoc*',
3535
],
3636
filePrompt:
37+
config?.filePrompt ??
3738
'Write a detailed technical explanation of what this code does. \n\
3839
Focus on the high-level purpose of the code and how it may be used in the larger project.\n\
3940
Include code examples where appropriate. Keep you response between 100 and 300 words. \n\
4041
DO NOT RETURN MORE THAN 300 WORDS.\n\
4142
Output should be in markdown format.\n\
4243
Do not just list the methods and classes in this file.',
4344
folderPrompt:
45+
config?.folderPrompt ??
4446
'Write a technical explanation of what the code in this folder does\n\
4547
and how it might fit into the larger project or work with other parts of the project.\n\
4648
Give examples of how this code might be used. Include code examples where appropriate.\n\
@@ -111,15 +113,34 @@ export const init = async (
111113
},
112114
],
113115
},
116+
{
117+
type: 'input',
118+
name: 'filePrompt',
119+
message: chalk.yellow(
120+
`Enter the prompt you want to use for generating file-level documentation:`,
121+
),
122+
default: config.filePrompt,
123+
},
124+
{
125+
type: 'input',
126+
name: 'folderPrompt',
127+
message: chalk.yellow(
128+
`Enter the prompt you want to use for generating folder-level documentation:`,
129+
),
130+
default: config.folderPrompt,
131+
},
114132
];
115133

116-
const { name, repositoryUrl, llms } = await inquirer.prompt(questions);
134+
const { name, repositoryUrl, llms, filePrompt, folderPrompt } =
135+
await inquirer.prompt(questions);
117136

118137
const newConfig = makeConfigTemplate({
119138
...config,
120139
name,
121140
repositoryUrl,
122141
llms,
142+
filePrompt,
143+
folderPrompt,
123144
});
124145

125146
fs.writeFileSync(

0 commit comments

Comments
 (0)