@stackbilt/classify 0.1.1 → 0.1.3

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 +69 -0
  2. package/package.json +1 -1
package/README.md ADDED
@@ -0,0 +1,69 @@
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
+ > **Want the full toolkit?** Just install the CLI — it includes everything:
6
+ > ```bash
7
+ > npm install -g @stackbilt/cli
8
+ > ```
9
+ > Only install this package directly if you need change classification without the CLI.
10
+
11
+ ## Install
12
+
13
+ ```bash
14
+ npm install @stackbilt/classify
15
+ ```
16
+
17
+ ## Usage
18
+
19
+ ```ts
20
+ import { heuristicClassify, determineRecommendation } from '@stackbilt/classify';
21
+
22
+ const result = heuristicClassify('fix typo in readme');
23
+ // {
24
+ // suggestedClass: 'SURFACE',
25
+ // confidence: 'HIGH',
26
+ // signals: ['Surface pattern: ...', 'Surface pattern: ...']
27
+ // }
28
+
29
+ const recommendation = determineRecommendation('CROSS_CUTTING', 'CLEAR', true);
30
+ // 'APPROVE_WITH_MITIGATIONS'
31
+ ```
32
+
33
+ ## API Reference
34
+
35
+ ### `heuristicClassify(subject: string)`
36
+
37
+ Classifies a change description by matching against built-in pattern sets.
38
+
39
+ **Returns** `{ suggestedClass: ChangeClass, confidence: 'HIGH' | 'MEDIUM' | 'LOW', signals: string[] }`
40
+
41
+ | ChangeClass | Meaning | Example triggers |
42
+ |---|---|---|
43
+ | `SURFACE` | Cosmetic or documentation-only | readme, doc, typo, spelling, rename, `.md`/`.txt`/`.json` |
44
+ | `CROSS_CUTTING` | Multi-system or architectural | schema, API, migration, auth, infrastructure, integration |
45
+ | `LOCAL` | Single-module (default) | No strong pattern match detected |
46
+
47
+ Confidence is `HIGH` when two or more patterns match, `MEDIUM` for one, `LOW` when defaulting to `LOCAL`.
48
+
49
+ ### `determineRecommendation(changeClass, governanceStatus, mitigationsRequired)`
50
+
51
+ Returns `APPROVE`, `APPROVE_WITH_MITIGATIONS`, `REJECT`, or `ESCALATE` based on classification context.
52
+
53
+ ### `formatChangeClassification(classification: ChangeClassification)`
54
+
55
+ Renders a full classification as human-readable Markdown.
56
+
57
+ ## Requirements
58
+
59
+ - Node >= 18
60
+ - Peer dependency: `@stackbilt/types`
61
+
62
+ ## License
63
+
64
+ Apache-2.0
65
+
66
+ ## Links
67
+
68
+ - [Repository](https://github.com/Stackbilt-dev/charter)
69
+ - [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.3",
4
4
  "description": "Heuristic change classification (SURFACE/LOCAL/CROSS_CUTTING)",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",