productkit 1.3.0 → 1.5.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 +2 -0
- package/package.json +1 -1
- package/src/cli.js +13 -1
- package/src/commands/reset.js +45 -0
- package/src/commands/update.js +51 -0
package/README.md
CHANGED
|
@@ -96,6 +96,8 @@ These markdown files are your product foundation — share them with your team,
|
|
|
96
96
|
| `productkit init <name>` | Scaffold a new project |
|
|
97
97
|
| `productkit init --existing` | Add Product Kit to the current directory |
|
|
98
98
|
| `productkit status` | Show progress — which artifacts exist and what's next |
|
|
99
|
+
| `productkit update` | Refresh slash commands to the latest version |
|
|
100
|
+
| `productkit reset` | Remove all artifacts and start over |
|
|
99
101
|
| `productkit check` | Verify Claude Code is installed |
|
|
100
102
|
|
|
101
103
|
## How It Works
|
package/package.json
CHANGED
package/src/cli.js
CHANGED
|
@@ -5,13 +5,15 @@ const chalk = require('chalk');
|
|
|
5
5
|
const initCommand = require('./commands/init');
|
|
6
6
|
const checkCommand = require('./commands/check');
|
|
7
7
|
const statusCommand = require('./commands/status');
|
|
8
|
+
const updateCommand = require('./commands/update');
|
|
9
|
+
const resetCommand = require('./commands/reset');
|
|
8
10
|
|
|
9
11
|
const program = new Command();
|
|
10
12
|
|
|
11
13
|
program
|
|
12
14
|
.name('productkit')
|
|
13
15
|
.description(chalk.cyan.bold('Product thinking toolkit for Claude Code'))
|
|
14
|
-
.version('1.
|
|
16
|
+
.version('1.5.0');
|
|
15
17
|
|
|
16
18
|
program
|
|
17
19
|
.command('init [projectName]')
|
|
@@ -29,6 +31,16 @@ program
|
|
|
29
31
|
.description('Show which artifacts exist and what steps remain')
|
|
30
32
|
.action(statusCommand);
|
|
31
33
|
|
|
34
|
+
program
|
|
35
|
+
.command('update')
|
|
36
|
+
.description('Refresh slash commands to the latest version')
|
|
37
|
+
.action(updateCommand);
|
|
38
|
+
|
|
39
|
+
program
|
|
40
|
+
.command('reset')
|
|
41
|
+
.description('Remove all artifacts and start over')
|
|
42
|
+
.action(resetCommand);
|
|
43
|
+
|
|
32
44
|
program.parse(process.argv);
|
|
33
45
|
|
|
34
46
|
if (process.argv.length === 2) {
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
const fs = require('fs-extra');
|
|
2
|
+
const path = require('path');
|
|
3
|
+
const chalk = require('chalk');
|
|
4
|
+
|
|
5
|
+
const ARTIFACTS = [
|
|
6
|
+
'constitution.md',
|
|
7
|
+
'users.md',
|
|
8
|
+
'problem.md',
|
|
9
|
+
'assumptions.md',
|
|
10
|
+
'solution.md',
|
|
11
|
+
'priorities.md',
|
|
12
|
+
'spec.md',
|
|
13
|
+
];
|
|
14
|
+
|
|
15
|
+
async function reset() {
|
|
16
|
+
const root = process.cwd();
|
|
17
|
+
const configPath = path.join(root, '.productkit', 'config.json');
|
|
18
|
+
|
|
19
|
+
if (!fs.existsSync(configPath)) {
|
|
20
|
+
console.error(chalk.red('Not a Product Kit project.'));
|
|
21
|
+
console.log('Run: productkit init <name>');
|
|
22
|
+
process.exit(1);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
let removed = 0;
|
|
26
|
+
|
|
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
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
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.'));
|
|
41
|
+
}
|
|
42
|
+
console.log();
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
module.exports = reset;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
const fs = require('fs-extra');
|
|
2
|
+
const path = require('path');
|
|
3
|
+
const chalk = require('chalk');
|
|
4
|
+
|
|
5
|
+
async function update() {
|
|
6
|
+
const root = process.cwd();
|
|
7
|
+
const configPath = path.join(root, '.productkit', 'config.json');
|
|
8
|
+
|
|
9
|
+
if (!fs.existsSync(configPath)) {
|
|
10
|
+
console.error(chalk.red('Not a Product Kit project.'));
|
|
11
|
+
console.log('Run: productkit init <name>');
|
|
12
|
+
process.exit(1);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
const templatesDir = path.join(__dirname, '..', '..', 'templates');
|
|
16
|
+
const commandsDir = path.join(templatesDir, 'commands');
|
|
17
|
+
const targetDir = path.join(root, '.claude', 'commands');
|
|
18
|
+
|
|
19
|
+
fs.ensureDirSync(targetDir);
|
|
20
|
+
|
|
21
|
+
const commandFiles = fs.readdirSync(commandsDir);
|
|
22
|
+
let updated = 0;
|
|
23
|
+
let added = 0;
|
|
24
|
+
|
|
25
|
+
for (const file of commandFiles) {
|
|
26
|
+
const src = path.join(commandsDir, file);
|
|
27
|
+
const dest = path.join(targetDir, file);
|
|
28
|
+
const existed = fs.existsSync(dest);
|
|
29
|
+
|
|
30
|
+
fs.copyFileSync(src, dest);
|
|
31
|
+
|
|
32
|
+
if (existed) {
|
|
33
|
+
updated++;
|
|
34
|
+
} else {
|
|
35
|
+
added++;
|
|
36
|
+
console.log(chalk.green(` + ${file}`));
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
// Update CLAUDE.md
|
|
41
|
+
const claudeSrc = path.join(templatesDir, 'CLAUDE.md');
|
|
42
|
+
const claudeDest = path.join(root, 'CLAUDE.md');
|
|
43
|
+
fs.copyFileSync(claudeSrc, claudeDest);
|
|
44
|
+
|
|
45
|
+
console.log();
|
|
46
|
+
console.log(chalk.green.bold('Slash commands updated!'));
|
|
47
|
+
console.log(` ${updated} updated, ${added} new`);
|
|
48
|
+
console.log();
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
module.exports = update;
|