In order to leverage the tool, you will need to prepare your environment for the shell of your choice. Installation instructions are shown below for each supported shell environment.
The following terminal environments are supported:
- Powershell
- Bash
- Zsh (or Bash 5.1)
Learn to install PowerShell on Linux/MacOS here.
In order to run the CLI, ensure that you have python installed. To install the required python packages, please go to the command line in the shell of your choice and enter the following commands:
python -m pip install -r requirements.txt
Additionally, the OpenAI API key, organization id, and engine id are required to execute the CLI tool.
To obtain the OpenAI API key information, go to (https://beta.openai.com/account/api-keys) and login into your account.
Copy the API key by clicking the Copy button and save the copied key where you can retrieve it.
To obtain the OpenAI organization id, go to OpenAI Settings page (https://beta.openai.com/account/org-settings) and copy the id shown underneath the Organization ID heading. Save the copied id with the API key that was stored in previous step.
See image below for reference:
To obtain the OpenAI engine id, go to OpenAI Engines page (https://platform.openai.com/docs/models/overview) for the chat engines available. Select the desired model and save the engine (model) id with the API key and organization id stored in previous steps.
To leverage the CLI on WSL and Linux environments using Bash please follow the steps below:
-
Open Bash shell and download the CLI project to your desired location in Linux by cloning the CLI repo using the following command:
$ git clone https://github.com/antonosika/CLI-Co-Pilot.git /your/custom/path/
-
Once you have the project cloned. Go to the directory that contains the code.
cd </your/custom/path>/CLI-Co-Pilot
-
Setup your Bash CLI environment.
In the folder, there is a folder named
scripts
where you will find abash_setup.sh
script which is used to setup the Bash environment.Run the following commands to setup your environment, the script will prompt for Organization id, API key and engine id:
cd scripts source bash_setup.sh
The script will create an OpenAI config file and update your bash environment.
-
Open a new Bash terminal. Type in
#
followed by your natural language request. PressCtrl + G
to execute!
Once you have finished using the CLI tool, go to the folder that contains the code. ex cd ~/your/custom/path/CLI-Co-Pilot
. Run the following command to clean up the CLI bash environment.
source ./scripts/bash_cleanup.sh
Once done, close the terminal session.
By default bash_setup.sh
will prompt for the required settings. It's also possible to pass these values from the command line, using the following parameters:
Parameter | Description |
---|---|
-o <value> |
To pass your OpenAI Organization Id |
-k <value> |
To pass your OpenAI API key |
-e <value> |
To specify the OpenAI Engine Id |
Example:
source bash_setup.sh -o myorgid -k myapikey -e someengineid
For help running the CLI Bash setup, please run the following command:
source bash_setup.sh -h
- Download this project to
~/your/custom/path/
.
$ git clone https://github.com/antonosika/CLI-Co-Pilot.git ~/your/custom/path/
- In zsh, go to
~/your/custom/path/
(the folder contains code), then run the following command to setup your zsh environment. The script will prompt for Organization id, API key and engine id:
./scripts/zsh_setup.sh
See About zsh_setup.sh section to learn script parameters.
- Run
zsh
, start typing and complete it using^G
!
Once you are done, go to ~/your/custom/path/
(the folder contains code), then run the following command to clean up.
./scripts/zsh_cleanup.sh
zsh_setup.sh
supports the following parameters:
Parameter | Description |
---|---|
-o <value> |
To pass your OpenAI Organization Id |
-k <value> |
To pass your OpenAI API key |
-e <value> |
To specify the OpenAI Engine Id |
- Download this project to wherever you want. For example,
C:\your\custom\path\
or~/your/custom/path
.
git clone https://github.com/antonosika/CLI-Co-Pilot.git C:\your\custom\path\
- Open PowerShell and run the following command. If running in Windows, start PowerShell "as an Administrator".
Set-ExecutionPolicy RemoteSigned -Scope CurrentUser
For more information about Execution Policies, see about_Execution_Policies.
- In the same Powershell terminal, go to
C:\your\custom\path\CLI-Co-Pilot\
(the folder that contains the cloned project). Copy the following command, then replaceYOUR_OPENAI_ORGANIZATION_ID
andENGINE_ID
with your OpenAI organization Id and OpenAI engine Id. Run the command to setup your PowerShell environment. It will prompt you for OpenAI access key.
.\scripts\powershell_setup.ps1 -OpenAIOrganizationId 'YOUR_OPENAI_ORGANIZATION_ID' -OpenAIEngineId 'ENGINE_ID'
See About powershell_setup.ps1 section to learn script parameters.
- Open a new PowerShell session, type in
#
followed by your natural language command and hitCtrl + G
!
Once you are done, go to C:\your\custom\path\
(the folder that contains the cloned project), then run the following command to clean up.
.\scripts\powershell_cleanup.ps1
If you want to revert the execution policy, run this command
Set-ExecutionPolicy Undefined -Scope CurrentUser
powershell_setup.ps1
supports the following parameters:
Parameter | Type | Description |
---|---|---|
-OpenAIApiKey |
SecureString | Required. If is not supplied, the script will prompt you to input the value. You can find this value at https://beta.openai.com/account/api-keys. To provide the value via PowerShell parameter, this is an example for PowerShell 7: .\scripts\powershell_setup.ps1 -OpenAIApiKey (ConvertTo-SecureString "YOUR_OPENAI_API_KEY" -AsPlainText -Force) |
-OpenAIOrganizationId |
String | Required. Your OpenAI organization Id. |
-OpenAIEngineId |
String | Required. The OpenAI engine Id that provides access to a model. |
-RepoRoot |
FileInfo | Optional. Default to the current folder. The value should be the path of CLI co pilot folder. Example: .\scripts\powershell_setup.ps1 -RepoRoot 'C:\your\custom\path' |