@hyperfrontend/project-scope/heuristics/project-typeproject-type
Project-type classification that decides whether a folder is an application, library, e2e suite, CLI tool, or plugin.
detectProjectType scores a project against multiple signals — package.json name suffixes (-lib, -app, -e2e, -cli), presence of exports/main/module/bin, entry-point file patterns (server.ts vs index.ts), directory layout (public/, pages/, lib/, cypress/), framework membership, and e2e tooling. The result includes the chosen type, a confidence percentage, and a list of evidence entries explaining each contributing factor. Useful as a starting point for code-mod scripts, scaffolding, and workspace-management tooling that needs to react differently per project shape.
API Reference
ƒ Functions
§function
detectProjectType(projectPath: string, options?: DetectProjectTypeOptions): ProjectTypeDetection
Detect the type of a project based on its structure and configuration.
Uses multiple heuristics including:
Uses multiple heuristics including:
- Package name patterns
- Exports/main/module fields
- Binary (bin) field
- Entry point patterns
- Testing framework presence
- Directory structure
- Framework detection
- NX project type field
Parameters
Returns
ProjectTypeDetectionProject type detection result with confidence score
Example
Detecting project type
import { detectProjectType } from '@hyperfrontend/project-scope'
const result = detectProjectType('./my-lib')
console.log(result.type) // 'library' | 'application' | 'e2e' | 'tool' | 'plugin'
console.log(result.confidence) // 85
console.log(result.evidence) // [{ factor: 'exports', confidence: 20, ... }]◈ Interfaces
Options for project type detection.
Properties
Project type detection result.