Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
114 changes: 114 additions & 0 deletions .github/LABELS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
# PR Label System

This document describes all labels automatically applied to pull requests by the
[pr-labeler](scripts/pr-labeler.cjs) script.

- **Type labels** derived from the PR title
- **Size labels** derived from total line changes
- **Module labels** derived from changed file paths
- **Complexity labels** derived from a heuristic score

---

## Type Labels

Applied by parsing the PR title. Supports KDM-style titles (`[KDM-123-FIX-...]`),
conventional commits (`fix:`, `feat:`, `refactor:`), and plain keywords.

| Label | Triggered When |
|---|---|
| `type: bug-fix` | Title contains FIX / fix |
| `type: feature` | Title contains FEAT / feat / feature |
| `type: refactor` | Title contains REFACTOR / refactor |

**Suggested colors:** `type: bug-fix` (red), `type: feature` (green), `type: refactor` (blue)

---

## Size Labels

Applied based on the total number of lines changed (additions + deletions).

| Label | Threshold | Suggested Color |
|---|---|---|
| `size: XS` | < 10 lines | Lightest gray |
| `size: S` | < 50 lines | Light gray |
| `size: M` | < 200 lines | Medium gray |
| `size: L` | < 500 lines | Dark gray |
| `size: XL` | >= 500 lines | Darkest gray |

Exactly one size label is applied per PR. Thresholds are defined in
[`kdm-automation.json`](kdm-automation.json) under `prLabels.size`.

---

## Module Labels

Applied by matching changed file paths against the pattern map defined in
[`kdm-automation.json`](kdm-automation.json) under `prLabels.modulePaths`.

| Label | Path Pattern |
|---|---|
| `module: cli` | `src/commands/**`, `src/utils/version-check.ts`, `src/**` (fallback) |
| `module: ui` | `src/ui/**` |
| `module: config` | `src/utils/config.ts` |
| `module: logger` | `src/utils/logger.ts` |
| `module: auth` | _(not currently mapped)_ |
| `module: test` | `src/__tests__/**` |
| `module: docs` | `docs/**` |
| `module: docker` | `src/docker/**` |
| `module: k8s` | `src/kubernetes/**` |
| `module: minikube` | `src/minikube/**` |
| `module: monitor` | `src/monitor/**` |

A PR may receive multiple module labels if it touches files in several areas.
If more than 2 modules are touched, a `multi-module` indicator label is also
added.

**Suggested color for all module labels:** Consistent color family (e.g. purples)

---

## Complexity Labels

Applied based on a heuristic score that considers file count, line changes,
and module spread:

```
score = (files × 2) + (lines / 50) + (modules × 5)
```

| Label | Score Range | Suggested Color |
|---|---|---|
| `review: easy` | < 15 | Green |
| `review: medium` | < 40 | Yellow |
| `review: complex` | >= 40 | Red |

Exactly one complexity label is applied per PR. The heuristic helps reviewers
gauge the cognitive load of a review: more files, more lines, and more modules
touched all increase the score.

---

## Multi-Module Indicator

When a PR touches more than 2 distinct modules, the label `multi-module` is
added. This signals that the PR crosses subsystem boundaries and may benefit
from additional reviewer attention.

---

## Configuration Reference

All label definitions and thresholds are centralized in
[`kdm-automation.json`](kdm-automation.json) under the `prLabels` key:

- `prLabels.type` — type label name mappings
- `prLabels.size` — size label entries with `maxChanges` thresholds
- `prLabels.module` — module label name definitions
- `prLabels.complexity` — complexity label entries with `maxScore` thresholds
- `prLabels.modulePaths` — file path glob patterns → module key mappings

Modify thresholds or add new labels by editing this file. The
[pr-labeler](scripts/pr-labeler.cjs) script reads the configuration
at runtime via the shared config loader.
47 changes: 47 additions & 0 deletions .github/kdm-automation.json
Original file line number Diff line number Diff line change
Expand Up @@ -79,5 +79,52 @@

"community": {
"discordChannel": "https://discord.com/channels/905194001349627914/1337424839761465364"
},

"prLabels": {
"type": {
"bugFix": "type: bug-fix",
"feature": "type: feature",
"refactor": "type: refactor"
},
"size": {
"xs": { "label": "size: XS", "maxChanges": 9 },
"s": { "label": "size: S", "maxChanges": 49 },
"m": { "label": "size: M", "maxChanges": 199 },
"l": { "label": "size: L", "maxChanges": 499 },
"xl": { "label": "size: XL", "maxChanges": null }
},
"module": {
"config": "module: config",
"cli": "module: cli",
"ui": "module: ui",
"auth": "module: auth",
"logger": "module: logger",
"test": "module: test",
"docs": "module: docs",
"docker": "module: docker",
"k8s": "module: k8s",
"minikube": "module: minikube",
"monitor": "module: monitor"
},
"complexity": {
"easy": { "label": "review: easy", "maxScore": 14 },
"medium": { "label": "review: medium", "maxScore": 39 },
"complex": { "label": "review: complex", "maxScore": null }
},
"modulePaths": {
"src/commands/**": "cli",
"src/ui/**": "ui",
"src/utils/config.ts": "config",
"src/utils/logger.ts": "logger",
"src/__tests__/**": "test",
"docs/**": "docs",
"src/docker/**": "docker",
"src/kubernetes/**": "k8s",
"src/minikube/**": "minikube",
"src/monitor/**": "monitor",
"src/utils/version-check.ts": "cli",
"src/**": "cli"
}
}
}
Loading
Loading