clavix 2.8.2 → 3.0.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.
- package/README.md +26 -6
- package/dist/cli/commands/deep.d.ts +3 -4
- package/dist/cli/commands/deep.js +162 -261
- package/dist/cli/commands/fast.d.ts +3 -4
- package/dist/cli/commands/fast.js +126 -303
- package/dist/cli/commands/init.js +184 -22
- package/dist/cli/commands/prd.d.ts +7 -6
- package/dist/cli/commands/prd.js +113 -132
- package/dist/cli/commands/summarize.d.ts +1 -12
- package/dist/cli/commands/summarize.js +63 -131
- package/dist/core/intelligence/index.d.ts +10 -0
- package/dist/core/intelligence/index.js +13 -0
- package/dist/core/intelligence/intent-detector.d.ts +33 -0
- package/dist/core/intelligence/intent-detector.js +311 -0
- package/dist/core/intelligence/pattern-library.d.ts +44 -0
- package/dist/core/intelligence/pattern-library.js +103 -0
- package/dist/core/intelligence/patterns/actionability-enhancer.d.ts +27 -0
- package/dist/core/intelligence/patterns/actionability-enhancer.js +162 -0
- package/dist/core/intelligence/patterns/base-pattern.d.ts +31 -0
- package/dist/core/intelligence/patterns/base-pattern.js +39 -0
- package/dist/core/intelligence/patterns/completeness-validator.d.ts +27 -0
- package/dist/core/intelligence/patterns/completeness-validator.js +135 -0
- package/dist/core/intelligence/patterns/conciseness-filter.d.ts +12 -0
- package/dist/core/intelligence/patterns/conciseness-filter.js +61 -0
- package/dist/core/intelligence/patterns/objective-clarifier.d.ts +14 -0
- package/dist/core/intelligence/patterns/objective-clarifier.js +97 -0
- package/dist/core/intelligence/patterns/structure-organizer.d.ts +31 -0
- package/dist/core/intelligence/patterns/structure-organizer.js +185 -0
- package/dist/core/intelligence/patterns/technical-context-enricher.d.ts +16 -0
- package/dist/core/intelligence/patterns/technical-context-enricher.js +132 -0
- package/dist/core/intelligence/quality-assessor.d.ts +42 -0
- package/dist/core/intelligence/quality-assessor.js +296 -0
- package/dist/core/intelligence/types.d.ts +81 -0
- package/dist/core/intelligence/types.js +3 -0
- package/dist/core/intelligence/universal-optimizer.d.ts +31 -0
- package/dist/core/intelligence/universal-optimizer.js +118 -0
- package/dist/core/prd-generator.d.ts +2 -2
- package/dist/core/task-manager.js +18 -5
- package/dist/templates/agents/agents.md +2 -2
- package/dist/templates/agents/copilot-instructions.md +15 -15
- package/dist/templates/agents/octo.md +35 -30
- package/dist/templates/agents/warp.md +3 -3
- package/dist/templates/full-prd-template.hbs +1 -1
- package/dist/templates/prd-questions.md +1 -1
- package/dist/templates/quick-prd-template.hbs +1 -1
- package/dist/templates/slash-commands/_canonical/deep.md +261 -122
- package/dist/templates/slash-commands/_canonical/fast.md +101 -69
- package/dist/templates/slash-commands/_canonical/implement.md +1 -1
- package/dist/templates/slash-commands/_canonical/plan.md +12 -12
- package/dist/templates/slash-commands/_canonical/prd.md +34 -24
- package/dist/templates/slash-commands/_canonical/start.md +13 -12
- package/dist/templates/slash-commands/_canonical/summarize.md +42 -25
- package/dist/utils/error-utils.d.ts +7 -0
- package/dist/utils/error-utils.js +17 -0
- package/package.json +21 -12
|
@@ -301,47 +301,209 @@ Welcome to Clavix! This directory contains your local Clavix configuration and d
|
|
|
301
301
|
|
|
302
302
|
## Directory Structure
|
|
303
303
|
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
304
|
+
\`\`\`
|
|
305
|
+
.clavix/
|
|
306
|
+
├── config.json # Your Clavix configuration
|
|
307
|
+
├── INSTRUCTIONS.md # This file
|
|
308
|
+
├── sessions/ # Conversational mode session files
|
|
309
|
+
├── outputs/
|
|
310
|
+
│ ├── <project-name>/ # Per-project outputs
|
|
311
|
+
│ │ ├── full-prd.md
|
|
312
|
+
│ │ ├── quick-prd.md
|
|
313
|
+
│ │ ├── tasks.md
|
|
314
|
+
│ │ └── .clavix-implement-config.json
|
|
315
|
+
│ ├── prompts/ # Saved prompts for re-execution
|
|
316
|
+
│ │ ├── fast/ # Fast mode prompts
|
|
317
|
+
│ │ └── deep/ # Deep mode prompts
|
|
318
|
+
│ └── archive/ # Archived completed projects
|
|
319
|
+
└── templates/ # Custom template overrides (optional)
|
|
320
|
+
\`\`\`
|
|
308
321
|
|
|
309
|
-
##
|
|
322
|
+
## CLI Commands Reference
|
|
310
323
|
|
|
324
|
+
### Prompt Improvement
|
|
325
|
+
- \`clavix fast "<prompt>"\` - Quick CLEAR (C/L/E) improvements with smart triage
|
|
326
|
+
- \`clavix deep "<prompt>"\` - Comprehensive CLEAR (C/L/E/A/R) analysis with alternatives
|
|
327
|
+
- \`clavix execute [--latest]\` - Execute saved prompts from fast/deep optimization
|
|
328
|
+
- \`clavix prompts list\` - View all saved prompts with status (NEW/EXECUTED/OLD/STALE)
|
|
329
|
+
- \`clavix prompts clear\` - Cleanup prompts (\`--executed\`, \`--stale\`, \`--fast\`, \`--deep\`, \`--all\`)
|
|
330
|
+
|
|
331
|
+
### PRD & Planning
|
|
332
|
+
- \`clavix prd\` - Generate PRD through guided Socratic questions
|
|
333
|
+
- \`clavix plan\` - Transform PRD or session into phase-based \`tasks.md\`
|
|
334
|
+
- \`clavix start\` - Start conversational mode for requirements gathering
|
|
335
|
+
- \`clavix summarize [session-id]\` - Extract mini-PRD and prompts from conversation
|
|
336
|
+
|
|
337
|
+
### Implementation
|
|
338
|
+
- \`clavix implement [--commit-strategy=<type>]\` - Execute tasks with optional git auto-commits
|
|
339
|
+
- \`clavix task-complete <taskId>\` - Mark task complete with validation, auto-show next task
|
|
340
|
+
|
|
341
|
+
### Project Management
|
|
342
|
+
- \`clavix list [--sessions|--outputs]\` - List sessions and/or output projects
|
|
343
|
+
- \`clavix show [session-id|--output <project>]\` - Inspect session or project details
|
|
344
|
+
- \`clavix archive [project] [--restore]\` - Archive completed projects or restore them
|
|
345
|
+
|
|
346
|
+
### Configuration
|
|
311
347
|
- \`clavix init\` - Initialize Clavix (you just ran this!)
|
|
312
|
-
- \`clavix
|
|
313
|
-
- \`clavix
|
|
314
|
-
- \`clavix
|
|
315
|
-
- \`clavix start\` - Start conversational mode
|
|
316
|
-
- \`clavix summarize\` - Analyze conversation and extract prompt
|
|
317
|
-
- \`clavix list\` - List sessions and outputs
|
|
318
|
-
- \`clavix update\` - Update Clavix managed blocks
|
|
348
|
+
- \`clavix config [get|set|edit|reset]\` - Manage configuration preferences
|
|
349
|
+
- \`clavix update [--docs-only|--commands-only]\` - Refresh managed docs and slash commands
|
|
350
|
+
- \`clavix version\` - Print installed version
|
|
319
351
|
|
|
320
|
-
## Slash Commands (AI
|
|
352
|
+
## Slash Commands (AI Agents)
|
|
321
353
|
|
|
322
|
-
If using Claude Code, the following slash commands are
|
|
354
|
+
If using Claude Code, Cursor, or Windsurf, the following slash commands are available:
|
|
323
355
|
|
|
356
|
+
### Prompt Improvement
|
|
324
357
|
- \`/clavix:fast [prompt]\` - Quick prompt improvements
|
|
325
358
|
- \`/clavix:deep [prompt]\` - Comprehensive prompt analysis
|
|
326
|
-
- \`/clavix:
|
|
359
|
+
- \`/clavix:execute\` - Execute saved prompts
|
|
360
|
+
- \`/clavix:prompts\` - Manage prompt lifecycle
|
|
361
|
+
|
|
362
|
+
### PRD & Planning
|
|
363
|
+
- \`/clavix:prd\` - Generate PRD through guided questions
|
|
364
|
+
- \`/clavix:plan\` - Generate task breakdown from PRD
|
|
327
365
|
- \`/clavix:start\` - Start conversational mode
|
|
328
366
|
- \`/clavix:summarize\` - Summarize conversation
|
|
329
367
|
|
|
368
|
+
### Implementation
|
|
369
|
+
- \`/clavix:implement\` - Execute task workflow with git integration
|
|
370
|
+
- \`/clavix:task-complete\` - Mark task as complete
|
|
371
|
+
|
|
372
|
+
### Project Management
|
|
373
|
+
- \`/clavix:archive\` - Archive completed projects
|
|
374
|
+
|
|
375
|
+
## Workflows
|
|
376
|
+
|
|
377
|
+
### Prompt Lifecycle (v2.7+)
|
|
378
|
+
|
|
379
|
+
1. **Create improved prompt**:
|
|
380
|
+
\`\`\`bash
|
|
381
|
+
clavix fast "your prompt here"
|
|
382
|
+
# or
|
|
383
|
+
clavix deep "your prompt here"
|
|
384
|
+
\`\`\`
|
|
385
|
+
- CLI auto-saves to \`.clavix/outputs/prompts/fast/\` or \`deep/\`
|
|
386
|
+
- Slash commands require manual save per template instructions
|
|
387
|
+
|
|
388
|
+
2. **Execute saved prompt**:
|
|
389
|
+
\`\`\`bash
|
|
390
|
+
clavix execute --latest # Most recent prompt
|
|
391
|
+
clavix execute # Interactive selection
|
|
392
|
+
\`\`\`
|
|
393
|
+
|
|
394
|
+
3. **Manage prompts**:
|
|
395
|
+
\`\`\`bash
|
|
396
|
+
clavix prompts list # View all with status
|
|
397
|
+
clavix prompts clear --executed # Remove executed prompts
|
|
398
|
+
clavix prompts clear --stale # Remove stale (30+ days)
|
|
399
|
+
\`\`\`
|
|
400
|
+
|
|
401
|
+
**Prompt Status**:
|
|
402
|
+
- \`NEW\` - Just created, never executed
|
|
403
|
+
- \`EXECUTED\` - Successfully executed at least once
|
|
404
|
+
- \`OLD\` - 7+ days old, not executed
|
|
405
|
+
- \`STALE\` - 30+ days old, not executed
|
|
406
|
+
|
|
407
|
+
### Implementation Workflow (v1.3+)
|
|
408
|
+
|
|
409
|
+
1. **Generate PRD**:
|
|
410
|
+
\`\`\`bash
|
|
411
|
+
clavix prd
|
|
412
|
+
# Creates: .clavix/outputs/<project>/full-prd.md + quick-prd.md
|
|
413
|
+
\`\`\`
|
|
414
|
+
|
|
415
|
+
2. **Create task breakdown**:
|
|
416
|
+
\`\`\`bash
|
|
417
|
+
clavix plan
|
|
418
|
+
# Creates: .clavix/outputs/<project>/tasks.md
|
|
419
|
+
\`\`\`
|
|
420
|
+
|
|
421
|
+
3. **Execute tasks with git integration**:
|
|
422
|
+
\`\`\`bash
|
|
423
|
+
# Manual commits (default):
|
|
424
|
+
clavix implement
|
|
425
|
+
|
|
426
|
+
# Or with auto-commit strategy:
|
|
427
|
+
clavix implement --commit-strategy=per-phase
|
|
428
|
+
\`\`\`
|
|
429
|
+
|
|
430
|
+
4. **Mark tasks complete**:
|
|
431
|
+
\`\`\`bash
|
|
432
|
+
clavix task-complete <taskId>
|
|
433
|
+
# Validates completion, optionally commits, shows next task
|
|
434
|
+
\`\`\`
|
|
435
|
+
|
|
436
|
+
5. **Archive when done**:
|
|
437
|
+
\`\`\`bash
|
|
438
|
+
clavix archive my-project
|
|
439
|
+
\`\`\`
|
|
440
|
+
|
|
441
|
+
### Git Auto-Commit Strategies (v2.8.1)
|
|
442
|
+
|
|
443
|
+
When using \`clavix implement --commit-strategy=<type>\`:
|
|
444
|
+
|
|
445
|
+
- \`none\` (default) - Manual git workflow, full control
|
|
446
|
+
- \`per-task\` - Commit after each completed task (detailed history)
|
|
447
|
+
- \`per-5-tasks\` - Commit every 5 tasks (balanced)
|
|
448
|
+
- \`per-phase\` - Commit when phase completes (milestone-based)
|
|
449
|
+
|
|
450
|
+
**Recommendation**: Use \`none\` for most projects. Only enable auto-commits for large implementations with clear phases.
|
|
451
|
+
|
|
330
452
|
## When to Use Which Mode
|
|
331
453
|
|
|
332
|
-
- **Fast mode
|
|
333
|
-
- **Deep mode
|
|
334
|
-
- **PRD mode
|
|
454
|
+
- **Fast mode**: Quick cleanup for simple prompts (1-2 iterations)
|
|
455
|
+
- **Deep mode**: Complex requirements needing comprehensive analysis (3-5 alternatives)
|
|
456
|
+
- **PRD mode**: Strategic planning with architecture, risks, and business impact
|
|
457
|
+
- **Conversational mode** (\`start\`/\`summarize\`): Natural discussion → extract structured requirements
|
|
458
|
+
|
|
459
|
+
## Typical Workflows
|
|
460
|
+
|
|
461
|
+
**Improve a prompt quickly**:
|
|
462
|
+
\`\`\`bash
|
|
463
|
+
clavix fast "Add user authentication"
|
|
464
|
+
clavix execute --latest
|
|
465
|
+
\`\`\`
|
|
466
|
+
|
|
467
|
+
**Create and execute strategy**:
|
|
468
|
+
\`\`\`bash
|
|
469
|
+
clavix prd # Generate PRD
|
|
470
|
+
clavix plan # Create tasks.md
|
|
471
|
+
clavix implement # Execute with manual commits
|
|
472
|
+
\`\`\`
|
|
473
|
+
|
|
474
|
+
**Capture conversation**:
|
|
475
|
+
\`\`\`bash
|
|
476
|
+
clavix start # Record conversation
|
|
477
|
+
# ... discuss requirements ...
|
|
478
|
+
clavix summarize # Extract mini-PRD + prompt
|
|
479
|
+
\`\`\`
|
|
480
|
+
|
|
481
|
+
**Stay organized**:
|
|
482
|
+
\`\`\`bash
|
|
483
|
+
clavix list # See all projects
|
|
484
|
+
clavix show --output my-project
|
|
485
|
+
clavix archive my-project
|
|
486
|
+
\`\`\`
|
|
335
487
|
|
|
336
488
|
## Customization
|
|
337
489
|
|
|
338
|
-
|
|
339
|
-
|
|
490
|
+
Create custom templates in \`.clavix/templates/\` to override defaults:
|
|
491
|
+
- \`fast.txt\` - Custom fast mode template
|
|
492
|
+
- \`deep.txt\` - Custom deep mode template
|
|
493
|
+
- \`prd-questions.txt\` - Custom PRD questions
|
|
494
|
+
|
|
495
|
+
Edit configuration:
|
|
496
|
+
\`\`\`bash
|
|
497
|
+
clavix config edit # Opens config.json in $EDITOR
|
|
498
|
+
clavix config set key=value
|
|
499
|
+
\`\`\`
|
|
340
500
|
|
|
341
501
|
## Need Help?
|
|
342
502
|
|
|
343
|
-
- Documentation
|
|
344
|
-
- Issues
|
|
503
|
+
- **Documentation**: https://github.com/ClavixDev/Clavix
|
|
504
|
+
- **Issues**: https://github.com/ClavixDev/Clavix/issues
|
|
505
|
+
- **Version**: Run \`clavix version\` to check your installed version
|
|
506
|
+
- **Update managed blocks**: Run \`clavix update\` to refresh documentation
|
|
345
507
|
`;
|
|
346
508
|
await FileSystem.writeFileAtomic('.clavix/INSTRUCTIONS.md', instructions);
|
|
347
509
|
}
|
|
@@ -6,18 +6,19 @@ export default class Prd extends Command {
|
|
|
6
6
|
quick: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
7
7
|
project: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
8
8
|
template: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
9
|
-
'skip-validation': import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
10
9
|
};
|
|
11
10
|
run(): Promise<void>;
|
|
12
11
|
/**
|
|
13
|
-
*
|
|
14
|
-
|
|
12
|
+
* Derive a project name from the answers
|
|
13
|
+
*/
|
|
14
|
+
private deriveProjectName;
|
|
15
|
+
/**
|
|
16
|
+
* Auto-detect project tech stack from common config files
|
|
15
17
|
*/
|
|
16
18
|
private detectProjectTechStack;
|
|
17
19
|
/**
|
|
18
|
-
* Validate the generated quick-prd.md
|
|
19
|
-
* Focuses on C, L, E components for AI consumption quality
|
|
20
|
+
* Validate the generated quick-prd.md for AI consumption quality
|
|
20
21
|
*/
|
|
21
|
-
private
|
|
22
|
+
private validatePrdQuality;
|
|
22
23
|
}
|
|
23
24
|
//# sourceMappingURL=prd.d.ts.map
|
package/dist/cli/commands/prd.js
CHANGED
|
@@ -7,11 +7,11 @@ import { dirname } from 'path';
|
|
|
7
7
|
import fs from 'fs-extra';
|
|
8
8
|
import { QuestionEngine } from '../../core/question-engine.js';
|
|
9
9
|
import { PrdGenerator } from '../../core/prd-generator.js';
|
|
10
|
-
import {
|
|
10
|
+
import { UniversalOptimizer } from '../../core/intelligence/index.js';
|
|
11
11
|
const __filename = fileURLToPath(import.meta.url);
|
|
12
12
|
const __dirname = dirname(__filename);
|
|
13
13
|
export default class Prd extends Command {
|
|
14
|
-
static description = '
|
|
14
|
+
static description = 'Launch Clavix Planning Mode - transform ideas into structured PRDs through strategic questions';
|
|
15
15
|
static examples = [
|
|
16
16
|
'<%= config.bin %> <%= command.id %>',
|
|
17
17
|
'<%= config.bin %> <%= command.id %> --quick',
|
|
@@ -31,15 +31,14 @@ export default class Prd extends Command {
|
|
|
31
31
|
char: 't',
|
|
32
32
|
description: 'Path to custom question template',
|
|
33
33
|
}),
|
|
34
|
-
'skip-validation': Flags.boolean({
|
|
35
|
-
description: 'Skip CLEAR framework validation of generated PRD',
|
|
36
|
-
default: false,
|
|
37
|
-
}),
|
|
38
34
|
};
|
|
39
35
|
async run() {
|
|
40
36
|
const { flags } = await this.parse(Prd);
|
|
41
|
-
console.log(chalk.bold.cyan('\
|
|
42
|
-
console.log(chalk.gray(
|
|
37
|
+
console.log(chalk.bold.cyan('\n🔑 Clavix Planning Mode\n'));
|
|
38
|
+
console.log(chalk.gray('Transform your idea into structured requirements through strategic questions.\n'));
|
|
39
|
+
console.log(chalk.gray('This will generate two documents:'));
|
|
40
|
+
console.log(chalk.gray(' 📄 Full PRD - Comprehensive team-facing document'));
|
|
41
|
+
console.log(chalk.gray(' ⚡ Quick PRD - AI-optimized 2-3 paragraph version\n'));
|
|
43
42
|
try {
|
|
44
43
|
// Initialize QuestionEngine
|
|
45
44
|
const engine = new QuestionEngine();
|
|
@@ -85,91 +84,108 @@ export default class Prd extends Command {
|
|
|
85
84
|
}
|
|
86
85
|
else {
|
|
87
86
|
// Text input
|
|
88
|
-
// Capture question reference for closure
|
|
89
87
|
const currentQuestion = question;
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
if (currentQuestion.id === 'q3' && !stackDetectionDone) {
|
|
88
|
+
// Special handling for tech stack question - auto-detect
|
|
89
|
+
if (question.id === 'techStack' && !stackDetectionDone) {
|
|
93
90
|
detectedStack = await this.detectProjectTechStack();
|
|
94
91
|
stackDetectionDone = true;
|
|
95
92
|
if (detectedStack) {
|
|
96
|
-
|
|
93
|
+
console.log(chalk.cyan(`\n💡 Detected: ${detectedStack}\n`));
|
|
94
|
+
const useDetected = await inquirer.prompt([
|
|
95
|
+
{
|
|
96
|
+
type: 'confirm',
|
|
97
|
+
name: 'use',
|
|
98
|
+
message: 'Use detected tech stack?',
|
|
99
|
+
default: true,
|
|
100
|
+
},
|
|
101
|
+
]);
|
|
102
|
+
if (useDetected.use) {
|
|
103
|
+
answer = detectedStack;
|
|
104
|
+
engine.submitAnswer(question.id, answer);
|
|
105
|
+
question = engine.getNextQuestion();
|
|
106
|
+
continue;
|
|
107
|
+
}
|
|
97
108
|
}
|
|
98
109
|
}
|
|
99
110
|
const response = await inquirer.prompt([
|
|
100
111
|
{
|
|
101
112
|
type: 'input',
|
|
102
113
|
name: 'answer',
|
|
103
|
-
message:
|
|
104
|
-
default:
|
|
105
|
-
validate: (input) => {
|
|
106
|
-
// Check if required
|
|
114
|
+
message: question.text,
|
|
115
|
+
default: question.default,
|
|
116
|
+
validate: question.validate || ((input) => {
|
|
107
117
|
if (currentQuestion.required && !input.trim()) {
|
|
108
|
-
return 'This
|
|
109
|
-
}
|
|
110
|
-
// Run custom validation if exists
|
|
111
|
-
if (currentQuestion.validate) {
|
|
112
|
-
const result = currentQuestion.validate(input);
|
|
113
|
-
if (result !== true) {
|
|
114
|
-
return result;
|
|
115
|
-
}
|
|
118
|
+
return 'This field is required';
|
|
116
119
|
}
|
|
117
120
|
return true;
|
|
118
|
-
},
|
|
121
|
+
}),
|
|
119
122
|
},
|
|
120
123
|
]);
|
|
121
124
|
answer = response.answer;
|
|
122
|
-
// If Q3 and answer is empty but we have detected stack, use it
|
|
123
|
-
if (currentQuestion.id === 'q3' && !answer.trim() && detectedStack) {
|
|
124
|
-
answer = detectedStack;
|
|
125
|
-
console.log(chalk.dim(` Using detected: ${detectedStack}`));
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
// Submit answer (only if not empty or if it's a detected stack for Q3)
|
|
129
|
-
if (answer && answer.toString().trim() && question) {
|
|
130
|
-
const submitResult = engine.submitAnswer(question.id, answer);
|
|
131
|
-
if (submitResult !== true) {
|
|
132
|
-
console.log(chalk.red(`\n${submitResult}\n`));
|
|
133
|
-
continue; // Ask again
|
|
134
|
-
}
|
|
135
|
-
answers[question.id] = answer;
|
|
136
125
|
}
|
|
137
|
-
|
|
126
|
+
// Submit answer and get next question
|
|
127
|
+
engine.submitAnswer(question.id, answer);
|
|
128
|
+
answers[question.id] = answer;
|
|
138
129
|
question = engine.getNextQuestion();
|
|
130
|
+
console.log();
|
|
139
131
|
}
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
132
|
+
console.log(chalk.green('\n✓ All questions answered\n'));
|
|
133
|
+
// Determine project name
|
|
134
|
+
const projectName = flags.project || this.deriveProjectName(answers);
|
|
135
|
+
// Generate PRD documents
|
|
136
|
+
console.log(chalk.cyan('📝 Generating PRD documents...\n'));
|
|
144
137
|
const generator = new PrdGenerator();
|
|
145
|
-
const
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
console.log();
|
|
155
|
-
console.log(chalk.
|
|
156
|
-
console.log(chalk.
|
|
157
|
-
console.log(chalk.gray(`
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
console.log(chalk.gray('Tip: Use quick-prd.md as input for your AI agent to start development\n'));
|
|
138
|
+
const outputPath = path.join(process.cwd(), '.clavix', 'outputs', projectName);
|
|
139
|
+
await fs.ensureDir(outputPath);
|
|
140
|
+
// Generate both full and quick PRDs
|
|
141
|
+
await generator.generateFullPrd(answers, outputPath);
|
|
142
|
+
await generator.generateQuickPrd(answers, outputPath);
|
|
143
|
+
console.log(chalk.green('✓ PRD documents generated\n'));
|
|
144
|
+
// Validate the quick PRD for AI consumption quality
|
|
145
|
+
await this.validatePrdQuality(outputPath);
|
|
146
|
+
// Display output locations
|
|
147
|
+
console.log(chalk.bold.cyan('📄 Documents Generated:\n'));
|
|
148
|
+
console.log(chalk.cyan(` • full-prd.md - Comprehensive team-facing document`));
|
|
149
|
+
console.log(chalk.cyan(` • quick-prd.md - AI-optimized 2-3 paragraph version\n`));
|
|
150
|
+
console.log(chalk.gray(`Location: ${outputPath}\n`));
|
|
151
|
+
// Next steps
|
|
152
|
+
console.log(chalk.bold.blue('💡 Next Steps:\n'));
|
|
153
|
+
console.log(chalk.blue(' 1. Review the generated documents'));
|
|
154
|
+
console.log(chalk.blue(' 2. Run: clavix plan (generate task breakdown)'));
|
|
155
|
+
console.log(chalk.blue(' 3. Run: clavix implement (start implementation)\n'));
|
|
164
156
|
}
|
|
165
157
|
catch (error) {
|
|
166
|
-
|
|
167
|
-
|
|
158
|
+
if (error instanceof Error) {
|
|
159
|
+
console.log(chalk.red(`\n✗ Error: ${error.message}\n`));
|
|
160
|
+
}
|
|
161
|
+
else {
|
|
162
|
+
console.log(chalk.red('\n✗ An unexpected error occurred\n'));
|
|
163
|
+
}
|
|
164
|
+
this.exit(1);
|
|
168
165
|
}
|
|
169
166
|
}
|
|
170
167
|
/**
|
|
171
|
-
*
|
|
172
|
-
|
|
168
|
+
* Derive a project name from the answers
|
|
169
|
+
*/
|
|
170
|
+
deriveProjectName(answers) {
|
|
171
|
+
// Try to extract from first answer (usually "what are we building")
|
|
172
|
+
const firstAnswer = Object.values(answers)[0];
|
|
173
|
+
if (typeof firstAnswer === 'string') {
|
|
174
|
+
// Extract first few words, convert to kebab-case
|
|
175
|
+
const words = firstAnswer.toLowerCase()
|
|
176
|
+
.replace(/[^a-z0-9\s]/g, '')
|
|
177
|
+
.split(/\s+/)
|
|
178
|
+
.filter(w => w.length > 0)
|
|
179
|
+
.slice(0, 3);
|
|
180
|
+
if (words.length > 0) {
|
|
181
|
+
return words.join('-');
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
// Fallback to timestamp
|
|
185
|
+
return `project-${Date.now()}`;
|
|
186
|
+
}
|
|
187
|
+
/**
|
|
188
|
+
* Auto-detect project tech stack from common config files
|
|
173
189
|
*/
|
|
174
190
|
async detectProjectTechStack() {
|
|
175
191
|
const detectedTech = [];
|
|
@@ -248,20 +264,18 @@ export default class Prd extends Command {
|
|
|
248
264
|
}
|
|
249
265
|
}
|
|
250
266
|
/**
|
|
251
|
-
* Validate the generated quick-prd.md
|
|
252
|
-
* Focuses on C, L, E components for AI consumption quality
|
|
267
|
+
* Validate the generated quick-prd.md for AI consumption quality
|
|
253
268
|
*/
|
|
254
|
-
async
|
|
269
|
+
async validatePrdQuality(outputPath) {
|
|
255
270
|
try {
|
|
256
271
|
const quickPrdPath = path.join(outputPath, 'quick-prd.md');
|
|
257
272
|
// Read the generated quick-prd.md
|
|
258
273
|
const prdContent = await fs.readFile(quickPrdPath, 'utf-8');
|
|
259
|
-
console.log(chalk.bold.cyan('
|
|
260
|
-
console.log(chalk.gray('Analyzing
|
|
261
|
-
// Run
|
|
262
|
-
const optimizer = new
|
|
263
|
-
const
|
|
264
|
-
const clearScore = optimizer.calculateCLEARScore(clearResult);
|
|
274
|
+
console.log(chalk.bold.cyan('✅ Validating Quick PRD Quality\n'));
|
|
275
|
+
console.log(chalk.gray('Analyzing for AI consumption quality...\n'));
|
|
276
|
+
// Run quality assessment
|
|
277
|
+
const optimizer = new UniversalOptimizer();
|
|
278
|
+
const result = await optimizer.optimize(prdContent, 'fast');
|
|
265
279
|
const getScoreColor = (score) => {
|
|
266
280
|
if (score >= 80)
|
|
267
281
|
return chalk.green;
|
|
@@ -269,70 +283,37 @@ export default class Prd extends Command {
|
|
|
269
283
|
return chalk.yellow;
|
|
270
284
|
return chalk.red;
|
|
271
285
|
};
|
|
272
|
-
// Display
|
|
273
|
-
console.log(chalk.bold('
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
console.log(
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
});
|
|
281
|
-
}
|
|
282
|
-
console.log();
|
|
283
|
-
// Logic
|
|
284
|
-
const lColor = getScoreColor(clearScore.logic);
|
|
285
|
-
console.log(lColor.bold(` [L] Logical: ${clearScore.logic.toFixed(0)}%`));
|
|
286
|
-
if (clearResult.logic.suggestions.length > 0) {
|
|
287
|
-
clearResult.logic.suggestions.slice(0, 2).forEach((s) => {
|
|
288
|
-
console.log(lColor(` ${s}`));
|
|
289
|
-
});
|
|
286
|
+
// Display quality assessment
|
|
287
|
+
console.log(chalk.bold('📊 Quality Assessment:\n'));
|
|
288
|
+
console.log(getScoreColor(result.quality.clarity)(` Clarity: ${result.quality.clarity.toFixed(0)}%`));
|
|
289
|
+
console.log(getScoreColor(result.quality.structure)(` Structure: ${result.quality.structure.toFixed(0)}%`));
|
|
290
|
+
console.log(getScoreColor(result.quality.completeness)(` Completeness: ${result.quality.completeness.toFixed(0)}%`));
|
|
291
|
+
console.log(getScoreColor(result.quality.overall).bold(`\n Overall: ${result.quality.overall.toFixed(0)}%\n`));
|
|
292
|
+
if (result.quality.overall >= 80) {
|
|
293
|
+
console.log(chalk.green('✨ Excellent! Your Quick PRD is AI-ready.\n'));
|
|
290
294
|
}
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
clearResult.explicitness.suggestions.slice(0, 2).forEach((s) => {
|
|
297
|
-
console.log(eColor(` ${s}`));
|
|
298
|
-
});
|
|
299
|
-
}
|
|
300
|
-
console.log();
|
|
301
|
-
// Overall
|
|
302
|
-
const overallColor = getScoreColor(clearScore.overall);
|
|
303
|
-
console.log(overallColor.bold(` Overall CLEAR Score: ${clearScore.overall.toFixed(0)}% (${clearScore.rating})\n`));
|
|
304
|
-
// Recommendations
|
|
305
|
-
if (clearScore.overall < 80) {
|
|
306
|
-
console.log(chalk.yellow('💡 PRD Quality Tips:\n'));
|
|
307
|
-
if (clearScore.conciseness < 80 && clearResult.conciseness.suggestions.length > 0) {
|
|
308
|
-
console.log(chalk.yellow(' [C] Consider making the PRD more concise:'));
|
|
309
|
-
clearResult.conciseness.suggestions.slice(0, 2).forEach((s) => {
|
|
310
|
-
console.log(chalk.yellow(` • ${s}`));
|
|
311
|
-
});
|
|
312
|
-
console.log();
|
|
313
|
-
}
|
|
314
|
-
if (clearScore.logic < 80 && clearResult.logic.suggestions.length > 0) {
|
|
315
|
-
console.log(chalk.yellow(' [L] Improve logical structure:'));
|
|
316
|
-
clearResult.logic.suggestions.slice(0, 2).forEach((s) => {
|
|
317
|
-
console.log(chalk.yellow(` • ${s}`));
|
|
295
|
+
else if (result.quality.overall >= 70) {
|
|
296
|
+
console.log(chalk.yellow('✓ Good quality. Consider the suggestions below:\n'));
|
|
297
|
+
if (result.quality.improvements && result.quality.improvements.length > 0) {
|
|
298
|
+
result.quality.improvements.forEach((imp) => {
|
|
299
|
+
console.log(chalk.yellow(` • ${imp}`));
|
|
318
300
|
});
|
|
319
301
|
console.log();
|
|
320
302
|
}
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
303
|
+
}
|
|
304
|
+
else {
|
|
305
|
+
console.log(chalk.yellow('💡 Suggestions for improvement:\n'));
|
|
306
|
+
if (result.quality.improvements && result.quality.improvements.length > 0) {
|
|
307
|
+
result.quality.improvements.forEach((imp) => {
|
|
308
|
+
console.log(chalk.yellow(` • ${imp}`));
|
|
325
309
|
});
|
|
326
310
|
console.log();
|
|
327
311
|
}
|
|
328
312
|
}
|
|
329
|
-
else {
|
|
330
|
-
console.log(chalk.green('✨ Excellent! This PRD is well-optimized for AI consumption.\n'));
|
|
331
|
-
}
|
|
332
313
|
}
|
|
333
|
-
catch {
|
|
334
|
-
|
|
335
|
-
console.log(chalk.
|
|
314
|
+
catch (error) {
|
|
315
|
+
console.log(chalk.yellow('⚠️ Could not validate PRD quality'));
|
|
316
|
+
console.log(chalk.gray('Continuing without validation...\n'));
|
|
336
317
|
}
|
|
337
318
|
}
|
|
338
319
|
}
|
|
@@ -8,21 +8,10 @@ export default class Summarize extends Command {
|
|
|
8
8
|
static flags: {
|
|
9
9
|
active: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
10
10
|
output: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
11
|
-
'skip-clear': import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
12
11
|
};
|
|
13
12
|
run(): Promise<void>;
|
|
14
|
-
/**
|
|
15
|
-
* Display analysis summary
|
|
16
|
-
*/
|
|
17
13
|
private displayAnalysisSummary;
|
|
18
|
-
|
|
19
|
-
* Sanitize project name for directory name
|
|
20
|
-
*/
|
|
14
|
+
private applyOptimization;
|
|
21
15
|
private sanitizeProjectName;
|
|
22
|
-
/**
|
|
23
|
-
* Apply CLEAR framework optimization to extracted prompt
|
|
24
|
-
* Shows both raw extraction and CLEAR-enhanced version
|
|
25
|
-
*/
|
|
26
|
-
private applyClearOptimization;
|
|
27
16
|
}
|
|
28
17
|
//# sourceMappingURL=summarize.d.ts.map
|