@stackbilt/validate 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 +78 -0
  2. package/package.json +1 -1
package/README.md ADDED
@@ -0,0 +1,78 @@
1
+ # @stackbilt/validate
2
+
3
+ Citation validation and commit message intent classification for [Charter Kit](https://github.com/Stackbilt-dev/charter) -- a local-first governance toolkit for software repos. Pure heuristics, no LLM calls.
4
+
5
+ ## Install
6
+
7
+ ```bash
8
+ npm install @stackbilt/validate
9
+ ```
10
+
11
+ ## Usage
12
+
13
+ ### Extract and validate citations
14
+
15
+ ```ts
16
+ import { extractCitations, validateCitations, enrichCitations } from '@stackbilt/validate';
17
+
18
+ const text = 'Per [Section 3.1] and [ADR-012], this approach is approved.';
19
+
20
+ const citations = extractCitations(text);
21
+ // => ['Section 3.1', 'ADR-012']
22
+
23
+ const result = validateCitations(text, bundle, 'WARN');
24
+ // => { valid: true, violations: [], totalCitations: 2, validCount: 2 }
25
+ ```
26
+
27
+ ### Classify commit message intent
28
+
29
+ ```ts
30
+ import { classifyMessage } from '@stackbilt/validate';
31
+
32
+ const result = classifyMessage('Should we adopt GraphQL or stick with REST?');
33
+ // => {
34
+ // intent: 'decision',
35
+ // confidence: 1,
36
+ // dudePhases: ['D', 'U', 'Di', 'E'],
37
+ // suggestedMode: 'GOVERNANCE',
38
+ // complexity: 'low',
39
+ // domain: 'ARCHITECTURE'
40
+ // }
41
+ ```
42
+
43
+ ## API Reference
44
+
45
+ ### `extractCitations(text: string): string[]`
46
+
47
+ Extract governance citation references from text. Recognized: `[Section X.Y]`, `[ADR-XXX]`, `[RFC-YYYY-XXX]`, `[Pattern: Name]`, `[POLICY-XXX]`.
48
+
49
+ ### `validateCitations(text, bundle, strictness?): CitationValidationResult`
50
+
51
+ Validate citations against a `CitationBundle`. Unknown citations receive closest-match suggestions via Levenshtein distance.
52
+
53
+ ### `enrichCitations(text, bundle): string`
54
+
55
+ Replace citation references with hyperlinked, titled versions.
56
+
57
+ ### `classifyMessage(message, context?): Classification`
58
+
59
+ Classify a message by intent (`ideation`, `decision`, `doubt`, `synthesis`, `question`, `review`), DUDE phases, complexity, and suggested app mode. Runs in under 5 ms.
60
+
61
+ ## Types
62
+
63
+ - `CitationViolation`, `CitationValidationResult`, `ValidationStrictness`, `CitationBundle`
64
+ - `Classification`, `MessageIntent`, `DudePhase`
65
+
66
+ ## Requirements
67
+
68
+ - Node >= 18
69
+ - Peer dependency: `@stackbilt/types`
70
+
71
+ ## License
72
+
73
+ Apache-2.0
74
+
75
+ ## Links
76
+
77
+ - [Repository](https://github.com/Stackbilt-dev/charter)
78
+ - [Issues](https://github.com/Stackbilt-dev/charter/issues)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stackbilt/validate",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "description": "Citation validation, message classification, and governance checks",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",