{
  "scope": "src/**/*.{ts,tsx,js,jsx,mjs,cjs}",
  "syncFs": {
    "totalOccurrences": 835,
    "filesAffected": 100,
    "hotpathOccurrences": 724,
    "hotpathFilesAffected": 89,
    "topHotpathFiles": [
      {
        "file": "src/management/shared-manager.ts",
        "count": 60,
        "calls": [
          "copyFileSync",
          "cpSync",
          "existsSync",
          "lstatSync",
          "mkdirSync",
          "readdirSync",
          "readFileSync",
          "readlinkSync",
          "rmSync",
          "statSync",
          "symlinkSync",
          "unlinkSync",
          "writeFileSync"
        ],
        "markers": []
      },
      {
        "file": "src/utils/claude-symlink-manager.ts",
        "count": 27,
        "calls": [
          "copyFileSync",
          "existsSync",
          "lstatSync",
          "mkdirSync",
          "readdirSync",
          "readlinkSync",
          "renameSync",
          "rmSync",
          "statSync",
          "symlinkSync",
          "unlinkSync"
        ],
        "markers": []
      },
      {
        "file": "src/utils/shell-completion.ts",
        "count": 23,
        "calls": [
          "appendFileSync",
          "copyFileSync",
          "existsSync",
          "mkdirSync",
          "readFileSync",
          "statSync"
        ],
        "markers": []
      },
      {
        "file": "src/web-server/routes/settings-routes.ts",
        "count": 23,
        "calls": [
          "copyFileSync",
          "existsSync",
          "mkdirSync",
          "readFileSync",
          "renameSync",
          "statSync",
          "writeFileSync"
        ],
        "markers": []
      },
      {
        "file": "src/utils/claude-dir-installer.ts",
        "count": 21,
        "calls": [
          "copyFileSync",
          "cpSync",
          "existsSync",
          "lstatSync",
          "mkdirSync",
          "readdirSync",
          "renameSync",
          "rmSync",
          "statSync",
          "unlinkSync",
          "writeFileSync"
        ],
        "markers": []
      },
      {
        "file": "src/cliproxy/binary/version-cache.ts",
        "count": 20,
        "calls": [
          "existsSync",
          "mkdirSync",
          "readFileSync",
          "unlinkSync",
          "writeFileSync"
        ],
        "markers": []
      },
      {
        "file": "src/management/recovery-manager.ts",
        "count": 20,
        "calls": [
          "copyFileSync",
          "existsSync",
          "mkdirSync",
          "renameSync",
          "writeFileSync"
        ],
        "markers": []
      },
      {
        "file": "src/web-server/routes/cliproxy-stats-routes.ts",
        "count": 20,
        "calls": [
          "closeSync",
          "existsSync",
          "fstatSync",
          "mkdirSync",
          "openSync",
          "readdirSync",
          "readFileSync",
          "readSync",
          "renameSync",
          "statSync",
          "writeFileSync"
        ],
        "markers": []
      },
      {
        "file": "src/web-server/routes/misc-routes.ts",
        "count": 20,
        "calls": [
          "copyFileSync",
          "existsSync",
          "mkdirSync",
          "readdirSync",
          "readFileSync",
          "renameSync",
          "statSync",
          "writeFileSync"
        ],
        "markers": []
      },
      {
        "file": "src/web-server/routes/persist-routes.ts",
        "count": 17,
        "calls": [
          "closeSync",
          "copyFileSync",
          "existsSync",
          "lstatSync",
          "openSync",
          "readdirSync",
          "readSync",
          "renameSync",
          "unlinkSync",
          "writeFileSync"
        ],
        "markers": []
      }
    ],
    "topFilesOverall": [
      {
        "file": "src/management/shared-manager.ts",
        "count": 60,
        "calls": [
          "copyFileSync",
          "cpSync",
          "existsSync",
          "lstatSync",
          "mkdirSync",
          "readdirSync",
          "readFileSync",
          "readlinkSync",
          "rmSync",
          "statSync",
          "symlinkSync",
          "unlinkSync",
          "writeFileSync"
        ],
        "markers": []
      },
      {
        "file": "src/config/migration-manager.ts",
        "count": 27,
        "calls": [
          "copyFileSync",
          "existsSync",
          "mkdirSync",
          "readdirSync",
          "readFileSync",
          "renameSync",
          "rmdirSync",
          "unlinkSync"
        ],
        "markers": []
      },
      {
        "file": "src/utils/claude-symlink-manager.ts",
        "count": 27,
        "calls": [
          "copyFileSync",
          "existsSync",
          "lstatSync",
          "mkdirSync",
          "readdirSync",
          "readlinkSync",
          "renameSync",
          "rmSync",
          "statSync",
          "symlinkSync",
          "unlinkSync"
        ],
        "markers": []
      },
      {
        "file": "src/utils/shell-completion.ts",
        "count": 23,
        "calls": [
          "appendFileSync",
          "copyFileSync",
          "existsSync",
          "mkdirSync",
          "readFileSync",
          "statSync"
        ],
        "markers": []
      },
      {
        "file": "src/web-server/routes/settings-routes.ts",
        "count": 23,
        "calls": [
          "copyFileSync",
          "existsSync",
          "mkdirSync",
          "readFileSync",
          "renameSync",
          "statSync",
          "writeFileSync"
        ],
        "markers": []
      },
      {
        "file": "src/utils/claude-dir-installer.ts",
        "count": 21,
        "calls": [
          "copyFileSync",
          "cpSync",
          "existsSync",
          "lstatSync",
          "mkdirSync",
          "readdirSync",
          "renameSync",
          "rmSync",
          "statSync",
          "unlinkSync",
          "writeFileSync"
        ],
        "markers": []
      },
      {
        "file": "src/cliproxy/binary/version-cache.ts",
        "count": 20,
        "calls": [
          "existsSync",
          "mkdirSync",
          "readFileSync",
          "unlinkSync",
          "writeFileSync"
        ],
        "markers": []
      },
      {
        "file": "src/copilot/copilot-package-manager.ts",
        "count": 20,
        "calls": [
          "existsSync",
          "mkdirSync",
          "readFileSync",
          "rmSync",
          "unlinkSync",
          "writeFileSync"
        ],
        "markers": []
      },
      {
        "file": "src/management/recovery-manager.ts",
        "count": 20,
        "calls": [
          "copyFileSync",
          "existsSync",
          "mkdirSync",
          "renameSync",
          "writeFileSync"
        ],
        "markers": []
      },
      {
        "file": "src/web-server/routes/cliproxy-stats-routes.ts",
        "count": 20,
        "calls": [
          "closeSync",
          "existsSync",
          "fstatSync",
          "mkdirSync",
          "openSync",
          "readdirSync",
          "readFileSync",
          "readSync",
          "renameSync",
          "statSync",
          "writeFileSync"
        ],
        "markers": []
      }
    ]
  },
  "legacyShim": {
    "totalMarkers": 131,
    "filesAffected": 56,
    "topFiles": [
      {
        "file": "src/utils/config-manager.ts",
        "count": 13,
        "calls": [],
        "markers": [
          "* Get config file path (legacy JSON path)",
          "* Precedence: --config-dir flag > CCS_DIR env > CCS_HOME env (legacy, appends .ccs) > ~/.ccs default",
          "* Read and parse config (legacy compatibility)",
          "* Returns Config with profiles from unified config.yaml or legacy config.json.",
          "* Returns config.yaml in unified mode, config.json in legacy mode.",
          "* then falls back to config.json for backward compatibility.",
          "// Convert unified cliproxy variants to legacy format",
          "// Convert unified profiles to legacy format for compatibility",
          "// If not found in unified config, try legacy config.json as fallback",
          "// Legacy config is invalid JSON - that's OK in unified mode",
          "// Legacy mode - read from config.json only",
          "// Legacy mode: read config.json",
          "// Merge legacy profiles into available list (avoid duplicates)"
        ]
      },
      {
        "file": "src/auth/profile-detector.ts",
        "count": 11,
        "calls": [],
        "markers": [
          "* - Legacy JSON format (config.json, profiles.json) as fallback",
          "* 2. User-defined CLIProxy variants (config.cliproxy section) [legacy]",
          "* 3. Settings-based profiles (config.profiles section) [legacy]",
          "* 4. Account-based profiles (profiles.json) [legacy]",
          "* Priority: settings-based profiles (glm/kimi) checked FIRST for backward compatibility.",
          "// Check if account-based default exists (legacy)",
          "// Fall back to legacy config",
          "// Fall back to legacy config display",
          "// Fall through to legacy if not found in unified config",
          "// Priority 3: Check settings-based profiles (glm, kimi) - LEGACY FALLBACK",
          "// Priority 4: Check account-based profiles (work, personal) - LEGACY FALLBACK"
        ]
      },
      {
        "file": "src/config/unified-config-loader.ts",
        "count": 9,
        "calls": [],
        "markers": [
          "* 'json' if only legacy config exists,",
          "* Check if legacy config.json exists",
          "* Get path to legacy config.json",
          "* Provides fallback to legacy JSON format for backward compatibility.",
          "// Legacy field for backwards compatibility",
          "// Legacy fields (deprecated)",
          "// Legacy fields (keep for backwards compatibility during read)",
          "partial.websearch?.gemini?.enabled ?? // Legacy fallback",
          "partial.websearch?.gemini?.timeout ?? // Legacy fallback"
        ]
      },
      {
        "file": "src/commands/setup-command.ts",
        "count": 7,
        "calls": [],
        "markers": [
          "* 3. Legacy config.json profiles (GLM, Kimi)",
          "* 4. Legacy profiles.json accounts",
          "// Also check legacy config.json for existing profiles",
          "// Has legacy accounts - NOT first time",
          "// Has legacy profiles - NOT first time",
          "// Legacy config exists but is invalid - ignore and continue",
          "// Legacy profiles exists but is invalid - ignore and continue"
        ]
      },
      {
        "file": "src/management/checks/config-check.ts",
        "count": 6,
        "calls": [],
        "markers": [
          "* - Prefers config.yaml (v2) over config.json (legacy)",
          "// Fallback to config.json (legacy format)",
          "// Inform if legacy config.json also exists (purely informational, not a check)",
          "console.log(`  ${info('config.json'.padEnd(22))}  Legacy (ignored)`);",
          "console.log(`  ${ok('config.json'.padEnd(22))}  Valid (legacy)`);",
          "info: 'Valid (legacy)',"
        ]
      },
      {
        "file": "src/web-server/routes/account-routes.ts",
        "count": 6,
        "calls": [],
        "markers": [
          "* Uses ProfileRegistry to read from both legacy (profiles.json)",
          "// Add legacy profiles first",
          "// Delete from appropriate config (unified and/or legacy)",
          "// Get default from unified config first, fallback to legacy",
          "// Get profiles from both legacy and unified config (same logic as CLI)",
          "// Use unified config if in unified mode, otherwise use legacy"
        ]
      },
      {
        "file": "src/config/migration-manager.ts",
        "count": 5,
        "calls": [],
        "markers": [
          "* Check if there are legacy profiles that haven't been migrated to config.yaml.",
          "* Handles migration from legacy JSON config (v1) to unified YAML config (v2).",
          "`Profile \"${name}\" exists in both configs with different settings - keeping existing (${existingSettings}), skipping legacy (${pathStr})`",
          "console.log(infoBox('Migrated legacy profiles to config.yaml', 'SUCCESS'));",
          "console.log(infoBox('Migration failed - using legacy config', 'WARNING'));"
        ]
      },
      {
        "file": "src/api/services/profile-writer.ts",
        "count": 4,
        "calls": [],
        "markers": [
          "* Supports both unified YAML config and legacy JSON config.",
          "/** Create settings.json file for API profile (legacy format) */",
          "/** Remove API profile from legacy config */",
          "/** Update config.json with new API profile (legacy format) */"
        ]
      },
      {
        "file": "src/cliproxy/quota-fetcher-gemini-cli.ts",
        "count": 4,
        "calls": [],
        "markers": [
          "// Legacy pattern: gemini-email.json",
          "// Must match account AND be gemini type (or legacy gemini- prefix)",
          "// Try exact legacy match first",
          "`gemini-${sanitizedId}.json`, // Legacy format"
        ]
      },
      {
        "file": "src/auth/profile-registry.ts",
        "count": 3,
        "calls": [],
        "markers": [
          "* Get all profiles merged from both legacy and unified config.",
          "* Get resolved default profile from unified config first, fallback to legacy.",
          "// Start with legacy profiles"
        ]
      }
    ],
    "explicitShimFiles": [
      "src/cliproxy/openai-compat-manager.ts"
    ]
  }
}
