# ProjectDetector

**Kind:** Class

**Source:** [`atloria-monorepo/libs/parser-core/src/detector/project-detector.ts`](https://github.com/sherkety/atloria/blob/main/atloria-monorepo/libs/parser-core/src/detector/project-detector.ts#L55)

ProjectDetector class

Detects project type, frameworks, package manager, and build tools
by analyzing project structure and configuration files.

## Methods

| Method | Signature | Returns |
|---|---|---|
| `detect` | `detect(rootDir: string)` | `Promise<DetectedProject>` |
| `addFrameworkRule` | `addFrameworkRule(rule: FrameworkRule)` | `void` |
| `getFrameworkRules` | `getFrameworkRules()` | `FrameworkRule[]` |
| `hasFramework` | `hasFramework(rootDir: string, frameworkName: string)` | `Promise<boolean>` |
| `supportsParser` | `supportsParser(rootDir: string, parserName: string)` | `Promise<boolean>` |

## Where it refuses work

- `ProjectDetector` stops the work with `Error` when `!fs.existsSync(absoluteRootDir)`.
- `ProjectDetector` stops the work with an early return when `depth >= maxDepth`, in 3 places.
- `ProjectDetector` stops the work with an early return when `!fs.existsSync(packageJsonPath)`.
- `ProjectDetector` stops the work with an early return when `fs.existsSync(path.join(rootDir, 'bun.lockb'))`.
- `ProjectDetector` stops the work with an early return when `fs.existsSync(path.join(rootDir, 'pnpm-lock.yaml'))`.
- `ProjectDetector` stops the work with an early return when `fs.existsSync(path.join(rootDir, 'yarn.lock'))`.

## When something fails

- `ProjectDetector` handles failure in 5 places: it discards it silently in 4, and turns it into a return value in 1.
