1717def get_project_info ():
1818 """
1919 Retrieves project name and description from pyproject.toml.
20-
20+
2121 Returns:
2222 tuple: (name, description) or ("Unknown", "No description available.").
2323 """
@@ -36,7 +36,7 @@ def get_commands():
3636 commands_dir = os .path .join (".gemini" , "commands" )
3737 if not os .path .isdir (commands_dir ):
3838 return []
39-
39+
4040 commands = []
4141 for filename in sorted (os .listdir (commands_dir )):
4242 if filename .endswith (".toml" ):
@@ -53,10 +53,17 @@ def get_commands():
5353 continue
5454 return commands
5555
56+ def is_pre_commit_installed ():
57+ """
58+ Checks if the pre-commit hook is installed in git.
59+ """
60+ hook_path = os .path .join (".git" , "hooks" , "pre-commit" )
61+ return os .path .exists (hook_path ) and os .access (hook_path , os .X_OK )
62+
5663def main ():
5764 """
5865 Main entry point for the welcome message hook.
59-
66+
6067 Reads stdin and returns JSON response with a systemMessage containing project context.
6168 """
6269 # Read stdin though we don't strictly need it for this simple message
@@ -67,27 +74,35 @@ def main():
6774
6875 name , description = get_project_info ()
6976 git_status_str = utils .get_git_status_short ()
70-
77+
7178 if git_status_str :
7279 status_msg = f"⚠️ Uncommitted changes:\n { git_status_str } "
7380 else :
7481 status_msg = "✅ Working tree is clean."
7582
7683 commands = get_commands ()
7784 command_lines = [f"- `/{ cmd_name } `: { desc } " for cmd_name , desc in commands if cmd_name != "onboard" ]
78-
85+
7986 message_lines = [
8087 f"🚀 Welcome to Gemini CLI for `{ name } `" ,
8188 f"📝 { description } " ,
8289 " " ,
8390 "📊 Git Status:" ,
8491 status_msg ,
8592 " " ,
93+ ]
94+
95+ if not is_pre_commit_installed ():
96+ message_lines .append ("🚨 **Warning**: Git pre-commit hook is not installed." )
97+ message_lines .append ("💡 Suggestion: Run `make install-hooks` to enable automatic validation." )
98+ message_lines .append (" " )
99+
100+ message_lines .extend ([
86101 "🛠️ Available Commands:" ,
87102 * command_lines ,
88103 " " ,
89- ]
90-
104+ ])
105+
91106 if any (cmd [0 ] == "onboard" for cmd in commands ):
92107 message_lines .append ("💡 Tip: Run `/onboard` for a brief explanation of the project." )
93108
@@ -101,7 +116,7 @@ def main():
101116 }
102117
103118 utils .send_hook_decision (
104- "allow" ,
119+ "allow" ,
105120 system_message = system_message ,
106121 hook_output = hook_output
107122 )
0 commit comments