aicommits 1.1.0 → 1.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/README.md +81 -19
  2. package/dist/cli.mjs +69 -74
  3. package/package.json +33 -8
package/README.md CHANGED
@@ -5,34 +5,95 @@
5
5
  </div>
6
6
  <p>A CLI that writes your git commit messages for you with AI. Never write a commit message again.</p>
7
7
  <a href="https://www.npmjs.com/package/aicommits"><img src="https://img.shields.io/npm/v/aicommits" alt="Current version"></a>
8
- <a href="https://twitter.com/nutlope">
9
- <img src="https://img.shields.io/twitter/follow/nutlope?style=flat&label=nutlope&logo=twitter&color=0bf&logoColor=fff" alt="Hassan Twitter follower count" />
10
- </a>
11
8
  </div>
12
9
 
13
10
  ---
14
11
 
15
- ## Installation and Usage
12
+ ## Setup
16
13
 
17
- 1. Install the CLI:
14
+ > The minimum supported version of Node.js is the latest v14. Check your Node.js version with `node --version`.
18
15
 
19
- ```sh
20
- npm install -g aicommits
21
- ```
16
+
17
+ 1. Install _aicommits_:
18
+
19
+ ```sh
20
+ npm install -g aicommits
21
+ ```
22
22
 
23
23
  2. Retrieve your API key from [OpenAI](https://platform.openai.com/account/api-keys)
24
24
 
25
- > Note: If you haven't already, you'll have to create an account and set up billing.
25
+ > Note: If you haven't already, you'll have to create an account and set up billing.
26
26
 
27
27
  3. Set the key so aicommits can use it:
28
28
 
29
- ```sh
30
- echo "OPENAI_KEY=<your token>" >> ~/.aicommits
31
- ```
29
+ ```sh
30
+ aicommits config set OPENAI_KEY=<your token>
31
+ ```
32
+
33
+ This will create a `.aicommits` file in your home directory.
34
+
35
+
36
+ ### Upgrading
37
+
38
+ Check the installed version with:
39
+ ```
40
+ aicommits --version
41
+ ```
42
+
43
+ If it's not the [latest version](https://github.com/Nutlope/aicommits/releases/latest), run:
44
+
45
+ ```sh
46
+ npm update -g aicommits
47
+ ```
48
+
49
+ ## Usage
50
+ ### CLI mode
51
+
52
+ You can call `aicommits` directly to generate a commit message for your staged changes:
53
+
54
+ ```sh
55
+ git add <files...>
56
+ aicommits
57
+ ```
58
+
59
+ `aicommits` passes down unknown flags to `git commit`, so you can pass in [`commit` flags](https://git-scm.com/docs/git-commit) (with some exceptions (e.g. `--all`):
60
+
61
+ ```sh
62
+ aicommits --dry-run
63
+ ```
32
64
 
33
- 4. You're ready to go!
65
+ ### Git hook
66
+
67
+ You can also integrate _aicommits_ with Git via the [`prepare-commit-msg`](https://git-scm.com/docs/githooks#_prepare_commit_msg) hook. This lets you use Git like you normally would, and edit the commit message before committing.
68
+
69
+ #### Install
70
+
71
+ In the Git repository you want to install the hook in:
72
+ ```sh
73
+ aicommits hook install
74
+ ```
75
+
76
+ #### Uninstall
77
+ In the Git repository you want to uninstall the hook from:
78
+
79
+ ```sh
80
+ aicommits hook uninstall
81
+ ```
82
+
83
+ #### Usage
84
+
85
+ 1. Stage your files and commit:
86
+ ```sh
87
+ git add <files...>
88
+ git commit # Only generates a message when it's not passed in
89
+ ```
90
+
91
+ > If you ever want to write your own message instead of generating one, you can simply pass one in: `git commit -m "My message"`
92
+
93
+ 2. Aicommits will generate the commit message for you and pass it back to Git. Git will open it with the [configured editor](https://docs.github.com/en/get-started/getting-started-with-git/associating-text-editors-with-git) for you to review/edit it.
94
+
95
+ 3. Save and close the editor to commit!
34
96
 
35
- Run `aicommits` in any Git repo and it will generate a commit message for you.
36
97
 
37
98
  ## How it works
38
99
 
@@ -43,17 +104,18 @@ Video coming soon where I rebuild it from scratch to show you how to easily buil
43
104
  ## Future tasks
44
105
 
45
106
  - Add support for conventional commits as a flag that users can enable
107
+ - Migrate to chatGPT instead of GPT-3
46
108
  - Add support for diffs greater than 200 lines by grabbing the diff per file, optional flag
47
109
  - Add ability to specify a commit message from inside aicommit if user doesn't like generated one
48
- - Solve latency issue (use a githook to asynchronously run gpt3 call on every git add, store the result in a temp file or in the .git folder). Put behind a flag
49
- - Use gpt-3-tokenizer instead of hard limit on characters as a more accurate model
50
110
  - Play around with prompt to produce optimal result
111
+ - Add an alias called `aic` that does "git add . && aicommits && git push"
51
112
  - Add opt-in emoji flag to preface commits with an emoji, use [this](https://gitmoji.dev) as a guide
52
113
  - Add opt-in languages flag where it returns the commit in different languages
53
- - Add automated github releases using [this action](https://github.com/manovotny/github-releases-for-automated-package-publishing-action)
54
114
  - Build landing page for the 2.0 launch
55
115
 
56
116
  ## Maintainers
57
117
 
58
- - **Hassan El Mghari**: [GitHub](https://github.com/Nutlope) | [Twitter](https://twitter.com/nutlope)
59
- - **Hiroki Osame**: [GitHub](https://github.com/privatenumber) | [Twitter](https://twitter.com/privatenumbr)
118
+ - **Hassan El Mghari**: [@Nutlope](https://github.com/Nutlope) [<img src="https://img.shields.io/twitter/follow/nutlope?style=flat&label=nutlope&logo=twitter&color=0bf&logoColor=fff" align="center">](https://twitter.com/nutlope)
119
+
120
+
121
+ - **Hiroki Osame**: [@privatenumber](https://github.com/privatenumber) [<img src="https://img.shields.io/twitter/follow/privatenumbr?style=flat&label=privatenumbr&logo=twitter&color=0bf&logoColor=fff" align="center">](https://twitter.com/privatenumbr)