@elsikora/git-branch-lint 1.0.1-dev.1 → 1.1.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.
@@ -0,0 +1 @@
1
+ export declare const createBranch: (appName: string) => Promise<void>;
@@ -0,0 +1,8 @@
1
+ import type { BranchList } from "../../../domain/interfaces/branch.type";
2
+ interface IAlignChoicesResult {
3
+ name: string;
4
+ short: string;
5
+ value: string;
6
+ }
7
+ export declare const alignChoices: (branchList: BranchList) => Array<IAlignChoicesResult>;
8
+ export {};
@@ -0,0 +1,2 @@
1
+ import type { BranchList } from "../../../domain/interfaces/branch.type.js";
2
+ export declare const branchNameQuiz: (branchList: BranchList) => Promise<string>;
@@ -0,0 +1 @@
1
+ export declare const runGitCommand: (command: string) => void;
@@ -1,4 +1,4 @@
1
- import type { IBranchConfig } from "../../domain/interfaces/branch-interfaces";
1
+ import type { BranchLintConfig } from "../../domain/interfaces/config.type";
2
2
  import type { IConfigRepository } from "../../domain/interfaces/repository-interfaces";
3
3
  /**
4
4
  * Use case for getting branch configuration
@@ -15,5 +15,5 @@ export declare class GetBranchConfigUseCase {
15
15
  * @param appName The application name
16
16
  * @returns The branch configuration
17
17
  */
18
- execute(appName: string): Promise<IBranchConfig>;
18
+ execute(appName: string): Promise<BranchLintConfig>;
19
19
  }
@@ -1,4 +1,3 @@
1
- import type { TBranchName } from "../../domain/interfaces/branch-interfaces";
2
1
  import type { IBranchRepository } from "../../domain/interfaces/repository-interfaces";
3
2
  /**
4
3
  * Use case for getting the current branch name
@@ -14,5 +13,5 @@ export declare class GetCurrentBranchUseCase {
14
13
  * Execute the use case
15
14
  * @returns The current branch name
16
15
  */
17
- execute(): Promise<TBranchName>;
16
+ execute(): Promise<string>;
18
17
  }
@@ -1,4 +1,4 @@
1
- import type { IBranchConfig, TBranchName } from "../../domain/interfaces/branch-interfaces";
1
+ import type { BranchLintConfig } from "../../domain/interfaces/config.type";
2
2
  /**
3
3
  * Use case for linting a branch name
4
4
  */
@@ -12,7 +12,7 @@ export declare class LintBranchNameUseCase {
12
12
  * @throws {BranchTooShortError} When branch name is shorter than the minimum length
13
13
  * @throws {BranchTooLongError} When branch name is longer than the maximum length
14
14
  */
15
- execute(branchName: TBranchName, config: IBranchConfig): void;
15
+ execute(branchName: string, config: BranchLintConfig): void;
16
16
  /**
17
17
  * Validate the branch name against the pattern
18
18
  * @param branchName The branch name to validate
@@ -1,11 +1,10 @@
1
- import type { TBranchName } from "../interfaces/branch-interfaces";
2
1
  /**
3
2
  * Domain entity representing a Git branch
4
3
  */
5
4
  export declare class Branch {
6
5
  private readonly VALUE;
7
- constructor(name: TBranchName);
8
- getName(): TBranchName;
6
+ constructor(name: string);
7
+ getName(): string;
9
8
  isProhibited(prohibitedNames: ReadonlyArray<string>): boolean;
10
9
  isTooLong(maxLength?: number): boolean;
11
10
  isTooShort(minLength?: number): boolean;
@@ -0,0 +1,5 @@
1
+ export interface BranchDetails {
2
+ description: string;
3
+ title: string;
4
+ }
5
+ export type BranchList = Array<string> | Record<string, BranchDetails>;
@@ -0,0 +1,7 @@
1
+ import type { BranchList } from "./branch.type";
2
+ import type { RulesList } from "./rules.type";
3
+ export interface BranchLintConfig {
4
+ branches: BranchList;
5
+ ignore?: Array<string>;
6
+ rules?: Partial<RulesList>;
7
+ }
@@ -1,4 +1,3 @@
1
- import type { TBranchName } from "../branch-interfaces";
2
1
  /**
3
2
  * Repository interface for branch operations
4
3
  */
@@ -6,5 +5,5 @@ export interface IBranchRepository {
6
5
  /**
7
6
  * Get the current branch name
8
7
  */
9
- getCurrentBranchName(): Promise<TBranchName>;
8
+ getCurrentBranchName(): Promise<string>;
10
9
  }
@@ -1,4 +1,4 @@
1
- import type { IBranchConfig } from "../branch-interfaces";
1
+ import type { BranchLintConfig } from "../config.type";
2
2
  /**
3
3
  * Repository interface for configuration operations
4
4
  */
@@ -7,5 +7,5 @@ export interface IConfigRepository {
7
7
  * Get the branch configuration
8
8
  * @param appName The name of the application
9
9
  */
10
- getConfig(appName: string): Promise<IBranchConfig>;
10
+ getConfig(appName: string): Promise<BranchLintConfig>;
11
11
  }
@@ -0,0 +1,7 @@
1
+ export interface RulesList {
2
+ "branch-max-length": number;
3
+ "branch-min-length": number;
4
+ "branch-pattern": string;
5
+ "branch-prohibited": Array<string>;
6
+ "branch-subject-pattern": string;
7
+ }
@@ -1,4 +1,3 @@
1
- import type { TBranchName } from "../interfaces/branch-interfaces";
2
1
  /**
3
2
  * Repository interface for branch operations
4
3
  * @deprecated Use IBranchRepository instead
@@ -7,5 +6,5 @@ export interface BranchRepository {
7
6
  /**
8
7
  * Get the current branch name
9
8
  */
10
- getCurrentBranchName(): Promise<TBranchName>;
9
+ getCurrentBranchName(): Promise<string>;
11
10
  }
@@ -1,12 +1,12 @@
1
- import type { IBranchConfig } from "../interfaces/branch-interfaces";
2
1
  /**
3
2
  * Repository interface for configuration operations
4
3
  * @deprecated Use IConfigRepository instead
5
4
  */
5
+ import type { BranchLintConfig } from "../interfaces/config.type";
6
6
  export interface ConfigRepository {
7
7
  /**
8
8
  * Get the branch configuration
9
9
  * @param appName The name of the application
10
10
  */
11
- getConfig(appName: string): Promise<IBranchConfig>;
11
+ getConfig(appName: string): Promise<BranchLintConfig>;
12
12
  }
package/bin/index.d.ts CHANGED
@@ -1 +1 @@
1
- export {};
1
+ export type { BranchLintConfig } from "./domain/interfaces/config.type";
package/bin/index.js CHANGED
@@ -1,9 +1,172 @@
1
1
  #!/usr/bin/env node
2
+ import yargs from 'yargs';
3
+ import { execSync, exec } from 'node:child_process';
4
+ import inquirer from 'inquirer';
2
5
  import { cosmiconfig } from 'cosmiconfig';
3
- import { exec } from 'node:child_process';
4
6
  import { promisify } from 'node:util';
5
7
  import chalk from 'chalk';
6
8
 
9
+ /**
10
+ * Default configuration for branch linting
11
+ */
12
+ const DEFAULT_CONFIG = {
13
+ branches: {
14
+ bugfix: { description: "🐞 Fixing issues in existing functionality", title: "Bugfix" },
15
+ feature: { description: "🆕 Integration of new functionality", title: "Feature" },
16
+ hotfix: { description: "🚑 Critical fixes for urgent issues", title: "Hotfix" },
17
+ release: { description: "📦 Preparing a new release version", title: "Release" },
18
+ support: { description: "🛠️ Support and maintenance tasks", title: "Support" },
19
+ },
20
+ ignore: ["dev"],
21
+ rules: {
22
+ "branch-max-length": 50,
23
+ "branch-min-length": 5,
24
+ "branch-pattern": ":type/:name",
25
+ "branch-prohibited": ["main", "master", "release"],
26
+ "branch-subject-pattern": "[a-z0-9-]+",
27
+ },
28
+ };
29
+ /**
30
+ * Cosmiconfig implementation of ConfigRepository
31
+ */
32
+ class CosmiconfigRepository {
33
+ /**
34
+ * Get the branch configuration
35
+ * @param appName The name of the application
36
+ * @returns A promise that resolves to the branch configuration
37
+ */
38
+ async getConfig(appName) {
39
+ const configExplorer = cosmiconfig(appName, {
40
+ packageProp: `elsikora.${appName}`,
41
+ searchPlaces: ["package.json", `.elsikora/.${appName}rc`, `.elsikora/.${appName}rc.json`, `.elsikora/.${appName}rc.yaml`, `.elsikora/.${appName}rc.yml`, `.elsikora/.${appName}rc.js`, `.elsikora/.${appName}rc.ts`, `.elsikora/.${appName}rc.mjs`, `.elsikora/.${appName}rc.cjs`, `.elsikora/${appName}.config.js`, `.elsikora/${appName}.config.ts`, `.elsikora/${appName}.config.mjs`, `.elsikora/${appName}.config.cjs`],
42
+ });
43
+ const result = await configExplorer.search();
44
+ if (!result || result.isEmpty) {
45
+ return DEFAULT_CONFIG;
46
+ }
47
+ // Convert the config to match our interfaces
48
+ const providedConfig = result.config;
49
+ const mergedConfig = {
50
+ ...DEFAULT_CONFIG,
51
+ ...providedConfig,
52
+ };
53
+ return mergedConfig;
54
+ }
55
+ }
56
+
57
+ const EMPTY_SPACING_OFFSET = 5; // in spaces
58
+ // Функция для выравнивания текста
59
+ const alignChoices = (branchList) => {
60
+ if (Array.isArray(branchList)) {
61
+ return branchList.map((branchName) => {
62
+ return {
63
+ name: branchName,
64
+ short: branchName,
65
+ value: branchName,
66
+ };
67
+ });
68
+ }
69
+ else {
70
+ const nameOfBranchesArray = Object.keys(branchList);
71
+ const maxNameLength = Math.max(...nameOfBranchesArray.map((branchName) => branchName.length));
72
+ // Формируем choices с выравниванием
73
+ return nameOfBranchesArray.map((branchName) => {
74
+ const padding = " ".repeat(maxNameLength - branchName.length + EMPTY_SPACING_OFFSET);
75
+ return {
76
+ name: `${branchList[branchName].title}:${padding}${branchList[branchName].description}`,
77
+ short: branchList[branchName].title,
78
+ value: branchName,
79
+ };
80
+ });
81
+ }
82
+ };
83
+
84
+ const branchNameQuiz = async (branchList) => {
85
+ const { branchType } = await inquirer.prompt([
86
+ {
87
+ choices: alignChoices(branchList),
88
+ message: "Select the type of branch you're creating:",
89
+ name: "branchType",
90
+ type: "list",
91
+ },
92
+ ]);
93
+ const { branchName } = await inquirer.prompt([
94
+ {
95
+ message: "Enter the branch name (e.g., authorization):",
96
+ name: "branchName",
97
+ type: "input",
98
+ // Валидация названия ветки
99
+ // eslint-disable-next-line @elsikora/sonar/function-return-type
100
+ validate: (input) => {
101
+ if (!input.trim()) {
102
+ return "Branch name cannot be empty!";
103
+ }
104
+ if (!/^[a-z0-9-]+$/.test(input)) {
105
+ return "Branch name can only contain lowercase letters, numbers, and hyphens!";
106
+ }
107
+ return true;
108
+ },
109
+ },
110
+ ]);
111
+ const fullBranchName = `${branchType}/${branchName}`;
112
+ console.log(`\n⌛️ Creating branch: ${fullBranchName}`);
113
+ return fullBranchName;
114
+ };
115
+
116
+ /* eslint-disable @elsikora/sonar/os-command */
117
+ /* eslint-disable @elsikora/unicorn/no-process-exit */
118
+ // Функция для выполнения Git-команд
119
+ const runGitCommand = (command) => {
120
+ try {
121
+ execSync(command, { stdio: "inherit" });
122
+ }
123
+ catch (error) {
124
+ console.error(`❌ Error executing command: ${command}`);
125
+ console.error(error.message);
126
+ process.exit(1);
127
+ }
128
+ };
129
+
130
+ /* eslint-disable @elsikora/sonar/no-os-command-from-path */
131
+ /* eslint-disable @elsikora/unicorn/no-process-exit */
132
+ /* eslint-disable @elsikora/node/no-extraneous-import */
133
+ // Основная функция для создания ветки
134
+ const createBranch = async (appName) => {
135
+ const configRepository = new CosmiconfigRepository();
136
+ const { branches } = await configRepository.getConfig(appName);
137
+ // Проверка чистоты рабочей директории (есть ли незакомиченные файлы)
138
+ const status = execSync("git status --porcelain", { encoding: "utf8" });
139
+ if (status) {
140
+ console.log("⚠️ You have uncommitted changes. Please commit or stash them before creating a new branch.");
141
+ process.exit(1);
142
+ }
143
+ //
144
+ console.log("🌿 Creating a new branch...\n");
145
+ const branchName = await branchNameQuiz(branches);
146
+ // Проверка, не создается ли дубликат
147
+ const currentBranch = execSync("git rev-parse --abbrev-ref HEAD", { encoding: "utf8" }).trim();
148
+ if (currentBranch === branchName) {
149
+ console.log(`⚠️ You are already on branch ${branchName}!`);
150
+ process.exit(0);
151
+ }
152
+ runGitCommand(`git checkout -b ${branchName}`);
153
+ const { shouldPush } = await inquirer.prompt([
154
+ {
155
+ default: false,
156
+ message: "Do you want to push the branch to the remote repository?",
157
+ name: "shouldPush",
158
+ type: "confirm",
159
+ },
160
+ ]);
161
+ if (shouldPush) {
162
+ runGitCommand(`git push --set-upstream origin ${branchName}`);
163
+ console.log(`✅ Branch ${branchName} pushed to remote repository!`);
164
+ }
165
+ else {
166
+ console.log(`✅ Branch ${branchName} created locally!`);
167
+ }
168
+ };
169
+
7
170
  /**
8
171
  * Use case for getting branch configuration
9
172
  */
@@ -89,7 +252,7 @@ class LintError extends Error {
89
252
  */
90
253
  class BranchTooLongError extends LintError {
91
254
  constructor(branchName, maxLength) {
92
- // eslint-disable-next-line @elsikora-typescript/restrict-template-expressions
255
+ // eslint-disable-next-line @elsikora/typescript/restrict-template-expressions
93
256
  super(`Branch name "${branchName}" is too long (maximum length: ${maxLength})`);
94
257
  this.name = "BranchTooLongError";
95
258
  }
@@ -99,7 +262,7 @@ class BranchTooLongError extends LintError {
99
262
  */
100
263
  class BranchTooShortError extends LintError {
101
264
  constructor(branchName, minLength) {
102
- // eslint-disable-next-line @elsikora-typescript/restrict-template-expressions
265
+ // eslint-disable-next-line @elsikora/typescript/restrict-template-expressions
103
266
  super(`Branch name "${branchName}" is too short (minimum length: ${minLength})`);
104
267
  this.name = "BranchTooShortError";
105
268
  }
@@ -138,18 +301,19 @@ class LintBranchNameUseCase {
138
301
  */
139
302
  execute(branchName, config) {
140
303
  const branch = new Branch(branchName);
141
- if (branch.isProhibited(config.PROHIBITED)) {
304
+ const configRules = config.rules;
305
+ const ignoreList = config.ignore ?? [];
306
+ if (configRules?.["branch-prohibited"] && branch.isProhibited(configRules["branch-prohibited"])) {
142
307
  throw new ProhibitedBranchError(branchName);
143
308
  }
144
- // @ts-ignore
145
- if (branch.isTooShort(config.MINLENGTH)) {
146
- // @ts-ignore
147
- throw new BranchTooShortError(branchName, config.MINLENGTH);
309
+ if (ignoreList.length > 0 && ignoreList.includes(branchName)) {
310
+ return;
311
+ }
312
+ if (configRules?.["branch-min-length"] && branch.isTooShort(configRules["branch-min-length"])) {
313
+ throw new BranchTooShortError(branchName, configRules["branch-min-length"]);
148
314
  }
149
- // @ts-ignore
150
- if (branch.isTooLong(config.MAXLENGTH)) {
151
- // @ts-ignore
152
- throw new BranchTooLongError(branchName, config.MAXLENGTH);
315
+ if (configRules?.["branch-max-length"] && branch.isTooLong(configRules["branch-max-length"])) {
316
+ throw new BranchTooLongError(branchName, configRules["branch-max-length"]);
153
317
  }
154
318
  this.validatePattern(branch.getName(), config);
155
319
  }
@@ -161,16 +325,22 @@ class LintBranchNameUseCase {
161
325
  */
162
326
  validatePattern(branchName, config) {
163
327
  // Start with original pattern
164
- let pattern = config.PATTERN;
165
- // Process each parameter in the configuration
166
- for (const [key, values] of Object.entries(config.PARAMS)) {
167
- // Create the placeholder - IMPORTANT: Convert to lowercase to match pattern
328
+ let branchNamePattern = config.rules?.["branch-pattern"];
329
+ const subjectNamePattern = config.rules?.["branch-subject-pattern"];
330
+ if (!branchNamePattern) {
331
+ return;
332
+ }
333
+ const parameters = {
334
+ type: Object.keys(config.branches),
335
+ // Если branch-name-pattern не определён, не добавляем name в params
336
+ ...(subjectNamePattern && { name: [subjectNamePattern] }),
337
+ };
338
+ // Обрабатываем параметры, если они есть
339
+ for (const [key, values] of Object.entries(parameters)) {
168
340
  const placeholder = `:${key.toLowerCase()}`;
169
- const parameterValues = values;
170
341
  let replacement = "(";
171
- for (let index = 0; index < parameterValues.length; index++) {
172
- const value = parameterValues[index];
173
- // Add the value to the replacement pattern
342
+ for (let index = 0; index < values.length; index++) {
343
+ const value = values[index];
174
344
  if (value.startsWith("[")) {
175
345
  replacement += value;
176
346
  }
@@ -178,17 +348,15 @@ class LintBranchNameUseCase {
178
348
  const escapedValue = value.replaceAll(/[-/\\^$*+?.()|[\]{}]/g, String.raw `\$&`);
179
349
  replacement += escapedValue;
180
350
  }
181
- // Add OR separator if not the last value
182
- if (index < parameterValues.length - 1) {
351
+ if (index < values.length - 1) {
183
352
  replacement += "|";
184
353
  }
185
354
  }
186
355
  replacement += ")";
187
- // Replace the placeholder in the pattern
188
- pattern = pattern.replaceAll(new RegExp(placeholder, "g"), replacement);
356
+ branchNamePattern = branchNamePattern.replaceAll(new RegExp(placeholder, "g"), replacement);
189
357
  }
190
358
  // Create the regular expression
191
- const regexp = new RegExp(`^${pattern}$`);
359
+ const regexp = new RegExp(`^${branchNamePattern}$`);
192
360
  // Test the branch name against the pattern
193
361
  if (!regexp.test(branchName)) {
194
362
  throw new PatternMatchError(branchName);
@@ -196,86 +364,6 @@ class LintBranchNameUseCase {
196
364
  }
197
365
  }
198
366
 
199
- /**
200
- * Default configuration for branch linting
201
- */
202
- const DEFAULT_CONFIG = {
203
- // eslint-disable-next-line @elsikora-typescript/no-magic-numbers
204
- MAXLENGTH: 50,
205
- // eslint-disable-next-line @elsikora-typescript/no-magic-numbers
206
- MINLENGTH: 5,
207
- PARAMS: {
208
- NAME: ["[a-z0-9-]+"],
209
- TYPE: ["feature", "hotfix", "support", "bugfix", "release"],
210
- },
211
- PATTERN: ":type/:name",
212
- PROHIBITED: ["ci", "wip", "main", "test", "build", "master", "release", "dev", "develop"],
213
- };
214
- /**
215
- * Cosmiconfig implementation of ConfigRepository
216
- */
217
- class CosmiconfigRepository {
218
- /**
219
- * Get the branch configuration
220
- * @param appName The name of the application
221
- * @returns A promise that resolves to the branch configuration
222
- */
223
- async getConfig(appName) {
224
- const configExplorer = cosmiconfig(appName, {
225
- packageProp: `elsikora.${appName}`,
226
- searchPlaces: ["package.json", `.elsikora/.${appName}rc`, `.elsikora/.${appName}rc.json`, `.elsikora/.${appName}rc.yaml`, `.elsikora/.${appName}rc.yml`, `.elsikora/.${appName}rc.js`, `.elsikora/.${appName}rc.ts`, `.elsikora/.${appName}rc.mjs`, `.elsikora/.${appName}rc.cjs`, `.elsikora/${appName}.config.js`, `.elsikora/${appName}.config.ts`, `.elsikora/${appName}.config.mjs`, `.elsikora/${appName}.config.cjs`],
227
- });
228
- const result = await configExplorer.search();
229
- if (!result || result.isEmpty) {
230
- return DEFAULT_CONFIG;
231
- }
232
- // Convert the config to match our interfaces
233
- const providedConfig = result.config;
234
- const uppercasedConfig = {};
235
- // Create a new object with uppercase keys instead of modifying the original
236
- for (const key of Object.keys(providedConfig)) {
237
- const uppercaseKey = key.toUpperCase();
238
- const value = providedConfig[key];
239
- if (Array.isArray(value)) {
240
- // Preserve arrays
241
- // eslint-disable-next-line @elsikora-typescript/no-unsafe-assignment
242
- uppercasedConfig[uppercaseKey] = [...value];
243
- }
244
- else if (typeof value === "object" && value !== null) {
245
- // Handle nested objects
246
- const nestedObject = {};
247
- for (const subKey of Object.keys(value)) {
248
- const subValue = value[subKey];
249
- if (Array.isArray(subValue)) {
250
- // Preserve nested arrays
251
- // eslint-disable-next-line @elsikora-typescript/no-unsafe-assignment
252
- nestedObject[subKey.toUpperCase()] = [...subValue];
253
- }
254
- else {
255
- nestedObject[subKey.toUpperCase()] = subValue;
256
- }
257
- }
258
- uppercasedConfig[uppercaseKey] = nestedObject;
259
- }
260
- else {
261
- // Handle primitive values
262
- uppercasedConfig[uppercaseKey] = value;
263
- }
264
- }
265
- const mergedConfig = {
266
- ...DEFAULT_CONFIG,
267
- ...uppercasedConfig,
268
- };
269
- if (uppercasedConfig.PARAMS && DEFAULT_CONFIG.PARAMS) {
270
- mergedConfig.PARAMS = {
271
- ...DEFAULT_CONFIG.PARAMS,
272
- ...uppercasedConfig.PARAMS,
273
- };
274
- }
275
- return mergedConfig;
276
- }
277
- }
278
-
279
367
  const execAsync = promisify(exec);
280
368
  /**
281
369
  * Git implementation of BranchRepository
@@ -333,12 +421,11 @@ class HintFormatter {
333
421
  */
334
422
  formatPatternMatchHint(config) {
335
423
  let output = "";
336
- output += `${chalk.blue("Expected pattern:")} ${chalk.yellow(config.PATTERN)}\n`;
337
- // Format the parameters
338
- for (const [parameterName, parameterValues] of Object.entries(config.PARAMS)) {
339
- const valuesList = parameterValues.map((value) => chalk.yellow(value)).join(", ");
340
- output += chalk.blue(`Valid ${parameterName} values:`) + " " + valuesList + "\n";
341
- }
424
+ const branchNamePattern = config.rules?.["branch-pattern"];
425
+ const branchTypeList = Array.isArray(config.branches) ? config.branches : Object.keys(config.branches);
426
+ output += branchNamePattern ? `${chalk.blue("Expected pattern:")} ${chalk.yellow(branchNamePattern)}\n` : "";
427
+ const valuesList = branchTypeList.map((value) => chalk.yellow(value)).join(", ");
428
+ output += chalk.blue(`Valid branch types:`) + " " + valuesList + "\n";
342
429
  return output.trim();
343
430
  }
344
431
  /**
@@ -347,7 +434,7 @@ class HintFormatter {
347
434
  * @returns The formatted hint
348
435
  */
349
436
  formatProhibitedBranchHint(config) {
350
- const prohibitedList = config.PROHIBITED.map((name) => chalk.yellow(name)).join(", ");
437
+ const prohibitedList = config.rules?.["branch-prohibited"]?.map((name) => chalk.yellow(name)).join(", ") ?? "";
351
438
  return `${chalk.blue("Prohibited branch names:")} ${prohibitedList}`;
352
439
  }
353
440
  }
@@ -404,13 +491,13 @@ class CliController {
404
491
  console.log(this.HINT_FORMATTER.format(error, config));
405
492
  // Since this is a CLI tool, it's appropriate to exit the process on validation errors
406
493
  // ESLint wants us to throw instead, but this is a CLI application where exit is acceptable
407
- // eslint-disable-next-line elsikora-node/no-process-exit, @elsikora-unicorn/no-process-exit
494
+ // eslint-disable-next-line @elsikora/unicorn/no-process-exit
408
495
  process.exit(1);
409
496
  }
410
497
  catch {
411
498
  console.error(this.ERROR_FORMATTER.format("Failed to load configuration for error hint"));
412
499
  console.error(this.ERROR_FORMATTER.format(error.message));
413
- // eslint-disable-next-line elsikora-node/no-process-exit, @elsikora-unicorn/no-process-exit
500
+ // eslint-disable-next-line @elsikora/unicorn/no-process-exit
414
501
  process.exit(1);
415
502
  }
416
503
  }
@@ -422,21 +509,42 @@ class CliController {
422
509
  * Application name used for configuration
423
510
  */
424
511
  const APP_NAME = "git-branch-lint";
512
+ const argv = yargs(process.argv.slice(2))
513
+ .option("branch", {
514
+ alias: "b",
515
+ description: "Run branch creation tool",
516
+ type: "boolean",
517
+ })
518
+ .help()
519
+ .usage("Usage: $0 [-b] to create a branch or lint the current branch")
520
+ .parseSync();
425
521
  /**
426
522
  * Main function that bootstraps the application
427
523
  */
428
524
  const main = async () => {
429
- // Infrastructure layer
430
- const configRepository = new CosmiconfigRepository();
431
- const branchRepository = new GitBranchRepository();
432
- // Application layer
433
- const getBranchConfigUseCase = new GetBranchConfigUseCase(configRepository);
434
- const getCurrentBranchUseCase = new GetCurrentBranchUseCase(branchRepository);
435
- const lintBranchNameUseCase = new LintBranchNameUseCase();
436
- // Presentation layer
437
- const cliController = new CliController(getBranchConfigUseCase, getCurrentBranchUseCase, lintBranchNameUseCase);
438
- // Execute the application
439
- await cliController.execute(APP_NAME);
525
+ if (argv.branch) {
526
+ try {
527
+ await createBranch(APP_NAME);
528
+ }
529
+ catch (error) {
530
+ console.error("❌ Failed to create branch:", error.message);
531
+ // eslint-disable-next-line @elsikora/unicorn/no-process-exit
532
+ process.exit(1);
533
+ }
534
+ }
535
+ else {
536
+ // Infrastructure layer
537
+ const configRepository = new CosmiconfigRepository();
538
+ const branchRepository = new GitBranchRepository();
539
+ // Application layer
540
+ const getBranchConfigUseCase = new GetBranchConfigUseCase(configRepository);
541
+ const getCurrentBranchUseCase = new GetCurrentBranchUseCase(branchRepository);
542
+ const lintBranchNameUseCase = new LintBranchNameUseCase();
543
+ // Presentation layer
544
+ const cliController = new CliController(getBranchConfigUseCase, getCurrentBranchUseCase, lintBranchNameUseCase);
545
+ // Execute the application
546
+ await cliController.execute(APP_NAME);
547
+ }
440
548
  };
441
549
  // Bootstrap the application and handle errors
442
550
  main().catch((error) => {
package/bin/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../src/application/use-cases/get-branch-config-use-case.ts","../src/application/use-cases/get-current-branch-use-case.ts","../src/domain/entities/branch.ts","../src/domain/errors/lint-errors.ts","../src/application/use-cases/lint-branch-name-use-case.ts","../src/infrastructure/config/cosmiconfig-repository.ts","../src/infrastructure/git/git-branch-repository.ts","../src/presentation/cli/formatters/error-formatter.ts","../src/presentation/cli/formatters/hint-formatter.ts","../src/presentation/cli/cli-controller.ts","../src/index.ts"],"sourcesContent":[null,null,null,null,null,null,null,null,null,null,null],"names":[],"mappings":";;;;;;AAGA;;AAEG;MACU,sBAAsB,CAAA;AACjB,IAAA,iBAAiB;AAElC;;;AAGG;AACH,IAAA,WAAA,CAAY,gBAAmC,EAAA;AAC9C,QAAA,IAAI,CAAC,iBAAiB,GAAG,gBAAgB;;AAG1C;;;;AAIG;IACI,MAAM,OAAO,CAAC,OAAe,EAAA;QACnC,OAAO,IAAI,CAAC,iBAAiB,CAAC,SAAS,CAAC,OAAO,CAAC;;AAEjD;;ACtBD;;AAEG;MACU,uBAAuB,CAAA;AAClB,IAAA,iBAAiB;AAElC;;;AAGG;AACH,IAAA,WAAA,CAAY,gBAAmC,EAAA;AAC9C,QAAA,IAAI,CAAC,iBAAiB,GAAG,gBAAgB;;AAG1C;;;AAGG;AACI,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AC,CAAC,CAAC;;;AAIjB,QAAA,MAAM,KAAK;;AAEZ;;AC/ED;;AAEG;AACH,MAAM,QAAQ,GAAW,iBAAiB;AAE1C;;AAEG;AACH,MAAM,IAAI,GAAG,YAA0B;;AAEtC,IAAA,MAAM,gBAAgB,GAA0B,IAAI,qBAAqB,EAAE;AAC3E,IAAA,MAAM,gBAAgB,GAAwB,IAAI,mBAAmB,EAAE;;AAGvE,IAAA,MAAM,sBAAsB,GAA2B,IAAI,sBAAsB,CAAC,gBAAgB,CAAC;AACnG,IAAA,MAAM,uBAAuB,GAA4B,IAAI,uBAAuB,CAAC,gBAAgB,CAAC;AACtG,IAAA,MAAM,qBAAqB,GAA0B,IAAI,qBAAqB,EAAE;;IAGhF,MAAM,aAAa,GAAkB,IAAI,aAAa,CAAC,sBAAsB,EAAE,uBAAuB,EAAE,qBAAqB,CAAC;;AAG9H,IAAA,MAAM,aAAa,CAAC,OAAO,CAAC,QAAQ,CAAC;AACtC,CAAC;AAED;AACA,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,KAAc,KAAI;AAC/B,IAAA,OAAO,CAAC,KAAK,CAAC,2CAA2C,CAAC;AAE1D,IAAA,MAAM,KAAK;AACZ,CAAC,CAAC"}
1
+ {"version":3,"file":"index.js","sources":["../src/infrastructure/config/cosmiconfig-repository.ts","../src/application/create-branch-tool/utils/alignChoices.ts","../src/application/create-branch-tool/utils/branchNameQuiz.ts","../src/application/create-branch-tool/utils/runGitCommand.ts","../src/application/create-branch-tool/createBranch.ts","../src/application/use-cases/get-branch-config-use-case.ts","../src/application/use-cases/get-current-branch-use-case.ts","../src/domain/entities/branch.ts","../src/domain/errors/lint-errors.ts","../src/application/use-cases/lint-branch-name-use-case.ts","../src/infrastructure/git/git-branch-repository.ts","../src/presentation/cli/formatters/error-formatter.ts","../src/presentation/cli/formatters/hint-formatter.ts","../src/presentation/cli/cli-controller.ts","../src/index.ts"],"sourcesContent":[null,null,null,null,null,null,null,null,null,null,null,null,null,null,null],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AsB,GAA2B,IAAI,sBAAsB,CAAC,gBAAgB,CAAC;AACnG,QAAA,MAAM,uBAAuB,GAA4B,IAAI,uBAAuB,CAAC,gBAAgB,CAAC;AACtG,QAAA,MAAM,qBAAqB,GAA0B,IAAI,qBAAqB,EAAE;;QAGhF,MAAM,aAAa,GAAkB,IAAI,aAAa,CAAC,sBAAsB,EAAE,uBAAuB,EAAE,qBAAqB,CAAC;;AAG9H,QAAA,MAAM,aAAa,CAAC,OAAO,CAAC,QAAQ,CAAC;;AAEvC,CAAC;AAED;AACA,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,KAAc,KAAI;AAC/B,IAAA,OAAO,CAAC,KAAK,CAAC,2CAA2C,CAAC;AAE1D,IAAA,MAAM,KAAK;AACZ,CAAC,CAAC"}
@@ -1,5 +1,9 @@
1
- import type { IBranchConfig } from "../../domain/interfaces/branch-interfaces";
1
+ import type { BranchLintConfig } from "../../domain/interfaces/config.type";
2
2
  import type { IConfigRepository } from "../../domain/interfaces/repository-interfaces";
3
+ /**
4
+ * Default configuration for branch linting
5
+ */
6
+ export declare const DEFAULT_CONFIG: BranchLintConfig;
3
7
  /**
4
8
  * Cosmiconfig implementation of ConfigRepository
5
9
  */
@@ -9,5 +13,5 @@ export declare class CosmiconfigRepository implements IConfigRepository {
9
13
  * @param appName The name of the application
10
14
  * @returns A promise that resolves to the branch configuration
11
15
  */
12
- getConfig(appName: string): Promise<IBranchConfig>;
16
+ getConfig(appName: string): Promise<BranchLintConfig>;
13
17
  }
@@ -1,4 +1,3 @@
1
- import type { TBranchName } from "../../domain/interfaces/branch-interfaces";
2
1
  import type { IBranchRepository } from "../../domain/interfaces/repository-interfaces";
3
2
  /**
4
3
  * Git implementation of BranchRepository
@@ -8,5 +7,5 @@ export declare class GitBranchRepository implements IBranchRepository {
8
7
  * Get the current branch name
9
8
  * @returns A promise that resolves to the current branch name
10
9
  */
11
- getCurrentBranchName(): Promise<TBranchName>;
10
+ getCurrentBranchName(): Promise<string>;
12
11
  }
@@ -1,4 +1,4 @@
1
- import type { IBranchConfig } from "../../../domain/interfaces/branch-interfaces";
1
+ import type { BranchLintConfig } from "../../../domain/interfaces/config.type";
2
2
  /**
3
3
  * Format hint messages for CLI output
4
4
  */
@@ -9,7 +9,7 @@ export declare class HintFormatter {
9
9
  * @param config The branch configuration
10
10
  * @returns The formatted hint message
11
11
  */
12
- format(error: unknown, config: IBranchConfig): string;
12
+ format(error: unknown, config: BranchLintConfig): string;
13
13
  /**
14
14
  * Format a hint for pattern match errors
15
15
  * @param config The branch configuration
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@elsikora/git-branch-lint",
3
- "version": "1.0.1-dev.1",
3
+ "version": "1.1.0",
4
4
  "description": "Lint your git branch names",
5
5
  "keywords": [
6
6
  "lint",
@@ -18,7 +18,13 @@
18
18
  "license": "MIT",
19
19
  "author": "ElsiKora",
20
20
  "type": "module",
21
+ "exports": {
22
+ ".": {
23
+ "types": "./bin/index.d.ts"
24
+ }
25
+ },
21
26
  "main": "bin/index.js",
27
+ "types": "./bin/index.d.ts",
22
28
  "bin": {
23
29
  "git-branch-lint": "./bin/index.js"
24
30
  },
@@ -48,7 +54,8 @@
48
54
  "dependencies": {
49
55
  "chalk": "^5.4.1",
50
56
  "cosmiconfig": "^9.0.0",
51
- "path-to-regexp": "^8.2.0"
57
+ "path-to-regexp": "^8.2.0",
58
+ "yargs": "^17.7.2"
52
59
  },
53
60
  "devDependencies": {
54
61
  "@commitlint/cli": "^19.7.1",
@@ -63,7 +70,9 @@
63
70
  "@semantic-release/github": "^11.0.1",
64
71
  "@semantic-release/npm": "^12.0.1",
65
72
  "@semantic-release/release-notes-generator": "^14.0.3",
66
- "@types/node": "^22.13.8",
73
+ "@types/inquirer": "^9.0.7",
74
+ "@types/node": "^22.14.1",
75
+ "@types/yargs": "^17.0.33",
67
76
  "commitizen": "^4.3.1",
68
77
  "conventional-changelog-conventionalcommits": "^8.0.0",
69
78
  "eslint": "^9.21.0",
@@ -74,8 +83,10 @@
74
83
  "rimraf": "^6.0.1",
75
84
  "rollup": "^4.34.9",
76
85
  "semantic-release": "^24.2.3",
86
+ "ts-node": "^10.9.2",
77
87
  "tslib": "^2.8.1",
78
- "typescript": "^5.7.3"
88
+ "tsx": "^4.19.3",
89
+ "typescript": "^5.8.3"
79
90
  },
80
91
  "publishConfig": {
81
92
  "access": "public"
@@ -1,22 +0,0 @@
1
- /**
2
- * Interface for branch configuration
3
- */
4
- export interface IBranchConfig {
5
- readonly MAXLENGTH?: number;
6
- readonly MINLENGTH?: number;
7
- PARAMS: IBranchParameters;
8
- readonly PATTERN: string;
9
- readonly PROHIBITED: ReadonlyArray<string>;
10
- }
11
- /**
12
- * Interface for branch parameters
13
- */
14
- export interface IBranchParameters {
15
- readonly NAME: ReadonlyArray<string>;
16
- readonly TYPE: ReadonlyArray<string>;
17
- }
18
- /**
19
- * Type definition for a branch name
20
- * We explicitly keep this type for semantic clarity
21
- */
22
- export type TBranchName = string;