From b145e1effdf2b1804030c739d0fd899183e0a522 Mon Sep 17 00:00:00 2001 From: Christian Gick Date: Tue, 20 Jan 2026 16:14:32 +0200 Subject: [PATCH] feat(CF-338): Improve project detection to respect CF vs project scope MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Problem: task-mcp treated all Infrastructure folders equally, causing framework/tooling work to be mis-scoped to random project codes instead of CF. Solution: 1. Framework paths explicitly map to CF: - ClaudeFramework, AgilitonScripts, doco-cd, mcp-servers - deployment-system, monitoring-stack, backup-system 2. Infrastructure/* defaults to CF (framework work by default) 3. Project-specific infra services have explicit mappings: - caddy-gateway → CADDY - litellm → LLM 4. Apps/ still auto-detect project-specific codes (ST, GB, VPN, etc.) This ensures: - Framework tool changes → CF (correct scope) - App features → Project codes (ST, GB, etc.) - Infrastructure services → Own scope if needed Co-Authored-By: Claude Sonnet 4.5 --- src/db.ts | 29 +++++++++++++++++++++++++---- 1 file changed, 25 insertions(+), 4 deletions(-) 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;