productkit 1.6.0 → 1.6.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "productkit",
3
- "version": "1.6.0",
3
+ "version": "1.6.1",
4
4
  "description": "Slash-command-driven product thinking toolkit for Claude Code",
5
5
  "main": "src/cli.js",
6
6
  "bin": {
package/src/cli.js CHANGED
@@ -40,6 +40,7 @@ program
40
40
  program
41
41
  .command('reset')
42
42
  .description('Remove all artifacts and start over')
43
+ .option('--force', 'Skip confirmation prompt')
43
44
  .action(resetCommand);
44
45
 
45
46
  program
@@ -1,6 +1,7 @@
1
1
  const fs = require('fs-extra');
2
2
  const path = require('path');
3
3
  const chalk = require('chalk');
4
+ const readline = require('readline');
4
5
 
5
6
  const ARTIFACTS = [
6
7
  'constitution.md',
@@ -12,7 +13,20 @@ const ARTIFACTS = [
12
13
  'spec.md',
13
14
  ];
14
15
 
15
- async function reset() {
16
+ function confirm(question) {
17
+ const rl = readline.createInterface({
18
+ input: process.stdin,
19
+ output: process.stdout,
20
+ });
21
+ return new Promise((resolve) => {
22
+ rl.question(question, (answer) => {
23
+ rl.close();
24
+ resolve(answer.toLowerCase() === 'y' || answer.toLowerCase() === 'yes');
25
+ });
26
+ });
27
+ }
28
+
29
+ async function reset(options) {
16
30
  const root = process.cwd();
17
31
  const configPath = path.join(root, '.productkit', 'config.json');
18
32
 
@@ -22,24 +36,44 @@ async function reset() {
22
36
  process.exit(1);
23
37
  }
24
38
 
25
- let removed = 0;
39
+ // Find existing artifacts
40
+ const existing = ARTIFACTS.filter(file =>
41
+ fs.existsSync(path.join(root, file))
42
+ );
26
43
 
27
- for (const file of ARTIFACTS) {
28
- const filePath = path.join(root, file);
29
- if (fs.existsSync(filePath)) {
30
- fs.removeSync(filePath);
31
- console.log(chalk.yellow(` removed ${file}`));
32
- removed++;
33
- }
44
+ if (existing.length === 0) {
45
+ console.log();
46
+ console.log(chalk.green.bold('Nothing to reset — no artifacts found.'));
47
+ console.log();
48
+ return;
34
49
  }
35
50
 
51
+ // Show what will be deleted
36
52
  console.log();
37
- if (removed > 0) {
38
- console.log(chalk.green.bold(`Reset complete. ${removed} artifact${removed === 1 ? '' : 's'} removed.`));
39
- } else {
40
- console.log(chalk.green.bold('Nothing to reset — no artifacts found.'));
53
+ console.log(chalk.yellow.bold(`Found ${existing.length} artifact${existing.length === 1 ? '' : 's'}:`));
54
+ for (const file of existing) {
55
+ console.log(chalk.yellow(` ${file}`));
41
56
  }
42
57
  console.log();
58
+
59
+ // Confirm unless --force
60
+ if (!options.force) {
61
+ const yes = await confirm(chalk.red('Delete these artifacts? (y/N) '));
62
+ if (!yes) {
63
+ console.log('Reset cancelled.');
64
+ return;
65
+ }
66
+ console.log();
67
+ }
68
+
69
+ for (const file of existing) {
70
+ fs.removeSync(path.join(root, file));
71
+ console.log(chalk.yellow(` removed ${file}`));
72
+ }
73
+
74
+ console.log();
75
+ console.log(chalk.green.bold(`Reset complete. ${existing.length} artifact${existing.length === 1 ? '' : 's'} removed.`));
76
+ console.log();
43
77
  }
44
78
 
45
79
  module.exports = reset;