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.
- package/README.md +72 -60
- package/dist/cli/commands/update.js +9 -10
- package/dist/templates/agents/agents.md +14 -8
- package/dist/templates/agents/copilot-instructions.md +1 -1
- package/dist/templates/instructions/core/verification.md +2 -2
- package/dist/templates/slash-commands/_canonical/archive.md +83 -121
- package/dist/templates/slash-commands/_canonical/execute.md +32 -42
- package/dist/templates/slash-commands/_canonical/implement.md +32 -44
- package/dist/templates/slash-commands/_canonical/improve.md +14 -53
- package/dist/templates/slash-commands/_canonical/start.md +1 -1
- package/dist/templates/slash-commands/_canonical/summarize.md +8 -8
- package/dist/templates/slash-commands/_components/agent-protocols/cli-reference.md +84 -180
- package/dist/templates/slash-commands/_components/agent-protocols/error-handling.md +2 -2
- package/dist/templates/slash-commands/_components/agent-protocols/file-formats.md +41 -59
- package/dist/templates/slash-commands/_components/agent-protocols/state-assertion.md +1 -1
- package/dist/templates/slash-commands/_components/references/intent-types.md +1 -1
- package/dist/templates/slash-commands/_components/sections/file-saving-protocol.md +20 -27
- package/dist/templates/slash-commands/_components/sections/pattern-visibility.md +29 -46
- package/dist/templates/slash-commands/_components/troubleshooting/file-not-saved.md +4 -5
- package/dist/types/config.d.ts +57 -0
- package/dist/utils/legacy-command-cleanup.js +31 -4
- package/package.json +5 -4
- package/dist/cli/commands/analyze.d.ts +0 -17
- package/dist/cli/commands/analyze.js +0 -133
- package/dist/cli/commands/archive.d.ts +0 -36
- package/dist/cli/commands/archive.js +0 -266
- package/dist/cli/commands/deep.d.ts +0 -17
- package/dist/cli/commands/deep.js +0 -170
- package/dist/cli/commands/execute.d.ts +0 -15
- package/dist/cli/commands/execute.js +0 -168
- package/dist/cli/commands/fast.d.ts +0 -18
- package/dist/cli/commands/fast.js +0 -219
- package/dist/cli/commands/implement.d.ts +0 -24
- package/dist/cli/commands/implement.js +0 -289
- package/dist/cli/commands/improve.d.ts +0 -32
- package/dist/cli/commands/improve.js +0 -250
- package/dist/cli/commands/list.d.ts +0 -17
- package/dist/cli/commands/list.js +0 -217
- package/dist/cli/commands/plan.d.ts +0 -21
- package/dist/cli/commands/plan.js +0 -297
- package/dist/cli/commands/prd.d.ts +0 -24
- package/dist/cli/commands/prd.js +0 -321
- package/dist/cli/commands/prompts/clear.d.ts +0 -16
- package/dist/cli/commands/prompts/clear.js +0 -222
- package/dist/cli/commands/prompts/list.d.ts +0 -8
- package/dist/cli/commands/prompts/list.js +0 -88
- package/dist/cli/commands/show.d.ts +0 -21
- package/dist/cli/commands/show.js +0 -191
- package/dist/cli/commands/start.d.ts +0 -40
- package/dist/cli/commands/start.js +0 -210
- package/dist/cli/commands/summarize.d.ts +0 -17
- package/dist/cli/commands/summarize.js +0 -196
- package/dist/cli/commands/task-complete.d.ts +0 -27
- package/dist/cli/commands/task-complete.js +0 -269
- package/dist/cli/commands/verify.d.ts +0 -28
- package/dist/cli/commands/verify.js +0 -349
- package/dist/core/archive-manager.d.ts +0 -100
- package/dist/core/archive-manager.js +0 -302
- package/dist/core/basic-checklist-generator.d.ts +0 -35
- package/dist/core/basic-checklist-generator.js +0 -344
- package/dist/core/checklist-parser.d.ts +0 -48
- package/dist/core/checklist-parser.js +0 -238
- package/dist/core/config-manager.d.ts +0 -149
- package/dist/core/config-manager.js +0 -230
- package/dist/core/conversation-analyzer.d.ts +0 -86
- package/dist/core/conversation-analyzer.js +0 -387
- package/dist/core/conversation-quality-tracker.d.ts +0 -81
- package/dist/core/conversation-quality-tracker.js +0 -195
- package/dist/core/git-manager.d.ts +0 -126
- package/dist/core/git-manager.js +0 -282
- package/dist/core/intelligence/confidence-calculator.d.ts +0 -93
- package/dist/core/intelligence/confidence-calculator.js +0 -124
- package/dist/core/intelligence/index.d.ts +0 -11
- package/dist/core/intelligence/index.js +0 -15
- package/dist/core/intelligence/intent-detector.d.ts +0 -54
- package/dist/core/intelligence/intent-detector.js +0 -723
- package/dist/core/intelligence/pattern-library.d.ts +0 -104
- package/dist/core/intelligence/pattern-library.js +0 -339
- package/dist/core/intelligence/patterns/actionability-enhancer.d.ts +0 -27
- package/dist/core/intelligence/patterns/actionability-enhancer.js +0 -192
- package/dist/core/intelligence/patterns/alternative-phrasing-generator.d.ts +0 -29
- package/dist/core/intelligence/patterns/alternative-phrasing-generator.js +0 -239
- package/dist/core/intelligence/patterns/ambiguity-detector.d.ts +0 -22
- package/dist/core/intelligence/patterns/ambiguity-detector.js +0 -196
- package/dist/core/intelligence/patterns/assumption-explicitizer.d.ts +0 -30
- package/dist/core/intelligence/patterns/assumption-explicitizer.js +0 -296
- package/dist/core/intelligence/patterns/base-pattern.d.ts +0 -192
- package/dist/core/intelligence/patterns/base-pattern.js +0 -103
- package/dist/core/intelligence/patterns/completeness-validator.d.ts +0 -27
- package/dist/core/intelligence/patterns/completeness-validator.js +0 -221
- package/dist/core/intelligence/patterns/conciseness-filter.d.ts +0 -20
- package/dist/core/intelligence/patterns/conciseness-filter.js +0 -92
- package/dist/core/intelligence/patterns/context-precision.d.ts +0 -32
- package/dist/core/intelligence/patterns/context-precision.js +0 -389
- package/dist/core/intelligence/patterns/conversation-summarizer.d.ts +0 -30
- package/dist/core/intelligence/patterns/conversation-summarizer.js +0 -277
- package/dist/core/intelligence/patterns/dependency-identifier.d.ts +0 -23
- package/dist/core/intelligence/patterns/dependency-identifier.js +0 -166
- package/dist/core/intelligence/patterns/domain-context-enricher.d.ts +0 -21
- package/dist/core/intelligence/patterns/domain-context-enricher.js +0 -198
- package/dist/core/intelligence/patterns/edge-case-identifier.d.ts +0 -30
- package/dist/core/intelligence/patterns/edge-case-identifier.js +0 -269
- package/dist/core/intelligence/patterns/error-tolerance-enhancer.d.ts +0 -22
- package/dist/core/intelligence/patterns/error-tolerance-enhancer.js +0 -179
- package/dist/core/intelligence/patterns/implicit-requirement-extractor.d.ts +0 -24
- package/dist/core/intelligence/patterns/implicit-requirement-extractor.js +0 -259
- package/dist/core/intelligence/patterns/objective-clarifier.d.ts +0 -22
- package/dist/core/intelligence/patterns/objective-clarifier.js +0 -126
- package/dist/core/intelligence/patterns/output-format-enforcer.d.ts +0 -22
- package/dist/core/intelligence/patterns/output-format-enforcer.js +0 -151
- package/dist/core/intelligence/patterns/prd-structure-enforcer.d.ts +0 -23
- package/dist/core/intelligence/patterns/prd-structure-enforcer.js +0 -183
- package/dist/core/intelligence/patterns/prerequisite-identifier.d.ts +0 -23
- package/dist/core/intelligence/patterns/prerequisite-identifier.js +0 -221
- package/dist/core/intelligence/patterns/requirement-prioritizer.d.ts +0 -24
- package/dist/core/intelligence/patterns/requirement-prioritizer.js +0 -134
- package/dist/core/intelligence/patterns/scope-definer.d.ts +0 -26
- package/dist/core/intelligence/patterns/scope-definer.js +0 -236
- package/dist/core/intelligence/patterns/step-decomposer.d.ts +0 -31
- package/dist/core/intelligence/patterns/step-decomposer.js +0 -242
- package/dist/core/intelligence/patterns/structure-organizer.d.ts +0 -31
- package/dist/core/intelligence/patterns/structure-organizer.js +0 -218
- package/dist/core/intelligence/patterns/success-criteria-enforcer.d.ts +0 -22
- package/dist/core/intelligence/patterns/success-criteria-enforcer.js +0 -165
- package/dist/core/intelligence/patterns/success-metrics-enforcer.d.ts +0 -24
- package/dist/core/intelligence/patterns/success-metrics-enforcer.js +0 -165
- package/dist/core/intelligence/patterns/technical-context-enricher.d.ts +0 -25
- package/dist/core/intelligence/patterns/technical-context-enricher.js +0 -165
- package/dist/core/intelligence/patterns/topic-coherence-analyzer.d.ts +0 -26
- package/dist/core/intelligence/patterns/topic-coherence-analyzer.js +0 -300
- package/dist/core/intelligence/patterns/user-persona-enricher.d.ts +0 -24
- package/dist/core/intelligence/patterns/user-persona-enricher.js +0 -141
- package/dist/core/intelligence/patterns/validation-checklist-creator.d.ts +0 -31
- package/dist/core/intelligence/patterns/validation-checklist-creator.js +0 -242
- package/dist/core/intelligence/quality-assessor.d.ts +0 -51
- package/dist/core/intelligence/quality-assessor.js +0 -505
- package/dist/core/intelligence/types.d.ts +0 -111
- package/dist/core/intelligence/types.js +0 -3
- package/dist/core/intelligence/universal-optimizer.d.ts +0 -84
- package/dist/core/intelligence/universal-optimizer.js +0 -371
- package/dist/core/prd-generator.d.ts +0 -76
- package/dist/core/prd-generator.js +0 -173
- package/dist/core/prompt-manager.d.ts +0 -110
- package/dist/core/prompt-manager.js +0 -274
- package/dist/core/prompt-optimizer.d.ts +0 -268
- package/dist/core/prompt-optimizer.js +0 -959
- package/dist/core/question-engine.d.ts +0 -167
- package/dist/core/question-engine.js +0 -356
- package/dist/core/session-manager.d.ts +0 -139
- package/dist/core/session-manager.js +0 -365
- package/dist/core/task-manager.d.ts +0 -211
- package/dist/core/task-manager.js +0 -981
- package/dist/core/verification-hooks.d.ts +0 -67
- package/dist/core/verification-hooks.js +0 -309
- package/dist/core/verification-manager.d.ts +0 -107
- package/dist/core/verification-manager.js +0 -415
- package/dist/index 2.js +0 -13
- package/dist/index.d 2.ts +0 -4
- package/dist/types/session.d.ts +0 -78
- package/dist/types/session.js +0 -8
- package/dist/types/verification.d.ts +0 -205
- package/dist/types/verification.js +0 -9
|
@@ -1,236 +0,0 @@
|
|
|
1
|
-
import { BasePattern, } from './base-pattern.js';
|
|
2
|
-
/**
|
|
3
|
-
* v4.5 Pattern: Scope Definer
|
|
4
|
-
*
|
|
5
|
-
* Adds explicit scope boundaries to prevent scope creep
|
|
6
|
-
* and clarify what is/isn't included.
|
|
7
|
-
*/
|
|
8
|
-
export class ScopeDefiner extends BasePattern {
|
|
9
|
-
// -------------------------------------------------------------------------
|
|
10
|
-
// Pattern Metadata (v4.5 unified types)
|
|
11
|
-
// -------------------------------------------------------------------------
|
|
12
|
-
id = 'scope-definer';
|
|
13
|
-
name = 'Scope Definer';
|
|
14
|
-
description = 'Add explicit scope boundaries to prevent scope creep';
|
|
15
|
-
applicableIntents = [
|
|
16
|
-
'code-generation',
|
|
17
|
-
'planning',
|
|
18
|
-
'prd-generation',
|
|
19
|
-
'migration',
|
|
20
|
-
'documentation',
|
|
21
|
-
];
|
|
22
|
-
scope = 'comprehensive';
|
|
23
|
-
priority = 5; // MEDIUM-LOW - supplementary
|
|
24
|
-
phases = ['all'];
|
|
25
|
-
// -------------------------------------------------------------------------
|
|
26
|
-
// Configuration Schema (v4.5)
|
|
27
|
-
// -------------------------------------------------------------------------
|
|
28
|
-
static configSchema = {
|
|
29
|
-
maxInScopeItems: {
|
|
30
|
-
type: 'number',
|
|
31
|
-
default: 5,
|
|
32
|
-
description: 'Maximum number of in-scope items to list',
|
|
33
|
-
validation: { min: 1, max: 10 },
|
|
34
|
-
},
|
|
35
|
-
maxOutOfScopeItems: {
|
|
36
|
-
type: 'number',
|
|
37
|
-
default: 5,
|
|
38
|
-
description: 'Maximum number of out-of-scope items to list',
|
|
39
|
-
validation: { min: 1, max: 10 },
|
|
40
|
-
},
|
|
41
|
-
};
|
|
42
|
-
// -------------------------------------------------------------------------
|
|
43
|
-
// Pattern Application
|
|
44
|
-
// -------------------------------------------------------------------------
|
|
45
|
-
apply(prompt, context) {
|
|
46
|
-
// Check if prompt already has scope definition
|
|
47
|
-
if (this.hasExistingScope(prompt)) {
|
|
48
|
-
return {
|
|
49
|
-
enhancedPrompt: prompt,
|
|
50
|
-
improvement: {
|
|
51
|
-
dimension: 'completeness',
|
|
52
|
-
description: 'Scope already defined',
|
|
53
|
-
impact: 'low',
|
|
54
|
-
},
|
|
55
|
-
applied: false,
|
|
56
|
-
};
|
|
57
|
-
}
|
|
58
|
-
const scope = this.defineScope(prompt, context.intent.primaryIntent);
|
|
59
|
-
const scopeSection = this.formatScopeSection(scope);
|
|
60
|
-
const enhancedPrompt = `${prompt}\n\n${scopeSection}`;
|
|
61
|
-
return {
|
|
62
|
-
enhancedPrompt,
|
|
63
|
-
improvement: {
|
|
64
|
-
dimension: 'completeness',
|
|
65
|
-
description: 'Added explicit scope boundaries',
|
|
66
|
-
impact: 'medium',
|
|
67
|
-
},
|
|
68
|
-
applied: true,
|
|
69
|
-
};
|
|
70
|
-
}
|
|
71
|
-
hasExistingScope(prompt) {
|
|
72
|
-
const scopeIndicators = [
|
|
73
|
-
'out of scope',
|
|
74
|
-
'not included',
|
|
75
|
-
'scope:',
|
|
76
|
-
'in scope',
|
|
77
|
-
'excluded',
|
|
78
|
-
'will not',
|
|
79
|
-
"won't include",
|
|
80
|
-
'not part of',
|
|
81
|
-
];
|
|
82
|
-
const lowerPrompt = prompt.toLowerCase();
|
|
83
|
-
return scopeIndicators.some((indicator) => lowerPrompt.includes(indicator));
|
|
84
|
-
}
|
|
85
|
-
defineScope(prompt, intent) {
|
|
86
|
-
const lowerPrompt = prompt.toLowerCase();
|
|
87
|
-
// Extract what's explicitly requested
|
|
88
|
-
const inScope = this.extractInScope(lowerPrompt, intent);
|
|
89
|
-
// Identify common out-of-scope items based on context
|
|
90
|
-
const outOfScope = this.identifyOutOfScope(lowerPrompt, intent);
|
|
91
|
-
// Identify boundaries
|
|
92
|
-
const boundaries = this.identifyBoundaries(lowerPrompt, intent);
|
|
93
|
-
return { inScope, outOfScope, boundaries };
|
|
94
|
-
}
|
|
95
|
-
extractInScope(prompt, intent) {
|
|
96
|
-
const inScope = [];
|
|
97
|
-
// Look for explicit requirements
|
|
98
|
-
const requirementPatterns = [
|
|
99
|
-
/(?:need|want|require|should have|must have)\s+(.+?)(?:\.|,|$)/gi,
|
|
100
|
-
/(?:create|build|implement|add)\s+(?:a\s+)?(.+?)(?:\.|,|$)/gi,
|
|
101
|
-
];
|
|
102
|
-
requirementPatterns.forEach((pattern) => {
|
|
103
|
-
let match;
|
|
104
|
-
while ((match = pattern.exec(prompt)) !== null) {
|
|
105
|
-
const requirement = match[1].trim();
|
|
106
|
-
if (requirement.length > 3 && requirement.length < 100) {
|
|
107
|
-
inScope.push(requirement);
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
});
|
|
111
|
-
// Intent-specific in-scope items
|
|
112
|
-
switch (intent) {
|
|
113
|
-
case 'code-generation':
|
|
114
|
-
if (this.hasSection(prompt, ['component', 'ui'])) {
|
|
115
|
-
inScope.push('Component implementation with specified functionality');
|
|
116
|
-
}
|
|
117
|
-
if (this.hasSection(prompt, ['api', 'endpoint'])) {
|
|
118
|
-
inScope.push('API endpoint implementation');
|
|
119
|
-
}
|
|
120
|
-
break;
|
|
121
|
-
case 'planning':
|
|
122
|
-
inScope.push('High-level architecture design');
|
|
123
|
-
inScope.push('Task breakdown and sequencing');
|
|
124
|
-
break;
|
|
125
|
-
case 'migration':
|
|
126
|
-
inScope.push('Data migration from source to target');
|
|
127
|
-
inScope.push('Functionality preservation');
|
|
128
|
-
break;
|
|
129
|
-
}
|
|
130
|
-
return [...new Set(inScope)].slice(0, 5);
|
|
131
|
-
}
|
|
132
|
-
identifyOutOfScope(prompt, intent) {
|
|
133
|
-
const outOfScope = [];
|
|
134
|
-
// Common out-of-scope items by intent
|
|
135
|
-
switch (intent) {
|
|
136
|
-
case 'code-generation':
|
|
137
|
-
outOfScope.push('Deployment and CI/CD configuration');
|
|
138
|
-
outOfScope.push('Production infrastructure setup');
|
|
139
|
-
if (!this.hasSection(prompt, ['test'])) {
|
|
140
|
-
outOfScope.push('Comprehensive test suite (basic tests only)');
|
|
141
|
-
}
|
|
142
|
-
if (!this.hasSection(prompt, ['doc', 'readme'])) {
|
|
143
|
-
outOfScope.push('Extensive documentation');
|
|
144
|
-
}
|
|
145
|
-
break;
|
|
146
|
-
case 'planning':
|
|
147
|
-
outOfScope.push('Actual implementation code');
|
|
148
|
-
outOfScope.push('Detailed technical specifications');
|
|
149
|
-
outOfScope.push('Resource allocation and team assignments');
|
|
150
|
-
break;
|
|
151
|
-
case 'migration':
|
|
152
|
-
outOfScope.push('New feature development');
|
|
153
|
-
outOfScope.push('Performance optimization beyond parity');
|
|
154
|
-
outOfScope.push('Refactoring unrelated code');
|
|
155
|
-
break;
|
|
156
|
-
case 'documentation':
|
|
157
|
-
outOfScope.push('Code implementation changes');
|
|
158
|
-
outOfScope.push('Architectural modifications');
|
|
159
|
-
break;
|
|
160
|
-
case 'prd-generation':
|
|
161
|
-
outOfScope.push('Technical implementation details');
|
|
162
|
-
outOfScope.push('Code or pseudocode');
|
|
163
|
-
outOfScope.push('Database schema design');
|
|
164
|
-
break;
|
|
165
|
-
}
|
|
166
|
-
// Domain-specific exclusions
|
|
167
|
-
if (this.hasSection(prompt, ['frontend', 'ui', 'component'])) {
|
|
168
|
-
if (!this.hasSection(prompt, ['backend', 'api', 'server'])) {
|
|
169
|
-
outOfScope.push('Backend/API implementation');
|
|
170
|
-
}
|
|
171
|
-
}
|
|
172
|
-
if (this.hasSection(prompt, ['backend', 'api', 'server'])) {
|
|
173
|
-
if (!this.hasSection(prompt, ['frontend', 'ui'])) {
|
|
174
|
-
outOfScope.push('Frontend/UI implementation');
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
-
return [...new Set(outOfScope)].slice(0, 5);
|
|
178
|
-
}
|
|
179
|
-
identifyBoundaries(prompt, intent) {
|
|
180
|
-
const boundaries = [];
|
|
181
|
-
// Technical boundaries
|
|
182
|
-
if (this.hasSection(prompt, ['component', 'module', 'service'])) {
|
|
183
|
-
boundaries.push('Limited to specified component/module boundaries');
|
|
184
|
-
}
|
|
185
|
-
// Integration boundaries
|
|
186
|
-
if (this.hasSection(prompt, ['integration', 'third-party', 'external'])) {
|
|
187
|
-
boundaries.push('External integrations assumed to be available and configured');
|
|
188
|
-
}
|
|
189
|
-
// Data boundaries
|
|
190
|
-
if (this.hasSection(prompt, ['database', 'data', 'storage'])) {
|
|
191
|
-
boundaries.push('Database schema assumed to exist or specified separately');
|
|
192
|
-
}
|
|
193
|
-
// Auth boundaries
|
|
194
|
-
if (this.hasSection(prompt, ['auth', 'user', 'login'])) {
|
|
195
|
-
boundaries.push('Authentication system assumed to be in place');
|
|
196
|
-
}
|
|
197
|
-
// Intent-specific boundaries
|
|
198
|
-
switch (intent) {
|
|
199
|
-
case 'code-generation':
|
|
200
|
-
boundaries.push('Following existing project conventions and patterns');
|
|
201
|
-
break;
|
|
202
|
-
case 'migration':
|
|
203
|
-
boundaries.push('Maintaining backward compatibility where specified');
|
|
204
|
-
break;
|
|
205
|
-
case 'testing':
|
|
206
|
-
boundaries.push('Testing within unit/integration test scope');
|
|
207
|
-
break;
|
|
208
|
-
}
|
|
209
|
-
return [...new Set(boundaries)].slice(0, 4);
|
|
210
|
-
}
|
|
211
|
-
formatScopeSection(scope) {
|
|
212
|
-
const lines = ['### Scope Definition', ''];
|
|
213
|
-
if (scope.inScope.length > 0) {
|
|
214
|
-
lines.push('**In Scope:**');
|
|
215
|
-
scope.inScope.forEach((item) => {
|
|
216
|
-
lines.push(`✓ ${item}`);
|
|
217
|
-
});
|
|
218
|
-
lines.push('');
|
|
219
|
-
}
|
|
220
|
-
if (scope.outOfScope.length > 0) {
|
|
221
|
-
lines.push('**Out of Scope:**');
|
|
222
|
-
scope.outOfScope.forEach((item) => {
|
|
223
|
-
lines.push(`✗ ${item}`);
|
|
224
|
-
});
|
|
225
|
-
lines.push('');
|
|
226
|
-
}
|
|
227
|
-
if (scope.boundaries.length > 0) {
|
|
228
|
-
lines.push('**Boundaries & Assumptions:**');
|
|
229
|
-
scope.boundaries.forEach((item) => {
|
|
230
|
-
lines.push(`• ${item}`);
|
|
231
|
-
});
|
|
232
|
-
}
|
|
233
|
-
return lines.join('\n');
|
|
234
|
-
}
|
|
235
|
-
}
|
|
236
|
-
//# sourceMappingURL=scope-definer.js.map
|
|
@@ -1,31 +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: Step-by-Step Decomposer
|
|
5
|
-
*
|
|
6
|
-
* Breaks complex prompts into clear sequential steps.
|
|
7
|
-
* Applicable in both fast and deep modes.
|
|
8
|
-
*/
|
|
9
|
-
export declare class StepDecomposer extends BasePattern {
|
|
10
|
-
readonly id = "step-decomposer";
|
|
11
|
-
readonly name = "Step-by-Step Decomposer";
|
|
12
|
-
readonly description = "Break complex prompts into clear sequential steps";
|
|
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 needsDecomposition;
|
|
20
|
-
private hasSteps;
|
|
21
|
-
private decompose;
|
|
22
|
-
private decomposeCodeGeneration;
|
|
23
|
-
private decomposePlanning;
|
|
24
|
-
private decomposeMigration;
|
|
25
|
-
private decomposeTesting;
|
|
26
|
-
private decomposeDebugging;
|
|
27
|
-
private decomposeDocumentation;
|
|
28
|
-
private decomposeGeneric;
|
|
29
|
-
private formatStepsSection;
|
|
30
|
-
}
|
|
31
|
-
//# sourceMappingURL=step-decomposer.d.ts.map
|
|
@@ -1,242 +0,0 @@
|
|
|
1
|
-
import { BasePattern, } from './base-pattern.js';
|
|
2
|
-
/**
|
|
3
|
-
* v4.5 Pattern: Step-by-Step Decomposer
|
|
4
|
-
*
|
|
5
|
-
* Breaks complex prompts into clear sequential steps.
|
|
6
|
-
* Applicable in both fast and deep modes.
|
|
7
|
-
*/
|
|
8
|
-
export class StepDecomposer extends BasePattern {
|
|
9
|
-
// -------------------------------------------------------------------------
|
|
10
|
-
// Pattern Metadata (v4.5 unified types)
|
|
11
|
-
// -------------------------------------------------------------------------
|
|
12
|
-
id = 'step-decomposer';
|
|
13
|
-
name = 'Step-by-Step Decomposer';
|
|
14
|
-
description = 'Break complex prompts into clear sequential steps';
|
|
15
|
-
applicableIntents = [
|
|
16
|
-
'code-generation',
|
|
17
|
-
'planning',
|
|
18
|
-
'migration',
|
|
19
|
-
'testing',
|
|
20
|
-
'debugging',
|
|
21
|
-
'documentation',
|
|
22
|
-
];
|
|
23
|
-
scope = 'both';
|
|
24
|
-
priority = 5; // MEDIUM-LOW - supplementary
|
|
25
|
-
phases = ['all'];
|
|
26
|
-
// -------------------------------------------------------------------------
|
|
27
|
-
// Configuration Schema (v4.5)
|
|
28
|
-
// -------------------------------------------------------------------------
|
|
29
|
-
static configSchema = {
|
|
30
|
-
minWordsForDecomposition: {
|
|
31
|
-
type: 'number',
|
|
32
|
-
default: 100,
|
|
33
|
-
description: 'Minimum word count before decomposition is applied',
|
|
34
|
-
validation: { min: 50, max: 500 },
|
|
35
|
-
},
|
|
36
|
-
};
|
|
37
|
-
// -------------------------------------------------------------------------
|
|
38
|
-
// Pattern Application
|
|
39
|
-
// -------------------------------------------------------------------------
|
|
40
|
-
apply(prompt, context) {
|
|
41
|
-
// Check if prompt is complex enough to benefit from decomposition
|
|
42
|
-
if (!this.needsDecomposition(prompt)) {
|
|
43
|
-
return {
|
|
44
|
-
enhancedPrompt: prompt,
|
|
45
|
-
improvement: {
|
|
46
|
-
dimension: 'structure',
|
|
47
|
-
description: 'Prompt is simple enough, no decomposition needed',
|
|
48
|
-
impact: 'low',
|
|
49
|
-
},
|
|
50
|
-
applied: false,
|
|
51
|
-
};
|
|
52
|
-
}
|
|
53
|
-
// Check if already has steps
|
|
54
|
-
if (this.hasSteps(prompt)) {
|
|
55
|
-
return {
|
|
56
|
-
enhancedPrompt: prompt,
|
|
57
|
-
improvement: {
|
|
58
|
-
dimension: 'structure',
|
|
59
|
-
description: 'Prompt already has step structure',
|
|
60
|
-
impact: 'low',
|
|
61
|
-
},
|
|
62
|
-
applied: false,
|
|
63
|
-
};
|
|
64
|
-
}
|
|
65
|
-
const steps = this.decompose(prompt, context.intent.primaryIntent);
|
|
66
|
-
if (steps.length < 2) {
|
|
67
|
-
return {
|
|
68
|
-
enhancedPrompt: prompt,
|
|
69
|
-
improvement: {
|
|
70
|
-
dimension: 'structure',
|
|
71
|
-
description: 'Could not identify multiple steps',
|
|
72
|
-
impact: 'low',
|
|
73
|
-
},
|
|
74
|
-
applied: false,
|
|
75
|
-
};
|
|
76
|
-
}
|
|
77
|
-
const stepsSection = this.formatStepsSection(steps);
|
|
78
|
-
const enhancedPrompt = `${prompt}\n\n${stepsSection}`;
|
|
79
|
-
return {
|
|
80
|
-
enhancedPrompt,
|
|
81
|
-
improvement: {
|
|
82
|
-
dimension: 'structure',
|
|
83
|
-
description: `Decomposed into ${steps.length} sequential steps`,
|
|
84
|
-
impact: 'high',
|
|
85
|
-
},
|
|
86
|
-
applied: true,
|
|
87
|
-
};
|
|
88
|
-
}
|
|
89
|
-
needsDecomposition(prompt) {
|
|
90
|
-
// Complex if:
|
|
91
|
-
// - Contains multiple actions (and, then, also, after)
|
|
92
|
-
// - Has multiple requirements listed
|
|
93
|
-
// - Is longer than 100 words
|
|
94
|
-
const wordCount = this.countWords(prompt);
|
|
95
|
-
const hasMultipleActions = /\b(and|then|also|after|next|finally|additionally)\b/gi.test(prompt);
|
|
96
|
-
const hasMultipleRequirements = (prompt.match(/[-•*]\s+/g) || []).length >= 2;
|
|
97
|
-
return wordCount > 100 || hasMultipleActions || hasMultipleRequirements;
|
|
98
|
-
}
|
|
99
|
-
hasSteps(prompt) {
|
|
100
|
-
// Check for existing step indicators
|
|
101
|
-
const stepPatterns = [
|
|
102
|
-
/step\s*[1-9]/i,
|
|
103
|
-
/^\s*[1-9]\.\s+/m,
|
|
104
|
-
/first[\s,].*second[\s,]/i,
|
|
105
|
-
/phase\s*[1-9]/i,
|
|
106
|
-
];
|
|
107
|
-
return stepPatterns.some((pattern) => pattern.test(prompt));
|
|
108
|
-
}
|
|
109
|
-
decompose(prompt, intent) {
|
|
110
|
-
const steps = [];
|
|
111
|
-
const lowerPrompt = prompt.toLowerCase();
|
|
112
|
-
// Intent-specific decomposition
|
|
113
|
-
switch (intent) {
|
|
114
|
-
case 'code-generation':
|
|
115
|
-
steps.push(...this.decomposeCodeGeneration(lowerPrompt));
|
|
116
|
-
break;
|
|
117
|
-
case 'planning':
|
|
118
|
-
steps.push(...this.decomposePlanning(lowerPrompt));
|
|
119
|
-
break;
|
|
120
|
-
case 'migration':
|
|
121
|
-
steps.push(...this.decomposeMigration(lowerPrompt));
|
|
122
|
-
break;
|
|
123
|
-
case 'testing':
|
|
124
|
-
steps.push(...this.decomposeTesting(lowerPrompt));
|
|
125
|
-
break;
|
|
126
|
-
case 'debugging':
|
|
127
|
-
steps.push(...this.decomposeDebugging(lowerPrompt));
|
|
128
|
-
break;
|
|
129
|
-
case 'documentation':
|
|
130
|
-
steps.push(...this.decomposeDocumentation(lowerPrompt));
|
|
131
|
-
break;
|
|
132
|
-
default:
|
|
133
|
-
steps.push(...this.decomposeGeneric(lowerPrompt));
|
|
134
|
-
}
|
|
135
|
-
return steps;
|
|
136
|
-
}
|
|
137
|
-
decomposeCodeGeneration(prompt) {
|
|
138
|
-
const steps = [];
|
|
139
|
-
// Standard code generation workflow
|
|
140
|
-
if (this.hasSection(prompt, ['component', 'ui', 'interface'])) {
|
|
141
|
-
steps.push({ description: 'Define component interface and props' });
|
|
142
|
-
steps.push({ description: 'Implement core component logic' });
|
|
143
|
-
steps.push({ description: 'Add styling and responsive design' });
|
|
144
|
-
steps.push({ description: 'Add error handling and edge cases' });
|
|
145
|
-
steps.push({ description: 'Write unit tests' });
|
|
146
|
-
}
|
|
147
|
-
else if (this.hasSection(prompt, ['api', 'endpoint', 'route'])) {
|
|
148
|
-
steps.push({ description: 'Define API contract (request/response)' });
|
|
149
|
-
steps.push({ description: 'Implement endpoint handler' });
|
|
150
|
-
steps.push({ description: 'Add input validation' });
|
|
151
|
-
steps.push({ description: 'Implement error handling' });
|
|
152
|
-
steps.push({ description: 'Add authentication/authorization if needed' });
|
|
153
|
-
steps.push({ description: 'Write tests' });
|
|
154
|
-
}
|
|
155
|
-
else if (this.hasSection(prompt, ['function', 'utility', 'helper'])) {
|
|
156
|
-
steps.push({ description: 'Define function signature and types' });
|
|
157
|
-
steps.push({ description: 'Implement core logic' });
|
|
158
|
-
steps.push({ description: 'Handle edge cases' });
|
|
159
|
-
steps.push({ description: 'Add documentation' });
|
|
160
|
-
steps.push({ description: 'Write tests' });
|
|
161
|
-
}
|
|
162
|
-
else {
|
|
163
|
-
steps.push({ description: 'Understand requirements and define interface' });
|
|
164
|
-
steps.push({ description: 'Implement core functionality' });
|
|
165
|
-
steps.push({ description: 'Add error handling' });
|
|
166
|
-
steps.push({ description: 'Test and validate' });
|
|
167
|
-
}
|
|
168
|
-
return steps;
|
|
169
|
-
}
|
|
170
|
-
decomposePlanning(_prompt) {
|
|
171
|
-
return [
|
|
172
|
-
{ description: 'Clarify goals and success criteria' },
|
|
173
|
-
{ description: 'Identify key components and dependencies' },
|
|
174
|
-
{ description: 'Define architecture and data flow' },
|
|
175
|
-
{ description: 'Break down into implementable tasks' },
|
|
176
|
-
{ description: 'Identify risks and mitigation strategies' },
|
|
177
|
-
{ description: 'Create timeline and milestones' },
|
|
178
|
-
];
|
|
179
|
-
}
|
|
180
|
-
decomposeMigration(_prompt) {
|
|
181
|
-
return [
|
|
182
|
-
{ description: 'Assess current state and document existing behavior' },
|
|
183
|
-
{ description: 'Define target state and requirements' },
|
|
184
|
-
{ description: 'Create migration plan with rollback strategy' },
|
|
185
|
-
{ description: 'Set up parallel environment for testing' },
|
|
186
|
-
{ description: 'Migrate data in stages' },
|
|
187
|
-
{ description: 'Validate functionality and performance' },
|
|
188
|
-
{ description: 'Switch traffic and monitor' },
|
|
189
|
-
{ description: 'Decommission old system after stabilization' },
|
|
190
|
-
];
|
|
191
|
-
}
|
|
192
|
-
decomposeTesting(_prompt) {
|
|
193
|
-
return [
|
|
194
|
-
{ description: 'Identify test cases from requirements' },
|
|
195
|
-
{ description: 'Set up test environment and fixtures' },
|
|
196
|
-
{ description: 'Write happy path tests' },
|
|
197
|
-
{ description: 'Write edge case tests' },
|
|
198
|
-
{ description: 'Write error scenario tests' },
|
|
199
|
-
{ description: 'Verify coverage meets requirements' },
|
|
200
|
-
{ description: 'Review and refactor tests for maintainability' },
|
|
201
|
-
];
|
|
202
|
-
}
|
|
203
|
-
decomposeDebugging(_prompt) {
|
|
204
|
-
return [
|
|
205
|
-
{ description: 'Reproduce the bug consistently' },
|
|
206
|
-
{ description: 'Gather error logs and stack traces' },
|
|
207
|
-
{ description: 'Isolate the problem area' },
|
|
208
|
-
{ description: 'Form hypothesis about root cause' },
|
|
209
|
-
{ description: 'Test hypothesis with targeted changes' },
|
|
210
|
-
{ description: 'Implement fix' },
|
|
211
|
-
{ description: 'Verify fix resolves issue without regression' },
|
|
212
|
-
{ description: 'Add test to prevent recurrence' },
|
|
213
|
-
];
|
|
214
|
-
}
|
|
215
|
-
decomposeDocumentation(_prompt) {
|
|
216
|
-
return [
|
|
217
|
-
{ description: 'Identify target audience and their needs' },
|
|
218
|
-
{ description: 'Outline document structure' },
|
|
219
|
-
{ description: 'Write introduction and overview' },
|
|
220
|
-
{ description: 'Document main content with examples' },
|
|
221
|
-
{ description: 'Add troubleshooting/FAQ section' },
|
|
222
|
-
{ description: 'Review for accuracy and clarity' },
|
|
223
|
-
];
|
|
224
|
-
}
|
|
225
|
-
decomposeGeneric(_prompt) {
|
|
226
|
-
return [
|
|
227
|
-
{ description: 'Understand and clarify requirements' },
|
|
228
|
-
{ description: 'Plan approach and identify dependencies' },
|
|
229
|
-
{ description: 'Execute main task' },
|
|
230
|
-
{ description: 'Validate results' },
|
|
231
|
-
{ description: 'Document and finalize' },
|
|
232
|
-
];
|
|
233
|
-
}
|
|
234
|
-
formatStepsSection(steps) {
|
|
235
|
-
const lines = ['### Implementation Steps', ''];
|
|
236
|
-
steps.forEach((step, index) => {
|
|
237
|
-
lines.push(`${index + 1}. ${step.description}`);
|
|
238
|
-
});
|
|
239
|
-
return lines.join('\n');
|
|
240
|
-
}
|
|
241
|
-
}
|
|
242
|
-
//# sourceMappingURL=step-decomposer.js.map
|
|
@@ -1,31 +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: Structure Organizer
|
|
5
|
-
*
|
|
6
|
-
* Reorders information logically following the flow:
|
|
7
|
-
* Objective → Requirements → Technical Constraints → Expected Output → Success Criteria
|
|
8
|
-
*/
|
|
9
|
-
export declare class StructureOrganizer extends BasePattern {
|
|
10
|
-
readonly id = "structure-organizer";
|
|
11
|
-
readonly name = "Structure Organizer";
|
|
12
|
-
readonly description = "Reorders information into logical sections";
|
|
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 detectSections;
|
|
20
|
-
private isWellOrdered;
|
|
21
|
-
private isDisorganized;
|
|
22
|
-
private extractObjective;
|
|
23
|
-
private extractRequirements;
|
|
24
|
-
private extractTechnical;
|
|
25
|
-
private extractExpectedOutput;
|
|
26
|
-
private extractSuccessCriteria;
|
|
27
|
-
private extractConstraints;
|
|
28
|
-
private extractOther;
|
|
29
|
-
private addSectionHeaders;
|
|
30
|
-
}
|
|
31
|
-
//# sourceMappingURL=structure-organizer.d.ts.map
|