skill-market-cli 1.0.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/src/index.js ADDED
@@ -0,0 +1,113 @@
1
+ const { Command } = require('commander');
2
+ const chalk = require('chalk');
3
+ const pkg = require('../package.json');
4
+
5
+ const login = require('./commands/login');
6
+ const logout = require('./commands/logout');
7
+ const list = require('./commands/list');
8
+ const upload = require('./commands/upload');
9
+ const update = require('./commands/update');
10
+ const remove = require('./commands/delete');
11
+ const runExample = require('./commands/run-example');
12
+ const { getConfig } = require('./auth/token-store');
13
+
14
+ const program = new Command();
15
+
16
+ program
17
+ .name('skill-market-cli')
18
+ .description('CLI tool for managing skills on Skill Market')
19
+ .version(pkg.version, '-v, --version')
20
+ .option('-c, --config <path>', 'config file path')
21
+ .hook('preAction', (thisCommand) => {
22
+ // 显示欢迎信息
23
+ const config = getConfig();
24
+ if (config.user && thisCommand.args[0] !== 'login') {
25
+ console.log(chalk.gray(`Logged in as: ${config.user.name}`));
26
+ }
27
+ });
28
+
29
+ // Login command
30
+ program
31
+ .command('login')
32
+ .description('Login to Skill Market')
33
+ .option('--no-open', 'Do not open browser automatically')
34
+ .action(login);
35
+
36
+ // Logout command
37
+ program
38
+ .command('logout')
39
+ .description('Logout from Skill Market')
40
+ .action(logout);
41
+
42
+ // List command
43
+ program
44
+ .command('list')
45
+ .alias('ls')
46
+ .description('List all skills')
47
+ .option('--my', 'Show only my skills')
48
+ .option('--json', 'Output as JSON')
49
+ .option('-p, --page <number>', 'Page number', '1')
50
+ .option('-s, --size <number>', 'Page size', '20')
51
+ .action(list);
52
+
53
+ // Upload command
54
+ program
55
+ .command('upload <path>')
56
+ .alias('up')
57
+ .description('Upload a new skill')
58
+ .option('-n, --name <name>', 'Skill name')
59
+ .option('-d, --description <desc>', 'Skill description/purpose')
60
+ .option('-t, --tags <tags>', 'Tags (comma separated)')
61
+ .option('-m, --model <model>', 'Recommended model')
62
+ .action(upload);
63
+
64
+ // Update command
65
+ program
66
+ .command('update <id>')
67
+ .alias('updt')
68
+ .description('Update an existing skill')
69
+ .option('-f, --file <path>', 'Path to SKILL.md file')
70
+ .option('-n, --name <name>', 'Skill name')
71
+ .option('-d, --description <desc>', 'Skill description')
72
+ .option('-t, --tags <tags>', 'Tags (comma separated)')
73
+ .action(update);
74
+
75
+ // Delete command
76
+ program
77
+ .command('delete <id>')
78
+ .alias('rm')
79
+ .description('Delete a skill')
80
+ .option('-f, --force', 'Force delete without confirmation')
81
+ .action(remove);
82
+
83
+ // Run example command
84
+ program
85
+ .command('run-example <path>')
86
+ .alias('run')
87
+ .description('Run user examples and collect AI responses')
88
+ .option('-m, --model <model>', 'Model to use for running examples', 'claude-3-5-sonnet')
89
+ .option('--skip-confirm', 'Skip confirmation for each example')
90
+ .action(runExample);
91
+
92
+ // Skill guide command
93
+ program
94
+ .command('guide')
95
+ .description('Show skill upload guide')
96
+ .action(() => {
97
+ const fs = require('fs');
98
+ const path = require('path');
99
+ const guidePath = path.join(__dirname, 'skills', 'upload-guide', 'SKILL.md');
100
+ if (fs.existsSync(guidePath)) {
101
+ console.log(fs.readFileSync(guidePath, 'utf-8'));
102
+ } else {
103
+ console.log(chalk.yellow('Guide not found. Please visit https://kirigaya.cn/ktools/skillmanager'));
104
+ }
105
+ });
106
+
107
+ // Parse arguments
108
+ program.parse();
109
+
110
+ // Show help if no arguments
111
+ if (!process.argv.slice(2).length) {
112
+ program.outputHelp();
113
+ }
@@ -0,0 +1,92 @@
1
+ # Skill Upload Guide
2
+
3
+ This skill helps you upload skills to the Skill Market using the CLI tool.
4
+
5
+ ## Overview
6
+
7
+ When uploading a skill, you need to provide:
8
+
9
+ 1. **SKILL.md** - The main skill definition file
10
+ 2. **Usage Examples** - Demonstrations of how to use the skill
11
+ 3. **AI Responses** - Expected AI behavior for each example
12
+
13
+ ## File Structure
14
+
15
+ ```
16
+ my-skill/
17
+ ├── SKILL.md # Required: Main skill file
18
+ ├── .skill-examples.json # Generated: Collected AI responses
19
+ └── assets/ # Optional: Additional files
20
+ ```
21
+
22
+ ## SKILL.md Format
23
+
24
+ ```markdown
25
+ ---
26
+ name: my-awesome-skill
27
+ purpose: Brief description of what this skill does
28
+ tags: ["tag1", "tag2"]
29
+ model: claude-3-5-sonnet
30
+ ---
31
+
32
+ # My Awesome Skill
33
+
34
+ Detailed description of the skill...
35
+
36
+ ## Usage Examples
37
+
38
+ ### Example 1
39
+ **User:** How do I use this skill?
40
+
41
+ **AI:** I'll help you use this skill. Here's what you need to do...
42
+
43
+ ### Example 2
44
+ **User:** Another example prompt
45
+
46
+ **AI:** Here's the response...
47
+ ```
48
+
49
+ ## Collecting AI Responses
50
+
51
+ Before uploading, you should collect AI responses for your examples:
52
+
53
+ ```bash
54
+ # Run examples and collect AI responses
55
+ skill-market-cli run-example ./my-skill --model claude-3-5-sonnet
56
+
57
+ # This will:
58
+ # 1. Read your SKILL.md
59
+ # 2. Run each example through the AI
60
+ # 3. Collect thinking steps, tool calls, and messages
61
+ # 4. Save to .skill-examples.json
62
+ ```
63
+
64
+ ## Uploading
65
+
66
+ ```bash
67
+ # Upload with automatic info extraction
68
+ skill-market-cli upload ./my-skill
69
+
70
+ # Or specify details manually
71
+ skill-market-cli upload ./my-skill/SKILL.md \
72
+ --name "my-skill" \
73
+ --description "What this skill does" \
74
+ --tags "tag1,tag2" \
75
+ --model "claude-3-5-sonnet"
76
+ ```
77
+
78
+ ## Best Practices
79
+
80
+ 1. **Clear Examples**: Provide 2-5 clear, diverse usage examples
81
+ 2. **Complete Responses**: Always run `run-example` to collect full AI responses
82
+ 3. **Privacy**: The tool will automatically redact sensitive information
83
+ 4. **Model Spec**: Indicate which model works best with your skill
84
+
85
+ ## Privacy & Security
86
+
87
+ When collecting AI responses:
88
+ - API keys are automatically redacted
89
+ - Sensitive domains are masked
90
+ - Personal information is removed
91
+
92
+ You can review the collected data in `.skill-examples.json` before uploading.