Skip to content

fix(init): skip hook injection for uninstalled tools#133

Closed
jeff-r2026 wants to merge 7 commits into
Tencent:mainfrom
jeff-r2026:worktree-fix+hooks-tool-detection
Closed

fix(init): skip hook injection for uninstalled tools#133
jeff-r2026 wants to merge 7 commits into
Tencent:mainfrom
jeff-r2026:worktree-fix+hooks-tool-detection

Conversation

@jeff-r2026

Copy link
Copy Markdown
Collaborator

Summary

  • injectHooksToAllTools now checks whether the tool's root directory exists before writing hooks
  • Prevents creating .claude-internal, .tclaude, .tcodex, .codex-internal etc. for tools the user hasn't installed
  • Aligns hook injection behavior with pull.ts which already uses isToolInstalled checks

Test plan

  • Unit test: mock pathExists to return false → tool skipped
  • E2E test: only pre-created tool dirs receive hooks, others untouched
  • Full test suite passes (976 tests)
  • Manual verification: tmpdir with only .claude → only .claude/settings.json written

🤖 Generated with Claude Code

jeff-r2026 and others added 7 commits May 20, 2026 19:40
Show user and project scope storage paths (e.g. ~/.teamai/, $PWD/.teamai/)
before the scope selection prompt so users know where data will be stored.

Closes Tencent#7
…ope-paths

feat(init): display storage paths when prompting for scope
Resolves Tencent#6. Instead of spawning N separate `teamai <subcommand>` processes
per Claude Code hook event, introduce a unified `teamai hook-dispatch <event>`
command that reads STDIN once and fans out to all handlers internally.

Key changes:
- New dispatcher core (hook-dispatch.ts) with routing, isolation via
  Promise.allSettled, per-handler timeout, and output merging
- Handler registry (hook-handlers.ts) wrapping existing subcommand logic
- hooks.ts now emits 9 merged dispatch entries instead of 13 individual ones
- Legacy hooks are auto-cleaned on next `teamai hooks inject`
- Backward compatible: standalone subcommands (pull, track, etc.) unchanged

Performance: lightweight events (prompt-submit) drop from ~1040ms to ~220ms
by eliminating redundant Node.js cold starts.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…format

The E2E test file still expected the old 13-hook format. Updated to match
the new 9-entry dispatch format (1 per event+matcher instead of N per event).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
feat: merge multiple hooks per event into single hook-dispatch process
feat: auto-migrate hooks to dispatch format on first session after update
injectHooksToAllTools now checks whether the tool's root directory exists
before writing hooks, preventing creation of .claude-internal, .tclaude,
.tcodex etc. directories for tools the user hasn't installed.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@jeff-r2026

Copy link
Copy Markdown
Collaborator Author

Closing in favor of a clean PR with a single commit (no merge history noise).

@jeff-r2026 jeff-r2026 closed this Jul 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant