threadlines 0.2.12 → 0.2.13
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/commands/check.js +20 -1
- package/dist/git/bitbucket.js +14 -1
- package/dist/git/github.js +14 -1
- package/dist/git/gitlab.js +14 -1
- package/dist/git/local.js +3 -1
- package/dist/git/vercel.js +3 -1
- package/package.json +1 -1
package/dist/commands/check.js
CHANGED
|
@@ -149,6 +149,7 @@ async function checkCommand(options) {
|
|
|
149
149
|
let gitDiff;
|
|
150
150
|
let repoName;
|
|
151
151
|
let branchName;
|
|
152
|
+
let reviewContext;
|
|
152
153
|
let metadata = {};
|
|
153
154
|
// Check for explicit flags
|
|
154
155
|
const explicitFlags = [options.commit, options.file, options.folder, options.files].filter(Boolean);
|
|
@@ -180,6 +181,7 @@ async function checkCommand(options) {
|
|
|
180
181
|
gitDiff = envContext.diff;
|
|
181
182
|
repoName = envContext.repoName;
|
|
182
183
|
branchName = envContext.branchName;
|
|
184
|
+
reviewContext = envContext.reviewContext; // Get from CI context
|
|
183
185
|
metadata = {
|
|
184
186
|
commitSha: envContext.commitSha,
|
|
185
187
|
commitMessage: envContext.commitMessage,
|
|
@@ -190,6 +192,22 @@ async function checkCommand(options) {
|
|
|
190
192
|
}
|
|
191
193
|
else {
|
|
192
194
|
// Local environment: support all flags
|
|
195
|
+
// Detect review context from flags (priority order: file > folder > files > commit > local)
|
|
196
|
+
if (options.file) {
|
|
197
|
+
reviewContext = 'file';
|
|
198
|
+
}
|
|
199
|
+
else if (options.folder) {
|
|
200
|
+
reviewContext = 'folder';
|
|
201
|
+
}
|
|
202
|
+
else if (options.files && options.files.length > 0) {
|
|
203
|
+
reviewContext = 'files';
|
|
204
|
+
}
|
|
205
|
+
else if (options.commit) {
|
|
206
|
+
reviewContext = 'commit';
|
|
207
|
+
}
|
|
208
|
+
else {
|
|
209
|
+
reviewContext = 'local';
|
|
210
|
+
}
|
|
193
211
|
if (options.file) {
|
|
194
212
|
logger_1.logger.info(`Reading file: ${options.file}...`);
|
|
195
213
|
gitDiff = await (0, file_1.getFileContent)(repoRoot, options.file);
|
|
@@ -285,7 +303,8 @@ async function checkCommand(options) {
|
|
|
285
303
|
commitAuthorEmail: metadata.commitAuthorEmail,
|
|
286
304
|
prTitle: metadata.prTitle,
|
|
287
305
|
environment: environment,
|
|
288
|
-
cliVersion: CLI_VERSION
|
|
306
|
+
cliVersion: CLI_VERSION,
|
|
307
|
+
reviewContext: reviewContext
|
|
289
308
|
});
|
|
290
309
|
// 7. Display results (with filtering if --full not specified)
|
|
291
310
|
displayResults(response, options.full || false);
|
package/dist/git/bitbucket.js
CHANGED
|
@@ -41,6 +41,7 @@ async function getBitbucketContext(repoRoot) {
|
|
|
41
41
|
const repoName = getRepoName();
|
|
42
42
|
const branchName = getBranchName();
|
|
43
43
|
const context = detectContext();
|
|
44
|
+
const reviewContext = detectReviewContext();
|
|
44
45
|
const commitSha = getCommitSha();
|
|
45
46
|
// Get commit author (from git log - Bitbucket doesn't provide this as env var)
|
|
46
47
|
const commitAuthor = await getCommitAuthor(repoRoot);
|
|
@@ -60,7 +61,8 @@ async function getBitbucketContext(repoRoot) {
|
|
|
60
61
|
commitMessage,
|
|
61
62
|
commitAuthor,
|
|
62
63
|
prTitle: undefined, // Bitbucket doesn't expose PR title as env var
|
|
63
|
-
context
|
|
64
|
+
context,
|
|
65
|
+
reviewContext
|
|
64
66
|
};
|
|
65
67
|
}
|
|
66
68
|
/**
|
|
@@ -153,6 +155,17 @@ function detectContext() {
|
|
|
153
155
|
'Expected BITBUCKET_PR_ID or BITBUCKET_COMMIT to be set. ' +
|
|
154
156
|
'This should be automatically provided by Bitbucket Pipelines.');
|
|
155
157
|
}
|
|
158
|
+
/**
|
|
159
|
+
* Detects review context type for API (simple string type)
|
|
160
|
+
*/
|
|
161
|
+
function detectReviewContext() {
|
|
162
|
+
// PR context
|
|
163
|
+
if (process.env.BITBUCKET_PR_ID) {
|
|
164
|
+
return 'pr';
|
|
165
|
+
}
|
|
166
|
+
// Commit context (any push)
|
|
167
|
+
return 'commit';
|
|
168
|
+
}
|
|
156
169
|
/**
|
|
157
170
|
* Gets commit SHA from Bitbucket environment
|
|
158
171
|
*/
|
package/dist/git/github.js
CHANGED
|
@@ -35,6 +35,7 @@ async function getGitHubContext(repoRoot) {
|
|
|
35
35
|
const repoName = await getRepoName();
|
|
36
36
|
const branchName = await getBranchName();
|
|
37
37
|
const context = detectContext();
|
|
38
|
+
const reviewContext = detectReviewContext();
|
|
38
39
|
const commitSha = getCommitSha(context);
|
|
39
40
|
// Validate commit SHA is available (should always be set in GitHub Actions)
|
|
40
41
|
if (!commitSha) {
|
|
@@ -66,7 +67,8 @@ async function getGitHubContext(repoRoot) {
|
|
|
66
67
|
commitMessage,
|
|
67
68
|
commitAuthor,
|
|
68
69
|
prTitle,
|
|
69
|
-
context
|
|
70
|
+
context,
|
|
71
|
+
reviewContext
|
|
70
72
|
};
|
|
71
73
|
}
|
|
72
74
|
/**
|
|
@@ -188,6 +190,17 @@ function getCommitSha(context) {
|
|
|
188
190
|
}
|
|
189
191
|
return undefined;
|
|
190
192
|
}
|
|
193
|
+
/**
|
|
194
|
+
* Detects review context type for API (simple string type)
|
|
195
|
+
*/
|
|
196
|
+
function detectReviewContext() {
|
|
197
|
+
// PR context
|
|
198
|
+
if (process.env.GITHUB_EVENT_NAME === 'pull_request') {
|
|
199
|
+
return 'pr';
|
|
200
|
+
}
|
|
201
|
+
// Commit context (any push)
|
|
202
|
+
return 'commit';
|
|
203
|
+
}
|
|
191
204
|
/**
|
|
192
205
|
* Gets PR title for GitHub Actions
|
|
193
206
|
* Note: GitHub Actions doesn't provide PR title as an env var by default.
|
package/dist/git/gitlab.js
CHANGED
|
@@ -35,6 +35,7 @@ async function getGitLabContext(repoRoot) {
|
|
|
35
35
|
const repoName = await getRepoName();
|
|
36
36
|
const branchName = await getBranchName();
|
|
37
37
|
const context = detectContext();
|
|
38
|
+
const reviewContext = detectReviewContext();
|
|
38
39
|
const commitSha = getCommitSha(context);
|
|
39
40
|
// Get commit author (fails loudly if unavailable)
|
|
40
41
|
const commitAuthor = await getCommitAuthor();
|
|
@@ -56,7 +57,8 @@ async function getGitLabContext(repoRoot) {
|
|
|
56
57
|
commitMessage,
|
|
57
58
|
commitAuthor,
|
|
58
59
|
prTitle,
|
|
59
|
-
context
|
|
60
|
+
context,
|
|
61
|
+
reviewContext
|
|
60
62
|
};
|
|
61
63
|
}
|
|
62
64
|
/**
|
|
@@ -148,6 +150,17 @@ function detectContext() {
|
|
|
148
150
|
'Expected CI_MERGE_REQUEST_IID or CI_COMMIT_SHA to be set. ' +
|
|
149
151
|
'This should be automatically provided by GitLab CI.');
|
|
150
152
|
}
|
|
153
|
+
/**
|
|
154
|
+
* Detects review context type for API (simple string type)
|
|
155
|
+
*/
|
|
156
|
+
function detectReviewContext() {
|
|
157
|
+
// MR context
|
|
158
|
+
if (process.env.CI_MERGE_REQUEST_IID) {
|
|
159
|
+
return 'pr';
|
|
160
|
+
}
|
|
161
|
+
// Commit context (any push)
|
|
162
|
+
return 'commit';
|
|
163
|
+
}
|
|
151
164
|
/**
|
|
152
165
|
* Gets commit SHA from context
|
|
153
166
|
*/
|
package/dist/git/local.js
CHANGED
|
@@ -33,6 +33,7 @@ async function getLocalContext(repoRoot, commitSha) {
|
|
|
33
33
|
const repoName = await getRepoName(repoRoot);
|
|
34
34
|
const branchName = await getBranchName(repoRoot);
|
|
35
35
|
const context = commitSha ? { type: 'commit', commitSha } : { type: 'local' };
|
|
36
|
+
const reviewContext = commitSha ? 'commit' : 'local';
|
|
36
37
|
// Get commit author (fails loudly if unavailable)
|
|
37
38
|
const commitAuthor = commitSha
|
|
38
39
|
? await getCommitAuthorFromGit(repoRoot, commitSha)
|
|
@@ -53,7 +54,8 @@ async function getLocalContext(repoRoot, commitSha) {
|
|
|
53
54
|
commitMessage,
|
|
54
55
|
commitAuthor,
|
|
55
56
|
prTitle: undefined, // Not applicable for local
|
|
56
|
-
context
|
|
57
|
+
context,
|
|
58
|
+
reviewContext
|
|
57
59
|
};
|
|
58
60
|
}
|
|
59
61
|
/**
|
package/dist/git/vercel.js
CHANGED
|
@@ -35,6 +35,7 @@ async function getVercelContext(repoRoot) {
|
|
|
35
35
|
const branchName = await getBranchName();
|
|
36
36
|
const commitSha = getCommitSha();
|
|
37
37
|
const context = { type: 'commit', commitSha };
|
|
38
|
+
const reviewContext = 'commit';
|
|
38
39
|
// Get commit author (fails loudly if unavailable)
|
|
39
40
|
const commitAuthor = await getCommitAuthorForVercel(repoRoot, commitSha);
|
|
40
41
|
// Get commit message
|
|
@@ -50,7 +51,8 @@ async function getVercelContext(repoRoot) {
|
|
|
50
51
|
commitSha,
|
|
51
52
|
commitMessage,
|
|
52
53
|
commitAuthor,
|
|
53
|
-
context
|
|
54
|
+
context,
|
|
55
|
+
reviewContext
|
|
54
56
|
};
|
|
55
57
|
}
|
|
56
58
|
/**
|