-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add init command #12
Conversation
src/commands/prompt/index.ts
Outdated
@@ -48,7 +49,13 @@ export const command: CommandModule<{}, PromptOptions> = { | |||
default: false, | |||
describe: 'Verbose output', | |||
}), | |||
handler: (args) => run(args._.join(' '), args), | |||
handler: (args) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[high] Instead of trying to handle it here, you should modify bin.ts
to include init command as well.
src/commands/init/index.ts
Outdated
}, | ||
{ | ||
type: 'confirm', | ||
message: 'Do you already have OpenAI API key?', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are asking about OpenAI api key, what about case when user wanted to provide only Perplexity key?
src/commands/init/index.ts
Outdated
{ | ||
type: (prev) => (prev ? 'password' : null), | ||
name: 'apiKey', | ||
message: 'Paste your OpenAI key here:', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ditto Perplexity key.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks promising. I've noticed some issue to be handled:
- Prompt always ask for OpenAI key (message is fixed to OpenAI)
init
command should be configured onbin.ts
level, not insideprompt.ts
- We currently have
~.airc
file which is a JSON file but without.json
extension editors might not recognize it as such.
In order to mitigate it for early adopters, let's a a simple code that runs early and moves ~.airc.json
file to ~/.airc.json
const LEGACY_CONFIG_FILE = `.airc`;
const CONFIG_FILE = `.airc.json`;
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good!
Pls resolve comments before merging @Q1w1N.
Adding new init command
Summary
init command can be triggered manually, and it triggers automatically if prompt i run withour config file.
Test plan
Run through all use cases.