@optima-chat/dev-skills 0.7.40 → 0.7.41
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/bin/helpers/billing-http.ts +4 -2
- package/bin/helpers/generate-test-token.ts +17 -8
- package/bin/helpers/verify-health.ts +9 -8
- package/dist/bin/helpers/billing-http.js +4 -2
- package/dist/bin/helpers/discount.js +0 -0
- package/dist/bin/helpers/entitlement.js +0 -0
- package/dist/bin/helpers/generate-test-token.js +15 -6
- package/dist/bin/helpers/grant-balance.js +0 -0
- package/dist/bin/helpers/grant-subscription.js +0 -0
- package/dist/bin/helpers/plugin.js +0 -0
- package/dist/bin/helpers/product.js +0 -0
- package/dist/bin/helpers/query-db.js +0 -0
- package/dist/bin/helpers/show-env.js +0 -0
- package/dist/bin/helpers/verify-health.js +9 -8
- package/package.json +1 -1
|
@@ -5,13 +5,15 @@ import { getInfisicalConfig, getInfisicalToken } from './db-utils';
|
|
|
5
5
|
const USER_AUTH_URLS: Record<string, string> = {
|
|
6
6
|
stage: 'https://auth.stage.optima.onl',
|
|
7
7
|
prod: 'https://auth.optima.onl',
|
|
8
|
-
|
|
8
|
+
// #201: yzsgo.com 全量迁移 (2026-06-12), 旧 auth-cn.optima.chat 路由已下线
|
|
9
|
+
'cn-prod': 'https://auth.yzsgo.com',
|
|
9
10
|
};
|
|
10
11
|
|
|
11
12
|
// cn-prod URLs are hardcoded: cn Infisical (secrets-cn.optima.chat) is a
|
|
12
13
|
// separate instance dev-skills has no machine identity for, and these domains
|
|
13
14
|
// are stable. AWS envs keep reading /shared-secrets/domain-urls.
|
|
14
|
-
|
|
15
|
+
// #201: yzsgo.com 全量迁移 (2026-06-12), 旧 billing-cn.optima.chat 路由已下线
|
|
16
|
+
const CN_PROD_BILLING_URL = 'https://billing-api.yzsgo.com';
|
|
15
17
|
|
|
16
18
|
/**
|
|
17
19
|
* Validate the --env flag value at command entry, before any I/O.
|
|
@@ -24,7 +24,7 @@ interface MerchantSetupResponse {
|
|
|
24
24
|
user_id: string;
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
-
type Environment = 'ci' | 'stage' | 'prod';
|
|
27
|
+
type Environment = 'ci' | 'stage' | 'prod' | 'cn-prod';
|
|
28
28
|
|
|
29
29
|
interface EnvironmentConfig {
|
|
30
30
|
authUrl: string;
|
|
@@ -51,6 +51,13 @@ const ENV_CONFIG: Record<Environment, EnvironmentConfig> = {
|
|
|
51
51
|
apiUrl: 'https://api.optima.onl',
|
|
52
52
|
clientId: 'commerce-cli-ecs-pro-i2r5of1h',
|
|
53
53
|
envName: 'prod'
|
|
54
|
+
},
|
|
55
|
+
'cn-prod': {
|
|
56
|
+
// #201: yzsgo.com 全量迁移 (2026-06-12), 旧 *-cn.optima.chat 路由已下线
|
|
57
|
+
authUrl: 'https://auth.yzsgo.com',
|
|
58
|
+
apiUrl: 'https://commerce.yzsgo.com',
|
|
59
|
+
clientId: 'commerce-cli-cn-prod',
|
|
60
|
+
envName: 'cn-prod'
|
|
54
61
|
}
|
|
55
62
|
};
|
|
56
63
|
|
|
@@ -190,10 +197,10 @@ async function main() {
|
|
|
190
197
|
address = args[++i];
|
|
191
198
|
} else if (arg === '--env' && args[i + 1]) {
|
|
192
199
|
const envArg = args[++i];
|
|
193
|
-
if (envArg === 'ci' || envArg === 'stage' || envArg === 'prod') {
|
|
194
|
-
environment = envArg;
|
|
200
|
+
if (envArg === 'ci' || envArg === 'stage' || envArg === 'prod' || envArg === 'cn-prod') {
|
|
201
|
+
environment = envArg as Environment;
|
|
195
202
|
} else {
|
|
196
|
-
console.error(`❌ Invalid environment: ${envArg}. Must be 'ci', 'stage', or 'prod'.`);
|
|
203
|
+
console.error(`❌ Invalid environment: ${envArg}. Must be 'ci', 'stage', 'prod', or 'cn-prod'.`);
|
|
197
204
|
process.exit(1);
|
|
198
205
|
}
|
|
199
206
|
} else if (arg === '--help' || arg === '-h') {
|
|
@@ -206,18 +213,20 @@ Options:
|
|
|
206
213
|
--business-name <name> Merchant business name (default: auto-generated)
|
|
207
214
|
--phone <phone> Merchant phone number (optional)
|
|
208
215
|
--address <address> Merchant address (optional)
|
|
209
|
-
--env <environment> Environment: ci (default), stage, or prod
|
|
216
|
+
--env <environment> Environment: ci (default), stage, prod, or cn-prod
|
|
210
217
|
--help, -h Show this help message
|
|
211
218
|
|
|
212
219
|
Environments:
|
|
213
|
-
ci
|
|
214
|
-
stage
|
|
215
|
-
prod
|
|
220
|
+
ci CI 环境 (auth.optima.chat, api.optima.chat)
|
|
221
|
+
stage Stage 环境 (auth.stage.optima.onl, api.stage.optima.onl)
|
|
222
|
+
prod Prod 环境 (auth.optima.onl, api.optima.onl)
|
|
223
|
+
cn-prod 阿里云生产环境 (auth.yzsgo.com, commerce.yzsgo.com) [#201]
|
|
216
224
|
|
|
217
225
|
Example:
|
|
218
226
|
optima-generate-test-token
|
|
219
227
|
optima-generate-test-token --env stage
|
|
220
228
|
optima-generate-test-token --env prod
|
|
229
|
+
optima-generate-test-token --env cn-prod
|
|
221
230
|
optima-generate-test-token --business-name "My Test Shop" --env stage
|
|
222
231
|
`);
|
|
223
232
|
process.exit(0);
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
* optima-verify-health user-auth --env prod # 环境 stage|prod|cn|all
|
|
21
21
|
* optima-verify-health --all --env all # stage/prod/cn 三环境矩阵
|
|
22
22
|
* optima-verify-health gateway-core --expect-commit a1b2c3d
|
|
23
|
-
* optima-verify-health --url https://auth
|
|
23
|
+
* optima-verify-health --url https://auth.yzsgo.com/health
|
|
24
24
|
* optima-verify-health --all --json # 机器可读,接 CI
|
|
25
25
|
* optima-verify-health --all --strict # warn 也算不通过
|
|
26
26
|
* 退出码:fail → 非 0;warn 默认放行(0),--strict 让 warn 也非 0。
|
|
@@ -33,15 +33,16 @@ type Env = 'stage' | 'prod' | 'cn';
|
|
|
33
33
|
interface SvcCfg { path: string; stage?: string; prod?: string; cn?: string; cn_path?: string; }
|
|
34
34
|
|
|
35
35
|
// 服务 × 环境 FQDN 表。某服务某环境没部署 → 该 env 键缺省,探时跳过。
|
|
36
|
-
// cn-prod 真实 subdomain 抄自 optima-terraform
|
|
36
|
+
// cn-prod 真实 subdomain 抄自 optima-terraform alicloud/stacks/cn-prod-ingress-sae/main.tf。
|
|
37
|
+
// #201 (2026-06-12): yzsgo.com 全量迁移完成,旧 *-cn.optima.chat 路由已下线。
|
|
37
38
|
const SERVICES: Record<string, SvcCfg> = {
|
|
38
|
-
'user-auth': { path: '/health', stage: 'auth-stage.optima.onl', prod: 'auth.optima.onl', cn: 'auth
|
|
39
|
-
'agentic-chat': { path: '/api/health', stage: 'ai-stage.optima.onl', prod: 'ai.optima.onl', cn: '
|
|
40
|
-
'commerce-backend': { path: '/health', stage: 'api-stage.optima.onl', prod: 'api.optima.onl', cn: '
|
|
39
|
+
'user-auth': { path: '/health', stage: 'auth-stage.optima.onl', prod: 'auth.optima.onl', cn: 'auth.yzsgo.com' },
|
|
40
|
+
'agentic-chat': { path: '/api/health', stage: 'ai-stage.optima.onl', prod: 'ai.optima.onl', cn: 'app.yzsgo.com' },
|
|
41
|
+
'commerce-backend': { path: '/health', stage: 'api-stage.optima.onl', prod: 'api.optima.onl', cn: 'commerce.yzsgo.com', cn_path: '/health/live' },
|
|
41
42
|
'mcp-host': { path: '/health', stage: 'mcp-stage.optima.onl', prod: 'mcp.optima.onl' },
|
|
42
|
-
'gateway-core': { path: '/health', cn: 'gw
|
|
43
|
-
'optima-scout': { path: '/health', cn: 'scout
|
|
44
|
-
'optima-skills': { path: '/health', cn: 'skills
|
|
43
|
+
'gateway-core': { path: '/health', cn: 'gw.yzsgo.com' },
|
|
44
|
+
'optima-scout': { path: '/health', cn: 'scout.yzsgo.com' },
|
|
45
|
+
'optima-skills': { path: '/health', cn: 'skills.yzsgo.com' },
|
|
45
46
|
};
|
|
46
47
|
const ENVS: Env[] = ['stage', 'prod', 'cn'];
|
|
47
48
|
|
|
@@ -12,12 +12,14 @@ const db_utils_1 = require("./db-utils");
|
|
|
12
12
|
const USER_AUTH_URLS = {
|
|
13
13
|
stage: 'https://auth.stage.optima.onl',
|
|
14
14
|
prod: 'https://auth.optima.onl',
|
|
15
|
-
|
|
15
|
+
// #201: yzsgo.com 全量迁移 (2026-06-12), 旧 auth-cn.optima.chat 路由已下线
|
|
16
|
+
'cn-prod': 'https://auth.yzsgo.com',
|
|
16
17
|
};
|
|
17
18
|
// cn-prod URLs are hardcoded: cn Infisical (secrets-cn.optima.chat) is a
|
|
18
19
|
// separate instance dev-skills has no machine identity for, and these domains
|
|
19
20
|
// are stable. AWS envs keep reading /shared-secrets/domain-urls.
|
|
20
|
-
|
|
21
|
+
// #201: yzsgo.com 全量迁移 (2026-06-12), 旧 billing-cn.optima.chat 路由已下线
|
|
22
|
+
const CN_PROD_BILLING_URL = 'https://billing-api.yzsgo.com';
|
|
21
23
|
/**
|
|
22
24
|
* Validate the --env flag value at command entry, before any I/O.
|
|
23
25
|
*
|
|
File without changes
|
|
File without changes
|
|
@@ -55,6 +55,13 @@ const ENV_CONFIG = {
|
|
|
55
55
|
apiUrl: 'https://api.optima.onl',
|
|
56
56
|
clientId: 'commerce-cli-ecs-pro-i2r5of1h',
|
|
57
57
|
envName: 'prod'
|
|
58
|
+
},
|
|
59
|
+
'cn-prod': {
|
|
60
|
+
// #201: yzsgo.com 全量迁移 (2026-06-12), 旧 *-cn.optima.chat 路由已下线
|
|
61
|
+
authUrl: 'https://auth.yzsgo.com',
|
|
62
|
+
apiUrl: 'https://commerce.yzsgo.com',
|
|
63
|
+
clientId: 'commerce-cli-cn-prod',
|
|
64
|
+
envName: 'cn-prod'
|
|
58
65
|
}
|
|
59
66
|
};
|
|
60
67
|
async function httpRequest(url, options = {}) {
|
|
@@ -176,11 +183,11 @@ async function main() {
|
|
|
176
183
|
}
|
|
177
184
|
else if (arg === '--env' && args[i + 1]) {
|
|
178
185
|
const envArg = args[++i];
|
|
179
|
-
if (envArg === 'ci' || envArg === 'stage' || envArg === 'prod') {
|
|
186
|
+
if (envArg === 'ci' || envArg === 'stage' || envArg === 'prod' || envArg === 'cn-prod') {
|
|
180
187
|
environment = envArg;
|
|
181
188
|
}
|
|
182
189
|
else {
|
|
183
|
-
console.error(`❌ Invalid environment: ${envArg}. Must be 'ci', 'stage', or 'prod'.`);
|
|
190
|
+
console.error(`❌ Invalid environment: ${envArg}. Must be 'ci', 'stage', 'prod', or 'cn-prod'.`);
|
|
184
191
|
process.exit(1);
|
|
185
192
|
}
|
|
186
193
|
}
|
|
@@ -194,18 +201,20 @@ Options:
|
|
|
194
201
|
--business-name <name> Merchant business name (default: auto-generated)
|
|
195
202
|
--phone <phone> Merchant phone number (optional)
|
|
196
203
|
--address <address> Merchant address (optional)
|
|
197
|
-
--env <environment> Environment: ci (default), stage, or prod
|
|
204
|
+
--env <environment> Environment: ci (default), stage, prod, or cn-prod
|
|
198
205
|
--help, -h Show this help message
|
|
199
206
|
|
|
200
207
|
Environments:
|
|
201
|
-
ci
|
|
202
|
-
stage
|
|
203
|
-
prod
|
|
208
|
+
ci CI 环境 (auth.optima.chat, api.optima.chat)
|
|
209
|
+
stage Stage 环境 (auth.stage.optima.onl, api.stage.optima.onl)
|
|
210
|
+
prod Prod 环境 (auth.optima.onl, api.optima.onl)
|
|
211
|
+
cn-prod 阿里云生产环境 (auth.yzsgo.com, commerce.yzsgo.com) [#201]
|
|
204
212
|
|
|
205
213
|
Example:
|
|
206
214
|
optima-generate-test-token
|
|
207
215
|
optima-generate-test-token --env stage
|
|
208
216
|
optima-generate-test-token --env prod
|
|
217
|
+
optima-generate-test-token --env cn-prod
|
|
209
218
|
optima-generate-test-token --business-name "My Test Shop" --env stage
|
|
210
219
|
`);
|
|
211
220
|
process.exit(0);
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -55,7 +55,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
55
55
|
* optima-verify-health user-auth --env prod # 环境 stage|prod|cn|all
|
|
56
56
|
* optima-verify-health --all --env all # stage/prod/cn 三环境矩阵
|
|
57
57
|
* optima-verify-health gateway-core --expect-commit a1b2c3d
|
|
58
|
-
* optima-verify-health --url https://auth
|
|
58
|
+
* optima-verify-health --url https://auth.yzsgo.com/health
|
|
59
59
|
* optima-verify-health --all --json # 机器可读,接 CI
|
|
60
60
|
* optima-verify-health --all --strict # warn 也算不通过
|
|
61
61
|
* 退出码:fail → 非 0;warn 默认放行(0),--strict 让 warn 也非 0。
|
|
@@ -64,15 +64,16 @@ const node_dns_1 = require("node:dns");
|
|
|
64
64
|
const tls = __importStar(require("node:tls"));
|
|
65
65
|
const https = __importStar(require("node:https"));
|
|
66
66
|
// 服务 × 环境 FQDN 表。某服务某环境没部署 → 该 env 键缺省,探时跳过。
|
|
67
|
-
// cn-prod 真实 subdomain 抄自 optima-terraform
|
|
67
|
+
// cn-prod 真实 subdomain 抄自 optima-terraform alicloud/stacks/cn-prod-ingress-sae/main.tf。
|
|
68
|
+
// #201 (2026-06-12): yzsgo.com 全量迁移完成,旧 *-cn.optima.chat 路由已下线。
|
|
68
69
|
const SERVICES = {
|
|
69
|
-
'user-auth': { path: '/health', stage: 'auth-stage.optima.onl', prod: 'auth.optima.onl', cn: 'auth
|
|
70
|
-
'agentic-chat': { path: '/api/health', stage: 'ai-stage.optima.onl', prod: 'ai.optima.onl', cn: '
|
|
71
|
-
'commerce-backend': { path: '/health', stage: 'api-stage.optima.onl', prod: 'api.optima.onl', cn: '
|
|
70
|
+
'user-auth': { path: '/health', stage: 'auth-stage.optima.onl', prod: 'auth.optima.onl', cn: 'auth.yzsgo.com' },
|
|
71
|
+
'agentic-chat': { path: '/api/health', stage: 'ai-stage.optima.onl', prod: 'ai.optima.onl', cn: 'app.yzsgo.com' },
|
|
72
|
+
'commerce-backend': { path: '/health', stage: 'api-stage.optima.onl', prod: 'api.optima.onl', cn: 'commerce.yzsgo.com', cn_path: '/health/live' },
|
|
72
73
|
'mcp-host': { path: '/health', stage: 'mcp-stage.optima.onl', prod: 'mcp.optima.onl' },
|
|
73
|
-
'gateway-core': { path: '/health', cn: 'gw
|
|
74
|
-
'optima-scout': { path: '/health', cn: 'scout
|
|
75
|
-
'optima-skills': { path: '/health', cn: 'skills
|
|
74
|
+
'gateway-core': { path: '/health', cn: 'gw.yzsgo.com' },
|
|
75
|
+
'optima-scout': { path: '/health', cn: 'scout.yzsgo.com' },
|
|
76
|
+
'optima-skills': { path: '/health', cn: 'skills.yzsgo.com' },
|
|
76
77
|
};
|
|
77
78
|
const ENVS = ['stage', 'prod', 'cn'];
|
|
78
79
|
const G = '\x1b[32m', R = '\x1b[31m', Y = '\x1b[33m', B = '\x1b[34m', N = '\x1b[0m';
|