npm package: @glue-tools-ai/onboarding-complexity
Description: Estimate developer onboarding time from repository structure analysis.
Author: Glue
Latest version: 1.0.0

# @glue-tools-ai/onboarding-complexity

[![npm version](https://img.shields.io/npm/v/@glue-tools-ai/onboarding-complexity)](https://www.npmjs.com/package/@glue-tools-ai/onboarding-complexity)
[![npm downloads](https://img.shields.io/npm/dm/@glue-tools-ai/onboarding-complexity)](https://www.npmjs.com/package/@glue-tools-ai/onboarding-complexity)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)

Estimate developer onboarding time from repository structure analysis. Analyzes language diversity, architecture complexity, documentation gaps, and knowledge concentration to predict time-to-productivity.

## Installation

```bash
npm install -g @glue-tools-ai/onboarding-complexity
```

Or run directly with npx:

```bash
npx @glue-tools-ai/onboarding-complexity analyze /path/to/repo
```

## Usage

### Analyze a Repository

```bash
onboarding-complexity analyze /path/to/repo
```

Output example:
```
Analyzing repository structure...

Onboarding Complexity Report

Language Diversity:     7/10
Architecture Complexity: 6/10
Documentation Gap:      4/10
Dependency Complexity:  5/10
Knowledge Concentration: 8/10
Codebase Size:         5/10

Overall Score: 6.2/10

Estimated Onboarding Time (Mid-level Developer):
  6.2 weeks to productivity

For Junior Developers:
  10.85 weeks (1.75x multiplier)

For Senior Developers:
  3.1 weeks (0.5x multiplier)
```

### Compare Two Repositories

```bash
onboarding-complexity compare /path/to/repo1 /path/to/repo2
```

### Options

- `--format [format]` - Output format: `table`, `json`, or `markdown` (default: table)
- `--experience [level]` - Developer experience level: `junior`, `mid`, or `senior` (default: mid)

### Examples

```bash
# Analyze with JSON output
onboarding-complexity analyze . --format json

# Compare with markdown output
onboarding-complexity compare repo1 repo2 --format markdown

# Analyze for a junior developer
onboarding-complexity analyze . --experience junior
```

## How It Works

The complexity estimator analyzes six key dimensions:

1. **Language Diversity**: Counts distinct programming languages and calculates primary vs. secondary language ratio
2. **Architecture Complexity**: Measures directory depth, number of services/modules, and configuration complexity
3. **Documentation Gap**: Evaluates README quality, code comment ratio, and API documentation presence
4. **Dependency Complexity**: Counts total dependencies and framework variety
5. **Knowledge Concentration**: Calculates bus factor from git history and identifies knowledge silos
6. **Codebase Size**: Estimates total files and lines of code

Each dimension scores 0-10, then a weighted aggregate produces a final complexity score. The score is converted to estimated weeks using multipliers based on developer experience:

- **Junior Developer**: 1.75x multiplier
- **Mid-level Developer**: 1.0x multiplier (baseline)
- **Senior Developer**: 0.5x multiplier

## API Usage

```javascript
import { analyzeRepository } from '@glue-tools-ai/onboarding-complexity';

const result = await analyzeRepository('/path/to/repo', {
  experience: 'mid'
});

console.log(result);
// {
//   scores: {
//     languageDiversity: 7,
//     architectureComplexity: 6,
//     documentationGap: 4,
//     dependencyComplexity: 5,
//     knowledgeConcentration: 8,
//     codebabseSize: 5
//   },
//   overall: 6.2,
//   weeks: 6.2,
//   ...
// }
```

## Attribution

Created by [Glue](https://getglueapp.com) — Developer experience platform for engineering teams.

## License

MIT - Copyright 2026 Glue