@stackbilt/validate 0.1.1

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.
@@ -0,0 +1,57 @@
1
+ /**
2
+ * Citation Validator
3
+ *
4
+ * Extracts, validates, and enriches governance citations in text.
5
+ * Supports: [Section X.Y], [ADR-XXX], [RFC-YYYY-XXX], [Pattern: Name], [POLICY-XXX]
6
+ *
7
+ * Pure logic — no database, no LLM, no external dependencies.
8
+ * Extracted from Charter Cloud.
9
+ */
10
+ export interface CitationViolation {
11
+ citation: string;
12
+ errorType: 'NOT_FOUND_IN_DATABASE' | 'MALFORMED' | 'DEPRECATED';
13
+ suggestion?: string;
14
+ }
15
+ export interface CitationValidationResult {
16
+ valid: boolean;
17
+ violations: CitationViolation[];
18
+ totalCitations: number;
19
+ validCount: number;
20
+ }
21
+ export type ValidationStrictness = 'STRICT' | 'WARN' | 'PERMISSIVE';
22
+ /** Known-valid citation data for validation */
23
+ export interface CitationBundle {
24
+ citationMap: Map<string, unknown>;
25
+ sections: Array<{
26
+ sectionId: string;
27
+ title: string;
28
+ exhibitId: string;
29
+ }>;
30
+ adrs: Array<{
31
+ id: string;
32
+ title: string;
33
+ }>;
34
+ patterns: Array<{
35
+ name: string;
36
+ }>;
37
+ }
38
+ /**
39
+ * Validate all citations in text against a known citation bundle.
40
+ */
41
+ export declare function validateCitations(responseText: string, citationBundle: CitationBundle, _strictness?: ValidationStrictness): CitationValidationResult;
42
+ /**
43
+ * Extract all governance citations from text.
44
+ *
45
+ * Patterns recognized:
46
+ * - [Section X.Y]
47
+ * - [ADR-XXX]
48
+ * - [RFC-YYYY-XXX]
49
+ * - [Pattern: Name]
50
+ * - [POLICY-XXX]
51
+ */
52
+ export declare function extractCitations(text: string): string[];
53
+ /**
54
+ * Enrich citations in text with hyperlinks and metadata icons.
55
+ */
56
+ export declare function enrichCitations(text: string, citationBundle: CitationBundle): string;
57
+ //# sourceMappingURL=citations.d.ts.map
@@ -0,0 +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M,CA2CpF"}
@@ -0,0 +1,163 @@
1
+ "use strict";
2
+ /**
3
+ * Citation Validator
4
+ *
5
+ * Extracts, validates, and enriches governance citations in text.
6
+ * Supports: [Section X.Y], [ADR-XXX], [RFC-YYYY-XXX], [Pattern: Name], [POLICY-XXX]
7
+ *
8
+ * Pure logic — no database, no LLM, no external dependencies.
9
+ * Extracted from Charter Cloud.
10
+ */
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.validateCitations = validateCitations;
13
+ exports.extractCitations = extractCitations;
14
+ exports.enrichCitations = enrichCitations;
15
+ // ============================================================================
16
+ // Validation
17
+ // ============================================================================
18
+ /**
19
+ * Validate all citations in text against a known citation bundle.
20
+ */
21
+ function validateCitations(responseText, citationBundle, _strictness = 'WARN') {
22
+ const extracted = extractCitations(responseText);
23
+ const violations = [];
24
+ for (const citation of extracted) {
25
+ if (!citationBundle.citationMap.has(citation)) {
26
+ const suggestion = findClosestMatch(citation, citationBundle.citationMap);
27
+ violations.push({
28
+ citation,
29
+ errorType: 'NOT_FOUND_IN_DATABASE',
30
+ suggestion
31
+ });
32
+ }
33
+ }
34
+ return {
35
+ valid: violations.length === 0,
36
+ violations,
37
+ totalCitations: extracted.length,
38
+ validCount: extracted.length - violations.length
39
+ };
40
+ }
41
+ // ============================================================================
42
+ // Extraction
43
+ // ============================================================================
44
+ /**
45
+ * Extract all governance citations from text.
46
+ *
47
+ * Patterns recognized:
48
+ * - [Section X.Y]
49
+ * - [ADR-XXX]
50
+ * - [RFC-YYYY-XXX]
51
+ * - [Pattern: Name]
52
+ * - [POLICY-XXX]
53
+ */
54
+ function extractCitations(text) {
55
+ const patterns = [
56
+ /\[Section (\d+(?:\.\d+)?)\]/gi,
57
+ /\[(ADR-\d{3})\]/gi,
58
+ /\[(RFC-\d{4}-\d{3})\]/gi,
59
+ /\[Pattern: ([^\]]+)\]/gi,
60
+ /\[(POLICY-\d{3})\]/gi
61
+ ];
62
+ const citations = new Set();
63
+ for (const pattern of patterns) {
64
+ const matches = text.matchAll(pattern);
65
+ for (const match of matches) {
66
+ if (match[0].includes('Section')) {
67
+ citations.add(`Section ${match[1]}`);
68
+ }
69
+ else if (match[0].includes('Pattern:')) {
70
+ citations.add(`Pattern: ${match[1]}`);
71
+ }
72
+ else {
73
+ citations.add(match[1]);
74
+ }
75
+ }
76
+ }
77
+ return Array.from(citations);
78
+ }
79
+ // ============================================================================
80
+ // Enrichment
81
+ // ============================================================================
82
+ /**
83
+ * Enrich citations in text with hyperlinks and metadata icons.
84
+ */
85
+ function enrichCitations(text, citationBundle) {
86
+ let enriched = text;
87
+ for (const section of citationBundle.sections) {
88
+ const patterns = [
89
+ `[Section ${section.sectionId}]`,
90
+ `**[Section ${section.sectionId}]**`
91
+ ];
92
+ for (const pattern of patterns) {
93
+ if (enriched.includes(pattern)) {
94
+ const link = `/exhibit/${section.exhibitId}#section-${section.sectionId}`;
95
+ const replacement = pattern.includes('**')
96
+ ? `**[Section ${section.sectionId}: ${section.title}](${link})**`
97
+ : `[Section ${section.sectionId}: ${section.title}](${link})`;
98
+ enriched = enriched.replace(new RegExp(escapeRegex(pattern), 'g'), replacement);
99
+ }
100
+ }
101
+ }
102
+ for (const adr of citationBundle.adrs) {
103
+ const match = adr.title.match(/^(ADR-\d{3}|RFC-\d{4}-\d{3})/);
104
+ if (match) {
105
+ const code = match[1];
106
+ const pattern = `[${code}]`;
107
+ if (enriched.includes(pattern)) {
108
+ const link = `/ledger/${adr.id}`;
109
+ const replacement = `[${adr.title}](${link})`;
110
+ enriched = enriched.replace(new RegExp(`\\[${escapeRegex(code)}\\]`, 'g'), replacement);
111
+ }
112
+ }
113
+ }
114
+ for (const pattern of citationBundle.patterns) {
115
+ const citationPattern = `[Pattern: ${pattern.name}]`;
116
+ if (enriched.includes(citationPattern)) {
117
+ const link = `/patterns/${encodeURIComponent(pattern.name)}`;
118
+ const replacement = `[Pattern: ${pattern.name}](${link})`;
119
+ enriched = enriched.replace(new RegExp(escapeRegex(citationPattern), 'g'), replacement);
120
+ }
121
+ }
122
+ return enriched;
123
+ }
124
+ // ============================================================================
125
+ // Helpers
126
+ // ============================================================================
127
+ function findClosestMatch(citation, citationMap) {
128
+ const candidates = Array.from(citationMap.keys());
129
+ let minDistance = Infinity;
130
+ let closest;
131
+ for (const candidate of candidates) {
132
+ const distance = levenshteinDistance(citation.toLowerCase(), candidate.toLowerCase());
133
+ if (distance < minDistance && distance <= 3) {
134
+ minDistance = distance;
135
+ closest = candidate;
136
+ }
137
+ }
138
+ return closest;
139
+ }
140
+ function levenshteinDistance(a, b) {
141
+ const matrix = [];
142
+ for (let i = 0; i <= b.length; i++) {
143
+ matrix[i] = [i];
144
+ }
145
+ for (let j = 0; j <= a.length; j++) {
146
+ matrix[0][j] = j;
147
+ }
148
+ for (let i = 1; i <= b.length; i++) {
149
+ for (let j = 1; j <= a.length; j++) {
150
+ if (b.charAt(i - 1) === a.charAt(j - 1)) {
151
+ matrix[i][j] = matrix[i - 1][j - 1];
152
+ }
153
+ else {
154
+ matrix[i][j] = Math.min(matrix[i - 1][j - 1] + 1, matrix[i][j - 1] + 1, matrix[i - 1][j] + 1);
155
+ }
156
+ }
157
+ }
158
+ return matrix[b.length][a.length];
159
+ }
160
+ function escapeRegex(str) {
161
+ return str.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
162
+ }
163
+ //# sourceMappingURL=citations.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"citations.js","sourceRoot":"","sources":["../src/citations.ts"],"names":[],"mappings":";AAAA;;;;;;;;GAQG;;AAoCH,8CAyBC;AAgBD,4CAyBC;AASD,0CA2CC;AA7HD,+EAA+E;AAC/E,aAAa;AACb,+EAA+E;AAE/E;;GAEG;AACH,SAAgB,iBAAiB,CAC/B,YAAoB,EACpB,cAA8B,EAC9B,cAAoC,MAAM;IAE1C,MAAM,SAAS,GAAG,gBAAgB,CAAC,YAAY,CAAC,CAAC;IACjD,MAAM,UAAU,GAAwB,EAAE,CAAC;IAE3C,KAAK,MA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,CAAC,CAAC,GAAG,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;YACtC,CAAC;iBAAM,CAAC;gBACN,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,CACrB,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,EACxB,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,EACpB,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CACrB,CAAC;YACJ,CAAC;QACH,CAAC;IACH,CAAC;IAED,OAAO,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC;AACpC,CAAC;AAED,SAAS,WAAW,CAAC,GAAW;IAC9B,OAAO,GAAG,CAAC,OAAO,CAAC,qBAAqB,EAAE,MAAM,CAAC,CAAC;AACpD,CAAC"}
@@ -0,0 +1,3 @@
1
+ export { validateCitations, extractCitations, enrichCitations, type CitationViolation, type CitationValidationResult, type ValidationStrictness, type CitationBundle, } from './citations';
2
+ export { classifyMessage, type Classification, type MessageIntent, type DudePhase, } from './message-classifier';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,EACjB,gBAAgB,EAChB,eAAe,EACf,KAAK,iBAAiB,EACtB,KAAK,wBAAwB,EAC7B,KAAK,oBAAoB,EACzB,KAAK,cAAc,GACpB,MAAM,aAAa,CAAC;AAErB,OAAO,EACL,eAAe,EACf,KAAK,cAAc,EACnB,KAAK,aAAa,EAClB,KAAK,SAAS,GACf,MAAM,sBAAsB,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.classifyMessage = exports.enrichCitations = exports.extractCitations = exports.validateCitations = void 0;
4
+ var citations_1 = require("./citations");
5
+ Object.defineProperty(exports, "validateCitations", { enumerable: true, get: function () { return citations_1.validateCitations; } });
6
+ Object.defineProperty(exports, "extractCitations", { enumerable: true, get: function () { return citations_1.extractCitations; } });
7
+ Object.defineProperty(exports, "enrichCitations", { enumerable: true, get: function () { return citations_1.enrichCitations; } });
8
+ var message_classifier_1 = require("./message-classifier");
9
+ Object.defineProperty(exports, "classifyMessage", { enumerable: true, get: function () { return message_classifier_1.classifyMessage; } });
10
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,yCAQqB;AAPnB,8GAAA,iBAAiB,OAAA;AACjB,6GAAA,gBAAgB,OAAA;AAChB,4GAAA,eAAe,OAAA;AAOjB,2DAK8B;AAJ5B,qHAAA,eAAe,OAAA"}
@@ -0,0 +1,30 @@
1
+ /**
2
+ * Message Classifier
3
+ *
4
+ * Lightweight, heuristic-first message classification.
5
+ * No LLM call — runs in <5ms. Classifies user messages by intent and determines
6
+ * which DUDE phases (Dissolve/Unify/Differentiate/Evaluate) to apply.
7
+ *
8
+ * Extracted from Charter Cloud (Cognitive Console).
9
+ */
10
+ import type { AppMode } from '@stackbilt/types';
11
+ export type MessageIntent = 'ideation' | 'decision' | 'doubt' | 'synthesis' | 'question' | 'review';
12
+ export type DudePhase = 'D' | 'U' | 'Di' | 'E';
13
+ export interface Classification {
14
+ intent: MessageIntent;
15
+ confidence: number;
16
+ dudePhases: DudePhase[];
17
+ suggestedMode: AppMode;
18
+ complexity: 'low' | 'medium' | 'high';
19
+ signals: string[];
20
+ domain: string | null;
21
+ }
22
+ /**
23
+ * Classify a user message by intent, DUDE phases, complexity, and suggested mode.
24
+ * Pure heuristics — no LLM call, runs in <5ms.
25
+ */
26
+ export declare function classifyMessage(message: string, conversationContext?: {
27
+ recentMessages: string[];
28
+ threadTopic?: string;
29
+ }): Classification;
30
+ //# sourceMappingURL=message-classifier.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"message-classifier.d.ts","sourceRoot":"","sources":["../src/message-classifier.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAMhD,MAAM,MAAM,aAAa,GAAG,UAAU,GAAG,UAAU,GAAG,OAAO,GAAG,WAAW,GAAG,UAAU,GAAG,QAAQ,CAAC;AACpG,MAAM,MAAM,SAAS,GAAG,GAAG,GAAG,GAAG,GAAG,IAAI,GAAG,GAAG,CAAC;AAE/C,MAAM,WAAW,cAAc;IAC7B,MAAM,EAAE,aAAa,CAAC;IACtB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,SAAS,EAAE,CAAC;IACxB,aAAa,EAAE,OAAO,CAAC;IACvB,UAAU,EAAE,KAAK,GAAG,QAAQ,GAAG,MAAM,CAAC;IACtC,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;CACvB;AAmJD;;;GAGG;AACH,wBAAgB,eAAe,CAC7B,OAAO,EAAE,MAAM,EACf,mBAAmB,CAAC,EAAE;IAAE,cAAc,EAAE,MAAM,EAAE,CAAC;IAAC,WAAW,CAAC,EAAE,MAAM,CAAA;CAAE,GACvE,cAAc,CA6DhB"}
@@ -0,0 +1,235 @@
1
+ "use strict";
2
+ /**
3
+ * Message Classifier
4
+ *
5
+ * Lightweight, heuristic-first message classification.
6
+ * No LLM call — runs in <5ms. Classifies user messages by intent and determines
7
+ * which DUDE phases (Dissolve/Unify/Differentiate/Evaluate) to apply.
8
+ *
9
+ * Extracted from Charter Cloud (Cognitive Console).
10
+ */
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.classifyMessage = classifyMessage;
13
+ // ============================================================================
14
+ // Intent Signal Patterns
15
+ // ============================================================================
16
+ const INTENT_PATTERNS = {
17
+ ideation: {
18
+ patterns: [
19
+ /^i('m| am) (thinking|considering|wondering|exploring|toying)/i,
20
+ /what if we/i,
21
+ /could we (try|explore|consider)/i,
22
+ /^(brainstorm|ideate|spitball)/i,
23
+ /how (might|could) we/i,
24
+ /^what (about|would happen)/i,
25
+ /playing with the idea/i,
26
+ /^imagine/i,
27
+ /just thinking out loud/i,
28
+ /throwing this out there/i,
29
+ ],
30
+ weight: 1.0
31
+ },
32
+ decision: {
33
+ patterns: [
34
+ /should (we|i|the team) (use|pick|choose|go with|adopt|switch)/i,
35
+ /^(which|what) (is better|should we|do you recommend)/i,
36
+ /versus|vs\.?\s/i,
37
+ /or should we/i,
38
+ /^decide|^choose|^pick between/i,
39
+ /trade-?offs? (between|of)/i,
40
+ /pros and cons/i,
41
+ /make a (decision|call|choice)/i,
42
+ /\bA or B\b/i,
43
+ /recommend (against|for|between)/i,
44
+ ],
45
+ weight: 1.0
46
+ },
47
+ doubt: {
48
+ patterns: [
49
+ /(something|this) (feels|seems) (off|wrong|weird|risky)/i,
50
+ /i('m| am) (not sure|uncertain|worried|concerned|uneasy)/i,
51
+ /doesn't (feel|seem|sit) right/i,
52
+ /^(is this|are we) (okay|right|correct|safe)/i,
53
+ /nagging (feeling|sense)/i,
54
+ /red flag/i,
55
+ /am i (overthinking|wrong|missing)/i,
56
+ /^(can you|could you) (validate|sanity.check|gut.check)/i,
57
+ /second.guess/i,
58
+ /smell(s)? (off|wrong|bad)/i,
59
+ ],
60
+ weight: 1.0
61
+ },
62
+ synthesis: {
63
+ patterns: [
64
+ /^(let me|i('ll| will)) (pull together|summarize|consolidate|synthesize)/i,
65
+ /^(summarize|recap|consolidate|wrap up)/i,
66
+ /putting (it|this) all together/i,
67
+ /^(so|okay),? (to (summarize|recap)|in summary)/i,
68
+ /^here('s| is) (what|where) (we|things) (stand|are)/i,
69
+ /^(draft|write|formalize|document) (an?|the) (adr|policy|sop|decision)/i,
70
+ /formalize this/i,
71
+ /make this official/i,
72
+ ],
73
+ weight: 1.0
74
+ },
75
+ question: {
76
+ patterns: [
77
+ /^what('s| is) (our|the) (pattern|policy|approach|standard|blessed)/i,
78
+ /^(do|does) (we|the team) have (a|an)/i,
79
+ /^(how|where) (do|does|did|can|should)/i,
80
+ /^(what|which|who|when|where|why|how)\b/i,
81
+ /^is (there|it|this)/i,
82
+ /^can (you|i|we) (check|look up|find|tell me)/i,
83
+ /^quick question/i,
84
+ /^reminder:/i,
85
+ ],
86
+ weight: 0.7
87
+ },
88
+ review: {
89
+ patterns: [
90
+ /^review (this|my|our|the)/i,
91
+ /^(red.team|critique|tear apart|challenge|attack)/i,
92
+ /^(check|audit|inspect|evaluate|assess) (this|my|our|the)/i,
93
+ /security (review|audit|check)/i,
94
+ /architecture review/i,
95
+ /what('s| is) wrong with/i,
96
+ /^(find|spot) (the )?(flaws|issues|problems|vulnerabilities)/i,
97
+ /poke holes/i,
98
+ /stress.test/i,
99
+ ],
100
+ weight: 1.0
101
+ }
102
+ };
103
+ // ============================================================================
104
+ // DUDE Phase Mapping
105
+ // ============================================================================
106
+ const INTENT_TO_PHASES = {
107
+ ideation: ['D', 'Di'],
108
+ decision: ['D', 'U', 'Di', 'E'],
109
+ doubt: ['D', 'U'],
110
+ synthesis: ['U', 'E'],
111
+ question: ['U'],
112
+ review: ['Di', 'E'],
113
+ };
114
+ const INTENT_TO_MODE = {
115
+ ideation: 'STRATEGY',
116
+ decision: 'GOVERNANCE',
117
+ doubt: 'STRATEGY',
118
+ synthesis: 'DRAFTER',
119
+ question: 'GOVERNANCE',
120
+ review: 'RED_TEAM',
121
+ };
122
+ // ============================================================================
123
+ // Domain Detection (standalone — no DB dependency)
124
+ // ============================================================================
125
+ const DOMAIN_PATTERNS = {
126
+ ARCHITECTURE: [/architect/i, /infrastructure/i, /system design/i, /topology/i, /microservice/i, /monolith/i],
127
+ DATA: [/database/i, /schema/i, /migration/i, /data model/i, /query/i, /storage/i, /d1/i, /sqlite/i],
128
+ SECURITY: [/security/i, /auth/i, /permission/i, /vulnerability/i, /encryption/i, /jwt/i, /oauth/i],
129
+ STANDARDS: [/standard/i, /convention/i, /pattern/i, /blessed/i, /anti-pattern/i, /best practice/i],
130
+ STRATEGY: [/strategy/i, /roadmap/i, /long-?term/i, /vision/i, /trade-?off/i],
131
+ };
132
+ function detectDomain(text) {
133
+ let bestDomain = null;
134
+ let bestScore = 0;
135
+ for (const [domain, patterns] of Object.entries(DOMAIN_PATTERNS)) {
136
+ const score = patterns.filter(p => p.test(text)).length;
137
+ if (score > bestScore) {
138
+ bestScore = score;
139
+ bestDomain = domain;
140
+ }
141
+ }
142
+ return bestDomain;
143
+ }
144
+ // ============================================================================
145
+ // Classification Logic
146
+ // ============================================================================
147
+ /**
148
+ * Classify a user message by intent, DUDE phases, complexity, and suggested mode.
149
+ * Pure heuristics — no LLM call, runs in <5ms.
150
+ */
151
+ function classifyMessage(message, conversationContext) {
152
+ const signals = [];
153
+ const scores = new Map();
154
+ for (const intent of Object.keys(INTENT_PATTERNS)) {
155
+ scores.set(intent, 0);
156
+ }
157
+ for (const [intent, config] of Object.entries(INTENT_PATTERNS)) {
158
+ for (const pattern of config.patterns) {
159
+ if (pattern.test(message)) {
160
+ const current = scores.get(intent) || 0;
161
+ scores.set(intent, current + config.weight);
162
+ signals.push(`${intent}:${pattern.source.substring(0, 30)}`);
163
+ }
164
+ }
165
+ }
166
+ if (conversationContext) {
167
+ const msgCount = conversationContext.recentMessages.length;
168
+ if (msgCount === 0) {
169
+ const current = scores.get('ideation') || 0;
170
+ scores.set('ideation', current + 0.3);
171
+ signals.push('position:first-message');
172
+ }
173
+ else if (msgCount > 6) {
174
+ const synthCurrent = scores.get('synthesis') || 0;
175
+ scores.set('synthesis', synthCurrent + 0.2);
176
+ const decCurrent = scores.get('decision') || 0;
177
+ scores.set('decision', decCurrent + 0.2);
178
+ signals.push('position:deep-conversation');
179
+ }
180
+ }
181
+ let bestIntent = 'question';
182
+ let bestScore = 0;
183
+ for (const [intent, score] of scores.entries()) {
184
+ if (score > bestScore) {
185
+ bestScore = score;
186
+ bestIntent = intent;
187
+ }
188
+ }
189
+ const maxPossible = INTENT_PATTERNS[bestIntent].patterns.length * INTENT_PATTERNS[bestIntent].weight;
190
+ const confidence = maxPossible > 0
191
+ ? Math.min(1.0, bestScore / Math.max(maxPossible * 0.3, 1))
192
+ : 0.5;
193
+ const complexity = estimateComplexity(message);
194
+ const domain = detectDomain(message);
195
+ return {
196
+ intent: bestIntent,
197
+ confidence: Math.round(confidence * 100) / 100,
198
+ dudePhases: INTENT_TO_PHASES[bestIntent],
199
+ suggestedMode: INTENT_TO_MODE[bestIntent],
200
+ complexity,
201
+ signals: signals.slice(0, 5),
202
+ domain,
203
+ };
204
+ }
205
+ // ============================================================================
206
+ // Complexity Estimation
207
+ // ============================================================================
208
+ function estimateComplexity(message) {
209
+ let score = 0;
210
+ const wordCount = message.split(/\s+/).length;
211
+ if (wordCount > 100)
212
+ score += 2;
213
+ else if (wordCount > 40)
214
+ score += 1;
215
+ const techTerms = message.match(/\b(api|database|schema|migration|auth|deploy|infrastructure|microservice|monolith|cache|queue|worker|webhook|oauth|jwt|graphql|rest|grpc|websocket|kubernetes|docker|terraform|cdn|dns|ssl|tls|encryption|sharding|replication|load.?balanc|circuit.?break|saga|cqrs|event.?sourc)\b/gi);
216
+ if (techTerms && techTerms.length > 3)
217
+ score += 2;
218
+ else if (techTerms && techTerms.length > 1)
219
+ score += 1;
220
+ const references = message.match(/(https?:\/\/|`[^`]+`|\/[\w/.-]+\.\w+)/g);
221
+ if (references && references.length > 2)
222
+ score += 1;
223
+ const questionMarks = (message.match(/\?/g) || []).length;
224
+ if (questionMarks > 2)
225
+ score += 1;
226
+ const listItems = (message.match(/^\s*[-*\d]+[.)]\s/gm) || []).length;
227
+ if (listItems > 2)
228
+ score += 1;
229
+ if (score >= 4)
230
+ return 'high';
231
+ if (score >= 2)
232
+ return 'medium';
233
+ return 'low';
234
+ }
235
+ //# sourceMappingURL=message-classifier.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"message-classifier.js","sourceRoot":"","sources":["../src/message-classifier.ts"],"names":[],"mappings":";AAAA;;;;;;;;GAQG;;AA0KH,0CAgEC;AArND,+EAA+E;AAC/E,yBAAyB;AACzB,+EAA+E;AAE/E,MAAM,eAAe,GAAkE;IACrF,QAAQ,EAAE;QACR,QAAQ,EAAE;YACR,+DAA+D;YAC/D,aAAa;YACb,kCAAkC;YAClC,gCAAgC;YAChC,uBAAuB;YACvB,6BAA6B;YAC7B,wBAAwB;YACxB,WAAW;YACX,yBAAyB;YACzB,0BAA0B;SAC3B;QACD,MAAM,EAAE,GAAG;KACZ;IACD,QAAQ,EAAE;QACR,QAAQ,EAAE;YACR,gEAAgE;YAChE,uDAAuD;YACvD,iBAAiB;YACjB,eAAe;YACf,gCAAgC;YAChC,4BAA4B;YAC5B,gBAAgB;YAChB,gCAAgC;YAChC,aAAa;YACb,kCAAkC;SACnC;QACD,MAAM,EAAE,GAAG;KACZ;IACD,KAAK,EAAE;QACL,QAAQ,EAAE;YACR,yDAAyD;YACzD,0DAA0D;YAC1D,gCAAgC;YAChC,8CAA8C;YAC9C,0BAA0B;YAC1B,WAAW;YACX,oCAAoC;YACpC,yDAAyD;YACzD,eAAe;YACf,4BAA4B;SAC7B;QACD,MAAM,EAAE,GAAG;KACZ;IACD,SAAS,EAAE;QACT,QAAQ,EAAE;YACR,0EAA0E;YAC1E,yCAAyC;YACzC,iCAAiC;YACjC,iDAAiD;YACjD,qDAAqD;YACrD,wEAAwE;YACxE,iBAAiB;YACjB,qBAAqB;SACtB;QACD,MAAM,EAAE,GAAG;KACZ;IACD,QAAQ,EAAE;QACR,QAAQ,EAAE;YACR,qEAAqE;YACrE,uCAAuC;YACvC,wCAAwC;YACxC,yCAAyC;YACzC,sBAAsB;YACtB,+CAA+C;YAC/C,kBAAkB;YAClB,aAAa;SACd;QACD,MAAM,E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AAC;IAEpC,MAAM,SAAS,GAAG,OAAO,CAAC,KAAK,CAC7B,wRAAwR,CACzR,CAAC;IACF,IAAI,SAAS,IAAI,SAAS,CAAC,MAAM,GAAG,CAAC;QAAE,KAAK,IAAI,CAAC,CAAC;SAC7C,IAAI,SAAS,IAAI,SAAS,CAAC,MAAM,GAAG,CAAC;QAAE,KAAK,IAAI,CAAC,CAAC;IAEvD,MAAM,UAAU,GAAG,OAAO,CAAC,KAAK,CAAC,wCAAwC,CAAC,CAAC;IAC3E,IAAI,UAAU,IAAI,UAAU,CAAC,MAAM,GAAG,CAAC;QAAE,KAAK,IAAI,CAAC,CAAC;IAEpD,MAAM,aAAa,GAAG,CAAC,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC;IAC1D,IAAI,aAAa,GAAG,CAAC;QAAE,KAAK,IAAI,CAAC,CAAC;IAElC,MAAM,SAAS,GAAG,CAAC,OAAO,CAAC,KAAK,CAAC,qBAAqB,CAAC,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC;IACtE,IAAI,SAAS,GAAG,CAAC;QAAE,KAAK,IAAI,CAAC,CAAC;IAE9B,IAAI,KAAK,IAAI,CAAC;QAAE,OAAO,MAAM,CAAC;IAC9B,IAAI,KAAK,IAAI,CAAC;QAAE,OAAO,QAAQ,CAAC;IAChC,OAAO,KAAK,CAAC;AACf,CAAC"}
package/package.json ADDED
@@ -0,0 +1,34 @@
1
+ {
2
+ "name": "@stackbilt/validate",
3
+ "version": "0.1.1",
4
+ "description": "Citation validation, message classification, and governance checks",
5
+ "main": "./dist/index.js",
6
+ "types": "./dist/index.d.ts",
7
+ "exports": {
8
+ ".": {
9
+ "types": "./dist/index.d.ts",
10
+ "default": "./dist/index.js"
11
+ }
12
+ },
13
+ "files": [
14
+ "dist",
15
+ "README.md",
16
+ "LICENSE"
17
+ ],
18
+ "engines": {
19
+ "node": ">=18.0.0"
20
+ },
21
+ "repository": {
22
+ "type": "git",
23
+ "url": "https://github.com/Stackbilt-dev/charter.git",
24
+ "directory": "packages/validate"
25
+ },
26
+ "bugs": {
27
+ "url": "https://github.com/Stackbilt-dev/charter/issues"
28
+ },
29
+ "homepage": "https://github.com/Stackbilt-dev/charter#readme",
30
+ "dependencies": {
31
+ "@stackbilt/types": "workspace:*"
32
+ },
33
+ "license": "Apache-2.0"
34
+ }