From b14dc087b114281aef40b89aef4d6c3ace109b58 Mon Sep 17 00:00:00 2001 From: Rushil Patel Date: Tue, 19 Aug 2025 11:30:52 -0700 Subject: [PATCH 1/3] fix: safe import for create claude session method in startup hook --- .../cli/commands/claude/config/claude_session_hook.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/codegen/cli/commands/claude/config/claude_session_hook.py b/src/codegen/cli/commands/claude/config/claude_session_hook.py index 374ef0462..2f14f1542 100755 --- a/src/codegen/cli/commands/claude/config/claude_session_hook.py +++ b/src/codegen/cli/commands/claude/config/claude_session_hook.py @@ -11,7 +11,6 @@ import sys from pathlib import Path -from codegen.cli.commands.claude.claude_session_api import create_claude_session from codegen.cli.utils.org import resolve_org_id # Add the codegen CLI to the path so we can import from it @@ -19,6 +18,11 @@ codegen_cli_dir = script_dir.parent.parent.parent sys.path.insert(0, str(codegen_cli_dir)) +try: + from codegen.cli.commands.claude.claude_session_api import create_claude_session +except ImportError: + create_claude_session = None + def main(): """Main hook function called by Claude Code.""" From d79265c30d65a37604cda772b1c929f85be7e128 Mon Sep 17 00:00:00 2001 From: Rushil Patel Date: Tue, 19 Aug 2025 11:38:25 -0700 Subject: [PATCH 2/3] fix: safe import --- src/codegen/cli/commands/claude/config/claude_session_hook.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/codegen/cli/commands/claude/config/claude_session_hook.py b/src/codegen/cli/commands/claude/config/claude_session_hook.py index 2f14f1542..c5021de9e 100755 --- a/src/codegen/cli/commands/claude/config/claude_session_hook.py +++ b/src/codegen/cli/commands/claude/config/claude_session_hook.py @@ -11,8 +11,6 @@ import sys from pathlib import Path -from codegen.cli.utils.org import resolve_org_id - # Add the codegen CLI to the path so we can import from it script_dir = Path(__file__).parent codegen_cli_dir = script_dir.parent.parent.parent @@ -20,6 +18,7 @@ try: from codegen.cli.commands.claude.claude_session_api import create_claude_session + from codegen.cli.utils.org import resolve_org_id except ImportError: create_claude_session = None From 7ca521c39b174a281d9603f66e6c30e65e58eb73 Mon Sep 17 00:00:00 2001 From: Rushil Patel Date: Tue, 19 Aug 2025 11:55:13 -0700 Subject: [PATCH 3/3] fix: update path location for codegen pacakge --- .../cli/commands/claude/config/claude_session_active_hook.py | 2 +- src/codegen/cli/commands/claude/config/claude_session_hook.py | 2 +- .../cli/commands/claude/config/claude_session_stop_hook.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/codegen/cli/commands/claude/config/claude_session_active_hook.py b/src/codegen/cli/commands/claude/config/claude_session_active_hook.py index 7aea27662..f48767242 100644 --- a/src/codegen/cli/commands/claude/config/claude_session_active_hook.py +++ b/src/codegen/cli/commands/claude/config/claude_session_active_hook.py @@ -13,7 +13,7 @@ # Add the codegen CLI to the path so we can import from it script_dir = Path(__file__).parent -codegen_cli_dir = script_dir.parent.parent.parent +codegen_cli_dir = script_dir.parent.parent.parent.parent sys.path.insert(0, str(codegen_cli_dir)) try: diff --git a/src/codegen/cli/commands/claude/config/claude_session_hook.py b/src/codegen/cli/commands/claude/config/claude_session_hook.py index c5021de9e..e9a1f138d 100755 --- a/src/codegen/cli/commands/claude/config/claude_session_hook.py +++ b/src/codegen/cli/commands/claude/config/claude_session_hook.py @@ -13,7 +13,7 @@ # Add the codegen CLI to the path so we can import from it script_dir = Path(__file__).parent -codegen_cli_dir = script_dir.parent.parent.parent +codegen_cli_dir = script_dir.parent.parent.parent.parent sys.path.insert(0, str(codegen_cli_dir)) try: diff --git a/src/codegen/cli/commands/claude/config/claude_session_stop_hook.py b/src/codegen/cli/commands/claude/config/claude_session_stop_hook.py index 6e954d55c..48ea07ddf 100644 --- a/src/codegen/cli/commands/claude/config/claude_session_stop_hook.py +++ b/src/codegen/cli/commands/claude/config/claude_session_stop_hook.py @@ -13,7 +13,7 @@ # Add the codegen CLI to the path so we can import from it script_dir = Path(__file__).parent -codegen_cli_dir = script_dir.parent.parent.parent +codegen_cli_dir = script_dir.parent.parent.parent.parent sys.path.insert(0, str(codegen_cli_dir)) try: