clavix 4.11.2 → 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 (162) hide show
  1. package/README.md +72 -60
  2. package/dist/cli/commands/update.js +9 -10
  3. package/dist/templates/agents/agents.md +14 -8
  4. package/dist/templates/agents/copilot-instructions.md +1 -1
  5. package/dist/templates/instructions/core/verification.md +2 -2
  6. package/dist/templates/slash-commands/_canonical/archive.md +83 -121
  7. package/dist/templates/slash-commands/_canonical/execute.md +32 -42
  8. package/dist/templates/slash-commands/_canonical/implement.md +32 -44
  9. package/dist/templates/slash-commands/_canonical/improve.md +14 -53
  10. package/dist/templates/slash-commands/_canonical/start.md +1 -1
  11. package/dist/templates/slash-commands/_canonical/summarize.md +8 -8
  12. package/dist/templates/slash-commands/_components/agent-protocols/cli-reference.md +84 -180
  13. package/dist/templates/slash-commands/_components/agent-protocols/error-handling.md +2 -2
  14. package/dist/templates/slash-commands/_components/agent-protocols/file-formats.md +41 -59
  15. package/dist/templates/slash-commands/_components/agent-protocols/state-assertion.md +1 -1
  16. package/dist/templates/slash-commands/_components/references/intent-types.md +1 -1
  17. package/dist/templates/slash-commands/_components/sections/file-saving-protocol.md +20 -27
  18. package/dist/templates/slash-commands/_components/sections/pattern-visibility.md +29 -46
  19. package/dist/templates/slash-commands/_components/troubleshooting/file-not-saved.md +4 -5
  20. package/dist/types/config.d.ts +57 -0
  21. package/dist/utils/legacy-command-cleanup.js +31 -4
  22. package/package.json +5 -4
  23. package/dist/cli/commands/analyze.d.ts +0 -17
  24. package/dist/cli/commands/analyze.js +0 -133
  25. package/dist/cli/commands/archive.d.ts +0 -36
  26. package/dist/cli/commands/archive.js +0 -266
  27. package/dist/cli/commands/deep.d.ts +0 -17
  28. package/dist/cli/commands/deep.js +0 -170
  29. package/dist/cli/commands/execute.d.ts +0 -15
  30. package/dist/cli/commands/execute.js +0 -168
  31. package/dist/cli/commands/fast.d.ts +0 -18
  32. package/dist/cli/commands/fast.js +0 -219
  33. package/dist/cli/commands/implement.d.ts +0 -24
  34. package/dist/cli/commands/implement.js +0 -289
  35. package/dist/cli/commands/improve.d.ts +0 -32
  36. package/dist/cli/commands/improve.js +0 -250
  37. package/dist/cli/commands/list.d.ts +0 -17
  38. package/dist/cli/commands/list.js +0 -217
  39. package/dist/cli/commands/plan.d.ts +0 -21
  40. package/dist/cli/commands/plan.js +0 -297
  41. package/dist/cli/commands/prd.d.ts +0 -24
  42. package/dist/cli/commands/prd.js +0 -321
  43. package/dist/cli/commands/prompts/clear.d.ts +0 -16
  44. package/dist/cli/commands/prompts/clear.js +0 -222
  45. package/dist/cli/commands/prompts/list.d.ts +0 -8
  46. package/dist/cli/commands/prompts/list.js +0 -88
  47. package/dist/cli/commands/show.d.ts +0 -21
  48. package/dist/cli/commands/show.js +0 -191
  49. package/dist/cli/commands/start.d.ts +0 -40
  50. package/dist/cli/commands/start.js +0 -210
  51. package/dist/cli/commands/summarize.d.ts +0 -17
  52. package/dist/cli/commands/summarize.js +0 -196
  53. package/dist/cli/commands/task-complete.d.ts +0 -27
  54. package/dist/cli/commands/task-complete.js +0 -269
  55. package/dist/cli/commands/verify.d.ts +0 -28
  56. package/dist/cli/commands/verify.js +0 -349
  57. package/dist/core/archive-manager.d.ts +0 -100
  58. package/dist/core/archive-manager.js +0 -302
  59. package/dist/core/basic-checklist-generator.d.ts +0 -35
  60. package/dist/core/basic-checklist-generator.js +0 -344
  61. package/dist/core/checklist-parser.d.ts +0 -48
  62. package/dist/core/checklist-parser.js +0 -238
  63. package/dist/core/config-manager.d.ts +0 -149
  64. package/dist/core/config-manager.js +0 -230
  65. package/dist/core/conversation-analyzer.d.ts +0 -86
  66. package/dist/core/conversation-analyzer.js +0 -387
  67. package/dist/core/conversation-quality-tracker.d.ts +0 -81
  68. package/dist/core/conversation-quality-tracker.js +0 -195
  69. package/dist/core/git-manager.d.ts +0 -126
  70. package/dist/core/git-manager.js +0 -282
  71. package/dist/core/intelligence/confidence-calculator.d.ts +0 -93
  72. package/dist/core/intelligence/confidence-calculator.js +0 -124
  73. package/dist/core/intelligence/index.d.ts +0 -11
  74. package/dist/core/intelligence/index.js +0 -15
  75. package/dist/core/intelligence/intent-detector.d.ts +0 -54
  76. package/dist/core/intelligence/intent-detector.js +0 -723
  77. package/dist/core/intelligence/pattern-library.d.ts +0 -104
  78. package/dist/core/intelligence/pattern-library.js +0 -339
  79. package/dist/core/intelligence/patterns/actionability-enhancer.d.ts +0 -27
  80. package/dist/core/intelligence/patterns/actionability-enhancer.js +0 -192
  81. package/dist/core/intelligence/patterns/alternative-phrasing-generator.d.ts +0 -29
  82. package/dist/core/intelligence/patterns/alternative-phrasing-generator.js +0 -239
  83. package/dist/core/intelligence/patterns/ambiguity-detector.d.ts +0 -22
  84. package/dist/core/intelligence/patterns/ambiguity-detector.js +0 -196
  85. package/dist/core/intelligence/patterns/assumption-explicitizer.d.ts +0 -30
  86. package/dist/core/intelligence/patterns/assumption-explicitizer.js +0 -296
  87. package/dist/core/intelligence/patterns/base-pattern.d.ts +0 -192
  88. package/dist/core/intelligence/patterns/base-pattern.js +0 -103
  89. package/dist/core/intelligence/patterns/completeness-validator.d.ts +0 -27
  90. package/dist/core/intelligence/patterns/completeness-validator.js +0 -221
  91. package/dist/core/intelligence/patterns/conciseness-filter.d.ts +0 -20
  92. package/dist/core/intelligence/patterns/conciseness-filter.js +0 -92
  93. package/dist/core/intelligence/patterns/context-precision.d.ts +0 -32
  94. package/dist/core/intelligence/patterns/context-precision.js +0 -389
  95. package/dist/core/intelligence/patterns/conversation-summarizer.d.ts +0 -30
  96. package/dist/core/intelligence/patterns/conversation-summarizer.js +0 -277
  97. package/dist/core/intelligence/patterns/dependency-identifier.d.ts +0 -23
  98. package/dist/core/intelligence/patterns/dependency-identifier.js +0 -166
  99. package/dist/core/intelligence/patterns/domain-context-enricher.d.ts +0 -21
  100. package/dist/core/intelligence/patterns/domain-context-enricher.js +0 -198
  101. package/dist/core/intelligence/patterns/edge-case-identifier.d.ts +0 -30
  102. package/dist/core/intelligence/patterns/edge-case-identifier.js +0 -269
  103. package/dist/core/intelligence/patterns/error-tolerance-enhancer.d.ts +0 -22
  104. package/dist/core/intelligence/patterns/error-tolerance-enhancer.js +0 -179
  105. package/dist/core/intelligence/patterns/implicit-requirement-extractor.d.ts +0 -24
  106. package/dist/core/intelligence/patterns/implicit-requirement-extractor.js +0 -259
  107. package/dist/core/intelligence/patterns/objective-clarifier.d.ts +0 -22
  108. package/dist/core/intelligence/patterns/objective-clarifier.js +0 -126
  109. package/dist/core/intelligence/patterns/output-format-enforcer.d.ts +0 -22
  110. package/dist/core/intelligence/patterns/output-format-enforcer.js +0 -151
  111. package/dist/core/intelligence/patterns/prd-structure-enforcer.d.ts +0 -23
  112. package/dist/core/intelligence/patterns/prd-structure-enforcer.js +0 -183
  113. package/dist/core/intelligence/patterns/prerequisite-identifier.d.ts +0 -23
  114. package/dist/core/intelligence/patterns/prerequisite-identifier.js +0 -221
  115. package/dist/core/intelligence/patterns/requirement-prioritizer.d.ts +0 -24
  116. package/dist/core/intelligence/patterns/requirement-prioritizer.js +0 -134
  117. package/dist/core/intelligence/patterns/scope-definer.d.ts +0 -26
  118. package/dist/core/intelligence/patterns/scope-definer.js +0 -236
  119. package/dist/core/intelligence/patterns/step-decomposer.d.ts +0 -31
  120. package/dist/core/intelligence/patterns/step-decomposer.js +0 -242
  121. package/dist/core/intelligence/patterns/structure-organizer.d.ts +0 -31
  122. package/dist/core/intelligence/patterns/structure-organizer.js +0 -218
  123. package/dist/core/intelligence/patterns/success-criteria-enforcer.d.ts +0 -22
  124. package/dist/core/intelligence/patterns/success-criteria-enforcer.js +0 -165
  125. package/dist/core/intelligence/patterns/success-metrics-enforcer.d.ts +0 -24
  126. package/dist/core/intelligence/patterns/success-metrics-enforcer.js +0 -165
  127. package/dist/core/intelligence/patterns/technical-context-enricher.d.ts +0 -25
  128. package/dist/core/intelligence/patterns/technical-context-enricher.js +0 -165
  129. package/dist/core/intelligence/patterns/topic-coherence-analyzer.d.ts +0 -26
  130. package/dist/core/intelligence/patterns/topic-coherence-analyzer.js +0 -300
  131. package/dist/core/intelligence/patterns/user-persona-enricher.d.ts +0 -24
  132. package/dist/core/intelligence/patterns/user-persona-enricher.js +0 -141
  133. package/dist/core/intelligence/patterns/validation-checklist-creator.d.ts +0 -31
  134. package/dist/core/intelligence/patterns/validation-checklist-creator.js +0 -242
  135. package/dist/core/intelligence/quality-assessor.d.ts +0 -51
  136. package/dist/core/intelligence/quality-assessor.js +0 -505
  137. package/dist/core/intelligence/types.d.ts +0 -111
  138. package/dist/core/intelligence/types.js +0 -3
  139. package/dist/core/intelligence/universal-optimizer.d.ts +0 -84
  140. package/dist/core/intelligence/universal-optimizer.js +0 -371
  141. package/dist/core/prd-generator.d.ts +0 -76
  142. package/dist/core/prd-generator.js +0 -173
  143. package/dist/core/prompt-manager.d.ts +0 -110
  144. package/dist/core/prompt-manager.js +0 -274
  145. package/dist/core/prompt-optimizer.d.ts +0 -268
  146. package/dist/core/prompt-optimizer.js +0 -959
  147. package/dist/core/question-engine.d.ts +0 -167
  148. package/dist/core/question-engine.js +0 -356
  149. package/dist/core/session-manager.d.ts +0 -139
  150. package/dist/core/session-manager.js +0 -365
  151. package/dist/core/task-manager.d.ts +0 -211
  152. package/dist/core/task-manager.js +0 -981
  153. package/dist/core/verification-hooks.d.ts +0 -67
  154. package/dist/core/verification-hooks.js +0 -309
  155. package/dist/core/verification-manager.d.ts +0 -107
  156. package/dist/core/verification-manager.js +0 -415
  157. package/dist/index 2.js +0 -13
  158. package/dist/index.d 2.ts +0 -4
  159. package/dist/types/session.d.ts +0 -78
  160. package/dist/types/session.js +0 -8
  161. package/dist/types/verification.d.ts +0 -205
  162. package/dist/types/verification.js +0 -9
@@ -1,218 +0,0 @@
1
- import { BasePattern, } from './base-pattern.js';
2
- /**
3
- * v4.5 Pattern: Structure Organizer
4
- *
5
- * Reorders information logically following the flow:
6
- * Objective → Requirements → Technical Constraints → Expected Output → Success Criteria
7
- */
8
- export class StructureOrganizer extends BasePattern {
9
- // -------------------------------------------------------------------------
10
- // Pattern Metadata (v4.5 unified types)
11
- // -------------------------------------------------------------------------
12
- id = 'structure-organizer';
13
- name = 'Structure Organizer';
14
- description = 'Reorders information into logical sections';
15
- applicableIntents = [
16
- 'code-generation',
17
- 'planning',
18
- 'refinement',
19
- 'debugging',
20
- 'documentation',
21
- ];
22
- scope = 'both';
23
- priority = 8; // HIGH - core enhancement
24
- phases = ['all'];
25
- // -------------------------------------------------------------------------
26
- // Configuration Schema (v4.5)
27
- // -------------------------------------------------------------------------
28
- static configSchema = {
29
- addHeadersIfMissing: {
30
- type: 'boolean',
31
- default: true,
32
- description: 'Add markdown headers if not present',
33
- },
34
- reorderSections: {
35
- type: 'boolean',
36
- default: true,
37
- description: 'Reorder sections to follow logical flow',
38
- },
39
- };
40
- // -------------------------------------------------------------------------
41
- // Pattern Application
42
- // -------------------------------------------------------------------------
43
- apply(prompt, _context) {
44
- // Detect existing sections
45
- const sections = this.detectSections(prompt);
46
- // If already well-structured, minimal changes
47
- if (sections.length === 0 || this.isWellOrdered(sections)) {
48
- const enhanced = this.addSectionHeaders(prompt);
49
- return {
50
- enhancedPrompt: enhanced,
51
- improvement: {
52
- dimension: 'structure',
53
- description: 'Added section headers for clarity',
54
- impact: 'low',
55
- },
56
- applied: enhanced !== prompt,
57
- };
58
- }
59
- // Extract content by type
60
- const objective = this.extractObjective(prompt);
61
- const requirements = this.extractRequirements(prompt);
62
- const technical = this.extractTechnical(prompt);
63
- const expectedOutput = this.extractExpectedOutput(prompt);
64
- const successCriteria = this.extractSuccessCriteria(prompt);
65
- const constraints = this.extractConstraints(prompt);
66
- const other = this.extractOther(prompt, [
67
- objective,
68
- requirements,
69
- technical,
70
- expectedOutput,
71
- successCriteria,
72
- constraints,
73
- ]);
74
- // Build structured output
75
- let structured = '';
76
- let sectionsCount = 0;
77
- if (objective) {
78
- structured += '## Objective\n\n' + objective + '\n\n';
79
- sectionsCount++;
80
- }
81
- if (requirements) {
82
- structured += '## Requirements\n\n' + requirements + '\n\n';
83
- sectionsCount++;
84
- }
85
- if (technical) {
86
- structured += '## Technical Constraints\n\n' + technical + '\n\n';
87
- sectionsCount++;
88
- }
89
- if (constraints) {
90
- structured += '## Constraints\n\n' + constraints + '\n\n';
91
- sectionsCount++;
92
- }
93
- if (expectedOutput) {
94
- structured += '## Expected Output\n\n' + expectedOutput + '\n\n';
95
- sectionsCount++;
96
- }
97
- if (successCriteria) {
98
- structured += '## Success Criteria\n\n' + successCriteria + '\n\n';
99
- sectionsCount++;
100
- }
101
- if (other) {
102
- structured += other + '\n';
103
- }
104
- const enhanced = structured.trim();
105
- return {
106
- enhancedPrompt: enhanced,
107
- improvement: {
108
- dimension: 'structure',
109
- description: `Reorganized content into ${sectionsCount} logical sections`,
110
- impact: sectionsCount >= 4 ? 'high' : sectionsCount >= 2 ? 'medium' : 'low',
111
- },
112
- applied: true,
113
- };
114
- }
115
- detectSections(prompt) {
116
- const sectionMarkers = [
117
- /^#+\s+.+$/gm, // Markdown headers
118
- /^[A-Z][^.!?]+:$/gm, // "Objective:", "Requirements:"
119
- /^\d+\.\s+[A-Z]/gm, // Numbered lists
120
- /^[-*]\s+/gm, // Bullet points
121
- ];
122
- const sections = [];
123
- for (const marker of sectionMarkers) {
124
- const matches = prompt.match(marker);
125
- if (matches) {
126
- sections.push(...matches);
127
- }
128
- }
129
- return sections;
130
- }
131
- isWellOrdered(sections) {
132
- const idealOrder = ['objective', 'requirement', 'technical', 'constraint', 'output', 'success'];
133
- let lastIndex = -1;
134
- for (const section of sections) {
135
- const sectionLower = section.toLowerCase();
136
- const currentIndex = idealOrder.findIndex((keyword) => sectionLower.includes(keyword));
137
- if (currentIndex !== -1) {
138
- if (currentIndex < lastIndex) {
139
- return false; // Out of order
140
- }
141
- lastIndex = currentIndex;
142
- }
143
- }
144
- return true;
145
- }
146
- isDisorganized(prompt) {
147
- // Check for requirements before objective
148
- const objectiveIndex = prompt.toLowerCase().indexOf('objective');
149
- const requirementIndex = prompt.toLowerCase().indexOf('requirement');
150
- if (objectiveIndex > 0 && requirementIndex > 0 && requirementIndex < objectiveIndex) {
151
- return true;
152
- }
153
- // Check for output before requirements
154
- const outputIndex = prompt.toLowerCase().indexOf('output');
155
- if (outputIndex > 0 && requirementIndex > 0 && outputIndex < requirementIndex) {
156
- return true;
157
- }
158
- return false;
159
- }
160
- extractObjective(prompt) {
161
- const patterns = [
162
- /(?:objective|goal|purpose|need to|want to)[:]\s*(.+?)(?:\n\n|$)/is,
163
- /^(.{20,100}?)(?:\n|$)/i, // First sentence if no explicit objective
164
- ];
165
- for (const pattern of patterns) {
166
- const match = prompt.match(pattern);
167
- if (match) {
168
- return match[1].trim();
169
- }
170
- }
171
- return '';
172
- }
173
- extractRequirements(prompt) {
174
- const pattern = /(?:requirements?|must have|need|should)[:]\s*(.+?)(?:\n\n|##|$)/is;
175
- const match = prompt.match(pattern);
176
- return match ? match[1].trim() : '';
177
- }
178
- extractTechnical(prompt) {
179
- const pattern = /(?:technical|tech stack|technology|using|built? with)[:]\s*(.+?)(?:\n\n|##|$)/is;
180
- const match = prompt.match(pattern);
181
- return match ? match[1].trim() : '';
182
- }
183
- extractExpectedOutput(prompt) {
184
- const pattern = /(?:expected output|output|result|deliverable)[:]\s*(.+?)(?:\n\n|##|$)/is;
185
- const match = prompt.match(pattern);
186
- return match ? match[1].trim() : '';
187
- }
188
- extractSuccessCriteria(prompt) {
189
- const pattern = /(?:success criteria|success|criteria|measure)[:]\s*(.+?)(?:\n\n|##|$)/is;
190
- const match = prompt.match(pattern);
191
- return match ? match[1].trim() : '';
192
- }
193
- extractConstraints(prompt) {
194
- const pattern = /(?:constraints?|limitations?|must not|cannot)[:]\s*(.+?)(?:\n\n|##|$)/is;
195
- const match = prompt.match(pattern);
196
- return match ? match[1].trim() : '';
197
- }
198
- extractOther(prompt, extracted) {
199
- let remaining = prompt;
200
- for (const section of extracted) {
201
- if (section) {
202
- remaining = remaining.replace(section, '');
203
- }
204
- }
205
- remaining = remaining.replace(/#{1,6}\s*.+\n/g, ''); // Remove headers
206
- remaining = remaining.replace(/\n{3,}/g, '\n\n'); // Normalize newlines
207
- return remaining.trim();
208
- }
209
- addSectionHeaders(prompt) {
210
- // If prompt already has headers, return as-is
211
- if (prompt.match(/^#+\s+/m)) {
212
- return prompt;
213
- }
214
- // Add a simple objective header
215
- return '## Objective\n\n' + prompt;
216
- }
217
- }
218
- //# sourceMappingURL=structure-organizer.js.map
@@ -1,22 +0,0 @@
1
- import { BasePattern, PatternScope, PatternPriority, PatternPhase, PatternConfigSchema } from './base-pattern.js';
2
- import { PatternContext, PatternResult, PromptIntent } from '../types.js';
3
- /**
4
- * v4.5 Pattern: Success Criteria Enforcer
5
- *
6
- * Ensures prompts include measurable success criteria. Agents need to know
7
- * when they've successfully completed a task - this pattern adds that clarity.
8
- */
9
- export declare class SuccessCriteriaEnforcer extends BasePattern {
10
- readonly id = "success-criteria-enforcer";
11
- readonly name = "Success Criteria Enforcer";
12
- readonly description = "Adds measurable success criteria for task completion validation";
13
- readonly applicableIntents: PromptIntent[];
14
- readonly scope: PatternScope;
15
- readonly priority: PatternPriority;
16
- readonly phases: PatternPhase[];
17
- static readonly configSchema: PatternConfigSchema;
18
- private successIndicators;
19
- private intentCriteria;
20
- apply(prompt: string, context: PatternContext): PatternResult;
21
- }
22
- //# sourceMappingURL=success-criteria-enforcer.d.ts.map
@@ -1,165 +0,0 @@
1
- import { BasePattern, } from './base-pattern.js';
2
- /**
3
- * v4.5 Pattern: Success Criteria Enforcer
4
- *
5
- * Ensures prompts include measurable success criteria. Agents need to know
6
- * when they've successfully completed a task - this pattern adds that clarity.
7
- */
8
- export class SuccessCriteriaEnforcer extends BasePattern {
9
- // -------------------------------------------------------------------------
10
- // Pattern Metadata (v4.5 unified types)
11
- // -------------------------------------------------------------------------
12
- id = 'success-criteria-enforcer';
13
- name = 'Success Criteria Enforcer';
14
- description = 'Adds measurable success criteria for task completion validation';
15
- applicableIntents = [
16
- 'code-generation',
17
- 'planning',
18
- 'refinement',
19
- 'debugging',
20
- 'testing',
21
- 'migration',
22
- 'prd-generation',
23
- ];
24
- scope = 'both';
25
- priority = 7; // MEDIUM-HIGH - important enrichment
26
- phases = ['all'];
27
- // -------------------------------------------------------------------------
28
- // Configuration Schema (v4.5)
29
- // -------------------------------------------------------------------------
30
- static configSchema = {
31
- showCheckboxes: {
32
- type: 'boolean',
33
- default: true,
34
- description: 'Show criteria as checkboxes for progress tracking',
35
- },
36
- };
37
- // -------------------------------------------------------------------------
38
- // Pattern Data
39
- // -------------------------------------------------------------------------
40
- // Indicators that success criteria already exist
41
- successIndicators = [
42
- 'success criteria',
43
- 'acceptance criteria',
44
- 'done when',
45
- 'complete when',
46
- 'must pass',
47
- 'should pass',
48
- 'test coverage',
49
- 'meets requirements',
50
- 'criteria:',
51
- 'requirements:',
52
- 'must have',
53
- 'must include',
54
- 'validation:',
55
- 'verify that',
56
- 'ensure that',
57
- 'should be able to',
58
- ];
59
- // Intent-specific success criteria templates
60
- intentCriteria = {
61
- 'code-generation': [
62
- 'Code compiles/transpiles without errors',
63
- 'All tests pass (if tests are written)',
64
- 'Follows project coding standards',
65
- 'No TypeScript/linting errors',
66
- 'Functionality matches requirements',
67
- 'Edge cases are handled',
68
- ],
69
- planning: [
70
- 'All requirements are addressed',
71
- 'Tasks are atomic and actionable',
72
- 'Dependencies are identified',
73
- 'Timeline/phases are realistic',
74
- 'Risks are documented',
75
- ],
76
- refinement: [
77
- 'Improved metrics (specify: performance, readability, etc.)',
78
- 'No regression in functionality',
79
- 'Tests still pass',
80
- 'Code review approved',
81
- ],
82
- debugging: [
83
- 'Bug is reproducible and root cause identified',
84
- 'Fix addresses root cause, not symptom',
85
- 'No new bugs introduced',
86
- 'Regression test added',
87
- ],
88
- testing: [
89
- 'Test coverage meets threshold (e.g., >80%)',
90
- 'All critical paths tested',
91
- 'Edge cases covered',
92
- 'Tests are deterministic (no flaky tests)',
93
- 'Test execution time is reasonable',
94
- ],
95
- migration: [
96
- 'All features work as before',
97
- 'No data loss',
98
- 'Performance is not degraded',
99
- 'Rollback plan exists',
100
- 'Documentation is updated',
101
- ],
102
- 'prd-generation': [
103
- 'All sections are complete',
104
- 'Requirements are unambiguous',
105
- 'Technical constraints are specified',
106
- 'Success metrics are measurable',
107
- 'Scope is clearly defined',
108
- ],
109
- documentation: [
110
- 'All public APIs are documented',
111
- 'Examples are provided',
112
- 'Instructions are testable',
113
- 'No broken links',
114
- ],
115
- 'security-review': [
116
- 'All OWASP Top 10 checked',
117
- 'Vulnerabilities are prioritized',
118
- 'Remediation steps are provided',
119
- 'No false positives',
120
- ],
121
- learning: [
122
- 'Concept is explained clearly',
123
- 'Examples demonstrate the concept',
124
- 'Reader can apply knowledge',
125
- ],
126
- };
127
- apply(prompt, context) {
128
- const lowerPrompt = prompt.toLowerCase();
129
- // Check if success criteria already exist
130
- const hasCriteria = this.successIndicators.some((indicator) => lowerPrompt.includes(indicator.toLowerCase()));
131
- if (hasCriteria) {
132
- return {
133
- enhancedPrompt: prompt,
134
- improvement: {
135
- dimension: 'completeness',
136
- description: 'Success criteria already specified',
137
- impact: 'low',
138
- },
139
- applied: false,
140
- };
141
- }
142
- // Get intent-specific criteria
143
- const intent = context.intent.primaryIntent;
144
- const criteria = this.intentCriteria[intent] || this.intentCriteria['code-generation'];
145
- // Build success criteria section
146
- const criteriaSection = `
147
-
148
- ## Success Criteria
149
-
150
- This task is complete when:
151
- ${criteria.map((c) => `- [ ] ${c}`).join('\n')}
152
-
153
- **Tip**: Check off criteria as you complete them to track progress.`;
154
- return {
155
- enhancedPrompt: prompt + criteriaSection,
156
- improvement: {
157
- dimension: 'completeness',
158
- description: `Added ${criteria.length} measurable success criteria for ${intent}`,
159
- impact: 'medium',
160
- },
161
- applied: true,
162
- };
163
- }
164
- }
165
- //# sourceMappingURL=success-criteria-enforcer.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: Success Metrics Enforcer
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
- readonly id = "success-metrics-enforcer";
11
- readonly name = "Success Metrics Enforcer";
12
- readonly description = "Ensures measurable success criteria exist";
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 hasSuccessMetrics;
20
- private needsMetrics;
21
- private addSuccessMetrics;
22
- private inferRelevantMetrics;
23
- }
24
- //# sourceMappingURL=success-metrics-enforcer.d.ts.map
@@ -1,165 +0,0 @@
1
- import { BasePattern, } from './base-pattern.js';
2
- /**
3
- * v4.5 Pattern: Success Metrics Enforcer
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
- // -------------------------------------------------------------------------
10
- // Pattern Metadata (v4.5 unified types)
11
- // -------------------------------------------------------------------------
12
- id = 'success-metrics-enforcer';
13
- name = 'Success Metrics Enforcer';
14
- description = 'Ensures measurable success criteria exist';
15
- applicableIntents = ['prd-generation', 'planning'];
16
- scope = 'comprehensive';
17
- priority = 7; // MEDIUM-HIGH - important enrichment
18
- phases = ['question-validation', 'output-generation'];
19
- // -------------------------------------------------------------------------
20
- // Configuration Schema (v4.5)
21
- // -------------------------------------------------------------------------
22
- static configSchema = {
23
- maxKPIs: {
24
- type: 'number',
25
- default: 4,
26
- description: 'Maximum number of KPIs to suggest',
27
- validation: { min: 1, max: 8 },
28
- },
29
- includeMeasurementGuidance: {
30
- type: 'boolean',
31
- default: true,
32
- description: 'Include guidance on how to measure success',
33
- },
34
- };
35
- // -------------------------------------------------------------------------
36
- // Pattern Application
37
- // -------------------------------------------------------------------------
38
- apply(prompt, _context) {
39
- // Check if success metrics already exist
40
- if (this.hasSuccessMetrics(prompt)) {
41
- return {
42
- enhancedPrompt: prompt,
43
- improvement: {
44
- dimension: 'completeness',
45
- description: 'Success metrics already present',
46
- impact: 'low',
47
- },
48
- applied: false,
49
- };
50
- }
51
- // Check if this is content that needs metrics
52
- if (!this.needsMetrics(prompt)) {
53
- return {
54
- enhancedPrompt: prompt,
55
- improvement: {
56
- dimension: 'completeness',
57
- description: 'Content does not require success metrics',
58
- impact: 'low',
59
- },
60
- applied: false,
61
- };
62
- }
63
- // Add success metrics section
64
- const enhanced = this.addSuccessMetrics(prompt);
65
- return {
66
- enhancedPrompt: enhanced,
67
- improvement: {
68
- dimension: 'completeness',
69
- description: 'Added measurable success criteria and KPIs',
70
- impact: 'high',
71
- },
72
- applied: true,
73
- };
74
- }
75
- hasSuccessMetrics(prompt) {
76
- const metricsKeywords = [
77
- 'success metric',
78
- 'success criteria',
79
- 'kpi',
80
- 'measure success',
81
- 'acceptance criteria',
82
- '% increase',
83
- '% decrease',
84
- 'conversion rate',
85
- 'completion rate',
86
- 'response time',
87
- 'latency',
88
- 'uptime',
89
- 'sla',
90
- 'benchmark',
91
- ];
92
- return this.hasSection(prompt, metricsKeywords);
93
- }
94
- needsMetrics(prompt) {
95
- // PRD-like content that describes features
96
- const prdKeywords = [
97
- 'feature',
98
- 'build',
99
- 'implement',
100
- 'goal',
101
- 'objective',
102
- 'product',
103
- 'launch',
104
- 'release',
105
- ];
106
- return this.hasSection(prompt, prdKeywords);
107
- }
108
- addSuccessMetrics(prompt) {
109
- // Detect the type of project to suggest relevant metrics
110
- const metrics = this.inferRelevantMetrics(prompt);
111
- const metricsSection = `\n\n### Success Metrics\n` +
112
- `**Primary KPIs:**\n` +
113
- metrics.map((m) => `- ${m}`).join('\n') +
114
- `\n\n**Measurement Approach:**\n` +
115
- `- Baseline: [Current state before implementation]\n` +
116
- `- Target: [Specific, measurable goals]\n` +
117
- `- Timeline: [When to measure success]`;
118
- return prompt + metricsSection;
119
- }
120
- inferRelevantMetrics(prompt) {
121
- const lowerPrompt = prompt.toLowerCase();
122
- const metrics = [];
123
- // Performance-related
124
- if (lowerPrompt.includes('performance') ||
125
- lowerPrompt.includes('fast') ||
126
- lowerPrompt.includes('speed')) {
127
- metrics.push('Response time < [X]ms (p95)');
128
- metrics.push('Page load time improvement by [X]%');
129
- }
130
- // User engagement
131
- if (lowerPrompt.includes('user') ||
132
- lowerPrompt.includes('engagement') ||
133
- lowerPrompt.includes('retention')) {
134
- metrics.push('User engagement increase by [X]%');
135
- metrics.push('Task completion rate > [X]%');
136
- }
137
- // Conversion/business
138
- if (lowerPrompt.includes('conversion') ||
139
- lowerPrompt.includes('sales') ||
140
- lowerPrompt.includes('revenue')) {
141
- metrics.push('Conversion rate improvement by [X]%');
142
- metrics.push('Revenue impact of $[X]');
143
- }
144
- // Technical quality
145
- if (lowerPrompt.includes('quality') ||
146
- lowerPrompt.includes('bug') ||
147
- lowerPrompt.includes('error')) {
148
- metrics.push('Error rate < [X]%');
149
- metrics.push('Test coverage > [X]%');
150
- }
151
- // API/integration
152
- if (lowerPrompt.includes('api') || lowerPrompt.includes('integration')) {
153
- metrics.push('API availability > [X]%');
154
- metrics.push('Integration success rate > [X]%');
155
- }
156
- // Default metrics if none matched
157
- if (metrics.length === 0) {
158
- metrics.push('[Define primary success metric]');
159
- metrics.push('[Define secondary success metric]');
160
- metrics.push('[Define timeline for measurement]');
161
- }
162
- return metrics.slice(0, 4); // Max 4 metrics
163
- }
164
- }
165
- //# sourceMappingURL=success-metrics-enforcer.js.map
@@ -1,25 +0,0 @@
1
- import { BasePattern, PatternScope, PatternPriority, PatternPhase, PatternConfigSchema, PatternDependency } from './base-pattern.js';
2
- import { PatternContext, PatternResult, PromptIntent } from '../types.js';
3
- /**
4
- * v4.5 Pattern: Technical Context Enricher
5
- *
6
- * Adds missing technical context (language, framework, versions).
7
- * Detects technologies and suggests version specifications.
8
- */
9
- export declare class TechnicalContextEnricher extends BasePattern {
10
- readonly id = "technical-context-enricher";
11
- readonly name = "Technical Context Enricher";
12
- readonly description = "Adds missing technical context (language, framework, versions)";
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 hasTechnicalContext;
21
- private detectLanguage;
22
- private detectFramework;
23
- private hasVersionInfo;
24
- }
25
- //# sourceMappingURL=technical-context-enricher.d.ts.map