clavix 4.12.0 → 5.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (151) hide show
  1. package/README.md +69 -61
  2. package/dist/templates/slash-commands/_canonical/archive.md +83 -121
  3. package/dist/templates/slash-commands/_canonical/execute.md +32 -42
  4. package/dist/templates/slash-commands/_canonical/implement.md +32 -44
  5. package/dist/templates/slash-commands/_canonical/improve.md +13 -52
  6. package/dist/templates/slash-commands/_components/agent-protocols/cli-reference.md +84 -180
  7. package/dist/templates/slash-commands/_components/agent-protocols/error-handling.md +2 -2
  8. package/dist/templates/slash-commands/_components/agent-protocols/file-formats.md +41 -59
  9. package/dist/templates/slash-commands/_components/sections/file-saving-protocol.md +20 -27
  10. package/dist/templates/slash-commands/_components/troubleshooting/file-not-saved.md +4 -5
  11. package/package.json +2 -2
  12. package/dist/cli/commands/analyze.d.ts +0 -17
  13. package/dist/cli/commands/analyze.js +0 -133
  14. package/dist/cli/commands/archive.d.ts +0 -36
  15. package/dist/cli/commands/archive.js +0 -266
  16. package/dist/cli/commands/deep.d.ts +0 -17
  17. package/dist/cli/commands/deep.js +0 -170
  18. package/dist/cli/commands/execute.d.ts +0 -15
  19. package/dist/cli/commands/execute.js +0 -168
  20. package/dist/cli/commands/fast.d.ts +0 -18
  21. package/dist/cli/commands/fast.js +0 -219
  22. package/dist/cli/commands/implement.d.ts +0 -24
  23. package/dist/cli/commands/implement.js +0 -289
  24. package/dist/cli/commands/improve.d.ts +0 -32
  25. package/dist/cli/commands/improve.js +0 -250
  26. package/dist/cli/commands/list.d.ts +0 -17
  27. package/dist/cli/commands/list.js +0 -217
  28. package/dist/cli/commands/plan.d.ts +0 -21
  29. package/dist/cli/commands/plan.js +0 -297
  30. package/dist/cli/commands/prd.d.ts +0 -24
  31. package/dist/cli/commands/prd.js +0 -321
  32. package/dist/cli/commands/prompts/clear.d.ts +0 -16
  33. package/dist/cli/commands/prompts/clear.js +0 -222
  34. package/dist/cli/commands/prompts/list.d.ts +0 -8
  35. package/dist/cli/commands/prompts/list.js +0 -88
  36. package/dist/cli/commands/show.d.ts +0 -21
  37. package/dist/cli/commands/show.js +0 -191
  38. package/dist/cli/commands/start.d.ts +0 -40
  39. package/dist/cli/commands/start.js +0 -210
  40. package/dist/cli/commands/summarize.d.ts +0 -17
  41. package/dist/cli/commands/summarize.js +0 -196
  42. package/dist/cli/commands/task-complete.d.ts +0 -27
  43. package/dist/cli/commands/task-complete.js +0 -269
  44. package/dist/cli/commands/verify.d.ts +0 -28
  45. package/dist/cli/commands/verify.js +0 -349
  46. package/dist/core/archive-manager.d.ts +0 -100
  47. package/dist/core/archive-manager.js +0 -302
  48. package/dist/core/basic-checklist-generator.d.ts +0 -35
  49. package/dist/core/basic-checklist-generator.js +0 -344
  50. package/dist/core/checklist-parser.d.ts +0 -48
  51. package/dist/core/checklist-parser.js +0 -238
  52. package/dist/core/config-manager.d.ts +0 -149
  53. package/dist/core/config-manager.js +0 -230
  54. package/dist/core/conversation-analyzer.d.ts +0 -86
  55. package/dist/core/conversation-analyzer.js +0 -387
  56. package/dist/core/conversation-quality-tracker.d.ts +0 -81
  57. package/dist/core/conversation-quality-tracker.js +0 -195
  58. package/dist/core/git-manager.d.ts +0 -126
  59. package/dist/core/git-manager.js +0 -282
  60. package/dist/core/intelligence/confidence-calculator.d.ts +0 -93
  61. package/dist/core/intelligence/confidence-calculator.js +0 -124
  62. package/dist/core/intelligence/index.d.ts +0 -11
  63. package/dist/core/intelligence/index.js +0 -15
  64. package/dist/core/intelligence/intent-detector.d.ts +0 -54
  65. package/dist/core/intelligence/intent-detector.js +0 -723
  66. package/dist/core/intelligence/pattern-library.d.ts +0 -104
  67. package/dist/core/intelligence/pattern-library.js +0 -330
  68. package/dist/core/intelligence/patterns/actionability-enhancer.d.ts +0 -27
  69. package/dist/core/intelligence/patterns/actionability-enhancer.js +0 -192
  70. package/dist/core/intelligence/patterns/alternative-phrasing-generator.d.ts +0 -29
  71. package/dist/core/intelligence/patterns/alternative-phrasing-generator.js +0 -239
  72. package/dist/core/intelligence/patterns/ambiguity-detector.d.ts +0 -22
  73. package/dist/core/intelligence/patterns/ambiguity-detector.js +0 -196
  74. package/dist/core/intelligence/patterns/assumption-explicitizer.d.ts +0 -30
  75. package/dist/core/intelligence/patterns/assumption-explicitizer.js +0 -296
  76. package/dist/core/intelligence/patterns/base-pattern.d.ts +0 -192
  77. package/dist/core/intelligence/patterns/base-pattern.js +0 -103
  78. package/dist/core/intelligence/patterns/completeness-validator.d.ts +0 -27
  79. package/dist/core/intelligence/patterns/completeness-validator.js +0 -221
  80. package/dist/core/intelligence/patterns/conciseness-filter.d.ts +0 -20
  81. package/dist/core/intelligence/patterns/conciseness-filter.js +0 -92
  82. package/dist/core/intelligence/patterns/context-precision.d.ts +0 -32
  83. package/dist/core/intelligence/patterns/context-precision.js +0 -389
  84. package/dist/core/intelligence/patterns/conversation-summarizer.d.ts +0 -30
  85. package/dist/core/intelligence/patterns/conversation-summarizer.js +0 -277
  86. package/dist/core/intelligence/patterns/dependency-identifier.d.ts +0 -23
  87. package/dist/core/intelligence/patterns/dependency-identifier.js +0 -166
  88. package/dist/core/intelligence/patterns/domain-context-enricher.d.ts +0 -21
  89. package/dist/core/intelligence/patterns/domain-context-enricher.js +0 -198
  90. package/dist/core/intelligence/patterns/edge-case-identifier.d.ts +0 -30
  91. package/dist/core/intelligence/patterns/edge-case-identifier.js +0 -269
  92. package/dist/core/intelligence/patterns/error-tolerance-enhancer.d.ts +0 -22
  93. package/dist/core/intelligence/patterns/error-tolerance-enhancer.js +0 -179
  94. package/dist/core/intelligence/patterns/implicit-requirement-extractor.d.ts +0 -24
  95. package/dist/core/intelligence/patterns/implicit-requirement-extractor.js +0 -259
  96. package/dist/core/intelligence/patterns/objective-clarifier.d.ts +0 -22
  97. package/dist/core/intelligence/patterns/objective-clarifier.js +0 -126
  98. package/dist/core/intelligence/patterns/output-format-enforcer.d.ts +0 -22
  99. package/dist/core/intelligence/patterns/output-format-enforcer.js +0 -151
  100. package/dist/core/intelligence/patterns/prd-structure-enforcer.d.ts +0 -23
  101. package/dist/core/intelligence/patterns/prd-structure-enforcer.js +0 -183
  102. package/dist/core/intelligence/patterns/prerequisite-identifier.d.ts +0 -23
  103. package/dist/core/intelligence/patterns/prerequisite-identifier.js +0 -221
  104. package/dist/core/intelligence/patterns/requirement-prioritizer.d.ts +0 -24
  105. package/dist/core/intelligence/patterns/requirement-prioritizer.js +0 -134
  106. package/dist/core/intelligence/patterns/scope-definer.d.ts +0 -26
  107. package/dist/core/intelligence/patterns/scope-definer.js +0 -236
  108. package/dist/core/intelligence/patterns/step-decomposer.d.ts +0 -31
  109. package/dist/core/intelligence/patterns/step-decomposer.js +0 -242
  110. package/dist/core/intelligence/patterns/structure-organizer.d.ts +0 -31
  111. package/dist/core/intelligence/patterns/structure-organizer.js +0 -218
  112. package/dist/core/intelligence/patterns/success-criteria-enforcer.d.ts +0 -22
  113. package/dist/core/intelligence/patterns/success-criteria-enforcer.js +0 -165
  114. package/dist/core/intelligence/patterns/success-metrics-enforcer.d.ts +0 -24
  115. package/dist/core/intelligence/patterns/success-metrics-enforcer.js +0 -165
  116. package/dist/core/intelligence/patterns/technical-context-enricher.d.ts +0 -25
  117. package/dist/core/intelligence/patterns/technical-context-enricher.js +0 -165
  118. package/dist/core/intelligence/patterns/topic-coherence-analyzer.d.ts +0 -26
  119. package/dist/core/intelligence/patterns/topic-coherence-analyzer.js +0 -300
  120. package/dist/core/intelligence/patterns/user-persona-enricher.d.ts +0 -24
  121. package/dist/core/intelligence/patterns/user-persona-enricher.js +0 -141
  122. package/dist/core/intelligence/patterns/validation-checklist-creator.d.ts +0 -31
  123. package/dist/core/intelligence/patterns/validation-checklist-creator.js +0 -242
  124. package/dist/core/intelligence/quality-assessor.d.ts +0 -71
  125. package/dist/core/intelligence/quality-assessor.js +0 -525
  126. package/dist/core/intelligence/types.d.ts +0 -111
  127. package/dist/core/intelligence/types.js +0 -3
  128. package/dist/core/intelligence/universal-optimizer.d.ts +0 -91
  129. package/dist/core/intelligence/universal-optimizer.js +0 -399
  130. package/dist/core/prd-generator.d.ts +0 -76
  131. package/dist/core/prd-generator.js +0 -173
  132. package/dist/core/prompt-manager.d.ts +0 -110
  133. package/dist/core/prompt-manager.js +0 -274
  134. package/dist/core/prompt-optimizer.d.ts +0 -268
  135. package/dist/core/prompt-optimizer.js +0 -959
  136. package/dist/core/question-engine.d.ts +0 -167
  137. package/dist/core/question-engine.js +0 -356
  138. package/dist/core/session-manager.d.ts +0 -139
  139. package/dist/core/session-manager.js +0 -365
  140. package/dist/core/task-manager.d.ts +0 -211
  141. package/dist/core/task-manager.js +0 -981
  142. package/dist/core/verification-hooks.d.ts +0 -67
  143. package/dist/core/verification-hooks.js +0 -309
  144. package/dist/core/verification-manager.d.ts +0 -107
  145. package/dist/core/verification-manager.js +0 -415
  146. package/dist/index 2.js +0 -13
  147. package/dist/index.d 2.ts +0 -4
  148. package/dist/types/session.d.ts +0 -78
  149. package/dist/types/session.js +0 -8
  150. package/dist/types/verification.d.ts +0 -205
  151. package/dist/types/verification.js +0 -9
@@ -1,344 +0,0 @@
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
@@ -1,48 +0,0 @@
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
@@ -1,238 +0,0 @@
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