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,296 +0,0 @@
1
- import { BasePattern, } from './base-pattern.js';
2
- /**
3
- * v4.5 Pattern: Assumption Explicitizer
4
- *
5
- * Makes implicit assumptions explicit to prevent misunderstandings
6
- * and ensure comprehensive requirement coverage.
7
- */
8
- export class AssumptionExplicitizer extends BasePattern {
9
- // -------------------------------------------------------------------------
10
- // Pattern Metadata (v4.5 unified types)
11
- // -------------------------------------------------------------------------
12
- id = 'assumption-explicitizer';
13
- name = 'Assumption Explicitizer';
14
- description = 'Make implicit assumptions explicit to prevent misunderstandings';
15
- applicableIntents = [
16
- 'code-generation',
17
- 'planning',
18
- 'migration',
19
- 'testing',
20
- 'debugging',
21
- 'prd-generation',
22
- ];
23
- scope = 'comprehensive';
24
- priority = 6; // MEDIUM - standard enhancement
25
- phases = ['all'];
26
- // -------------------------------------------------------------------------
27
- // Configuration Schema (v4.5)
28
- // -------------------------------------------------------------------------
29
- static configSchema = {
30
- maxAssumptions: {
31
- type: 'number',
32
- default: 8,
33
- description: 'Maximum number of assumptions to surface',
34
- validation: { min: 1, max: 15 },
35
- },
36
- checkDomainAssumptions: {
37
- type: 'boolean',
38
- default: true,
39
- description: 'Check for domain-specific assumptions (auth, API style, etc.)',
40
- },
41
- };
42
- // -------------------------------------------------------------------------
43
- // Pattern Application
44
- // -------------------------------------------------------------------------
45
- apply(prompt, context) {
46
- const assumptions = this.identifyAssumptions(prompt, context.intent.primaryIntent);
47
- if (assumptions.length === 0) {
48
- return {
49
- enhancedPrompt: prompt,
50
- improvement: {
51
- dimension: 'clarity',
52
- description: 'No implicit assumptions detected',
53
- impact: 'low',
54
- },
55
- applied: false,
56
- };
57
- }
58
- // Append assumptions section to the prompt
59
- const assumptionsSection = this.formatAssumptionsSection(assumptions);
60
- const enhancedPrompt = `${prompt}\n\n${assumptionsSection}`;
61
- return {
62
- enhancedPrompt,
63
- improvement: {
64
- dimension: 'clarity',
65
- description: `Identified ${assumptions.length} implicit assumptions to clarify`,
66
- impact: 'high',
67
- },
68
- applied: true,
69
- };
70
- }
71
- identifyAssumptions(prompt, intent) {
72
- const assumptions = [];
73
- const lowerPrompt = prompt.toLowerCase();
74
- // Check for missing context that leads to assumptions
75
- assumptions.push(...this.identifyMissingContext(lowerPrompt));
76
- // Intent-specific assumptions
77
- switch (intent) {
78
- case 'code-generation':
79
- assumptions.push(...this.getCodeAssumptions(lowerPrompt));
80
- break;
81
- case 'planning':
82
- assumptions.push(...this.getPlanningAssumptions(lowerPrompt));
83
- break;
84
- case 'migration':
85
- assumptions.push(...this.getMigrationAssumptions(lowerPrompt));
86
- break;
87
- case 'testing':
88
- assumptions.push(...this.getTestingAssumptions(lowerPrompt));
89
- break;
90
- case 'debugging':
91
- assumptions.push(...this.getDebuggingAssumptions(lowerPrompt));
92
- break;
93
- }
94
- // Domain-specific assumptions
95
- assumptions.push(...this.getDomainAssumptions(lowerPrompt));
96
- return this.deduplicateAssumptions(assumptions).slice(0, 8);
97
- }
98
- identifyMissingContext(prompt) {
99
- const assumptions = [];
100
- // Check for vague technology references
101
- if (!this.hasSection(prompt, ['react', 'vue', 'angular', 'svelte', 'next', 'nuxt'])) {
102
- if (this.hasSection(prompt, ['component', 'frontend', 'ui'])) {
103
- assumptions.push({
104
- assumption: 'Frontend framework is React',
105
- clarificationNeeded: 'Which frontend framework should be used? (React, Vue, Angular, etc.)',
106
- });
107
- }
108
- }
109
- // Check for missing language specification
110
- if (!this.hasSection(prompt, ['typescript', 'javascript', 'python', 'java', 'go', 'rust'])) {
111
- if (this.hasSection(prompt, ['function', 'class', 'code', 'implement'])) {
112
- assumptions.push({
113
- assumption: 'Language is TypeScript/JavaScript',
114
- clarificationNeeded: 'Which programming language should be used?',
115
- });
116
- }
117
- }
118
- // Check for missing database type
119
- if (!this.hasSection(prompt, ['postgres', 'mysql', 'mongodb', 'sqlite', 'redis'])) {
120
- if (this.hasSection(prompt, ['database', 'store', 'persist', 'save'])) {
121
- assumptions.push({
122
- assumption: 'Database type is flexible',
123
- clarificationNeeded: 'Which database technology is being used?',
124
- });
125
- }
126
- }
127
- return assumptions;
128
- }
129
- getCodeAssumptions(prompt) {
130
- const assumptions = [];
131
- // Error handling assumption
132
- if (!this.hasSection(prompt, ['error', 'exception', 'catch', 'handle'])) {
133
- assumptions.push({
134
- assumption: 'Basic error handling is expected',
135
- clarificationNeeded: 'What error handling strategy should be used? (throw, return null, default value, etc.)',
136
- });
137
- }
138
- // Async assumption
139
- if (this.hasSection(prompt, ['api', 'fetch', 'request', 'call'])) {
140
- if (!this.hasSection(prompt, ['async', 'await', 'promise', 'callback'])) {
141
- assumptions.push({
142
- assumption: 'Using async/await pattern',
143
- clarificationNeeded: 'Should this be synchronous or asynchronous?',
144
- });
145
- }
146
- }
147
- // State management assumption
148
- if (this.hasSection(prompt, ['state', 'store', 'context'])) {
149
- if (!this.hasSection(prompt, ['redux', 'zustand', 'mobx', 'context api'])) {
150
- assumptions.push({
151
- assumption: 'Using React Context or local state',
152
- clarificationNeeded: 'Which state management approach is preferred?',
153
- });
154
- }
155
- }
156
- return assumptions;
157
- }
158
- getPlanningAssumptions(prompt) {
159
- const assumptions = [];
160
- // Team size assumption
161
- if (!this.hasSection(prompt, ['team', 'developer', 'person'])) {
162
- assumptions.push({
163
- assumption: 'Small team (1-3 developers)',
164
- clarificationNeeded: 'How many people will work on this?',
165
- });
166
- }
167
- // Timeline assumption
168
- if (!this.hasSection(prompt, ['deadline', 'timeline', 'sprint', 'week', 'month'])) {
169
- assumptions.push({
170
- assumption: 'Flexible timeline',
171
- clarificationNeeded: 'What are the timeline constraints?',
172
- });
173
- }
174
- // Scale assumption
175
- if (!this.hasSection(prompt, ['users', 'traffic', 'scale', 'load'])) {
176
- assumptions.push({
177
- assumption: 'Starting with low-moderate scale',
178
- clarificationNeeded: 'What is the expected scale (users, requests/sec)?',
179
- });
180
- }
181
- return assumptions;
182
- }
183
- getMigrationAssumptions(prompt) {
184
- const assumptions = [];
185
- // Downtime assumption
186
- if (!this.hasSection(prompt, ['downtime', 'zero-downtime', 'maintenance'])) {
187
- assumptions.push({
188
- assumption: 'Some downtime is acceptable',
189
- clarificationNeeded: 'Is zero-downtime migration required?',
190
- });
191
- }
192
- // Rollback assumption
193
- if (!this.hasSection(prompt, ['rollback', 'revert', 'backup'])) {
194
- assumptions.push({
195
- assumption: 'Rollback capability is needed',
196
- clarificationNeeded: 'What is the rollback strategy if migration fails?',
197
- });
198
- }
199
- // Data preservation assumption
200
- assumptions.push({
201
- assumption: 'All existing data must be preserved',
202
- clarificationNeeded: 'Can any data be discarded or archived during migration?',
203
- });
204
- return assumptions;
205
- }
206
- getTestingAssumptions(prompt) {
207
- const assumptions = [];
208
- // Test framework assumption
209
- if (!this.hasSection(prompt, ['jest', 'vitest', 'mocha', 'pytest', 'junit'])) {
210
- assumptions.push({
211
- assumption: "Using project's existing test framework",
212
- clarificationNeeded: 'Which test framework should be used?',
213
- });
214
- }
215
- // Coverage assumption
216
- if (!this.hasSection(prompt, ['coverage', 'percent', '%'])) {
217
- assumptions.push({
218
- assumption: 'Standard coverage target (80%+)',
219
- clarificationNeeded: 'What is the target code coverage percentage?',
220
- });
221
- }
222
- // Mocking assumption
223
- if (!this.hasSection(prompt, ['mock', 'stub', 'fake', 'spy'])) {
224
- assumptions.push({
225
- assumption: 'External dependencies should be mocked',
226
- clarificationNeeded: 'Should tests use real dependencies or mocks?',
227
- });
228
- }
229
- return assumptions;
230
- }
231
- getDebuggingAssumptions(prompt) {
232
- const assumptions = [];
233
- // Environment assumption
234
- if (!this.hasSection(prompt, ['production', 'staging', 'development', 'local'])) {
235
- assumptions.push({
236
- assumption: 'Bug occurs in development environment',
237
- clarificationNeeded: 'In which environment does this bug occur?',
238
- });
239
- }
240
- // Reproducibility assumption
241
- if (!this.hasSection(prompt, ['always', 'sometimes', 'intermittent', 'random'])) {
242
- assumptions.push({
243
- assumption: 'Bug is consistently reproducible',
244
- clarificationNeeded: 'Does this bug occur every time or intermittently?',
245
- });
246
- }
247
- return assumptions;
248
- }
249
- getDomainAssumptions(prompt) {
250
- const assumptions = [];
251
- // Authentication assumption
252
- if (this.hasSection(prompt, ['user', 'login', 'auth'])) {
253
- if (!this.hasSection(prompt, ['jwt', 'session', 'oauth', 'cookie'])) {
254
- assumptions.push({
255
- assumption: 'Using JWT-based authentication',
256
- clarificationNeeded: 'Which authentication mechanism is in use?',
257
- });
258
- }
259
- }
260
- // API style assumption
261
- if (this.hasSection(prompt, ['api', 'endpoint'])) {
262
- if (!this.hasSection(prompt, ['rest', 'graphql', 'grpc', 'websocket'])) {
263
- assumptions.push({
264
- assumption: 'Building REST API',
265
- clarificationNeeded: 'Which API style? (REST, GraphQL, gRPC, etc.)',
266
- });
267
- }
268
- }
269
- return assumptions;
270
- }
271
- deduplicateAssumptions(assumptions) {
272
- const seen = new Set();
273
- return assumptions.filter((a) => {
274
- const key = a.assumption.toLowerCase();
275
- if (seen.has(key))
276
- return false;
277
- seen.add(key);
278
- return true;
279
- });
280
- }
281
- formatAssumptionsSection(assumptions) {
282
- const lines = [
283
- '### Implicit Assumptions',
284
- '',
285
- 'The following assumptions are being made. Please clarify if any are incorrect:',
286
- '',
287
- ];
288
- assumptions.forEach((a, index) => {
289
- lines.push(`**${index + 1}. ${a.assumption}**`);
290
- lines.push(` → Clarify: ${a.clarificationNeeded}`);
291
- lines.push('');
292
- });
293
- return lines.join('\n');
294
- }
295
- }
296
- //# sourceMappingURL=assumption-explicitizer.js.map
@@ -1,192 +0,0 @@
1
- import { PromptIntent, PatternContext, PatternResult } from '../types.js';
2
- /**
3
- * v4.11: Pattern scope determines when a pattern is active.
4
- * - 'standard': Only for standard depth optimization
5
- * - 'comprehensive': Only for comprehensive depth analysis
6
- * - 'both': Available at both depth levels
7
- *
8
- * Note: Renamed from PatternMode in v4.11. 'fast' → 'standard', 'deep' → 'comprehensive'
9
- */
10
- export type PatternScope = 'standard' | 'comprehensive' | 'both';
11
- export type PatternMode = PatternScope;
12
- /**
13
- * Pattern phases for PRD and Conversational modes.
14
- * Patterns declare which phases they apply to.
15
- *
16
- * - 'question-validation': PRD mode - validating individual answers
17
- * - 'output-generation': PRD mode - generating final PRD documents
18
- * - 'conversation-tracking': Conversational mode - analyzing messages in real-time
19
- * - 'summarization': Conversational mode - extracting requirements from conversation
20
- * - 'all': Pattern applies to all phases (default for basic patterns)
21
- */
22
- export type PatternPhase = 'question-validation' | 'output-generation' | 'conversation-tracking' | 'summarization' | 'all';
23
- /**
24
- * Pattern Priority Scale (1-10)
25
- *
26
- * Higher priority patterns run FIRST (sorted descending).
27
- *
28
- * 10: CRITICAL - Must run before everything else
29
- * Use case: Mode detection, fundamental structure validation
30
- *
31
- * 9: VERY HIGH - Structural integrity
32
- * Use case: Ambiguity detection, completeness validation, PRD structure
33
- *
34
- * 8: HIGH - Core enhancement
35
- * Use case: Objective clarification, structure organization, summarization
36
- *
37
- * 7: MEDIUM-HIGH - Important enrichment
38
- * Use case: Output format, success criteria, requirement prioritization
39
- *
40
- * 6: MEDIUM - Standard enhancement
41
- * Use case: Context enrichment, topic coherence, user personas
42
- *
43
- * 5: MEDIUM-LOW - Supplementary
44
- * Use case: Step decomposition, technical context, implicit requirements
45
- *
46
- * 4: LOW - Polish
47
- * Use case: Conciseness filtering, actionability enhancement
48
- *
49
- * 3: VERY LOW - Final touches
50
- * Use case: Phrasing alternatives, edge cases, validation checklists
51
- *
52
- * 2: MINIMAL - Only if nothing else applies
53
- * Use case: Reserved for future
54
- *
55
- * 1: LOWEST - Last resort
56
- * Use case: Reserved for future
57
- *
58
- * Collision Resolution: When priorities are equal, patterns run
59
- * in registration order (first registered runs first).
60
- */
61
- export type PatternPriority = 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10;
62
- /**
63
- * Pattern dependency configuration.
64
- * Allows patterns to express execution order constraints.
65
- */
66
- export interface PatternDependency {
67
- /**
68
- * Patterns that must run before this one.
69
- * Uses pattern IDs.
70
- */
71
- runAfter?: string[];
72
- /**
73
- * Patterns that are mutually exclusive with this one.
74
- * If one runs, the other won't.
75
- */
76
- excludesWith?: string[];
77
- /**
78
- * Patterns that enhance this one when both run.
79
- * Informational only, no enforcement.
80
- */
81
- enhancedBy?: string[];
82
- }
83
- /**
84
- * Schema field types for pattern configuration
85
- */
86
- export type PatternConfigFieldType = 'string' | 'number' | 'boolean' | 'array' | 'enum';
87
- /**
88
- * Single field in a pattern's configuration schema
89
- */
90
- export interface PatternConfigField {
91
- type: PatternConfigFieldType;
92
- default: unknown;
93
- description: string;
94
- validation?: {
95
- min?: number;
96
- max?: number;
97
- enum?: string[];
98
- minLength?: number;
99
- maxLength?: number;
100
- };
101
- }
102
- /**
103
- * Configuration schema for a pattern.
104
- * Each pattern declares its configurable options.
105
- * Empty object `{}` means no configuration available.
106
- */
107
- export interface PatternConfigSchema {
108
- [fieldName: string]: PatternConfigField;
109
- }
110
- /**
111
- * Interface for PatternLibrary to avoid circular dependency.
112
- * Used by patterns to access their configuration.
113
- */
114
- export interface IPatternLibrary {
115
- getPatternSettings(patternId: string): Record<string, unknown> | undefined;
116
- }
117
- export declare abstract class BasePattern {
118
- /** Unique identifier for this pattern (e.g., 'conciseness-filter') */
119
- abstract readonly id: string;
120
- /** Human-readable name (e.g., 'Conciseness Filter') */
121
- abstract readonly name: string;
122
- /** Brief description of what this pattern does */
123
- abstract readonly description: string;
124
- /** Which intents this pattern is applicable to */
125
- abstract readonly applicableIntents: PromptIntent[];
126
- /** Which depth level(s) this pattern runs at (v4.11: renamed from mode) */
127
- abstract readonly scope: PatternScope;
128
- /** Execution priority (1-10, higher runs first) */
129
- abstract readonly priority: PatternPriority;
130
- /** Which phases this pattern applies to (PRD/conversational modes) */
131
- abstract readonly phases: PatternPhase[];
132
- /** Optional dependency configuration */
133
- readonly dependencies?: PatternDependency;
134
- /**
135
- * Configuration schema for this pattern.
136
- * Override in subclass to define configurable options.
137
- * Empty object means no configuration available.
138
- */
139
- static readonly configSchema: PatternConfigSchema;
140
- /**
141
- * Reference to pattern library for accessing configuration.
142
- * Injected by PatternLibrary on registration.
143
- */
144
- private patternLibraryRef?;
145
- /**
146
- * Inject PatternLibrary reference for config access.
147
- * Called by PatternLibrary during registration.
148
- */
149
- setPatternLibrary(library: IPatternLibrary): void;
150
- /**
151
- * Get settings for this pattern with defaults applied.
152
- * Use in apply() method to access user configuration.
153
- *
154
- * @example
155
- * ```typescript
156
- * apply(prompt: string, context: PatternContext): PatternResult {
157
- * const settings = this.getSettings();
158
- * if (fluffCount > settings.fluffThreshold) {
159
- * // ...
160
- * }
161
- * }
162
- * ```
163
- */
164
- protected getSettings(): Record<string, unknown>;
165
- /**
166
- * Apply this pattern to the given prompt.
167
- * Must be implemented by all concrete patterns.
168
- */
169
- abstract apply(prompt: string, context: PatternContext): PatternResult;
170
- /**
171
- * Check if this pattern is applicable for the given context.
172
- * Can be overridden for custom applicability logic.
173
- */
174
- isApplicable(context: PatternContext): boolean;
175
- /**
176
- * Utility: Remove extra whitespace
177
- */
178
- protected cleanWhitespace(text: string): string;
179
- /**
180
- * Utility: Check if prompt has a section
181
- */
182
- protected hasSection(prompt: string, keywords: string[]): boolean;
183
- /**
184
- * Utility: Count words
185
- */
186
- protected countWords(text: string): number;
187
- /**
188
- * Utility: Extract sentences
189
- */
190
- protected extractSentences(text: string): string[];
191
- }
192
- //# sourceMappingURL=base-pattern.d.ts.map
@@ -1,103 +0,0 @@
1
- // ============================================================================
2
- // Base Pattern Abstract Class
3
- // ============================================================================
4
- export class BasePattern {
5
- // -------------------------------------------------------------------------
6
- // Optional Pattern Metadata
7
- // -------------------------------------------------------------------------
8
- /** Optional dependency configuration */
9
- dependencies;
10
- // -------------------------------------------------------------------------
11
- // Configuration Support (v4.5)
12
- // -------------------------------------------------------------------------
13
- /**
14
- * Configuration schema for this pattern.
15
- * Override in subclass to define configurable options.
16
- * Empty object means no configuration available.
17
- */
18
- static configSchema = {};
19
- /**
20
- * Reference to pattern library for accessing configuration.
21
- * Injected by PatternLibrary on registration.
22
- */
23
- patternLibraryRef;
24
- /**
25
- * Inject PatternLibrary reference for config access.
26
- * Called by PatternLibrary during registration.
27
- */
28
- setPatternLibrary(library) {
29
- this.patternLibraryRef = library;
30
- }
31
- /**
32
- * Get settings for this pattern with defaults applied.
33
- * Use in apply() method to access user configuration.
34
- *
35
- * @example
36
- * ```typescript
37
- * apply(prompt: string, context: PatternContext): PatternResult {
38
- * const settings = this.getSettings();
39
- * if (fluffCount > settings.fluffThreshold) {
40
- * // ...
41
- * }
42
- * }
43
- * ```
44
- */
45
- getSettings() {
46
- // Get the static configSchema from the concrete class
47
- const ConcreteClass = this.constructor;
48
- const schema = ConcreteClass.configSchema;
49
- // Build defaults from schema
50
- const defaults = {};
51
- for (const [key, field] of Object.entries(schema)) {
52
- defaults[key] = field.default;
53
- }
54
- // Merge with user config (user config overrides defaults)
55
- const userConfig = this.patternLibraryRef?.getPatternSettings(this.id) || {};
56
- return { ...defaults, ...userConfig };
57
- }
58
- /**
59
- * Check if this pattern is applicable for the given context.
60
- * Can be overridden for custom applicability logic.
61
- */
62
- isApplicable(context) {
63
- // v4.11: Check scope compatibility with depth level
64
- // For improve mode, compare scope with depthLevel
65
- // For prd/conversational modes, use the derived depth from phase
66
- if (context.depthLevel) {
67
- if (this.scope !== 'both' && this.scope !== context.depthLevel) {
68
- return false;
69
- }
70
- }
71
- // Check intent compatibility
72
- return this.applicableIntents.includes(context.intent.primaryIntent);
73
- }
74
- // -------------------------------------------------------------------------
75
- // Utility Methods
76
- // -------------------------------------------------------------------------
77
- /**
78
- * Utility: Remove extra whitespace
79
- */
80
- cleanWhitespace(text) {
81
- return text.replace(/\s+/g, ' ').trim();
82
- }
83
- /**
84
- * Utility: Check if prompt has a section
85
- */
86
- hasSection(prompt, keywords) {
87
- const lowerPrompt = prompt.toLowerCase();
88
- return keywords.some((keyword) => lowerPrompt.includes(keyword.toLowerCase()));
89
- }
90
- /**
91
- * Utility: Count words
92
- */
93
- countWords(text) {
94
- return text.split(/\s+/).filter((word) => word.length > 0).length;
95
- }
96
- /**
97
- * Utility: Extract sentences
98
- */
99
- extractSentences(text) {
100
- return text.split(/[.!?]+/).filter((s) => s.trim().length > 0);
101
- }
102
- }
103
- //# sourceMappingURL=base-pattern.js.map
@@ -1,27 +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: Completeness Validator
5
- *
6
- * Ensures all necessary requirements are present.
7
- * Adds placeholder sections for missing critical elements.
8
- */
9
- export declare class CompletenessValidator extends BasePattern {
10
- readonly id = "completeness-validator";
11
- readonly name = "Completeness Validator";
12
- readonly description = "Ensures all necessary requirements are present";
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 findMissingElements;
20
- private hasObjective;
21
- private hasTechStack;
22
- private hasSuccessCriteria;
23
- private hasConstraints;
24
- private hasOutputFormat;
25
- private getMissingElementPrompt;
26
- }
27
- //# sourceMappingURL=completeness-validator.d.ts.map