lunel-cli 0.1.38 → 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/index.js +26 -23
- package/package.json +1 -2
package/dist/index.js
CHANGED
|
@@ -11,7 +11,6 @@ import * as os from "os";
|
|
|
11
11
|
import { spawn, execSync, execFileSync } from "child_process";
|
|
12
12
|
import { createServer, createConnection } from "net";
|
|
13
13
|
import { createInterface } from "readline";
|
|
14
|
-
import { simpleGit } from "simple-git";
|
|
15
14
|
const DEFAULT_PROXY_URL = process.env.LUNEL_PROXY_URL || "https://gateway.lunel.dev";
|
|
16
15
|
const MANAGER_URL = process.env.LUNEL_MANAGER_URL || "https://manager.lunel.dev";
|
|
17
16
|
const CLI_ARGS = process.argv.slice(2);
|
|
@@ -23,7 +22,6 @@ const PTY_RELEASE_INFO_URL = process.env.LUNEL_PTY_INFO_URL ||
|
|
|
23
22
|
const VERBOSE_AI_LOGS = process.env.LUNEL_DEBUG_AI === "1";
|
|
24
23
|
// Root directory - sandbox all file operations to this
|
|
25
24
|
const ROOT_DIR = process.cwd();
|
|
26
|
-
const gitClient = simpleGit(ROOT_DIR);
|
|
27
25
|
// Terminal sessions (managed by Rust PTY binary)
|
|
28
26
|
const terminals = new Set();
|
|
29
27
|
// PTY binary process
|
|
@@ -607,26 +605,27 @@ async function handleGitLog(payload) {
|
|
|
607
605
|
return { commits };
|
|
608
606
|
}
|
|
609
607
|
async function handleGitCommitDetails(payload) {
|
|
610
|
-
const hash = payload.hash;
|
|
608
|
+
const hash = payload.hash?.trim();
|
|
611
609
|
if (!hash)
|
|
612
610
|
throw Object.assign(new Error("hash is required"), { code: "EINVAL" });
|
|
613
611
|
try {
|
|
614
|
-
const
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
});
|
|
625
|
-
const latest = logResult.latest;
|
|
626
|
-
if (!latest) {
|
|
612
|
+
const commitResult = await runGit(["show", "-s", "--format=%H%n%s%n%an%n%at", hash]);
|
|
613
|
+
if (commitResult.code !== 0 || !commitResult.stdout.trim()) {
|
|
614
|
+
throw Object.assign(new Error("Commit not found"), { code: "EGIT" });
|
|
615
|
+
}
|
|
616
|
+
const commitLines = commitResult.stdout.split(/\r?\n/);
|
|
617
|
+
const fullHash = commitLines[0]?.trim() || "";
|
|
618
|
+
const message = commitLines[1] ?? "";
|
|
619
|
+
const author = commitLines[2] ?? "";
|
|
620
|
+
const timestamp = Number.parseInt(commitLines[3] ?? "0", 10);
|
|
621
|
+
if (!fullHash) {
|
|
627
622
|
throw Object.assign(new Error("Commit not found"), { code: "EGIT" });
|
|
628
623
|
}
|
|
629
|
-
const
|
|
624
|
+
const filesResult = await runGit(["show", "--name-status", "--format=", hash]);
|
|
625
|
+
if (filesResult.code !== 0) {
|
|
626
|
+
throw Object.assign(new Error(filesResult.stderr || "git show failed"), { code: "EGIT" });
|
|
627
|
+
}
|
|
628
|
+
const filesRaw = filesResult.stdout;
|
|
630
629
|
const files = filesRaw
|
|
631
630
|
.split(/\r?\n/)
|
|
632
631
|
.map((line) => line.trim())
|
|
@@ -639,7 +638,11 @@ async function handleGitCommitDetails(payload) {
|
|
|
639
638
|
return { status, path };
|
|
640
639
|
})
|
|
641
640
|
.filter((entry) => !!entry.path);
|
|
642
|
-
const
|
|
641
|
+
const diffResult = await runGit(["show", "--patch", "--format=", hash]);
|
|
642
|
+
if (diffResult.code !== 0) {
|
|
643
|
+
throw Object.assign(new Error(diffResult.stderr || "git show failed"), { code: "EGIT" });
|
|
644
|
+
}
|
|
645
|
+
const diff = diffResult.stdout;
|
|
643
646
|
const fileDiffs = {};
|
|
644
647
|
const fileChunks = diff.split(/^diff --git /m).filter(Boolean);
|
|
645
648
|
for (const chunk of fileChunks) {
|
|
@@ -652,11 +655,11 @@ async function handleGitCommitDetails(payload) {
|
|
|
652
655
|
}
|
|
653
656
|
return {
|
|
654
657
|
commit: {
|
|
655
|
-
hash:
|
|
656
|
-
fullHash
|
|
657
|
-
message
|
|
658
|
-
author
|
|
659
|
-
date:
|
|
658
|
+
hash: fullHash.substring(0, 7),
|
|
659
|
+
fullHash,
|
|
660
|
+
message,
|
|
661
|
+
author,
|
|
662
|
+
date: timestamp * 1000,
|
|
660
663
|
},
|
|
661
664
|
files,
|
|
662
665
|
diff,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "lunel-cli",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.39",
|
|
4
4
|
"author": [
|
|
5
5
|
{
|
|
6
6
|
"name": "Soham Bharambe",
|
|
@@ -29,7 +29,6 @@
|
|
|
29
29
|
"@opencode-ai/sdk": "^1.1.56",
|
|
30
30
|
"ignore": "^6.0.2",
|
|
31
31
|
"qrcode-terminal": "^0.12.0",
|
|
32
|
-
"simple-git": "^3.32.3",
|
|
33
32
|
"ws": "^8.18.0"
|
|
34
33
|
},
|
|
35
34
|
"devDependencies": {
|