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,221 +0,0 @@
|
|
|
1
|
-
import { BasePattern, } from './base-pattern.js';
|
|
2
|
-
/**
|
|
3
|
-
* v4.5 Pattern: Completeness Validator
|
|
4
|
-
*
|
|
5
|
-
* Ensures all necessary requirements are present.
|
|
6
|
-
* Adds placeholder sections for missing critical elements.
|
|
7
|
-
*/
|
|
8
|
-
export class CompletenessValidator extends BasePattern {
|
|
9
|
-
// -------------------------------------------------------------------------
|
|
10
|
-
// Pattern Metadata (v4.5 unified types)
|
|
11
|
-
// -------------------------------------------------------------------------
|
|
12
|
-
id = 'completeness-validator';
|
|
13
|
-
name = 'Completeness Validator';
|
|
14
|
-
description = 'Ensures all necessary requirements are present';
|
|
15
|
-
applicableIntents = ['code-generation', 'planning', 'refinement'];
|
|
16
|
-
scope = 'both';
|
|
17
|
-
priority = 6; // MEDIUM - standard enhancement
|
|
18
|
-
phases = ['all'];
|
|
19
|
-
// -------------------------------------------------------------------------
|
|
20
|
-
// Configuration Schema (v4.5)
|
|
21
|
-
// -------------------------------------------------------------------------
|
|
22
|
-
static configSchema = {
|
|
23
|
-
showCompletenessScore: {
|
|
24
|
-
type: 'boolean',
|
|
25
|
-
default: true,
|
|
26
|
-
description: 'Display completeness percentage in output',
|
|
27
|
-
},
|
|
28
|
-
minCompletenessThreshold: {
|
|
29
|
-
type: 'number',
|
|
30
|
-
default: 60,
|
|
31
|
-
description: 'Minimum completeness percentage to consider prompt adequate',
|
|
32
|
-
validation: { min: 0, max: 100 },
|
|
33
|
-
},
|
|
34
|
-
};
|
|
35
|
-
// -------------------------------------------------------------------------
|
|
36
|
-
// Pattern Application
|
|
37
|
-
// -------------------------------------------------------------------------
|
|
38
|
-
apply(prompt, _context) {
|
|
39
|
-
const missing = this.findMissingElements(prompt);
|
|
40
|
-
if (missing.length === 0) {
|
|
41
|
-
return {
|
|
42
|
-
enhancedPrompt: prompt,
|
|
43
|
-
improvement: {
|
|
44
|
-
dimension: 'completeness',
|
|
45
|
-
description: 'All required elements present',
|
|
46
|
-
impact: 'low',
|
|
47
|
-
},
|
|
48
|
-
applied: false,
|
|
49
|
-
};
|
|
50
|
-
}
|
|
51
|
-
// Calculate completeness score
|
|
52
|
-
const totalElements = 5;
|
|
53
|
-
const presentElements = totalElements - missing.length;
|
|
54
|
-
const score = Math.round((presentElements / totalElements) * 100);
|
|
55
|
-
let enhanced = prompt + '\n\n';
|
|
56
|
-
// Add missing elements section
|
|
57
|
-
enhanced += '---\n\n';
|
|
58
|
-
enhanced += `**Completeness Check**: ${score}% (${presentElements}/${totalElements} elements present)\n\n`;
|
|
59
|
-
enhanced += '**Missing Information** (please specify):\n\n';
|
|
60
|
-
for (const element of missing) {
|
|
61
|
-
enhanced += this.getMissingElementPrompt(element) + '\n';
|
|
62
|
-
}
|
|
63
|
-
const result = enhanced.trim();
|
|
64
|
-
return {
|
|
65
|
-
enhancedPrompt: result,
|
|
66
|
-
improvement: {
|
|
67
|
-
dimension: 'completeness',
|
|
68
|
-
description: `Added ${missing.length} missing element prompts (${score}% complete)`,
|
|
69
|
-
impact: missing.length >= 3 ? 'high' : missing.length >= 2 ? 'medium' : 'low',
|
|
70
|
-
},
|
|
71
|
-
applied: true,
|
|
72
|
-
};
|
|
73
|
-
}
|
|
74
|
-
findMissingElements(prompt) {
|
|
75
|
-
const missing = [];
|
|
76
|
-
const lowerPrompt = prompt.toLowerCase();
|
|
77
|
-
// Check for objective/goal
|
|
78
|
-
if (!this.hasObjective(lowerPrompt)) {
|
|
79
|
-
missing.push('objective');
|
|
80
|
-
}
|
|
81
|
-
// Check for tech stack
|
|
82
|
-
if (!this.hasTechStack(lowerPrompt)) {
|
|
83
|
-
missing.push('tech-stack');
|
|
84
|
-
}
|
|
85
|
-
// Check for success criteria
|
|
86
|
-
if (!this.hasSuccessCriteria(lowerPrompt)) {
|
|
87
|
-
missing.push('success-criteria');
|
|
88
|
-
}
|
|
89
|
-
// Check for constraints
|
|
90
|
-
if (!this.hasConstraints(lowerPrompt)) {
|
|
91
|
-
missing.push('constraints');
|
|
92
|
-
}
|
|
93
|
-
// Check for output format
|
|
94
|
-
if (!this.hasOutputFormat(lowerPrompt)) {
|
|
95
|
-
missing.push('output-format');
|
|
96
|
-
}
|
|
97
|
-
return missing;
|
|
98
|
-
}
|
|
99
|
-
hasObjective(prompt) {
|
|
100
|
-
const objectivePatterns = [
|
|
101
|
-
'objective',
|
|
102
|
-
'goal',
|
|
103
|
-
'purpose',
|
|
104
|
-
'need to',
|
|
105
|
-
'want to',
|
|
106
|
-
'trying to',
|
|
107
|
-
'aim',
|
|
108
|
-
'intend',
|
|
109
|
-
];
|
|
110
|
-
return objectivePatterns.some((pattern) => prompt.includes(pattern));
|
|
111
|
-
}
|
|
112
|
-
hasTechStack(prompt) {
|
|
113
|
-
const techPatterns = [
|
|
114
|
-
// Languages
|
|
115
|
-
'javascript',
|
|
116
|
-
'typescript',
|
|
117
|
-
'python',
|
|
118
|
-
'java',
|
|
119
|
-
'rust',
|
|
120
|
-
'go',
|
|
121
|
-
'php',
|
|
122
|
-
'ruby',
|
|
123
|
-
'swift',
|
|
124
|
-
'kotlin',
|
|
125
|
-
'c++',
|
|
126
|
-
'c#',
|
|
127
|
-
// Frameworks
|
|
128
|
-
'react',
|
|
129
|
-
'vue',
|
|
130
|
-
'angular',
|
|
131
|
-
'svelte',
|
|
132
|
-
'next',
|
|
133
|
-
'nuxt',
|
|
134
|
-
'express',
|
|
135
|
-
'fastapi',
|
|
136
|
-
'django',
|
|
137
|
-
'flask',
|
|
138
|
-
'spring',
|
|
139
|
-
'rails',
|
|
140
|
-
// Databases
|
|
141
|
-
'postgres',
|
|
142
|
-
'mysql',
|
|
143
|
-
'mongodb',
|
|
144
|
-
'redis',
|
|
145
|
-
'sqlite',
|
|
146
|
-
// Tools
|
|
147
|
-
'docker',
|
|
148
|
-
'kubernetes',
|
|
149
|
-
'aws',
|
|
150
|
-
'azure',
|
|
151
|
-
'gcp',
|
|
152
|
-
// Generic
|
|
153
|
-
'tech stack',
|
|
154
|
-
'technology',
|
|
155
|
-
'framework',
|
|
156
|
-
'library',
|
|
157
|
-
'using',
|
|
158
|
-
'built with',
|
|
159
|
-
];
|
|
160
|
-
return techPatterns.some((pattern) => prompt.includes(pattern));
|
|
161
|
-
}
|
|
162
|
-
hasSuccessCriteria(prompt) {
|
|
163
|
-
const successPatterns = [
|
|
164
|
-
'success',
|
|
165
|
-
'criteria',
|
|
166
|
-
'measure',
|
|
167
|
-
'metric',
|
|
168
|
-
'kpi',
|
|
169
|
-
'should work',
|
|
170
|
-
'expected to',
|
|
171
|
-
'result in',
|
|
172
|
-
'achieve',
|
|
173
|
-
];
|
|
174
|
-
return successPatterns.some((pattern) => prompt.includes(pattern));
|
|
175
|
-
}
|
|
176
|
-
hasConstraints(prompt) {
|
|
177
|
-
const constraintPatterns = [
|
|
178
|
-
'constraint',
|
|
179
|
-
'limit',
|
|
180
|
-
'limitation',
|
|
181
|
-
'must not',
|
|
182
|
-
'cannot',
|
|
183
|
-
'should not',
|
|
184
|
-
'avoid',
|
|
185
|
-
'within',
|
|
186
|
-
'budget',
|
|
187
|
-
'time',
|
|
188
|
-
'deadline',
|
|
189
|
-
];
|
|
190
|
-
return constraintPatterns.some((pattern) => prompt.includes(pattern));
|
|
191
|
-
}
|
|
192
|
-
hasOutputFormat(prompt) {
|
|
193
|
-
const outputPatterns = [
|
|
194
|
-
'output',
|
|
195
|
-
'format',
|
|
196
|
-
'return',
|
|
197
|
-
'result',
|
|
198
|
-
'deliverable',
|
|
199
|
-
'component',
|
|
200
|
-
'function',
|
|
201
|
-
'class',
|
|
202
|
-
'api',
|
|
203
|
-
'endpoint',
|
|
204
|
-
'file',
|
|
205
|
-
'document',
|
|
206
|
-
'report',
|
|
207
|
-
];
|
|
208
|
-
return outputPatterns.some((pattern) => prompt.includes(pattern));
|
|
209
|
-
}
|
|
210
|
-
getMissingElementPrompt(element) {
|
|
211
|
-
const prompts = {
|
|
212
|
-
objective: '- **Objective**: What is the primary goal? What problem are you solving?',
|
|
213
|
-
'tech-stack': '- **Tech Stack**: Which technologies/frameworks? (e.g., React, Node.js, PostgreSQL)',
|
|
214
|
-
'success-criteria': '- **Success Criteria**: How will you know it works? What metrics matter?',
|
|
215
|
-
constraints: '- **Constraints**: Any limitations? (time, budget, performance, compatibility)',
|
|
216
|
-
'output-format': '- **Expected Output**: What should the result look like? (component, API, file, etc.)',
|
|
217
|
-
};
|
|
218
|
-
return prompts[element] || `- **${element}**: Please specify`;
|
|
219
|
-
}
|
|
220
|
-
}
|
|
221
|
-
//# sourceMappingURL=completeness-validator.js.map
|
|
@@ -1,20 +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: Conciseness Filter
|
|
5
|
-
*
|
|
6
|
-
* Removes unnecessary pleasantries, fluff words, and redundancy
|
|
7
|
-
* to make prompts more direct and efficient.
|
|
8
|
-
*/
|
|
9
|
-
export declare class ConcisenessFilter extends BasePattern {
|
|
10
|
-
readonly id = "conciseness-filter";
|
|
11
|
-
readonly name = "Conciseness Filter";
|
|
12
|
-
readonly description = "Removes unnecessary pleasantries, fluff words, and redundancy";
|
|
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
|
-
}
|
|
20
|
-
//# sourceMappingURL=conciseness-filter.d.ts.map
|
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
import { BasePattern, } from './base-pattern.js';
|
|
2
|
-
/**
|
|
3
|
-
* v4.5 Pattern: Conciseness Filter
|
|
4
|
-
*
|
|
5
|
-
* Removes unnecessary pleasantries, fluff words, and redundancy
|
|
6
|
-
* to make prompts more direct and efficient.
|
|
7
|
-
*/
|
|
8
|
-
export class ConcisenessFilter extends BasePattern {
|
|
9
|
-
// -------------------------------------------------------------------------
|
|
10
|
-
// Pattern Metadata (v4.5 unified types)
|
|
11
|
-
// -------------------------------------------------------------------------
|
|
12
|
-
id = 'conciseness-filter';
|
|
13
|
-
name = 'Conciseness Filter';
|
|
14
|
-
description = 'Removes unnecessary pleasantries, fluff words, and redundancy';
|
|
15
|
-
applicableIntents = [
|
|
16
|
-
'code-generation',
|
|
17
|
-
'planning',
|
|
18
|
-
'refinement',
|
|
19
|
-
'debugging',
|
|
20
|
-
'documentation',
|
|
21
|
-
];
|
|
22
|
-
scope = 'both';
|
|
23
|
-
priority = 4; // LOW - Polish phase
|
|
24
|
-
phases = ['all'];
|
|
25
|
-
// -------------------------------------------------------------------------
|
|
26
|
-
// Configuration Schema (v4.5)
|
|
27
|
-
// -------------------------------------------------------------------------
|
|
28
|
-
static configSchema = {
|
|
29
|
-
fluffThreshold: {
|
|
30
|
-
type: 'number',
|
|
31
|
-
default: 3,
|
|
32
|
-
description: 'Number of fluff words to tolerate before applying filter',
|
|
33
|
-
validation: { min: 1, max: 10 },
|
|
34
|
-
},
|
|
35
|
-
preserveTechnicalTerms: {
|
|
36
|
-
type: 'boolean',
|
|
37
|
-
default: true,
|
|
38
|
-
description: 'Keep technical terms even if they appear verbose',
|
|
39
|
-
},
|
|
40
|
-
};
|
|
41
|
-
// -------------------------------------------------------------------------
|
|
42
|
-
// Pattern Application
|
|
43
|
-
// -------------------------------------------------------------------------
|
|
44
|
-
apply(prompt, _context) {
|
|
45
|
-
const settings = this.getSettings();
|
|
46
|
-
const fluffThreshold = settings.fluffThreshold ?? 3;
|
|
47
|
-
let cleaned = prompt;
|
|
48
|
-
let changesCount = 0;
|
|
49
|
-
// Remove pleasantries at start
|
|
50
|
-
const pleasantries = [
|
|
51
|
-
/^(please|could you|would you mind|I would appreciate if you could|kindly)\s+/gi,
|
|
52
|
-
/thank you/gi,
|
|
53
|
-
/thanks in advance/gi,
|
|
54
|
-
/I appreciate your help/gi,
|
|
55
|
-
];
|
|
56
|
-
for (const pattern of pleasantries) {
|
|
57
|
-
const before = cleaned;
|
|
58
|
-
cleaned = cleaned.replace(pattern, '');
|
|
59
|
-
if (before !== cleaned)
|
|
60
|
-
changesCount++;
|
|
61
|
-
}
|
|
62
|
-
// Remove fluff words
|
|
63
|
-
const fluffWords = ['very', 'really', 'just', 'basically', 'simply', 'actually', 'literally'];
|
|
64
|
-
for (const word of fluffWords) {
|
|
65
|
-
const regex = new RegExp(`\\b${word}\\b`, 'gi');
|
|
66
|
-
const before = cleaned;
|
|
67
|
-
cleaned = cleaned.replace(regex, '');
|
|
68
|
-
if (before !== cleaned)
|
|
69
|
-
changesCount++;
|
|
70
|
-
}
|
|
71
|
-
// Remove redundant phrases
|
|
72
|
-
cleaned = cleaned.replace(/in order to/gi, 'to');
|
|
73
|
-
cleaned = cleaned.replace(/at this point in time/gi, 'now');
|
|
74
|
-
cleaned = cleaned.replace(/due to the fact that/gi, 'because');
|
|
75
|
-
cleaned = cleaned.replace(/for the purpose of/gi, 'for');
|
|
76
|
-
cleaned = cleaned.replace(/in the event that/gi, 'if');
|
|
77
|
-
// Clean up extra whitespace
|
|
78
|
-
cleaned = this.cleanWhitespace(cleaned);
|
|
79
|
-
// Only apply if changes exceed threshold
|
|
80
|
-
const applied = changesCount >= fluffThreshold || cleaned !== prompt;
|
|
81
|
-
return {
|
|
82
|
-
enhancedPrompt: applied ? cleaned : prompt,
|
|
83
|
-
improvement: {
|
|
84
|
-
dimension: 'efficiency',
|
|
85
|
-
description: `Removed ${changesCount} unnecessary phrases for conciseness`,
|
|
86
|
-
impact: changesCount > 3 ? 'high' : changesCount > 1 ? 'medium' : 'low',
|
|
87
|
-
},
|
|
88
|
-
applied,
|
|
89
|
-
};
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
//# sourceMappingURL=conciseness-filter.js.map
|
|
@@ -1,32 +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: Context Precision Booster
|
|
5
|
-
*
|
|
6
|
-
* Adds precise context when missing to ensure
|
|
7
|
-
* the AI has sufficient information for accurate responses.
|
|
8
|
-
*/
|
|
9
|
-
export declare class ContextPrecisionBooster extends BasePattern {
|
|
10
|
-
readonly id = "context-precision";
|
|
11
|
-
readonly name = "Context Precision Booster";
|
|
12
|
-
readonly description = "Add precise context when missing";
|
|
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 identifyMissingContext;
|
|
20
|
-
private checkGeneralContext;
|
|
21
|
-
private checkCodeGenerationContext;
|
|
22
|
-
private checkDebuggingContext;
|
|
23
|
-
private checkCodeReviewContext;
|
|
24
|
-
private checkRefactoringContext;
|
|
25
|
-
private checkTestingContext;
|
|
26
|
-
private checkMigrationContext;
|
|
27
|
-
private checkSecurityContext;
|
|
28
|
-
private hasVersionNumber;
|
|
29
|
-
private deduplicateGaps;
|
|
30
|
-
private formatContextSection;
|
|
31
|
-
}
|
|
32
|
-
//# sourceMappingURL=context-precision.d.ts.map
|