commit-name-generator 1.0.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/dist/index.js +9738 -0
  2. package/package.json +27 -0
  3. package/readme.md +246 -0
package/package.json ADDED
@@ -0,0 +1,27 @@
1
+ {
2
+ "name": "commit-name-generator",
3
+ "version": "1.0.0",
4
+ "description": "Generate Conventional Commit messages from Git changes",
5
+ "author": "Taha Kourani",
6
+ "type": "module",
7
+ "bin": {
8
+ "commit-name-generator": "./dist/index.js"
9
+ },
10
+ "files": [
11
+ "dist"
12
+ ],
13
+ "scripts": {
14
+ "dev": "tsx src/index.ts",
15
+ "build": "tsup src/index.ts --format esm --clean --target node18",
16
+ "test": "vitest",
17
+ "start": "node dist/index.js",
18
+ "prepublishOnly": "npm run build"
19
+ },
20
+ "keywords": [
21
+ "git",
22
+ "commit",
23
+ "conventional-commits",
24
+ "cli"
25
+ ],
26
+ "license": "MIT"
27
+ }
package/readme.md ADDED
@@ -0,0 +1,246 @@
1
+ Commit Message Generator
2
+
3
+ A TypeScript command-line tool that analyzes Git changes and suggests a Conventional Commit message.
4
+
5
+ It can inspect staged and unstaged changes and open the generated message in VS Code's Git commit editor.
6
+
7
+ Features
8
+
9
+ Detects changes in the current Git repository
10
+
11
+ Suggests Conventional Commit messages
12
+
13
+ Recognizes feature, fix, test, documentation, and dependency changes
14
+
15
+ Supports staged and unstaged changes
16
+
17
+ Opens the suggested message in VS Code for editing
18
+
19
+ Works through npx or a global npm installation
20
+
21
+ Requirements
22
+
23
+ Node.js 18 or newer
24
+
25
+ Git
26
+
27
+ VS Code when using the --edit option
28
+
29
+ Installation
30
+
31
+ Install the package globally:
32
+
33
+ npm install --global @tahakoko/commit-name-generator
34
+
35
+ Run the package without installing it:
36
+
37
+ npx @tahakoko/commit-name-generator
38
+
39
+ If the package is published without an npm scope, use commit-name-generator instead of @tahakoko/commit-name-generator.
40
+
41
+ Usage
42
+
43
+ Stage the files you want to commit:
44
+
45
+ git add .
46
+
47
+ Generate a commit message:
48
+
49
+ commit-name-generator
50
+
51
+ Example output:
52
+
53
+ Changes detected.
54
+ Suggested commit:
55
+ feat: add new functionality
56
+
57
+ Open the message in VS Code
58
+
59
+ Use the --edit option:
60
+
61
+ commit-name-generator --edit
62
+
63
+ Edit the message if needed, save the file, and close the editor. Git completes the commit after the editor closes.
64
+
65
+ Analyze unstaged changes
66
+
67
+ Use --all to analyze changes that have not been staged:
68
+
69
+ commit-name-generator --all
70
+
71
+ Combine --all and --edit to stage all detected changes and open the generated message in VS Code:
72
+
73
+ commit-name-generator --all --edit
74
+
75
+ CLI Options
76
+
77
+ Option
78
+
79
+ Short option
80
+
81
+ Description
82
+
83
+ --all
84
+
85
+ -a
86
+
87
+ Analyze unstaged changes
88
+
89
+ --edit
90
+
91
+ -e
92
+
93
+ Open the generated message in VS Code's Git editor
94
+
95
+ --help
96
+
97
+ -h
98
+
99
+ Display command help
100
+
101
+ --version
102
+
103
+ -V
104
+
105
+ Display the installed version
106
+
107
+ Examples
108
+
109
+ Generate a message from staged changes:
110
+
111
+ git add src/index.ts
112
+ commit-name-generator
113
+
114
+ Open the generated message in VS Code:
115
+
116
+ git add .
117
+ commit-name-generator --edit
118
+
119
+ Analyze all current changes and commit them through VS Code:
120
+
121
+ commit-name-generator --all --edit
122
+
123
+ Possible suggestions include:
124
+
125
+ feat: add new functionality
126
+ fix: resolve application issue
127
+ test: update test coverage
128
+ docs: update documentation
129
+ chore: update project dependencies
130
+ chore: update project files
131
+
132
+ Local Development
133
+
134
+ Clone the repository:
135
+
136
+ git clone https://github.com/tahakourani-t/commit-message-generator.git
137
+ cd commit-message-generator
138
+
139
+ Install the dependencies:
140
+
141
+ npm install
142
+
143
+ Run the CLI directly from TypeScript:
144
+
145
+ npm run dev
146
+
147
+ Build the package:
148
+
149
+ npm run build
150
+
151
+ Run the tests:
152
+
153
+ npm test -- --run
154
+
155
+ Link the package globally for local testing:
156
+
157
+ npm link
158
+ commit-name-generator --help
159
+
160
+ Preview the files that will be included in the npm package:
161
+
162
+ npm pack --dry-run
163
+
164
+ Publishing
165
+
166
+ Log in and confirm your npm account:
167
+
168
+ npm login
169
+ npm whoami
170
+
171
+ Build and test the package:
172
+
173
+ npm run build
174
+ npm test -- --run
175
+
176
+ Publish the package:
177
+
178
+ npm publish --access public
179
+
180
+ For a future patch release:
181
+
182
+ npm version patch
183
+ npm publish --access public
184
+
185
+ Use npm version minor for new backward-compatible features and npm version major for breaking changes.
186
+
187
+ Conventional Commit Format
188
+
189
+ Generated messages follow this structure:
190
+
191
+ type(scope): description
192
+
193
+ Common types:
194
+
195
+ feat: a new feature
196
+
197
+ fix: a bug fix
198
+
199
+ docs: documentation changes
200
+
201
+ test: test changes
202
+
203
+ refactor: code restructuring without a feature or bug fix
204
+
205
+ chore: maintenance, tooling, or dependency changes
206
+
207
+ Troubleshooting
208
+
209
+ Error: Not a Git Repository
210
+
211
+ Run the command inside a Git repository:
212
+
213
+ git init
214
+
215
+ No Staged Changes Found
216
+
217
+ Stage your changes and try again:
218
+
219
+ git add .
220
+ commit-name-generator
221
+
222
+ Alternatively, analyze unstaged changes:
223
+
224
+ commit-name-generator --all
225
+
226
+ VS Code Does Not Open
227
+
228
+ Make sure the code command is available:
229
+
230
+ code --version
231
+
232
+ On macOS, open the VS Code Command Palette and choose Shell Command: Install 'code' command in PATH.
233
+
234
+ On Windows, rerun the VS Code installer and enable the option to add VS Code to PATH.
235
+
236
+ Repository
237
+
238
+ https://github.com/tahakourani-t/commit-message-generator
239
+
240
+ Author
241
+
242
+ Taha Kourani
243
+
244
+ License
245
+
246
+ MIT