Fix: Simplify role detection to work with all path formats
- Remove leading slash requirement - use includes() directly - Add word boundary regex for 'api' to avoid false matches - Covers /srv/joylo-api, /srv/joylo-apps/joylo-admin, etc - Should fix 'unknown' role detection issue 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -6,15 +6,15 @@ import { z } from 'zod';
|
|||||||
function detectRole(): string {
|
function detectRole(): string {
|
||||||
const cwd = process.cwd();
|
const cwd = process.cwd();
|
||||||
|
|
||||||
// Check for specific workspace patterns with leading slash
|
// Match patterns - check most specific first
|
||||||
if (cwd.includes('/joylo-admin')) return 'admin-dev';
|
if (cwd.includes('joylo-admin') || cwd.includes('joylo/admin')) return 'admin-dev';
|
||||||
if (cwd.includes('/joylo-api')) return 'api-dev';
|
if (cwd.includes('joylo-api') || cwd.includes('joylo/api')) return 'api-dev';
|
||||||
if (cwd.includes('/joylo-web')) return 'web-dev';
|
if (cwd.includes('joylo-web') || cwd.includes('joylo/web')) return 'web-dev';
|
||||||
|
|
||||||
// Fallback for different path formats
|
// Fallback regex
|
||||||
if (cwd.match(/admin/i)) return 'admin-dev';
|
if (/admin/i.test(cwd)) return 'admin-dev';
|
||||||
if (cwd.match(/api/i)) return 'api-dev';
|
if (/\bapi\b/i.test(cwd)) return 'api-dev';
|
||||||
if (cwd.match(/web/i)) return 'web-dev';
|
if (/\bweb\b/i.test(cwd)) return 'web-dev';
|
||||||
|
|
||||||
return 'unknown';
|
return 'unknown';
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user