glop.dev 0.8.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.
Files changed (2) hide show
  1. package/dist/index.js +33 -2
  2. 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);
@@ -604,7 +632,9 @@ var updateCommand = new Command6("update").description("Update glop to the lates
604
632
  console.log("Updating glop\u2026");
605
633
  try {
606
634
  execSync4("npm install -g glop.dev@latest", { stdio: "inherit" });
607
- console.log("\nglop has been updated successfully.");
635
+ const version = execSync4("glop --version", { encoding: "utf-8" }).trim();
636
+ console.log(`
637
+ glop has been updated successfully to v${version}.`);
608
638
  } catch {
609
639
  process.exitCode = 1;
610
640
  }
@@ -852,7 +882,7 @@ async function checkForUpdate(currentVersion) {
852
882
  // package.json
853
883
  var package_default = {
854
884
  name: "glop.dev",
855
- version: "0.8.0",
885
+ version: "0.9.0",
856
886
  type: "module",
857
887
  bin: {
858
888
  glop: "./dist/index.js"
@@ -871,6 +901,7 @@ var package_default = {
871
901
  commander: "^13.0.0"
872
902
  },
873
903
  devDependencies: {
904
+ "@types/node": "^25.5.0",
874
905
  tsup: "^8.3.0",
875
906
  tsx: "^4.19.0",
876
907
  typescript: "^5.7.0",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "glop.dev",
3
- "version": "0.8.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",