better-commits 1.10.0 → 1.12.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.
- package/dist/branch.js +45 -13
- package/dist/index.js +28 -4
- package/dist/init.js +22 -4
- package/dist/utils.js +28 -4
- package/dist/zod-state.js +22 -4
- package/package.json +1 -1
- package/readme.md +41 -7
- package/src/branch.ts +25 -5
- package/src/index.ts +7 -1
- package/src/utils.ts +16 -2
- package/src/zod-state.ts +13 -0
package/dist/branch.js
CHANGED
|
@@ -43,10 +43,10 @@ var OPTIONAL_PROMPT = `${import_picocolors.default.dim("(optional)")}`;
|
|
|
43
43
|
var CACHE_PROMPT = `${import_picocolors.default.dim("(value will be saved)")}`;
|
|
44
44
|
var REGEX_SLASH_TAG = new RegExp(/\/(\w+-\d+)/);
|
|
45
45
|
var REGEX_START_TAG = new RegExp(/^(\w+-\d+)/);
|
|
46
|
-
var REGEX_SLASH_NUM = new RegExp(/\/(\d+)/);
|
|
47
|
-
var REGEX_START_NUM = new RegExp(/^(\d+)/);
|
|
48
46
|
var REGEX_START_UND = new RegExp(/^([A-Z]+-[\[a-zA-Z\]\d]+)_/);
|
|
49
47
|
var REGEX_SLASH_UND = new RegExp(/\/([A-Z]+-[\[a-zA-Z\]\d]+)_/);
|
|
48
|
+
var REGEX_SLASH_NUM = new RegExp(/\/(\d+)/);
|
|
49
|
+
var REGEX_START_NUM = new RegExp(/^(\d+)/);
|
|
50
50
|
var DEFAULT_TYPE_OPTIONS = [
|
|
51
51
|
{ value: "feat", label: "feat", hint: "A new feature", emoji: "\u2728", trailer: "Changelog: feature" },
|
|
52
52
|
{ value: "fix", label: "fix", hint: "A bug fix", emoji: "\u{1F41B}", trailer: "Changelog: fix" },
|
|
@@ -116,6 +116,15 @@ var Z_FOOTER_OPTIONS = import_zod.z.enum([
|
|
|
116
116
|
"deprecated",
|
|
117
117
|
"custom"
|
|
118
118
|
]);
|
|
119
|
+
var Z_BRANCH_FIELDS = import_zod.z.enum(["user", "version", "type", "ticket", "description"]);
|
|
120
|
+
var Z_BRANCH_CONFIG_FIELDS = import_zod.z.enum([
|
|
121
|
+
"branch_user",
|
|
122
|
+
"branch_version",
|
|
123
|
+
"branch_type",
|
|
124
|
+
"branch_ticket",
|
|
125
|
+
"branch_description"
|
|
126
|
+
]);
|
|
127
|
+
var BRANCH_ORDER_DEFAULTS = ["user", "version", "type", "ticket", "description"];
|
|
119
128
|
var Z_BRANCH_ACTIONS = import_zod.z.enum(["branch", "worktree"]);
|
|
120
129
|
var FOOTER_OPTION_VALUES = [
|
|
121
130
|
"closes",
|
|
@@ -271,6 +280,7 @@ var Config = import_zod2.z.object({
|
|
|
271
280
|
breaking_change: import_zod2.z.object({
|
|
272
281
|
add_exclamation_to_title: import_zod2.z.boolean().default(true)
|
|
273
282
|
}).default({}),
|
|
283
|
+
confirm_with_editor: import_zod2.z.boolean().default(false),
|
|
274
284
|
confirm_commit: import_zod2.z.boolean().default(true),
|
|
275
285
|
print_commit_output: import_zod2.z.boolean().default(true),
|
|
276
286
|
branch_pre_commands: import_zod2.z.array(import_zod2.z.string()).default([]),
|
|
@@ -286,15 +296,22 @@ var Config = import_zod2.z.object({
|
|
|
286
296
|
enable: import_zod2.z.boolean().default(true),
|
|
287
297
|
separator: import_zod2.z.enum(["/", "-", "_"]).default("/")
|
|
288
298
|
}).default({}),
|
|
299
|
+
branch_version: import_zod2.z.object({
|
|
300
|
+
enable: import_zod2.z.boolean().default(false),
|
|
301
|
+
required: import_zod2.z.boolean().default(false),
|
|
302
|
+
separator: import_zod2.z.enum(["/", "-", "_"]).default("/")
|
|
303
|
+
}).default({}),
|
|
289
304
|
branch_ticket: import_zod2.z.object({
|
|
290
305
|
enable: import_zod2.z.boolean().default(true),
|
|
291
306
|
required: import_zod2.z.boolean().default(false),
|
|
292
307
|
separator: import_zod2.z.enum(["/", "-", "_"]).default("-")
|
|
293
308
|
}).default({}),
|
|
294
309
|
branch_description: import_zod2.z.object({
|
|
295
|
-
max_length: import_zod2.z.number().positive().default(70)
|
|
310
|
+
max_length: import_zod2.z.number().positive().default(70),
|
|
311
|
+
separator: import_zod2.z.enum(["", "/", "-", "_"]).default("")
|
|
296
312
|
}).default({}),
|
|
297
313
|
branch_action_default: Z_BRANCH_ACTIONS.default("branch"),
|
|
314
|
+
branch_order: import_zod2.z.array(Z_BRANCH_FIELDS).default(BRANCH_ORDER_DEFAULTS),
|
|
298
315
|
enable_worktrees: import_zod2.z.boolean().default(true),
|
|
299
316
|
overrides: import_zod2.z.object({ shell: import_zod2.z.string().optional() }).default({})
|
|
300
317
|
}).default({});
|
|
@@ -317,7 +334,8 @@ var BranchState = import_zod2.z.object({
|
|
|
317
334
|
user: import_zod2.z.string().default(""),
|
|
318
335
|
type: import_zod2.z.string().default(""),
|
|
319
336
|
ticket: import_zod2.z.string().default(""),
|
|
320
|
-
description: import_zod2.z.string().default("")
|
|
337
|
+
description: import_zod2.z.string().default(""),
|
|
338
|
+
version: import_zod2.z.string().default("")
|
|
321
339
|
}).default({});
|
|
322
340
|
|
|
323
341
|
// src/branch.ts
|
|
@@ -382,6 +400,20 @@ async function main(config) {
|
|
|
382
400
|
process.exit(0);
|
|
383
401
|
branch_state.ticket = ticket;
|
|
384
402
|
}
|
|
403
|
+
if (config.branch_version.enable) {
|
|
404
|
+
const version_required = config.branch_version.required;
|
|
405
|
+
const version = await p2.text({
|
|
406
|
+
message: `Type version number ${version_required ? "" : OPTIONAL_PROMPT}`.trim(),
|
|
407
|
+
placeholder: "",
|
|
408
|
+
validate: (val) => {
|
|
409
|
+
if (version_required && !val)
|
|
410
|
+
return "Please enter a version";
|
|
411
|
+
}
|
|
412
|
+
});
|
|
413
|
+
if (p2.isCancel(version))
|
|
414
|
+
process.exit(0);
|
|
415
|
+
branch_state.version = version;
|
|
416
|
+
}
|
|
385
417
|
const description_max_length = config.branch_description.max_length;
|
|
386
418
|
const description = await p2.text({
|
|
387
419
|
message: "Type a short description",
|
|
@@ -457,15 +489,15 @@ async function main(config) {
|
|
|
457
489
|
}
|
|
458
490
|
function build_branch(branch, config) {
|
|
459
491
|
let res = "";
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
return res;
|
|
492
|
+
config.branch_order.forEach((b) => {
|
|
493
|
+
const config_key = `branch_${b}`;
|
|
494
|
+
if (branch[b])
|
|
495
|
+
res += branch[b] + config[config_key].separator;
|
|
496
|
+
});
|
|
497
|
+
if (res.endsWith("-") || res.endsWith("/") || res.endsWith("_")) {
|
|
498
|
+
return res.slice(0, -1).trim();
|
|
499
|
+
}
|
|
500
|
+
return res.trim();
|
|
469
501
|
}
|
|
470
502
|
function get_user_from_cache() {
|
|
471
503
|
try {
|
package/dist/index.js
CHANGED
|
@@ -59,10 +59,10 @@ var OPTIONAL_PROMPT = `${import_picocolors.default.dim("(optional)")}`;
|
|
|
59
59
|
var CACHE_PROMPT = `${import_picocolors.default.dim("(value will be saved)")}`;
|
|
60
60
|
var REGEX_SLASH_TAG = new RegExp(/\/(\w+-\d+)/);
|
|
61
61
|
var REGEX_START_TAG = new RegExp(/^(\w+-\d+)/);
|
|
62
|
-
var REGEX_SLASH_NUM = new RegExp(/\/(\d+)/);
|
|
63
|
-
var REGEX_START_NUM = new RegExp(/^(\d+)/);
|
|
64
62
|
var REGEX_START_UND = new RegExp(/^([A-Z]+-[\[a-zA-Z\]\d]+)_/);
|
|
65
63
|
var REGEX_SLASH_UND = new RegExp(/\/([A-Z]+-[\[a-zA-Z\]\d]+)_/);
|
|
64
|
+
var REGEX_SLASH_NUM = new RegExp(/\/(\d+)/);
|
|
65
|
+
var REGEX_START_NUM = new RegExp(/^(\d+)/);
|
|
66
66
|
var DEFAULT_TYPE_OPTIONS = [
|
|
67
67
|
{ value: "feat", label: "feat", hint: "A new feature", emoji: "\u2728", trailer: "Changelog: feature" },
|
|
68
68
|
{ value: "fix", label: "fix", hint: "A bug fix", emoji: "\u{1F41B}", trailer: "Changelog: fix" },
|
|
@@ -151,6 +151,15 @@ var Z_FOOTER_OPTIONS = import_zod.z.enum([
|
|
|
151
151
|
"deprecated",
|
|
152
152
|
"custom"
|
|
153
153
|
]);
|
|
154
|
+
var Z_BRANCH_FIELDS = import_zod.z.enum(["user", "version", "type", "ticket", "description"]);
|
|
155
|
+
var Z_BRANCH_CONFIG_FIELDS = import_zod.z.enum([
|
|
156
|
+
"branch_user",
|
|
157
|
+
"branch_version",
|
|
158
|
+
"branch_type",
|
|
159
|
+
"branch_ticket",
|
|
160
|
+
"branch_description"
|
|
161
|
+
]);
|
|
162
|
+
var BRANCH_ORDER_DEFAULTS = ["user", "version", "type", "ticket", "description"];
|
|
154
163
|
var Z_BRANCH_ACTIONS = import_zod.z.enum(["branch", "worktree"]);
|
|
155
164
|
var FOOTER_OPTION_VALUES = [
|
|
156
165
|
"closes",
|
|
@@ -335,6 +344,7 @@ var Config = import_zod2.z.object({
|
|
|
335
344
|
breaking_change: import_zod2.z.object({
|
|
336
345
|
add_exclamation_to_title: import_zod2.z.boolean().default(true)
|
|
337
346
|
}).default({}),
|
|
347
|
+
confirm_with_editor: import_zod2.z.boolean().default(false),
|
|
338
348
|
confirm_commit: import_zod2.z.boolean().default(true),
|
|
339
349
|
print_commit_output: import_zod2.z.boolean().default(true),
|
|
340
350
|
branch_pre_commands: import_zod2.z.array(import_zod2.z.string()).default([]),
|
|
@@ -350,15 +360,22 @@ var Config = import_zod2.z.object({
|
|
|
350
360
|
enable: import_zod2.z.boolean().default(true),
|
|
351
361
|
separator: import_zod2.z.enum(["/", "-", "_"]).default("/")
|
|
352
362
|
}).default({}),
|
|
363
|
+
branch_version: import_zod2.z.object({
|
|
364
|
+
enable: import_zod2.z.boolean().default(false),
|
|
365
|
+
required: import_zod2.z.boolean().default(false),
|
|
366
|
+
separator: import_zod2.z.enum(["/", "-", "_"]).default("/")
|
|
367
|
+
}).default({}),
|
|
353
368
|
branch_ticket: import_zod2.z.object({
|
|
354
369
|
enable: import_zod2.z.boolean().default(true),
|
|
355
370
|
required: import_zod2.z.boolean().default(false),
|
|
356
371
|
separator: import_zod2.z.enum(["/", "-", "_"]).default("-")
|
|
357
372
|
}).default({}),
|
|
358
373
|
branch_description: import_zod2.z.object({
|
|
359
|
-
max_length: import_zod2.z.number().positive().default(70)
|
|
374
|
+
max_length: import_zod2.z.number().positive().default(70),
|
|
375
|
+
separator: import_zod2.z.enum(["", "/", "-", "_"]).default("")
|
|
360
376
|
}).default({}),
|
|
361
377
|
branch_action_default: Z_BRANCH_ACTIONS.default("branch"),
|
|
378
|
+
branch_order: import_zod2.z.array(Z_BRANCH_FIELDS).default(BRANCH_ORDER_DEFAULTS),
|
|
362
379
|
enable_worktrees: import_zod2.z.boolean().default(true),
|
|
363
380
|
overrides: import_zod2.z.object({ shell: import_zod2.z.string().optional() }).default({})
|
|
364
381
|
}).default({});
|
|
@@ -381,7 +398,8 @@ var BranchState = import_zod2.z.object({
|
|
|
381
398
|
user: import_zod2.z.string().default(""),
|
|
382
399
|
type: import_zod2.z.string().default(""),
|
|
383
400
|
ticket: import_zod2.z.string().default(""),
|
|
384
|
-
description: import_zod2.z.string().default("")
|
|
401
|
+
description: import_zod2.z.string().default(""),
|
|
402
|
+
version: import_zod2.z.string().default("")
|
|
385
403
|
}).default({});
|
|
386
404
|
|
|
387
405
|
// src/git.ts
|
|
@@ -629,6 +647,12 @@ async function main(config) {
|
|
|
629
647
|
commit_state.trailer = "";
|
|
630
648
|
}
|
|
631
649
|
}
|
|
650
|
+
if (config.confirm_with_editor) {
|
|
651
|
+
const options = config.overrides.shell ? { shell: config.overrides.shell, stdio: "inherit" } : { stdio: "inherit" };
|
|
652
|
+
const trailer = commit_state.trailer ? `--trailer="${commit_state.trailer}"` : "";
|
|
653
|
+
(0, import_child_process3.execSync)(`git commit -m "${build_commit_string(commit_state, config, false, true, false)}" ${trailer} --edit`, options);
|
|
654
|
+
process.exit(0);
|
|
655
|
+
}
|
|
632
656
|
let continue_commit = true;
|
|
633
657
|
p3.note(build_commit_string(commit_state, config, true, false, true), "Commit Preview");
|
|
634
658
|
if (config.confirm_commit) {
|
package/dist/init.js
CHANGED
|
@@ -41,10 +41,10 @@ var OPTIONAL_PROMPT = `${import_picocolors.default.dim("(optional)")}`;
|
|
|
41
41
|
var CACHE_PROMPT = `${import_picocolors.default.dim("(value will be saved)")}`;
|
|
42
42
|
var REGEX_SLASH_TAG = new RegExp(/\/(\w+-\d+)/);
|
|
43
43
|
var REGEX_START_TAG = new RegExp(/^(\w+-\d+)/);
|
|
44
|
-
var REGEX_SLASH_NUM = new RegExp(/\/(\d+)/);
|
|
45
|
-
var REGEX_START_NUM = new RegExp(/^(\d+)/);
|
|
46
44
|
var REGEX_START_UND = new RegExp(/^([A-Z]+-[\[a-zA-Z\]\d]+)_/);
|
|
47
45
|
var REGEX_SLASH_UND = new RegExp(/\/([A-Z]+-[\[a-zA-Z\]\d]+)_/);
|
|
46
|
+
var REGEX_SLASH_NUM = new RegExp(/\/(\d+)/);
|
|
47
|
+
var REGEX_START_NUM = new RegExp(/^(\d+)/);
|
|
48
48
|
var DEFAULT_TYPE_OPTIONS = [
|
|
49
49
|
{ value: "feat", label: "feat", hint: "A new feature", emoji: "\u2728", trailer: "Changelog: feature" },
|
|
50
50
|
{ value: "fix", label: "fix", hint: "A bug fix", emoji: "\u{1F41B}", trailer: "Changelog: fix" },
|
|
@@ -114,6 +114,15 @@ var Z_FOOTER_OPTIONS = import_zod.z.enum([
|
|
|
114
114
|
"deprecated",
|
|
115
115
|
"custom"
|
|
116
116
|
]);
|
|
117
|
+
var Z_BRANCH_FIELDS = import_zod.z.enum(["user", "version", "type", "ticket", "description"]);
|
|
118
|
+
var Z_BRANCH_CONFIG_FIELDS = import_zod.z.enum([
|
|
119
|
+
"branch_user",
|
|
120
|
+
"branch_version",
|
|
121
|
+
"branch_type",
|
|
122
|
+
"branch_ticket",
|
|
123
|
+
"branch_description"
|
|
124
|
+
]);
|
|
125
|
+
var BRANCH_ORDER_DEFAULTS = ["user", "version", "type", "ticket", "description"];
|
|
117
126
|
var Z_BRANCH_ACTIONS = import_zod.z.enum(["branch", "worktree"]);
|
|
118
127
|
var FOOTER_OPTION_VALUES = [
|
|
119
128
|
"closes",
|
|
@@ -223,6 +232,7 @@ var Config = import_zod2.z.object({
|
|
|
223
232
|
breaking_change: import_zod2.z.object({
|
|
224
233
|
add_exclamation_to_title: import_zod2.z.boolean().default(true)
|
|
225
234
|
}).default({}),
|
|
235
|
+
confirm_with_editor: import_zod2.z.boolean().default(false),
|
|
226
236
|
confirm_commit: import_zod2.z.boolean().default(true),
|
|
227
237
|
print_commit_output: import_zod2.z.boolean().default(true),
|
|
228
238
|
branch_pre_commands: import_zod2.z.array(import_zod2.z.string()).default([]),
|
|
@@ -238,15 +248,22 @@ var Config = import_zod2.z.object({
|
|
|
238
248
|
enable: import_zod2.z.boolean().default(true),
|
|
239
249
|
separator: import_zod2.z.enum(["/", "-", "_"]).default("/")
|
|
240
250
|
}).default({}),
|
|
251
|
+
branch_version: import_zod2.z.object({
|
|
252
|
+
enable: import_zod2.z.boolean().default(false),
|
|
253
|
+
required: import_zod2.z.boolean().default(false),
|
|
254
|
+
separator: import_zod2.z.enum(["/", "-", "_"]).default("/")
|
|
255
|
+
}).default({}),
|
|
241
256
|
branch_ticket: import_zod2.z.object({
|
|
242
257
|
enable: import_zod2.z.boolean().default(true),
|
|
243
258
|
required: import_zod2.z.boolean().default(false),
|
|
244
259
|
separator: import_zod2.z.enum(["/", "-", "_"]).default("-")
|
|
245
260
|
}).default({}),
|
|
246
261
|
branch_description: import_zod2.z.object({
|
|
247
|
-
max_length: import_zod2.z.number().positive().default(70)
|
|
262
|
+
max_length: import_zod2.z.number().positive().default(70),
|
|
263
|
+
separator: import_zod2.z.enum(["", "/", "-", "_"]).default("")
|
|
248
264
|
}).default({}),
|
|
249
265
|
branch_action_default: Z_BRANCH_ACTIONS.default("branch"),
|
|
266
|
+
branch_order: import_zod2.z.array(Z_BRANCH_FIELDS).default(BRANCH_ORDER_DEFAULTS),
|
|
250
267
|
enable_worktrees: import_zod2.z.boolean().default(true),
|
|
251
268
|
overrides: import_zod2.z.object({ shell: import_zod2.z.string().optional() }).default({})
|
|
252
269
|
}).default({});
|
|
@@ -269,7 +286,8 @@ var BranchState = import_zod2.z.object({
|
|
|
269
286
|
user: import_zod2.z.string().default(""),
|
|
270
287
|
type: import_zod2.z.string().default(""),
|
|
271
288
|
ticket: import_zod2.z.string().default(""),
|
|
272
|
-
description: import_zod2.z.string().default("")
|
|
289
|
+
description: import_zod2.z.string().default(""),
|
|
290
|
+
version: import_zod2.z.string().default("")
|
|
273
291
|
}).default({});
|
|
274
292
|
|
|
275
293
|
// src/init.ts
|
package/dist/utils.js
CHANGED
|
@@ -32,6 +32,7 @@ var utils_exports = {};
|
|
|
32
32
|
__export(utils_exports, {
|
|
33
33
|
A_FOR_ALL: () => A_FOR_ALL,
|
|
34
34
|
BRANCH_ACTION_OPTIONS: () => BRANCH_ACTION_OPTIONS,
|
|
35
|
+
BRANCH_ORDER_DEFAULTS: () => BRANCH_ORDER_DEFAULTS,
|
|
35
36
|
CACHE_PROMPT: () => CACHE_PROMPT,
|
|
36
37
|
COMMIT_FOOTER_OPTIONS: () => COMMIT_FOOTER_OPTIONS,
|
|
37
38
|
CONFIG_FILE_NAME: () => CONFIG_FILE_NAME,
|
|
@@ -48,6 +49,8 @@ __export(utils_exports, {
|
|
|
48
49
|
REGEX_START_UND: () => REGEX_START_UND,
|
|
49
50
|
SPACE_TO_SELECT: () => SPACE_TO_SELECT,
|
|
50
51
|
Z_BRANCH_ACTIONS: () => Z_BRANCH_ACTIONS,
|
|
52
|
+
Z_BRANCH_CONFIG_FIELDS: () => Z_BRANCH_CONFIG_FIELDS,
|
|
53
|
+
Z_BRANCH_FIELDS: () => Z_BRANCH_FIELDS,
|
|
51
54
|
Z_FOOTER_OPTIONS: () => Z_FOOTER_OPTIONS,
|
|
52
55
|
addNewLine: () => addNewLine,
|
|
53
56
|
clean_commit_title: () => clean_commit_title,
|
|
@@ -155,6 +158,7 @@ var Config = import_zod.z.object({
|
|
|
155
158
|
breaking_change: import_zod.z.object({
|
|
156
159
|
add_exclamation_to_title: import_zod.z.boolean().default(true)
|
|
157
160
|
}).default({}),
|
|
161
|
+
confirm_with_editor: import_zod.z.boolean().default(false),
|
|
158
162
|
confirm_commit: import_zod.z.boolean().default(true),
|
|
159
163
|
print_commit_output: import_zod.z.boolean().default(true),
|
|
160
164
|
branch_pre_commands: import_zod.z.array(import_zod.z.string()).default([]),
|
|
@@ -170,15 +174,22 @@ var Config = import_zod.z.object({
|
|
|
170
174
|
enable: import_zod.z.boolean().default(true),
|
|
171
175
|
separator: import_zod.z.enum(["/", "-", "_"]).default("/")
|
|
172
176
|
}).default({}),
|
|
177
|
+
branch_version: import_zod.z.object({
|
|
178
|
+
enable: import_zod.z.boolean().default(false),
|
|
179
|
+
required: import_zod.z.boolean().default(false),
|
|
180
|
+
separator: import_zod.z.enum(["/", "-", "_"]).default("/")
|
|
181
|
+
}).default({}),
|
|
173
182
|
branch_ticket: import_zod.z.object({
|
|
174
183
|
enable: import_zod.z.boolean().default(true),
|
|
175
184
|
required: import_zod.z.boolean().default(false),
|
|
176
185
|
separator: import_zod.z.enum(["/", "-", "_"]).default("-")
|
|
177
186
|
}).default({}),
|
|
178
187
|
branch_description: import_zod.z.object({
|
|
179
|
-
max_length: import_zod.z.number().positive().default(70)
|
|
188
|
+
max_length: import_zod.z.number().positive().default(70),
|
|
189
|
+
separator: import_zod.z.enum(["", "/", "-", "_"]).default("")
|
|
180
190
|
}).default({}),
|
|
181
191
|
branch_action_default: Z_BRANCH_ACTIONS.default("branch"),
|
|
192
|
+
branch_order: import_zod.z.array(Z_BRANCH_FIELDS).default(BRANCH_ORDER_DEFAULTS),
|
|
182
193
|
enable_worktrees: import_zod.z.boolean().default(true),
|
|
183
194
|
overrides: import_zod.z.object({ shell: import_zod.z.string().optional() }).default({})
|
|
184
195
|
}).default({});
|
|
@@ -201,7 +212,8 @@ var BranchState = import_zod.z.object({
|
|
|
201
212
|
user: import_zod.z.string().default(""),
|
|
202
213
|
type: import_zod.z.string().default(""),
|
|
203
214
|
ticket: import_zod.z.string().default(""),
|
|
204
|
-
description: import_zod.z.string().default("")
|
|
215
|
+
description: import_zod.z.string().default(""),
|
|
216
|
+
version: import_zod.z.string().default("")
|
|
205
217
|
}).default({});
|
|
206
218
|
|
|
207
219
|
// src/utils.ts
|
|
@@ -214,10 +226,10 @@ var OPTIONAL_PROMPT = `${import_picocolors.default.dim("(optional)")}`;
|
|
|
214
226
|
var CACHE_PROMPT = `${import_picocolors.default.dim("(value will be saved)")}`;
|
|
215
227
|
var REGEX_SLASH_TAG = new RegExp(/\/(\w+-\d+)/);
|
|
216
228
|
var REGEX_START_TAG = new RegExp(/^(\w+-\d+)/);
|
|
217
|
-
var REGEX_SLASH_NUM = new RegExp(/\/(\d+)/);
|
|
218
|
-
var REGEX_START_NUM = new RegExp(/^(\d+)/);
|
|
219
229
|
var REGEX_START_UND = new RegExp(/^([A-Z]+-[\[a-zA-Z\]\d]+)_/);
|
|
220
230
|
var REGEX_SLASH_UND = new RegExp(/\/([A-Z]+-[\[a-zA-Z\]\d]+)_/);
|
|
231
|
+
var REGEX_SLASH_NUM = new RegExp(/\/(\d+)/);
|
|
232
|
+
var REGEX_START_NUM = new RegExp(/^(\d+)/);
|
|
221
233
|
var DEFAULT_TYPE_OPTIONS = [
|
|
222
234
|
{ value: "feat", label: "feat", hint: "A new feature", emoji: "\u2728", trailer: "Changelog: feature" },
|
|
223
235
|
{ value: "fix", label: "fix", hint: "A bug fix", emoji: "\u{1F41B}", trailer: "Changelog: fix" },
|
|
@@ -306,6 +318,15 @@ var Z_FOOTER_OPTIONS = import_zod2.z.enum([
|
|
|
306
318
|
"deprecated",
|
|
307
319
|
"custom"
|
|
308
320
|
]);
|
|
321
|
+
var Z_BRANCH_FIELDS = import_zod2.z.enum(["user", "version", "type", "ticket", "description"]);
|
|
322
|
+
var Z_BRANCH_CONFIG_FIELDS = import_zod2.z.enum([
|
|
323
|
+
"branch_user",
|
|
324
|
+
"branch_version",
|
|
325
|
+
"branch_type",
|
|
326
|
+
"branch_ticket",
|
|
327
|
+
"branch_description"
|
|
328
|
+
]);
|
|
329
|
+
var BRANCH_ORDER_DEFAULTS = ["user", "version", "type", "ticket", "description"];
|
|
309
330
|
var Z_BRANCH_ACTIONS = import_zod2.z.enum(["branch", "worktree"]);
|
|
310
331
|
var FOOTER_OPTION_VALUES = [
|
|
311
332
|
"closes",
|
|
@@ -408,6 +429,7 @@ function clean_commit_title(title) {
|
|
|
408
429
|
0 && (module.exports = {
|
|
409
430
|
A_FOR_ALL,
|
|
410
431
|
BRANCH_ACTION_OPTIONS,
|
|
432
|
+
BRANCH_ORDER_DEFAULTS,
|
|
411
433
|
CACHE_PROMPT,
|
|
412
434
|
COMMIT_FOOTER_OPTIONS,
|
|
413
435
|
CONFIG_FILE_NAME,
|
|
@@ -424,6 +446,8 @@ function clean_commit_title(title) {
|
|
|
424
446
|
REGEX_START_UND,
|
|
425
447
|
SPACE_TO_SELECT,
|
|
426
448
|
Z_BRANCH_ACTIONS,
|
|
449
|
+
Z_BRANCH_CONFIG_FIELDS,
|
|
450
|
+
Z_BRANCH_FIELDS,
|
|
427
451
|
Z_FOOTER_OPTIONS,
|
|
428
452
|
addNewLine,
|
|
429
453
|
clean_commit_title,
|
package/dist/zod-state.js
CHANGED
|
@@ -50,10 +50,10 @@ var OPTIONAL_PROMPT = `${import_picocolors.default.dim("(optional)")}`;
|
|
|
50
50
|
var CACHE_PROMPT = `${import_picocolors.default.dim("(value will be saved)")}`;
|
|
51
51
|
var REGEX_SLASH_TAG = new RegExp(/\/(\w+-\d+)/);
|
|
52
52
|
var REGEX_START_TAG = new RegExp(/^(\w+-\d+)/);
|
|
53
|
-
var REGEX_SLASH_NUM = new RegExp(/\/(\d+)/);
|
|
54
|
-
var REGEX_START_NUM = new RegExp(/^(\d+)/);
|
|
55
53
|
var REGEX_START_UND = new RegExp(/^([A-Z]+-[\[a-zA-Z\]\d]+)_/);
|
|
56
54
|
var REGEX_SLASH_UND = new RegExp(/\/([A-Z]+-[\[a-zA-Z\]\d]+)_/);
|
|
55
|
+
var REGEX_SLASH_NUM = new RegExp(/\/(\d+)/);
|
|
56
|
+
var REGEX_START_NUM = new RegExp(/^(\d+)/);
|
|
57
57
|
var DEFAULT_TYPE_OPTIONS = [
|
|
58
58
|
{ value: "feat", label: "feat", hint: "A new feature", emoji: "\u2728", trailer: "Changelog: feature" },
|
|
59
59
|
{ value: "fix", label: "fix", hint: "A bug fix", emoji: "\u{1F41B}", trailer: "Changelog: fix" },
|
|
@@ -123,6 +123,15 @@ var Z_FOOTER_OPTIONS = import_zod.z.enum([
|
|
|
123
123
|
"deprecated",
|
|
124
124
|
"custom"
|
|
125
125
|
]);
|
|
126
|
+
var Z_BRANCH_FIELDS = import_zod.z.enum(["user", "version", "type", "ticket", "description"]);
|
|
127
|
+
var Z_BRANCH_CONFIG_FIELDS = import_zod.z.enum([
|
|
128
|
+
"branch_user",
|
|
129
|
+
"branch_version",
|
|
130
|
+
"branch_type",
|
|
131
|
+
"branch_ticket",
|
|
132
|
+
"branch_description"
|
|
133
|
+
]);
|
|
134
|
+
var BRANCH_ORDER_DEFAULTS = ["user", "version", "type", "ticket", "description"];
|
|
126
135
|
var Z_BRANCH_ACTIONS = import_zod.z.enum(["branch", "worktree"]);
|
|
127
136
|
var FOOTER_OPTION_VALUES = [
|
|
128
137
|
"closes",
|
|
@@ -221,6 +230,7 @@ var Config = import_zod2.z.object({
|
|
|
221
230
|
breaking_change: import_zod2.z.object({
|
|
222
231
|
add_exclamation_to_title: import_zod2.z.boolean().default(true)
|
|
223
232
|
}).default({}),
|
|
233
|
+
confirm_with_editor: import_zod2.z.boolean().default(false),
|
|
224
234
|
confirm_commit: import_zod2.z.boolean().default(true),
|
|
225
235
|
print_commit_output: import_zod2.z.boolean().default(true),
|
|
226
236
|
branch_pre_commands: import_zod2.z.array(import_zod2.z.string()).default([]),
|
|
@@ -236,15 +246,22 @@ var Config = import_zod2.z.object({
|
|
|
236
246
|
enable: import_zod2.z.boolean().default(true),
|
|
237
247
|
separator: import_zod2.z.enum(["/", "-", "_"]).default("/")
|
|
238
248
|
}).default({}),
|
|
249
|
+
branch_version: import_zod2.z.object({
|
|
250
|
+
enable: import_zod2.z.boolean().default(false),
|
|
251
|
+
required: import_zod2.z.boolean().default(false),
|
|
252
|
+
separator: import_zod2.z.enum(["/", "-", "_"]).default("/")
|
|
253
|
+
}).default({}),
|
|
239
254
|
branch_ticket: import_zod2.z.object({
|
|
240
255
|
enable: import_zod2.z.boolean().default(true),
|
|
241
256
|
required: import_zod2.z.boolean().default(false),
|
|
242
257
|
separator: import_zod2.z.enum(["/", "-", "_"]).default("-")
|
|
243
258
|
}).default({}),
|
|
244
259
|
branch_description: import_zod2.z.object({
|
|
245
|
-
max_length: import_zod2.z.number().positive().default(70)
|
|
260
|
+
max_length: import_zod2.z.number().positive().default(70),
|
|
261
|
+
separator: import_zod2.z.enum(["", "/", "-", "_"]).default("")
|
|
246
262
|
}).default({}),
|
|
247
263
|
branch_action_default: Z_BRANCH_ACTIONS.default("branch"),
|
|
264
|
+
branch_order: import_zod2.z.array(Z_BRANCH_FIELDS).default(BRANCH_ORDER_DEFAULTS),
|
|
248
265
|
enable_worktrees: import_zod2.z.boolean().default(true),
|
|
249
266
|
overrides: import_zod2.z.object({ shell: import_zod2.z.string().optional() }).default({})
|
|
250
267
|
}).default({});
|
|
@@ -267,7 +284,8 @@ var BranchState = import_zod2.z.object({
|
|
|
267
284
|
user: import_zod2.z.string().default(""),
|
|
268
285
|
type: import_zod2.z.string().default(""),
|
|
269
286
|
ticket: import_zod2.z.string().default(""),
|
|
270
|
-
description: import_zod2.z.string().default("")
|
|
287
|
+
description: import_zod2.z.string().default(""),
|
|
288
|
+
version: import_zod2.z.string().default("")
|
|
271
289
|
}).default({});
|
|
272
290
|
// Annotate the CommonJS export names for ESM import in node:
|
|
273
291
|
0 && (module.exports = {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "better-commits",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.12.0",
|
|
5
5
|
"description": "A CLI for creating better commits following the conventional commits specification",
|
|
6
6
|
"author": "Erik Verduin (https://github.com/everduin94)",
|
|
7
7
|
"keywords": [
|
package/readme.md
CHANGED
|
@@ -192,8 +192,8 @@ Better-commits (& better-branch) are highly flexible with sane defaults. These o
|
|
|
192
192
|
"confirm_ticket": true,
|
|
193
193
|
"add_to_title": true,
|
|
194
194
|
"append_hashtag": false,
|
|
195
|
-
"
|
|
196
|
-
"
|
|
195
|
+
"surround": "",
|
|
196
|
+
"title_position": "start"
|
|
197
197
|
},
|
|
198
198
|
"commit_title": {
|
|
199
199
|
"max_size": 70
|
|
@@ -217,6 +217,7 @@ Better-commits (& better-branch) are highly flexible with sane defaults. These o
|
|
|
217
217
|
"add_exclamation_to_title": true
|
|
218
218
|
},
|
|
219
219
|
"confirm_commit": true,
|
|
220
|
+
"confirm_with_editor": false,
|
|
220
221
|
"print_commit_output": true,
|
|
221
222
|
"branch_pre_commands": [],
|
|
222
223
|
"branch_post_commands": [],
|
|
@@ -231,15 +232,28 @@ Better-commits (& better-branch) are highly flexible with sane defaults. These o
|
|
|
231
232
|
"enable": true,
|
|
232
233
|
"separator": "/"
|
|
233
234
|
},
|
|
235
|
+
"branch_version": {
|
|
236
|
+
"enable": false,
|
|
237
|
+
"required": false,
|
|
238
|
+
"separator": "/"
|
|
239
|
+
},
|
|
234
240
|
"branch_ticket": {
|
|
235
241
|
"enable": true,
|
|
236
242
|
"required": false,
|
|
237
243
|
"separator": "-"
|
|
238
244
|
},
|
|
239
245
|
"branch_description": {
|
|
240
|
-
"max_length": 70
|
|
246
|
+
"max_length": 70,
|
|
247
|
+
"separator": ""
|
|
241
248
|
},
|
|
242
249
|
"branch_action_default": "branch",
|
|
250
|
+
"branch_order": [
|
|
251
|
+
"user",
|
|
252
|
+
"version",
|
|
253
|
+
"type",
|
|
254
|
+
"ticket",
|
|
255
|
+
"description"
|
|
256
|
+
],
|
|
243
257
|
"enable_worktrees": true,
|
|
244
258
|
"overrides": {
|
|
245
259
|
"shell": "/bin/sh"
|
|
@@ -294,19 +308,35 @@ Better-commits (& better-branch) are highly flexible with sane defaults. These o
|
|
|
294
308
|
| `commit_footer.options` | Footer options |
|
|
295
309
|
| `breaking_change.add_exclamation_to_title` | If true adds exclamation mark to title for breaking changes |
|
|
296
310
|
| `confirm_commit` | If true manually confirm commit at end |
|
|
311
|
+
| `confirm_with_editor` | Confirm / Edit commit with $GIT_EDITOR / $EDITOR |
|
|
297
312
|
| `print_commit_output` | If true pretty print commit preview |
|
|
313
|
+
| `overrides.shell` | Override default shell, useful for windows users |
|
|
314
|
+
|
|
315
|
+
Branch configuration (same config file, split for readability)
|
|
316
|
+
|
|
317
|
+
| Property | Description |
|
|
318
|
+
| -------- | ----------- |
|
|
298
319
|
| `branch_pre_commands` | Array of shell commands to run before branching |
|
|
299
320
|
| `branch_post_commands` | Array of shell commands to run after branching |
|
|
300
321
|
| `worktree_pre_commands` | Array of shell commands to run before creating worktree |
|
|
301
322
|
| `worktree_post_commands` | Array of shell commands to run after creating worktree |
|
|
302
323
|
| `branch_user.enable` | If enabled include user name |
|
|
303
324
|
| `branch_user.required` | If enabled require user name |
|
|
304
|
-
| `branch_user.separator` | Branch delimeter
|
|
325
|
+
| `branch_user.separator` | Branch delimeter - "/" (default), "-", "_" |
|
|
326
|
+
| `branch_type.enable` | If enabled include type |
|
|
327
|
+
| `branch_type.separator` | Branch delimeter - "/" (default), "-", "_" |
|
|
328
|
+
| `branch_ticket.enable` | If enabled include ticket |
|
|
329
|
+
| `branch_ticket.required` | If enabled require ticket |
|
|
330
|
+
| `branch_ticket.separator` | Branch delimeter - "/", "-" (default), "_" |
|
|
305
331
|
| `branch_description.max_length` | Max length branch name |
|
|
306
|
-
| `
|
|
332
|
+
| `branch_description.separator` | Branch delimeter - "" (default), "/", "-", "_" |
|
|
333
|
+
| `branch_version.enable` | If enabled include version |
|
|
334
|
+
| `branch_version.required` | If enabled require version |
|
|
335
|
+
| `branch_version.separator` | Branch delimeter - "", "/" (default), "-", "_" |
|
|
336
|
+
| `branch_order` | Order of branch name values (doesn't effect prompt order) |
|
|
337
|
+
| `branch_action_default` | "branch" or "worktree" |
|
|
307
338
|
| `enable_worktrees` | If false, always default to branch action |
|
|
308
|
-
|
|
309
|
-
|
|
339
|
+
|
|
310
340
|
</details>
|
|
311
341
|
|
|
312
342
|
### 🔎 Inference
|
|
@@ -377,6 +407,10 @@ If you're using Github issues to track your work, and select the `closes` footer
|
|
|
377
407
|
|
|
378
408
|
`better-commits` uses native `git` commands under the hood. So any hooks, tools, or staging should work as if it was a normal commit.
|
|
379
409
|
|
|
410
|
+
Setting `confirm_with_editor=true` will allow you to edit/confirm a commit with your editor.
|
|
411
|
+
- For example, to edit with Neovim: `git config --global core.editor "nvim"`
|
|
412
|
+
- For VS Code, `git config --global core.editor "code -n --wait"`
|
|
413
|
+
|
|
380
414
|
You can add this badge to your repository to display that you're using a better-commits repository config
|
|
381
415
|
|
|
382
416
|
| Markdown | Result |
|
package/src/branch.ts
CHANGED
|
@@ -7,6 +7,8 @@ import {
|
|
|
7
7
|
load_setup,
|
|
8
8
|
OPTIONAL_PROMPT,
|
|
9
9
|
Z_BRANCH_ACTIONS,
|
|
10
|
+
Z_BRANCH_CONFIG_FIELDS,
|
|
11
|
+
Z_BRANCH_FIELDS,
|
|
10
12
|
} from "./utils";
|
|
11
13
|
import { BranchState } from "./zod-state";
|
|
12
14
|
import * as p from "@clack/prompts";
|
|
@@ -77,6 +79,21 @@ async function main(config: z.infer<typeof Config>) {
|
|
|
77
79
|
branch_state.ticket = ticket;
|
|
78
80
|
}
|
|
79
81
|
|
|
82
|
+
if (config.branch_version.enable) {
|
|
83
|
+
const version_required = config.branch_version.required;
|
|
84
|
+
const version = await p.text({
|
|
85
|
+
message: `Type version number ${
|
|
86
|
+
version_required ? "" : OPTIONAL_PROMPT
|
|
87
|
+
}`.trim(),
|
|
88
|
+
placeholder: "",
|
|
89
|
+
validate: (val) => {
|
|
90
|
+
if (version_required && !val) return "Please enter a version";
|
|
91
|
+
},
|
|
92
|
+
});
|
|
93
|
+
if (p.isCancel(version)) process.exit(0);
|
|
94
|
+
branch_state.version = version;
|
|
95
|
+
}
|
|
96
|
+
|
|
80
97
|
const description_max_length = config.branch_description.max_length;
|
|
81
98
|
const description = await p.text({
|
|
82
99
|
message: "Type a short description",
|
|
@@ -165,11 +182,14 @@ function build_branch(
|
|
|
165
182
|
config: z.infer<typeof Config>
|
|
166
183
|
) {
|
|
167
184
|
let res = "";
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
185
|
+
config.branch_order.forEach((b: z.infer<typeof Z_BRANCH_FIELDS>) => {
|
|
186
|
+
const config_key: z.infer<typeof Z_BRANCH_CONFIG_FIELDS> = `branch_${b}`
|
|
187
|
+
if (branch[b]) res += branch[b] + config[config_key].separator
|
|
188
|
+
})
|
|
189
|
+
if (res.endsWith('-') || res.endsWith('/') || res.endsWith('_')) {
|
|
190
|
+
return res.slice(0, -1).trim();
|
|
191
|
+
}
|
|
192
|
+
return res.trim();
|
|
173
193
|
}
|
|
174
194
|
|
|
175
195
|
function get_user_from_cache(): string {
|
package/src/index.ts
CHANGED
|
@@ -207,7 +207,13 @@ export async function main(config: z.infer<typeof Config>) {
|
|
|
207
207
|
commit_state.trailer = '';
|
|
208
208
|
}
|
|
209
209
|
}
|
|
210
|
-
|
|
210
|
+
|
|
211
|
+
if (config.confirm_with_editor) {
|
|
212
|
+
const options = config.overrides.shell ? { shell: config.overrides.shell, stdio: 'inherit' } : { stdio: 'inherit' }
|
|
213
|
+
const trailer = commit_state.trailer ? `--trailer="${commit_state.trailer}"` : '';
|
|
214
|
+
execSync(`git commit -m "${build_commit_string(commit_state, config, false, true, false)}" ${trailer} --edit`, options);
|
|
215
|
+
process.exit(0);
|
|
216
|
+
}
|
|
211
217
|
|
|
212
218
|
let continue_commit = true;
|
|
213
219
|
p.note(build_commit_string(commit_state, config, true, false, true), 'Commit Preview')
|
package/src/utils.ts
CHANGED
|
@@ -16,11 +16,16 @@ export const OPTIONAL_PROMPT = `${color.dim("(optional)")}`;
|
|
|
16
16
|
export const CACHE_PROMPT = `${color.dim("(value will be saved)")}`;
|
|
17
17
|
export const REGEX_SLASH_TAG = new RegExp(/\/(\w+-\d+)/);
|
|
18
18
|
export const REGEX_START_TAG = new RegExp(/^(\w+-\d+)/);
|
|
19
|
-
export const REGEX_SLASH_NUM = new RegExp(/\/(\d+)/);
|
|
20
|
-
export const REGEX_START_NUM = new RegExp(/^(\d+)/);
|
|
21
19
|
export const REGEX_START_UND = new RegExp(/^([A-Z]+-[\[a-zA-Z\]\d]+)_/);
|
|
22
20
|
export const REGEX_SLASH_UND = new RegExp(/\/([A-Z]+-[\[a-zA-Z\]\d]+)_/);
|
|
23
21
|
|
|
22
|
+
// TODO: This might conflict with version from better-branch
|
|
23
|
+
// - Maybe negative lookup against .
|
|
24
|
+
// - Maybe check the order
|
|
25
|
+
// - Maybe use order to split and check values
|
|
26
|
+
export const REGEX_SLASH_NUM = new RegExp(/\/(\d+)/);
|
|
27
|
+
export const REGEX_START_NUM = new RegExp(/^(\d+)/);
|
|
28
|
+
|
|
24
29
|
export const DEFAULT_TYPE_OPTIONS = [
|
|
25
30
|
{ value: "feat", label: "feat", hint: "A new feature", emoji: "✨", trailer: "Changelog: feature"},
|
|
26
31
|
{ value: "fix", label: "fix", hint: "A bug fix", emoji: "🐛", trailer: "Changelog: fix"},
|
|
@@ -110,6 +115,15 @@ export const Z_FOOTER_OPTIONS = z.enum([
|
|
|
110
115
|
"deprecated",
|
|
111
116
|
"custom",
|
|
112
117
|
]);
|
|
118
|
+
export const Z_BRANCH_FIELDS = z.enum(["user", "version", "type", "ticket", "description"]);
|
|
119
|
+
export const Z_BRANCH_CONFIG_FIELDS = z.enum([
|
|
120
|
+
"branch_user",
|
|
121
|
+
"branch_version",
|
|
122
|
+
"branch_type",
|
|
123
|
+
"branch_ticket",
|
|
124
|
+
"branch_description"
|
|
125
|
+
]);
|
|
126
|
+
export const BRANCH_ORDER_DEFAULTS: z.infer<typeof Z_BRANCH_FIELDS>[] = ["user", "version", "type", "ticket", "description"]
|
|
113
127
|
export const Z_BRANCH_ACTIONS = z.enum(["branch", "worktree"]);
|
|
114
128
|
export const FOOTER_OPTION_VALUES: z.infer<typeof Z_FOOTER_OPTIONS>[] = [
|
|
115
129
|
"closes",
|
package/src/zod-state.ts
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import {
|
|
3
|
+
BRANCH_ORDER_DEFAULTS,
|
|
3
4
|
CUSTOM_SCOPE_KEY,
|
|
4
5
|
DEFAULT_SCOPE_OPTIONS,
|
|
5
6
|
DEFAULT_TYPE_OPTIONS,
|
|
6
7
|
FOOTER_OPTION_VALUES,
|
|
7
8
|
Z_BRANCH_ACTIONS,
|
|
9
|
+
Z_BRANCH_FIELDS,
|
|
8
10
|
Z_FOOTER_OPTIONS,
|
|
9
11
|
} from "./utils";
|
|
10
12
|
|
|
@@ -122,6 +124,7 @@ export const Config = z
|
|
|
122
124
|
add_exclamation_to_title: z.boolean().default(true),
|
|
123
125
|
})
|
|
124
126
|
.default({}),
|
|
127
|
+
confirm_with_editor: z.boolean().default(false),
|
|
125
128
|
confirm_commit: z.boolean().default(true),
|
|
126
129
|
print_commit_output: z.boolean().default(true),
|
|
127
130
|
branch_pre_commands: z.array(z.string()).default([]),
|
|
@@ -141,6 +144,13 @@ export const Config = z
|
|
|
141
144
|
separator: z.enum(["/", "-", "_"]).default("/"),
|
|
142
145
|
})
|
|
143
146
|
.default({}),
|
|
147
|
+
branch_version: z
|
|
148
|
+
.object({
|
|
149
|
+
enable: z.boolean().default(false),
|
|
150
|
+
required: z.boolean().default(false),
|
|
151
|
+
separator: z.enum(["/", "-", "_"]).default("/"),
|
|
152
|
+
})
|
|
153
|
+
.default({}),
|
|
144
154
|
branch_ticket: z
|
|
145
155
|
.object({
|
|
146
156
|
enable: z.boolean().default(true),
|
|
@@ -151,9 +161,11 @@ export const Config = z
|
|
|
151
161
|
branch_description: z
|
|
152
162
|
.object({
|
|
153
163
|
max_length: z.number().positive().default(70),
|
|
164
|
+
separator: z.enum(["", "/", "-", "_"]).default(""),
|
|
154
165
|
})
|
|
155
166
|
.default({}),
|
|
156
167
|
branch_action_default: Z_BRANCH_ACTIONS.default("branch"),
|
|
168
|
+
branch_order: z.array(Z_BRANCH_FIELDS).default(BRANCH_ORDER_DEFAULTS),
|
|
157
169
|
enable_worktrees: z.boolean().default(true),
|
|
158
170
|
overrides: z.object({ shell: z.string().optional() }).default({}),
|
|
159
171
|
})
|
|
@@ -183,5 +195,6 @@ export const BranchState = z
|
|
|
183
195
|
type: z.string().default(""),
|
|
184
196
|
ticket: z.string().default(""),
|
|
185
197
|
description: z.string().default(""),
|
|
198
|
+
version: z.string().default("")
|
|
186
199
|
})
|
|
187
200
|
.default({});
|