productkit 1.6.1 → 1.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 +1 -0
- package/package.json +1 -1
- package/src/cli.js +8 -1
- package/src/commands/completion.js +91 -0
package/README.md
CHANGED
|
@@ -99,6 +99,7 @@ These markdown files are your product foundation — share them with your team,
|
|
|
99
99
|
| `productkit update` | Refresh slash commands to the latest version |
|
|
100
100
|
| `productkit reset` | Remove all artifacts and start over |
|
|
101
101
|
| `productkit list` | Show available slash commands with descriptions |
|
|
102
|
+
| `productkit completion` | Output shell completion script (bash/zsh) |
|
|
102
103
|
| `productkit check` | Verify Claude Code is installed |
|
|
103
104
|
|
|
104
105
|
## How It Works
|
package/package.json
CHANGED
package/src/cli.js
CHANGED
|
@@ -8,13 +8,14 @@ const statusCommand = require('./commands/status');
|
|
|
8
8
|
const updateCommand = require('./commands/update');
|
|
9
9
|
const resetCommand = require('./commands/reset');
|
|
10
10
|
const listCommand = require('./commands/list');
|
|
11
|
+
const completionCommand = require('./commands/completion');
|
|
11
12
|
|
|
12
13
|
const program = new Command();
|
|
13
14
|
|
|
14
15
|
program
|
|
15
16
|
.name('productkit')
|
|
16
17
|
.description(chalk.cyan.bold('Product thinking toolkit for Claude Code'))
|
|
17
|
-
.version('1.
|
|
18
|
+
.version('1.7.0');
|
|
18
19
|
|
|
19
20
|
program
|
|
20
21
|
.command('init [projectName]')
|
|
@@ -48,6 +49,12 @@ program
|
|
|
48
49
|
.description('Show available slash commands with descriptions')
|
|
49
50
|
.action(listCommand);
|
|
50
51
|
|
|
52
|
+
program
|
|
53
|
+
.command('completion')
|
|
54
|
+
.description('Output shell completion script')
|
|
55
|
+
.option('--shell <shell>', 'Shell type (bash or zsh)')
|
|
56
|
+
.action(completionCommand);
|
|
57
|
+
|
|
51
58
|
program.parse(process.argv);
|
|
52
59
|
|
|
53
60
|
if (process.argv.length === 2) {
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
const chalk = require('chalk');
|
|
2
|
+
|
|
3
|
+
const ZSH_COMPLETION = `#compdef productkit
|
|
4
|
+
|
|
5
|
+
_productkit() {
|
|
6
|
+
local -a commands
|
|
7
|
+
commands=(
|
|
8
|
+
'init:Initialize a new product research project'
|
|
9
|
+
'check:Verify Claude Code is installed and available'
|
|
10
|
+
'status:Show which artifacts exist and what steps remain'
|
|
11
|
+
'update:Refresh slash commands to the latest version'
|
|
12
|
+
'reset:Remove all artifacts and start over'
|
|
13
|
+
'list:Show available slash commands with descriptions'
|
|
14
|
+
'completion:Output shell completion script'
|
|
15
|
+
)
|
|
16
|
+
|
|
17
|
+
_arguments -C \\
|
|
18
|
+
'1:command:->command' \\
|
|
19
|
+
'*::arg:->args'
|
|
20
|
+
|
|
21
|
+
case "$state" in
|
|
22
|
+
command)
|
|
23
|
+
_describe 'command' commands
|
|
24
|
+
;;
|
|
25
|
+
args)
|
|
26
|
+
case "$words[1]" in
|
|
27
|
+
init)
|
|
28
|
+
_arguments \\
|
|
29
|
+
'--existing[Add Product Kit to the current directory]' \\
|
|
30
|
+
'1:project name:_files -/'
|
|
31
|
+
;;
|
|
32
|
+
reset)
|
|
33
|
+
_arguments \\
|
|
34
|
+
'--force[Skip confirmation prompt]'
|
|
35
|
+
;;
|
|
36
|
+
esac
|
|
37
|
+
;;
|
|
38
|
+
esac
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
_productkit "$@"`;
|
|
42
|
+
|
|
43
|
+
const BASH_COMPLETION = `_productkit() {
|
|
44
|
+
local cur prev commands
|
|
45
|
+
COMPREPLY=()
|
|
46
|
+
cur="\${COMP_WORDS[COMP_CWORD]}"
|
|
47
|
+
prev="\${COMP_WORDS[COMP_CWORD-1]}"
|
|
48
|
+
commands="init check status update reset list completion"
|
|
49
|
+
|
|
50
|
+
case "\${prev}" in
|
|
51
|
+
productkit)
|
|
52
|
+
COMPREPLY=( $(compgen -W "\${commands}" -- "\${cur}") )
|
|
53
|
+
return 0
|
|
54
|
+
;;
|
|
55
|
+
init)
|
|
56
|
+
COMPREPLY=( $(compgen -W "--existing" -- "\${cur}") )
|
|
57
|
+
return 0
|
|
58
|
+
;;
|
|
59
|
+
reset)
|
|
60
|
+
COMPREPLY=( $(compgen -W "--force" -- "\${cur}") )
|
|
61
|
+
return 0
|
|
62
|
+
;;
|
|
63
|
+
esac
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
complete -F _productkit productkit`;
|
|
67
|
+
|
|
68
|
+
async function completion(options) {
|
|
69
|
+
if (options.shell === 'bash') {
|
|
70
|
+
console.log(BASH_COMPLETION);
|
|
71
|
+
} else if (options.shell === 'zsh') {
|
|
72
|
+
console.log(ZSH_COMPLETION);
|
|
73
|
+
} else {
|
|
74
|
+
// Auto-detect
|
|
75
|
+
const shell = process.env.SHELL || '';
|
|
76
|
+
if (shell.includes('zsh')) {
|
|
77
|
+
console.log(ZSH_COMPLETION);
|
|
78
|
+
} else {
|
|
79
|
+
console.log(BASH_COMPLETION);
|
|
80
|
+
}
|
|
81
|
+
console.error();
|
|
82
|
+
console.error(chalk.cyan('Add to your shell config:'));
|
|
83
|
+
if (shell.includes('zsh')) {
|
|
84
|
+
console.error(` echo 'eval "$(productkit completion)"' >> ~/.zshrc`);
|
|
85
|
+
} else {
|
|
86
|
+
console.error(` echo 'eval "$(productkit completion)"' >> ~/.bashrc`);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
module.exports = completion;
|