Angular Modernizer
    Preparing search index...
    • Resolve the tsconfig that should back a ts-morph Project for rootPath. Shared tsconfig discovery used by the kernel factory and every MCP tool that builds a ts-morph Project.

      Parameters

      • rootPath: string

        Project root directory.

      Returns TsConfigResolution | null

      The selected config with file count and reason, or null when no candidate exists.

      Angular CLI workspaces often use a "solution style" root tsconfig.json with "files": [] plus references to tsconfig.app.json / tsconfig.spec.json. Loading such a root config yields an (almost) empty program, so every investigation tool would silently search nothing. The resolver therefore prefers a config that actually contains source files:

      1. the first existing candidate, if it has files
      2. its references (recursively, *.app.* configs first, *.spec.* last)
      3. tsconfig.app.json (root, then src/)
      4. any other existing candidate with files
      5. the first existing candidate (legacy behaviour)

      The same selection order is mirrored in adapter-mcp's tools/helpers/find-ts-config.ts, which decides "has files" from the raw config JSON instead of the TypeScript API (the adapter test suites mock node:fs and @angular-modernizer/core).

      const resolution = resolveTsConfig('/path/to/angular-project');
      // { path: '/path/to/angular-project/tsconfig.app.json', fileCount: 1, reason: 'reference', ... }