@optima-chat/dev-skills 0.6.0 → 0.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/README.md +7 -4
- package/package.json +1 -1
- package/scripts/install.js +26 -0
package/README.md
CHANGED
|
@@ -142,15 +142,17 @@ Claude:
|
|
|
142
142
|
### 示例 2:生成测试 token 并管理店铺
|
|
143
143
|
|
|
144
144
|
```bash
|
|
145
|
-
# 1.
|
|
146
|
-
$ optima-generate-test-token
|
|
145
|
+
# 1. 生成 production 环境测试 token
|
|
146
|
+
$ optima-generate-test-token --env production
|
|
147
147
|
|
|
148
|
+
Environment: production
|
|
149
|
+
Auth API: https://auth.optima.shop
|
|
148
150
|
✅ Test token generated successfully!
|
|
149
151
|
📁 Token File Path: /tmp/optima-test-token-xxx.txt
|
|
150
152
|
|
|
151
153
|
# 2. 使用 token 创建商品
|
|
152
154
|
$ OPTIMA_TOKEN=$(cat /tmp/optima-test-token-xxx.txt) \
|
|
153
|
-
OPTIMA_ENV=
|
|
155
|
+
OPTIMA_ENV=production \
|
|
154
156
|
commerce product create --title "测试商品" --price 99.99 --stock 100
|
|
155
157
|
|
|
156
158
|
{
|
|
@@ -222,7 +224,7 @@ $ optima-query-db commerce-backend "SELECT id, title FROM products LIMIT 5" stag
|
|
|
222
224
|
|
|
223
225
|
## 🛠️ 开发状态
|
|
224
226
|
|
|
225
|
-
**当前版本**: 0.
|
|
227
|
+
**当前版本**: 0.6.0
|
|
226
228
|
|
|
227
229
|
**已完成**:
|
|
228
230
|
- ✅ 3 个跨环境命令:`/logs`、`/query-db`、`/generate-test-token`
|
|
@@ -233,6 +235,7 @@ $ optima-query-db commerce-backend "SELECT id, title FROM products LIMIT 5" stag
|
|
|
233
235
|
- ✅ TypeScript CLI 工具:`optima-query-db`、`optima-generate-test-token`
|
|
234
236
|
- ✅ 通过 Infisical 动态获取密钥
|
|
235
237
|
- ✅ 自动生成测试 token 并设置 merchant profile
|
|
238
|
+
- ✅ `generate-test-token` 支持 development 和 production 环境
|
|
236
239
|
|
|
237
240
|
**设计原则**:
|
|
238
241
|
- 命令提供信息(URL、路径、凭证位置),不实现复杂逻辑
|
package/package.json
CHANGED
package/scripts/install.js
CHANGED
|
@@ -9,6 +9,8 @@ const SKILLS_SOURCE = path.join(__dirname, '..', '.claude');
|
|
|
9
9
|
const COMMANDS_DEST = path.join(CLAUDE_DIR, 'commands');
|
|
10
10
|
const LOGS_SKILL_DEST = path.join(CLAUDE_DIR, 'skills', 'logs');
|
|
11
11
|
const QUERY_DB_SKILL_DEST = path.join(CLAUDE_DIR, 'skills', 'query-db');
|
|
12
|
+
const GENERATE_TOKEN_SKILL_DEST = path.join(CLAUDE_DIR, 'skills', 'generate-test-token');
|
|
13
|
+
const USE_COMMERCE_CLI_SKILL_DEST = path.join(CLAUDE_DIR, 'skills', 'use-commerce-cli');
|
|
12
14
|
|
|
13
15
|
// 颜色输出
|
|
14
16
|
const colors = {
|
|
@@ -71,6 +73,14 @@ function install() {
|
|
|
71
73
|
log(`✓ Installed /query-db command`, 'green');
|
|
72
74
|
}
|
|
73
75
|
|
|
76
|
+
// 安装 /generate-test-token 命令
|
|
77
|
+
const generateTokenCommandSource = path.join(SKILLS_SOURCE, 'commands', 'generate-test-token.md');
|
|
78
|
+
const generateTokenCommandDest = path.join(COMMANDS_DEST, 'generate-test-token.md');
|
|
79
|
+
if (fs.existsSync(generateTokenCommandSource)) {
|
|
80
|
+
fs.copyFileSync(generateTokenCommandSource, generateTokenCommandDest);
|
|
81
|
+
log(`✓ Installed /generate-test-token command`, 'green');
|
|
82
|
+
}
|
|
83
|
+
|
|
74
84
|
// 安装 logs skill
|
|
75
85
|
const logsSkillSource = path.join(SKILLS_SOURCE, 'skills', 'logs');
|
|
76
86
|
if (fs.existsSync(logsSkillSource)) {
|
|
@@ -85,13 +95,29 @@ function install() {
|
|
|
85
95
|
log(`✓ Installed query-db skill`, 'green');
|
|
86
96
|
}
|
|
87
97
|
|
|
98
|
+
// 安装 generate-test-token skill
|
|
99
|
+
const generateTokenSkillSource = path.join(SKILLS_SOURCE, 'skills', 'generate-test-token');
|
|
100
|
+
if (fs.existsSync(generateTokenSkillSource)) {
|
|
101
|
+
copyRecursive(generateTokenSkillSource, GENERATE_TOKEN_SKILL_DEST);
|
|
102
|
+
log(`✓ Installed generate-test-token skill`, 'green');
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
// 安装 use-commerce-cli skill
|
|
106
|
+
const useCommerceCliSkillSource = path.join(SKILLS_SOURCE, 'skills', 'use-commerce-cli');
|
|
107
|
+
if (fs.existsSync(useCommerceCliSkillSource)) {
|
|
108
|
+
copyRecursive(useCommerceCliSkillSource, USE_COMMERCE_CLI_SKILL_DEST);
|
|
109
|
+
log(`✓ Installed use-commerce-cli skill`, 'green');
|
|
110
|
+
}
|
|
111
|
+
|
|
88
112
|
log('\n✨ Installation complete!\n', 'green');
|
|
89
113
|
log('Available commands:', 'blue');
|
|
90
114
|
log(' /logs <service> [lines] [environment]', 'yellow');
|
|
91
115
|
log(' /query-db <service> <sql> [environment]', 'yellow');
|
|
116
|
+
log(' /generate-test-token [options]', 'yellow');
|
|
92
117
|
log('\nExamples:', 'blue');
|
|
93
118
|
log(' /logs commerce-backend # CI logs', 'yellow');
|
|
94
119
|
log(' /query-db commerce-backend "SELECT COUNT(*) FROM orders" # CI query', 'yellow');
|
|
120
|
+
log(' optima-generate-test-token --env production # Generate test token', 'yellow');
|
|
95
121
|
log('\nDocumentation: https://github.com/Optima-Chat/optima-dev-skills\n', 'blue');
|
|
96
122
|
}
|
|
97
123
|
|