threadlines 0.1.37 → 0.1.39
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 +1 -0
- package/dist/git/vercel.js +20 -10
- package/package.json +2 -2
package/dist/commands/check.js
CHANGED
package/dist/git/vercel.js
CHANGED
|
@@ -17,6 +17,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
18
|
exports.getVercelContext = getVercelContext;
|
|
19
19
|
const simple_git_1 = __importDefault(require("simple-git"));
|
|
20
|
+
const child_process_1 = require("child_process");
|
|
20
21
|
const diff_1 = require("./diff");
|
|
21
22
|
/**
|
|
22
23
|
* Gets all Vercel context in one call - completely isolated from other environments.
|
|
@@ -75,7 +76,7 @@ async function getDiff(repoRoot) {
|
|
|
75
76
|
.filter(line => line.trim().length > 0)
|
|
76
77
|
.map(line => line.trim());
|
|
77
78
|
return {
|
|
78
|
-
diff: diff || '',
|
|
79
|
+
diff: diff || '', // Empty diff is legitimate (e.g., metadata-only commits, merge commits)
|
|
79
80
|
changedFiles
|
|
80
81
|
};
|
|
81
82
|
}
|
|
@@ -115,7 +116,10 @@ function getCommitSha() {
|
|
|
115
116
|
}
|
|
116
117
|
/**
|
|
117
118
|
* Gets commit author for Vercel
|
|
118
|
-
* Uses VERCEL_GIT_COMMIT_AUTHOR_NAME for name, git log for email
|
|
119
|
+
* Uses VERCEL_GIT_COMMIT_AUTHOR_NAME for name, raw git log command for email
|
|
120
|
+
*
|
|
121
|
+
* Uses raw `git log` command (same as test script) instead of simple-git library
|
|
122
|
+
* because simple-git's log method may not work correctly in Vercel's shallow clone.
|
|
119
123
|
*/
|
|
120
124
|
async function getCommitAuthorForVercel(repoRoot, commitSha) {
|
|
121
125
|
const authorName = process.env.VERCEL_GIT_COMMIT_AUTHOR_NAME;
|
|
@@ -123,14 +127,20 @@ async function getCommitAuthorForVercel(repoRoot, commitSha) {
|
|
|
123
127
|
throw new Error('Vercel: VERCEL_GIT_COMMIT_AUTHOR_NAME environment variable is not set. ' +
|
|
124
128
|
'This should be automatically provided by Vercel.');
|
|
125
129
|
}
|
|
126
|
-
//
|
|
127
|
-
|
|
128
|
-
|
|
130
|
+
// Use raw git log command (same approach as test script) - more reliable than simple-git
|
|
131
|
+
try {
|
|
132
|
+
const email = (0, child_process_1.execSync)(`git log ${commitSha} -1 --format=%ae`, { encoding: 'utf-8', cwd: repoRoot }).trim();
|
|
133
|
+
if (!email) {
|
|
134
|
+
throw new Error('Email is empty');
|
|
135
|
+
}
|
|
136
|
+
return {
|
|
137
|
+
name: authorName.trim(),
|
|
138
|
+
email: email.trim()
|
|
139
|
+
};
|
|
140
|
+
}
|
|
141
|
+
catch (error) {
|
|
129
142
|
throw new Error(`Vercel: Failed to get commit author email from git log for commit ${commitSha}. ` +
|
|
130
|
-
`This should be available in Vercel's build environment
|
|
143
|
+
`This should be available in Vercel's build environment. ` +
|
|
144
|
+
`Error: ${error instanceof Error ? error.message : 'Unknown error'}`);
|
|
131
145
|
}
|
|
132
|
-
return {
|
|
133
|
-
name: authorName.trim(),
|
|
134
|
-
email: gitAuthor.email.trim()
|
|
135
|
-
};
|
|
136
146
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "threadlines",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.39",
|
|
4
4
|
"description": "Threadline CLI - AI-powered linter based on your natural language documentation",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"bin": {
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"typecheck": "tsc --noEmit",
|
|
37
37
|
"check": "npm run lint && npm run typecheck",
|
|
38
38
|
"threadlines": "npx -y threadlines check",
|
|
39
|
-
"threadlines:local": "npx -y threadlines check ||
|
|
39
|
+
"threadlines:local": "npx -y threadlines check || exit 0",
|
|
40
40
|
"check:all": "npm run check && npm run threadlines"
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|