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