feat(CF-338): Improve project detection to respect CF vs project scope

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 <noreply@anthropic.com>
This commit is contained in:
Christian Gick
2026-01-20 16:14:32 +02:00
parent 7f86d256c9
commit b145e1effd

View File

@@ -74,7 +74,25 @@ export async function getNextTaskId(projectKey: string): Promise<string> {
export function detectProjectFromCwd(): string | null { export function detectProjectFromCwd(): string | null {
const cwd = process.cwd(); 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<string, string> = { const patterns: Record<string, string> = {
'SmartTranslate': 'ST', 'SmartTranslate': 'ST',
'VPN': 'VPN', 'VPN': 'VPN',
@@ -85,8 +103,6 @@ export function detectProjectFromCwd(): string | null {
'eToroGridbot': 'GB', 'eToroGridbot': 'GB',
'WildFiles': 'WF', 'WildFiles': 'WF',
'Circles': 'CIR', 'Circles': 'CIR',
'ClaudeFramework': 'CF',
'AgilitonScripts': 'AS',
'WHMCS': 'WHMCS', 'WHMCS': 'WHMCS',
'Cardscanner': 'CS', 'Cardscanner': 'CS',
'ZorkiOS': 'ZORK', 'ZorkiOS': 'ZORK',
@@ -94,6 +110,9 @@ export function detectProjectFromCwd(): string | null {
'PropertyMap': 'PM', 'PropertyMap': 'PM',
'Rubic': 'RUB', 'Rubic': 'RUB',
'Socialguard': 'SG', 'Socialguard': 'SG',
// Infrastructure services with their own scope
'caddy-gateway': 'CADDY',
'litellm': 'LLM',
}; };
// Check each pattern // 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(); 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\/([^/]+)/); const infraMatch = cwd.match(/\/Infrastructure\/([^/]+)/);
if (infraMatch) { if (infraMatch) {
return infraMatch[1].replace(/[a-z]/g, '').slice(0, 4) || infraMatch[1].slice(0, 3).toUpperCase(); return 'CF';
} }
return null; return null;