clavix 2.6.0 โ†’ 2.7.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 CHANGED
@@ -39,9 +39,40 @@ clavix init
39
39
  /clavix:fast "Create a login page"
40
40
  /clavix:deep "Build an API for user management"
41
41
  /clavix:prd # Full PRD workflow
42
+
43
+ # 3. Execute saved prompts (v2.7+)
44
+ /clavix:execute # Interactive selection of saved prompts
45
+ /clavix:prompts # Manage prompt lifecycle
46
+
47
+ # Or via CLI
48
+ clavix execute --latest
49
+ clavix prompts list
50
+ clavix prompts clear --executed
42
51
  ```
43
52
 
44
- **Supported agents**: Claude Code, Cursor, Windsurf, and [20+ more providers](docs/providers.md)
53
+ **Supported agents**: Claude Code, Cursor, Windsurf, and [15+ more providers](docs/providers.md)
54
+
55
+ ### Prompt Lifecycle Management (v2.7+)
56
+
57
+ Clavix now automatically saves prompts from fast/deep optimization, allowing you to:
58
+ - ๐Ÿ’พ **Review** saved prompts before execution
59
+ - โšก **Execute** prompts when ready
60
+ - ๐Ÿ“Š **Track** prompt lifecycle (NEW โ†’ EXECUTED โ†’ STALE)
61
+ - ๐Ÿงน **Clean up** old prompts with safety checks
62
+
63
+ **Complete workflow:**
64
+ 1. **Optimize**: `/clavix:fast` or `/clavix:deep` โ†’ Auto-saved to `.clavix/outputs/prompts/`
65
+ 2. **Review**: `/clavix:prompts` or `clavix prompts list` โ†’ View all saved prompts with status
66
+ 3. **Execute**: `/clavix:execute` or `clavix execute --latest` โ†’ Implement when ready
67
+ 4. **Cleanup**: `clavix prompts clear --executed` โ†’ Remove completed prompts
68
+
69
+ **Storage hygiene:**
70
+ - Age warnings: >7 days = OLD, >30 days = STALE
71
+ - Safety confirmations before deletion
72
+ - Smart recommendations for cleanup
73
+ - Keep <20 active prompts recommended
74
+
75
+ Learn more: [Complete prompt lifecycle documentation](#prompt-management-commands)
45
76
 
46
77
  ### Direct CLI Usage (Alternative)
47
78
 
@@ -71,3 +102,13 @@ clavix prd
71
102
 
72
103
  ## License
73
104
  MIT
105
+
106
+ ## Star History
107
+
108
+ <a href="https://www.star-history.com/#Bob5k/Clavix&type=date&legend=top-left">
109
+ <picture>
110
+ <source media="(prefers-color-scheme: dark)" srcset="https://api.star-history.com/svg?repos=Bob5k/Clavix&type=date&theme=dark&legend=top-left" />
111
+ <source media="(prefers-color-scheme: light)" srcset="https://api.star-history.com/svg?repos=Bob5k/Clavix&type=date&legend=top-left" />
112
+ <img alt="Star History Chart" src="https://api.star-history.com/svg?repos=Bob5k/Clavix&type=date&legend=top-left" />
113
+ </picture>
114
+ </a>
@@ -12,6 +12,7 @@ export default class Deep extends Command {
12
12
  run(): Promise<void>;
13
13
  private displayOutput;
14
14
  private displayCLEAROnlyAnalysis;
15
+ private savePrompt;
15
16
  private displayFrameworkInfo;
16
17
  }
17
18
  //# sourceMappingURL=deep.d.ts.map
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const core_1 = require("@oclif/core");
7
7
  const chalk_1 = __importDefault(require("chalk"));
8
8
  const prompt_optimizer_1 = require("../../core/prompt-optimizer");
9
+ const prompt_manager_1 = require("../../core/prompt-manager");
9
10
  class Deep extends core_1.Command {
10
11
  async run() {
11
12
  const { args, flags } = await this.parse(Deep);
@@ -32,6 +33,8 @@ class Deep extends core_1.Command {
32
33
  return;
33
34
  }
34
35
  this.displayOutput(result, clearResult, clearScore);
36
+ // Save prompt to file system
37
+ await this.savePrompt(clearResult.improvedPrompt, args.prompt, clearScore);
35
38
  }
36
39
  displayOutput(result, clearResult, clearScore) {
37
40
  console.log(chalk_1.default.bold.cyan('๐ŸŽฏ CLEAR Framework Deep Analysis\n'));
@@ -220,6 +223,39 @@ class Deep extends core_1.Command {
220
223
  console.log(overallColor.bold(` Overall Score: ${clearScore.overall.toFixed(0)}% (${clearScore.rating})\n`));
221
224
  console.log(chalk_1.default.gray('Use without --clear-only flag to see improved prompt and detailed sections.\n'));
222
225
  }
226
+ async savePrompt(improvedPrompt, originalPrompt, clearScore) {
227
+ try {
228
+ const promptManager = new prompt_manager_1.PromptManager();
229
+ // Build content with full CLEAR scores (including A and R)
230
+ const content = `# Improved Prompt
231
+
232
+ ${improvedPrompt}
233
+
234
+ ## CLEAR Scores (Deep Analysis)
235
+ - **C** (Conciseness): ${clearScore.conciseness.toFixed(0)}%
236
+ - **L** (Logic): ${clearScore.logic.toFixed(0)}%
237
+ - **E** (Explicitness): ${clearScore.explicitness.toFixed(0)}%
238
+ - **A** (Adaptiveness): ${(clearScore.adaptiveness || 0).toFixed(0)}%
239
+ - **R** (Reflectiveness): ${(clearScore.reflectiveness || 0).toFixed(0)}%
240
+ - **Overall**: ${clearScore.overall.toFixed(0)}% (${clearScore.rating})
241
+
242
+ ## Original Prompt
243
+ \`\`\`
244
+ ${originalPrompt}
245
+ \`\`\`
246
+ `;
247
+ const metadata = await promptManager.savePrompt(content, 'deep', originalPrompt);
248
+ console.log(chalk_1.default.green(`\nโœ… Prompt saved to: ${metadata.filename}`));
249
+ console.log(chalk_1.default.cyan(`\n๐Ÿ’ก Next steps:`));
250
+ console.log(chalk_1.default.cyan(` /clavix:execute - Implement this prompt`));
251
+ console.log(chalk_1.default.cyan(` /clavix:prompts - Review all saved prompts`));
252
+ console.log();
253
+ }
254
+ catch (error) {
255
+ // Don't fail the command if saving fails
256
+ console.log(chalk_1.default.yellow(`\nโš ๏ธ Could not save prompt: ${error}`));
257
+ }
258
+ }
223
259
  displayFrameworkInfo() {
224
260
  console.log(chalk_1.default.bold.cyan('\n๐ŸŽฏ CLEAR Framework for Prompt Engineering\n'));
225
261
  console.log(chalk_1.default.bold('What is CLEAR?\n'));
@@ -0,0 +1,15 @@
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/lib/interfaces").BooleanFlag<boolean>;
7
+ fast: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
8
+ deep: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
9
+ id: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
10
+ };
11
+ run(): Promise<void>;
12
+ private selectPromptInteractively;
13
+ private executePrompt;
14
+ }
15
+ //# sourceMappingURL=execute.d.ts.map
@@ -0,0 +1,152 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const core_1 = require("@oclif/core");
7
+ const chalk_1 = __importDefault(require("chalk"));
8
+ const inquirer_1 = __importDefault(require("inquirer"));
9
+ const prompt_manager_1 = require("../../core/prompt-manager");
10
+ class Execute extends core_1.Command {
11
+ async run() {
12
+ const { flags } = await this.parse(Execute);
13
+ const promptManager = new prompt_manager_1.PromptManager();
14
+ try {
15
+ // Get all prompts
16
+ const allPrompts = await promptManager.listPrompts();
17
+ if (allPrompts.length === 0) {
18
+ console.log(chalk_1.default.yellow('\nโš ๏ธ No prompts found\n'));
19
+ console.log(chalk_1.default.cyan('Generate an optimized prompt first:'));
20
+ console.log(chalk_1.default.cyan(' /clavix:fast "your requirement"'));
21
+ console.log(chalk_1.default.cyan(' /clavix:deep "your requirement"'));
22
+ console.log();
23
+ return;
24
+ }
25
+ let selectedPrompt = null;
26
+ // Execute specific prompt by ID
27
+ if (flags.id) {
28
+ selectedPrompt = allPrompts.find(p => p.id === flags.id) || null;
29
+ if (!selectedPrompt) {
30
+ console.log(chalk_1.default.red(`\nโœ— Prompt not found: ${flags.id}\n`));
31
+ console.log(chalk_1.default.cyan('Run clavix prompts list to see available prompts'));
32
+ console.log();
33
+ return;
34
+ }
35
+ }
36
+ // Auto-select latest with optional filtering
37
+ else if (flags.latest) {
38
+ let filtered = allPrompts;
39
+ // Apply source filter
40
+ if (flags.fast && !flags.deep) {
41
+ filtered = allPrompts.filter(p => p.source === 'fast');
42
+ }
43
+ else if (flags.deep && !flags.fast) {
44
+ filtered = allPrompts.filter(p => p.source === 'deep');
45
+ }
46
+ if (filtered.length === 0) {
47
+ const source = flags.fast ? 'fast' : flags.deep ? 'deep' : 'any';
48
+ console.log(chalk_1.default.yellow(`\nโš ๏ธ No ${source} prompts found\n`));
49
+ console.log(chalk_1.default.cyan(`Generate a ${source} prompt first:`));
50
+ console.log(chalk_1.default.cyan(` /clavix:${source === 'any' ? 'fast' : source} "your requirement"`));
51
+ console.log();
52
+ return;
53
+ }
54
+ // Latest is first (already sorted by timestamp desc)
55
+ selectedPrompt = filtered[0];
56
+ }
57
+ // Interactive selection
58
+ else {
59
+ selectedPrompt = await this.selectPromptInteractively(allPrompts);
60
+ if (!selectedPrompt)
61
+ return;
62
+ }
63
+ // Load and display prompt
64
+ await this.executePrompt(selectedPrompt, promptManager);
65
+ }
66
+ catch (error) {
67
+ console.log(chalk_1.default.red(`\nโœ— Error: ${error}\n`));
68
+ }
69
+ }
70
+ async selectPromptInteractively(prompts) {
71
+ console.log(chalk_1.default.bold.cyan('\n๐Ÿ“‹ Available Prompts\n'));
72
+ const choices = prompts.map(p => {
73
+ const status = p.executed ? chalk_1.default.green('โœ“') : chalk_1.default.gray('โ—‹');
74
+ const age = p.ageInDays === 0 ? 'today' : `${p.ageInDays}d ago`;
75
+ const ageColor = (p.ageInDays || 0) > 30 ? chalk_1.default.red : (p.ageInDays || 0) > 7 ? chalk_1.default.yellow : chalk_1.default.gray;
76
+ return {
77
+ name: `${status} [${p.source}] ${p.originalPrompt.substring(0, 60)}... ${ageColor(`(${age})`)}`,
78
+ value: p.id,
79
+ short: p.id,
80
+ };
81
+ });
82
+ const { promptId } = await inquirer_1.default.prompt([
83
+ {
84
+ type: 'list',
85
+ name: 'promptId',
86
+ message: 'Select a prompt to execute:',
87
+ choices,
88
+ pageSize: 15,
89
+ },
90
+ ]);
91
+ return prompts.find(p => p.id === promptId) || null;
92
+ }
93
+ async executePrompt(prompt, manager) {
94
+ const promptData = await manager.loadPrompt(prompt.id);
95
+ if (!promptData) {
96
+ console.log(chalk_1.default.red(`\nโœ— Could not load prompt: ${prompt.id}\n`));
97
+ return;
98
+ }
99
+ // Display prompt header
100
+ console.log(chalk_1.default.bold.cyan(`\n๐ŸŽฏ Executing Prompt: ${prompt.id}\n`));
101
+ console.log(chalk_1.default.gray(`Source: ${prompt.source}`));
102
+ console.log(chalk_1.default.gray(`Created: ${new Date(prompt.timestamp).toLocaleDateString()}`));
103
+ console.log(chalk_1.default.gray(`Age: ${prompt.ageInDays} days\n`));
104
+ // Display full prompt content
105
+ console.log(chalk_1.default.dim('โ”€'.repeat(80)));
106
+ console.log(promptData.content);
107
+ console.log(chalk_1.default.dim('โ”€'.repeat(80)));
108
+ console.log();
109
+ // Mark as executed
110
+ if (!prompt.executed) {
111
+ await manager.markExecuted(prompt.id);
112
+ console.log(chalk_1.default.green('โœ“ Prompt marked as executed\n'));
113
+ }
114
+ // Suggest cleanup
115
+ const stats = await manager.getStorageStats();
116
+ if (stats.executedPrompts >= 5) {
117
+ console.log(chalk_1.default.yellow(`๐Ÿ’ก Cleanup suggestion:`));
118
+ console.log(chalk_1.default.yellow(` You have ${stats.executedPrompts} executed prompts.`));
119
+ console.log(chalk_1.default.yellow(` Run /clavix:prompts clear to clean up.`));
120
+ console.log();
121
+ }
122
+ console.log(chalk_1.default.cyan('๐Ÿ’ก Next: Implement the requirements described above'));
123
+ console.log();
124
+ }
125
+ }
126
+ Execute.description = 'Execute a saved prompt from fast/deep optimization';
127
+ Execute.examples = [
128
+ '<%= config.bin %> <%= command.id %> --latest',
129
+ '<%= config.bin %> <%= command.id %> --latest --fast',
130
+ '<%= config.bin %> <%= command.id %> --latest --deep',
131
+ '<%= config.bin %> <%= command.id %> --id fast-20250117-143022-a3f2',
132
+ '<%= config.bin %> <%= command.id %>',
133
+ ];
134
+ Execute.flags = {
135
+ latest: core_1.Flags.boolean({
136
+ description: 'Auto-select latest prompt (any type)',
137
+ default: false,
138
+ }),
139
+ fast: core_1.Flags.boolean({
140
+ description: 'Filter to fast prompts only (use with --latest)',
141
+ default: false,
142
+ }),
143
+ deep: core_1.Flags.boolean({
144
+ description: 'Filter to deep prompts only (use with --latest)',
145
+ default: false,
146
+ }),
147
+ id: core_1.Flags.string({
148
+ description: 'Execute specific prompt by ID',
149
+ }),
150
+ };
151
+ exports.default = Execute;
152
+ //# sourceMappingURL=execute.js.map
@@ -13,6 +13,7 @@ export default class Fast extends Command {
13
13
  private displayFastModeOutput;
14
14
  private displayDeepModeOutput;
15
15
  private displayCLEAROnlyAnalysis;
16
+ private savePrompt;
16
17
  private displayFrameworkInfo;
17
18
  }
18
19
  //# sourceMappingURL=fast.d.ts.map
@@ -7,6 +7,7 @@ const core_1 = require("@oclif/core");
7
7
  const chalk_1 = __importDefault(require("chalk"));
8
8
  const inquirer_1 = __importDefault(require("inquirer"));
9
9
  const prompt_optimizer_1 = require("../../core/prompt-optimizer");
10
+ const prompt_manager_1 = require("../../core/prompt-manager");
10
11
  class Fast extends core_1.Command {
11
12
  async run() {
12
13
  const { args, flags } = await this.parse(Fast);
@@ -76,6 +77,8 @@ class Fast extends core_1.Command {
76
77
  }
77
78
  // Display full analysis
78
79
  this.displayFastModeOutput(result, clearResult, clearScore);
80
+ // Save prompt to file system
81
+ await this.savePrompt(clearResult.improvedPrompt, args.prompt, clearScore);
79
82
  }
80
83
  displayFastModeOutput(result, clearResult, clearScore) {
81
84
  console.log(chalk_1.default.bold.cyan('๐ŸŽฏ CLEAR Analysis (Fast Mode)\n'));
@@ -295,6 +298,37 @@ class Fast extends core_1.Command {
295
298
  console.log(overallColor.bold(` Overall Score: ${clearScore.overall.toFixed(0)}% (${clearScore.rating})\n`));
296
299
  console.log(chalk_1.default.gray('Use without --clear-only flag to see improved prompt and changes.\n'));
297
300
  }
301
+ async savePrompt(improvedPrompt, originalPrompt, clearScore) {
302
+ try {
303
+ const promptManager = new prompt_manager_1.PromptManager();
304
+ // Build content with CLEAR scores
305
+ const content = `# Improved Prompt
306
+
307
+ ${improvedPrompt}
308
+
309
+ ## CLEAR Scores
310
+ - **C** (Conciseness): ${clearScore.conciseness.toFixed(0)}%
311
+ - **L** (Logic): ${clearScore.logic.toFixed(0)}%
312
+ - **E** (Explicitness): ${clearScore.explicitness.toFixed(0)}%
313
+ - **Overall**: ${clearScore.overall.toFixed(0)}% (${clearScore.rating})
314
+
315
+ ## Original Prompt
316
+ \`\`\`
317
+ ${originalPrompt}
318
+ \`\`\`
319
+ `;
320
+ const metadata = await promptManager.savePrompt(content, 'fast', originalPrompt);
321
+ console.log(chalk_1.default.green(`\nโœ… Prompt saved to: ${metadata.filename}`));
322
+ console.log(chalk_1.default.cyan(`\n๐Ÿ’ก Next steps:`));
323
+ console.log(chalk_1.default.cyan(` /clavix:execute - Implement this prompt`));
324
+ console.log(chalk_1.default.cyan(` /clavix:prompts - Review all saved prompts`));
325
+ console.log();
326
+ }
327
+ catch (error) {
328
+ // Don't fail the command if saving fails
329
+ console.log(chalk_1.default.yellow(`\nโš ๏ธ Could not save prompt: ${error}`));
330
+ }
331
+ }
298
332
  displayFrameworkInfo() {
299
333
  console.log(chalk_1.default.bold.cyan('\n๐ŸŽฏ CLEAR Framework for Prompt Engineering\n'));
300
334
  console.log(chalk_1.default.bold('What is CLEAR?\n'));
@@ -0,0 +1,16 @@
1
+ import { Command } from '@oclif/core';
2
+ export default class PromptsClear extends Command {
3
+ static description: string;
4
+ static examples: string[];
5
+ static flags: {
6
+ fast: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
7
+ deep: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
8
+ executed: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
9
+ stale: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
10
+ all: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
11
+ force: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
12
+ };
13
+ run(): Promise<void>;
14
+ private interactiveClear;
15
+ }
16
+ //# sourceMappingURL=clear.d.ts.map
@@ -0,0 +1,222 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const core_1 = require("@oclif/core");
7
+ const chalk_1 = __importDefault(require("chalk"));
8
+ const inquirer_1 = __importDefault(require("inquirer"));
9
+ const prompt_manager_1 = require("../../../core/prompt-manager");
10
+ class PromptsClear extends core_1.Command {
11
+ async run() {
12
+ const { flags } = await this.parse(PromptsClear);
13
+ const promptManager = new prompt_manager_1.PromptManager();
14
+ try {
15
+ // Build filters
16
+ const filters = {};
17
+ if (flags.fast && !flags.deep) {
18
+ filters.source = 'fast';
19
+ }
20
+ else if (flags.deep && !flags.fast) {
21
+ filters.source = 'deep';
22
+ }
23
+ if (flags.executed) {
24
+ filters.executed = true;
25
+ }
26
+ if (flags.stale) {
27
+ filters.stale = true;
28
+ }
29
+ // Interactive mode
30
+ if (!flags.fast && !flags.deep && !flags.executed && !flags.stale && !flags.all) {
31
+ await this.interactiveClear(promptManager);
32
+ return;
33
+ }
34
+ // Get prompts that will be deleted
35
+ const toDelete = await promptManager.listPrompts(filters);
36
+ if (toDelete.length === 0) {
37
+ console.log(chalk_1.default.yellow('\nโš ๏ธ No prompts match the specified criteria\n'));
38
+ return;
39
+ }
40
+ // Display what will be deleted
41
+ console.log(chalk_1.default.bold.cyan(`\n๐Ÿ“‹ Prompts to Delete (${toDelete.length}):\n`));
42
+ toDelete.forEach(p => {
43
+ const status = p.executed ? chalk_1.default.green('โœ“') : chalk_1.default.gray('โ—‹');
44
+ const age = p.ageInDays === 0 ? 'today' : `${p.ageInDays}d ago`;
45
+ console.log(` ${status} [${p.source}] ${p.id} (${age})`);
46
+ console.log(` ${chalk_1.default.gray(p.originalPrompt.substring(0, 60))}...`);
47
+ });
48
+ console.log();
49
+ // Safety check for unexecuted prompts
50
+ const unexecuted = toDelete.filter(p => !p.executed);
51
+ if (unexecuted.length > 0 && !flags.force) {
52
+ console.log(chalk_1.default.yellow(`โš ๏ธ Warning: ${unexecuted.length} unexecuted prompts will be deleted\n`));
53
+ const { proceed } = await inquirer_1.default.prompt([
54
+ {
55
+ type: 'confirm',
56
+ name: 'proceed',
57
+ message: 'Delete unexecuted prompts?',
58
+ default: false,
59
+ },
60
+ ]);
61
+ if (!proceed) {
62
+ console.log(chalk_1.default.gray('\nCancelled. No prompts were deleted.\n'));
63
+ return;
64
+ }
65
+ }
66
+ // Final confirmation for --all
67
+ if (flags.all && !flags.force) {
68
+ const { confirm } = await inquirer_1.default.prompt([
69
+ {
70
+ type: 'confirm',
71
+ name: 'confirm',
72
+ message: chalk_1.default.red('Delete ALL prompts? This cannot be undone.'),
73
+ default: false,
74
+ },
75
+ ]);
76
+ if (!confirm) {
77
+ console.log(chalk_1.default.gray('\nCancelled. No prompts were deleted.\n'));
78
+ return;
79
+ }
80
+ }
81
+ // Delete prompts
82
+ const deleted = await promptManager.deletePrompts(filters);
83
+ console.log(chalk_1.default.green(`\nโœ“ Deleted ${deleted} prompt(s)\n`));
84
+ // Show remaining stats
85
+ const stats = await promptManager.getStorageStats();
86
+ if (stats.totalPrompts > 0) {
87
+ console.log(chalk_1.default.gray(`Remaining prompts: ${stats.totalPrompts}`));
88
+ console.log(chalk_1.default.gray(` Fast: ${stats.fastPrompts} | Deep: ${stats.deepPrompts}`));
89
+ console.log(chalk_1.default.gray(` Executed: ${stats.executedPrompts} | Pending: ${stats.pendingPrompts}\n`));
90
+ }
91
+ }
92
+ catch (error) {
93
+ console.log(chalk_1.default.red(`\nโœ— Error: ${error}\n`));
94
+ }
95
+ }
96
+ async interactiveClear(manager) {
97
+ const allPrompts = await manager.listPrompts();
98
+ if (allPrompts.length === 0) {
99
+ console.log(chalk_1.default.yellow('\nโš ๏ธ No prompts to clear\n'));
100
+ return;
101
+ }
102
+ console.log(chalk_1.default.bold.cyan(`\n๐Ÿ“‹ Clear Saved Prompts\n`));
103
+ const choices = [
104
+ { name: 'Executed prompts only (safe)', value: 'executed' },
105
+ { name: 'Stale prompts (>30 days old)', value: 'stale' },
106
+ { name: 'Old prompts (>7 days old)', value: 'old' },
107
+ { name: 'Fast prompts only', value: 'fast' },
108
+ { name: 'Deep prompts only', value: 'deep' },
109
+ { name: chalk_1.default.red('All prompts (dangerous)'), value: 'all' },
110
+ { name: 'Cancel', value: 'cancel' },
111
+ ];
112
+ const { selection } = await inquirer_1.default.prompt([
113
+ {
114
+ type: 'list',
115
+ name: 'selection',
116
+ message: 'What would you like to clear?',
117
+ choices,
118
+ },
119
+ ]);
120
+ if (selection === 'cancel') {
121
+ console.log(chalk_1.default.gray('\nCancelled.\n'));
122
+ return;
123
+ }
124
+ // Build filters based on selection
125
+ const filters = {};
126
+ if (selection === 'executed') {
127
+ filters.executed = true;
128
+ }
129
+ else if (selection === 'stale') {
130
+ filters.stale = true;
131
+ }
132
+ else if (selection === 'old') {
133
+ filters.old = true;
134
+ }
135
+ else if (selection === 'fast') {
136
+ filters.source = 'fast';
137
+ }
138
+ else if (selection === 'deep') {
139
+ filters.source = 'deep';
140
+ }
141
+ // 'all' means no filters
142
+ // Get matching prompts
143
+ const toDelete = selection === 'all'
144
+ ? allPrompts
145
+ : await manager.listPrompts(filters);
146
+ if (toDelete.length === 0) {
147
+ console.log(chalk_1.default.yellow('\nโš ๏ธ No prompts match the selected criteria\n'));
148
+ return;
149
+ }
150
+ // Show preview
151
+ console.log(chalk_1.default.cyan(`\nWill delete ${toDelete.length} prompt(s):\n`));
152
+ toDelete.slice(0, 5).forEach(p => {
153
+ const status = p.executed ? chalk_1.default.green('โœ“') : chalk_1.default.gray('โ—‹');
154
+ console.log(` ${status} [${p.source}] ${p.id}`);
155
+ });
156
+ if (toDelete.length > 5) {
157
+ console.log(chalk_1.default.gray(` ... and ${toDelete.length - 5} more`));
158
+ }
159
+ console.log();
160
+ // Confirm deletion
161
+ const { confirm } = await inquirer_1.default.prompt([
162
+ {
163
+ type: 'confirm',
164
+ name: 'confirm',
165
+ message: `Delete ${toDelete.length} prompt(s)?`,
166
+ default: false,
167
+ },
168
+ ]);
169
+ if (!confirm) {
170
+ console.log(chalk_1.default.gray('\nCancelled. No prompts were deleted.\n'));
171
+ return;
172
+ }
173
+ // Delete
174
+ const deleted = await manager.deletePrompts(filters);
175
+ console.log(chalk_1.default.green(`\nโœ“ Deleted ${deleted} prompt(s)\n`));
176
+ // Show remaining
177
+ const stats = await manager.getStorageStats();
178
+ if (stats.totalPrompts > 0) {
179
+ console.log(chalk_1.default.gray(`Remaining: ${stats.totalPrompts} prompt(s)\n`));
180
+ }
181
+ else {
182
+ console.log(chalk_1.default.gray('All prompts cleared.\n'));
183
+ }
184
+ }
185
+ }
186
+ PromptsClear.description = 'Clear saved prompts with safety checks';
187
+ PromptsClear.examples = [
188
+ '<%= config.bin %> <%= command.id %>',
189
+ '<%= config.bin %> <%= command.id %> --fast',
190
+ '<%= config.bin %> <%= command.id %> --deep',
191
+ '<%= config.bin %> <%= command.id %> --executed',
192
+ '<%= config.bin %> <%= command.id %> --stale',
193
+ '<%= config.bin %> <%= command.id %> --all',
194
+ ];
195
+ PromptsClear.flags = {
196
+ fast: core_1.Flags.boolean({
197
+ description: 'Clear all fast prompts',
198
+ default: false,
199
+ }),
200
+ deep: core_1.Flags.boolean({
201
+ description: 'Clear all deep prompts',
202
+ default: false,
203
+ }),
204
+ executed: core_1.Flags.boolean({
205
+ description: 'Clear executed prompts only (safe)',
206
+ default: false,
207
+ }),
208
+ stale: core_1.Flags.boolean({
209
+ description: 'Clear stale prompts (>30 days old)',
210
+ default: false,
211
+ }),
212
+ all: core_1.Flags.boolean({
213
+ description: 'Clear all prompts (with confirmation)',
214
+ default: false,
215
+ }),
216
+ force: core_1.Flags.boolean({
217
+ description: 'Skip confirmation prompts',
218
+ default: false,
219
+ }),
220
+ };
221
+ exports.default = PromptsClear;
222
+ //# sourceMappingURL=clear.js.map
@@ -0,0 +1,8 @@
1
+ import { Command } from '@oclif/core';
2
+ export default class PromptsList extends Command {
3
+ static description: string;
4
+ static examples: string[];
5
+ run(): Promise<void>;
6
+ private displayPrompts;
7
+ }
8
+ //# sourceMappingURL=list.d.ts.map