Get-Response is a node.js based command-line interface (CLI) created by Swapnoneel Saha tool that interacts with the Google's Gemini API to generate content based on the user input. This tool allows you to ask questions directly or provide context from files, images or directories, and get the response in a simple and easy to understand interface. Also, you can automate some terminal commands by prompting for the task. And additionally, we also have support for responses from Stack Exchange sites like Stack Overflow
To install this package, you need to have node.js and npm installed in your machine. If you don't have them installed, you can refer to this article. Once that's done, you can install the package globally by using this command in your terminal:
npm i get-response -g
To ask a question directly from the command line (context is not stored for further questions):
npx get-response "<Ask your question>"
To provide additional context about your question, you can use the -f
or --file
flag followed by the file path:
npx get-response "<Ask your question>" -f ./path/to/your/file.js
To provide additional context about your question, you can use the -p
or --pdf
flag followed by the file path:
npx get-response "<Ask your question>" -p ./path/to/your/pdf.pdf
To provide additional context about your question, you can use the -d
or --directory
flag followed by the name of the directory:
npx get-response "<Ask your question>" -d ./path/to/your/directory
To provide additional context about your question, you can use the -i
or --image
flag followed by the name of the image file:
npx get-response "<Ask your question>" -i ./path/to/your/image.png
Note: The image must contain texts, for valid responses!
In the context-based chat mode, you can ask multiple questions in a session:
npx get-response -c
Alternatively, you can also use:
npx get-response --chat-mode
In the chat mode, the prompt Type your message:
will appear, indicating that the tool is ready for you to type your question or command.
To exit the chat mode, type exit
and press Enter, also you can access the Stack Exchange mode anytime you want by typing stack
and hitting enter.
Also, you can use the chat mode in association with the file, directory and PDF file as the context, using the -f, -d and -p flags respectively.
In the terminal mode, you can ask the AI to perform some specific actions and it will automatically execute the commands in your terminal based on your permission:
npx get-response "<Mention your task>" -t
Alternatively, you can also use:
npx get-response "<Mention your task>" --terminal
You can also ask a question to Stack Exchange and get the response based on the most relevant conversations based on that topic, also you can limit the number of links that you want to see from the response.
npx get-response "Mention your question/problem" -s "maximum number of links"
Alternatively, you can also use:
npx get-response "Mention your question/problem" --search-stack "maximum number of links"
Other than this, we also have a Stack Exchange interface in the live chat mode, and you can switch to it whenever you want by typing stack
as a response, while you are on the chat mode. And you will be able to have a conversation with the StackAI. To switch back to the AI chat mode, you can simply type chat
as a response, and you'll be back on the interactive chat mode with the context of the previous interactions of the current session!
Using the mermaid code generator, you can generate the entire workflow of the codebase in a single image file. For that, you can use:
npx get-response -m -f index.js
Alternatively, you can also give directory as a context,
npx get-response -m -d ./src
npx get-response "What is the currency of South Africa?"
npx get-response "Tell me, what is the function of the variable named toggleMode" -f ./index.js
Alternatively, you can also use:
npx get-response "Tell me, what is the function of the variable named toggleMode" --file ./index.js
npx get-response "What is the summary of the story" -p ./sample.pdf
Alternatively, you can also use:
npx get-response "What is the summary of the story" --pdf ./sample.pdf
npx get-response "Write unit test cases for each of the functions" -d ./sample-app
Alternatively, you can also use:
npx get-response "Write unit test cases for each of the functions" --directory ./sample-app
npx get-response -c -f ./index.js
Or,
npx get-response -c -d ./sample-app
Or,
npx get-response -c -p ./sample.pdf
npx get-response "Create a React application named get-response" -t
Or,
npx get-response "Create a directory named 'hello' and a text file named 'hi' inside it" --terminal
npx get-response "How to shutdown a PC from the terminal?" -s 3
Or,
npx get-response "How to copy a file from one directory to another?" --search-stack 10
If you want to contribute to this project, please go ahead!! Open an issue or submit a pull request for any improvements, bug fixes or feature implementations.
For any questions, suggestions or issues, please open an issue in the GitHub repository.