threadlines 0.1.15 → 0.1.17

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.
@@ -48,33 +48,26 @@ const fs = __importStar(require("fs"));
48
48
  const path = __importStar(require("path"));
49
49
  const chalk_1 = __importDefault(require("chalk"));
50
50
  /**
51
- * Detect the environment where the check is being run
52
- * Returns: 'vercel', 'github', 'gitlab', or 'local'
51
+ * Detect the environment where the check is being run.
52
+ *
53
+ * CI Environment Detection:
54
+ * - Vercel: VERCEL=1
55
+ * - GitHub Actions: GITHUB_ACTIONS=1
56
+ * - GitLab CI: GITLAB_CI=1 or (CI=1 + CI_COMMIT_SHA)
57
+ * - Local: None of the above
58
+ *
59
+ * Available CI Environment Variables:
60
+ * - GitHub Actions: GITHUB_REPOSITORY, GITHUB_REF_NAME, GITHUB_SHA, GITHUB_BASE_REF, GITHUB_HEAD_REF
61
+ * - Vercel: VERCEL_GIT_REPO_OWNER, VERCEL_GIT_REPO_SLUG, VERCEL_GIT_COMMIT_REF, VERCEL_GIT_COMMIT_SHA
62
+ * - GitLab CI: CI_COMMIT_REF_NAME, CI_COMMIT_SHA, CI_MERGE_REQUEST_IID, CI_MERGE_REQUEST_TITLE
53
63
  */
54
64
  function detectEnvironment() {
55
- console.log(chalk_1.default.gray(' [DEBUG] detectEnvironment: Starting detection...'));
56
- console.log(chalk_1.default.gray(` [DEBUG] detectEnvironment: VERCEL = "${process.env.VERCEL || 'NOT SET'}"`));
57
- console.log(chalk_1.default.gray(` [DEBUG] detectEnvironment: GITHUB_ACTIONS = "${process.env.GITHUB_ACTIONS || 'NOT SET'}"`));
58
- console.log(chalk_1.default.gray(` [DEBUG] detectEnvironment: GITLAB_CI = "${process.env.GITLAB_CI || 'NOT SET'}"`));
59
- console.log(chalk_1.default.gray(` [DEBUG] detectEnvironment: CI = "${process.env.CI || 'NOT SET'}"`));
60
- console.log(chalk_1.default.gray(` [DEBUG] detectEnvironment: CI_COMMIT_SHA = "${process.env.CI_COMMIT_SHA || 'NOT SET'}"`));
61
- // Vercel: VERCEL env var is always set in Vercel builds
62
- if (process.env.VERCEL) {
63
- console.log(chalk_1.default.green(' [DEBUG] detectEnvironment: Detected VERCEL'));
65
+ if (process.env.VERCEL)
64
66
  return 'vercel';
65
- }
66
- // GitHub Actions: GITHUB_ACTIONS env var is always set
67
- if (process.env.GITHUB_ACTIONS) {
68
- console.log(chalk_1.default.green(' [DEBUG] detectEnvironment: Detected GITHUB_ACTIONS'));
67
+ if (process.env.GITHUB_ACTIONS)
69
68
  return 'github';
70
- }
71
- // GitLab CI: GITLAB_CI env var is always set, or CI is set with GitLab-specific vars
72
- if (process.env.GITLAB_CI || (process.env.CI && process.env.CI_COMMIT_SHA)) {
73
- console.log(chalk_1.default.green(' [DEBUG] detectEnvironment: Detected GITLAB_CI'));
69
+ if (process.env.GITLAB_CI || (process.env.CI && process.env.CI_COMMIT_SHA))
74
70
  return 'gitlab';
75
- }
76
- // Local development: none of the above
77
- console.log(chalk_1.default.yellow(' [DEBUG] detectEnvironment: No CI env vars detected - returning "local"'));
78
71
  return 'local';
79
72
  }
80
73
  async function checkCommand(options) {
@@ -180,6 +173,19 @@ async function checkCommand(options) {
180
173
  console.log(chalk_1.default.gray(`šŸ“ Collecting git changes for branch: ${autoTarget.value}...`));
181
174
  gitDiff = await (0, diff_1.getBranchDiff)(repoRoot, autoTarget.value);
182
175
  reviewContext = { type: 'branch', value: autoTarget.value };
176
+ // Capture commit SHA from CI env vars if available
177
+ if (process.env.GITHUB_SHA) {
178
+ commitSha = process.env.GITHUB_SHA;
179
+ const message = await (0, diff_1.getCommitMessage)(repoRoot, process.env.GITHUB_SHA);
180
+ if (message)
181
+ commitMessage = message;
182
+ }
183
+ else if (process.env.VERCEL_GIT_COMMIT_SHA) {
184
+ commitSha = process.env.VERCEL_GIT_COMMIT_SHA;
185
+ const message = await (0, diff_1.getCommitMessage)(repoRoot, process.env.VERCEL_GIT_COMMIT_SHA);
186
+ if (message)
187
+ commitMessage = message;
188
+ }
183
189
  }
184
190
  else if (autoTarget.type === 'commit') {
185
191
  // Commit: use single commit
@@ -242,16 +248,6 @@ async function checkCommand(options) {
242
248
  };
243
249
  });
244
250
  // 4. Get repo name and branch name
245
- console.log(chalk_1.default.gray('\nšŸ“” Detecting repository and branch information...'));
246
- // Log Vercel-specific env vars that might help with repo detection
247
- if (process.env.VERCEL) {
248
- console.log(chalk_1.default.gray(' [DEBUG] Vercel environment variables:'));
249
- console.log(chalk_1.default.gray(` [DEBUG] VERCEL_GIT_REPO_OWNER = "${process.env.VERCEL_GIT_REPO_OWNER || 'NOT SET'}"`));
250
- console.log(chalk_1.default.gray(` [DEBUG] VERCEL_GIT_REPO_SLUG = "${process.env.VERCEL_GIT_REPO_SLUG || 'NOT SET'}"`));
251
- console.log(chalk_1.default.gray(` [DEBUG] VERCEL_GIT_REPO_ID = "${process.env.VERCEL_GIT_REPO_ID || 'NOT SET'}"`));
252
- console.log(chalk_1.default.gray(` [DEBUG] VERCEL_GIT_COMMIT_REF = "${process.env.VERCEL_GIT_COMMIT_REF || 'NOT SET'}"`));
253
- console.log(chalk_1.default.gray(` [DEBUG] VERCEL_GIT_COMMIT_SHA = "${process.env.VERCEL_GIT_COMMIT_SHA || 'NOT SET'}"`));
254
- }
255
251
  const repoName = await (0, repo_1.getRepoName)(repoRoot);
256
252
  const branchName = await (0, repo_1.getBranchName)(repoRoot);
257
253
  // 5. Get API URL
@@ -259,19 +255,9 @@ async function checkCommand(options) {
259
255
  process.env.THREADLINE_API_URL ||
260
256
  'https://devthreadline.com';
261
257
  // 6. Detect environment
262
- console.log(chalk_1.default.gray('\nšŸŒ Detecting environment...'));
263
258
  const environment = detectEnvironment();
264
- // 7. Log final values being sent to API
265
- console.log(chalk_1.default.gray('\nšŸ“¤ Final values being sent to API:'));
266
- console.log(chalk_1.default.gray(` repoName: ${repoName ? `"${repoName}"` : 'null/undefined'}`));
267
- console.log(chalk_1.default.gray(` branchName: ${branchName ? `"${branchName}"` : 'null/undefined'}`));
268
- console.log(chalk_1.default.gray(` commitSha: ${commitSha ? `"${commitSha}"` : 'null/undefined'}`));
269
- console.log(chalk_1.default.gray(` commitMessage: ${commitMessage ? `"${commitMessage.substring(0, 50)}..."` : 'null/undefined'}`));
270
- console.log(chalk_1.default.gray(` prTitle: ${prTitle ? `"${prTitle}"` : 'null/undefined'}`));
271
- console.log(chalk_1.default.gray(` environment: "${environment}"`));
272
- console.log(chalk_1.default.gray(` reviewContext: ${JSON.stringify(reviewContext)}`));
273
- // 8. Call review API
274
- console.log(chalk_1.default.gray('\nšŸ¤– Running threadline checks...'));
259
+ // 7. Call review API
260
+ console.log(chalk_1.default.gray('šŸ¤– Running threadline checks...'));
275
261
  const client = new client_1.ReviewAPIClient(apiUrl);
276
262
  const response = await client.review({
277
263
  threadlines: threadlinesWithContext,
package/dist/git/diff.js CHANGED
@@ -95,15 +95,18 @@ async function getBranchDiff(repoRoot, branchName, baseBranch) {
95
95
  base = await detectBaseBranch(git, branchName);
96
96
  }
97
97
  // Helper function to detect base branch
98
+ // Returns the branch name to use in git commands (may be local or remote)
98
99
  async function detectBaseBranch(git, branchName) {
99
100
  // Try upstream tracking branch
100
101
  const upstream = await git.revparse(['--abbrev-ref', '--symbolic-full-name', `${branchName}@{u}`]).catch(() => null);
101
102
  if (upstream) {
102
- // Extract base from upstream (e.g., "origin/main" -> "main")
103
+ // Extract base from upstream (e.g., "origin/main" -> check if local exists, else use "origin/main")
103
104
  const upstreamBranch = upstream.replace(/^origin\//, '');
104
105
  // Don't use the branch itself as its base
105
106
  if (upstreamBranch !== branchName) {
106
- return upstreamBranch;
107
+ // Check if local branch exists, otherwise use remote
108
+ const localExists = await git.revparse([upstreamBranch]).catch(() => null);
109
+ return localExists ? upstreamBranch : upstream;
107
110
  }
108
111
  }
109
112
  // Try default branch
@@ -112,7 +115,9 @@ async function getBranchDiff(repoRoot, branchName, baseBranch) {
112
115
  const defaultBranchName = defaultBranch.replace(/^origin\//, '');
113
116
  // Don't use the branch itself as its base
114
117
  if (defaultBranchName !== branchName) {
115
- return defaultBranchName;
118
+ // Check if local branch exists, otherwise use remote
119
+ const localExists = await git.revparse([defaultBranchName]).catch(() => null);
120
+ return localExists ? defaultBranchName : defaultBranch;
116
121
  }
117
122
  }
118
123
  catch {
@@ -125,8 +130,11 @@ async function getBranchDiff(repoRoot, branchName, baseBranch) {
125
130
  continue; // Skip if it's the same branch
126
131
  }
127
132
  try {
133
+ // Check if remote exists
128
134
  await git.revparse([`origin/${candidate}`]);
129
- return candidate;
135
+ // Check if local exists, otherwise use remote
136
+ const localExists = await git.revparse([candidate]).catch(() => null);
137
+ return localExists ? candidate : `origin/${candidate}`;
130
138
  }
131
139
  catch {
132
140
  // Try next
package/dist/git/repo.js CHANGED
@@ -6,72 +6,58 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.getRepoName = getRepoName;
7
7
  exports.getBranchName = getBranchName;
8
8
  const simple_git_1 = __importDefault(require("simple-git"));
9
- const chalk_1 = __importDefault(require("chalk"));
10
9
  /**
11
- * Gets the raw git remote URL from origin.
12
- * Returns the URL exactly as Git provides it - no parsing or normalization.
13
- * Server-side can normalize variations if needed based on actual data.
10
+ * Gets repository URL. Prefers CI environment variables over git commands.
11
+ *
12
+ * CI Environment Variables:
13
+ * - GitHub Actions: GITHUB_REPOSITORY (format: "owner/repo"), GITHUB_SERVER_URL
14
+ * - Vercel: VERCEL_GIT_REPO_OWNER, VERCEL_GIT_REPO_SLUG
15
+ * - GitLab CI: Not available (falls back to git)
16
+ * - Local: Falls back to git origin remote
14
17
  */
15
18
  async function getRepoName(repoRoot) {
19
+ // GitHub Actions: GITHUB_REPOSITORY = "owner/repo"
20
+ if (process.env.GITHUB_REPOSITORY) {
21
+ const serverUrl = process.env.GITHUB_SERVER_URL || 'https://github.com';
22
+ return `${serverUrl}/${process.env.GITHUB_REPOSITORY}.git`;
23
+ }
24
+ // Vercel: Construct from owner + slug
25
+ if (process.env.VERCEL_GIT_REPO_OWNER && process.env.VERCEL_GIT_REPO_SLUG) {
26
+ return `https://github.com/${process.env.VERCEL_GIT_REPO_OWNER}/${process.env.VERCEL_GIT_REPO_SLUG}.git`;
27
+ }
28
+ // Fallback: git origin remote (local dev, GitLab CI)
16
29
  const git = (0, simple_git_1.default)(repoRoot);
17
- console.log(chalk_1.default.gray(' [DEBUG] getRepoName: Starting...'));
18
- console.log(chalk_1.default.gray(` [DEBUG] getRepoName: repoRoot = ${repoRoot}`));
19
30
  try {
20
31
  const remotes = await git.getRemotes(true);
21
- console.log(chalk_1.default.gray(` [DEBUG] getRepoName: Found ${remotes.length} remote(s)`));
22
- if (remotes.length > 0) {
23
- remotes.forEach((remote, idx) => {
24
- console.log(chalk_1.default.gray(` [DEBUG] getRepoName: Remote[${idx}] name="${remote.name}", fetch="${remote.refs?.fetch || 'N/A'}", push="${remote.refs?.push || 'N/A'}"`));
25
- });
26
- }
27
- else {
28
- console.log(chalk_1.default.yellow(' [DEBUG] getRepoName: No remotes found'));
29
- }
30
32
  const origin = remotes.find(r => r.name === 'origin');
31
- if (!origin) {
32
- console.log(chalk_1.default.yellow(' [DEBUG] getRepoName: No "origin" remote found'));
33
- return null;
34
- }
35
- console.log(chalk_1.default.gray(` [DEBUG] getRepoName: Found origin remote: fetch="${origin.refs?.fetch || 'N/A'}"`));
36
- if (!origin.refs?.fetch) {
37
- console.log(chalk_1.default.yellow(' [DEBUG] getRepoName: Origin remote found but no fetch URL'));
38
- return null;
39
- }
40
- console.log(chalk_1.default.green(` [DEBUG] getRepoName: Success - returning "${origin.refs.fetch}"`));
41
- // Return raw URL - let server handle normalization if needed
42
- return origin.refs.fetch;
33
+ return origin?.refs?.fetch || null;
43
34
  }
44
- catch (error) {
45
- console.log(chalk_1.default.red(` [DEBUG] getRepoName: Error occurred: ${error.message || error}`));
46
- if (error.stack) {
47
- console.log(chalk_1.default.gray(` [DEBUG] getRepoName: Stack: ${error.stack}`));
48
- }
35
+ catch {
49
36
  return null;
50
37
  }
51
38
  }
52
39
  /**
53
- * Gets current branch name from git.
54
- * Returns null if not in a git repo or error occurs.
40
+ * Gets branch name. Prefers CI environment variables over git commands.
41
+ *
42
+ * CI Environment Variables:
43
+ * - GitHub Actions: GITHUB_REF_NAME
44
+ * - Vercel: VERCEL_GIT_COMMIT_REF
45
+ * - GitLab CI: CI_COMMIT_REF_NAME
46
+ * - Local: Falls back to git revparse --abbrev-ref HEAD
55
47
  */
56
48
  async function getBranchName(repoRoot) {
49
+ if (process.env.GITHUB_REF_NAME)
50
+ return process.env.GITHUB_REF_NAME;
51
+ if (process.env.VERCEL_GIT_COMMIT_REF)
52
+ return process.env.VERCEL_GIT_COMMIT_REF;
53
+ if (process.env.CI_COMMIT_REF_NAME)
54
+ return process.env.CI_COMMIT_REF_NAME;
55
+ // Fallback: git command
57
56
  const git = (0, simple_git_1.default)(repoRoot);
58
- console.log(chalk_1.default.gray(' [DEBUG] getBranchName: Starting...'));
59
- console.log(chalk_1.default.gray(` [DEBUG] getBranchName: repoRoot = ${repoRoot}`));
60
57
  try {
61
- const branch = await git.revparse(['--abbrev-ref', 'HEAD']);
62
- console.log(chalk_1.default.gray(` [DEBUG] getBranchName: git revparse --abbrev-ref HEAD returned: "${branch || '(empty)'}"`));
63
- if (!branch) {
64
- console.log(chalk_1.default.yellow(' [DEBUG] getBranchName: Git command returned empty string'));
65
- return null;
66
- }
67
- console.log(chalk_1.default.green(` [DEBUG] getBranchName: Success - returning "${branch}"`));
68
- return branch;
58
+ return await git.revparse(['--abbrev-ref', 'HEAD']) || null;
69
59
  }
70
- catch (error) {
71
- console.log(chalk_1.default.red(` [DEBUG] getBranchName: Error occurred: ${error.message || error}`));
72
- if (error.stack) {
73
- console.log(chalk_1.default.gray(` [DEBUG] getBranchName: Stack: ${error.stack}`));
74
- }
60
+ catch {
75
61
  return null;
76
62
  }
77
63
  }
@@ -1,42 +1,15 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
2
  Object.defineProperty(exports, "__esModule", { value: true });
6
3
  exports.getAutoReviewTarget = getAutoReviewTarget;
7
- const chalk_1 = __importDefault(require("chalk"));
8
4
  function getAutoReviewTarget() {
9
- console.log(chalk_1.default.gray(' [DEBUG] getAutoReviewTarget: Starting detection...'));
10
- // Log ALL GitHub Actions env vars that start with GITHUB_ to see what's available
11
- if (process.env.GITHUB_ACTIONS) {
12
- console.log(chalk_1.default.gray(' [DEBUG] getAutoReviewTarget: All GITHUB_* env vars:'));
13
- const githubVars = Object.keys(process.env)
14
- .filter(key => key.startsWith('GITHUB_'))
15
- .sort();
16
- githubVars.forEach(key => {
17
- const value = process.env[key];
18
- // Truncate long values for readability
19
- const displayValue = value && value.length > 100 ? value.substring(0, 100) + '...' : value;
20
- console.log(chalk_1.default.gray(` ${key} = "${displayValue || 'NOT SET'}"`));
21
- });
22
- }
23
- // 1. Check for PR/MR context (most authoritative)
24
- // GitHub Actions PR
25
- console.log(chalk_1.default.gray(` [DEBUG] getAutoReviewTarget: Checking GitHub Actions PR...`));
26
- console.log(chalk_1.default.gray(` [DEBUG] getAutoReviewTarget: GITHUB_EVENT_NAME = "${process.env.GITHUB_EVENT_NAME || 'NOT SET'}"`));
5
+ // 1. PR/MR context
27
6
  if (process.env.GITHUB_EVENT_NAME === 'pull_request') {
28
7
  const targetBranch = process.env.GITHUB_BASE_REF;
29
8
  const sourceBranch = process.env.GITHUB_HEAD_REF;
30
- // Try multiple possible env var names for PR number
31
- const prNumber = process.env.GITHUB_EVENT_PULL_REQUEST_NUMBER ||
32
- process.env.GITHUB_PR_NUMBER ||
33
- process.env.GITHUB_EVENT_NUMBER;
34
- console.log(chalk_1.default.gray(` [DEBUG] getAutoReviewTarget: GITHUB_BASE_REF = "${targetBranch || 'NOT SET'}"`));
35
- console.log(chalk_1.default.gray(` [DEBUG] getAutoReviewTarget: GITHUB_HEAD_REF = "${sourceBranch || 'NOT SET'}"`));
36
- console.log(chalk_1.default.gray(` [DEBUG] getAutoReviewTarget: GITHUB_EVENT_PULL_REQUEST_NUMBER = "${process.env.GITHUB_EVENT_PULL_REQUEST_NUMBER || 'NOT SET'}"`));
37
- console.log(chalk_1.default.gray(` [DEBUG] getAutoReviewTarget: GITHUB_EVENT_NUMBER = "${process.env.GITHUB_EVENT_NUMBER || 'NOT SET'}"`));
9
+ const prNumber = process.env.GITHUB_EVENT_PULL_REQUEST_NUMBER || process.env.GITHUB_EVENT_NUMBER;
10
+ // Log PR detection for verification (remove after confirming it works)
11
+ console.log(`[PR Detection] GITHUB_BASE_REF=${targetBranch || 'NOT SET'}, GITHUB_HEAD_REF=${sourceBranch || 'NOT SET'}, PR_NUMBER=${prNumber || 'NOT SET'}`);
38
12
  if (targetBranch && sourceBranch && prNumber) {
39
- console.log(chalk_1.default.green(` [DEBUG] getAutoReviewTarget: Detected GitHub PR #${prNumber}`));
40
13
  return {
41
14
  type: 'pr',
42
15
  value: prNumber,
@@ -44,66 +17,36 @@ function getAutoReviewTarget() {
44
17
  targetBranch
45
18
  };
46
19
  }
47
- else {
48
- console.log(chalk_1.default.yellow(' [DEBUG] getAutoReviewTarget: GitHub PR env vars incomplete'));
49
- }
50
20
  }
51
- // GitLab CI MR
52
- console.log(chalk_1.default.gray(` [DEBUG] getAutoReviewTarget: Checking GitLab CI MR...`));
53
- console.log(chalk_1.default.gray(` [DEBUG] getAutoReviewTarget: CI_MERGE_REQUEST_IID = "${process.env.CI_MERGE_REQUEST_IID || 'NOT SET'}"`));
54
21
  if (process.env.CI_MERGE_REQUEST_IID) {
55
22
  const targetBranch = process.env.CI_MERGE_REQUEST_TARGET_BRANCH_NAME;
56
23
  const sourceBranch = process.env.CI_MERGE_REQUEST_SOURCE_BRANCH_NAME;
57
24
  const mrNumber = process.env.CI_MERGE_REQUEST_IID;
58
- const mrTitle = process.env.CI_MERGE_REQUEST_TITLE; // Reliable GitLab CI env var
59
- console.log(chalk_1.default.gray(` [DEBUG] getAutoReviewTarget: CI_MERGE_REQUEST_TARGET_BRANCH_NAME = "${targetBranch || 'NOT SET'}"`));
60
- console.log(chalk_1.default.gray(` [DEBUG] getAutoReviewTarget: CI_MERGE_REQUEST_SOURCE_BRANCH_NAME = "${sourceBranch || 'NOT SET'}"`));
61
- console.log(chalk_1.default.gray(` [DEBUG] getAutoReviewTarget: CI_MERGE_REQUEST_TITLE = "${mrTitle || 'NOT SET'}"`));
25
+ const mrTitle = process.env.CI_MERGE_REQUEST_TITLE;
62
26
  if (targetBranch && sourceBranch && mrNumber) {
63
- console.log(chalk_1.default.green(` [DEBUG] getAutoReviewTarget: Detected GitLab MR #${mrNumber}`));
64
27
  return {
65
28
  type: 'mr',
66
29
  value: mrNumber,
67
30
  sourceBranch,
68
31
  targetBranch,
69
- prTitle: mrTitle || undefined // Only include if present
32
+ prTitle: mrTitle || undefined
70
33
  };
71
34
  }
72
- else {
73
- console.log(chalk_1.default.yellow(' [DEBUG] getAutoReviewTarget: GitLab MR env vars incomplete'));
74
- }
75
35
  }
76
- // 2. Check for branch name (CI with branch)
77
- console.log(chalk_1.default.gray(` [DEBUG] getAutoReviewTarget: Checking branch env vars...`));
78
- console.log(chalk_1.default.gray(` [DEBUG] getAutoReviewTarget: GITHUB_REF_NAME = "${process.env.GITHUB_REF_NAME || 'NOT SET'}"`));
79
- console.log(chalk_1.default.gray(` [DEBUG] getAutoReviewTarget: CI_COMMIT_REF_NAME = "${process.env.CI_COMMIT_REF_NAME || 'NOT SET'}"`));
80
- console.log(chalk_1.default.gray(` [DEBUG] getAutoReviewTarget: VERCEL_GIT_COMMIT_REF = "${process.env.VERCEL_GIT_COMMIT_REF || 'NOT SET'}"`));
81
- const branch = process.env.GITHUB_REF_NAME || // GitHub Actions
82
- process.env.CI_COMMIT_REF_NAME || // GitLab CI
83
- process.env.VERCEL_GIT_COMMIT_REF; // Vercel
36
+ // 2. Branch name
37
+ const branch = process.env.GITHUB_REF_NAME ||
38
+ process.env.CI_COMMIT_REF_NAME ||
39
+ process.env.VERCEL_GIT_COMMIT_REF;
84
40
  if (branch) {
85
- console.log(chalk_1.default.green(` [DEBUG] getAutoReviewTarget: Detected branch "${branch}"`));
86
- return {
87
- type: 'branch',
88
- value: branch
89
- };
41
+ return { type: 'branch', value: branch };
90
42
  }
91
- // 3. Check for commit SHA (CI without branch)
92
- console.log(chalk_1.default.gray(` [DEBUG] getAutoReviewTarget: Checking commit SHA env vars...`));
93
- console.log(chalk_1.default.gray(` [DEBUG] getAutoReviewTarget: GITHUB_SHA = "${process.env.GITHUB_SHA || 'NOT SET'}"`));
94
- console.log(chalk_1.default.gray(` [DEBUG] getAutoReviewTarget: CI_COMMIT_SHA = "${process.env.CI_COMMIT_SHA || 'NOT SET'}"`));
95
- console.log(chalk_1.default.gray(` [DEBUG] getAutoReviewTarget: VERCEL_GIT_COMMIT_SHA = "${process.env.VERCEL_GIT_COMMIT_SHA || 'NOT SET'}"`));
96
- const commit = process.env.GITHUB_SHA || // GitHub Actions
97
- process.env.CI_COMMIT_SHA || // GitLab CI
98
- process.env.VERCEL_GIT_COMMIT_SHA; // Vercel
43
+ // 3. Commit SHA
44
+ const commit = process.env.GITHUB_SHA ||
45
+ process.env.CI_COMMIT_SHA ||
46
+ process.env.VERCEL_GIT_COMMIT_SHA;
99
47
  if (commit) {
100
- console.log(chalk_1.default.green(` [DEBUG] getAutoReviewTarget: Detected commit "${commit}"`));
101
- return {
102
- type: 'commit',
103
- value: commit
104
- };
48
+ return { type: 'commit', value: commit };
105
49
  }
106
- // 4. Local development (no CI env vars)
107
- console.log(chalk_1.default.yellow(' [DEBUG] getAutoReviewTarget: No CI env vars detected - returning null (local mode)'));
50
+ // 4. Local development
108
51
  return null;
109
52
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "threadlines",
3
- "version": "0.1.15",
3
+ "version": "0.1.17",
4
4
  "description": "Threadline CLI - AI-powered linter based on your natural language documentation",
5
5
  "main": "dist/index.js",
6
6
  "bin": {