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.
- package/README.md +69 -61
- package/dist/templates/slash-commands/_canonical/archive.md +83 -121
- package/dist/templates/slash-commands/_canonical/execute.md +32 -42
- package/dist/templates/slash-commands/_canonical/implement.md +32 -44
- package/dist/templates/slash-commands/_canonical/improve.md +13 -52
- package/dist/templates/slash-commands/_components/agent-protocols/cli-reference.md +84 -180
- package/dist/templates/slash-commands/_components/agent-protocols/error-handling.md +2 -2
- package/dist/templates/slash-commands/_components/agent-protocols/file-formats.md +41 -59
- package/dist/templates/slash-commands/_components/sections/file-saving-protocol.md +20 -27
- package/dist/templates/slash-commands/_components/troubleshooting/file-not-saved.md +4 -5
- package/package.json +2 -2
- package/dist/cli/commands/analyze.d.ts +0 -17
- package/dist/cli/commands/analyze.js +0 -133
- package/dist/cli/commands/archive.d.ts +0 -36
- package/dist/cli/commands/archive.js +0 -266
- package/dist/cli/commands/deep.d.ts +0 -17
- package/dist/cli/commands/deep.js +0 -170
- package/dist/cli/commands/execute.d.ts +0 -15
- package/dist/cli/commands/execute.js +0 -168
- package/dist/cli/commands/fast.d.ts +0 -18
- package/dist/cli/commands/fast.js +0 -219
- package/dist/cli/commands/implement.d.ts +0 -24
- package/dist/cli/commands/implement.js +0 -289
- package/dist/cli/commands/improve.d.ts +0 -32
- package/dist/cli/commands/improve.js +0 -250
- package/dist/cli/commands/list.d.ts +0 -17
- package/dist/cli/commands/list.js +0 -217
- package/dist/cli/commands/plan.d.ts +0 -21
- package/dist/cli/commands/plan.js +0 -297
- package/dist/cli/commands/prd.d.ts +0 -24
- package/dist/cli/commands/prd.js +0 -321
- package/dist/cli/commands/prompts/clear.d.ts +0 -16
- package/dist/cli/commands/prompts/clear.js +0 -222
- package/dist/cli/commands/prompts/list.d.ts +0 -8
- package/dist/cli/commands/prompts/list.js +0 -88
- package/dist/cli/commands/show.d.ts +0 -21
- package/dist/cli/commands/show.js +0 -191
- package/dist/cli/commands/start.d.ts +0 -40
- package/dist/cli/commands/start.js +0 -210
- package/dist/cli/commands/summarize.d.ts +0 -17
- package/dist/cli/commands/summarize.js +0 -196
- package/dist/cli/commands/task-complete.d.ts +0 -27
- package/dist/cli/commands/task-complete.js +0 -269
- package/dist/cli/commands/verify.d.ts +0 -28
- package/dist/cli/commands/verify.js +0 -349
- package/dist/core/archive-manager.d.ts +0 -100
- package/dist/core/archive-manager.js +0 -302
- package/dist/core/basic-checklist-generator.d.ts +0 -35
- package/dist/core/basic-checklist-generator.js +0 -344
- package/dist/core/checklist-parser.d.ts +0 -48
- package/dist/core/checklist-parser.js +0 -238
- package/dist/core/config-manager.d.ts +0 -149
- package/dist/core/config-manager.js +0 -230
- package/dist/core/conversation-analyzer.d.ts +0 -86
- package/dist/core/conversation-analyzer.js +0 -387
- package/dist/core/conversation-quality-tracker.d.ts +0 -81
- package/dist/core/conversation-quality-tracker.js +0 -195
- package/dist/core/git-manager.d.ts +0 -126
- package/dist/core/git-manager.js +0 -282
- package/dist/core/intelligence/confidence-calculator.d.ts +0 -93
- package/dist/core/intelligence/confidence-calculator.js +0 -124
- package/dist/core/intelligence/index.d.ts +0 -11
- package/dist/core/intelligence/index.js +0 -15
- package/dist/core/intelligence/intent-detector.d.ts +0 -54
- package/dist/core/intelligence/intent-detector.js +0 -723
- package/dist/core/intelligence/pattern-library.d.ts +0 -104
- package/dist/core/intelligence/pattern-library.js +0 -330
- package/dist/core/intelligence/patterns/actionability-enhancer.d.ts +0 -27
- package/dist/core/intelligence/patterns/actionability-enhancer.js +0 -192
- package/dist/core/intelligence/patterns/alternative-phrasing-generator.d.ts +0 -29
- package/dist/core/intelligence/patterns/alternative-phrasing-generator.js +0 -239
- package/dist/core/intelligence/patterns/ambiguity-detector.d.ts +0 -22
- package/dist/core/intelligence/patterns/ambiguity-detector.js +0 -196
- package/dist/core/intelligence/patterns/assumption-explicitizer.d.ts +0 -30
- package/dist/core/intelligence/patterns/assumption-explicitizer.js +0 -296
- package/dist/core/intelligence/patterns/base-pattern.d.ts +0 -192
- package/dist/core/intelligence/patterns/base-pattern.js +0 -103
- package/dist/core/intelligence/patterns/completeness-validator.d.ts +0 -27
- package/dist/core/intelligence/patterns/completeness-validator.js +0 -221
- package/dist/core/intelligence/patterns/conciseness-filter.d.ts +0 -20
- package/dist/core/intelligence/patterns/conciseness-filter.js +0 -92
- package/dist/core/intelligence/patterns/context-precision.d.ts +0 -32
- package/dist/core/intelligence/patterns/context-precision.js +0 -389
- package/dist/core/intelligence/patterns/conversation-summarizer.d.ts +0 -30
- package/dist/core/intelligence/patterns/conversation-summarizer.js +0 -277
- package/dist/core/intelligence/patterns/dependency-identifier.d.ts +0 -23
- package/dist/core/intelligence/patterns/dependency-identifier.js +0 -166
- package/dist/core/intelligence/patterns/domain-context-enricher.d.ts +0 -21
- package/dist/core/intelligence/patterns/domain-context-enricher.js +0 -198
- package/dist/core/intelligence/patterns/edge-case-identifier.d.ts +0 -30
- package/dist/core/intelligence/patterns/edge-case-identifier.js +0 -269
- package/dist/core/intelligence/patterns/error-tolerance-enhancer.d.ts +0 -22
- package/dist/core/intelligence/patterns/error-tolerance-enhancer.js +0 -179
- package/dist/core/intelligence/patterns/implicit-requirement-extractor.d.ts +0 -24
- package/dist/core/intelligence/patterns/implicit-requirement-extractor.js +0 -259
- package/dist/core/intelligence/patterns/objective-clarifier.d.ts +0 -22
- package/dist/core/intelligence/patterns/objective-clarifier.js +0 -126
- package/dist/core/intelligence/patterns/output-format-enforcer.d.ts +0 -22
- package/dist/core/intelligence/patterns/output-format-enforcer.js +0 -151
- package/dist/core/intelligence/patterns/prd-structure-enforcer.d.ts +0 -23
- package/dist/core/intelligence/patterns/prd-structure-enforcer.js +0 -183
- package/dist/core/intelligence/patterns/prerequisite-identifier.d.ts +0 -23
- package/dist/core/intelligence/patterns/prerequisite-identifier.js +0 -221
- package/dist/core/intelligence/patterns/requirement-prioritizer.d.ts +0 -24
- package/dist/core/intelligence/patterns/requirement-prioritizer.js +0 -134
- package/dist/core/intelligence/patterns/scope-definer.d.ts +0 -26
- package/dist/core/intelligence/patterns/scope-definer.js +0 -236
- package/dist/core/intelligence/patterns/step-decomposer.d.ts +0 -31
- package/dist/core/intelligence/patterns/step-decomposer.js +0 -242
- package/dist/core/intelligence/patterns/structure-organizer.d.ts +0 -31
- package/dist/core/intelligence/patterns/structure-organizer.js +0 -218
- package/dist/core/intelligence/patterns/success-criteria-enforcer.d.ts +0 -22
- package/dist/core/intelligence/patterns/success-criteria-enforcer.js +0 -165
- package/dist/core/intelligence/patterns/success-metrics-enforcer.d.ts +0 -24
- package/dist/core/intelligence/patterns/success-metrics-enforcer.js +0 -165
- package/dist/core/intelligence/patterns/technical-context-enricher.d.ts +0 -25
- package/dist/core/intelligence/patterns/technical-context-enricher.js +0 -165
- package/dist/core/intelligence/patterns/topic-coherence-analyzer.d.ts +0 -26
- package/dist/core/intelligence/patterns/topic-coherence-analyzer.js +0 -300
- package/dist/core/intelligence/patterns/user-persona-enricher.d.ts +0 -24
- package/dist/core/intelligence/patterns/user-persona-enricher.js +0 -141
- package/dist/core/intelligence/patterns/validation-checklist-creator.d.ts +0 -31
- package/dist/core/intelligence/patterns/validation-checklist-creator.js +0 -242
- package/dist/core/intelligence/quality-assessor.d.ts +0 -71
- package/dist/core/intelligence/quality-assessor.js +0 -525
- package/dist/core/intelligence/types.d.ts +0 -111
- package/dist/core/intelligence/types.js +0 -3
- package/dist/core/intelligence/universal-optimizer.d.ts +0 -91
- package/dist/core/intelligence/universal-optimizer.js +0 -399
- package/dist/core/prd-generator.d.ts +0 -76
- package/dist/core/prd-generator.js +0 -173
- package/dist/core/prompt-manager.d.ts +0 -110
- package/dist/core/prompt-manager.js +0 -274
- package/dist/core/prompt-optimizer.d.ts +0 -268
- package/dist/core/prompt-optimizer.js +0 -959
- package/dist/core/question-engine.d.ts +0 -167
- package/dist/core/question-engine.js +0 -356
- package/dist/core/session-manager.d.ts +0 -139
- package/dist/core/session-manager.js +0 -365
- package/dist/core/task-manager.d.ts +0 -211
- package/dist/core/task-manager.js +0 -981
- package/dist/core/verification-hooks.d.ts +0 -67
- package/dist/core/verification-hooks.js +0 -309
- package/dist/core/verification-manager.d.ts +0 -107
- package/dist/core/verification-manager.js +0 -415
- package/dist/index 2.js +0 -13
- package/dist/index.d 2.ts +0 -4
- package/dist/types/session.d.ts +0 -78
- package/dist/types/session.js +0 -8
- package/dist/types/verification.d.ts +0 -205
- package/dist/types/verification.js +0 -9
|
@@ -1,133 +0,0 @@
|
|
|
1
|
-
import { Command, Args, Flags } from '@oclif/core';
|
|
2
|
-
import { UniversalOptimizer } from '../../core/intelligence/index.js';
|
|
3
|
-
export default class Analyze extends Command {
|
|
4
|
-
static description = 'Analyze a prompt and return structured JSON with intent, quality, and escalation data';
|
|
5
|
-
static examples = [
|
|
6
|
-
'<%= config.bin %> <%= command.id %> "Create a login page"',
|
|
7
|
-
'<%= config.bin %> <%= command.id %> "Build an API for user management" --pretty',
|
|
8
|
-
];
|
|
9
|
-
static flags = {
|
|
10
|
-
pretty: Flags.boolean({
|
|
11
|
-
char: 'p',
|
|
12
|
-
description: 'Pretty-print the JSON output',
|
|
13
|
-
default: false,
|
|
14
|
-
}),
|
|
15
|
-
};
|
|
16
|
-
static args = {
|
|
17
|
-
prompt: Args.string({
|
|
18
|
-
description: 'The prompt to analyze',
|
|
19
|
-
required: true,
|
|
20
|
-
}),
|
|
21
|
-
};
|
|
22
|
-
async run() {
|
|
23
|
-
const { args, flags } = await this.parse(Analyze);
|
|
24
|
-
if (!args.prompt || args.prompt.trim().length === 0) {
|
|
25
|
-
const errorOutput = {
|
|
26
|
-
error: 'No prompt provided',
|
|
27
|
-
message: 'Please provide a prompt to analyze',
|
|
28
|
-
};
|
|
29
|
-
console.log(JSON.stringify(errorOutput, null, flags.pretty ? 2 : 0));
|
|
30
|
-
this.exit(1);
|
|
31
|
-
return;
|
|
32
|
-
}
|
|
33
|
-
const optimizer = new UniversalOptimizer();
|
|
34
|
-
// v4.11: Use 'improve' mode for analysis
|
|
35
|
-
const result = await optimizer.optimize(args.prompt, 'improve');
|
|
36
|
-
// Calculate escalation score and recommendation
|
|
37
|
-
const escalation = this.calculateEscalation(result);
|
|
38
|
-
// Build the analysis result
|
|
39
|
-
const analysisResult = {
|
|
40
|
-
intent: result.intent.primaryIntent,
|
|
41
|
-
confidence: result.intent.confidence,
|
|
42
|
-
quality: {
|
|
43
|
-
overall: Math.round(result.quality.overall),
|
|
44
|
-
clarity: Math.round(result.quality.clarity),
|
|
45
|
-
efficiency: Math.round(result.quality.efficiency),
|
|
46
|
-
structure: Math.round(result.quality.structure),
|
|
47
|
-
completeness: Math.round(result.quality.completeness),
|
|
48
|
-
actionability: Math.round(result.quality.actionability),
|
|
49
|
-
specificity: Math.round(result.quality.specificity ?? 0),
|
|
50
|
-
},
|
|
51
|
-
escalation,
|
|
52
|
-
characteristics: {
|
|
53
|
-
hasCodeContext: result.intent.characteristics.hasCodeContext,
|
|
54
|
-
hasTechnicalTerms: result.intent.characteristics.hasTechnicalTerms,
|
|
55
|
-
isOpenEnded: result.intent.characteristics.isOpenEnded,
|
|
56
|
-
needsStructure: result.intent.characteristics.needsStructure,
|
|
57
|
-
},
|
|
58
|
-
};
|
|
59
|
-
// Output as JSON
|
|
60
|
-
console.log(JSON.stringify(analysisResult, null, flags.pretty ? 2 : 0));
|
|
61
|
-
}
|
|
62
|
-
/**
|
|
63
|
-
* v4.11: Calculate escalation with unified improve mode
|
|
64
|
-
*/
|
|
65
|
-
calculateEscalation(result) {
|
|
66
|
-
const factors = [];
|
|
67
|
-
let score = 0;
|
|
68
|
-
// Quality-based factors
|
|
69
|
-
if (result.quality.overall < 50) {
|
|
70
|
-
score += 30;
|
|
71
|
-
factors.push('low overall quality');
|
|
72
|
-
}
|
|
73
|
-
else if (result.quality.overall < 65) {
|
|
74
|
-
score += 15;
|
|
75
|
-
factors.push('moderate quality - could be improved');
|
|
76
|
-
}
|
|
77
|
-
if (result.quality.clarity < 50) {
|
|
78
|
-
score += 15;
|
|
79
|
-
factors.push('unclear objective');
|
|
80
|
-
}
|
|
81
|
-
if (result.quality.completeness < 50) {
|
|
82
|
-
score += 20;
|
|
83
|
-
factors.push('missing technical requirements');
|
|
84
|
-
}
|
|
85
|
-
if (result.quality.actionability < 50) {
|
|
86
|
-
score += 15;
|
|
87
|
-
factors.push('vague scope');
|
|
88
|
-
}
|
|
89
|
-
// Intent-based factors
|
|
90
|
-
if (result.intent.primaryIntent === 'planning') {
|
|
91
|
-
score += 15;
|
|
92
|
-
factors.push('planning intent - benefits from exploration');
|
|
93
|
-
}
|
|
94
|
-
if (result.intent.primaryIntent === 'prd-generation') {
|
|
95
|
-
score += 25;
|
|
96
|
-
factors.push('PRD generation - needs strategic planning');
|
|
97
|
-
}
|
|
98
|
-
// Characteristics-based factors
|
|
99
|
-
if (result.intent.characteristics.isOpenEnded && result.intent.characteristics.needsStructure) {
|
|
100
|
-
score += 10;
|
|
101
|
-
factors.push('open-ended without structure');
|
|
102
|
-
}
|
|
103
|
-
// Confidence-based factors
|
|
104
|
-
if (result.intent.confidence < 70) {
|
|
105
|
-
score += 10;
|
|
106
|
-
factors.push('low intent confidence');
|
|
107
|
-
}
|
|
108
|
-
// v4.11: Determine recommendation based on score and intent
|
|
109
|
-
let recommend = 'improve';
|
|
110
|
-
let recommendedDepth = 'standard';
|
|
111
|
-
if (result.intent.primaryIntent === 'prd-generation') {
|
|
112
|
-
recommend = 'prd';
|
|
113
|
-
}
|
|
114
|
-
else if (score >= 60 || result.quality.overall < 50) {
|
|
115
|
-
recommendedDepth = 'comprehensive';
|
|
116
|
-
}
|
|
117
|
-
else if (score >= 35) {
|
|
118
|
-
recommendedDepth = 'comprehensive';
|
|
119
|
-
}
|
|
120
|
-
// Check for strategic keywords that suggest PRD mode
|
|
121
|
-
const strategicIntents = ['planning', 'prd-generation', 'documentation'];
|
|
122
|
-
if (strategicIntents.includes(result.intent.primaryIntent) && score >= 50) {
|
|
123
|
-
recommend = 'prd';
|
|
124
|
-
}
|
|
125
|
-
return {
|
|
126
|
-
score: Math.min(100, score),
|
|
127
|
-
recommend,
|
|
128
|
-
recommendedDepth: recommend === 'improve' ? recommendedDepth : undefined,
|
|
129
|
-
factors,
|
|
130
|
-
};
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
//# sourceMappingURL=analyze.js.map
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { Command } from '@oclif/core';
|
|
2
|
-
export default class Archive extends Command {
|
|
3
|
-
static description: string;
|
|
4
|
-
static examples: string[];
|
|
5
|
-
static args: {
|
|
6
|
-
project: import("@oclif/core/interfaces").Arg<string | undefined, Record<string, unknown>>;
|
|
7
|
-
};
|
|
8
|
-
static flags: {
|
|
9
|
-
list: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
10
|
-
force: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
11
|
-
yes: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
12
|
-
restore: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
13
|
-
};
|
|
14
|
-
run(): Promise<void>;
|
|
15
|
-
/**
|
|
16
|
-
* Interactive archive mode - show list of archivable projects
|
|
17
|
-
*/
|
|
18
|
-
private interactiveArchive;
|
|
19
|
-
/**
|
|
20
|
-
* Archive a specific project by name
|
|
21
|
-
*/
|
|
22
|
-
private archiveSpecificProject;
|
|
23
|
-
/**
|
|
24
|
-
* List all archived projects
|
|
25
|
-
*/
|
|
26
|
-
private listArchivedProjects;
|
|
27
|
-
/**
|
|
28
|
-
* Restore an archived project
|
|
29
|
-
*/
|
|
30
|
-
private restoreProject;
|
|
31
|
-
/**
|
|
32
|
-
* Display project details (helper for formatting)
|
|
33
|
-
*/
|
|
34
|
-
private displayProjectInfo;
|
|
35
|
-
}
|
|
36
|
-
//# sourceMappingURL=archive.d.ts.map
|
|
@@ -1,266 +0,0 @@
|
|
|
1
|
-
import { Command, Flags, Args } from '@oclif/core';
|
|
2
|
-
import chalk from 'chalk';
|
|
3
|
-
import inquirer from 'inquirer';
|
|
4
|
-
import { ArchiveManager } from '../../core/archive-manager.js';
|
|
5
|
-
export default class Archive extends Command {
|
|
6
|
-
static description = 'Archive completed PRD projects';
|
|
7
|
-
static examples = [
|
|
8
|
-
'<%= config.bin %> <%= command.id %> # Interactive selection',
|
|
9
|
-
'<%= config.bin %> <%= command.id %> my-project # Archive specific project',
|
|
10
|
-
'<%= config.bin %> <%= command.id %> --list # List archived projects',
|
|
11
|
-
'<%= config.bin %> <%= command.id %> my-project --force # Force archive',
|
|
12
|
-
'<%= config.bin %> <%= command.id %> --restore my-project # Restore from archive',
|
|
13
|
-
];
|
|
14
|
-
static args = {
|
|
15
|
-
project: Args.string({
|
|
16
|
-
description: 'Name of the project to archive',
|
|
17
|
-
required: false,
|
|
18
|
-
}),
|
|
19
|
-
};
|
|
20
|
-
static flags = {
|
|
21
|
-
list: Flags.boolean({
|
|
22
|
-
char: 'l',
|
|
23
|
-
description: 'List archived projects',
|
|
24
|
-
default: false,
|
|
25
|
-
}),
|
|
26
|
-
force: Flags.boolean({
|
|
27
|
-
char: 'f',
|
|
28
|
-
description: 'Force archive even if tasks are incomplete',
|
|
29
|
-
default: false,
|
|
30
|
-
}),
|
|
31
|
-
yes: Flags.boolean({
|
|
32
|
-
char: 'y',
|
|
33
|
-
description: 'Skip all confirmation prompts (agent-friendly)',
|
|
34
|
-
default: false,
|
|
35
|
-
}),
|
|
36
|
-
restore: Flags.string({
|
|
37
|
-
char: 'r',
|
|
38
|
-
description: 'Restore an archived project',
|
|
39
|
-
}),
|
|
40
|
-
};
|
|
41
|
-
async run() {
|
|
42
|
-
const { args, flags } = await this.parse(Archive);
|
|
43
|
-
const archiveManager = new ArchiveManager();
|
|
44
|
-
try {
|
|
45
|
-
// Handle restore flag
|
|
46
|
-
if (flags.restore) {
|
|
47
|
-
await this.restoreProject(flags.restore, archiveManager, flags.yes);
|
|
48
|
-
return;
|
|
49
|
-
}
|
|
50
|
-
// Handle list flag
|
|
51
|
-
if (flags.list) {
|
|
52
|
-
await this.listArchivedProjects(archiveManager);
|
|
53
|
-
return;
|
|
54
|
-
}
|
|
55
|
-
// Handle direct project archival
|
|
56
|
-
if (args.project) {
|
|
57
|
-
await this.archiveSpecificProject(args.project, flags.force, flags.yes, archiveManager);
|
|
58
|
-
return;
|
|
59
|
-
}
|
|
60
|
-
// Interactive mode
|
|
61
|
-
await this.interactiveArchive(archiveManager, flags.yes);
|
|
62
|
-
}
|
|
63
|
-
catch (error) {
|
|
64
|
-
const { getErrorMessage } = await import('../../utils/error-utils.js');
|
|
65
|
-
this.error(chalk.red(`Archive failed: ${getErrorMessage(error)}`));
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
/**
|
|
69
|
-
* Interactive archive mode - show list of archivable projects
|
|
70
|
-
*/
|
|
71
|
-
async interactiveArchive(archiveManager, yes) {
|
|
72
|
-
this.log(chalk.bold.cyan('\n📦 Archive PRD Projects\n'));
|
|
73
|
-
// Get all archivable projects (100% tasks completed)
|
|
74
|
-
const archivableProjects = await archiveManager.getArchivablePrds();
|
|
75
|
-
if (archivableProjects.length === 0) {
|
|
76
|
-
this.log(chalk.gray('No projects ready to archive.'));
|
|
77
|
-
this.log(chalk.gray('\nProjects can be archived when all tasks are completed.'));
|
|
78
|
-
this.log(chalk.gray('Use ') + chalk.cyan('clavix list --outputs') + chalk.gray(' to see all projects.'));
|
|
79
|
-
return;
|
|
80
|
-
}
|
|
81
|
-
// Show archivable projects
|
|
82
|
-
this.log(chalk.green(`Found ${archivableProjects.length} project(s) ready to archive:\n`));
|
|
83
|
-
// Inquirer choices can be mixed types (choices + separators)
|
|
84
|
-
const choices = archivableProjects.map((project) => ({
|
|
85
|
-
name: `${project.name} (${project.taskStatus.completed} tasks completed)`,
|
|
86
|
-
value: project.name,
|
|
87
|
-
short: project.name,
|
|
88
|
-
}));
|
|
89
|
-
choices.push(new inquirer.Separator());
|
|
90
|
-
choices.push({
|
|
91
|
-
name: chalk.gray('Cancel'),
|
|
92
|
-
value: '__cancel__',
|
|
93
|
-
short: 'Cancel',
|
|
94
|
-
});
|
|
95
|
-
const { selectedProject } = await inquirer.prompt([
|
|
96
|
-
{
|
|
97
|
-
type: 'list',
|
|
98
|
-
name: 'selectedProject',
|
|
99
|
-
message: 'Which project would you like to archive?',
|
|
100
|
-
choices,
|
|
101
|
-
pageSize: 15,
|
|
102
|
-
},
|
|
103
|
-
]);
|
|
104
|
-
if (selectedProject === '__cancel__') {
|
|
105
|
-
this.log(chalk.yellow('\n✗ Archive cancelled\n'));
|
|
106
|
-
return;
|
|
107
|
-
}
|
|
108
|
-
// Confirm archival (unless --yes)
|
|
109
|
-
if (!yes) {
|
|
110
|
-
const { confirm } = await inquirer.prompt([
|
|
111
|
-
{
|
|
112
|
-
type: 'confirm',
|
|
113
|
-
name: 'confirm',
|
|
114
|
-
message: `Archive "${selectedProject}"? (This will move it to .clavix/outputs/archive/)`,
|
|
115
|
-
default: false,
|
|
116
|
-
},
|
|
117
|
-
]);
|
|
118
|
-
if (!confirm) {
|
|
119
|
-
this.log(chalk.yellow('\n✗ Archive cancelled\n'));
|
|
120
|
-
return;
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
// Archive the project
|
|
124
|
-
const result = await archiveManager.archiveProject(selectedProject);
|
|
125
|
-
if (result.success) {
|
|
126
|
-
this.log(chalk.green(`\n✓ ${result.message}\n`));
|
|
127
|
-
}
|
|
128
|
-
else {
|
|
129
|
-
this.error(chalk.red(`\n✗ ${result.message}\n`));
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
/**
|
|
133
|
-
* Archive a specific project by name
|
|
134
|
-
*/
|
|
135
|
-
async archiveSpecificProject(projectName, force, yes, archiveManager) {
|
|
136
|
-
this.log(chalk.cyan(`\nArchiving project: ${chalk.bold(projectName)}\n`));
|
|
137
|
-
// Check task status
|
|
138
|
-
const projectPath = `.clavix/outputs/${projectName}`;
|
|
139
|
-
const taskStatus = await archiveManager.checkTasksStatus(projectPath);
|
|
140
|
-
// If not forcing and tasks are incomplete, ask for confirmation (unless --yes)
|
|
141
|
-
if (!force && !taskStatus.allCompleted) {
|
|
142
|
-
if (!taskStatus.hasTasksFile) {
|
|
143
|
-
this.log(chalk.yellow(`⚠ Project has no tasks.md file\n`));
|
|
144
|
-
if (!yes) {
|
|
145
|
-
const { proceed } = await inquirer.prompt([
|
|
146
|
-
{
|
|
147
|
-
type: 'confirm',
|
|
148
|
-
name: 'proceed',
|
|
149
|
-
message: 'Archive anyway?',
|
|
150
|
-
default: false,
|
|
151
|
-
},
|
|
152
|
-
]);
|
|
153
|
-
if (!proceed) {
|
|
154
|
-
this.log(chalk.yellow('\n✗ Archive cancelled\n'));
|
|
155
|
-
return;
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
else if (taskStatus.remaining > 0) {
|
|
160
|
-
this.log(chalk.yellow(`⚠ Project has ${taskStatus.remaining} incomplete task(s):\n`));
|
|
161
|
-
// Show incomplete tasks
|
|
162
|
-
const incompleteTasks = await archiveManager.getIncompleteTasks(projectPath);
|
|
163
|
-
incompleteTasks.slice(0, 5).forEach((task) => {
|
|
164
|
-
this.log(chalk.gray(` • ${task}`));
|
|
165
|
-
});
|
|
166
|
-
if (incompleteTasks.length > 5) {
|
|
167
|
-
this.log(chalk.gray(` ... and ${incompleteTasks.length - 5} more\n`));
|
|
168
|
-
}
|
|
169
|
-
else {
|
|
170
|
-
this.log('');
|
|
171
|
-
}
|
|
172
|
-
if (!yes) {
|
|
173
|
-
const { proceed } = await inquirer.prompt([
|
|
174
|
-
{
|
|
175
|
-
type: 'confirm',
|
|
176
|
-
name: 'proceed',
|
|
177
|
-
message: 'Archive anyway?',
|
|
178
|
-
default: false,
|
|
179
|
-
},
|
|
180
|
-
]);
|
|
181
|
-
if (!proceed) {
|
|
182
|
-
this.log(chalk.yellow('\n✗ Archive cancelled\n'));
|
|
183
|
-
return;
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
}
|
|
187
|
-
}
|
|
188
|
-
// Archive the project
|
|
189
|
-
const result = await archiveManager.archiveProject(projectName, true);
|
|
190
|
-
if (result.success) {
|
|
191
|
-
this.log(chalk.green(`✓ ${result.message}\n`));
|
|
192
|
-
}
|
|
193
|
-
else {
|
|
194
|
-
this.error(chalk.red(`✗ ${result.message}\n`));
|
|
195
|
-
}
|
|
196
|
-
}
|
|
197
|
-
/**
|
|
198
|
-
* List all archived projects
|
|
199
|
-
*/
|
|
200
|
-
async listArchivedProjects(archiveManager) {
|
|
201
|
-
this.log(chalk.bold.cyan('\n📦 Archived Projects\n'));
|
|
202
|
-
const archivedProjects = await archiveManager.listArchivedProjects();
|
|
203
|
-
if (archivedProjects.length === 0) {
|
|
204
|
-
this.log(chalk.gray('No archived projects found.'));
|
|
205
|
-
this.log(chalk.gray('\nUse ') + chalk.cyan('clavix archive') + chalk.gray(' to archive completed projects.\n'));
|
|
206
|
-
return;
|
|
207
|
-
}
|
|
208
|
-
// Display archived projects
|
|
209
|
-
archivedProjects.forEach((project, index) => {
|
|
210
|
-
const statusIcon = project.taskStatus.allCompleted ? '✓' : '○';
|
|
211
|
-
const taskInfo = project.taskStatus.hasTasksFile
|
|
212
|
-
? `${project.taskStatus.completed}/${project.taskStatus.total} tasks`
|
|
213
|
-
: 'no tasks';
|
|
214
|
-
const modified = project.modifiedTime.toLocaleDateString();
|
|
215
|
-
this.log(` ${statusIcon} ${chalk.bold(project.name)}` +
|
|
216
|
-
`\n ${chalk.gray('Tasks:')} ${taskInfo} ${chalk.gray('│')} ` +
|
|
217
|
-
`${chalk.gray('Archived:')} ${modified}` +
|
|
218
|
-
`\n ${chalk.gray('Path:')} ${chalk.dim(project.path)}` +
|
|
219
|
-
(index < archivedProjects.length - 1 ? '\n' : ''));
|
|
220
|
-
});
|
|
221
|
-
this.log('');
|
|
222
|
-
this.log(chalk.gray(` Total: ${archivedProjects.length} archived project(s)`));
|
|
223
|
-
this.log(chalk.gray(` Use ${chalk.cyan('clavix archive --restore <project>')} to restore a project\n`));
|
|
224
|
-
}
|
|
225
|
-
/**
|
|
226
|
-
* Restore an archived project
|
|
227
|
-
*/
|
|
228
|
-
async restoreProject(projectName, archiveManager, yes) {
|
|
229
|
-
this.log(chalk.cyan(`\nRestoring project: ${chalk.bold(projectName)}\n`));
|
|
230
|
-
// Confirm restoration (unless --yes)
|
|
231
|
-
if (!yes) {
|
|
232
|
-
const { confirm } = await inquirer.prompt([
|
|
233
|
-
{
|
|
234
|
-
type: 'confirm',
|
|
235
|
-
name: 'confirm',
|
|
236
|
-
message: `Restore "${projectName}" from archive?`,
|
|
237
|
-
default: false,
|
|
238
|
-
},
|
|
239
|
-
]);
|
|
240
|
-
if (!confirm) {
|
|
241
|
-
this.log(chalk.yellow('\n✗ Restore cancelled\n'));
|
|
242
|
-
return;
|
|
243
|
-
}
|
|
244
|
-
}
|
|
245
|
-
const result = await archiveManager.restoreProject(projectName);
|
|
246
|
-
if (result.success) {
|
|
247
|
-
this.log(chalk.green(`✓ ${result.message}\n`));
|
|
248
|
-
}
|
|
249
|
-
else {
|
|
250
|
-
this.error(chalk.red(`✗ ${result.message}\n`));
|
|
251
|
-
}
|
|
252
|
-
}
|
|
253
|
-
/**
|
|
254
|
-
* Display project details (helper for formatting)
|
|
255
|
-
*/
|
|
256
|
-
displayProjectInfo(project) {
|
|
257
|
-
const statusIcon = project.taskStatus.allCompleted ? '✓' : '○';
|
|
258
|
-
const taskInfo = project.taskStatus.hasTasksFile
|
|
259
|
-
? `${project.taskStatus.completed}/${project.taskStatus.total} tasks (${Math.round(project.taskStatus.percentage)}%)`
|
|
260
|
-
: 'no tasks';
|
|
261
|
-
this.log(` ${statusIcon} ${chalk.bold(project.name)}` +
|
|
262
|
-
`\n ${chalk.gray('Tasks:')} ${taskInfo}` +
|
|
263
|
-
`\n ${chalk.gray('Modified:')} ${project.modifiedTime.toLocaleDateString()}`);
|
|
264
|
-
}
|
|
265
|
-
}
|
|
266
|
-
//# sourceMappingURL=archive.js.map
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { Command } from '@oclif/core';
|
|
2
|
-
export default class Deep extends Command {
|
|
3
|
-
static description: string;
|
|
4
|
-
static examples: string[];
|
|
5
|
-
static flags: {
|
|
6
|
-
'analysis-only': import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
7
|
-
};
|
|
8
|
-
static args: {
|
|
9
|
-
prompt: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
|
|
10
|
-
};
|
|
11
|
-
run(): Promise<void>;
|
|
12
|
-
private displayOutput;
|
|
13
|
-
private displayAnalysisOnly;
|
|
14
|
-
private savePrompt;
|
|
15
|
-
private generateShortHash;
|
|
16
|
-
}
|
|
17
|
-
//# sourceMappingURL=deep.d.ts.map
|
|
@@ -1,170 +0,0 @@
|
|
|
1
|
-
import { Command, Args, Flags } from '@oclif/core';
|
|
2
|
-
import chalk from 'chalk';
|
|
3
|
-
import { UniversalOptimizer } from '../../core/intelligence/index.js';
|
|
4
|
-
import { PromptManager } from '../../core/prompt-manager.js';
|
|
5
|
-
export default class Deep extends Command {
|
|
6
|
-
static description = 'Perform comprehensive deep analysis with alternative approaches, edge cases, and validation checklists';
|
|
7
|
-
static examples = [
|
|
8
|
-
'<%= config.bin %> <%= command.id %> "Create a login page"',
|
|
9
|
-
'<%= config.bin %> <%= command.id %> "Build an API for user management"',
|
|
10
|
-
'<%= config.bin %> <%= command.id %> "Design a notification system"',
|
|
11
|
-
];
|
|
12
|
-
static flags = {
|
|
13
|
-
'analysis-only': Flags.boolean({
|
|
14
|
-
description: 'Show only quality analysis without improved prompt',
|
|
15
|
-
default: false,
|
|
16
|
-
}),
|
|
17
|
-
};
|
|
18
|
-
static args = {
|
|
19
|
-
prompt: Args.string({
|
|
20
|
-
description: 'The prompt to analyze deeply',
|
|
21
|
-
required: true,
|
|
22
|
-
}),
|
|
23
|
-
};
|
|
24
|
-
async run() {
|
|
25
|
-
const { args, flags } = await this.parse(Deep);
|
|
26
|
-
if (!args.prompt || args.prompt.trim().length === 0) {
|
|
27
|
-
console.log(chalk.red('\n✗ Please provide a prompt to analyze\n'));
|
|
28
|
-
console.log(chalk.gray('Example:'), chalk.cyan('clavix deep "Create a login page"'));
|
|
29
|
-
return;
|
|
30
|
-
}
|
|
31
|
-
console.log(chalk.bold.cyan('\n🔍 Performing comprehensive deep analysis...\n'));
|
|
32
|
-
console.log(chalk.gray('This may take up to 15 seconds for thorough exploration\n'));
|
|
33
|
-
const optimizer = new UniversalOptimizer();
|
|
34
|
-
const result = await optimizer.optimize(args.prompt, 'deep');
|
|
35
|
-
// Handle --analysis-only flag
|
|
36
|
-
if (flags['analysis-only']) {
|
|
37
|
-
this.displayAnalysisOnly(result);
|
|
38
|
-
return;
|
|
39
|
-
}
|
|
40
|
-
// Display full deep mode output
|
|
41
|
-
this.displayOutput(result);
|
|
42
|
-
// Save prompt to file system
|
|
43
|
-
await this.savePrompt(result);
|
|
44
|
-
}
|
|
45
|
-
displayOutput(result) {
|
|
46
|
-
console.log(chalk.bold.cyan('🔍 Deep Analysis Complete\n'));
|
|
47
|
-
// ===== Intent Analysis =====
|
|
48
|
-
console.log(chalk.bold.cyan('🎯 Intent Analysis:\n'));
|
|
49
|
-
console.log(chalk.cyan(` Type: ${result.intent.primaryIntent}`));
|
|
50
|
-
console.log(chalk.cyan(` Confidence: ${result.intent.confidence}%`));
|
|
51
|
-
console.log(chalk.cyan(` Characteristics:`));
|
|
52
|
-
console.log(chalk.cyan(` • Has code context: ${result.intent.characteristics.hasCodeContext ? 'Yes' : 'No'}`));
|
|
53
|
-
console.log(chalk.cyan(` • Technical terms: ${result.intent.characteristics.hasTechnicalTerms ? 'Yes' : 'No'}`));
|
|
54
|
-
console.log(chalk.cyan(` • Open-ended: ${result.intent.characteristics.isOpenEnded ? 'Yes' : 'No'}`));
|
|
55
|
-
console.log(chalk.cyan(` • Needs structure: ${result.intent.characteristics.needsStructure ? 'Yes' : 'No'}`));
|
|
56
|
-
console.log();
|
|
57
|
-
// ===== Quality Metrics =====
|
|
58
|
-
console.log(chalk.bold('📊 Quality Metrics:\n'));
|
|
59
|
-
const getScoreColor = (score) => {
|
|
60
|
-
if (score >= 80)
|
|
61
|
-
return chalk.green;
|
|
62
|
-
if (score >= 60)
|
|
63
|
-
return chalk.yellow;
|
|
64
|
-
return chalk.red;
|
|
65
|
-
};
|
|
66
|
-
console.log(getScoreColor(result.quality.clarity)(` Clarity: ${result.quality.clarity.toFixed(0)}%`));
|
|
67
|
-
console.log(getScoreColor(result.quality.efficiency)(` Efficiency: ${result.quality.efficiency.toFixed(0)}%`));
|
|
68
|
-
console.log(getScoreColor(result.quality.structure)(` Structure: ${result.quality.structure.toFixed(0)}%`));
|
|
69
|
-
console.log(getScoreColor(result.quality.completeness)(` Completeness: ${result.quality.completeness.toFixed(0)}%`));
|
|
70
|
-
console.log(getScoreColor(result.quality.actionability)(` Actionability: ${result.quality.actionability.toFixed(0)}%`));
|
|
71
|
-
console.log(getScoreColor(result.quality.overall).bold(`\n Overall: ${result.quality.overall.toFixed(0)}%\n`));
|
|
72
|
-
// ===== Strengths =====
|
|
73
|
-
if (result.quality.strengths.length > 0) {
|
|
74
|
-
console.log(chalk.bold.green('✅ Strengths:\n'));
|
|
75
|
-
result.quality.strengths.forEach((strength) => {
|
|
76
|
-
console.log(chalk.green(` • ${strength}`));
|
|
77
|
-
});
|
|
78
|
-
console.log();
|
|
79
|
-
}
|
|
80
|
-
// ===== Improvements Applied =====
|
|
81
|
-
if (result.improvements.length > 0) {
|
|
82
|
-
console.log(chalk.bold.magenta('✨ Improvements Applied:\n'));
|
|
83
|
-
result.improvements.forEach((improvement) => {
|
|
84
|
-
const emoji = improvement.impact === 'high' ? '🔥' : improvement.impact === 'medium' ? '⚡' : '💡';
|
|
85
|
-
console.log(chalk.magenta(` ${emoji} ${improvement.description} [${improvement.dimension}]`));
|
|
86
|
-
});
|
|
87
|
-
console.log();
|
|
88
|
-
}
|
|
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
|
|
92
|
-
console.log(chalk.bold.cyan('✨ Enhanced Prompt:\n'));
|
|
93
|
-
console.log(chalk.dim('─'.repeat(80)));
|
|
94
|
-
console.log(result.enhanced);
|
|
95
|
-
console.log(chalk.dim('─'.repeat(80)));
|
|
96
|
-
console.log();
|
|
97
|
-
// Patterns Applied
|
|
98
|
-
if (result.appliedPatterns.length > 0) {
|
|
99
|
-
console.log(chalk.bold.blue('🧩 Patterns Applied:\n'));
|
|
100
|
-
result.appliedPatterns.forEach((pattern) => {
|
|
101
|
-
console.log(chalk.blue(` • ${pattern.name}: ${pattern.description}`));
|
|
102
|
-
});
|
|
103
|
-
console.log();
|
|
104
|
-
}
|
|
105
|
-
// Remaining Issues (if any)
|
|
106
|
-
if (result.quality.remainingIssues && result.quality.remainingIssues.length > 0) {
|
|
107
|
-
console.log(chalk.bold.yellow('⚠️ Remaining Areas for Improvement:\n'));
|
|
108
|
-
result.quality.remainingIssues.forEach((issue) => {
|
|
109
|
-
console.log(chalk.yellow(` • ${issue}`));
|
|
110
|
-
});
|
|
111
|
-
console.log();
|
|
112
|
-
}
|
|
113
|
-
// Final recommendation
|
|
114
|
-
const recommendation = new UniversalOptimizer().getRecommendation(result);
|
|
115
|
-
if (recommendation) {
|
|
116
|
-
console.log(chalk.blue.bold('💡 Recommendation:'));
|
|
117
|
-
console.log(chalk.blue(` ${recommendation}\n`));
|
|
118
|
-
}
|
|
119
|
-
console.log(chalk.gray(`⚡ Processed in ${result.processingTimeMs}ms\n`));
|
|
120
|
-
console.log(chalk.gray('💡 Tip: The enhanced prompt above includes alternative approaches, edge cases, and validation checklist\n'));
|
|
121
|
-
}
|
|
122
|
-
displayAnalysisOnly(result) {
|
|
123
|
-
console.log(chalk.bold.cyan('🎯 Intent Analysis:\n'));
|
|
124
|
-
console.log(chalk.cyan(` Type: ${result.intent.primaryIntent}`));
|
|
125
|
-
console.log(chalk.cyan(` Confidence: ${result.intent.confidence}%`));
|
|
126
|
-
console.log(chalk.cyan(` Characteristics:`));
|
|
127
|
-
console.log(chalk.cyan(` • Has code context: ${result.intent.characteristics.hasCodeContext ? 'Yes' : 'No'}`));
|
|
128
|
-
console.log(chalk.cyan(` • Technical terms: ${result.intent.characteristics.hasTechnicalTerms ? 'Yes' : 'No'}`));
|
|
129
|
-
console.log(chalk.cyan(` • Open-ended: ${result.intent.characteristics.isOpenEnded ? 'Yes' : 'No'}`));
|
|
130
|
-
console.log(chalk.cyan(` • Needs structure: ${result.intent.characteristics.needsStructure ? 'Yes' : 'No'}`));
|
|
131
|
-
console.log();
|
|
132
|
-
console.log(chalk.bold('📊 Quality Scores:\n'));
|
|
133
|
-
console.log(chalk.white(` Clarity: ${result.quality.clarity.toFixed(0)}%`));
|
|
134
|
-
console.log(chalk.white(` Efficiency: ${result.quality.efficiency.toFixed(0)}%`));
|
|
135
|
-
console.log(chalk.white(` Structure: ${result.quality.structure.toFixed(0)}%`));
|
|
136
|
-
console.log(chalk.white(` Completeness: ${result.quality.completeness.toFixed(0)}%`));
|
|
137
|
-
console.log(chalk.white(` Actionability: ${result.quality.actionability.toFixed(0)}%`));
|
|
138
|
-
console.log(chalk.bold(`\n Overall: ${result.quality.overall.toFixed(0)}%\n`));
|
|
139
|
-
if (result.quality.strengths.length > 0) {
|
|
140
|
-
console.log(chalk.bold.green('✅ Strengths:\n'));
|
|
141
|
-
result.quality.strengths.forEach((strength) => {
|
|
142
|
-
console.log(chalk.green(` • ${strength}`));
|
|
143
|
-
});
|
|
144
|
-
console.log();
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
async savePrompt(result) {
|
|
148
|
-
try {
|
|
149
|
-
const manager = new PromptManager();
|
|
150
|
-
// Format enhanced prompt as content
|
|
151
|
-
const content = result.enhanced;
|
|
152
|
-
await manager.savePrompt(content, 'deep', result.original);
|
|
153
|
-
console.log(chalk.gray(`💾 Saved prompt to .clavix/outputs/prompts/deep/\n`));
|
|
154
|
-
}
|
|
155
|
-
catch (error) {
|
|
156
|
-
console.log(chalk.yellow('⚠️ Could not save prompt to file system'));
|
|
157
|
-
console.log(chalk.gray('Error: ' + (error instanceof Error ? error.message : 'Unknown error')));
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
generateShortHash(text) {
|
|
161
|
-
let hash = 0;
|
|
162
|
-
for (let i = 0; i < text.length; i++) {
|
|
163
|
-
const char = text.charCodeAt(i);
|
|
164
|
-
hash = (hash << 5) - hash + char;
|
|
165
|
-
hash = hash & hash;
|
|
166
|
-
}
|
|
167
|
-
return Math.abs(hash).toString(16).slice(0, 4);
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
//# sourceMappingURL=deep.js.map
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { Command } from '@oclif/core';
|
|
2
|
-
export default class Execute extends Command {
|
|
3
|
-
static description: string;
|
|
4
|
-
static examples: string[];
|
|
5
|
-
static flags: {
|
|
6
|
-
latest: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
7
|
-
standard: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
8
|
-
comprehensive: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
9
|
-
id: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
10
|
-
};
|
|
11
|
-
run(): Promise<void>;
|
|
12
|
-
private selectPromptInteractively;
|
|
13
|
-
private executePrompt;
|
|
14
|
-
}
|
|
15
|
-
//# sourceMappingURL=execute.d.ts.map
|