Fix: Improve role detection for all workspace paths
- Check for paths with leading slash (/joylo-admin) - Add fallback regex matching for different path formats - Fixes 'unknown' role detection for /srv/joylo-apps/joylo-admin - Now correctly identifies admin-dev, api-dev, web-dev 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -5,9 +5,17 @@ import { z } from 'zod';
|
||||
// Detect current developer role from workspace
|
||||
function detectRole(): string {
|
||||
const cwd = process.cwd();
|
||||
if (cwd.includes('joylo-admin')) return 'admin-dev';
|
||||
if (cwd.includes('joylo-api')) return 'api-dev';
|
||||
if (cwd.includes('joylo-web')) return 'web-dev';
|
||||
|
||||
// Check for specific workspace patterns with leading slash
|
||||
if (cwd.includes('/joylo-admin')) return 'admin-dev';
|
||||
if (cwd.includes('/joylo-api')) return 'api-dev';
|
||||
if (cwd.includes('/joylo-web')) return 'web-dev';
|
||||
|
||||
// Fallback for different path formats
|
||||
if (cwd.match(/admin/i)) return 'admin-dev';
|
||||
if (cwd.match(/api/i)) return 'api-dev';
|
||||
if (cwd.match(/web/i)) return 'web-dev';
|
||||
|
||||
return 'unknown';
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user