gtx-cli 2.6.15 → 2.6.16

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/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # gtx-cli
2
2
 
3
+ ## 2.6.16
4
+
5
+ ### Patch Changes
6
+
7
+ - [#1002](https://github.com/generaltranslation/gt/pull/1002) [`8f8368a`](https://github.com/generaltranslation/gt/commit/8f8368a8723f79c4ebe56129bac03cb6cb33eec8) Thanks [@ErnestM1234](https://github.com/ErnestM1234)! - fix: branch detection vercel
8
+
3
9
  ## 2.6.15
4
10
 
5
11
  ### Patch Changes
@@ -175,8 +175,11 @@ export async function generateSettings(flags, cwd = process.cwd()) {
175
175
  ];
176
176
  // Add branch options if not provided
177
177
  const branchOptions = mergedOptions.branchOptions || {};
178
+ // If --branch is set, enable branching
178
179
  branchOptions.enabled =
179
- flags.enableBranching ?? gtConfig.branchOptions?.enabled ?? false;
180
+ flags.enableBranching ??
181
+ gtConfig.branchOptions?.enabled ??
182
+ (flags.branch ? true : false);
180
183
  branchOptions.currentBranch =
181
184
  flags.branch ?? gtConfig.branchOptions?.currentBranch ?? undefined;
182
185
  branchOptions.autoDetectBranches = flags.disableBranchDetection
@@ -1 +1 @@
1
- export declare const PACKAGE_VERSION = "2.6.15";
1
+ export declare const PACKAGE_VERSION = "2.6.16";
@@ -1,2 +1,2 @@
1
1
  // This file is auto-generated. Do not edit manually.
2
- export const PACKAGE_VERSION = '2.6.15';
2
+ export const PACKAGE_VERSION = '2.6.16';
@@ -30,6 +30,7 @@ export class BranchStep extends WorkflowStep {
30
30
  let incoming = [];
31
31
  let checkedOut = [];
32
32
  let useDefaultBranch = true;
33
+ let autoDetectFailed = false;
33
34
  if (this.settings.branchOptions.enabled &&
34
35
  this.settings.branchOptions.autoDetectBranches) {
35
36
  const [currentResult, incomingResult, checkedOutResult] = await Promise.all([
@@ -40,7 +41,21 @@ export class BranchStep extends WorkflowStep {
40
41
  current = currentResult;
41
42
  incoming = incomingResult;
42
43
  checkedOut = checkedOutResult;
43
- useDefaultBranch = false;
44
+ // Try env var detection if git commands failed (e.g. Vercel)
45
+ if (!currentResult) {
46
+ autoDetectFailed = true;
47
+ const vercelBranch = process.env.VERCEL_GIT_COMMIT_REF;
48
+ if (vercelBranch) {
49
+ current = { currentBranchName: vercelBranch, defaultBranch: false };
50
+ }
51
+ }
52
+ // If detection succeeded, use the detected branch; otherwise fall back to default
53
+ if (current) {
54
+ useDefaultBranch = false;
55
+ }
56
+ else {
57
+ logger.warn('Branch auto-detection failed. Falling back to the default branch. Use --branch to specify a branch manually.');
58
+ }
44
59
  }
45
60
  if (this.settings.branchOptions.enabled &&
46
61
  this.settings.branchOptions.currentBranch) {
@@ -129,6 +144,14 @@ export class BranchStep extends WorkflowStep {
129
144
  }
130
145
  })
131
146
  .filter((b) => b !== null)[0] ?? null;
147
+ // When --branch is set manually or auto-detection failed, assume it was checked out from default
148
+ if ((this.settings.branchOptions.currentBranch || autoDetectFailed) &&
149
+ (!this.settings.branchOptions.autoDetectBranches || autoDetectFailed) &&
150
+ !this.branchData.checkedOutBranch &&
151
+ branchData.defaultBranch &&
152
+ this.branchData.currentBranch.id !== branchData.defaultBranch.id) {
153
+ this.branchData.checkedOutBranch = branchData.defaultBranch;
154
+ }
132
155
  this.spinner.stop(chalk.green('Branch information resolved successfully'));
133
156
  return this.branchData;
134
157
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gtx-cli",
3
- "version": "2.6.15",
3
+ "version": "2.6.16",
4
4
  "main": "dist/index.js",
5
5
  "bin": "dist/main.js",
6
6
  "files": [