Skip to content

fix(plugin): use CLAUDE_PROJECT_DIR in user-prompt-submit hook (#1236)#1240

Merged
JeremyDev87 merged 1 commit into
masterfrom
taskmaestro/1775233185/pane-1
Apr 3, 2026
Merged

fix(plugin): use CLAUDE_PROJECT_DIR in user-prompt-submit hook (#1236)#1240
JeremyDev87 merged 1 commit into
masterfrom
taskmaestro/1775233185/pane-1

Conversation

@JeremyDev87

Copy link
Copy Markdown
Owner

Summary

  • Use CLAUDE_PROJECT_DIR env var instead of os.getcwd() for MCP detection and ModeEngine cwd in user-prompt-submit.py
  • Fixes incorrect standalone mode fallback when hook process cwd differs from project directory
  • Adds two tests verifying CLAUDE_PROJECT_DIR override for both .claude/mcp.json and project-level .mcp.json

Closes #1236

Test plan

  • python3 -m pytest hooks/test_user_prompt_submit.py -v — 37/37 passed
  • yarn workspace codingbuddy test — 5822 passed

Use CLAUDE_PROJECT_DIR env var instead of os.getcwd() for MCP detection
and ModeEngine cwd, matching session-start.py behavior. When hook process
cwd differs from the project dir, MCP detection now works correctly.
@vercel

vercel Bot commented Apr 3, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
codingbuddy-landing Ready Ready Preview, Comment Apr 3, 2026 5:24pm

@JeremyDev87 JeremyDev87 left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review: ✅ APPROVE

CI Status: ALL PASS

Code Review

user-prompt-submit.py — Clean, minimal fix:

  • project_dir = os.environ.get("CLAUDE_PROJECT_DIR", os.getcwd()) — matches session-start.py pattern
  • Both is_mcp_available() and ModeEngine() now receive resolved project_dir
  • No unused imports, no dead code

test_user_prompt_submit.py — Two well-structured tests:

  • test_claude_project_dir_env_overrides_cwd: Sets HOME/CLAUDE_PROJECT_DIR/cwd to different dirs, verifies MCP detection uses CLAUDE_PROJECT_DIR
  • test_claude_project_dir_with_project_mcp_json: Tests project-level .mcp.json detection via CLAUDE_PROJECT_DIR

Issues Found: None

Recommendation: APPROVE

@JeremyDev87 JeremyDev87 self-assigned this Apr 3, 2026
@JeremyDev87 JeremyDev87 merged commit abb324c into master Apr 3, 2026
28 checks passed
@JeremyDev87 JeremyDev87 deleted the taskmaestro/1775233185/pane-1 branch April 3, 2026 17:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(plugin): use CLAUDE_PROJECT_DIR in user-prompt-submit hook (#1236)

1 participant