threadlines 0.2.11 → 0.2.12

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.
Files changed (2) hide show
  1. package/dist/git/diff.js +14 -14
  2. package/package.json +1 -1
package/dist/git/diff.js CHANGED
@@ -7,6 +7,7 @@ exports.getCommitMessage = getCommitMessage;
7
7
  exports.getCommitAuthor = getCommitAuthor;
8
8
  exports.getCommitDiff = getCommitDiff;
9
9
  const simple_git_1 = __importDefault(require("simple-git"));
10
+ const child_process_1 = require("child_process");
10
11
  /**
11
12
  * Get commit message for a specific commit SHA
12
13
  * Returns full commit message (subject + body) or null if commit not found
@@ -26,26 +27,25 @@ async function getCommitMessage(repoRoot, sha) {
26
27
  /**
27
28
  * Get commit author name and email for a specific commit SHA or HEAD.
28
29
  *
29
- * Uses git log to extract author information from the commit.
30
+ * Uses raw git log command to extract author information.
30
31
  * Works in all environments where git is available.
31
32
  */
32
33
  async function getCommitAuthor(repoRoot, sha) {
33
- const git = (0, simple_git_1.default)(repoRoot);
34
34
  try {
35
- let logResult;
36
- if (sha) {
37
- // Use git log for specific commit SHA
38
- logResult = await git.log({ from: sha, to: sha, maxCount: 1 });
39
- }
40
- else {
41
- // Use git log for HEAD (local environment only)
42
- logResult = await git.log({ maxCount: 1 });
43
- }
44
- if (!logResult.latest) {
35
+ // Use raw git command (same as test scripts) - more reliable than simple-git API
36
+ const commitRef = sha || 'HEAD';
37
+ const command = `git log -1 --format="%an <%ae>" ${commitRef}`;
38
+ const output = (0, child_process_1.execSync)(command, {
39
+ encoding: 'utf-8',
40
+ cwd: repoRoot
41
+ }).trim();
42
+ // Parse output: "Name <email>"
43
+ const match = output.match(/^(.+?)\s*<(.+?)>$/);
44
+ if (!match) {
45
45
  return null;
46
46
  }
47
- const name = logResult.latest.author_name?.trim();
48
- const email = logResult.latest.author_email?.trim();
47
+ const name = match[1].trim();
48
+ const email = match[2].trim();
49
49
  if (!name || !email) {
50
50
  return null;
51
51
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "threadlines",
3
- "version": "0.2.11",
3
+ "version": "0.2.12",
4
4
  "description": "Threadlines CLI - AI-powered linter based on your natural language documentation",
5
5
  "main": "dist/index.js",
6
6
  "bin": {