threadlines 0.1.12 → 0.1.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 +25 -4
- package/dist/index.js +1 -1
- package/package.json +1 -1
package/dist/commands/check.js
CHANGED
|
@@ -47,6 +47,26 @@ const config_1 = require("../utils/config");
|
|
|
47
47
|
const fs = __importStar(require("fs"));
|
|
48
48
|
const path = __importStar(require("path"));
|
|
49
49
|
const chalk_1 = __importDefault(require("chalk"));
|
|
50
|
+
/**
|
|
51
|
+
* Detect the environment where the check is being run
|
|
52
|
+
* Returns: 'vercel', 'github', 'gitlab', or 'local'
|
|
53
|
+
*/
|
|
54
|
+
function detectEnvironment() {
|
|
55
|
+
// Vercel: VERCEL env var is always set in Vercel builds
|
|
56
|
+
if (process.env.VERCEL) {
|
|
57
|
+
return 'vercel';
|
|
58
|
+
}
|
|
59
|
+
// GitHub Actions: GITHUB_ACTIONS env var is always set
|
|
60
|
+
if (process.env.GITHUB_ACTIONS) {
|
|
61
|
+
return 'github';
|
|
62
|
+
}
|
|
63
|
+
// GitLab CI: GITLAB_CI env var is always set, or CI is set with GitLab-specific vars
|
|
64
|
+
if (process.env.GITLAB_CI || (process.env.CI && process.env.CI_COMMIT_SHA)) {
|
|
65
|
+
return 'gitlab';
|
|
66
|
+
}
|
|
67
|
+
// Local development: none of the above
|
|
68
|
+
return 'local';
|
|
69
|
+
}
|
|
50
70
|
async function checkCommand(options) {
|
|
51
71
|
const repoRoot = process.cwd();
|
|
52
72
|
console.log(chalk_1.default.blue('🔍 Threadline: Checking code against your threadlines...\n'));
|
|
@@ -214,14 +234,14 @@ async function checkCommand(options) {
|
|
|
214
234
|
// 4. Get repo name and branch name
|
|
215
235
|
const repoName = await (0, repo_1.getRepoName)(repoRoot);
|
|
216
236
|
const branchName = await (0, repo_1.getBranchName)(repoRoot);
|
|
217
|
-
// 5. Get API URL
|
|
237
|
+
// 5. Get API URL
|
|
218
238
|
const apiUrl = options.apiUrl ||
|
|
219
239
|
process.env.THREADLINE_API_URL ||
|
|
220
|
-
|
|
221
|
-
'http://localhost:3000';
|
|
240
|
+
'https://devthreadline.com';
|
|
222
241
|
// 6. Call review API
|
|
223
242
|
console.log(chalk_1.default.gray('🤖 Running threadline checks...'));
|
|
224
243
|
const client = new client_1.ReviewAPIClient(apiUrl);
|
|
244
|
+
const environment = detectEnvironment();
|
|
225
245
|
const response = await client.review({
|
|
226
246
|
threadlines: threadlinesWithContext,
|
|
227
247
|
diff: gitDiff.diff,
|
|
@@ -232,7 +252,8 @@ async function checkCommand(options) {
|
|
|
232
252
|
branchName: branchName || undefined,
|
|
233
253
|
commitSha: commitSha,
|
|
234
254
|
commitMessage: commitMessage,
|
|
235
|
-
prTitle: prTitle
|
|
255
|
+
prTitle: prTitle,
|
|
256
|
+
environment: environment
|
|
236
257
|
});
|
|
237
258
|
// 7. Display results (with filtering if --full not specified)
|
|
238
259
|
displayResults(response, options.full || false);
|
package/dist/index.js
CHANGED
|
@@ -61,7 +61,7 @@ program
|
|
|
61
61
|
program
|
|
62
62
|
.command('check')
|
|
63
63
|
.description('Check code against your threadlines')
|
|
64
|
-
.option('--api-url <url>', 'Threadline server URL', process.env.THREADLINE_API_URL ||
|
|
64
|
+
.option('--api-url <url>', 'Threadline server URL', process.env.THREADLINE_API_URL || 'https://devthreadline.com')
|
|
65
65
|
.option('--full', 'Show all results (compliant, attention, not_relevant). Default: only attention items')
|
|
66
66
|
.option('--branch <name>', 'Review all commits in branch vs base (e.g., --branch feature/new-feature)')
|
|
67
67
|
.option('--commit <ref>', 'Review specific commit. Accepts commit SHA or git reference (e.g., HEAD, HEAD~1, abc123). Example: --commit HEAD')
|