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:
29
src/db.ts
29
src/db.ts
@@ -74,7 +74,25 @@ export async function getNextTaskId(projectKey: string): Promise<string> {
|
||||
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<string, string> = {
|
||||
'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;
|
||||
|
||||
Reference in New Issue
Block a user