Skip to content

Commit 04f50eb

Browse files
committed
fix(hooks): compute project name from git root for notification
1 parent 1cf2d5e commit 04f50eb

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

.gemini/hooks/notify.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,16 @@ def notify_user():
99
Fails gracefully if notify-send is not available.
1010
"""
1111
try:
12-
# Get the project name from the current directory
13-
project_name = os.path.basename(os.getcwd())
12+
# Get the project root from git
13+
try:
14+
project_root = subprocess.check_output(
15+
["git", "rev-parse", "--show-toplevel"],
16+
stderr=subprocess.DEVNULL
17+
).decode().strip()
18+
project_name = os.path.basename(project_root)
19+
except Exception:
20+
# Fallback to current directory if not in a git repo
21+
project_name = os.path.basename(os.getcwd())
1422

1523
# Determine the message based on the hook context
1624
message = f"Gemini CLI has finished in '{project_name}'"

0 commit comments

Comments
 (0)