The post-checkout hook automatically creates .idea/scopes/ticket___code.xml with ticket-specific patterns:
<component name="DependencyValidationManager">
<scope name="ticket & code"
pattern="(!file:*//*&&!file:*||
file:docs//*&&(!file:docs/CRs//*||
file:docs/CRs/*101*||
file:docs/CRs/*101//*)||
file:tests//*||
file:src//*||
file:shared//*||
file:server//*||
file:mcp-server//*||
file:playwright*||
file:package*||
file:README*||
file:prompts//*)&&!file:**/dist//*" />
</component>This scope filters files to show:
- All
docs/CRs/*101*files (ticket-specific) - Core code directories:
tests/,src/,shared/,server/,mcp-server/ - Build and package files
- Excludes
dist/directories
- Open the worktree in IntelliJ IDEA
- Go to File → Settings → Editor → Inspections → Scope
- Select the "ticket & code" scope
- Use it for:
- Running inspections on ticket-specific code
- Code analysis limited to ticket scope
- Find references within ticket context
For VS Code users, you can add this to .vscode/settings.json:
{
"files.exclude": {
"**/node_modules": true,
"**/dist": true,
"**/.git": true
},
"search.exclude": {
"**/node_modules": true,
"**/dist": true
}
}-
"parse error near '}'"
- Ensure you're using bash/zsh, not plain sh
- Check for unescaped quotes in the alias
-
Worktree path not expanding
~- Use
$HOMEinstead of~in config - Or ensure the script includes
~expansion
- Use
-
Post-checkout hook not running
- Check hook is executable:
chmod +x .git/hooks/post-checkout - Verify you're in a worktree:
git rev-parse --git-dirshould show.git/worktrees/...
- Check hook is executable:
-
IDEA scope not created
- Check hook output: Should show "Created IDEA scope file..."
- Verify
.idea/scopes/directory exists - Check branch name contains 3 digits
Add debug output to the script:
# Add at the beginning of the function
set -x # Enable debug modeOr create a debug version:
git config --global alias.wt-debug '!f() {
set -x
# ... rest of script ...
}; f'# Remove all worktree configurations
git config --global --unset worktree.defaultPath
git config --unset worktree.defaultPath
# Reset git alias
git config --global --unset alias.wt
# Remove post-checkout hook
rm .git/hooks/post-checkout