@optima-chat/dev-skills 0.7.13 → 0.7.15
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/.claude/commands/generate-test-token.md +0 -0
- package/.claude/commands/logs.md +0 -0
- package/.claude/commands/query-db.md +4 -4
- package/.claude/commands/read-code.md +0 -0
- package/.claude/skills/generate-test-token/SKILL.md +38 -23
- package/.claude/skills/logs/SKILL.md +0 -0
- package/.claude/skills/query-db/SKILL.md +1 -1
- package/.claude/skills/read-code/SKILL.md +0 -0
- package/.claude/skills/use-commerce-cli/SKILL.md +0 -0
- package/LICENSE +0 -0
- package/README.md +0 -0
- package/bin/helpers/generate-test-token.ts +28 -17
- package/bin/helpers/query-db.ts +2 -2
- package/dist/bin/helpers/generate-test-token.js +27 -16
- package/dist/bin/helpers/query-db.js +2 -2
- package/package.json +1 -1
- package/tsconfig.json +0 -0
- package/.claude/settings.local.json +0 -41
|
File without changes
|
package/.claude/commands/logs.md
CHANGED
|
File without changes
|
|
@@ -192,7 +192,7 @@ print(f\"COMMERCE_DB_PASSWORD={secrets['COMMERCE_DB_PASSWORD']}\")
|
|
|
192
192
|
" > /tmp/stage_db_config.sh && source /tmp/stage_db_config.sh
|
|
193
193
|
|
|
194
194
|
# 4. 建立 SSH 隧道到 Shared EC2,通过隧道访问 Stage RDS
|
|
195
|
-
ssh -i ~/.ssh/optima-ec2-key -f -N -L 15432:optima-stage-postgres.ctg866o0ehac.ap-southeast-1.rds.amazonaws.com:5432 ec2-user@
|
|
195
|
+
ssh -i ~/.ssh/optima-ec2-key -f -N -L 15432:optima-stage-postgres.ctg866o0ehac.ap-southeast-1.rds.amazonaws.com:5432 ec2-user@3.0.210.113
|
|
196
196
|
|
|
197
197
|
# 5. 通过本地端口 15432 连接到 RDS
|
|
198
198
|
PGPASSWORD="${COMMERCE_DB_PASSWORD}" psql -h localhost -p 15432 -U "${COMMERCE_DB_USER}" -d optima_commerce -c "SELECT COUNT(*) FROM products"
|
|
@@ -249,7 +249,7 @@ pkill -f "ssh.*15432:${DATABASE_HOST}:5432"
|
|
|
249
249
|
- Infisical 配置从 GitHub Variables 获取
|
|
250
250
|
- 数据库密钥从 Infisical 动态获取(项目: optima-secrets-v2, 环境: staging, 路径: /shared-secrets/database-users)
|
|
251
251
|
- Stage RDS: `optima-stage-postgres.ctg866o0ehac.ap-southeast-1.rds.amazonaws.com`
|
|
252
|
-
- Shared EC2 IP: `
|
|
252
|
+
- Shared EC2 IP: `3.0.210.113`
|
|
253
253
|
- SSH 隧道: 本地端口 `15432` → Shared EC2 → Stage RDS `5432`
|
|
254
254
|
- Stage 和 Prod 有独立的 RDS 实例
|
|
255
255
|
- ⚠️ session-gateway 数据库名: Stage 用 `optima_shell`, Prod 用 `optima_ai_shell`
|
|
@@ -290,7 +290,7 @@ print(f\"COMMERCE_DB_PASSWORD={secrets['COMMERCE_DB_PASSWORD']}\")
|
|
|
290
290
|
" > /tmp/prod_db_config.sh && source /tmp/prod_db_config.sh
|
|
291
291
|
|
|
292
292
|
# 4. 建立 SSH 隧道到 Shared EC2,通过隧道访问 Prod RDS
|
|
293
|
-
ssh -i ~/.ssh/optima-ec2-key -f -N -L 15433:optima-prod-postgres.ctg866o0ehac.ap-southeast-1.rds.amazonaws.com:5432 ec2-user@
|
|
293
|
+
ssh -i ~/.ssh/optima-ec2-key -f -N -L 15433:optima-prod-postgres.ctg866o0ehac.ap-southeast-1.rds.amazonaws.com:5432 ec2-user@3.0.210.113
|
|
294
294
|
|
|
295
295
|
# 5. 通过本地端口 15433 连接到 RDS
|
|
296
296
|
PGPASSWORD="${COMMERCE_DB_PASSWORD}" psql -h localhost -p 15433 -U "${COMMERCE_DB_USER}" -d optima_commerce -c "SELECT COUNT(*) FROM products"
|
|
@@ -347,7 +347,7 @@ pkill -f "ssh.*15433:${DATABASE_HOST}:5432"
|
|
|
347
347
|
- Infisical 配置从 GitHub Variables 获取
|
|
348
348
|
- 数据库密钥从 Infisical 动态获取(项目: optima-secrets-v2, 环境: prod, 路径: /shared-secrets/database-users)
|
|
349
349
|
- Prod RDS: `optima-prod-postgres.ctg866o0ehac.ap-southeast-1.rds.amazonaws.com`
|
|
350
|
-
- Shared EC2 IP: `
|
|
350
|
+
- Shared EC2 IP: `3.0.210.113`
|
|
351
351
|
- SSH 隧道: 本地端口 `15433` → Shared EC2 → Prod RDS `5432`
|
|
352
352
|
- Stage 用端口 `15432`,Prod 用端口 `15433`
|
|
353
353
|
- Stage 和 Prod 有独立的 RDS 实例
|
|
File without changes
|
|
@@ -36,23 +36,34 @@ optima-generate-test-token [options]
|
|
|
36
36
|
### 基本使用
|
|
37
37
|
|
|
38
38
|
```bash
|
|
39
|
-
#
|
|
39
|
+
# CI 环境(默认)
|
|
40
40
|
optima-generate-test-token
|
|
41
41
|
|
|
42
|
-
#
|
|
43
|
-
optima-generate-test-token --env
|
|
42
|
+
# Stage 环境
|
|
43
|
+
optima-generate-test-token --env stage
|
|
44
|
+
|
|
45
|
+
# Prod 环境
|
|
46
|
+
optima-generate-test-token --env prod
|
|
44
47
|
|
|
45
48
|
# 自定义商户名称
|
|
46
|
-
optima-generate-test-token --business-name "我的测试店铺" --env
|
|
49
|
+
optima-generate-test-token --business-name "我的测试店铺" --env stage
|
|
47
50
|
|
|
48
51
|
# 完全自定义
|
|
49
52
|
optima-generate-test-token \
|
|
50
53
|
--email "test@example.com" \
|
|
51
54
|
--password "MyPassword123" \
|
|
52
55
|
--business-name "测试商店" \
|
|
53
|
-
--env
|
|
56
|
+
--env prod
|
|
54
57
|
```
|
|
55
58
|
|
|
59
|
+
### 环境说明
|
|
60
|
+
|
|
61
|
+
| 环境 | Auth URL | API URL |
|
|
62
|
+
|------|----------|---------|
|
|
63
|
+
| ci | `auth.optima.chat` | `api.optima.chat` |
|
|
64
|
+
| stage | `auth.stage.optima.onl` | `api.stage.optima.onl` |
|
|
65
|
+
| prod | `auth.optima.onl` | `api.optima.onl` |
|
|
66
|
+
|
|
56
67
|
### 使用生成的 Token
|
|
57
68
|
|
|
58
69
|
工具执行后会输出 token 文件路径,例如:`/tmp/optima-test-token-1763997011780.txt`
|
|
@@ -62,12 +73,12 @@ optima-generate-test-token \
|
|
|
62
73
|
```bash
|
|
63
74
|
# 查询商品列表
|
|
64
75
|
OPTIMA_TOKEN=$(cat /tmp/optima-test-token-xxx.txt) \
|
|
65
|
-
OPTIMA_ENV=
|
|
76
|
+
OPTIMA_ENV=ci \
|
|
66
77
|
commerce product list
|
|
67
78
|
|
|
68
79
|
# 创建商品
|
|
69
80
|
OPTIMA_TOKEN=$(cat /tmp/optima-test-token-xxx.txt) \
|
|
70
|
-
OPTIMA_ENV=
|
|
81
|
+
OPTIMA_ENV=ci \
|
|
71
82
|
commerce product create \
|
|
72
83
|
--title "测试商品" \
|
|
73
84
|
--description "这是一个测试商品" \
|
|
@@ -101,7 +112,7 @@ curl -H "Authorization: Bearer $(cat /tmp/optima-test-token-xxx.txt)" \
|
|
|
101
112
|
3. 使用 token 创建商品:
|
|
102
113
|
```bash
|
|
103
114
|
OPTIMA_TOKEN=$(cat /tmp/optima-test-token-xxx.txt) \
|
|
104
|
-
OPTIMA_ENV=
|
|
115
|
+
OPTIMA_ENV=ci \
|
|
105
116
|
commerce product create --title "测试商品" --price 99.99 --stock 100
|
|
106
117
|
```
|
|
107
118
|
|
|
@@ -115,7 +126,7 @@ curl -H "Authorization: Bearer $(cat /tmp/optima-test-token-xxx.txt)" \
|
|
|
115
126
|
3. 使用 token 查询订单:
|
|
116
127
|
```bash
|
|
117
128
|
OPTIMA_TOKEN=$(cat /tmp/optima-test-token-xxx.txt) \
|
|
118
|
-
OPTIMA_ENV=
|
|
129
|
+
OPTIMA_ENV=ci \
|
|
119
130
|
commerce order list
|
|
120
131
|
```
|
|
121
132
|
|
|
@@ -130,10 +141,10 @@ curl -H "Authorization: Bearer $(cat /tmp/optima-test-token-xxx.txt)" \
|
|
|
130
141
|
TOKEN_FILE=/tmp/optima-test-token-xxx.txt
|
|
131
142
|
|
|
132
143
|
# 创建多个商品
|
|
133
|
-
OPTIMA_TOKEN=$(cat $TOKEN_FILE) OPTIMA_ENV=
|
|
144
|
+
OPTIMA_TOKEN=$(cat $TOKEN_FILE) OPTIMA_ENV=ci \
|
|
134
145
|
commerce product create --title "商品A" --price 49.99 --stock 50
|
|
135
146
|
|
|
136
|
-
OPTIMA_TOKEN=$(cat $TOKEN_FILE) OPTIMA_ENV=
|
|
147
|
+
OPTIMA_TOKEN=$(cat $TOKEN_FILE) OPTIMA_ENV=ci \
|
|
137
148
|
commerce product create --title "商品B" --price 89.99 --stock 30
|
|
138
149
|
```
|
|
139
150
|
|
|
@@ -150,7 +161,7 @@ curl -H "Authorization: Bearer $(cat /tmp/optima-test-token-xxx.txt)" \
|
|
|
150
161
|
|
|
151
162
|
# 在环境变量中设置
|
|
152
163
|
export OPTIMA_TOKEN=$(cat $TOKEN_FILE)
|
|
153
|
-
export OPTIMA_ENV=
|
|
164
|
+
export OPTIMA_ENV=ci
|
|
154
165
|
|
|
155
166
|
# 运行测试
|
|
156
167
|
npm run test:api
|
|
@@ -179,7 +190,7 @@ curl -H "Authorization: Bearer $(cat /tmp/optima-test-token-xxx.txt)" \
|
|
|
179
190
|
TOKEN=$(cat /tmp/optima-test-token-1763997011780.txt)
|
|
180
191
|
|
|
181
192
|
# Use with commerce CLI:
|
|
182
|
-
OPTIMA_TOKEN=$(cat /tmp/optima-test-token-1763997011780.txt) OPTIMA_ENV=
|
|
193
|
+
OPTIMA_TOKEN=$(cat /tmp/optima-test-token-1763997011780.txt) OPTIMA_ENV=ci commerce product list
|
|
183
194
|
|
|
184
195
|
# Use in curl:
|
|
185
196
|
curl -H "Authorization: Bearer $(cat /tmp/optima-test-token-1763997011780.txt)" https://api.optima.chat/api/products
|
|
@@ -196,7 +207,7 @@ curl -H "Authorization: Bearer $(cat /tmp/optima-test-token-xxx.txt)" \
|
|
|
196
207
|
|
|
197
208
|
使用 commerce CLI 时**必须**设置环境变量:
|
|
198
209
|
```bash
|
|
199
|
-
OPTIMA_ENV=
|
|
210
|
+
OPTIMA_ENV=ci # 必需,指定环境 (ci/stage/prod)
|
|
200
211
|
OPTIMA_TOKEN=$(cat /tmp/optima-test-token-xxx.txt) # 必需,读取 token
|
|
201
212
|
```
|
|
202
213
|
|
|
@@ -212,13 +223,17 @@ OPTIMA_TOKEN=$(cat /tmp/optima-test-token-xxx.txt) # 必需,读取 token
|
|
|
212
223
|
- 系统重启后可能被清理
|
|
213
224
|
- 建议在使用完成后手动删除敏感文件
|
|
214
225
|
|
|
215
|
-
###
|
|
226
|
+
### 支持的环境
|
|
227
|
+
|
|
228
|
+
工具支持三个环境,使用 `--env` 参数指定:
|
|
229
|
+
|
|
230
|
+
| 环境 | Auth API | Commerce API |
|
|
231
|
+
|------|----------|--------------|
|
|
232
|
+
| ci (默认) | `https://auth.optima.chat` | `https://api.optima.chat` |
|
|
233
|
+
| stage | `https://auth.stage.optima.onl` | `https://api.stage.optima.onl` |
|
|
234
|
+
| prod | `https://auth.optima.onl` | `https://api.optima.onl` |
|
|
216
235
|
|
|
217
|
-
|
|
218
|
-
- API 地址:
|
|
219
|
-
- Auth: `https://auth.optima.chat`
|
|
220
|
-
- Commerce: `https://api.optima.chat`
|
|
221
|
-
- **不能用于** production 或 stage 环境
|
|
236
|
+
⚠️ **注意**:Prod 环境创建的账户会出现在生产系统中,请谨慎使用。
|
|
222
237
|
|
|
223
238
|
## 💡 最佳实践
|
|
224
239
|
|
|
@@ -241,8 +256,8 @@ OPTIMA_TOKEN=$(cat "$TOKEN_FILE")
|
|
|
241
256
|
export TOKEN_FILE=/tmp/optima-test-token-1763997011780.txt
|
|
242
257
|
|
|
243
258
|
# 后续使用
|
|
244
|
-
OPTIMA_TOKEN=$(cat $TOKEN_FILE) OPTIMA_ENV=
|
|
245
|
-
OPTIMA_TOKEN=$(cat $TOKEN_FILE) OPTIMA_ENV=
|
|
259
|
+
OPTIMA_TOKEN=$(cat $TOKEN_FILE) OPTIMA_ENV=ci commerce product list
|
|
260
|
+
OPTIMA_TOKEN=$(cat $TOKEN_FILE) OPTIMA_ENV=ci commerce order list
|
|
246
261
|
```
|
|
247
262
|
|
|
248
263
|
### 3. 自定义账户信息(可选)
|
|
@@ -275,7 +290,7 @@ rm /tmp/optima-test-token-*.txt
|
|
|
275
290
|
|
|
276
291
|
**解决方案**:
|
|
277
292
|
- Token 已过期(15分钟),重新生成
|
|
278
|
-
- 环境变量设置错误,检查 `OPTIMA_ENV=
|
|
293
|
+
- 环境变量设置错误,检查 `OPTIMA_ENV=ci`
|
|
279
294
|
- Token 文件路径错误,检查文件是否存在
|
|
280
295
|
|
|
281
296
|
### 问题 2:Merchant profile 未设置
|
|
File without changes
|
|
@@ -203,7 +203,7 @@ optima-query-db commerce-backend "SELECT status, COUNT(*) FROM orders GROUP BY s
|
|
|
203
203
|
| Stage | `optima-stage-postgres.ctg866o0ehac.ap-southeast-1.rds.amazonaws.com` | 15432 |
|
|
204
204
|
| Prod | `optima-prod-postgres.ctg866o0ehac.ap-southeast-1.rds.amazonaws.com` | 15433 |
|
|
205
205
|
|
|
206
|
-
**跳板机**: `
|
|
206
|
+
**跳板机**: `3.0.210.113` (Shared EC2)
|
|
207
207
|
|
|
208
208
|
## 🔗 相关命令
|
|
209
209
|
|
|
File without changes
|
|
File without changes
|
package/LICENSE
CHANGED
|
File without changes
|
package/README.md
CHANGED
|
File without changes
|
|
@@ -24,7 +24,7 @@ interface MerchantSetupResponse {
|
|
|
24
24
|
user_id: string;
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
-
type Environment = '
|
|
27
|
+
type Environment = 'ci' | 'stage' | 'prod';
|
|
28
28
|
|
|
29
29
|
interface EnvironmentConfig {
|
|
30
30
|
authUrl: string;
|
|
@@ -34,17 +34,23 @@ interface EnvironmentConfig {
|
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
const ENV_CONFIG: Record<Environment, EnvironmentConfig> = {
|
|
37
|
-
|
|
37
|
+
ci: {
|
|
38
38
|
authUrl: 'https://auth.optima.chat',
|
|
39
39
|
apiUrl: 'https://api.optima.chat',
|
|
40
40
|
clientId: 'dev-skill-cli-he7fjmsp',
|
|
41
|
-
envName: '
|
|
41
|
+
envName: 'ci'
|
|
42
42
|
},
|
|
43
|
-
|
|
44
|
-
authUrl: 'https://auth.optima.
|
|
45
|
-
apiUrl: 'https://api.optima.
|
|
46
|
-
clientId: '
|
|
47
|
-
envName: '
|
|
43
|
+
stage: {
|
|
44
|
+
authUrl: 'https://auth.stage.optima.onl',
|
|
45
|
+
apiUrl: 'https://api.stage.optima.onl',
|
|
46
|
+
clientId: 'commerce-cli-stage-ihbbwplz',
|
|
47
|
+
envName: 'stage'
|
|
48
|
+
},
|
|
49
|
+
prod: {
|
|
50
|
+
authUrl: 'https://auth.optima.onl',
|
|
51
|
+
apiUrl: 'https://api.optima.onl',
|
|
52
|
+
clientId: 'commerce-cli-ecs-pro-i2r5of1h',
|
|
53
|
+
envName: 'prod'
|
|
48
54
|
}
|
|
49
55
|
};
|
|
50
56
|
|
|
@@ -166,7 +172,7 @@ async function main() {
|
|
|
166
172
|
let businessName = defaultBusinessName;
|
|
167
173
|
let phone: string | undefined;
|
|
168
174
|
let address: string | undefined;
|
|
169
|
-
let environment: Environment = '
|
|
175
|
+
let environment: Environment = 'ci';
|
|
170
176
|
|
|
171
177
|
// 解析命令行参数
|
|
172
178
|
for (let i = 0; i < args.length; i++) {
|
|
@@ -184,15 +190,15 @@ async function main() {
|
|
|
184
190
|
address = args[++i];
|
|
185
191
|
} else if (arg === '--env' && args[i + 1]) {
|
|
186
192
|
const envArg = args[++i];
|
|
187
|
-
if (envArg === '
|
|
193
|
+
if (envArg === 'ci' || envArg === 'stage' || envArg === 'prod') {
|
|
188
194
|
environment = envArg;
|
|
189
195
|
} else {
|
|
190
|
-
console.error(`❌ Invalid environment: ${envArg}. Must be '
|
|
196
|
+
console.error(`❌ Invalid environment: ${envArg}. Must be 'ci', 'stage', or 'prod'.`);
|
|
191
197
|
process.exit(1);
|
|
192
198
|
}
|
|
193
199
|
} else if (arg === '--help' || arg === '-h') {
|
|
194
200
|
console.log(`
|
|
195
|
-
Usage: generate-test-token [options]
|
|
201
|
+
Usage: optima-generate-test-token [options]
|
|
196
202
|
|
|
197
203
|
Options:
|
|
198
204
|
--email <email> User email (default: auto-generated)
|
|
@@ -200,14 +206,19 @@ Options:
|
|
|
200
206
|
--business-name <name> Merchant business name (default: auto-generated)
|
|
201
207
|
--phone <phone> Merchant phone number (optional)
|
|
202
208
|
--address <address> Merchant address (optional)
|
|
203
|
-
--env <environment> Environment:
|
|
209
|
+
--env <environment> Environment: ci (default), stage, or prod
|
|
204
210
|
--help, -h Show this help message
|
|
205
211
|
|
|
212
|
+
Environments:
|
|
213
|
+
ci CI 环境 (auth.optima.chat, api.optima.chat)
|
|
214
|
+
stage Stage 环境 (auth.stage.optima.onl, api.stage.optima.onl)
|
|
215
|
+
prod Prod 环境 (auth.optima.onl, api.optima.onl)
|
|
216
|
+
|
|
206
217
|
Example:
|
|
207
|
-
generate-test-token
|
|
208
|
-
generate-test-token --env
|
|
209
|
-
generate-test-token --
|
|
210
|
-
generate-test-token --
|
|
218
|
+
optima-generate-test-token
|
|
219
|
+
optima-generate-test-token --env stage
|
|
220
|
+
optima-generate-test-token --env prod
|
|
221
|
+
optima-generate-test-token --business-name "My Test Shop" --env stage
|
|
211
222
|
`);
|
|
212
223
|
process.exit(0);
|
|
213
224
|
}
|
package/bin/helpers/query-db.ts
CHANGED
|
@@ -51,8 +51,8 @@ const RDS_HOSTS = {
|
|
|
51
51
|
prod: 'optima-prod-postgres.ctg866o0ehac.ap-southeast-1.rds.amazonaws.com'
|
|
52
52
|
};
|
|
53
53
|
|
|
54
|
-
// 统一使用
|
|
55
|
-
const EC2_HOST = '
|
|
54
|
+
// 统一使用 BI Data ARM Host 作为跳板机
|
|
55
|
+
const EC2_HOST = '3.0.210.113';
|
|
56
56
|
|
|
57
57
|
function getGitHubVariable(name: string): string {
|
|
58
58
|
return execSync(`gh variable get ${name} -R Optima-Chat/optima-dev-skills`, { encoding: 'utf-8' }).trim();
|
|
@@ -38,17 +38,23 @@ const fs = __importStar(require("fs"));
|
|
|
38
38
|
const os = __importStar(require("os"));
|
|
39
39
|
const path = __importStar(require("path"));
|
|
40
40
|
const ENV_CONFIG = {
|
|
41
|
-
|
|
41
|
+
ci: {
|
|
42
42
|
authUrl: 'https://auth.optima.chat',
|
|
43
43
|
apiUrl: 'https://api.optima.chat',
|
|
44
44
|
clientId: 'dev-skill-cli-he7fjmsp',
|
|
45
|
-
envName: '
|
|
45
|
+
envName: 'ci'
|
|
46
46
|
},
|
|
47
|
-
|
|
48
|
-
authUrl: 'https://auth.optima.
|
|
49
|
-
apiUrl: 'https://api.optima.
|
|
50
|
-
clientId: '
|
|
51
|
-
envName: '
|
|
47
|
+
stage: {
|
|
48
|
+
authUrl: 'https://auth.stage.optima.onl',
|
|
49
|
+
apiUrl: 'https://api.stage.optima.onl',
|
|
50
|
+
clientId: 'commerce-cli-stage-ihbbwplz',
|
|
51
|
+
envName: 'stage'
|
|
52
|
+
},
|
|
53
|
+
prod: {
|
|
54
|
+
authUrl: 'https://auth.optima.onl',
|
|
55
|
+
apiUrl: 'https://api.optima.onl',
|
|
56
|
+
clientId: 'commerce-cli-ecs-pro-i2r5of1h',
|
|
57
|
+
envName: 'prod'
|
|
52
58
|
}
|
|
53
59
|
};
|
|
54
60
|
async function httpRequest(url, options = {}) {
|
|
@@ -149,7 +155,7 @@ async function main() {
|
|
|
149
155
|
let businessName = defaultBusinessName;
|
|
150
156
|
let phone;
|
|
151
157
|
let address;
|
|
152
|
-
let environment = '
|
|
158
|
+
let environment = 'ci';
|
|
153
159
|
// 解析命令行参数
|
|
154
160
|
for (let i = 0; i < args.length; i++) {
|
|
155
161
|
const arg = args[i];
|
|
@@ -170,17 +176,17 @@ async function main() {
|
|
|
170
176
|
}
|
|
171
177
|
else if (arg === '--env' && args[i + 1]) {
|
|
172
178
|
const envArg = args[++i];
|
|
173
|
-
if (envArg === '
|
|
179
|
+
if (envArg === 'ci' || envArg === 'stage' || envArg === 'prod') {
|
|
174
180
|
environment = envArg;
|
|
175
181
|
}
|
|
176
182
|
else {
|
|
177
|
-
console.error(`❌ Invalid environment: ${envArg}. Must be '
|
|
183
|
+
console.error(`❌ Invalid environment: ${envArg}. Must be 'ci', 'stage', or 'prod'.`);
|
|
178
184
|
process.exit(1);
|
|
179
185
|
}
|
|
180
186
|
}
|
|
181
187
|
else if (arg === '--help' || arg === '-h') {
|
|
182
188
|
console.log(`
|
|
183
|
-
Usage: generate-test-token [options]
|
|
189
|
+
Usage: optima-generate-test-token [options]
|
|
184
190
|
|
|
185
191
|
Options:
|
|
186
192
|
--email <email> User email (default: auto-generated)
|
|
@@ -188,14 +194,19 @@ Options:
|
|
|
188
194
|
--business-name <name> Merchant business name (default: auto-generated)
|
|
189
195
|
--phone <phone> Merchant phone number (optional)
|
|
190
196
|
--address <address> Merchant address (optional)
|
|
191
|
-
--env <environment> Environment:
|
|
197
|
+
--env <environment> Environment: ci (default), stage, or prod
|
|
192
198
|
--help, -h Show this help message
|
|
193
199
|
|
|
200
|
+
Environments:
|
|
201
|
+
ci CI 环境 (auth.optima.chat, api.optima.chat)
|
|
202
|
+
stage Stage 环境 (auth.stage.optima.onl, api.stage.optima.onl)
|
|
203
|
+
prod Prod 环境 (auth.optima.onl, api.optima.onl)
|
|
204
|
+
|
|
194
205
|
Example:
|
|
195
|
-
generate-test-token
|
|
196
|
-
generate-test-token --env
|
|
197
|
-
generate-test-token --
|
|
198
|
-
generate-test-token --
|
|
206
|
+
optima-generate-test-token
|
|
207
|
+
optima-generate-test-token --env stage
|
|
208
|
+
optima-generate-test-token --env prod
|
|
209
|
+
optima-generate-test-token --business-name "My Test Shop" --env stage
|
|
199
210
|
`);
|
|
200
211
|
process.exit(0);
|
|
201
212
|
}
|
|
@@ -68,8 +68,8 @@ const RDS_HOSTS = {
|
|
|
68
68
|
stage: 'optima-stage-postgres.ctg866o0ehac.ap-southeast-1.rds.amazonaws.com',
|
|
69
69
|
prod: 'optima-prod-postgres.ctg866o0ehac.ap-southeast-1.rds.amazonaws.com'
|
|
70
70
|
};
|
|
71
|
-
// 统一使用
|
|
72
|
-
const EC2_HOST = '
|
|
71
|
+
// 统一使用 BI Data ARM Host 作为跳板机
|
|
72
|
+
const EC2_HOST = '3.0.210.113';
|
|
73
73
|
function getGitHubVariable(name) {
|
|
74
74
|
return (0, child_process_1.execSync)(`gh variable get ${name} -R Optima-Chat/optima-dev-skills`, { encoding: 'utf-8' }).trim();
|
|
75
75
|
}
|
package/package.json
CHANGED
package/tsconfig.json
CHANGED
|
File without changes
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"permissions": {
|
|
3
|
-
"allow": [
|
|
4
|
-
"WebSearch",
|
|
5
|
-
"WebFetch(domain:code.claude.com)",
|
|
6
|
-
"WebFetch(domain:platform.claude.com)",
|
|
7
|
-
"WebFetch(domain:github.com)",
|
|
8
|
-
"Bash(gh repo view:*)",
|
|
9
|
-
"Bash(gh repo clone:*)",
|
|
10
|
-
"Bash(gh repo list:*)",
|
|
11
|
-
"Read(//private/tmp/optima-docs/**)",
|
|
12
|
-
"Read(//tmp/optima-docs/**)",
|
|
13
|
-
"Bash(git init:*)",
|
|
14
|
-
"Bash(gh repo create:*)",
|
|
15
|
-
"Read(//private/tmp/optima-workspace/**)",
|
|
16
|
-
"Read(//tmp/optima-workspace/**)",
|
|
17
|
-
"Read(//tmp/optima-workspace/.claude/commands/**)",
|
|
18
|
-
"Bash(git add:*)",
|
|
19
|
-
"Bash(git push:*)",
|
|
20
|
-
"Bash(find:*)",
|
|
21
|
-
"Bash(git commit:*)",
|
|
22
|
-
"Bash(aws logs get-log-events:*)",
|
|
23
|
-
"Bash(npm install:*)",
|
|
24
|
-
"Bash(optima-dev-skills:*)",
|
|
25
|
-
"Bash(optima-generate-test-token:*)",
|
|
26
|
-
"Bash(optima-query-db:*)",
|
|
27
|
-
"Bash(gh variable set:*)",
|
|
28
|
-
"Bash(npm publish:*)",
|
|
29
|
-
"Bash(python3:*)",
|
|
30
|
-
"Bash(gh api:*)",
|
|
31
|
-
"Bash(curl -s http://auth.optima.chat/openapi.json)",
|
|
32
|
-
"Bash(curl -s https://auth.optima.chat/openapi.json)",
|
|
33
|
-
"Bash(cat:*)",
|
|
34
|
-
"Bash(node /Users/verypro/optima-dev-skills/scripts/install.js:*)",
|
|
35
|
-
"Bash(aws logs tail:*)",
|
|
36
|
-
"Bash(grep:*)"
|
|
37
|
-
],
|
|
38
|
-
"deny": [],
|
|
39
|
-
"ask": []
|
|
40
|
-
}
|
|
41
|
-
}
|