glop.dev 0.7.0 → 0.9.0
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 +35 -3
- package/package.json +2 -1
package/dist/index.js
CHANGED
|
@@ -73,6 +73,26 @@ function getGitUserEmail() {
|
|
|
73
73
|
return null;
|
|
74
74
|
}
|
|
75
75
|
}
|
|
76
|
+
function getCommitDiffStats() {
|
|
77
|
+
try {
|
|
78
|
+
const output = execSync("git diff --shortstat HEAD~1", {
|
|
79
|
+
encoding: "utf-8",
|
|
80
|
+
stdio: ["pipe", "pipe", "pipe"],
|
|
81
|
+
timeout: 3e3
|
|
82
|
+
}).trim();
|
|
83
|
+
if (!output) return null;
|
|
84
|
+
const files = output.match(/(\d+)\s+file/);
|
|
85
|
+
const insertions = output.match(/(\d+)\s+insertion/);
|
|
86
|
+
const deletions = output.match(/(\d+)\s+deletion/);
|
|
87
|
+
return {
|
|
88
|
+
files_changed: files ? parseInt(files[1], 10) : 0,
|
|
89
|
+
lines_added: insertions ? parseInt(insertions[1], 10) : 0,
|
|
90
|
+
lines_removed: deletions ? parseInt(deletions[1], 10) : 0
|
|
91
|
+
};
|
|
92
|
+
} catch {
|
|
93
|
+
return null;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
76
96
|
|
|
77
97
|
// src/lib/config.ts
|
|
78
98
|
var CONFIG_DIR = path.join(os.homedir(), ".glop");
|
|
@@ -480,6 +500,14 @@ var hookCommand = new Command4("__hook").description("internal").action(async ()
|
|
|
480
500
|
payload.machine_id = config.machine_id;
|
|
481
501
|
payload.git_user_name = getGitUserName();
|
|
482
502
|
payload.git_user_email = getGitUserEmail();
|
|
503
|
+
if (payload.hook_event_name === "PostToolUse" && payload.tool_name === "Bash" && typeof payload.tool_response === "string" && /\bgit\s+commit\b/.test(
|
|
504
|
+
typeof payload.tool_input?.command === "string" ? payload.tool_input.command : ""
|
|
505
|
+
) && /\[\w[^\]]*\s+[a-f0-9]{7,}\]/.test(payload.tool_response)) {
|
|
506
|
+
const diffStats = getCommitDiffStats();
|
|
507
|
+
if (diffStats) {
|
|
508
|
+
payload.commit_diff_stats = diffStats;
|
|
509
|
+
}
|
|
510
|
+
}
|
|
483
511
|
const skipSlugEvents = /* @__PURE__ */ new Set(["PostToolUse"]);
|
|
484
512
|
if (!skipSlugEvents.has(payload.hook_event_name) && typeof payload.transcript_path === "string") {
|
|
485
513
|
const slug = extractSlugFromTranscript(payload.transcript_path);
|
|
@@ -593,7 +621,8 @@ var initCommand = new Command5("init").description("Install Claude Code hooks in
|
|
|
593
621
|
hooks.SessionEnd = [hookGroup];
|
|
594
622
|
settings.hooks = hooks;
|
|
595
623
|
fs4.writeFileSync(settingsFile, JSON.stringify(settings, null, 2));
|
|
596
|
-
|
|
624
|
+
const workspace = config.workspace_name || config.workspace_slug || config.workspace_id || "default";
|
|
625
|
+
console.log(`${hadHooks ? "\u2713 glop updated" : "\u2713 glop connected"} to workspace "${workspace}" \u2014 sessions will appear at ${config.server_url}/live`);
|
|
597
626
|
});
|
|
598
627
|
|
|
599
628
|
// src/commands/update.ts
|
|
@@ -603,7 +632,9 @@ var updateCommand = new Command6("update").description("Update glop to the lates
|
|
|
603
632
|
console.log("Updating glop\u2026");
|
|
604
633
|
try {
|
|
605
634
|
execSync4("npm install -g glop.dev@latest", { stdio: "inherit" });
|
|
606
|
-
|
|
635
|
+
const version = execSync4("glop --version", { encoding: "utf-8" }).trim();
|
|
636
|
+
console.log(`
|
|
637
|
+
glop has been updated successfully to v${version}.`);
|
|
607
638
|
} catch {
|
|
608
639
|
process.exitCode = 1;
|
|
609
640
|
}
|
|
@@ -851,7 +882,7 @@ async function checkForUpdate(currentVersion) {
|
|
|
851
882
|
// package.json
|
|
852
883
|
var package_default = {
|
|
853
884
|
name: "glop.dev",
|
|
854
|
-
version: "0.
|
|
885
|
+
version: "0.9.0",
|
|
855
886
|
type: "module",
|
|
856
887
|
bin: {
|
|
857
888
|
glop: "./dist/index.js"
|
|
@@ -870,6 +901,7 @@ var package_default = {
|
|
|
870
901
|
commander: "^13.0.0"
|
|
871
902
|
},
|
|
872
903
|
devDependencies: {
|
|
904
|
+
"@types/node": "^25.5.0",
|
|
873
905
|
tsup: "^8.3.0",
|
|
874
906
|
tsx: "^4.19.0",
|
|
875
907
|
typescript: "^5.7.0",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "glop.dev",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.9.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"bin": {
|
|
6
6
|
"glop": "./dist/index.js"
|
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
"commander": "^13.0.0"
|
|
20
20
|
},
|
|
21
21
|
"devDependencies": {
|
|
22
|
+
"@types/node": "^25.5.0",
|
|
22
23
|
"tsup": "^8.3.0",
|
|
23
24
|
"tsx": "^4.19.0",
|
|
24
25
|
"typescript": "^5.7.0",
|