Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"env": {
"browser": true,
"es2021": true
},
"extends": ["google", "prettier"],
"parserOptions": {
"ecmaVersion": "latest",
"sourceType": "module"
},
"rules": {}
}
54 changes: 54 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# Contributing

Thank you for considering contributing to this project! We appreciate your time and effort.

## Table of Contents

- [Contributing](#contributing)
- [Table of Contents](#table-of-contents)
- [Getting Started](#getting-started)
- [Contributing Guidelines](#contributing-guidelines)
- [Code Style](#code-style)
- [Submitting a Pull Request](#submitting-a-pull-request)
- [License](#license)

## Getting Started

To get started with contributing, follow these steps:

1. Fork the repository.
2. Clone the forked repository to your local machine.
3. Install the necessary dependencies.
4. Make your changes and test them thoroughly.
5. Commit your changes and push them to your forked repository.
6. Submit a pull request.

## Contributing Guidelines

Please adhere to the following guidelines when contributing:

- Follow the code style and conventions used in the project.
- Write clear and concise commit messages.
- Provide detailed documentation for any new features or changes.
- Be respectful and considerate towards others in the community.

## Code Style

We follow a specific code style in this project. Please make sure to familiarize yourself with it before contributing.

## Submitting a Pull Request

When submitting a pull request, please ensure the following:

- Your code builds without any errors or warnings.
- All existing tests pass successfully.
- You have added new tests to cover any new functionality or changes.
- Your code follows the project's code style guidelines.

## License

By contributing to this project, you agree that your contributions will be licensed under the [LICENSE](./LICENSE) file.

---

We appreciate your contributions and look forward to your pull requests!
86 changes: 86 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
<!-- Badges section here. -->

[![npm version](https://badge.fury.io/js/@ebenjs%2Fgpt-shell.svg)](https://badge.fury.io/js/@ebenjs%2Fgpt-shell)
[![Build Status](https://travis-ci.org/brunolm/chat-gpt.svg?branch=master)](https://travis-ci.org/brunolm/chat-gpt)
[![Known Vulnerabilities](https://snyk.io/test/github/ebenjs/gpt-shell/badge.svg?targetFile=package.json)](https://snyk.io/test/github/brunolm/chat-gpt?targetFile=package.json)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)

<!-- Description section here. -->

The app is a command line client for chat gpt. It allows users to ask gpt questions and receive responses directly in the console. Written in nodejs.

<!-- Table of contents section here. -->

## Table of Contents

- [Table of Contents](#table-of-contents)
- [Prerequisites](#prerequisites)
- [Installation](#installation)
- [Common steps](#common-steps)
- [Linux and MacOS](#linux-and-macos)
- [Windows](#windows)
- [Usage](#usage)
- [Configuration](#configuration)
- [Contributing](#contributing)

## Prerequisites

Any recent version of nodejs.

<!-- Installation section here. -->

## Installation

### Common steps

```bash
git clone https://github.com/ebenjs/gpt-shell.git
cd gpt-shell
npm install
```

### Linux and MacOS

```bash
sudo chmod +x index.js
ln -s "$(pwd)/index.js" ~/bin/gptshell
```

### Windows

On windows you need to create a `gptshell.cmd` file in `C:\Windows\System32` with the following content:

```cmd
@echo off
node "C:\path\to\gpt-shell\index.js" %*
```

<!-- Usage section here. -->

## Usage

```bash
gptshell ask -p "What is the meaning of life?"
```

## Configuration

```bash
gptshell config -k YOUR_API_KEY -m MODEL_NAME -u API_URL
```

`-k` or `--key` is your openai api key.
`-m` or `--model` is the model name to use. Default is `gpt-3.5-turbo`.
`-u` or `--url` is the url of the gpt server. Default is `https://api.openai.com/v1/chat/completions`.

The configuration command is needed only once. It will create a `.gpt-shell-config.json` file in current directory. You can edit this file manually if you want to change the configuration.

<!-- Contributing section here. -->

## Contributing

Contributions are welcome. Please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

For more information, please refer to the [contributing guidelines](./CONTRIBUTING.md).
6 changes: 3 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const isAtLeastOneOptionSpecified = (keys, args) => {
return keys.some((key) => args[key] !== null);
};

const args = yargs(hideBin(process.argv))
yargs(hideBin(process.argv))
.strict(true)
.command(
"ask",
Expand All @@ -30,7 +30,7 @@ const args = yargs(hideBin(process.argv))
},
(argv) => {
ask(argv.prompt);
}
},
)
.command(
"config",
Expand Down Expand Up @@ -58,7 +58,7 @@ const args = yargs(hideBin(process.argv))
},
(argv) => {
configure(argv);
}
},
)
.check((argv) => {
if (!isAtLeastOneOptionSpecified(["apikey", "model", "url"], argv)) {
Expand Down
Loading