[#592][refactor] Consolidate _get_agentize_home() into session_utils.py #597
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Consolidated duplicate AGENTIZE_HOME path resolution logic by moving the
_get_agentize_home()function fromworkflow.pyintosession_utils.pyas a publicget_agentize_home()function. This eliminates code duplication while maintaining workflow.py's self-contained design principle (since session_utils.py is part of the plugin lib).The new implementation also handles symlink resolution correctly using
os.path.realpath(), which fixes path derivation when imported via the.cursor/hooks/libsymlink.Changes
get_agentize_home()to.claude-plugin/lib/session_utils.py:12-35with symlink-aware path resolutionsession_dir()in.claude-plugin/lib/session_utils.py:89to useget_agentize_home()instead of directos.getenv()_get_agentize_home()from.claude-plugin/lib/workflow.py:145-168.claude-plugin/lib/workflow.py:29to importget_agentize_homefrom session_utils.claude-plugin/lib/logger.py:4,9to useget_agentize_home()in_tmp_dir().claude-plugin/lib/session_utils.mdto documentget_agentize_home()interface.claude-plugin/lib/README.md:51to reflect workflow.py's dependency on session_utilsTesting
tests/cli/test-workflow-module.sh:295-323(Tests 40-42) to import from session_utilstests/cli/test-handsoff-session-path.sh:47-62(Test 2) for new path derivation behaviortests/cli/test-cursor-hook-before-prompt-submit.sh:56-71(Test 3) for new behaviormake test-fast)Related Issue
Closes #592