clavix 4.2.0 → 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/cli/commands/deep.js +4 -58
- package/dist/cli/commands/init.js +13 -16
- package/dist/cli/commands/plan.js +2 -2
- 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/core/task-manager.d.ts +1 -2
- package/dist/core/task-manager.js +21 -26
- package/dist/templates/slash-commands/_canonical/deep.md +37 -69
- 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 +3 -3
- package/dist/templates/instructions/README 2.md +0 -311
- package/dist/templates/instructions/core 2/clavix-mode.md +0 -275
- package/dist/templates/instructions/core 2/file-operations.md +0 -330
- package/dist/templates/instructions/core 2/verification.md +0 -377
- package/dist/templates/instructions/troubleshooting 2/jumped-to-implementation.md +0 -234
- package/dist/templates/instructions/troubleshooting 2/mode-confusion.md +0 -402
- package/dist/templates/instructions/troubleshooting 2/skipped-file-creation.md +0 -385
- package/dist/templates/slash-commands/_canonical 2/archive.md +0 -410
- package/dist/templates/slash-commands/_canonical 2/deep.md +0 -512
- package/dist/templates/slash-commands/_canonical 2/execute.md +0 -80
- package/dist/templates/slash-commands/_canonical 2/fast.md +0 -370
- package/dist/templates/slash-commands/_canonical 2/implement.md +0 -364
- package/dist/templates/slash-commands/_canonical 2/plan.md +0 -329
- package/dist/templates/slash-commands/_canonical 2/prd.md +0 -320
- package/dist/templates/slash-commands/_canonical 2/prompts.md +0 -97
- package/dist/templates/slash-commands/_canonical 2/start.md +0 -204
- package/dist/templates/slash-commands/_canonical 2/summarize.md +0 -395
|
@@ -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
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import { BasePattern } from './base-pattern.js';
|
|
2
|
+
/**
|
|
3
|
+
* v4.3.2 Conversational Pattern: ImplicitRequirementExtractor
|
|
4
|
+
*
|
|
5
|
+
* Surfaces requirements mentioned indirectly in conversations.
|
|
6
|
+
* Identifies hidden assumptions and unstated needs.
|
|
7
|
+
*/
|
|
8
|
+
export class ImplicitRequirementExtractor extends BasePattern {
|
|
9
|
+
id = 'implicit-requirement-extractor';
|
|
10
|
+
name = 'ImplicitRequirementExtractor';
|
|
11
|
+
description = 'Surfaces requirements mentioned indirectly';
|
|
12
|
+
applicableIntents = ['summarization', 'planning', 'prd-generation'];
|
|
13
|
+
mode = 'deep';
|
|
14
|
+
priority = 7;
|
|
15
|
+
apply(prompt, _context) {
|
|
16
|
+
// Extract implicit requirements
|
|
17
|
+
const implicitReqs = this.extractImplicitRequirements(prompt);
|
|
18
|
+
// If no implicit requirements found, skip
|
|
19
|
+
if (implicitReqs.length === 0) {
|
|
20
|
+
return {
|
|
21
|
+
enhancedPrompt: prompt,
|
|
22
|
+
improvement: {
|
|
23
|
+
dimension: 'completeness',
|
|
24
|
+
description: 'No implicit requirements detected',
|
|
25
|
+
impact: 'low',
|
|
26
|
+
},
|
|
27
|
+
applied: false,
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
// Add implicit requirements section
|
|
31
|
+
const enhanced = this.addImplicitRequirements(prompt, implicitReqs);
|
|
32
|
+
return {
|
|
33
|
+
enhancedPrompt: enhanced,
|
|
34
|
+
improvement: {
|
|
35
|
+
dimension: 'completeness',
|
|
36
|
+
description: `Surfaced ${implicitReqs.length} implicit requirements`,
|
|
37
|
+
impact: 'medium',
|
|
38
|
+
},
|
|
39
|
+
applied: true,
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
extractImplicitRequirements(prompt) {
|
|
43
|
+
const implicitReqs = [];
|
|
44
|
+
const lowerPrompt = prompt.toLowerCase();
|
|
45
|
+
// Pattern 1: "like X" implies feature parity
|
|
46
|
+
const likePatterns = prompt.matchAll(/(?:like|similar to|same as)\s+([A-Za-z0-9\s]+)/gi);
|
|
47
|
+
for (const match of likePatterns) {
|
|
48
|
+
if (match[1]) {
|
|
49
|
+
implicitReqs.push(`Feature parity with "${match[1].trim()}" (implied)`);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
// Pattern 2: Technical mentions imply requirements
|
|
53
|
+
if (lowerPrompt.includes('mobile')) {
|
|
54
|
+
implicitReqs.push('Mobile-responsive design required');
|
|
55
|
+
}
|
|
56
|
+
if (lowerPrompt.includes('real-time') || lowerPrompt.includes('realtime')) {
|
|
57
|
+
implicitReqs.push('Real-time updates infrastructure needed');
|
|
58
|
+
}
|
|
59
|
+
if (lowerPrompt.includes('scale') ||
|
|
60
|
+
lowerPrompt.includes('thousands') ||
|
|
61
|
+
lowerPrompt.includes('millions')) {
|
|
62
|
+
implicitReqs.push('Scalability architecture required');
|
|
63
|
+
}
|
|
64
|
+
if (lowerPrompt.includes('secure') || lowerPrompt.includes('security')) {
|
|
65
|
+
implicitReqs.push('Security audit and compliance requirements');
|
|
66
|
+
}
|
|
67
|
+
if (lowerPrompt.includes('fast') || lowerPrompt.includes('quick')) {
|
|
68
|
+
implicitReqs.push('Performance optimization requirements');
|
|
69
|
+
}
|
|
70
|
+
// Pattern 3: User mentions imply auth/permissions
|
|
71
|
+
if ((lowerPrompt.includes('user') || lowerPrompt.includes('admin')) &&
|
|
72
|
+
!lowerPrompt.includes('authentication')) {
|
|
73
|
+
implicitReqs.push('User authentication system (implied by user roles)');
|
|
74
|
+
}
|
|
75
|
+
// Pattern 4: Data mentions imply storage
|
|
76
|
+
if ((lowerPrompt.includes('save') ||
|
|
77
|
+
lowerPrompt.includes('store') ||
|
|
78
|
+
lowerPrompt.includes('data')) &&
|
|
79
|
+
!lowerPrompt.includes('database')) {
|
|
80
|
+
implicitReqs.push('Data persistence/storage (implied by data operations)');
|
|
81
|
+
}
|
|
82
|
+
// Pattern 5: "Easy" or "simple" implies UX focus
|
|
83
|
+
if (lowerPrompt.includes('easy') ||
|
|
84
|
+
lowerPrompt.includes('simple') ||
|
|
85
|
+
lowerPrompt.includes('intuitive')) {
|
|
86
|
+
implicitReqs.push('User experience priority (simplicity mentioned)');
|
|
87
|
+
}
|
|
88
|
+
// Pattern 6: Notifications/alerts imply communication system
|
|
89
|
+
if (lowerPrompt.includes('notify') ||
|
|
90
|
+
lowerPrompt.includes('alert') ||
|
|
91
|
+
lowerPrompt.includes('email') ||
|
|
92
|
+
lowerPrompt.includes('notification')) {
|
|
93
|
+
implicitReqs.push('Notification system infrastructure');
|
|
94
|
+
}
|
|
95
|
+
// Pattern 7: Search implies search infrastructure
|
|
96
|
+
if (lowerPrompt.includes('search') || lowerPrompt.includes('find')) {
|
|
97
|
+
implicitReqs.push('Search functionality and indexing');
|
|
98
|
+
}
|
|
99
|
+
// Pattern 8: Reports/analytics implies data aggregation
|
|
100
|
+
if (lowerPrompt.includes('report') ||
|
|
101
|
+
lowerPrompt.includes('analytics') ||
|
|
102
|
+
lowerPrompt.includes('dashboard')) {
|
|
103
|
+
implicitReqs.push('Analytics and reporting infrastructure');
|
|
104
|
+
}
|
|
105
|
+
// Pattern 9: Integration mentions
|
|
106
|
+
if (lowerPrompt.includes('integrate') ||
|
|
107
|
+
lowerPrompt.includes('connect') ||
|
|
108
|
+
lowerPrompt.includes('sync')) {
|
|
109
|
+
implicitReqs.push('Integration APIs and webhooks');
|
|
110
|
+
}
|
|
111
|
+
// Pattern 10: "Always" or "never" implies validation rules
|
|
112
|
+
const alwaysNeverPatterns = prompt.matchAll(/(?:always|never|must always|must never)\s+([^.!?]+)/gi);
|
|
113
|
+
for (const match of alwaysNeverPatterns) {
|
|
114
|
+
if (match[1]) {
|
|
115
|
+
implicitReqs.push(`Business rule: "${match[1].trim()}" (implied constraint)`);
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
// Deduplicate
|
|
119
|
+
return [...new Set(implicitReqs)].slice(0, 8);
|
|
120
|
+
}
|
|
121
|
+
addImplicitRequirements(prompt, implicitReqs) {
|
|
122
|
+
let section = '\n\n### Implicit Requirements (Inferred)\n';
|
|
123
|
+
section += '*The following requirements are implied by the discussion:*\n\n';
|
|
124
|
+
section += implicitReqs.map((r) => `- ${r}`).join('\n');
|
|
125
|
+
section += '\n\n> **Note:** Please verify these inferred requirements are accurate.';
|
|
126
|
+
return prompt + section;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
//# sourceMappingURL=implicit-requirement-extractor.js.map
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { BasePattern } from './base-pattern.js';
|
|
2
|
+
import { PromptIntent, OptimizationMode, PatternContext, PatternResult } from '../types.js';
|
|
3
|
+
/**
|
|
4
|
+
* v4.3.2 PRD Pattern: RequirementPrioritizer
|
|
5
|
+
*
|
|
6
|
+
* Separates must-have from nice-to-have requirements in PRD content.
|
|
7
|
+
* Helps clarify priorities and MVP scope.
|
|
8
|
+
*/
|
|
9
|
+
export declare class RequirementPrioritizer 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 hasFeatureContent;
|
|
18
|
+
private hasPrioritization;
|
|
19
|
+
private addPrioritization;
|
|
20
|
+
private extractFeatureSection;
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=requirement-prioritizer.d.ts.map
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import { BasePattern } from './base-pattern.js';
|
|
2
|
+
/**
|
|
3
|
+
* v4.3.2 PRD Pattern: RequirementPrioritizer
|
|
4
|
+
*
|
|
5
|
+
* Separates must-have from nice-to-have requirements in PRD content.
|
|
6
|
+
* Helps clarify priorities and MVP scope.
|
|
7
|
+
*/
|
|
8
|
+
export class RequirementPrioritizer extends BasePattern {
|
|
9
|
+
id = 'requirement-prioritizer';
|
|
10
|
+
name = 'RequirementPrioritizer';
|
|
11
|
+
description = 'Separates must-have from nice-to-have requirements';
|
|
12
|
+
applicableIntents = ['prd-generation', 'planning'];
|
|
13
|
+
mode = 'deep';
|
|
14
|
+
priority = 7;
|
|
15
|
+
apply(prompt, _context) {
|
|
16
|
+
// Only apply to PRD-related content with features
|
|
17
|
+
if (!this.hasFeatureContent(prompt)) {
|
|
18
|
+
return {
|
|
19
|
+
enhancedPrompt: prompt,
|
|
20
|
+
improvement: {
|
|
21
|
+
dimension: 'structure',
|
|
22
|
+
description: 'No feature content to prioritize',
|
|
23
|
+
impact: 'low',
|
|
24
|
+
},
|
|
25
|
+
applied: false,
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
// Check if prioritization already exists
|
|
29
|
+
if (this.hasPrioritization(prompt)) {
|
|
30
|
+
return {
|
|
31
|
+
enhancedPrompt: prompt,
|
|
32
|
+
improvement: {
|
|
33
|
+
dimension: 'structure',
|
|
34
|
+
description: 'Requirements already prioritized',
|
|
35
|
+
impact: 'low',
|
|
36
|
+
},
|
|
37
|
+
applied: false,
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
// Add prioritization framework
|
|
41
|
+
const enhanced = this.addPrioritization(prompt);
|
|
42
|
+
return {
|
|
43
|
+
enhancedPrompt: enhanced,
|
|
44
|
+
improvement: {
|
|
45
|
+
dimension: 'structure',
|
|
46
|
+
description: 'Added requirement prioritization (must-have vs nice-to-have)',
|
|
47
|
+
impact: 'high',
|
|
48
|
+
},
|
|
49
|
+
applied: true,
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
hasFeatureContent(prompt) {
|
|
53
|
+
const featureKeywords = [
|
|
54
|
+
'feature',
|
|
55
|
+
'requirement',
|
|
56
|
+
'functionality',
|
|
57
|
+
'capability',
|
|
58
|
+
'should',
|
|
59
|
+
'must',
|
|
60
|
+
'need',
|
|
61
|
+
'want',
|
|
62
|
+
'implement',
|
|
63
|
+
];
|
|
64
|
+
return this.hasSection(prompt, featureKeywords);
|
|
65
|
+
}
|
|
66
|
+
hasPrioritization(prompt) {
|
|
67
|
+
const priorityKeywords = [
|
|
68
|
+
'must-have',
|
|
69
|
+
'must have',
|
|
70
|
+
'nice-to-have',
|
|
71
|
+
'nice to have',
|
|
72
|
+
'p0',
|
|
73
|
+
'p1',
|
|
74
|
+
'p2',
|
|
75
|
+
'priority:',
|
|
76
|
+
'mvp',
|
|
77
|
+
'phase 1',
|
|
78
|
+
'phase 2',
|
|
79
|
+
'critical',
|
|
80
|
+
'optional',
|
|
81
|
+
];
|
|
82
|
+
return this.hasSection(prompt, priorityKeywords);
|
|
83
|
+
}
|
|
84
|
+
addPrioritization(prompt) {
|
|
85
|
+
// Look for feature sections and add prioritization guidance
|
|
86
|
+
const featureSection = this.extractFeatureSection(prompt);
|
|
87
|
+
if (!featureSection) {
|
|
88
|
+
// No clear feature section, add prioritization note
|
|
89
|
+
return (prompt +
|
|
90
|
+
'\n\n### Requirement Priorities\n' +
|
|
91
|
+
'**Must-Have (MVP):**\n- [Core features required for launch]\n\n' +
|
|
92
|
+
'**Nice-to-Have (Post-MVP):**\n- [Features to add after initial release]');
|
|
93
|
+
}
|
|
94
|
+
// Features exist but aren't prioritized - add framework
|
|
95
|
+
const priorityNote = '\n\n> **Priority Framework:** Consider categorizing features as:\n' +
|
|
96
|
+
'> - **Must-Have (P0):** Required for MVP, blocking issues\n' +
|
|
97
|
+
'> - **Should-Have (P1):** Important but not blocking\n' +
|
|
98
|
+
'> - **Nice-to-Have (P2):** Enhancements for future iterations';
|
|
99
|
+
return prompt + priorityNote;
|
|
100
|
+
}
|
|
101
|
+
extractFeatureSection(prompt) {
|
|
102
|
+
// Try to find feature-related sections
|
|
103
|
+
const featurePatterns = [
|
|
104
|
+
/features?:?\s*\n([\s\S]*?)(?=\n##|\n\*\*[A-Z]|$)/i,
|
|
105
|
+
/requirements?:?\s*\n([\s\S]*?)(?=\n##|\n\*\*[A-Z]|$)/i,
|
|
106
|
+
/what we(?:'re| are) building:?\s*\n([\s\S]*?)(?=\n##|\n\*\*[A-Z]|$)/i,
|
|
107
|
+
];
|
|
108
|
+
for (const pattern of featurePatterns) {
|
|
109
|
+
const match = prompt.match(pattern);
|
|
110
|
+
if (match) {
|
|
111
|
+
return match[1];
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
return null;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
//# sourceMappingURL=requirement-prioritizer.js.map
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { BasePattern } from './base-pattern.js';
|
|
2
|
+
import { PromptIntent, OptimizationMode, PatternContext, PatternResult } from '../types.js';
|
|
3
|
+
/**
|
|
4
|
+
* v4.3.2 PRD Pattern: SuccessMetricsEnforcer
|
|
5
|
+
*
|
|
6
|
+
* Ensures measurable success criteria exist in PRD content.
|
|
7
|
+
* Adds KPIs and metrics when missing.
|
|
8
|
+
*/
|
|
9
|
+
export declare class SuccessMetricsEnforcer 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 hasSuccessMetrics;
|
|
18
|
+
private needsMetrics;
|
|
19
|
+
private addSuccessMetrics;
|
|
20
|
+
private inferRelevantMetrics;
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=success-metrics-enforcer.d.ts.map
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import { BasePattern } from './base-pattern.js';
|
|
2
|
+
/**
|
|
3
|
+
* v4.3.2 PRD Pattern: SuccessMetricsEnforcer
|
|
4
|
+
*
|
|
5
|
+
* Ensures measurable success criteria exist in PRD content.
|
|
6
|
+
* Adds KPIs and metrics when missing.
|
|
7
|
+
*/
|
|
8
|
+
export class SuccessMetricsEnforcer extends BasePattern {
|
|
9
|
+
id = 'success-metrics-enforcer';
|
|
10
|
+
name = 'SuccessMetricsEnforcer';
|
|
11
|
+
description = 'Ensures measurable success criteria exist';
|
|
12
|
+
applicableIntents = ['prd-generation', 'planning'];
|
|
13
|
+
mode = 'deep';
|
|
14
|
+
priority = 7;
|
|
15
|
+
apply(prompt, _context) {
|
|
16
|
+
// Check if success metrics already exist
|
|
17
|
+
if (this.hasSuccessMetrics(prompt)) {
|
|
18
|
+
return {
|
|
19
|
+
enhancedPrompt: prompt,
|
|
20
|
+
improvement: {
|
|
21
|
+
dimension: 'completeness',
|
|
22
|
+
description: 'Success metrics already present',
|
|
23
|
+
impact: 'low',
|
|
24
|
+
},
|
|
25
|
+
applied: false,
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
// Check if this is content that needs metrics
|
|
29
|
+
if (!this.needsMetrics(prompt)) {
|
|
30
|
+
return {
|
|
31
|
+
enhancedPrompt: prompt,
|
|
32
|
+
improvement: {
|
|
33
|
+
dimension: 'completeness',
|
|
34
|
+
description: 'Content does not require success metrics',
|
|
35
|
+
impact: 'low',
|
|
36
|
+
},
|
|
37
|
+
applied: false,
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
// Add success metrics section
|
|
41
|
+
const enhanced = this.addSuccessMetrics(prompt);
|
|
42
|
+
return {
|
|
43
|
+
enhancedPrompt: enhanced,
|
|
44
|
+
improvement: {
|
|
45
|
+
dimension: 'completeness',
|
|
46
|
+
description: 'Added measurable success criteria and KPIs',
|
|
47
|
+
impact: 'high',
|
|
48
|
+
},
|
|
49
|
+
applied: true,
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
hasSuccessMetrics(prompt) {
|
|
53
|
+
const metricsKeywords = [
|
|
54
|
+
'success metric',
|
|
55
|
+
'success criteria',
|
|
56
|
+
'kpi',
|
|
57
|
+
'measure success',
|
|
58
|
+
'acceptance criteria',
|
|
59
|
+
'% increase',
|
|
60
|
+
'% decrease',
|
|
61
|
+
'conversion rate',
|
|
62
|
+
'completion rate',
|
|
63
|
+
'response time',
|
|
64
|
+
'latency',
|
|
65
|
+
'uptime',
|
|
66
|
+
'sla',
|
|
67
|
+
'benchmark',
|
|
68
|
+
];
|
|
69
|
+
return this.hasSection(prompt, metricsKeywords);
|
|
70
|
+
}
|
|
71
|
+
needsMetrics(prompt) {
|
|
72
|
+
// PRD-like content that describes features
|
|
73
|
+
const prdKeywords = [
|
|
74
|
+
'feature',
|
|
75
|
+
'build',
|
|
76
|
+
'implement',
|
|
77
|
+
'goal',
|
|
78
|
+
'objective',
|
|
79
|
+
'product',
|
|
80
|
+
'launch',
|
|
81
|
+
'release',
|
|
82
|
+
];
|
|
83
|
+
return this.hasSection(prompt, prdKeywords);
|
|
84
|
+
}
|
|
85
|
+
addSuccessMetrics(prompt) {
|
|
86
|
+
// Detect the type of project to suggest relevant metrics
|
|
87
|
+
const metrics = this.inferRelevantMetrics(prompt);
|
|
88
|
+
const metricsSection = `\n\n### Success Metrics\n` +
|
|
89
|
+
`**Primary KPIs:**\n` +
|
|
90
|
+
metrics.map((m) => `- ${m}`).join('\n') +
|
|
91
|
+
`\n\n**Measurement Approach:**\n` +
|
|
92
|
+
`- Baseline: [Current state before implementation]\n` +
|
|
93
|
+
`- Target: [Specific, measurable goals]\n` +
|
|
94
|
+
`- Timeline: [When to measure success]`;
|
|
95
|
+
return prompt + metricsSection;
|
|
96
|
+
}
|
|
97
|
+
inferRelevantMetrics(prompt) {
|
|
98
|
+
const lowerPrompt = prompt.toLowerCase();
|
|
99
|
+
const metrics = [];
|
|
100
|
+
// Performance-related
|
|
101
|
+
if (lowerPrompt.includes('performance') ||
|
|
102
|
+
lowerPrompt.includes('fast') ||
|
|
103
|
+
lowerPrompt.includes('speed')) {
|
|
104
|
+
metrics.push('Response time < [X]ms (p95)');
|
|
105
|
+
metrics.push('Page load time improvement by [X]%');
|
|
106
|
+
}
|
|
107
|
+
// User engagement
|
|
108
|
+
if (lowerPrompt.includes('user') ||
|
|
109
|
+
lowerPrompt.includes('engagement') ||
|
|
110
|
+
lowerPrompt.includes('retention')) {
|
|
111
|
+
metrics.push('User engagement increase by [X]%');
|
|
112
|
+
metrics.push('Task completion rate > [X]%');
|
|
113
|
+
}
|
|
114
|
+
// Conversion/business
|
|
115
|
+
if (lowerPrompt.includes('conversion') ||
|
|
116
|
+
lowerPrompt.includes('sales') ||
|
|
117
|
+
lowerPrompt.includes('revenue')) {
|
|
118
|
+
metrics.push('Conversion rate improvement by [X]%');
|
|
119
|
+
metrics.push('Revenue impact of $[X]');
|
|
120
|
+
}
|
|
121
|
+
// Technical quality
|
|
122
|
+
if (lowerPrompt.includes('quality') ||
|
|
123
|
+
lowerPrompt.includes('bug') ||
|
|
124
|
+
lowerPrompt.includes('error')) {
|
|
125
|
+
metrics.push('Error rate < [X]%');
|
|
126
|
+
metrics.push('Test coverage > [X]%');
|
|
127
|
+
}
|
|
128
|
+
// API/integration
|
|
129
|
+
if (lowerPrompt.includes('api') || lowerPrompt.includes('integration')) {
|
|
130
|
+
metrics.push('API availability > [X]%');
|
|
131
|
+
metrics.push('Integration success rate > [X]%');
|
|
132
|
+
}
|
|
133
|
+
// Default metrics if none matched
|
|
134
|
+
if (metrics.length === 0) {
|
|
135
|
+
metrics.push('[Define primary success metric]');
|
|
136
|
+
metrics.push('[Define secondary success metric]');
|
|
137
|
+
metrics.push('[Define timeline for measurement]');
|
|
138
|
+
}
|
|
139
|
+
return metrics.slice(0, 4); // Max 4 metrics
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
//# sourceMappingURL=success-metrics-enforcer.js.map
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { BasePattern } from './base-pattern.js';
|
|
2
|
+
import { PromptIntent, OptimizationMode, PatternContext, PatternResult } from '../types.js';
|
|
3
|
+
/**
|
|
4
|
+
* v4.3.2 Conversational Pattern: TopicCoherenceAnalyzer
|
|
5
|
+
*
|
|
6
|
+
* Detects topic shifts and multi-topic conversations.
|
|
7
|
+
* Helps organize scattered discussions into coherent themes.
|
|
8
|
+
*/
|
|
9
|
+
export declare class TopicCoherenceAnalyzer 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 detectTopics;
|
|
18
|
+
private hasTopicOrganization;
|
|
19
|
+
private organizeByTopic;
|
|
20
|
+
private extractTopicContent;
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=topic-coherence-analyzer.d.ts.map
|