diff --git a/src/db.ts b/src/db.ts index e9f512b..b3cfb26 100644 --- a/src/db.ts +++ b/src/db.ts @@ -74,7 +74,25 @@ export async function getNextTaskId(projectKey: string): Promise { export function detectProjectFromCwd(): string | null { const cwd = process.cwd(); - // Known project path patterns + // Framework/tooling infrastructure - these should default to CF + // These are cross-project systems, not standalone services + const frameworkPaths = [ + 'ClaudeFramework', + 'AgilitonScripts', + 'doco-cd', + 'mcp-servers', + 'deployment-system', + 'monitoring-stack', + 'backup-system', + ]; + + for (const framework of frameworkPaths) { + if (cwd.includes(`/${framework}/`) || cwd.endsWith(`/${framework}`)) { + return 'CF'; + } + } + + // Known project path patterns (Apps, standalone services) const patterns: Record = { 'SmartTranslate': 'ST', 'VPN': 'VPN', @@ -85,8 +103,6 @@ export function detectProjectFromCwd(): string | null { 'eToroGridbot': 'GB', 'WildFiles': 'WF', 'Circles': 'CIR', - 'ClaudeFramework': 'CF', - 'AgilitonScripts': 'AS', 'WHMCS': 'WHMCS', 'Cardscanner': 'CS', 'ZorkiOS': 'ZORK', @@ -94,6 +110,9 @@ export function detectProjectFromCwd(): string | null { 'PropertyMap': 'PM', 'Rubic': 'RUB', 'Socialguard': 'SG', + // Infrastructure services with their own scope + 'caddy-gateway': 'CADDY', + 'litellm': 'LLM', }; // Check each pattern @@ -109,9 +128,11 @@ export function detectProjectFromCwd(): string | null { return appsMatch[1].replace(/[a-z]/g, '').slice(0, 4) || appsMatch[1].slice(0, 3).toUpperCase(); } + // Infrastructure projects default to CF unless explicitly mapped above + // This ensures framework/tooling work goes to CF by default const infraMatch = cwd.match(/\/Infrastructure\/([^/]+)/); if (infraMatch) { - return infraMatch[1].replace(/[a-z]/g, '').slice(0, 4) || infraMatch[1].slice(0, 3).toUpperCase(); + return 'CF'; } return null;