@stackbilt/classify 0.1.1 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +63 -0
  2. package/package.json +1 -1
package/README.md ADDED
@@ -0,0 +1,63 @@
1
+ # @stackbilt/classify
2
+
3
+ Heuristic change classification for [Charter Kit](https://github.com/Stackbilt-dev/charter) -- a local-first governance toolkit for software repos. Classifies changes as **SURFACE**, **LOCAL**, or **CROSS_CUTTING** using pure pattern matching. No LLM calls, runs in under 5 ms.
4
+
5
+ ## Install
6
+
7
+ ```bash
8
+ npm install @stackbilt/classify
9
+ ```
10
+
11
+ ## Usage
12
+
13
+ ```ts
14
+ import { heuristicClassify, determineRecommendation } from '@stackbilt/classify';
15
+
16
+ const result = heuristicClassify('fix typo in readme');
17
+ // {
18
+ // suggestedClass: 'SURFACE',
19
+ // confidence: 'HIGH',
20
+ // signals: ['Surface pattern: ...', 'Surface pattern: ...']
21
+ // }
22
+
23
+ const recommendation = determineRecommendation('CROSS_CUTTING', 'CLEAR', true);
24
+ // 'APPROVE_WITH_MITIGATIONS'
25
+ ```
26
+
27
+ ## API Reference
28
+
29
+ ### `heuristicClassify(subject: string)`
30
+
31
+ Classifies a change description by matching against built-in pattern sets.
32
+
33
+ **Returns** `{ suggestedClass: ChangeClass, confidence: 'HIGH' | 'MEDIUM' | 'LOW', signals: string[] }`
34
+
35
+ | ChangeClass | Meaning | Example triggers |
36
+ |---|---|---|
37
+ | `SURFACE` | Cosmetic or documentation-only | readme, doc, typo, spelling, rename, `.md`/`.txt`/`.json` |
38
+ | `CROSS_CUTTING` | Multi-system or architectural | schema, API, migration, auth, infrastructure, integration |
39
+ | `LOCAL` | Single-module (default) | No strong pattern match detected |
40
+
41
+ Confidence is `HIGH` when two or more patterns match, `MEDIUM` for one, `LOW` when defaulting to `LOCAL`.
42
+
43
+ ### `determineRecommendation(changeClass, governanceStatus, mitigationsRequired)`
44
+
45
+ Returns `APPROVE`, `APPROVE_WITH_MITIGATIONS`, `REJECT`, or `ESCALATE` based on classification context.
46
+
47
+ ### `formatChangeClassification(classification: ChangeClassification)`
48
+
49
+ Renders a full classification as human-readable Markdown.
50
+
51
+ ## Requirements
52
+
53
+ - Node >= 18
54
+ - Peer dependency: `@stackbilt/types`
55
+
56
+ ## License
57
+
58
+ Apache-2.0
59
+
60
+ ## Links
61
+
62
+ - [Repository](https://github.com/Stackbilt-dev/charter)
63
+ - [Issues](https://github.com/Stackbilt-dev/charter/issues)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stackbilt/classify",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "description": "Heuristic change classification (SURFACE/LOCAL/CROSS_CUTTING)",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",