@hyperfrontend/project-scope/heuristics/project-type

project-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:
  • 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

NameTypeDescription
§projectPath
string
Project directory path
§options?
DetectProjectTypeOptions
Detection options

Returns

ProjectTypeDetection
Project 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

§interface

DetectProjectTypeOptions

Options for project type detection.

Properties

§skipTechDetection?:boolean
Skip technology detection (faster but less accurate)
§interface

ProjectTypeDetection

Project type detection result.

Properties

§confidence:number
Detection confidence (0-100)
§evidence:TypeEvidence[]
Evidence collected
§secondaryTypes:ProjectType[]
Secondary types
§type:ProjectType
Primary project type
§interface

TypeEvidence

Type evidence for detection.

Properties

§confidence:number
Confidence contribution
§description:string
Description
§factor:string
Evidence factor