Compare commits

...

12 Commits

Author SHA1 Message Date
di-sukharev
5d0c69e849 1.1.11 2023-03-16 11:48:42 +08:00
di-sukharev
9754442efa chore(README.md): update Twitter handle in header 2023-03-16 11:48:31 +08:00
di-sukharev
a619cd1f78 docs(README.md): update payment information to include GPT-4 cost comparison 2023-03-15 17:35:25 +08:00
di-sukharev
1fc4a6b6c0 1.1.10 2023-03-15 17:33:55 +08:00
di-sukharev
798bddba81 docs(README.md): remove outdated information about minimum supported version of Node.js 2023-03-15 17:33:43 +08:00
di-sukharev
42ed2a31f4 fix(commit.ts): remove '-u' and 'origin' arguments from git push command to push to the current branch 2023-03-15 14:51:26 +08:00
di-sukharev
571e1e9d8f chore(TODO.md): mark batch small files in one request as completed
refactor(TODO.md): rephrase optimize prompt TODO to suggest exploring cleaner alternatives to prompt
2023-03-15 14:49:38 +08:00
di-sukharev
bd8de7a8ea feat(commit.ts): add '-u origin HEAD' flag to 'git push' command to set upstream branch and push current branch to it 2023-03-15 14:46:15 +08:00
di-sukharev
913bcd379f 1.1.9 2023-03-14 18:51:06 +08:00
di-sukharev
25468f67ad 1.1.8 2023-03-14 18:50:57 +08:00
Benny Neugebauer
6766f62848 Replace type assertion with built-in error detection (#10)
* refactor(api.ts): use built-in axios error detection
2023-03-14 18:50:25 +08:00
di-sukharev
71c36db265 1.1.7 2023-03-13 16:44:36 +08:00
5 changed files with 11 additions and 16 deletions

3
.github/TODO.md vendored
View File

@@ -5,5 +5,6 @@
- [] make bundle smaller by properly configuring esbuild
- [] [build for both mjs and cjs](https://snyk.io/blog/best-practices-create-modern-npm-package/)
- [] do // TODOs in the code
- [] batch small files in one request
- [x] batch small files in one request
- [] add tests
- [] optimize prompt, maybe no prompt would be cleaner

View File

@@ -2,7 +2,7 @@
<div>
<img src=".github/logo-grad.svg" alt="OpenCommit logo"/>
<h1 align="center">OpenCommit</h1>
<h4 align="center">Author <a href="https://github.com/di-sukharev">@di-sukharev</a> <a href="https://twitter.com/io_Y_oi"><img src="https://img.shields.io/twitter/follow/io_Y_oi?style=flat&label=io_Y_oi&logo=twitter&color=0bf&logoColor=fff" align="center"></a>
<h4 align="center">Follow the bird <a href="https://twitter.com/io_Y_oi"><img src="https://img.shields.io/twitter/follow/io_Y_oi?style=flat&label=io_Y_oi&logo=twitter&color=0bf&logoColor=fff" align="center"></a>
</h4>
</div>
<h2>GPT CLI to auto-generate impressive commits in 1 second</h2>
@@ -20,8 +20,6 @@ All the commits in this repo are done with OpenCommit — look into [the commits
## Setup
> The minimum supported version of Node.js is the latest v14. Check your Node.js version with `node --version`.
1. Install opencommit globally to use in any repository:
```sh
@@ -113,4 +111,4 @@ Or follow the process of your IDE Source Control feature, when it calls `git com
## Payments
You pay for your own requests to OpenAI API. OpenCommit uses ChatGPT official model, that is ~10x times cheaper than GPT-3.
You pay for your own requests to OpenAI API. OpenCommit uses ChatGPT official model, that is ~10x times cheaper than GPT-3 and ~6x times cheaper than GPT-4.

4
package-lock.json generated
View File

@@ -1,12 +1,12 @@
{
"name": "opencommit",
"version": "1.1.6",
"version": "1.1.11",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "opencommit",
"version": "1.1.6",
"version": "1.1.11",
"license": "ISC",
"dependencies": {
"@clack/prompts": "^0.6.1",

View File

@@ -1,6 +1,6 @@
{
"name": "opencommit",
"version": "1.1.6",
"version": "1.1.11",
"description": "GPT CLI to auto-generate impressive commits in 1 second. Killing lame commits with AI 🤯🔫",
"keywords": [
"git",

View File

@@ -1,5 +1,5 @@
import { intro, outro } from '@clack/prompts';
import { AxiosError } from 'axios';
import axios from 'axios';
import chalk from 'chalk';
import {
ChatCompletionRequestMessage,
@@ -50,15 +50,11 @@ class OpenAi {
const message = data.choices[0].message;
return message?.content;
} catch (error: any) {
} catch (error: unknown) {
outro(`${chalk.red('✖')} ${error}`);
if (error.isAxiosError && error.response?.status === 401) {
const err = error as AxiosError;
const openAiError = (
err.response?.data as { error?: { message: string } }
).error;
if (axios.isAxiosError<{ error?: { message: string } }>(error) && error.response?.status === 401) {
const openAiError = error.response.data.error;
if (openAiError?.message) outro(openAiError.message);
outro(