better-commits 1.20.0-cli-flags → 1.20.1-temp.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 (71) hide show
  1. package/dist/branch.js +1 -1
  2. package/dist/{chunk-SIF4LZUS.js → chunk-LPU7O52G.js} +1 -1
  3. package/dist/chunk-QPUTIRGU.js +245 -0
  4. package/dist/index.js +2 -2
  5. package/dist/init.js +1 -1
  6. package/package.json +7 -1
  7. package/readme.md +141 -173
  8. package/.better-commits.json +0 -52
  9. package/.github/workflows/publish.yml +0 -34
  10. package/.github/workflows/test.yml +0 -27
  11. package/.opencode/package-lock.json +0 -115
  12. package/.opencode/plans/cli-args.md +0 -182
  13. package/.prettierignore +0 -5
  14. package/.prettierrc +0 -1
  15. package/.svelte-kit/ambient.d.ts +0 -289
  16. package/.svelte-kit/generated/client/app.js +0 -28
  17. package/.svelte-kit/generated/client/matchers.js +0 -1
  18. package/.svelte-kit/generated/client/nodes/0.js +0 -1
  19. package/.svelte-kit/generated/client/nodes/1.js +0 -1
  20. package/.svelte-kit/tsconfig.json +0 -49
  21. package/0001-feat-branch-124-update-worktrees-feature.patch +0 -316
  22. package/dist/chunk-OFJCRS3N.js +0 -4
  23. package/docs/ai-skills.yaml +0 -48
  24. package/docs/clack.md +0 -143
  25. package/docs/valibot.md +0 -228
  26. package/src/args.test.ts +0 -102
  27. package/src/args.ts +0 -106
  28. package/src/branch-args.test.ts +0 -72
  29. package/src/branch-args.ts +0 -106
  30. package/src/branch-help.ts +0 -114
  31. package/src/branch.ts +0 -95
  32. package/src/git.ts +0 -60
  33. package/src/help.ts +0 -131
  34. package/src/index.test.ts +0 -7
  35. package/src/index.ts +0 -100
  36. package/src/init.ts +0 -25
  37. package/src/prompts/branch-checkout.prompt.ts +0 -36
  38. package/src/prompts/branch-confirm.prompt.ts +0 -134
  39. package/src/prompts/branch-description.prompt.ts +0 -37
  40. package/src/prompts/branch-runnable.ts +0 -13
  41. package/src/prompts/branch-ticket.prompt.ts +0 -41
  42. package/src/prompts/branch-type.prompt.ts +0 -43
  43. package/src/prompts/branch-user.prompt.ts +0 -50
  44. package/src/prompts/branch-version.prompt.ts +0 -41
  45. package/src/prompts/commit-body.prompt.ts +0 -57
  46. package/src/prompts/commit-confirm.prompt.ts +0 -119
  47. package/src/prompts/commit-footer.prompt.ts +0 -195
  48. package/src/prompts/commit-scope.prompt.ts +0 -73
  49. package/src/prompts/commit-status.prompt.ts +0 -75
  50. package/src/prompts/commit-ticket.prompt.ts +0 -82
  51. package/src/prompts/commit-title.prompt.ts +0 -98
  52. package/src/prompts/commit-type.prompt.ts +0 -93
  53. package/src/prompts/runnable.ts +0 -13
  54. package/src/utils/build-branch.test.ts +0 -141
  55. package/src/utils/build-branch.ts +0 -46
  56. package/src/utils/build-commit-string.test.ts +0 -253
  57. package/src/utils/build-commit-string.ts +0 -158
  58. package/src/utils/commit-title-size.ts +0 -24
  59. package/src/utils/infer.test.ts +0 -83
  60. package/src/utils/infer.ts +0 -114
  61. package/src/utils/messages.ts +0 -25
  62. package/src/utils/no-interactive-branch-validation.test.ts +0 -170
  63. package/src/utils/no-interactive-validation.test.ts +0 -174
  64. package/src/utils/no-interactive-validation.ts +0 -190
  65. package/src/utils.ts +0 -219
  66. package/src/valibot-consts.ts +0 -114
  67. package/src/valibot-state.test.ts +0 -48
  68. package/src/valibot-state.ts +0 -265
  69. package/tsconfig.json +0 -15
  70. package/tsup.config.ts +0 -12
  71. package/vitest.config.ts +0 -8
package/readme.md CHANGED
@@ -51,18 +51,20 @@ better-branch # Create a new branch
51
51
 
52
52
  `better-commits` will prompt a series of questions. These prompts will build a commit message, which you can preview, before confirming the commit. - To better understand these prompts and their intention, read [Conventional Commits Summary](https://www.conventionalcommits.org/en/v1.0.0-beta.4/#summary)
53
53
 
54
- Some of the values in these prompts will be inferred by your branch name and auto populated. You can adjust this in your `.better-commits.json` configuration file.
54
+ Some of the values in these prompts will be inferred by your branch name and auto populated. You can adjust this in your `.better-commits.jsonc` (or `.better-commits.json`) configuration file.
55
55
 
56
56
  For documentation on passing commit values to `better-commits` via the CLI, see [CLI Flags](#cli-flags).
57
57
 
58
58
  > [!TIP]
59
- > The --no-interactive flag, allows automated workflows or AI agents like OpenCode and Claude Code, to use better-commits to generate consistent commit messages using less tokens.
59
+ > The `--no-interactive` flag, allows automated workflows or AI agents like OpenCode and Claude Code, to use better-commits to generate consistent commit messages using less tokens.
60
+ >
61
+ > Run `better-commits --help` / `better-branch --help` for more information.
60
62
 
61
63
  ## ⚙️ Configuration
62
64
 
63
65
  ### Global
64
66
 
65
- Your first time running `better-commits`, a default config will be generated in your `$HOME` directory, named `.better-commits.json`
67
+ Your first time running `better-commits`, a default config will be generated in your `$HOME` directory, named `.better-commits.jsonc` (formerly `.better-commits.json`)
66
68
 
67
69
  - This config will be used if a repository-specific config cannot be found.
68
70
 
@@ -71,293 +73,262 @@ Your first time running `better-commits`, a default config will be generated in
71
73
  To create a **repository-specific config**, navigate to the root of your project.
72
74
 
73
75
  - Run `better-commits-init`
74
- - This will create a default config named `.better-commits.json`
76
+ - This will create a default config named `.better-commits.jsonc`
75
77
  - Properties such as `confirm_with_editor` and `overrides` will prefer the global config
76
78
 
77
- ### Options
79
+ ### 💫 Properties
78
80
 
79
81
  > [!NOTE]<br>
80
- > All properties are optional and can be removed from the config. It will be replaced by the default at run-time.
82
+ > All properties are optional and can be removed from the config. They will be replaced by the default at run-time.
81
83
  >
82
84
  > - See `.better-commits.json` in this repository as an example
83
85
 
84
- ### 💫 Default JSON Config
85
-
86
- <details open>
87
- <summary>Expand / Collapse</summary>
88
-
89
- ```json
86
+ ```jsonc
90
87
  {
88
+ // Run interactive `git status` before composing a commit
91
89
  "check_status": true,
90
+
91
+ /* COMMIT FIELDS */
92
92
  "commit_type": {
93
93
  "enable": true,
94
+
95
+ // Default selected type from options
94
96
  "initial_value": "feat",
97
+
95
98
  "max_items": 20,
99
+
100
+ // Infer type from the current branch name: user/TYPE/my-branch
96
101
  "infer_type_from_branch": true,
102
+
103
+ // Include emoji in prompt label
97
104
  "append_emoji_to_label": false,
105
+
106
+ // Include emoji from prompt label in commit message
98
107
  "append_emoji_to_commit": false,
108
+
109
+ // "Start" | "After-Colon"
99
110
  "emoji_commit_position": "Start",
111
+
100
112
  "options": [
101
113
  {
102
114
  "value": "feat",
103
115
  "label": "feat",
104
116
  "hint": "A new feature",
105
117
  "emoji": "🌟",
106
- "trailer": "Changelog: feature"
118
+ "trailer": "Changelog: feature",
107
119
  },
108
120
  {
109
121
  "value": "fix",
110
122
  "label": "fix",
111
123
  "hint": "A bug fix",
112
124
  "emoji": "🐛",
113
- "trailer": "Changelog: fix"
125
+ "trailer": "Changelog: fix",
114
126
  },
115
127
  {
116
128
  "value": "docs",
117
129
  "label": "docs",
118
130
  "hint": "Documentation only changes",
119
131
  "emoji": "📚",
120
- "trailer": "Changelog: documentation"
132
+ "trailer": "Changelog: documentation",
121
133
  },
122
134
  {
123
135
  "value": "refactor",
124
136
  "label": "refactor",
125
137
  "hint": "A code change that neither fixes a bug nor adds a feature",
126
138
  "emoji": "🔨",
127
- "trailer": "Changelog: refactor"
139
+ "trailer": "Changelog: refactor",
128
140
  },
129
141
  {
130
142
  "value": "perf",
131
143
  "label": "perf",
132
144
  "hint": "A code change that improves performance",
133
145
  "emoji": "🚀",
134
- "trailer": "Changelog: performance"
146
+ "trailer": "Changelog: performance",
135
147
  },
136
148
  {
137
149
  "value": "test",
138
150
  "label": "test",
139
151
  "hint": "Adding missing tests or correcting existing tests",
140
152
  "emoji": "🚨",
141
- "trailer": "Changelog: test"
153
+ "trailer": "Changelog: test",
142
154
  },
143
155
  {
144
156
  "value": "build",
145
157
  "label": "build",
146
158
  "hint": "Changes that affect the build system or external dependencies",
147
159
  "emoji": "🚧",
148
- "trailer": "Changelog: build"
160
+ "trailer": "Changelog: build",
149
161
  },
150
162
  {
151
163
  "value": "ci",
152
164
  "label": "ci",
153
165
  "hint": "Changes to our CI configuration files and scripts",
154
166
  "emoji": "🤖",
155
- "trailer": "Changelog: ci"
167
+ "trailer": "Changelog: ci",
156
168
  },
157
169
  {
158
170
  "value": "chore",
159
171
  "label": "chore",
160
172
  "hint": "Other changes that do not modify src or test files",
161
173
  "emoji": "🧹",
162
- "trailer": "Changelog: chore"
174
+ "trailer": "Changelog: chore",
163
175
  },
164
176
  {
165
177
  "value": "",
166
- "label": "none"
167
- }
168
- ]
178
+ "label": "none",
179
+ },
180
+ ],
169
181
  },
182
+
170
183
  "commit_scope": {
171
184
  "enable": true,
185
+
186
+ // If true, users can type a scope not listed in options
172
187
  "custom_scope": false,
188
+
189
+ // Default selected scope from options
173
190
  "initial_value": "app",
191
+
174
192
  "max_items": 20,
175
193
  "options": [
176
- {
177
- "value": "app",
178
- "label": "app"
179
- },
180
- {
181
- "value": "shared",
182
- "label": "shared"
183
- },
184
- {
185
- "value": "server",
186
- "label": "server"
187
- },
188
- {
189
- "value": "tools",
190
- "label": "tools"
191
- },
192
- {
193
- "value": "",
194
- "label": "none"
195
- }
196
- ]
194
+ { "value": "app", "label": "app" },
195
+ { "value": "shared", "label": "shared" },
196
+ { "value": "server", "label": "server" },
197
+ { "value": "tools", "label": "tools" },
198
+ { "value": "", "label": "none" },
199
+ ],
197
200
  },
201
+
198
202
  "check_ticket": {
203
+ // Infer ticket / issue from the branch name - user/type/TICKET-my-branch
199
204
  "infer_ticket": true,
205
+
206
+ // Prompt for confirmation / edit before using an inferred ticket
200
207
  "confirm_ticket": true,
208
+
209
+ // Add the ticket to the commit title - feat(app): TICKET my commit title
201
210
  "add_to_title": true,
211
+
212
+ // Deprecated, prefer `prepend_hashtag`
202
213
  "append_hashtag": false,
214
+
215
+ // "Never" | "Prompt" | "Always" - 12345 --> #12345
203
216
  "prepend_hashtag": "Never",
217
+
218
+ // Wrap the ticket in the commit title: "" | "[]" | "()" | "{}"
204
219
  "surround": "",
205
- "title_position": "start"
220
+
221
+ // "start" | "end" | "before-colon" | "beginning"
222
+ "title_position": "start",
206
223
  },
224
+
207
225
  "commit_title": {
208
- "max_size": 70
226
+ // Includes total size of title + type + scope + ticket
227
+ "max_size": 70,
209
228
  },
229
+
210
230
  "commit_body": {
211
231
  "enable": true,
212
232
  "required": false,
213
- "split_by_period": false
233
+
234
+ // Split sentences into multiple lines automatically
235
+ "split_by_period": false,
214
236
  },
237
+
215
238
  "commit_footer": {
216
239
  "enable": true,
217
240
  "initial_value": [],
218
- "options": ["closes", "trailer", "breaking-change", "deprecated", "custom"]
241
+
242
+ // "closes", "trailer", "breaking-change", "deprecated", "custom"
243
+ "options": ["closes", "trailer", "breaking-change", "deprecated", "custom"],
219
244
  },
245
+
220
246
  "breaking_change": {
221
- "add_exclamation_to_title": true
247
+ // Adds `!` to the commit title when a breaking change is selected
248
+ "add_exclamation_to_title": true,
222
249
  },
250
+
251
+ // Confirm / edit with $GIT_EDITOR or $EDITOR
252
+ "confirm_with_editor": false,
253
+
254
+ // Show a final confirmation prompt before running git commit
223
255
  "confirm_commit": true,
256
+
257
+ // Reuse the last known value from a previous canceled or failed commit
224
258
  "cache_last_value": true,
225
- "confirm_with_editor": false,
259
+
260
+ // Pretty-print the final commit preview before execution
226
261
  "print_commit_output": true,
262
+
263
+ /* BRANCH FIELDS */
264
+ // Optional shell commands to run before / after creating branches or worktrees
227
265
  "branch_pre_commands": [],
228
266
  "branch_post_commands": [],
229
267
  "worktree_pre_commands": [],
230
268
  "worktree_post_commands": [],
269
+
231
270
  "branch_user": {
232
271
  "enable": true,
233
272
  "required": false,
234
- "separator": "/"
273
+
274
+ // "/" | "-" | "_" - user/feat/my-branch
275
+ "separator": "/",
235
276
  },
277
+
236
278
  "branch_type": {
237
279
  "enable": true,
238
- "separator": "/"
239
- },
240
- "branch_version": {
241
- "enable": false,
242
- "required": false,
243
- "separator": "/"
280
+ "separator": "/",
244
281
  },
282
+
245
283
  "branch_ticket": {
246
284
  "enable": true,
247
285
  "required": false,
248
- "separator": "-"
286
+ "separator": "-",
249
287
  },
288
+
289
+ "branch_version": {
290
+ "enable": false,
291
+ "required": false,
292
+ "separator": "/",
293
+ },
294
+
250
295
  "branch_description": {
296
+ // Maximum length for the description segment of the branch name
251
297
  "max_length": 70,
252
- "separator": ""
253
- },
254
- "branch_action_default": "branch",
255
- "branch_order": ["user", "version", "type", "ticket", "description"],
256
- "worktrees": {
257
- "enable": true,
258
- "base_path": "..",
259
- "folder_template": "{{repo_name}}-{{ticket}}-{{branch_description}}"
298
+
299
+ // Allowed values: "" | "/" | "-" | "_"
300
+ "separator": "",
260
301
  },
261
- "overrides": {
262
- "shell": "/bin/sh"
263
- }
264
- }
265
- ```
266
302
 
267
- </details>
303
+ // "branch" | "worktree"
304
+ "branch_action_default": "branch",
268
305
 
269
- > [!NOTE]<br>
270
- > Some properties allow a set of specific string values
271
- >
272
- > - See _config file explanations_ for possible values
306
+ // Order of values in the final branch name
307
+ "branch_order": ["user", "version", "type", "ticket", "description"],
273
308
 
274
- ### 🔭 Config File Explanations
309
+ // Deprecated, prefer `worktrees.enable`
310
+ "enable_worktrees": true,
275
311
 
276
- Expand to see explanations and possible values
312
+ "worktrees": {
313
+ // If false, always create a branch instead of prompting for a worktree
314
+ "enable": true,
277
315
 
278
- <details>
279
- <summary>Expand / Collapse</summary>
316
+ // Directory where worktrees are created
317
+ "base_path": "..",
280
318
 
281
- `.` refers to nesting. i.e. if a property is `commit_type.enable` then expect in the config for it to be:
319
+ // Available template variables include:
320
+ // {{repo_name}}, {{branch_description}}, {{user}}, {{type}}, {{ticket}}, {{version}}
321
+ "folder_template": "{{repo_name}}-{{ticket}}-{{branch_description}}",
322
+ },
282
323
 
283
- ```json
284
- "commit_type": {
285
- "enable": true
324
+ /* OTHER FIELDS */
325
+ "overrides": {
326
+ // Useful on Windows or for shells with different multiline behavior
327
+ "shell": "/bin/sh",
328
+ },
286
329
  }
287
330
  ```
288
331
 
289
- | Property | Description |
290
- | ------------------------------------------ | --------------------------------------------------------------------------------------------------- |
291
- | `check_status` | If true run interactive `git status` |
292
- | `commit_type.enable` | If true include commit type |
293
- | `commit_type.initial_value` | Initial selection of commit type |
294
- | `commit_type.max_items` | Maximum number of type displayed on the screen |
295
- | `commit_type.infer_type_from_branch` | If true infer type from branch name |
296
- | `commit_type.append_emoji_to_label` | If true append emoji to prompt |
297
- | `commit_type.append_emoji_to_commit` | If true append emoji to commit |
298
- | `commit_type.emoji_commit_position` | Emoji position, "Start" (default) or "After-Colon" |
299
- | `commit_type.options.value` | Commit type prompt value |
300
- | `commit_type.options.label` | Commit type prompt label |
301
- | `commit_type.options.hint` | Commit type inline hint (like this) |
302
- | `commit_type.options.emoji` | Commit type emoji |
303
- | `commit_type.options.trailer` | Commit type trailer |
304
- | `commit_scope.enable` | If true include commit scope |
305
- | `commit_scope.custom_scope` | If true allow custom scope at run-time |
306
- | `commit_scope.initial_value` | Default commit scope selected |
307
- | `commit_scope.max_items` | Maximum number of scope displayed on the screen |
308
- | `commit_scope.options.value` | Commit scope value |
309
- | `commit_scope.options.label` | Commit scope label |
310
- | `check_ticket.infer_ticket` | If true infer ticket from branch name |
311
- | `check_ticket.confirm_ticket` | If true manually confirm inference |
312
- | `check_ticket.add_to_title` | If true add ticket to title |
313
- | `check_ticket.append_hashtag` | **Deprecated**: see prepend_hashtag |
314
- | `check_ticket.prepend_hashtag` | "Never" (default), "Prompt", or "Always" |
315
- | `check_ticket.title_position` | "start" (of description) (default), "end", "before-colon", "beginning" (of the entire commit title) |
316
- | `check_ticket.surround` | "" (default), "[]", "()", "{}" - Wraps ticket in title |
317
- | `commit_title.max_size` | Max size of title including scope, type, etc... |
318
- | `commit_body.enable` | If true include body |
319
- | `commit_body.required` | If true body is required |
320
- | `commit_body.split_by_period` | Automatically split sentences into new lines |
321
- | `commit_footer.enable` | If true include footer |
322
- | `commit_footer.initial_value` | Initial values selected in footer |
323
- | `commit_footer.options` | Footer options |
324
- | `breaking_change.add_exclamation_to_title` | If true adds exclamation mark to title for breaking changes |
325
- | `confirm_commit` | If true manually confirm commit at end |
326
- | `confirm_with_editor` | Confirm / Edit commit with $GIT_EDITOR / $EDITOR |
327
- | `cache_last_value` | Reuse last prompt value after cancel |
328
- | `print_commit_output` | If true pretty print commit preview |
329
- | `overrides.shell` | Override default shell, useful for windows users |
330
-
331
- Branch configuration (same config file, split for readability)
332
-
333
- | Property | Description |
334
- | ------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------- |
335
- | `branch_pre_commands` | Array of shell commands to run before branching |
336
- | `branch_post_commands` | Array of shell commands to run after branching |
337
- | `worktree_pre_commands` | Array of shell commands to run before creating worktree |
338
- | `worktree_post_commands` | Array of shell commands to run after creating worktree |
339
- | `branch_user.enable` | If enabled include user name |
340
- | `branch_user.required` | If enabled require user name |
341
- | `branch_user.separator` | Branch delimeter - "/" (default), "-", "\_" |
342
- | `branch_type.enable` | If enabled include type |
343
- | `branch_type.separator` | Branch delimeter - "/" (default), "-", "\_" |
344
- | `branch_ticket.enable` | If enabled include ticket |
345
- | `branch_ticket.required` | If enabled require ticket |
346
- | `branch_ticket.separator` | Branch delimeter - "/", "-" (default), "\_" |
347
- | `branch_description.max_length` | Max length branch name |
348
- | `branch_description.separator` | Branch delimeter - "" (default), "/", "-", "\_" |
349
- | `branch_version.enable` | If enabled include version |
350
- | `branch_version.required` | If enabled require version |
351
- | `branch_version.separator` | Branch delimeter - "", "/" (default), "-", "\_" |
352
- | `branch_order` | Order of branch name values (doesn't affect prompt order) |
353
- | `branch_action_default` | "branch" or "worktree" |
354
- | `enable_worktrees` | `Deprecated` see `worktrees.enable` |
355
- | `worktrees.enable` | If false, always default to branch action |
356
- | `worktrees.base_path` | Directory where worktrees are created (default: "..") |
357
- | `worktrees.folder_template` | Template for worktree folder names with variables like {{repo_name}}, {{branch_description}}, {{user}}, {{type}}, {{ticket}}, {{version}} |
358
-
359
- </details>
360
-
361
332
  ### 🔎 Inference
362
333
 
363
334
  `better-commits` will attempt to infer the ticket/issue and the commit-type from your branch name. It will auto populate the corresponding field if found.
@@ -406,7 +377,7 @@ Optionally configure pre and post checkout commands, for example:
406
377
 
407
378
  See _branch_pre_commands_ and _branch_post_commands_ in default config. (or _worktree_pre_commands_ and _worktree_post_commands_ for creating worktrees)
408
379
 
409
- ## 🌌 Mildly Interesting
380
+ ## 💡 Tips & Tricks
410
381
 
411
382
  ### Building / Versioning
412
383
 
@@ -427,7 +398,7 @@ If you're using Github issues to track your work, and select the `closes` footer
427
398
 
428
399
  `better-commits` can append a commit trailer per commit type. This allows you to [automate change logs](https://docs.gitlab.com/ee/user/project/changelogs.html) with tools like Gitlab.
429
400
 
430
- ### Misc
401
+ ### Git
431
402
 
432
403
  `better-commits` uses native `git` commands under the hood. So any hooks, tools, or staging should work as if it was a normal commit.
433
404
 
@@ -436,11 +407,13 @@ Setting `confirm_with_editor=true` will allow you to edit/confirm a commit with
436
407
  - For example, to edit with Neovim: `git config --global core.editor "nvim"`
437
408
  - For VS Code, `git config --global core.editor "code -n --wait"`
438
409
 
439
- You can add this badge to your repository to display that you're using a better-commits repository config
410
+ You can pass arguments to `git` through `better-commits` like so:
411
+
412
+ ```sh
413
+ better-commits --git-dir="$HOME/.config" --work-tree="$HOME"
414
+ ```
440
415
 
441
- | Markdown | Result |
442
- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
443
- | `[![better commits is enabled](https://img.shields.io/badge/better--commits-enabled?style=for-the-badge&logo=git&color=a6e3a1&logoColor=D9E0EE&labelColor=302D41)](https://github.com/Everduin94/better-commits)` | [![better commits is enabled](https://img.shields.io/badge/better--commits-enabled?style=for-the-badge&logo=git&color=a6e3a1&logoColor=D9E0EE&labelColor=302D41)](https://github.com/Everduin94/better-commits) |
416
+ A practical example of this would be managing dotfiles, as described in this [Atlassian Article](https://www.atlassian.com/git/tutorials/dotfiles)
444
417
 
445
418
  ### CLI Flags
446
419
 
@@ -449,21 +422,16 @@ Use CLI flags to pass commit values directly instead of answering prompts.
449
422
  - Use `--no-interactive` to skip prompts, confirmation, and editor flows. This is the recommended mode for OpenCode, Claude Code, and other coding agents.
450
423
  - Use `--dry-run` to validate the generated `git commit` command without creating a commit.
451
424
  - Supported commit field flags: `--type`, `--scope`, `--title`, `--body`, `--ticket`, `--closes`, `--deprecates`, `--breaking-title`, `--breaking-body`, `--deprecates-title`, `--deprecates-body`, `--custom-footer`, `--trailer`.
425
+ - Supported branch field flags: `--user`, `--type`, `--description`, `--ticket`, `--branch-version`, `--checkout`.
426
+
427
+ **Examples**
452
428
 
453
429
  ```sh
454
430
  better-commits --no-interactive --dry-run --type feat --scope cli --title "add parser"
455
- ```
456
-
457
- ### Git Arguments
458
431
 
459
- You can pass arguments to `git` through `better-commits` like so:
460
-
461
- ```sh
462
- better-commits --git-dir="$HOME/.config" --work-tree="$HOME"
432
+ better-branch --no-interactive --type feat --ticket TAC-123 --description "add parser" --checkout worktree
463
433
  ```
464
434
 
465
- A practical example of this would be managing dotfiles, as described in this [Atlassian Article](https://www.atlassian.com/git/tutorials/dotfiles)
466
-
467
435
  ---
468
436
 
469
437
  ### 🪟 Troubleshooting Windows
@@ -474,7 +442,7 @@ A practical example of this would be managing dotfiles, as described in this [At
474
442
 
475
443
  #### Multi-line
476
444
 
477
- If your are having issues with multilines for commits on windows, you can override the shell via your `.better-commits.json` config.
445
+ If your are having issues with multilines for commits on windows, you can override the shell via your `.better-commits.jsonc` config.
478
446
 
479
447
  Example
480
448
 
@@ -1,52 +0,0 @@
1
- {
2
- "commit_type": {
3
- "append_emoji_to_label": true,
4
- "append_emoji_to_commit": false
5
- },
6
- "commit_body": {
7
- "split_by_period": true
8
- },
9
- "commit_scope": {
10
- "enable": true,
11
- "initial_value": "commit",
12
- "options": [
13
- {
14
- "value": "commit",
15
- "label": "commit"
16
- },
17
- {
18
- "value": "branch",
19
- "label": "branch"
20
- },
21
- {
22
- "value": "init",
23
- "label": "init"
24
- },
25
- {
26
- "value": "util",
27
- "label": "util"
28
- },
29
- {
30
- "value": "build",
31
- "label": "build"
32
- },
33
- {
34
- "value": "help",
35
- "label": "help"
36
- },
37
- {
38
- "value": "",
39
- "label": "none"
40
- }
41
- ]
42
- },
43
- "check_ticket": {
44
- "prepend_hashtag": "Always"
45
- },
46
- "branch_pre_commands": [
47
- "git stash",
48
- "git checkout main",
49
- "git pull -r origin main",
50
- "npm install"
51
- ]
52
- }
@@ -1,34 +0,0 @@
1
- name: Publish to NPM
2
-
3
- on:
4
- push:
5
- branches:
6
- - main
7
-
8
- jobs:
9
- publish:
10
- name: Publish
11
- runs-on: ubuntu-latest
12
- permissions:
13
- contents: write
14
- issues: write
15
- pull-requests: write
16
- id-token: write
17
- steps:
18
- - name: Checkout
19
- uses: actions/checkout@v4
20
- with:
21
- fetch-depth: 0
22
- - name: Setup Node.js
23
- uses: actions/setup-node@v4
24
- with:
25
- node-version: "lts/*"
26
- registry-url: "https://registry.npmjs.org"
27
- - name: Install dependencies
28
- run: npm ci
29
- - name: Build package
30
- run: npm run build
31
- - name: Release
32
- env:
33
- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
34
- run: npx semantic-release
@@ -1,27 +0,0 @@
1
- name: Test
2
-
3
- on:
4
- pull_request:
5
- push:
6
- branches:
7
- - main
8
-
9
- jobs:
10
- test:
11
- name: npm test
12
- runs-on: ubuntu-latest
13
- steps:
14
- - name: Checkout
15
- uses: actions/checkout@v4
16
-
17
- - name: Setup Node.js
18
- uses: actions/setup-node@v4
19
- with:
20
- node-version: "lts/*"
21
- cache: npm
22
-
23
- - name: Install dependencies
24
- run: npm ci
25
-
26
- - name: Run tests
27
- run: npm run test