clavix 4.6.0 → 4.8.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.
@@ -0,0 +1,344 @@
1
+ /**
2
+ * Clavix v4.8: Basic Checklist Generator
3
+ *
4
+ * Generates basic verification checklists for fast mode prompts
5
+ * that don't have comprehensive checklists from deep mode.
6
+ */
7
+ /**
8
+ * Intent-specific checklist templates
9
+ */
10
+ const INTENT_CHECKLISTS = {
11
+ 'code-generation': [
12
+ {
13
+ content: 'Code compiles/runs without errors',
14
+ group: 'Functionality',
15
+ verificationType: 'automated',
16
+ },
17
+ {
18
+ content: 'All requirements from prompt are implemented',
19
+ group: 'Functionality',
20
+ verificationType: 'manual',
21
+ },
22
+ {
23
+ content: 'No console errors or warnings',
24
+ group: 'Quality',
25
+ verificationType: 'semi-automated',
26
+ },
27
+ {
28
+ content: 'Code follows project conventions',
29
+ group: 'Quality',
30
+ verificationType: 'automated',
31
+ },
32
+ ],
33
+ testing: [
34
+ {
35
+ content: 'All tests pass',
36
+ group: 'Functionality',
37
+ verificationType: 'automated',
38
+ },
39
+ {
40
+ content: 'Test coverage is acceptable',
41
+ group: 'Coverage',
42
+ verificationType: 'automated',
43
+ },
44
+ {
45
+ content: 'Edge cases are tested',
46
+ group: 'Coverage',
47
+ verificationType: 'manual',
48
+ },
49
+ {
50
+ content: 'Tests are independent (no shared state)',
51
+ group: 'Quality',
52
+ verificationType: 'manual',
53
+ },
54
+ ],
55
+ debugging: [
56
+ {
57
+ content: 'Bug is fixed',
58
+ group: 'Functionality',
59
+ verificationType: 'manual',
60
+ },
61
+ {
62
+ content: 'No regression introduced',
63
+ group: 'Regression',
64
+ verificationType: 'automated',
65
+ },
66
+ {
67
+ content: 'Root cause is addressed',
68
+ group: 'Analysis',
69
+ verificationType: 'manual',
70
+ },
71
+ {
72
+ content: 'Related areas tested for side effects',
73
+ group: 'Regression',
74
+ verificationType: 'manual',
75
+ },
76
+ ],
77
+ 'security-review': [
78
+ {
79
+ content: 'Authentication is verified',
80
+ group: 'Auth',
81
+ verificationType: 'manual',
82
+ },
83
+ {
84
+ content: 'Input is properly sanitized',
85
+ group: 'Input',
86
+ verificationType: 'manual',
87
+ },
88
+ {
89
+ content: 'Sensitive data is protected',
90
+ group: 'Data',
91
+ verificationType: 'manual',
92
+ },
93
+ {
94
+ content: 'No known vulnerabilities',
95
+ group: 'Security',
96
+ verificationType: 'manual',
97
+ },
98
+ ],
99
+ refinement: [
100
+ {
101
+ content: 'Improvement is implemented',
102
+ group: 'Functionality',
103
+ verificationType: 'manual',
104
+ },
105
+ {
106
+ content: 'No functionality regression',
107
+ group: 'Regression',
108
+ verificationType: 'automated',
109
+ },
110
+ {
111
+ content: 'Performance is not degraded',
112
+ group: 'Performance',
113
+ verificationType: 'manual',
114
+ },
115
+ {
116
+ content: 'Code quality is maintained',
117
+ group: 'Quality',
118
+ verificationType: 'automated',
119
+ },
120
+ ],
121
+ planning: [
122
+ {
123
+ content: 'Plan is clear and actionable',
124
+ group: 'Clarity',
125
+ verificationType: 'manual',
126
+ },
127
+ {
128
+ content: 'All requirements are addressed',
129
+ group: 'Completeness',
130
+ verificationType: 'manual',
131
+ },
132
+ {
133
+ content: 'Risks are identified',
134
+ group: 'Risk',
135
+ verificationType: 'manual',
136
+ },
137
+ ],
138
+ documentation: [
139
+ {
140
+ content: 'Documentation is accurate',
141
+ group: 'Accuracy',
142
+ verificationType: 'manual',
143
+ },
144
+ {
145
+ content: 'Examples are correct and work',
146
+ group: 'Accuracy',
147
+ verificationType: 'manual',
148
+ },
149
+ {
150
+ content: 'Documentation is complete',
151
+ group: 'Completeness',
152
+ verificationType: 'manual',
153
+ },
154
+ ],
155
+ migration: [
156
+ {
157
+ content: 'Migration completes successfully',
158
+ group: 'Functionality',
159
+ verificationType: 'manual',
160
+ },
161
+ {
162
+ content: 'Data integrity is preserved',
163
+ group: 'Data',
164
+ verificationType: 'manual',
165
+ },
166
+ {
167
+ content: 'All features work post-migration',
168
+ group: 'Functionality',
169
+ verificationType: 'manual',
170
+ },
171
+ {
172
+ content: 'Rollback plan is tested',
173
+ group: 'Safety',
174
+ verificationType: 'manual',
175
+ },
176
+ ],
177
+ learning: [
178
+ {
179
+ content: 'Concept is understood',
180
+ group: 'Understanding',
181
+ verificationType: 'manual',
182
+ },
183
+ {
184
+ content: 'Examples are working',
185
+ group: 'Practice',
186
+ verificationType: 'manual',
187
+ },
188
+ ],
189
+ 'prd-generation': [
190
+ {
191
+ content: 'PRD covers all requirements',
192
+ group: 'Completeness',
193
+ verificationType: 'manual',
194
+ },
195
+ {
196
+ content: 'Success criteria are defined',
197
+ group: 'Clarity',
198
+ verificationType: 'manual',
199
+ },
200
+ ],
201
+ summarization: [
202
+ {
203
+ content: 'Summary captures key points',
204
+ group: 'Accuracy',
205
+ verificationType: 'manual',
206
+ },
207
+ {
208
+ content: 'No important details omitted',
209
+ group: 'Completeness',
210
+ verificationType: 'manual',
211
+ },
212
+ ],
213
+ };
214
+ /**
215
+ * Default checklist for unknown intents
216
+ */
217
+ const DEFAULT_CHECKLIST = [
218
+ {
219
+ content: 'Task is completed successfully',
220
+ group: 'Functionality',
221
+ verificationType: 'manual',
222
+ },
223
+ {
224
+ content: 'No errors or warnings',
225
+ group: 'Quality',
226
+ verificationType: 'semi-automated',
227
+ },
228
+ {
229
+ content: 'Output meets requirements',
230
+ group: 'Functionality',
231
+ verificationType: 'manual',
232
+ },
233
+ ];
234
+ /**
235
+ * Basic Checklist Generator
236
+ */
237
+ export class BasicChecklistGenerator {
238
+ /**
239
+ * Generate a basic checklist based on intent
240
+ */
241
+ generate(intent) {
242
+ const template = INTENT_CHECKLISTS[intent] || DEFAULT_CHECKLIST;
243
+ const validationItems = template.map((item, index) => ({
244
+ id: `generated-${index + 1}`,
245
+ category: 'validation',
246
+ content: item.content,
247
+ group: item.group,
248
+ verificationType: item.verificationType,
249
+ }));
250
+ return {
251
+ validationItems,
252
+ edgeCases: [],
253
+ risks: [],
254
+ hasChecklist: validationItems.length > 0,
255
+ totalItems: validationItems.length,
256
+ };
257
+ }
258
+ /**
259
+ * Generate checklist for a specific prompt content
260
+ * Detects additional items based on prompt keywords
261
+ */
262
+ generateFromPrompt(content, intent) {
263
+ const baseChecklist = this.generate(intent);
264
+ const additionalItems = [];
265
+ const lowerContent = content.toLowerCase();
266
+ let itemIndex = baseChecklist.validationItems.length;
267
+ // API-related checks
268
+ if (this.hasKeywords(lowerContent, ['api', 'endpoint', 'route', 'rest', 'graphql'])) {
269
+ additionalItems.push({
270
+ id: `generated-${++itemIndex}`,
271
+ category: 'validation',
272
+ content: 'API endpoints return correct responses',
273
+ group: 'API',
274
+ verificationType: 'manual',
275
+ });
276
+ }
277
+ // UI-related checks
278
+ if (this.hasKeywords(lowerContent, ['ui', 'component', 'form', 'page', 'button'])) {
279
+ additionalItems.push({
280
+ id: `generated-${++itemIndex}`,
281
+ category: 'validation',
282
+ content: 'UI renders correctly',
283
+ group: 'UI',
284
+ verificationType: 'semi-automated',
285
+ });
286
+ }
287
+ // Database-related checks
288
+ if (this.hasKeywords(lowerContent, ['database', 'db', 'query', 'schema', 'migration'])) {
289
+ additionalItems.push({
290
+ id: `generated-${++itemIndex}`,
291
+ category: 'validation',
292
+ content: 'Database operations work correctly',
293
+ group: 'Data',
294
+ verificationType: 'manual',
295
+ });
296
+ }
297
+ // Auth-related checks
298
+ if (this.hasKeywords(lowerContent, ['auth', 'login', 'session', 'token', 'permission'])) {
299
+ additionalItems.push({
300
+ id: `generated-${++itemIndex}`,
301
+ category: 'validation',
302
+ content: 'Authentication/authorization works correctly',
303
+ group: 'Security',
304
+ verificationType: 'manual',
305
+ });
306
+ }
307
+ // Performance-related checks
308
+ if (this.hasKeywords(lowerContent, ['performance', 'optimize', 'speed', 'fast', 'slow'])) {
309
+ additionalItems.push({
310
+ id: `generated-${++itemIndex}`,
311
+ category: 'validation',
312
+ content: 'Performance is acceptable',
313
+ group: 'Performance',
314
+ verificationType: 'manual',
315
+ });
316
+ }
317
+ return {
318
+ validationItems: [...baseChecklist.validationItems, ...additionalItems],
319
+ edgeCases: baseChecklist.edgeCases,
320
+ risks: baseChecklist.risks,
321
+ hasChecklist: true,
322
+ totalItems: baseChecklist.validationItems.length + additionalItems.length,
323
+ };
324
+ }
325
+ /**
326
+ * Check if content contains any of the keywords
327
+ */
328
+ hasKeywords(content, keywords) {
329
+ return keywords.some((kw) => content.includes(kw));
330
+ }
331
+ /**
332
+ * Get available intents
333
+ */
334
+ getAvailableIntents() {
335
+ return Object.keys(INTENT_CHECKLISTS);
336
+ }
337
+ /**
338
+ * Check if intent has a specific checklist
339
+ */
340
+ hasChecklistForIntent(intent) {
341
+ return intent in INTENT_CHECKLISTS;
342
+ }
343
+ }
344
+ //# sourceMappingURL=basic-checklist-generator.js.map
@@ -0,0 +1,48 @@
1
+ /**
2
+ * Clavix v4.8: Checklist Parser
3
+ *
4
+ * Parses validation checklists, edge cases, and risk sections from
5
+ * deep mode prompt output files.
6
+ */
7
+ import { ChecklistItem, ParsedChecklist, VerificationType } from '../types/verification.js';
8
+ /**
9
+ * Parse checklist items from prompt content
10
+ */
11
+ export declare class ChecklistParser {
12
+ /**
13
+ * Parse all checklist sections from prompt content
14
+ */
15
+ parse(content: string): ParsedChecklist;
16
+ /**
17
+ * Parse the Validation Checklist section
18
+ */
19
+ parseValidationSection(content: string): ChecklistItem[];
20
+ /**
21
+ * Parse the Edge Cases to Consider section
22
+ */
23
+ parseEdgeCaseSection(content: string): ChecklistItem[];
24
+ /**
25
+ * Parse the What Could Go Wrong section
26
+ */
27
+ parseRiskSection(content: string): ChecklistItem[];
28
+ /**
29
+ * Detect verification type based on item content
30
+ */
31
+ detectVerificationType(content: string): VerificationType;
32
+ /**
33
+ * Get a summary of the parsed checklist
34
+ */
35
+ getSummary(checklist: ParsedChecklist): {
36
+ validation: number;
37
+ edgeCases: number;
38
+ risks: number;
39
+ automated: number;
40
+ semiAutomated: number;
41
+ manual: number;
42
+ };
43
+ /**
44
+ * Check if content has any checklist sections
45
+ */
46
+ hasChecklist(content: string): boolean;
47
+ }
48
+ //# sourceMappingURL=checklist-parser.d.ts.map
@@ -0,0 +1,238 @@
1
+ /**
2
+ * Clavix v4.8: Checklist Parser
3
+ *
4
+ * Parses validation checklists, edge cases, and risk sections from
5
+ * deep mode prompt output files.
6
+ */
7
+ /**
8
+ * Regex patterns for parsing checklist sections
9
+ */
10
+ const PATTERNS = {
11
+ // Section headers (support both ## and ### headers)
12
+ validationSection: /#{2,3}\s*Validation\s+Checklist[\s\S]*?(?=#{2,3}|$)/i,
13
+ edgeCaseSection: /#{2,3}\s*Edge\s+Cases?\s+to\s+Consider[\s\S]*?(?=#{2,3}|$)/i,
14
+ riskSection: /#{2,3}\s*What\s+Could\s+Go\s+Wrong[\s\S]*?(?=#{2,3}|$)/i,
15
+ // Item patterns
16
+ checklistItem: /[☐□○●◯]\s*(.+)$/gm, // Various checkbox characters
17
+ categoryHeader: /\*\*(.+?):\*\*/g,
18
+ edgeCaseItem: /[•\-*]\s*\*\*(.+?)\*\*:?\s*(.+?)$/gm,
19
+ riskItem: /[•\-*]\s*\*\*(.+?)\*\*:?\s*(.+?)$/gm,
20
+ bulletItem: /[•\-*]\s+(.+?)$/gm,
21
+ };
22
+ /**
23
+ * Keywords for determining verification type
24
+ */
25
+ const VERIFICATION_TYPE_KEYWORDS = {
26
+ automated: [
27
+ 'compiles',
28
+ 'builds',
29
+ 'tests pass',
30
+ 'all tests',
31
+ 'test coverage',
32
+ 'lint',
33
+ 'typecheck',
34
+ 'no errors',
35
+ 'exit code',
36
+ 'npm test',
37
+ 'npm run',
38
+ 'build succeeds',
39
+ 'build passes',
40
+ ],
41
+ semiAutomated: [
42
+ 'renders',
43
+ 'displays',
44
+ 'console errors',
45
+ 'console warnings',
46
+ 'no warnings',
47
+ 'ui renders',
48
+ 'responsive',
49
+ 'screen sizes',
50
+ 'visual',
51
+ 'layout',
52
+ ],
53
+ // Everything else defaults to manual
54
+ };
55
+ /**
56
+ * Parse checklist items from prompt content
57
+ */
58
+ export class ChecklistParser {
59
+ /**
60
+ * Parse all checklist sections from prompt content
61
+ */
62
+ parse(content) {
63
+ const validationItems = this.parseValidationSection(content);
64
+ const edgeCases = this.parseEdgeCaseSection(content);
65
+ const risks = this.parseRiskSection(content);
66
+ const totalItems = validationItems.length + edgeCases.length + risks.length;
67
+ return {
68
+ validationItems,
69
+ edgeCases,
70
+ risks,
71
+ hasChecklist: totalItems > 0,
72
+ totalItems,
73
+ };
74
+ }
75
+ /**
76
+ * Parse the Validation Checklist section
77
+ */
78
+ parseValidationSection(content) {
79
+ const sectionMatch = content.match(PATTERNS.validationSection);
80
+ if (!sectionMatch)
81
+ return [];
82
+ const section = sectionMatch[0];
83
+ const items = [];
84
+ let currentGroup;
85
+ let itemIndex = 0;
86
+ // Split by lines and process
87
+ const lines = section.split('\n');
88
+ for (const line of lines) {
89
+ // Check for category header
90
+ const categoryMatch = line.match(/\*\*(.+?):\*\*/);
91
+ if (categoryMatch) {
92
+ currentGroup = categoryMatch[1].trim();
93
+ continue;
94
+ }
95
+ // Check for checklist item (Unicode checkbox or markdown checkbox)
96
+ const itemMatch = line.match(/(?:[☐□○●◯]|-\s*\[\s*\])\s*(.+)$/);
97
+ if (itemMatch) {
98
+ const itemContent = itemMatch[1].trim();
99
+ const verificationType = this.detectVerificationType(itemContent);
100
+ items.push({
101
+ id: `validation-${++itemIndex}`,
102
+ category: 'validation',
103
+ content: itemContent,
104
+ group: currentGroup,
105
+ verificationType,
106
+ });
107
+ }
108
+ }
109
+ return items;
110
+ }
111
+ /**
112
+ * Parse the Edge Cases to Consider section
113
+ */
114
+ parseEdgeCaseSection(content) {
115
+ const sectionMatch = content.match(PATTERNS.edgeCaseSection);
116
+ if (!sectionMatch)
117
+ return [];
118
+ const section = sectionMatch[0];
119
+ const items = [];
120
+ let itemIndex = 0;
121
+ // Match edge case items with scenario and consideration
122
+ const regex = /[•\-*]\s*\*\*(.+?)\*\*:?\s*(.+?)$/gm;
123
+ let match;
124
+ while ((match = regex.exec(section)) !== null) {
125
+ const scenario = match[1].trim();
126
+ const consideration = match[2].trim();
127
+ const itemContent = `${scenario}: ${consideration}`;
128
+ items.push({
129
+ id: `edge-case-${++itemIndex}`,
130
+ category: 'edge-case',
131
+ content: itemContent,
132
+ group: scenario,
133
+ verificationType: 'manual', // Edge cases are typically manual
134
+ });
135
+ }
136
+ // Also try to match simple bullet items without bold scenario
137
+ if (items.length === 0) {
138
+ const simpleRegex = /[•\-*]\s+([^*\n]+)$/gm;
139
+ while ((match = simpleRegex.exec(section)) !== null) {
140
+ const itemContent = match[1].trim();
141
+ if (itemContent && !itemContent.startsWith('#')) {
142
+ items.push({
143
+ id: `edge-case-${++itemIndex}`,
144
+ category: 'edge-case',
145
+ content: itemContent,
146
+ verificationType: 'manual',
147
+ });
148
+ }
149
+ }
150
+ }
151
+ return items;
152
+ }
153
+ /**
154
+ * Parse the What Could Go Wrong section
155
+ */
156
+ parseRiskSection(content) {
157
+ const sectionMatch = content.match(PATTERNS.riskSection);
158
+ if (!sectionMatch)
159
+ return [];
160
+ const section = sectionMatch[0];
161
+ const items = [];
162
+ let itemIndex = 0;
163
+ // Match risk items with bold titles
164
+ const regex = /[•\-*]\s*\*\*(.+?)\*\*:?\s*(.*)$/gm;
165
+ let match;
166
+ while ((match = regex.exec(section)) !== null) {
167
+ const risk = match[1].trim();
168
+ const details = match[2]?.trim() || '';
169
+ const itemContent = details ? `${risk}: ${details}` : risk;
170
+ items.push({
171
+ id: `risk-${++itemIndex}`,
172
+ category: 'risk',
173
+ content: itemContent,
174
+ group: risk,
175
+ verificationType: 'manual', // Risks are typically manual verification
176
+ });
177
+ }
178
+ // Also try to match simple bullet items
179
+ if (items.length === 0) {
180
+ const simpleRegex = /[•\-*]\s+([^*\n]+)$/gm;
181
+ while ((match = simpleRegex.exec(section)) !== null) {
182
+ const itemContent = match[1].trim();
183
+ if (itemContent && !itemContent.startsWith('#')) {
184
+ items.push({
185
+ id: `risk-${++itemIndex}`,
186
+ category: 'risk',
187
+ content: itemContent,
188
+ verificationType: 'manual',
189
+ });
190
+ }
191
+ }
192
+ }
193
+ return items;
194
+ }
195
+ /**
196
+ * Detect verification type based on item content
197
+ */
198
+ detectVerificationType(content) {
199
+ const lowerContent = content.toLowerCase();
200
+ // Check for automated keywords
201
+ for (const keyword of VERIFICATION_TYPE_KEYWORDS.automated) {
202
+ if (lowerContent.includes(keyword)) {
203
+ return 'automated';
204
+ }
205
+ }
206
+ // Check for semi-automated keywords
207
+ for (const keyword of VERIFICATION_TYPE_KEYWORDS.semiAutomated) {
208
+ if (lowerContent.includes(keyword)) {
209
+ return 'semi-automated';
210
+ }
211
+ }
212
+ // Default to manual
213
+ return 'manual';
214
+ }
215
+ /**
216
+ * Get a summary of the parsed checklist
217
+ */
218
+ getSummary(checklist) {
219
+ const allItems = [...checklist.validationItems, ...checklist.edgeCases, ...checklist.risks];
220
+ return {
221
+ validation: checklist.validationItems.length,
222
+ edgeCases: checklist.edgeCases.length,
223
+ risks: checklist.risks.length,
224
+ automated: allItems.filter((i) => i.verificationType === 'automated').length,
225
+ semiAutomated: allItems.filter((i) => i.verificationType === 'semi-automated').length,
226
+ manual: allItems.filter((i) => i.verificationType === 'manual').length,
227
+ };
228
+ }
229
+ /**
230
+ * Check if content has any checklist sections
231
+ */
232
+ hasChecklist(content) {
233
+ return (PATTERNS.validationSection.test(content) ||
234
+ PATTERNS.edgeCaseSection.test(content) ||
235
+ PATTERNS.riskSection.test(content));
236
+ }
237
+ }
238
+ //# sourceMappingURL=checklist-parser.js.map
@@ -11,6 +11,9 @@ export interface PromptMetadata {
11
11
  executedAt: string | null;
12
12
  ageInDays?: number;
13
13
  linkedProject?: string;
14
+ verificationRequired: boolean;
15
+ verified: boolean;
16
+ verifiedAt: string | null;
14
17
  }
15
18
  export interface PromptsIndex {
16
19
  version: string;
@@ -67,6 +70,10 @@ export declare class PromptManager {
67
70
  * Mark prompt as executed
68
71
  */
69
72
  markExecuted(id: string): Promise<void>;
73
+ /**
74
+ * Mark prompt as verified (v4.8)
75
+ */
76
+ markVerified(id: string): Promise<void>;
70
77
  /**
71
78
  * Delete prompts by filter
72
79
  */