clavix 4.3.1 → 4.3.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.
- package/LICENSE +201 -21
- package/README.md +1 -1
- package/dist/core/conversation-quality-tracker.d.ts +81 -0
- package/dist/core/conversation-quality-tracker.js +195 -0
- package/dist/core/intelligence/intent-detector.js +3 -0
- package/dist/core/intelligence/pattern-library.d.ts +18 -1
- package/dist/core/intelligence/pattern-library.js +131 -0
- package/dist/core/intelligence/patterns/conversation-summarizer.d.ts +25 -0
- package/dist/core/intelligence/patterns/conversation-summarizer.js +197 -0
- package/dist/core/intelligence/patterns/dependency-identifier.d.ts +21 -0
- package/dist/core/intelligence/patterns/dependency-identifier.js +149 -0
- package/dist/core/intelligence/patterns/implicit-requirement-extractor.d.ts +20 -0
- package/dist/core/intelligence/patterns/implicit-requirement-extractor.js +129 -0
- package/dist/core/intelligence/patterns/requirement-prioritizer.d.ts +22 -0
- package/dist/core/intelligence/patterns/requirement-prioritizer.js +117 -0
- package/dist/core/intelligence/patterns/success-metrics-enforcer.d.ts +22 -0
- package/dist/core/intelligence/patterns/success-metrics-enforcer.js +142 -0
- package/dist/core/intelligence/patterns/topic-coherence-analyzer.d.ts +22 -0
- package/dist/core/intelligence/patterns/topic-coherence-analyzer.js +140 -0
- package/dist/core/intelligence/patterns/user-persona-enricher.d.ts +22 -0
- package/dist/core/intelligence/patterns/user-persona-enricher.js +124 -0
- package/dist/core/intelligence/quality-assessor.js +2 -0
- package/dist/core/intelligence/types.d.ts +7 -2
- package/dist/core/intelligence/universal-optimizer.d.ts +27 -2
- package/dist/core/intelligence/universal-optimizer.js +65 -5
- package/dist/templates/slash-commands/_canonical/deep.md +1 -0
- package/dist/templates/slash-commands/_canonical/fast.md +1 -0
- package/dist/templates/slash-commands/_components/sections/pattern-visibility.md +26 -2
- package/package.json +2 -2
|
@@ -21,6 +21,15 @@ import { SuccessCriteriaEnforcer } from './patterns/success-criteria-enforcer.js
|
|
|
21
21
|
import { ErrorToleranceEnhancer } from './patterns/error-tolerance-enhancer.js';
|
|
22
22
|
import { PrerequisiteIdentifier } from './patterns/prerequisite-identifier.js';
|
|
23
23
|
import { DomainContextEnricher } from './patterns/domain-context-enricher.js';
|
|
24
|
+
// v4.3.2 PRD patterns
|
|
25
|
+
import { RequirementPrioritizer } from './patterns/requirement-prioritizer.js';
|
|
26
|
+
import { UserPersonaEnricher } from './patterns/user-persona-enricher.js';
|
|
27
|
+
import { SuccessMetricsEnforcer } from './patterns/success-metrics-enforcer.js';
|
|
28
|
+
import { DependencyIdentifier } from './patterns/dependency-identifier.js';
|
|
29
|
+
// v4.3.2 Conversational patterns
|
|
30
|
+
import { ConversationSummarizer } from './patterns/conversation-summarizer.js';
|
|
31
|
+
import { TopicCoherenceAnalyzer } from './patterns/topic-coherence-analyzer.js';
|
|
32
|
+
import { ImplicitRequirementExtractor } from './patterns/implicit-requirement-extractor.js';
|
|
24
33
|
export class PatternLibrary {
|
|
25
34
|
patterns = new Map();
|
|
26
35
|
constructor() {
|
|
@@ -51,6 +60,15 @@ export class PatternLibrary {
|
|
|
51
60
|
this.register(new ErrorToleranceEnhancer()); // P5 - Add error handling (deep only)
|
|
52
61
|
this.register(new PrerequisiteIdentifier()); // P6 - Identify prerequisites (deep only)
|
|
53
62
|
this.register(new DomainContextEnricher()); // P5 - Add domain best practices (both modes)
|
|
63
|
+
// v4.3.2 PRD patterns
|
|
64
|
+
this.register(new RequirementPrioritizer()); // P7 - Separate must-have from nice-to-have
|
|
65
|
+
this.register(new UserPersonaEnricher()); // P6 - Add user context and personas
|
|
66
|
+
this.register(new SuccessMetricsEnforcer()); // P7 - Ensure measurable success criteria
|
|
67
|
+
this.register(new DependencyIdentifier()); // P5 - Identify technical/external dependencies
|
|
68
|
+
// v4.3.2 Conversational patterns
|
|
69
|
+
this.register(new ConversationSummarizer()); // P8 - Extract structured requirements
|
|
70
|
+
this.register(new TopicCoherenceAnalyzer()); // P6 - Detect topic shifts
|
|
71
|
+
this.register(new ImplicitRequirementExtractor()); // P7 - Surface implicit requirements
|
|
54
72
|
}
|
|
55
73
|
/**
|
|
56
74
|
* Register a new pattern
|
|
@@ -102,6 +120,119 @@ export class PatternLibrary {
|
|
|
102
120
|
// Sort by priority (highest first)
|
|
103
121
|
return applicablePatterns.sort((a, b) => b.priority - a.priority);
|
|
104
122
|
}
|
|
123
|
+
/**
|
|
124
|
+
* v4.3.2: Select patterns for specific mode with phase-awareness
|
|
125
|
+
* Maps PRD and conversational modes to appropriate base modes and patterns
|
|
126
|
+
*/
|
|
127
|
+
selectPatternsForMode(mode, intent, phase) {
|
|
128
|
+
// Map PRD/conversational modes to base modes for pattern selection
|
|
129
|
+
const baseMode = this.mapToBaseMode(mode, phase);
|
|
130
|
+
const applicablePatterns = [];
|
|
131
|
+
for (const pattern of this.patterns.values()) {
|
|
132
|
+
// Check mode compatibility (use mapped base mode)
|
|
133
|
+
if (pattern.mode !== 'both' && pattern.mode !== baseMode) {
|
|
134
|
+
continue;
|
|
135
|
+
}
|
|
136
|
+
// Check intent compatibility
|
|
137
|
+
if (!pattern.applicableIntents.includes(intent.primaryIntent)) {
|
|
138
|
+
continue;
|
|
139
|
+
}
|
|
140
|
+
// Phase-specific filtering for PRD mode
|
|
141
|
+
if (mode === 'prd' && phase) {
|
|
142
|
+
if (!this.isPatternApplicableForPRDPhase(pattern, phase)) {
|
|
143
|
+
continue;
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
// Phase-specific filtering for conversational mode
|
|
147
|
+
if (mode === 'conversational' && phase) {
|
|
148
|
+
if (!this.isPatternApplicableForConversationalPhase(pattern, phase)) {
|
|
149
|
+
continue;
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
applicablePatterns.push(pattern);
|
|
153
|
+
}
|
|
154
|
+
// Sort by priority (highest first)
|
|
155
|
+
return applicablePatterns.sort((a, b) => b.priority - a.priority);
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* Map extended modes to base modes for pattern compatibility
|
|
159
|
+
*/
|
|
160
|
+
mapToBaseMode(mode, phase) {
|
|
161
|
+
switch (mode) {
|
|
162
|
+
case 'prd':
|
|
163
|
+
// PRD uses deep mode for output generation, fast for validation
|
|
164
|
+
return phase === 'question-validation' ? 'fast' : 'deep';
|
|
165
|
+
case 'conversational':
|
|
166
|
+
// Conversational uses fast mode for tracking, deep for summarization
|
|
167
|
+
return phase === 'summarization' ? 'deep' : 'fast';
|
|
168
|
+
case 'fast':
|
|
169
|
+
case 'deep':
|
|
170
|
+
default:
|
|
171
|
+
return mode;
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
/**
|
|
175
|
+
* Check if pattern is applicable for PRD phase
|
|
176
|
+
*/
|
|
177
|
+
isPatternApplicableForPRDPhase(pattern, phase) {
|
|
178
|
+
// Patterns for question validation (lightweight, clarity-focused)
|
|
179
|
+
const questionValidationPatterns = [
|
|
180
|
+
'ambiguity-detector',
|
|
181
|
+
'completeness-validator',
|
|
182
|
+
'objective-clarifier',
|
|
183
|
+
];
|
|
184
|
+
// Patterns for output generation (comprehensive)
|
|
185
|
+
const outputGenerationPatterns = [
|
|
186
|
+
'prd-structure-enforcer',
|
|
187
|
+
'structure-organizer',
|
|
188
|
+
'success-criteria-enforcer',
|
|
189
|
+
'scope-definer',
|
|
190
|
+
'edge-case-identifier',
|
|
191
|
+
'assumption-explicitizer',
|
|
192
|
+
'technical-context-enricher',
|
|
193
|
+
'domain-context-enricher',
|
|
194
|
+
// v4.3.2 PRD patterns will be added here
|
|
195
|
+
'requirement-prioritizer',
|
|
196
|
+
'user-persona-enricher',
|
|
197
|
+
'success-metrics-enforcer',
|
|
198
|
+
'dependency-identifier',
|
|
199
|
+
];
|
|
200
|
+
if (phase === 'question-validation') {
|
|
201
|
+
return questionValidationPatterns.includes(pattern.id);
|
|
202
|
+
}
|
|
203
|
+
if (phase === 'output-generation') {
|
|
204
|
+
return outputGenerationPatterns.includes(pattern.id);
|
|
205
|
+
}
|
|
206
|
+
return true; // Default: allow pattern
|
|
207
|
+
}
|
|
208
|
+
/**
|
|
209
|
+
* Check if pattern is applicable for conversational phase
|
|
210
|
+
*/
|
|
211
|
+
isPatternApplicableForConversationalPhase(pattern, phase) {
|
|
212
|
+
// Patterns for conversation tracking (minimal, non-intrusive)
|
|
213
|
+
const conversationTrackingPatterns = ['ambiguity-detector', 'completeness-validator'];
|
|
214
|
+
// Patterns for summarization (comprehensive extraction)
|
|
215
|
+
const summarizationPatterns = [
|
|
216
|
+
'structure-organizer',
|
|
217
|
+
'completeness-validator',
|
|
218
|
+
'success-criteria-enforcer',
|
|
219
|
+
'edge-case-identifier',
|
|
220
|
+
'actionability-enhancer',
|
|
221
|
+
'technical-context-enricher',
|
|
222
|
+
'domain-context-enricher',
|
|
223
|
+
// v4.3.2 Conversational patterns will be added here
|
|
224
|
+
'conversation-summarizer',
|
|
225
|
+
'topic-coherence-analyzer',
|
|
226
|
+
'implicit-requirement-extractor',
|
|
227
|
+
];
|
|
228
|
+
if (phase === 'conversation-tracking') {
|
|
229
|
+
return conversationTrackingPatterns.includes(pattern.id);
|
|
230
|
+
}
|
|
231
|
+
if (phase === 'summarization') {
|
|
232
|
+
return summarizationPatterns.includes(pattern.id);
|
|
233
|
+
}
|
|
234
|
+
return true; // Default: allow pattern
|
|
235
|
+
}
|
|
105
236
|
/**
|
|
106
237
|
* Get all registered patterns
|
|
107
238
|
*/
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { BasePattern } from './base-pattern.js';
|
|
2
|
+
import { PromptIntent, OptimizationMode, PatternContext, PatternResult } from '../types.js';
|
|
3
|
+
/**
|
|
4
|
+
* v4.3.2 Conversational Pattern: ConversationSummarizer
|
|
5
|
+
*
|
|
6
|
+
* Extracts structured requirements from conversational messages.
|
|
7
|
+
* Organizes free-form discussion into actionable requirements.
|
|
8
|
+
*/
|
|
9
|
+
export declare class ConversationSummarizer extends BasePattern {
|
|
10
|
+
id: string;
|
|
11
|
+
name: string;
|
|
12
|
+
description: string;
|
|
13
|
+
applicableIntents: PromptIntent[];
|
|
14
|
+
mode: OptimizationMode | 'both';
|
|
15
|
+
priority: number;
|
|
16
|
+
apply(prompt: string, _context: PatternContext): PatternResult;
|
|
17
|
+
private isAlreadyStructured;
|
|
18
|
+
private isConversationalContent;
|
|
19
|
+
private extractAndStructure;
|
|
20
|
+
private extractRequirements;
|
|
21
|
+
private extractConstraints;
|
|
22
|
+
private extractGoals;
|
|
23
|
+
private cleanRequirement;
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=conversation-summarizer.d.ts.map
|
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
import { BasePattern } from './base-pattern.js';
|
|
2
|
+
/**
|
|
3
|
+
* v4.3.2 Conversational Pattern: ConversationSummarizer
|
|
4
|
+
*
|
|
5
|
+
* Extracts structured requirements from conversational messages.
|
|
6
|
+
* Organizes free-form discussion into actionable requirements.
|
|
7
|
+
*/
|
|
8
|
+
export class ConversationSummarizer extends BasePattern {
|
|
9
|
+
id = 'conversation-summarizer';
|
|
10
|
+
name = 'ConversationSummarizer';
|
|
11
|
+
description = 'Extracts structured requirements from messages';
|
|
12
|
+
applicableIntents = ['summarization', 'planning', 'prd-generation'];
|
|
13
|
+
mode = 'deep';
|
|
14
|
+
priority = 8;
|
|
15
|
+
apply(prompt, _context) {
|
|
16
|
+
// Check if content is already well-structured
|
|
17
|
+
if (this.isAlreadyStructured(prompt)) {
|
|
18
|
+
return {
|
|
19
|
+
enhancedPrompt: prompt,
|
|
20
|
+
improvement: {
|
|
21
|
+
dimension: 'structure',
|
|
22
|
+
description: 'Content already well-structured',
|
|
23
|
+
impact: 'low',
|
|
24
|
+
},
|
|
25
|
+
applied: false,
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
// Check if this looks like conversational content
|
|
29
|
+
if (!this.isConversationalContent(prompt)) {
|
|
30
|
+
return {
|
|
31
|
+
enhancedPrompt: prompt,
|
|
32
|
+
improvement: {
|
|
33
|
+
dimension: 'structure',
|
|
34
|
+
description: 'Not conversational content',
|
|
35
|
+
impact: 'low',
|
|
36
|
+
},
|
|
37
|
+
applied: false,
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
// Extract and structure requirements
|
|
41
|
+
const enhanced = this.extractAndStructure(prompt);
|
|
42
|
+
return {
|
|
43
|
+
enhancedPrompt: enhanced,
|
|
44
|
+
improvement: {
|
|
45
|
+
dimension: 'structure',
|
|
46
|
+
description: 'Extracted structured requirements from conversation',
|
|
47
|
+
impact: 'high',
|
|
48
|
+
},
|
|
49
|
+
applied: true,
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
isAlreadyStructured(prompt) {
|
|
53
|
+
// Check for markdown structure
|
|
54
|
+
const structureIndicators = [
|
|
55
|
+
'##',
|
|
56
|
+
'###',
|
|
57
|
+
'**Requirements:**',
|
|
58
|
+
'**Features:**',
|
|
59
|
+
'- [ ]',
|
|
60
|
+
'1.',
|
|
61
|
+
'2.',
|
|
62
|
+
'3.',
|
|
63
|
+
];
|
|
64
|
+
const matches = structureIndicators.filter((indicator) => prompt.includes(indicator));
|
|
65
|
+
return matches.length >= 3;
|
|
66
|
+
}
|
|
67
|
+
isConversationalContent(prompt) {
|
|
68
|
+
// Conversational markers
|
|
69
|
+
const conversationalMarkers = [
|
|
70
|
+
'i want',
|
|
71
|
+
'i need',
|
|
72
|
+
'we need',
|
|
73
|
+
'should be able to',
|
|
74
|
+
'would like',
|
|
75
|
+
'thinking about',
|
|
76
|
+
'maybe we could',
|
|
77
|
+
'what if',
|
|
78
|
+
'how about',
|
|
79
|
+
'let me',
|
|
80
|
+
"let's",
|
|
81
|
+
'also',
|
|
82
|
+
'and then',
|
|
83
|
+
'basically',
|
|
84
|
+
'so basically',
|
|
85
|
+
];
|
|
86
|
+
const lowerPrompt = prompt.toLowerCase();
|
|
87
|
+
const matches = conversationalMarkers.filter((marker) => lowerPrompt.includes(marker));
|
|
88
|
+
// Also check for lack of structure (sentences without bullet points)
|
|
89
|
+
const sentences = this.extractSentences(prompt);
|
|
90
|
+
const hasBulletPoints = prompt.includes('- ') || prompt.includes('* ');
|
|
91
|
+
return matches.length >= 2 || (sentences.length > 3 && !hasBulletPoints);
|
|
92
|
+
}
|
|
93
|
+
extractAndStructure(prompt) {
|
|
94
|
+
const requirements = this.extractRequirements(prompt);
|
|
95
|
+
const constraints = this.extractConstraints(prompt);
|
|
96
|
+
const goals = this.extractGoals(prompt);
|
|
97
|
+
let structured = '### Extracted Requirements\n\n';
|
|
98
|
+
if (goals.length > 0) {
|
|
99
|
+
structured += '**Goals:**\n';
|
|
100
|
+
structured += goals.map((g) => `- ${g}`).join('\n');
|
|
101
|
+
structured += '\n\n';
|
|
102
|
+
}
|
|
103
|
+
if (requirements.length > 0) {
|
|
104
|
+
structured += '**Requirements:**\n';
|
|
105
|
+
structured += requirements.map((r) => `- ${r}`).join('\n');
|
|
106
|
+
structured += '\n\n';
|
|
107
|
+
}
|
|
108
|
+
if (constraints.length > 0) {
|
|
109
|
+
structured += '**Constraints:**\n';
|
|
110
|
+
structured += constraints.map((c) => `- ${c}`).join('\n');
|
|
111
|
+
structured += '\n\n';
|
|
112
|
+
}
|
|
113
|
+
structured += '---\n\n**Original Context:**\n' + prompt;
|
|
114
|
+
return structured;
|
|
115
|
+
}
|
|
116
|
+
extractRequirements(prompt) {
|
|
117
|
+
const requirements = [];
|
|
118
|
+
const sentences = this.extractSentences(prompt);
|
|
119
|
+
const requirementPatterns = [
|
|
120
|
+
/(?:need|want|should|must|require)\s+(?:to\s+)?(.+)/i,
|
|
121
|
+
/(?:should be able to|needs to)\s+(.+)/i,
|
|
122
|
+
/(?:feature|functionality):\s*(.+)/i,
|
|
123
|
+
];
|
|
124
|
+
for (const sentence of sentences) {
|
|
125
|
+
for (const pattern of requirementPatterns) {
|
|
126
|
+
const match = sentence.match(pattern);
|
|
127
|
+
if (match && match[1]) {
|
|
128
|
+
const req = this.cleanRequirement(match[1]);
|
|
129
|
+
if (req && !requirements.includes(req)) {
|
|
130
|
+
requirements.push(req);
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
return requirements.slice(0, 10); // Max 10 requirements
|
|
136
|
+
}
|
|
137
|
+
extractConstraints(prompt) {
|
|
138
|
+
const constraints = [];
|
|
139
|
+
const lowerPrompt = prompt.toLowerCase();
|
|
140
|
+
const constraintPatterns = [
|
|
141
|
+
/(?:can't|cannot|shouldn't|must not)\s+(.+)/gi,
|
|
142
|
+
/(?:limited to|restricted to|only)\s+(.+)/gi,
|
|
143
|
+
/(?:within|budget|deadline|timeline):\s*(.+)/gi,
|
|
144
|
+
/(?:no more than|at most|maximum)\s+(.+)/gi,
|
|
145
|
+
];
|
|
146
|
+
for (const pattern of constraintPatterns) {
|
|
147
|
+
const matches = prompt.matchAll(pattern);
|
|
148
|
+
for (const match of matches) {
|
|
149
|
+
if (match[1]) {
|
|
150
|
+
const constraint = this.cleanRequirement(match[1]);
|
|
151
|
+
if (constraint && !constraints.includes(constraint)) {
|
|
152
|
+
constraints.push(constraint);
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
// Common constraint keywords
|
|
158
|
+
if (lowerPrompt.includes('performance')) {
|
|
159
|
+
constraints.push('Performance requirements to be defined');
|
|
160
|
+
}
|
|
161
|
+
if (lowerPrompt.includes('security')) {
|
|
162
|
+
constraints.push('Security requirements to be defined');
|
|
163
|
+
}
|
|
164
|
+
if (lowerPrompt.includes('mobile') && lowerPrompt.includes('desktop')) {
|
|
165
|
+
constraints.push('Must work on both mobile and desktop');
|
|
166
|
+
}
|
|
167
|
+
return constraints.slice(0, 5); // Max 5 constraints
|
|
168
|
+
}
|
|
169
|
+
extractGoals(prompt) {
|
|
170
|
+
const goals = [];
|
|
171
|
+
const goalPatterns = [
|
|
172
|
+
/(?:goal is to|aim to|objective is to)\s+(.+)/gi,
|
|
173
|
+
/(?:trying to|looking to|hoping to)\s+(.+)/gi,
|
|
174
|
+
/(?:so that|in order to)\s+(.+)/gi,
|
|
175
|
+
];
|
|
176
|
+
for (const pattern of goalPatterns) {
|
|
177
|
+
const matches = prompt.matchAll(pattern);
|
|
178
|
+
for (const match of matches) {
|
|
179
|
+
if (match[1]) {
|
|
180
|
+
const goal = this.cleanRequirement(match[1]);
|
|
181
|
+
if (goal && !goals.includes(goal)) {
|
|
182
|
+
goals.push(goal);
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
return goals.slice(0, 3); // Max 3 goals
|
|
188
|
+
}
|
|
189
|
+
cleanRequirement(text) {
|
|
190
|
+
return text
|
|
191
|
+
.trim()
|
|
192
|
+
.replace(/[.!?,;:]+$/, '')
|
|
193
|
+
.replace(/\s+/g, ' ')
|
|
194
|
+
.substring(0, 200);
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
//# sourceMappingURL=conversation-summarizer.js.map
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { BasePattern } from './base-pattern.js';
|
|
2
|
+
import { PromptIntent, OptimizationMode, PatternContext, PatternResult } from '../types.js';
|
|
3
|
+
/**
|
|
4
|
+
* v4.3.2 PRD Pattern: DependencyIdentifier
|
|
5
|
+
*
|
|
6
|
+
* Identifies technical and external dependencies in PRD content.
|
|
7
|
+
* Helps surface hidden requirements and blockers.
|
|
8
|
+
*/
|
|
9
|
+
export declare class DependencyIdentifier extends BasePattern {
|
|
10
|
+
id: string;
|
|
11
|
+
name: string;
|
|
12
|
+
description: string;
|
|
13
|
+
applicableIntents: PromptIntent[];
|
|
14
|
+
mode: OptimizationMode | 'both';
|
|
15
|
+
priority: number;
|
|
16
|
+
apply(prompt: string, _context: PatternContext): PatternResult;
|
|
17
|
+
private hasDependencySection;
|
|
18
|
+
private identifyDependencies;
|
|
19
|
+
private addDependencySection;
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=dependency-identifier.d.ts.map
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
import { BasePattern } from './base-pattern.js';
|
|
2
|
+
/**
|
|
3
|
+
* v4.3.2 PRD Pattern: DependencyIdentifier
|
|
4
|
+
*
|
|
5
|
+
* Identifies technical and external dependencies in PRD content.
|
|
6
|
+
* Helps surface hidden requirements and blockers.
|
|
7
|
+
*/
|
|
8
|
+
export class DependencyIdentifier extends BasePattern {
|
|
9
|
+
id = 'dependency-identifier';
|
|
10
|
+
name = 'DependencyIdentifier';
|
|
11
|
+
description = 'Identifies technical and external dependencies';
|
|
12
|
+
applicableIntents = ['prd-generation', 'planning', 'migration'];
|
|
13
|
+
mode = 'deep';
|
|
14
|
+
priority = 5;
|
|
15
|
+
apply(prompt, _context) {
|
|
16
|
+
// Check if dependencies are already documented
|
|
17
|
+
if (this.hasDependencySection(prompt)) {
|
|
18
|
+
return {
|
|
19
|
+
enhancedPrompt: prompt,
|
|
20
|
+
improvement: {
|
|
21
|
+
dimension: 'completeness',
|
|
22
|
+
description: 'Dependencies already documented',
|
|
23
|
+
impact: 'low',
|
|
24
|
+
},
|
|
25
|
+
applied: false,
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
// Check if this content has identifiable dependencies
|
|
29
|
+
const dependencies = this.identifyDependencies(prompt);
|
|
30
|
+
if (dependencies.length === 0) {
|
|
31
|
+
return {
|
|
32
|
+
enhancedPrompt: prompt,
|
|
33
|
+
improvement: {
|
|
34
|
+
dimension: 'completeness',
|
|
35
|
+
description: 'No clear dependencies identified',
|
|
36
|
+
impact: 'low',
|
|
37
|
+
},
|
|
38
|
+
applied: false,
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
// Add dependency section
|
|
42
|
+
const enhanced = this.addDependencySection(prompt, dependencies);
|
|
43
|
+
return {
|
|
44
|
+
enhancedPrompt: enhanced,
|
|
45
|
+
improvement: {
|
|
46
|
+
dimension: 'completeness',
|
|
47
|
+
description: `Identified ${dependencies.length} dependencies (technical/external)`,
|
|
48
|
+
impact: 'medium',
|
|
49
|
+
},
|
|
50
|
+
applied: true,
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
hasDependencySection(prompt) {
|
|
54
|
+
const dependencyKeywords = [
|
|
55
|
+
'dependencies',
|
|
56
|
+
'depends on',
|
|
57
|
+
'prerequisite',
|
|
58
|
+
'requires',
|
|
59
|
+
'blocked by',
|
|
60
|
+
'blocker',
|
|
61
|
+
'external service',
|
|
62
|
+
'third-party',
|
|
63
|
+
'integration with',
|
|
64
|
+
];
|
|
65
|
+
return this.hasSection(prompt, dependencyKeywords);
|
|
66
|
+
}
|
|
67
|
+
identifyDependencies(prompt) {
|
|
68
|
+
const dependencies = [];
|
|
69
|
+
const lowerPrompt = prompt.toLowerCase();
|
|
70
|
+
// Technical dependencies
|
|
71
|
+
if (lowerPrompt.includes('api')) {
|
|
72
|
+
dependencies.push('API availability and documentation');
|
|
73
|
+
}
|
|
74
|
+
if (lowerPrompt.includes('database') || lowerPrompt.includes('db')) {
|
|
75
|
+
dependencies.push('Database schema and migrations');
|
|
76
|
+
}
|
|
77
|
+
if (lowerPrompt.includes('authentication') || lowerPrompt.includes('auth')) {
|
|
78
|
+
dependencies.push('Authentication system integration');
|
|
79
|
+
}
|
|
80
|
+
if (lowerPrompt.includes('payment') ||
|
|
81
|
+
lowerPrompt.includes('stripe') ||
|
|
82
|
+
lowerPrompt.includes('billing')) {
|
|
83
|
+
dependencies.push('Payment provider integration');
|
|
84
|
+
}
|
|
85
|
+
if (lowerPrompt.includes('email') || lowerPrompt.includes('notification')) {
|
|
86
|
+
dependencies.push('Email/notification service');
|
|
87
|
+
}
|
|
88
|
+
if (lowerPrompt.includes('storage') ||
|
|
89
|
+
lowerPrompt.includes('s3') ||
|
|
90
|
+
lowerPrompt.includes('file')) {
|
|
91
|
+
dependencies.push('File storage service');
|
|
92
|
+
}
|
|
93
|
+
if (lowerPrompt.includes('search') || lowerPrompt.includes('elasticsearch')) {
|
|
94
|
+
dependencies.push('Search infrastructure');
|
|
95
|
+
}
|
|
96
|
+
if (lowerPrompt.includes('analytics') || lowerPrompt.includes('tracking')) {
|
|
97
|
+
dependencies.push('Analytics platform');
|
|
98
|
+
}
|
|
99
|
+
if (lowerPrompt.includes('ci/cd') || lowerPrompt.includes('deploy')) {
|
|
100
|
+
dependencies.push('CI/CD pipeline');
|
|
101
|
+
}
|
|
102
|
+
if (lowerPrompt.includes('cache') || lowerPrompt.includes('redis')) {
|
|
103
|
+
dependencies.push('Caching infrastructure');
|
|
104
|
+
}
|
|
105
|
+
// External dependencies
|
|
106
|
+
if (lowerPrompt.includes('third-party') || lowerPrompt.includes('external')) {
|
|
107
|
+
dependencies.push('Third-party service availability');
|
|
108
|
+
}
|
|
109
|
+
if (lowerPrompt.includes('team') || lowerPrompt.includes('collaboration')) {
|
|
110
|
+
dependencies.push('Cross-team coordination');
|
|
111
|
+
}
|
|
112
|
+
if (lowerPrompt.includes('approval') || lowerPrompt.includes('sign-off')) {
|
|
113
|
+
dependencies.push('Stakeholder approvals');
|
|
114
|
+
}
|
|
115
|
+
if (lowerPrompt.includes('legal') || lowerPrompt.includes('compliance')) {
|
|
116
|
+
dependencies.push('Legal/compliance review');
|
|
117
|
+
}
|
|
118
|
+
if (lowerPrompt.includes('design') ||
|
|
119
|
+
lowerPrompt.includes('ui') ||
|
|
120
|
+
lowerPrompt.includes('ux')) {
|
|
121
|
+
dependencies.push('Design specifications');
|
|
122
|
+
}
|
|
123
|
+
return dependencies;
|
|
124
|
+
}
|
|
125
|
+
addDependencySection(prompt, dependencies) {
|
|
126
|
+
// Categorize dependencies
|
|
127
|
+
const technical = dependencies.filter((d) => d.includes('API') ||
|
|
128
|
+
d.includes('Database') ||
|
|
129
|
+
d.includes('Authentication') ||
|
|
130
|
+
d.includes('service') ||
|
|
131
|
+
d.includes('infrastructure') ||
|
|
132
|
+
d.includes('pipeline'));
|
|
133
|
+
const external = dependencies.filter((d) => !technical.includes(d));
|
|
134
|
+
let section = '\n\n### Dependencies\n';
|
|
135
|
+
if (technical.length > 0) {
|
|
136
|
+
section += '**Technical Dependencies:**\n';
|
|
137
|
+
section += technical.map((d) => `- ${d}`).join('\n');
|
|
138
|
+
section += '\n\n';
|
|
139
|
+
}
|
|
140
|
+
if (external.length > 0) {
|
|
141
|
+
section += '**External Dependencies:**\n';
|
|
142
|
+
section += external.map((d) => `- ${d}`).join('\n');
|
|
143
|
+
section += '\n';
|
|
144
|
+
}
|
|
145
|
+
section += '\n**Dependency Status:** [Track status of each dependency]';
|
|
146
|
+
return prompt + section;
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
//# sourceMappingURL=dependency-identifier.js.map
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { BasePattern } from './base-pattern.js';
|
|
2
|
+
import { PromptIntent, OptimizationMode, PatternContext, PatternResult } from '../types.js';
|
|
3
|
+
/**
|
|
4
|
+
* v4.3.2 Conversational Pattern: ImplicitRequirementExtractor
|
|
5
|
+
*
|
|
6
|
+
* Surfaces requirements mentioned indirectly in conversations.
|
|
7
|
+
* Identifies hidden assumptions and unstated needs.
|
|
8
|
+
*/
|
|
9
|
+
export declare class ImplicitRequirementExtractor extends BasePattern {
|
|
10
|
+
id: string;
|
|
11
|
+
name: string;
|
|
12
|
+
description: string;
|
|
13
|
+
applicableIntents: PromptIntent[];
|
|
14
|
+
mode: OptimizationMode | 'both';
|
|
15
|
+
priority: number;
|
|
16
|
+
apply(prompt: string, _context: PatternContext): PatternResult;
|
|
17
|
+
private extractImplicitRequirements;
|
|
18
|
+
private addImplicitRequirements;
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=implicit-requirement-extractor.d.ts.map
|