clavix 4.2.0 → 4.3.1

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 (25) hide show
  1. package/dist/cli/commands/deep.js +4 -58
  2. package/dist/cli/commands/init.js +13 -16
  3. package/dist/cli/commands/plan.js +2 -2
  4. package/dist/core/task-manager.d.ts +1 -2
  5. package/dist/core/task-manager.js +21 -26
  6. package/dist/templates/slash-commands/_canonical/deep.md +37 -70
  7. package/dist/templates/slash-commands/_components/sections/pattern-visibility.md +1 -1
  8. package/package.json +2 -2
  9. package/dist/templates/instructions/README 2.md +0 -311
  10. package/dist/templates/instructions/core 2/clavix-mode.md +0 -275
  11. package/dist/templates/instructions/core 2/file-operations.md +0 -330
  12. package/dist/templates/instructions/core 2/verification.md +0 -377
  13. package/dist/templates/instructions/troubleshooting 2/jumped-to-implementation.md +0 -234
  14. package/dist/templates/instructions/troubleshooting 2/mode-confusion.md +0 -402
  15. package/dist/templates/instructions/troubleshooting 2/skipped-file-creation.md +0 -385
  16. package/dist/templates/slash-commands/_canonical 2/archive.md +0 -410
  17. package/dist/templates/slash-commands/_canonical 2/deep.md +0 -512
  18. package/dist/templates/slash-commands/_canonical 2/execute.md +0 -80
  19. package/dist/templates/slash-commands/_canonical 2/fast.md +0 -370
  20. package/dist/templates/slash-commands/_canonical 2/implement.md +0 -364
  21. package/dist/templates/slash-commands/_canonical 2/plan.md +0 -329
  22. package/dist/templates/slash-commands/_canonical 2/prd.md +0 -320
  23. package/dist/templates/slash-commands/_canonical 2/prompts.md +0 -97
  24. package/dist/templates/slash-commands/_canonical 2/start.md +0 -204
  25. package/dist/templates/slash-commands/_canonical 2/summarize.md +0 -395
@@ -87,64 +87,13 @@ export default class Deep extends Command {
87
87
  console.log();
88
88
  }
89
89
  // ===== Enhanced Prompt =====
90
+ // Note: Pattern-generated content (Alternative Approaches, Edge Cases, Validation Checklist)
91
+ // is already embedded in result.enhanced by deep mode patterns
90
92
  console.log(chalk.bold.cyan('✨ Enhanced Prompt:\n'));
91
93
  console.log(chalk.dim('─'.repeat(80)));
92
94
  console.log(result.enhanced);
93
95
  console.log(chalk.dim('─'.repeat(80)));
94
96
  console.log();
95
- // ===== DEEP MODE EXCLUSIVE FEATURES =====
96
- // Alternative Approaches (TODO: when AlternativePhrasingGenerator pattern is implemented)
97
- console.log(chalk.bold.cyan('🎨 Alternative Approaches:\n'));
98
- console.log(chalk.cyan(' 1. Functional Decomposition: Break the task into smaller, testable functions'));
99
- console.log(chalk.cyan(' 2. Test-Driven Approach: Write tests first, then implement to satisfy them'));
100
- console.log(chalk.cyan(' 3. Example-Driven: Start with concrete input/output examples'));
101
- console.log(chalk.gray(' Note: Full alternative generation coming soon with deep mode patterns\n'));
102
- // Alternative Structures (TODO: when StructureVariationGenerator pattern is implemented)
103
- console.log(chalk.bold.cyan('📋 Alternative Structures:\n'));
104
- console.log(chalk.cyan(' Step-by-step:'));
105
- console.log(chalk.gray(' • Break complex task into sequential steps'));
106
- console.log(chalk.gray(' • Each step has clear input/output'));
107
- console.log(chalk.cyan(' Template-based:'));
108
- console.log(chalk.gray(' • Provide code/document template to fill'));
109
- console.log(chalk.gray(' • Reduces ambiguity with concrete structure'));
110
- console.log(chalk.cyan(' Example-driven:'));
111
- console.log(chalk.gray(' • Show concrete examples of desired output'));
112
- console.log(chalk.gray(' • AI learns from patterns in examples\n'));
113
- // Validation Checklist (TODO: when ValidationChecklistCreator pattern is implemented)
114
- console.log(chalk.bold.yellow('✅ Validation Checklist:\n'));
115
- console.log(chalk.yellow(' Before considering this task complete, verify:'));
116
- console.log(chalk.yellow(' ☐ Requirements match the objective stated above'));
117
- console.log(chalk.yellow(' ☐ All edge cases are handled (empty, null, invalid inputs)'));
118
- console.log(chalk.yellow(' ☐ Error handling is appropriate for the context'));
119
- console.log(chalk.yellow(' ☐ Output format matches specifications'));
120
- console.log(chalk.yellow(' ☐ Performance is acceptable for expected input sizes'));
121
- if (result.intent.primaryIntent === 'code-generation') {
122
- console.log(chalk.yellow(' ☐ Code is testable and maintainable'));
123
- console.log(chalk.yellow(' ☐ Security considerations addressed (injection, XSS, etc.)'));
124
- }
125
- console.log();
126
- // Edge Cases (TODO: when EdgeCaseIdentifier pattern is implemented)
127
- console.log(chalk.bold.yellow('⚠️ Edge Cases to Consider:\n'));
128
- if (result.intent.primaryIntent === 'code-generation') {
129
- console.log(chalk.yellow(' • Empty or null inputs'));
130
- console.log(chalk.yellow(' • Very large inputs (performance implications)'));
131
- console.log(chalk.yellow(' • Invalid or malformed data'));
132
- console.log(chalk.yellow(' • Concurrent access (if applicable)'));
133
- console.log(chalk.yellow(' • Network failures or timeouts (if I/O involved)'));
134
- }
135
- else if (result.intent.primaryIntent === 'planning') {
136
- console.log(chalk.yellow(' • Scope creep during implementation'));
137
- console.log(chalk.yellow(' • Technical constraints not identified upfront'));
138
- console.log(chalk.yellow(' • Timeline assumptions that may not hold'));
139
- console.log(chalk.yellow(' • Dependencies on external systems'));
140
- }
141
- else {
142
- console.log(chalk.yellow(' • Unexpected user behavior'));
143
- console.log(chalk.yellow(' • Error conditions and recovery'));
144
- console.log(chalk.yellow(' • Resource limitations'));
145
- console.log(chalk.yellow(' • Compatibility across environments'));
146
- }
147
- console.log();
148
97
  // Patterns Applied
149
98
  if (result.appliedPatterns.length > 0) {
150
99
  console.log(chalk.bold.blue('🧩 Patterns Applied:\n'));
@@ -168,7 +117,7 @@ export default class Deep extends Command {
168
117
  console.log(chalk.blue(` ${recommendation}\n`));
169
118
  }
170
119
  console.log(chalk.gray(`⚡ Processed in ${result.processingTimeMs}ms\n`));
171
- console.log(chalk.gray('💡 Tip: Use the enhanced prompt with the validation checklist and edge cases in mind\n'));
120
+ console.log(chalk.gray('💡 Tip: The enhanced prompt above includes alternative approaches, edge cases, and validation checklist\n'));
172
121
  }
173
122
  displayAnalysisOnly(result) {
174
123
  console.log(chalk.bold.cyan('🎯 Intent Analysis:\n'));
@@ -198,9 +147,6 @@ export default class Deep extends Command {
198
147
  async savePrompt(result) {
199
148
  try {
200
149
  const manager = new PromptManager();
201
- const timestamp = new Date().toISOString().replace(/[:.]/g, '-').slice(0, -5);
202
- const hash = this.generateShortHash(result.original);
203
- const filename = `deep-${timestamp}-${hash}`;
204
150
  // Format enhanced prompt as content
205
151
  const content = result.enhanced;
206
152
  await manager.savePrompt(content, 'deep', result.original);
@@ -215,7 +161,7 @@ export default class Deep extends Command {
215
161
  let hash = 0;
216
162
  for (let i = 0; i < text.length; i++) {
217
163
  const char = text.charCodeAt(i);
218
- hash = ((hash << 5) - hash) + char;
164
+ hash = (hash << 5) - hash + char;
219
165
  hash = hash & hash;
220
166
  }
221
167
  return Math.abs(hash).toString(16).slice(0, 4);
@@ -17,9 +17,7 @@ import { loadCommandTemplates } from '../../utils/template-loader.js';
17
17
  import { collectLegacyCommandFiles } from '../../utils/legacy-command-cleanup.js';
18
18
  export default class Init extends Command {
19
19
  static description = 'Initialize Clavix in the current project';
20
- static examples = [
21
- '<%= config.bin %> <%= command.id %>',
22
- ];
20
+ static examples = ['<%= config.bin %> <%= command.id %>'];
23
21
  async run() {
24
22
  console.log(chalk.bold.cyan('\n🚀 Clavix Initialization\n'));
25
23
  try {
@@ -47,7 +45,7 @@ export default class Init extends Command {
47
45
  const config = JSON.parse(configContent);
48
46
  existingIntegrations = config.integrations || config.providers || [];
49
47
  }
50
- catch (error) {
48
+ catch {
51
49
  // Ignore parse errors, will use empty array
52
50
  }
53
51
  }
@@ -161,9 +159,10 @@ export default class Init extends Command {
161
159
  },
162
160
  ]);
163
161
  if (!useNamespace) {
164
- adapter = adapter.name === 'gemini'
165
- ? new GeminiAdapter({ useNamespace: false })
166
- : new QwenAdapter({ useNamespace: false });
162
+ adapter =
163
+ adapter.name === 'gemini'
164
+ ? new GeminiAdapter({ useNamespace: false })
165
+ : new QwenAdapter({ useNamespace: false });
167
166
  console.log(chalk.gray(` → Using ${adapter.getCommandPath()} (no namespacing)`));
168
167
  }
169
168
  }
@@ -235,19 +234,17 @@ export default class Init extends Command {
235
234
  catch (error) {
236
235
  const { getErrorMessage, toError } = await import('../../utils/error-utils.js');
237
236
  console.error(chalk.red('\n✗ Initialization failed:'), getErrorMessage(error));
238
- if (error && typeof error === 'object' && 'hint' in error && typeof error.hint === 'string') {
237
+ if (error &&
238
+ typeof error === 'object' &&
239
+ 'hint' in error &&
240
+ typeof error.hint === 'string') {
239
241
  console.error(chalk.yellow(' Hint:'), error.hint);
240
242
  }
241
243
  throw toError(error);
242
244
  }
243
245
  }
244
246
  async createDirectoryStructure() {
245
- const dirs = [
246
- '.clavix',
247
- '.clavix/sessions',
248
- '.clavix/outputs',
249
- '.clavix/templates',
250
- ];
247
+ const dirs = ['.clavix', '.clavix/sessions', '.clavix/outputs', '.clavix/templates'];
251
248
  for (const dir of dirs) {
252
249
  await FileSystem.ensureDir(dir);
253
250
  }
@@ -289,8 +286,8 @@ Welcome to Clavix! This directory contains your local Clavix configuration and d
289
286
  ## CLI Commands Reference
290
287
 
291
288
  ### Prompt Improvement
292
- - \`clavix fast "<prompt>"\` - Quick CLEAR (C/L/E) improvements with smart triage
293
- - \`clavix deep "<prompt>"\` - Comprehensive CLEAR (C/L/E/A/R) analysis with alternatives
289
+ - \`clavix fast "<prompt>"\` - Quick Clavix Intelligence improvements with smart triage
290
+ - \`clavix deep "<prompt>"\` - Comprehensive Clavix Intelligence analysis with alternatives
294
291
  - \`clavix execute [--latest]\` - Execute saved prompts from fast/deep optimization
295
292
  - \`clavix prompts list\` - View all saved prompts with status (NEW/EXECUTED/OLD/STALE)
296
293
  - \`clavix prompts clear\` - Cleanup prompts (\`--executed\`, \`--stale\`, \`--fast\`, \`--deep\`, \`--all\`)
@@ -80,7 +80,7 @@ export default class Plan extends Command {
80
80
  const resolvedProjectName = projectName ?? path.basename(prdPath);
81
81
  // Check if tasks.md already exists
82
82
  const tasksPath = path.join(prdPath, 'tasks.md');
83
- if (await fs.pathExists(tasksPath) && !flags.overwrite) {
83
+ if ((await fs.pathExists(tasksPath)) && !flags.overwrite) {
84
84
  console.log(chalk.yellow('Warning: tasks.md already exists.'));
85
85
  console.log(chalk.gray(`Location: ${tasksPath}`));
86
86
  console.log(chalk.gray('Use --overwrite to regenerate tasks.md.\n'));
@@ -151,7 +151,7 @@ export default class Plan extends Command {
151
151
  console.log(chalk.gray(' 2. Edit if needed (add/remove/modify tasks)'));
152
152
  console.log(chalk.gray(' 3. Run'), chalk.cyan('clavix implement'), chalk.gray('to start implementation'));
153
153
  console.log();
154
- console.log(chalk.dim('Tip: Tasks follow CLEAR framework principles for optimal AI execution\n'));
154
+ console.log(chalk.dim('Tip: Tasks are optimized with Clavix Intelligence for optimal AI execution\n'));
155
155
  }
156
156
  catch (error) {
157
157
  const errorMessage = error instanceof Error ? error.message : 'An unexpected error occurred';
@@ -3,7 +3,7 @@
3
3
  *
4
4
  * This class handles:
5
5
  * - Analyzing PRD documents
6
- * - Generating CLEAR-optimized task breakdowns
6
+ * - Generating optimized task breakdowns
7
7
  * - Reading/writing tasks.md with checkbox format
8
8
  * - Tracking task completion state
9
9
  * - Managing session resume capability
@@ -51,7 +51,6 @@ export interface TaskGenerationResult {
51
51
  * Generates and manages implementation tasks from PRD documents
52
52
  */
53
53
  export declare class TaskManager {
54
- private readonly optimizer;
55
54
  constructor();
56
55
  /**
57
56
  * Generate tasks.md from PRD
@@ -3,14 +3,13 @@
3
3
  *
4
4
  * This class handles:
5
5
  * - Analyzing PRD documents
6
- * - Generating CLEAR-optimized task breakdowns
6
+ * - Generating optimized task breakdowns
7
7
  * - Reading/writing tasks.md with checkbox format
8
8
  * - Tracking task completion state
9
9
  * - Managing session resume capability
10
10
  */
11
11
  import fs from 'fs-extra';
12
12
  import * as path from 'path';
13
- import { PromptOptimizer } from './prompt-optimizer.js';
14
13
  import { FileSystem } from '../utils/file-system.js';
15
14
  const SOURCE_FILE_MAP = {
16
15
  full: ['full-prd.md', 'PRD.md', 'prd.md', 'Full-PRD.md', 'FULL_PRD.md', 'FULL-PRD.md'],
@@ -18,7 +17,12 @@ const SOURCE_FILE_MAP = {
18
17
  mini: ['mini-prd.md'],
19
18
  prompt: ['optimized-prompt.md'],
20
19
  };
21
- const SOURCE_ORDER_AUTO = ['full', 'quick', 'mini', 'prompt'];
20
+ const SOURCE_ORDER_AUTO = [
21
+ 'full',
22
+ 'quick',
23
+ 'mini',
24
+ 'prompt',
25
+ ];
22
26
  const ALL_KNOWN_PRD_FILES = Array.from(new Set(Object.values(SOURCE_FILE_MAP).flat()));
23
27
  /**
24
28
  * TaskManager class
@@ -26,9 +30,8 @@ const ALL_KNOWN_PRD_FILES = Array.from(new Set(Object.values(SOURCE_FILE_MAP).fl
26
30
  * Generates and manages implementation tasks from PRD documents
27
31
  */
28
32
  export class TaskManager {
29
- optimizer;
30
33
  constructor() {
31
- this.optimizer = new PromptOptimizer();
34
+ // TaskManager uses Clavix Intelligence for optimization
32
35
  }
33
36
  /**
34
37
  * Generate tasks.md from PRD
@@ -184,7 +187,7 @@ export class TaskManager {
184
187
  'Configuration & Setup': [],
185
188
  'Core Implementation': [],
186
189
  'Testing & Validation': [],
187
- 'Documentation': [],
190
+ Documentation: [],
188
191
  'Integration & Release': [],
189
192
  };
190
193
  features.forEach((feature) => {
@@ -235,7 +238,9 @@ export class TaskManager {
235
238
  if (topLevelMatch) {
236
239
  const value = topLevelMatch[1].trim();
237
240
  // Skip items that look like code examples, file paths, or implementation details
238
- if (value && !this.looksLikeCodeOrPath(value) && !this.looksLikeImplementationDetail(value)) {
241
+ if (value &&
242
+ !this.looksLikeCodeOrPath(value) &&
243
+ !this.looksLikeImplementationDetail(value)) {
239
244
  items.push(value.replace(/\s+/g, ' ').replace(/\.$/, ''));
240
245
  }
241
246
  }
@@ -311,17 +316,11 @@ export class TaskManager {
311
316
  }
312
317
  // Conversion/migration tasks - Convert + test
313
318
  if (isConversion) {
314
- return [
315
- this.convertBehaviorToTask(feature),
316
- `Test ${formattedFeature} works correctly`,
317
- ];
319
+ return [this.convertBehaviorToTask(feature), `Test ${formattedFeature} works correctly`];
318
320
  }
319
321
  // Default for complex features - Implementation + testing only
320
322
  // (No more "integrate into end-to-end" boilerplate)
321
- return [
322
- this.convertBehaviorToTask(feature),
323
- `Add tests covering ${formattedFeature}`,
324
- ];
323
+ return [this.convertBehaviorToTask(feature), `Add tests covering ${formattedFeature}`];
325
324
  }
326
325
  formatInlineText(text) {
327
326
  if (!text) {
@@ -446,9 +445,7 @@ export class TaskManager {
446
445
  const featureName = featureHeaders[i][2].trim();
447
446
  // Extract content between this header and the next one
448
447
  const startIndex = featureHeaders[i].index;
449
- const endIndex = i < featureHeaders.length - 1
450
- ? featureHeaders[i + 1].index
451
- : featuresContent.length;
448
+ const endIndex = i < featureHeaders.length - 1 ? featureHeaders[i + 1].index : featuresContent.length;
452
449
  const featureContent = featuresContent.substring(startIndex, endIndex);
453
450
  // Extract behavior points using hierarchical parsing
454
451
  const behaviorMatch = featureContent.match(/\*\*Behavior\*\*:([\s\S]*?)(?=\*\*|####|$)/);
@@ -740,9 +737,7 @@ export class TaskManager {
740
737
  const content = await fs.readFile(tasksPath, 'utf-8');
741
738
  // Find the task line and replace [ ] with [x]
742
739
  // We need to find the exact task by description
743
- const targetTask = phases
744
- .flatMap((p) => p.tasks)
745
- .find((t) => t.id === taskId);
740
+ const targetTask = phases.flatMap((p) => p.tasks).find((t) => t.id === taskId);
746
741
  if (!targetTask) {
747
742
  throw new Error(`Task not found: ${taskId}`);
748
743
  }
@@ -769,7 +764,7 @@ export class TaskManager {
769
764
  */
770
765
  validateTaskExists(phases, taskId) {
771
766
  for (const phase of phases) {
772
- const task = phase.tasks.find(t => t.id === taskId);
767
+ const task = phase.tasks.find((t) => t.id === taskId);
773
768
  if (task) {
774
769
  return task;
775
770
  }
@@ -828,7 +823,7 @@ export class TaskManager {
828
823
  const task = this.validateTaskExists(phases, taskId);
829
824
  if (!task) {
830
825
  // Task not found - provide helpful error
831
- const allTaskIds = phases.flatMap(p => p.tasks.map(t => t.id));
826
+ const allTaskIds = phases.flatMap((p) => p.tasks.map((t) => t.id));
832
827
  return {
833
828
  success: false,
834
829
  error: `Task ID "${taskId}" not found. Available task IDs:\n${allTaskIds.join('\n')}`,
@@ -876,7 +871,7 @@ export class TaskManager {
876
871
  }
877
872
  }
878
873
  // Clean up backup on success
879
- if (backupPath && await fs.pathExists(backupPath)) {
874
+ if (backupPath && (await fs.pathExists(backupPath))) {
880
875
  await fs.remove(backupPath);
881
876
  }
882
877
  return {
@@ -886,7 +881,7 @@ export class TaskManager {
886
881
  }
887
882
  catch (error) {
888
883
  // Restore from backup if available
889
- if (backupPath && await fs.pathExists(backupPath)) {
884
+ if (backupPath && (await fs.pathExists(backupPath))) {
890
885
  try {
891
886
  await fs.copyFile(backupPath, tasksPath);
892
887
  warnings.push('Restored tasks.md from backup due to error');
@@ -919,7 +914,7 @@ export class TaskManager {
919
914
  */
920
915
  async findPrdDirectory(projectName) {
921
916
  const baseDir = '.clavix/outputs';
922
- if (!await fs.pathExists(baseDir)) {
917
+ if (!(await fs.pathExists(baseDir))) {
923
918
  throw new Error('No .clavix/outputs directory found. Have you generated a PRD yet?');
924
919
  }
925
920
  // If project name specified, look for it
@@ -131,18 +131,12 @@ Deep mode provides **Clavix Intelligence™** with comprehensive analysis that g
131
131
 
132
132
  d. **Improvements Applied** (labeled with quality dimensions)
133
133
 
134
- e. **Alternative Approaches**:
135
- - 2-3 different ways to phrase the request
136
- - Alternative structures (user story, job story, structured sections)
137
- - When each approach is most appropriate
138
- - Temperature/model recommendations
139
-
140
- f. **Alternative Structures**:
141
- - **Step-by-step**: Break into sequential steps
142
- - **Template-based**: Provide code/document template to fill
143
- - **Example-driven**: Show concrete examples of desired output
144
-
145
- g. **Validation Checklist**:
134
+ e. **Alternative Approaches** (generated by AlternativePhrasingGenerator pattern):
135
+ - 2-3 different ways to approach the request
136
+ - Each approach with title, description, and "best for" context
137
+ - Intent-specific alternatives (e.g., Functional Decomposition for code, Top-Down Design for planning)
138
+
139
+ f. **Validation Checklist** (generated by ValidationChecklistCreator pattern):
146
140
  - Steps to verify accuracy
147
141
  - Requirements match checks
148
142
  - Edge case handling verification
@@ -150,7 +144,7 @@ Deep mode provides **Clavix Intelligence™** with comprehensive analysis that g
150
144
  - Output format validation
151
145
  - Performance considerations
152
146
 
153
- h. **Edge Cases to Consider**:
147
+ g. **Edge Cases to Consider** (generated by EdgeCaseIdentifier pattern):
154
148
  - Intent-specific edge cases
155
149
  - Error conditions and recovery
156
150
  - Unexpected inputs or behavior
@@ -171,10 +165,9 @@ Deep mode provides **Clavix Intelligence™** with comprehensive analysis that g
171
165
  - **Intent Detection**: Automatic classification with confidence
172
166
  - **Quality Assessment**: All 6 dimensions with detailed analysis
173
167
  - **Advanced Optimization**: All applicable patterns
174
- - **Alternative Approaches**: Multiple phrasings and perspectives
175
- - **Alternative Structures**: Different organization approaches
176
- - **Validation Checklist**: Steps to verify completion
177
- - **Edge Case Analysis**: Potential issues and failure modes
168
+ - **Alternative Approaches**: Multiple approaches (generated by AlternativePhrasingGenerator pattern)
169
+ - **Validation Checklist**: Steps to verify completion (generated by ValidationChecklistCreator pattern)
170
+ - **Edge Case Analysis**: Potential issues and failure modes (generated by EdgeCaseIdentifier pattern)
178
171
  - **Risk Assessment**: "What could go wrong" analysis
179
172
 
180
173
  **Do NOT include (these belong in `/clavix:prd`):**
@@ -290,66 +283,40 @@ Success Criteria:
290
283
  [Completeness] Added tech stack (React/TypeScript), API endpoint, accessibility standards, testing requirements
291
284
  [Actionability] Converted vague request into specific, measurable implementation requirements
292
285
 
293
- ### Alternative Approaches:
286
+ ### Alternative Approaches
294
287
 
295
- 1. **Functional Decomposition**: "Build a React login component that: (1) validates email/password inputs, (2) calls JWT auth API, (3) handles errors gracefully, (4) manages session persistence"
288
+ **1. Functional Decomposition**
289
+ Break down into discrete functions with clear interfaces
296
290
  → Best for: Step-by-step implementation, clarity on sequence
297
291
 
298
- 2. **User-Centric**: "As a user, I need to log into my account securely using email/password, with clear feedback if credentials are invalid"
299
- Best for: Emphasizing user experience and value
300
-
301
- 3. **Example-Driven**: "Create a login page similar to [reference], with email/password fields, validation, and integration with our JWT API"
302
- → Best for: When you have a reference implementation
303
-
304
- ### Alternative Structures:
292
+ **2. Test-Driven Approach**
293
+ Define expected behavior through tests first
294
+ → Best for: When requirements are clear and testable
305
295
 
306
- **Step-by-step approach:**
307
- 1. Create form with email/password inputs and validation
308
- 2. Implement API integration with JWT endpoint
309
- 3. Add error handling and user feedback
310
- 4. Implement "remember me" and "forgot password" features
311
- 5. Add accessibility and responsive design
312
- 6. Write tests and documentation
296
+ **3. Example-Driven**
297
+ Provide concrete input/output examples
298
+ Best for: When you have reference implementations
313
299
 
314
- **Template-based approach:**
315
- Provide a component template with:
316
- - Form structure with input fields
317
- - Validation logic placeholders
318
- - API call hooks
319
- - Error state management
320
- - Accessibility attributes
321
-
322
- **Example-driven approach:**
323
- Show concrete examples of:
324
- - Login form HTML structure
325
- - Validation error messages
326
- - Success/failure API responses
327
- - Loading and error states
328
-
329
- ### Validation Checklist:
300
+ ### Validation Checklist
330
301
 
331
302
  Before considering this task complete, verify:
332
- ☐ Email and password fields validate input correctly
333
- Invalid credentials show appropriate, user-friendly error messages
334
- Successful login redirects to correct page or updates auth state
335
- "Remember me" persists session across browser sessions
336
- "Forgot password" link navigates to password reset flow
337
- Form is keyboard accessible (tab navigation, enter to submit)
338
- Screen readers announce errors and state changes
339
- Loading state prevents duplicate submissions
340
- Component renders correctly on mobile and desktop
341
- ☐ Unit tests cover success, failure, and edge cases (>80% coverage)
342
-
343
- ### Edge Cases to Consider:
344
-
345
- • **Empty or invalid inputs**: How to handle blank email, malformed email, empty password?
346
- • **API failures**: What happens if auth API is down or times out?
347
- • **Slow network**: How to indicate loading state and prevent double-submission?
348
- • **Expired sessions**: How to handle JWT expiration during login attempt?
349
- • **Account locked**: What if user account is temporarily locked after failed attempts?
350
- • **Password reset in progress**: How to handle user who requested reset but tries to login?
351
- • **Browser autofill**: Does component work correctly with password managers?
352
- • **Concurrent logins**: What happens if user logs in on multiple devices?
303
+
304
+ Code compiles/runs without errors
305
+ All requirements from prompt are implemented
306
+ Edge cases are handled gracefully
307
+ UI renders correctly on different screen sizes
308
+ Keyboard navigation works correctly
309
+ Code follows project conventions/style guide
310
+ No console errors or warnings
311
+ Documentation updated if needed
312
+
313
+ ### Edge Cases to Consider
314
+
315
+ • **Boundary conditions**: What happens at min/max values, empty collections, or single items?
316
+ • **Empty or null inputs**: How should the system handle missing or undefined values?
317
+ • **Invalid input types**: What happens if input is wrong type (string vs number)?
318
+ • **Network failures**: How to handle timeouts, connection errors, and retries?
319
+ • **Session expiration**: What happens when user session expires mid-operation?
353
320
 
354
321
  ### What Could Go Wrong:
355
322
 
@@ -115,5 +115,5 @@ Deep mode only:
115
115
 
116
116
  | Mode | Patterns Available | Typical Applied |
117
117
  |------|-------------------|-----------------|
118
- | Fast | 12 core patterns | 4-7 patterns |
118
+ | Fast | 14 core patterns | 4-7 patterns |
119
119
  | Deep | 20 total patterns | 8-14 patterns |
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "clavix",
3
- "version": "4.2.0",
3
+ "version": "4.3.1",
4
4
  "description": "Clavix Intelligence™ for AI coding. Automatically optimizes prompts with intent detection, quality assessment, and adaptive patterns—no framework to learn. Works with Claude Code, Cursor, Windsurf, and 19+ other AI coding tools.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -17,7 +17,7 @@
17
17
  "prebuild": "npm run validate:consistency",
18
18
  "build": "tsc && npm run copy-templates",
19
19
  "build:prod": "npm run build && npm run remove-sourcemaps",
20
- "copy-templates": "copyfiles -u 1 \"src/templates/**/*\" dist/",
20
+ "copy-templates": "rm -rf dist/templates && copyfiles -u 1 \"src/templates/**/*\" dist/",
21
21
  "remove-sourcemaps": "find dist -name '*.map' -type f -delete",
22
22
  "dev": "node --loader ts-node/esm src/index.ts",
23
23
  "test": "NODE_OPTIONS=\"--experimental-vm-modules --no-warnings\" jest",