productkit 1.1.0 → 1.3.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
@@ -94,6 +94,8 @@ These markdown files are your product foundation — share them with your team,
94
94
  | Command | Description |
95
95
  |---------|-------------|
96
96
  | `productkit init <name>` | Scaffold a new project |
97
+ | `productkit init --existing` | Add Product Kit to the current directory |
98
+ | `productkit status` | Show progress — which artifacts exist and what's next |
97
99
  | `productkit check` | Verify Claude Code is installed |
98
100
 
99
101
  ## How It Works
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "productkit",
3
- "version": "1.1.0",
3
+ "version": "1.3.0",
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
@@ -4,17 +4,19 @@ const { Command } = require('commander');
4
4
  const chalk = require('chalk');
5
5
  const initCommand = require('./commands/init');
6
6
  const checkCommand = require('./commands/check');
7
+ const statusCommand = require('./commands/status');
7
8
 
8
9
  const program = new Command();
9
10
 
10
11
  program
11
12
  .name('productkit')
12
13
  .description(chalk.cyan.bold('Product thinking toolkit for Claude Code'))
13
- .version('1.1.0');
14
+ .version('1.3.0');
14
15
 
15
16
  program
16
- .command('init <projectName>')
17
+ .command('init [projectName]')
17
18
  .description('Initialize a new product research project')
19
+ .option('--existing', 'Add Product Kit to the current directory')
18
20
  .action(initCommand);
19
21
 
20
22
  program
@@ -22,6 +24,11 @@ program
22
24
  .description('Verify Claude Code is installed and available')
23
25
  .action(checkCommand);
24
26
 
27
+ program
28
+ .command('status')
29
+ .description('Show which artifacts exist and what steps remain')
30
+ .action(statusCommand);
31
+
25
32
  program.parse(process.argv);
26
33
 
27
34
  if (process.argv.length === 2) {
@@ -2,53 +2,94 @@ const fs = require('fs-extra');
2
2
  const path = require('path');
3
3
  const chalk = require('chalk');
4
4
 
5
- async function init(projectName) {
6
- const projectRoot = path.join(process.cwd(), projectName);
5
+ function scaffold(projectRoot, projectName) {
6
+ const templatesDir = path.join(__dirname, '..', '..', 'templates');
7
7
 
8
- if (fs.existsSync(projectRoot)) {
9
- console.error(chalk.red(`Error: Directory "${projectName}" already exists`));
10
- process.exit(1);
11
- }
8
+ // Create directories
9
+ fs.ensureDirSync(path.join(projectRoot, '.productkit'));
10
+ fs.ensureDirSync(path.join(projectRoot, '.claude', 'commands'));
12
11
 
13
- try {
14
- const templatesDir = path.join(__dirname, '..', '..', 'templates');
15
-
16
- // Create directories
17
- fs.ensureDirSync(path.join(projectRoot, '.productkit'));
18
- fs.ensureDirSync(path.join(projectRoot, '.claude', 'commands'));
19
-
20
- // Write config
21
- fs.writeJsonSync(path.join(projectRoot, '.productkit', 'config.json'), {
22
- version: '1.0.0',
23
- created: new Date().toISOString(),
24
- }, { spaces: 2 });
25
-
26
- // Copy slash command templates
27
- const commandsDir = path.join(templatesDir, 'commands');
28
- const commandFiles = fs.readdirSync(commandsDir);
29
- for (const file of commandFiles) {
30
- fs.copyFileSync(
31
- path.join(commandsDir, file),
32
- path.join(projectRoot, '.claude', 'commands', file)
33
- );
34
- }
12
+ // Write config
13
+ fs.writeJsonSync(path.join(projectRoot, '.productkit', 'config.json'), {
14
+ version: '1.0.0',
15
+ created: new Date().toISOString(),
16
+ }, { spaces: 2 });
35
17
 
36
- // Copy CLAUDE.md
18
+ // Copy slash command templates
19
+ const commandsDir = path.join(templatesDir, 'commands');
20
+ const commandFiles = fs.readdirSync(commandsDir);
21
+ for (const file of commandFiles) {
37
22
  fs.copyFileSync(
38
- path.join(templatesDir, 'CLAUDE.md'),
39
- path.join(projectRoot, 'CLAUDE.md')
23
+ path.join(commandsDir, file),
24
+ path.join(projectRoot, '.claude', 'commands', file)
40
25
  );
26
+ }
41
27
 
42
- // Copy README.md with project name substitution
28
+ // Copy CLAUDE.md (don't overwrite existing)
29
+ const claudeMdPath = path.join(projectRoot, 'CLAUDE.md');
30
+ if (!fs.existsSync(claudeMdPath)) {
31
+ fs.copyFileSync(path.join(templatesDir, 'CLAUDE.md'), claudeMdPath);
32
+ } else {
33
+ const existing = fs.readFileSync(claudeMdPath, 'utf-8');
34
+ const template = fs.readFileSync(path.join(templatesDir, 'CLAUDE.md'), 'utf-8');
35
+ fs.writeFileSync(claudeMdPath, existing + '\n' + template);
36
+ }
37
+
38
+ // Copy README.md with project name substitution (only for new projects)
39
+ if (!fs.existsSync(path.join(projectRoot, 'README.md'))) {
43
40
  let readme = fs.readFileSync(path.join(templatesDir, 'README.md'), 'utf-8');
44
41
  readme = readme.replace(/\{\{PROJECT_NAME\}\}/g, projectName);
45
42
  fs.writeFileSync(path.join(projectRoot, 'README.md'), readme);
43
+ }
46
44
 
47
- // Copy .gitignore
45
+ // Copy .gitignore (only for new projects)
46
+ if (!fs.existsSync(path.join(projectRoot, '.gitignore'))) {
48
47
  fs.copyFileSync(
49
48
  path.join(templatesDir, 'gitignore'),
50
49
  path.join(projectRoot, '.gitignore')
51
50
  );
51
+ }
52
+ }
53
+
54
+ async function init(projectName, options) {
55
+ if (options.existing) {
56
+ const projectRoot = process.cwd();
57
+
58
+ if (fs.existsSync(path.join(projectRoot, '.productkit'))) {
59
+ console.error(chalk.red('Error: This directory is already a Product Kit project.'));
60
+ process.exit(1);
61
+ }
62
+
63
+ try {
64
+ scaffold(projectRoot, path.basename(projectRoot));
65
+
66
+ console.log(chalk.green.bold('Product Kit added to existing project!'));
67
+ console.log();
68
+ console.log(chalk.cyan('Next steps:'));
69
+ console.log(' 1. claude');
70
+ console.log(' 2. /productkit.constitution');
71
+ console.log();
72
+ } catch (error) {
73
+ console.error(chalk.red('Error initializing:'), error.message);
74
+ process.exit(1);
75
+ }
76
+ return;
77
+ }
78
+
79
+ if (!projectName) {
80
+ console.error(chalk.red('Error: Project name is required. Use --existing to init in current directory.'));
81
+ process.exit(1);
82
+ }
83
+
84
+ const projectRoot = path.join(process.cwd(), projectName);
85
+
86
+ if (fs.existsSync(projectRoot)) {
87
+ console.error(chalk.red(`Error: Directory "${projectName}" already exists`));
88
+ process.exit(1);
89
+ }
90
+
91
+ try {
92
+ scaffold(projectRoot, projectName);
52
93
 
53
94
  // Init git repo
54
95
  const { execSync } = require('child_process');
@@ -0,0 +1,66 @@
1
+ const fs = require('fs-extra');
2
+ const path = require('path');
3
+ const chalk = require('chalk');
4
+
5
+ const ARTIFACTS = [
6
+ { file: 'constitution.md', command: '/productkit.constitution', label: 'Constitution' },
7
+ { file: 'users.md', command: '/productkit.users', label: 'Users' },
8
+ { file: 'problem.md', command: '/productkit.problem', label: 'Problem' },
9
+ { file: 'assumptions.md', command: '/productkit.assumptions', label: 'Assumptions' },
10
+ { file: 'solution.md', command: '/productkit.solution', label: 'Solution' },
11
+ { file: 'priorities.md', command: '/productkit.prioritize', label: 'Priorities' },
12
+ { file: 'spec.md', command: '/productkit.spec', label: 'Spec' },
13
+ ];
14
+
15
+ async function status() {
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
+ const done = [];
26
+ const remaining = [];
27
+
28
+ for (const artifact of ARTIFACTS) {
29
+ const exists = fs.existsSync(path.join(root, artifact.file));
30
+ if (exists) {
31
+ done.push(artifact);
32
+ } else {
33
+ remaining.push(artifact);
34
+ }
35
+ }
36
+
37
+ console.log();
38
+ console.log(chalk.bold(`Progress: ${done.length}/${ARTIFACTS.length} artifacts`));
39
+ console.log();
40
+
41
+ if (done.length > 0) {
42
+ console.log(chalk.green.bold('Completed:'));
43
+ for (const a of done) {
44
+ console.log(chalk.green(` done ${a.label} (${a.file})`));
45
+ }
46
+ console.log();
47
+ }
48
+
49
+ if (remaining.length > 0) {
50
+ console.log(chalk.yellow.bold('Remaining:'));
51
+ for (const a of remaining) {
52
+ console.log(chalk.yellow(` todo ${a.label} — run ${a.command}`));
53
+ }
54
+ console.log();
55
+ }
56
+
57
+ if (remaining.length === 0) {
58
+ console.log(chalk.green.bold('All artifacts complete!'));
59
+ console.log();
60
+ } else {
61
+ console.log(chalk.cyan(`Next step: ${remaining[0].command}`));
62
+ console.log();
63
+ }
64
+ }
65
+
66
+ module.exports = status;