clavix 4.12.0 → 5.0.0

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 (151) hide show
  1. package/README.md +69 -61
  2. package/dist/templates/slash-commands/_canonical/archive.md +83 -121
  3. package/dist/templates/slash-commands/_canonical/execute.md +32 -42
  4. package/dist/templates/slash-commands/_canonical/implement.md +32 -44
  5. package/dist/templates/slash-commands/_canonical/improve.md +13 -52
  6. package/dist/templates/slash-commands/_components/agent-protocols/cli-reference.md +84 -180
  7. package/dist/templates/slash-commands/_components/agent-protocols/error-handling.md +2 -2
  8. package/dist/templates/slash-commands/_components/agent-protocols/file-formats.md +41 -59
  9. package/dist/templates/slash-commands/_components/sections/file-saving-protocol.md +20 -27
  10. package/dist/templates/slash-commands/_components/troubleshooting/file-not-saved.md +4 -5
  11. package/package.json +2 -2
  12. package/dist/cli/commands/analyze.d.ts +0 -17
  13. package/dist/cli/commands/analyze.js +0 -133
  14. package/dist/cli/commands/archive.d.ts +0 -36
  15. package/dist/cli/commands/archive.js +0 -266
  16. package/dist/cli/commands/deep.d.ts +0 -17
  17. package/dist/cli/commands/deep.js +0 -170
  18. package/dist/cli/commands/execute.d.ts +0 -15
  19. package/dist/cli/commands/execute.js +0 -168
  20. package/dist/cli/commands/fast.d.ts +0 -18
  21. package/dist/cli/commands/fast.js +0 -219
  22. package/dist/cli/commands/implement.d.ts +0 -24
  23. package/dist/cli/commands/implement.js +0 -289
  24. package/dist/cli/commands/improve.d.ts +0 -32
  25. package/dist/cli/commands/improve.js +0 -250
  26. package/dist/cli/commands/list.d.ts +0 -17
  27. package/dist/cli/commands/list.js +0 -217
  28. package/dist/cli/commands/plan.d.ts +0 -21
  29. package/dist/cli/commands/plan.js +0 -297
  30. package/dist/cli/commands/prd.d.ts +0 -24
  31. package/dist/cli/commands/prd.js +0 -321
  32. package/dist/cli/commands/prompts/clear.d.ts +0 -16
  33. package/dist/cli/commands/prompts/clear.js +0 -222
  34. package/dist/cli/commands/prompts/list.d.ts +0 -8
  35. package/dist/cli/commands/prompts/list.js +0 -88
  36. package/dist/cli/commands/show.d.ts +0 -21
  37. package/dist/cli/commands/show.js +0 -191
  38. package/dist/cli/commands/start.d.ts +0 -40
  39. package/dist/cli/commands/start.js +0 -210
  40. package/dist/cli/commands/summarize.d.ts +0 -17
  41. package/dist/cli/commands/summarize.js +0 -196
  42. package/dist/cli/commands/task-complete.d.ts +0 -27
  43. package/dist/cli/commands/task-complete.js +0 -269
  44. package/dist/cli/commands/verify.d.ts +0 -28
  45. package/dist/cli/commands/verify.js +0 -349
  46. package/dist/core/archive-manager.d.ts +0 -100
  47. package/dist/core/archive-manager.js +0 -302
  48. package/dist/core/basic-checklist-generator.d.ts +0 -35
  49. package/dist/core/basic-checklist-generator.js +0 -344
  50. package/dist/core/checklist-parser.d.ts +0 -48
  51. package/dist/core/checklist-parser.js +0 -238
  52. package/dist/core/config-manager.d.ts +0 -149
  53. package/dist/core/config-manager.js +0 -230
  54. package/dist/core/conversation-analyzer.d.ts +0 -86
  55. package/dist/core/conversation-analyzer.js +0 -387
  56. package/dist/core/conversation-quality-tracker.d.ts +0 -81
  57. package/dist/core/conversation-quality-tracker.js +0 -195
  58. package/dist/core/git-manager.d.ts +0 -126
  59. package/dist/core/git-manager.js +0 -282
  60. package/dist/core/intelligence/confidence-calculator.d.ts +0 -93
  61. package/dist/core/intelligence/confidence-calculator.js +0 -124
  62. package/dist/core/intelligence/index.d.ts +0 -11
  63. package/dist/core/intelligence/index.js +0 -15
  64. package/dist/core/intelligence/intent-detector.d.ts +0 -54
  65. package/dist/core/intelligence/intent-detector.js +0 -723
  66. package/dist/core/intelligence/pattern-library.d.ts +0 -104
  67. package/dist/core/intelligence/pattern-library.js +0 -330
  68. package/dist/core/intelligence/patterns/actionability-enhancer.d.ts +0 -27
  69. package/dist/core/intelligence/patterns/actionability-enhancer.js +0 -192
  70. package/dist/core/intelligence/patterns/alternative-phrasing-generator.d.ts +0 -29
  71. package/dist/core/intelligence/patterns/alternative-phrasing-generator.js +0 -239
  72. package/dist/core/intelligence/patterns/ambiguity-detector.d.ts +0 -22
  73. package/dist/core/intelligence/patterns/ambiguity-detector.js +0 -196
  74. package/dist/core/intelligence/patterns/assumption-explicitizer.d.ts +0 -30
  75. package/dist/core/intelligence/patterns/assumption-explicitizer.js +0 -296
  76. package/dist/core/intelligence/patterns/base-pattern.d.ts +0 -192
  77. package/dist/core/intelligence/patterns/base-pattern.js +0 -103
  78. package/dist/core/intelligence/patterns/completeness-validator.d.ts +0 -27
  79. package/dist/core/intelligence/patterns/completeness-validator.js +0 -221
  80. package/dist/core/intelligence/patterns/conciseness-filter.d.ts +0 -20
  81. package/dist/core/intelligence/patterns/conciseness-filter.js +0 -92
  82. package/dist/core/intelligence/patterns/context-precision.d.ts +0 -32
  83. package/dist/core/intelligence/patterns/context-precision.js +0 -389
  84. package/dist/core/intelligence/patterns/conversation-summarizer.d.ts +0 -30
  85. package/dist/core/intelligence/patterns/conversation-summarizer.js +0 -277
  86. package/dist/core/intelligence/patterns/dependency-identifier.d.ts +0 -23
  87. package/dist/core/intelligence/patterns/dependency-identifier.js +0 -166
  88. package/dist/core/intelligence/patterns/domain-context-enricher.d.ts +0 -21
  89. package/dist/core/intelligence/patterns/domain-context-enricher.js +0 -198
  90. package/dist/core/intelligence/patterns/edge-case-identifier.d.ts +0 -30
  91. package/dist/core/intelligence/patterns/edge-case-identifier.js +0 -269
  92. package/dist/core/intelligence/patterns/error-tolerance-enhancer.d.ts +0 -22
  93. package/dist/core/intelligence/patterns/error-tolerance-enhancer.js +0 -179
  94. package/dist/core/intelligence/patterns/implicit-requirement-extractor.d.ts +0 -24
  95. package/dist/core/intelligence/patterns/implicit-requirement-extractor.js +0 -259
  96. package/dist/core/intelligence/patterns/objective-clarifier.d.ts +0 -22
  97. package/dist/core/intelligence/patterns/objective-clarifier.js +0 -126
  98. package/dist/core/intelligence/patterns/output-format-enforcer.d.ts +0 -22
  99. package/dist/core/intelligence/patterns/output-format-enforcer.js +0 -151
  100. package/dist/core/intelligence/patterns/prd-structure-enforcer.d.ts +0 -23
  101. package/dist/core/intelligence/patterns/prd-structure-enforcer.js +0 -183
  102. package/dist/core/intelligence/patterns/prerequisite-identifier.d.ts +0 -23
  103. package/dist/core/intelligence/patterns/prerequisite-identifier.js +0 -221
  104. package/dist/core/intelligence/patterns/requirement-prioritizer.d.ts +0 -24
  105. package/dist/core/intelligence/patterns/requirement-prioritizer.js +0 -134
  106. package/dist/core/intelligence/patterns/scope-definer.d.ts +0 -26
  107. package/dist/core/intelligence/patterns/scope-definer.js +0 -236
  108. package/dist/core/intelligence/patterns/step-decomposer.d.ts +0 -31
  109. package/dist/core/intelligence/patterns/step-decomposer.js +0 -242
  110. package/dist/core/intelligence/patterns/structure-organizer.d.ts +0 -31
  111. package/dist/core/intelligence/patterns/structure-organizer.js +0 -218
  112. package/dist/core/intelligence/patterns/success-criteria-enforcer.d.ts +0 -22
  113. package/dist/core/intelligence/patterns/success-criteria-enforcer.js +0 -165
  114. package/dist/core/intelligence/patterns/success-metrics-enforcer.d.ts +0 -24
  115. package/dist/core/intelligence/patterns/success-metrics-enforcer.js +0 -165
  116. package/dist/core/intelligence/patterns/technical-context-enricher.d.ts +0 -25
  117. package/dist/core/intelligence/patterns/technical-context-enricher.js +0 -165
  118. package/dist/core/intelligence/patterns/topic-coherence-analyzer.d.ts +0 -26
  119. package/dist/core/intelligence/patterns/topic-coherence-analyzer.js +0 -300
  120. package/dist/core/intelligence/patterns/user-persona-enricher.d.ts +0 -24
  121. package/dist/core/intelligence/patterns/user-persona-enricher.js +0 -141
  122. package/dist/core/intelligence/patterns/validation-checklist-creator.d.ts +0 -31
  123. package/dist/core/intelligence/patterns/validation-checklist-creator.js +0 -242
  124. package/dist/core/intelligence/quality-assessor.d.ts +0 -71
  125. package/dist/core/intelligence/quality-assessor.js +0 -525
  126. package/dist/core/intelligence/types.d.ts +0 -111
  127. package/dist/core/intelligence/types.js +0 -3
  128. package/dist/core/intelligence/universal-optimizer.d.ts +0 -91
  129. package/dist/core/intelligence/universal-optimizer.js +0 -399
  130. package/dist/core/prd-generator.d.ts +0 -76
  131. package/dist/core/prd-generator.js +0 -173
  132. package/dist/core/prompt-manager.d.ts +0 -110
  133. package/dist/core/prompt-manager.js +0 -274
  134. package/dist/core/prompt-optimizer.d.ts +0 -268
  135. package/dist/core/prompt-optimizer.js +0 -959
  136. package/dist/core/question-engine.d.ts +0 -167
  137. package/dist/core/question-engine.js +0 -356
  138. package/dist/core/session-manager.d.ts +0 -139
  139. package/dist/core/session-manager.js +0 -365
  140. package/dist/core/task-manager.d.ts +0 -211
  141. package/dist/core/task-manager.js +0 -981
  142. package/dist/core/verification-hooks.d.ts +0 -67
  143. package/dist/core/verification-hooks.js +0 -309
  144. package/dist/core/verification-manager.d.ts +0 -107
  145. package/dist/core/verification-manager.js +0 -415
  146. package/dist/index 2.js +0 -13
  147. package/dist/index.d 2.ts +0 -4
  148. package/dist/types/session.d.ts +0 -78
  149. package/dist/types/session.js +0 -8
  150. package/dist/types/verification.d.ts +0 -205
  151. package/dist/types/verification.js +0 -9
@@ -1,165 +0,0 @@
1
- import { BasePattern, } from './base-pattern.js';
2
- /**
3
- * v4.5 Pattern: Technical Context Enricher
4
- *
5
- * Adds missing technical context (language, framework, versions).
6
- * Detects technologies and suggests version specifications.
7
- */
8
- export class TechnicalContextEnricher extends BasePattern {
9
- // -------------------------------------------------------------------------
10
- // Pattern Metadata (v4.5 unified types)
11
- // -------------------------------------------------------------------------
12
- id = 'technical-context-enricher';
13
- name = 'Technical Context Enricher';
14
- description = 'Adds missing technical context (language, framework, versions)';
15
- applicableIntents = ['code-generation', 'refinement', 'debugging'];
16
- scope = 'both';
17
- priority = 5; // MEDIUM-LOW - supplementary context
18
- phases = ['all'];
19
- // v4.5: Dependencies
20
- dependencies = {
21
- runAfter: ['objective-clarifier'], // Clarify objective first, then add technical context
22
- enhancedBy: ['domain-context-enricher'],
23
- };
24
- // -------------------------------------------------------------------------
25
- // Configuration Schema (v4.5)
26
- // -------------------------------------------------------------------------
27
- static configSchema = {
28
- detectFrameworks: {
29
- type: 'boolean',
30
- default: true,
31
- description: 'Detect and add framework information',
32
- },
33
- suggestVersions: {
34
- type: 'boolean',
35
- default: true,
36
- description: 'Suggest adding version information when missing',
37
- },
38
- };
39
- // -------------------------------------------------------------------------
40
- // Pattern Application
41
- // -------------------------------------------------------------------------
42
- apply(prompt, context) {
43
- const lowerPrompt = prompt.toLowerCase();
44
- const enhancements = [];
45
- // Check if technical context is already present
46
- if (this.hasTechnicalContext(prompt)) {
47
- return {
48
- enhancedPrompt: prompt,
49
- improvement: {
50
- dimension: 'completeness',
51
- description: 'Technical context already specified',
52
- impact: 'low',
53
- },
54
- applied: false,
55
- };
56
- }
57
- // Detect language mentions without versions
58
- const detectedLanguage = this.detectLanguage(lowerPrompt);
59
- if (detectedLanguage && !this.hasVersionInfo(prompt)) {
60
- enhancements.push(`Language: ${detectedLanguage} (please specify version if critical)`);
61
- }
62
- // Suggest adding framework if code generation
63
- if (context.intent.primaryIntent === 'code-generation') {
64
- const framework = this.detectFramework(lowerPrompt);
65
- if (framework) {
66
- enhancements.push(`Framework: ${framework}`);
67
- }
68
- }
69
- // No enhancements needed
70
- if (enhancements.length === 0) {
71
- return {
72
- enhancedPrompt: prompt,
73
- improvement: {
74
- dimension: 'completeness',
75
- description: 'No additional technical context needed',
76
- impact: 'low',
77
- },
78
- applied: false,
79
- };
80
- }
81
- // Add technical context section
82
- const contextSection = `\n\n# Technical Constraints\n${enhancements.map((e) => `- ${e}`).join('\n')}`;
83
- const enhanced = prompt + contextSection;
84
- return {
85
- enhancedPrompt: enhanced,
86
- improvement: {
87
- dimension: 'completeness',
88
- description: `Added ${enhancements.length} technical context specifications`,
89
- impact: 'medium',
90
- },
91
- applied: true,
92
- };
93
- }
94
- hasTechnicalContext(prompt) {
95
- const contextMarkers = [
96
- /version|v\d+\.\d+/i,
97
- /technical (context|constraints|requirements)/i,
98
- /language:.*framework:/i,
99
- /using (python|javascript|typescript|java|rust|go) \d/i,
100
- ];
101
- return contextMarkers.some((marker) => marker.test(prompt));
102
- }
103
- detectLanguage(prompt) {
104
- const languages = {
105
- python: 'Python',
106
- javascript: 'JavaScript',
107
- typescript: 'TypeScript',
108
- java: 'Java',
109
- rust: 'Rust',
110
- go: 'Go',
111
- php: 'PHP',
112
- ruby: 'Ruby',
113
- swift: 'Swift',
114
- kotlin: 'Kotlin',
115
- 'c++': 'C++',
116
- csharp: 'C#',
117
- 'c#': 'C#',
118
- };
119
- for (const [key, name] of Object.entries(languages)) {
120
- if (prompt.includes(key)) {
121
- return name;
122
- }
123
- }
124
- // Check for common patterns
125
- if (prompt.includes('react') || prompt.includes('vue') || prompt.includes('angular')) {
126
- return 'JavaScript/TypeScript';
127
- }
128
- if (prompt.includes('django') || prompt.includes('flask')) {
129
- return 'Python';
130
- }
131
- if (prompt.includes('spring') || prompt.includes('hibernate')) {
132
- return 'Java';
133
- }
134
- return null;
135
- }
136
- detectFramework(prompt) {
137
- const frameworks = {
138
- react: 'React',
139
- vue: 'Vue.js',
140
- angular: 'Angular',
141
- svelte: 'Svelte',
142
- next: 'Next.js',
143
- nextjs: 'Next.js',
144
- nuxt: 'Nuxt.js',
145
- django: 'Django',
146
- flask: 'Flask',
147
- fastapi: 'FastAPI',
148
- express: 'Express.js',
149
- nestjs: 'NestJS',
150
- spring: 'Spring Boot',
151
- rails: 'Ruby on Rails',
152
- laravel: 'Laravel',
153
- };
154
- for (const [key, name] of Object.entries(frameworks)) {
155
- if (prompt.includes(key)) {
156
- return name;
157
- }
158
- }
159
- return null;
160
- }
161
- hasVersionInfo(prompt) {
162
- return /\d+\.\d+/.test(prompt) || /v\d+/.test(prompt);
163
- }
164
- }
165
- //# sourceMappingURL=technical-context-enricher.js.map
@@ -1,26 +0,0 @@
1
- import { BasePattern, PatternScope, PatternPriority, PatternPhase, PatternConfigSchema } from './base-pattern.js';
2
- import { PromptIntent, PatternContext, PatternResult } from '../types.js';
3
- /**
4
- * v4.5 Pattern: Topic Coherence Analyzer
5
- *
6
- * Detects topic shifts and multi-topic conversations.
7
- * Helps organize scattered discussions into coherent themes.
8
- * Enhanced with expanded topic dictionary and better detection.
9
- */
10
- export declare class TopicCoherenceAnalyzer extends BasePattern {
11
- readonly id = "topic-coherence-analyzer";
12
- readonly name = "Topic Coherence Analyzer";
13
- readonly description = "Detects topic shifts and multi-topic conversations";
14
- readonly applicableIntents: PromptIntent[];
15
- readonly scope: PatternScope;
16
- readonly priority: PatternPriority;
17
- readonly phases: PatternPhase[];
18
- static readonly configSchema: PatternConfigSchema;
19
- private readonly topicIndicators;
20
- apply(prompt: string, _context: PatternContext): PatternResult;
21
- private detectTopics;
22
- private hasTopicOrganization;
23
- private organizeByTopic;
24
- private extractTopicContent;
25
- }
26
- //# sourceMappingURL=topic-coherence-analyzer.d.ts.map
@@ -1,300 +0,0 @@
1
- import { BasePattern, } from './base-pattern.js';
2
- /**
3
- * v4.5 Pattern: Topic Coherence Analyzer
4
- *
5
- * Detects topic shifts and multi-topic conversations.
6
- * Helps organize scattered discussions into coherent themes.
7
- * Enhanced with expanded topic dictionary and better detection.
8
- */
9
- export class TopicCoherenceAnalyzer extends BasePattern {
10
- // -------------------------------------------------------------------------
11
- // Pattern Metadata (v4.5 unified types)
12
- // -------------------------------------------------------------------------
13
- id = 'topic-coherence-analyzer';
14
- name = 'Topic Coherence Analyzer';
15
- description = 'Detects topic shifts and multi-topic conversations';
16
- applicableIntents = ['summarization', 'planning'];
17
- scope = 'comprehensive';
18
- priority = 6; // MEDIUM - standard enhancement
19
- phases = ['conversation-tracking', 'summarization'];
20
- // -------------------------------------------------------------------------
21
- // Configuration Schema (v4.5)
22
- // -------------------------------------------------------------------------
23
- static configSchema = {
24
- minTopicsForOrganization: {
25
- type: 'number',
26
- default: 2,
27
- description: 'Minimum number of topics before organizing',
28
- validation: { min: 2, max: 5 },
29
- },
30
- };
31
- // -------------------------------------------------------------------------
32
- // Pattern Data
33
- // -------------------------------------------------------------------------
34
- // Expanded topic indicators (~15 topics with more keywords)
35
- topicIndicators = {
36
- 'User Interface': [
37
- 'ui',
38
- 'interface',
39
- 'design',
40
- 'layout',
41
- 'button',
42
- 'form',
43
- 'page',
44
- 'screen',
45
- 'component',
46
- 'modal',
47
- 'dialog',
48
- 'navigation',
49
- 'menu',
50
- 'sidebar',
51
- 'header',
52
- 'footer',
53
- ],
54
- 'Backend/API': [
55
- 'api',
56
- 'backend',
57
- 'server',
58
- 'endpoint',
59
- 'route',
60
- 'controller',
61
- 'service',
62
- 'middleware',
63
- 'rest',
64
- 'graphql',
65
- 'websocket',
66
- ],
67
- Database: [
68
- 'database',
69
- 'db',
70
- 'schema',
71
- 'table',
72
- 'query',
73
- 'migration',
74
- 'model',
75
- 'orm',
76
- 'sql',
77
- 'nosql',
78
- 'index',
79
- 'relationship',
80
- ],
81
- Authentication: [
82
- 'auth',
83
- 'login',
84
- 'password',
85
- 'session',
86
- 'token',
87
- 'permission',
88
- 'role',
89
- 'oauth',
90
- 'jwt',
91
- 'sso',
92
- 'mfa',
93
- '2fa',
94
- ],
95
- Performance: [
96
- 'performance',
97
- 'speed',
98
- 'cache',
99
- 'optimize',
100
- 'latency',
101
- 'load time',
102
- 'bundle',
103
- 'lazy',
104
- 'memory',
105
- 'cpu',
106
- ],
107
- Testing: [
108
- 'test',
109
- 'spec',
110
- 'coverage',
111
- 'qa',
112
- 'validation',
113
- 'unit test',
114
- 'integration',
115
- 'e2e',
116
- 'mock',
117
- 'fixture',
118
- ],
119
- Deployment: [
120
- 'deploy',
121
- 'ci/cd',
122
- 'pipeline',
123
- 'release',
124
- 'environment',
125
- 'production',
126
- 'staging',
127
- 'docker',
128
- 'kubernetes',
129
- ],
130
- 'User Experience': [
131
- 'ux',
132
- 'usability',
133
- 'accessibility',
134
- 'user flow',
135
- 'journey',
136
- 'experience',
137
- 'onboarding',
138
- 'feedback',
139
- ],
140
- 'Business Logic': [
141
- 'business',
142
- 'workflow',
143
- 'process',
144
- 'rule',
145
- 'logic',
146
- 'requirement',
147
- 'feature',
148
- 'use case',
149
- ],
150
- Integration: [
151
- 'integration',
152
- 'third-party',
153
- 'external',
154
- 'webhook',
155
- 'sync',
156
- 'connect',
157
- 'import',
158
- 'export',
159
- ],
160
- Security: [
161
- 'security',
162
- 'encryption',
163
- 'vulnerability',
164
- 'xss',
165
- 'csrf',
166
- 'injection',
167
- 'sanitize',
168
- 'audit',
169
- ],
170
- Analytics: [
171
- 'analytics',
172
- 'tracking',
173
- 'metrics',
174
- 'dashboard',
175
- 'report',
176
- 'insight',
177
- 'data',
178
- 'statistics',
179
- ],
180
- 'Error Handling': [
181
- 'error',
182
- 'exception',
183
- 'fallback',
184
- 'retry',
185
- 'timeout',
186
- 'failure',
187
- 'recovery',
188
- 'logging',
189
- ],
190
- Documentation: [
191
- 'documentation',
192
- 'docs',
193
- 'readme',
194
- 'guide',
195
- 'tutorial',
196
- 'api docs',
197
- 'comment',
198
- 'jsdoc',
199
- ],
200
- 'State Management': [
201
- 'state',
202
- 'store',
203
- 'redux',
204
- 'context',
205
- 'global state',
206
- 'local state',
207
- 'persist',
208
- 'hydrate',
209
- ],
210
- };
211
- apply(prompt, _context) {
212
- // Detect topics in the content
213
- const topics = this.detectTopics(prompt);
214
- // If single topic or already organized, skip
215
- if (topics.length <= 1) {
216
- return {
217
- enhancedPrompt: prompt,
218
- improvement: {
219
- dimension: 'structure',
220
- description: 'Single coherent topic detected',
221
- impact: 'low',
222
- },
223
- applied: false,
224
- };
225
- }
226
- // Check if already has topic organization
227
- if (this.hasTopicOrganization(prompt)) {
228
- return {
229
- enhancedPrompt: prompt,
230
- improvement: {
231
- dimension: 'structure',
232
- description: 'Topics already organized',
233
- impact: 'low',
234
- },
235
- applied: false,
236
- };
237
- }
238
- // Add topic organization
239
- const enhanced = this.organizeByTopic(prompt, topics);
240
- return {
241
- enhancedPrompt: enhanced,
242
- improvement: {
243
- dimension: 'structure',
244
- description: `Organized ${topics.length} distinct topics for clarity`,
245
- impact: 'medium',
246
- },
247
- applied: true,
248
- };
249
- }
250
- detectTopics(prompt) {
251
- const topics = [];
252
- const lowerPrompt = prompt.toLowerCase();
253
- for (const [topic, keywords] of Object.entries(this.topicIndicators)) {
254
- const hasKeyword = keywords.some((kw) => lowerPrompt.includes(kw));
255
- if (hasKeyword) {
256
- topics.push(topic);
257
- }
258
- }
259
- return topics;
260
- }
261
- hasTopicOrganization(prompt) {
262
- // Check for existing topic headers
263
- const topicHeaders = /##\s*(user interface|backend|database|auth|performance|testing|deploy)/i;
264
- return topicHeaders.test(prompt);
265
- }
266
- organizeByTopic(prompt, topics) {
267
- // Add topic summary at the beginning
268
- let organized = '### Topics Covered\n';
269
- organized += 'This conversation touches on multiple areas:\n';
270
- organized += topics.map((t, i) => `${i + 1}. **${t}**`).join('\n');
271
- organized += '\n\n---\n\n';
272
- // Extract content relevant to each topic
273
- organized += '### Discussion by Topic\n\n';
274
- for (const topic of topics) {
275
- const relevantContent = this.extractTopicContent(prompt, topic);
276
- if (relevantContent) {
277
- organized += `#### ${topic}\n`;
278
- organized += relevantContent + '\n\n';
279
- }
280
- }
281
- organized += '---\n\n**Full Context:**\n' + prompt;
282
- return organized;
283
- }
284
- extractTopicContent(prompt, topic) {
285
- const keywords = this.topicIndicators[topic] || [];
286
- const sentences = this.extractSentences(prompt);
287
- const relevantSentences = sentences.filter((sentence) => {
288
- const lower = sentence.toLowerCase();
289
- return keywords.some((kw) => lower.includes(kw));
290
- });
291
- if (relevantSentences.length === 0) {
292
- return `- Discussion related to ${topic}`;
293
- }
294
- return relevantSentences
295
- .slice(0, 3)
296
- .map((s) => `- ${s.trim()}`)
297
- .join('\n');
298
- }
299
- }
300
- //# sourceMappingURL=topic-coherence-analyzer.js.map
@@ -1,24 +0,0 @@
1
- import { BasePattern, PatternScope, PatternPriority, PatternPhase, PatternConfigSchema } from './base-pattern.js';
2
- import { PromptIntent, PatternContext, PatternResult } from '../types.js';
3
- /**
4
- * v4.5 Pattern: User Persona Enricher
5
- *
6
- * Adds missing user context and personas to PRD content.
7
- * Ensures the "who" is clearly defined alongside the "what".
8
- */
9
- export declare class UserPersonaEnricher extends BasePattern {
10
- readonly id = "user-persona-enricher";
11
- readonly name = "User Persona Enricher";
12
- readonly description = "Adds missing user context and personas";
13
- readonly applicableIntents: PromptIntent[];
14
- readonly scope: PatternScope;
15
- readonly priority: PatternPriority;
16
- readonly phases: PatternPhase[];
17
- static readonly configSchema: PatternConfigSchema;
18
- apply(prompt: string, _context: PatternContext): PatternResult;
19
- private hasUserContext;
20
- private needsUserContext;
21
- private addUserPersona;
22
- private inferUserType;
23
- }
24
- //# sourceMappingURL=user-persona-enricher.d.ts.map
@@ -1,141 +0,0 @@
1
- import { BasePattern, } from './base-pattern.js';
2
- /**
3
- * v4.5 Pattern: User Persona Enricher
4
- *
5
- * Adds missing user context and personas to PRD content.
6
- * Ensures the "who" is clearly defined alongside the "what".
7
- */
8
- export class UserPersonaEnricher extends BasePattern {
9
- // -------------------------------------------------------------------------
10
- // Pattern Metadata (v4.5 unified types)
11
- // -------------------------------------------------------------------------
12
- id = 'user-persona-enricher';
13
- name = 'User Persona Enricher';
14
- description = 'Adds missing user context and personas';
15
- applicableIntents = ['prd-generation', 'planning'];
16
- scope = 'comprehensive';
17
- priority = 6; // MEDIUM - standard enhancement
18
- phases = ['question-validation', 'output-generation'];
19
- // -------------------------------------------------------------------------
20
- // Configuration Schema (v4.5)
21
- // -------------------------------------------------------------------------
22
- static configSchema = {
23
- inferUserType: {
24
- type: 'boolean',
25
- default: true,
26
- description: 'Attempt to infer user type from content',
27
- },
28
- };
29
- // -------------------------------------------------------------------------
30
- // Pattern Application
31
- // -------------------------------------------------------------------------
32
- apply(prompt, _context) {
33
- // Check if user/persona context already exists
34
- if (this.hasUserContext(prompt)) {
35
- return {
36
- enhancedPrompt: prompt,
37
- improvement: {
38
- dimension: 'completeness',
39
- description: 'User context already present',
40
- impact: 'low',
41
- },
42
- applied: false,
43
- };
44
- }
45
- // Check if this is PRD-like content that needs users
46
- if (!this.needsUserContext(prompt)) {
47
- return {
48
- enhancedPrompt: prompt,
49
- improvement: {
50
- dimension: 'completeness',
51
- description: 'Content does not require user persona',
52
- impact: 'low',
53
- },
54
- applied: false,
55
- };
56
- }
57
- // Add user persona section
58
- const enhanced = this.addUserPersona(prompt);
59
- return {
60
- enhancedPrompt: enhanced,
61
- improvement: {
62
- dimension: 'completeness',
63
- description: 'Added user persona context (who will use this)',
64
- impact: 'medium',
65
- },
66
- applied: true,
67
- };
68
- }
69
- hasUserContext(prompt) {
70
- const userKeywords = [
71
- 'user persona',
72
- 'target user',
73
- 'end user',
74
- 'user profile',
75
- 'audience',
76
- 'stakeholder',
77
- 'as a user',
78
- 'users can',
79
- 'users will',
80
- 'for users',
81
- 'customer',
82
- 'developer',
83
- 'admin',
84
- 'target audience',
85
- ];
86
- return this.hasSection(prompt, userKeywords);
87
- }
88
- needsUserContext(prompt) {
89
- // PRD-like content that talks about features but not users
90
- const featureKeywords = [
91
- 'feature',
92
- 'build',
93
- 'create',
94
- 'implement',
95
- 'functionality',
96
- 'should',
97
- 'must',
98
- 'requirement',
99
- ];
100
- return this.hasSection(prompt, featureKeywords);
101
- }
102
- addUserPersona(prompt) {
103
- // Detect the likely user type from content
104
- const userType = this.inferUserType(prompt);
105
- const personaSection = `\n\n### Target Users\n` +
106
- `**Primary User:** ${userType}\n` +
107
- `- Goals: [What they want to achieve]\n` +
108
- `- Pain Points: [Current frustrations]\n` +
109
- `- Context: [When and how they'll use this]`;
110
- return prompt + personaSection;
111
- }
112
- inferUserType(prompt) {
113
- const lowerPrompt = prompt.toLowerCase();
114
- // Try to infer user type from content
115
- if (lowerPrompt.includes('api') ||
116
- lowerPrompt.includes('sdk') ||
117
- lowerPrompt.includes('library')) {
118
- return 'Developers integrating with the system';
119
- }
120
- if (lowerPrompt.includes('admin') ||
121
- lowerPrompt.includes('manage') ||
122
- lowerPrompt.includes('dashboard')) {
123
- return 'Administrators managing the system';
124
- }
125
- if (lowerPrompt.includes('e-commerce') ||
126
- lowerPrompt.includes('shop') ||
127
- lowerPrompt.includes('buy')) {
128
- return 'Customers making purchases';
129
- }
130
- if (lowerPrompt.includes('content') ||
131
- lowerPrompt.includes('blog') ||
132
- lowerPrompt.includes('cms')) {
133
- return 'Content creators and editors';
134
- }
135
- if (lowerPrompt.includes('mobile') || lowerPrompt.includes('app')) {
136
- return 'Mobile app users';
137
- }
138
- return '[Define primary user type]';
139
- }
140
- }
141
- //# sourceMappingURL=user-persona-enricher.js.map
@@ -1,31 +0,0 @@
1
- import { BasePattern, PatternScope, PatternPriority, PatternPhase, PatternConfigSchema, PatternDependency } from './base-pattern.js';
2
- import { PromptIntent, PatternContext, PatternResult } from '../types.js';
3
- /**
4
- * v4.5 Pattern: Validation Checklist Creator
5
- *
6
- * Creates implementation validation checklists to ensure
7
- * comprehensive verification of completed work.
8
- */
9
- export declare class ValidationChecklistCreator extends BasePattern {
10
- readonly id = "validation-checklist-creator";
11
- readonly name = "Validation Checklist Creator";
12
- readonly description = "Create implementation validation checklist for verification";
13
- readonly applicableIntents: PromptIntent[];
14
- readonly scope: PatternScope;
15
- readonly priority: PatternPriority;
16
- readonly phases: PatternPhase[];
17
- readonly dependencies: PatternDependency;
18
- static readonly configSchema: PatternConfigSchema;
19
- apply(prompt: string, context: PatternContext): PatternResult;
20
- private createChecklist;
21
- private getCodeGenerationChecklist;
22
- private getTestingChecklist;
23
- private getMigrationChecklist;
24
- private getSecurityChecklist;
25
- private getDebuggingChecklist;
26
- private getDomainChecklist;
27
- private getGeneralChecklist;
28
- private formatChecklistSection;
29
- private formatCategory;
30
- }
31
- //# sourceMappingURL=validation-checklist-creator.d.ts.map