@optima-chat/dev-skills 0.9.0 → 0.9.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.
|
@@ -64,15 +64,16 @@ export function assertAwsEmailOnly(env: string, kind: 'email' | 'phone' | 'userI
|
|
|
64
64
|
}
|
|
65
65
|
}
|
|
66
66
|
|
|
67
|
-
//
|
|
68
|
-
//
|
|
69
|
-
//
|
|
67
|
+
// All envs use canonical plan ids (no market suffix). billing canonicalized
|
|
68
|
+
// plan ids — dropped the `-cn` suffix; market is now carried by deployment-level
|
|
69
|
+
// BILLING_MARKET + the plan's `currency` column, not the id (optima-billing#181).
|
|
70
|
+
// cn envs additionally have the CN-only `free` tier. Per-env whitelist guards
|
|
71
|
+
// against granting a plan absent in that env.
|
|
70
72
|
const PLANS_BY_ENV: Record<string, string[]> = {
|
|
71
73
|
stage: ['trial', 'starter', 'pro', 'enterprise'],
|
|
72
74
|
prod: ['trial', 'starter', 'pro', 'enterprise'],
|
|
73
|
-
'cn-prod': ['trial', 'starter
|
|
74
|
-
|
|
75
|
-
'cn-stage': ['trial', 'starter-cn', 'pro-cn', 'enterprise-cn'],
|
|
75
|
+
'cn-prod': ['trial', 'starter', 'pro', 'enterprise', 'free'],
|
|
76
|
+
'cn-stage': ['trial', 'starter', 'pro', 'enterprise', 'free'],
|
|
76
77
|
};
|
|
77
78
|
|
|
78
79
|
function parseArgs(args: string[]): { identifier: string; plan: string; months: number; env: string } {
|
|
@@ -81,7 +82,8 @@ function parseArgs(args: string[]): { identifier: string; plan: string; months:
|
|
|
81
82
|
|
|
82
83
|
Options:
|
|
83
84
|
--plan <id> Plan: trial, starter, pro, enterprise (default: pro)
|
|
84
|
-
cn-prod/cn-stage
|
|
85
|
+
cn-prod/cn-stage additionally allow: free
|
|
86
|
+
(legacy *-cn ids are accepted and normalized to canonical)
|
|
85
87
|
--months <n> Duration in months (default: 1)
|
|
86
88
|
--env <env> Environment: stage, prod, cn-prod, cn-stage (default: stage)
|
|
87
89
|
-h, --help Show this help`);
|
|
@@ -100,7 +102,10 @@ Options:
|
|
|
100
102
|
}
|
|
101
103
|
|
|
102
104
|
validateEnvCnProd(env);
|
|
103
|
-
|
|
105
|
+
// billing canonicalized plan ids (dropped the -cn suffix, optima-billing#181).
|
|
106
|
+
// Default to canonical `pro`; accept legacy `*-cn` input (operator muscle
|
|
107
|
+
// memory) and normalize so it still resolves after the -cn rows are deleted.
|
|
108
|
+
plan = (plan ?? 'pro').replace(/-cn$/, '');
|
|
104
109
|
const allowed = PLANS_BY_ENV[env];
|
|
105
110
|
if (!allowed.includes(plan)) {
|
|
106
111
|
console.error(`Unknown plan for ${env}: ${plan}. Available: ${allowed.join(', ')}`);
|
|
@@ -59,15 +59,16 @@ function assertAwsEmailOnly(env, kind) {
|
|
|
59
59
|
throw new Error('stage/prod 仅支持 email 标识;手机号/userId 解析仅 cn-prod / cn-stage 可用');
|
|
60
60
|
}
|
|
61
61
|
}
|
|
62
|
-
//
|
|
63
|
-
//
|
|
64
|
-
//
|
|
62
|
+
// All envs use canonical plan ids (no market suffix). billing canonicalized
|
|
63
|
+
// plan ids — dropped the `-cn` suffix; market is now carried by deployment-level
|
|
64
|
+
// BILLING_MARKET + the plan's `currency` column, not the id (optima-billing#181).
|
|
65
|
+
// cn envs additionally have the CN-only `free` tier. Per-env whitelist guards
|
|
66
|
+
// against granting a plan absent in that env.
|
|
65
67
|
const PLANS_BY_ENV = {
|
|
66
68
|
stage: ['trial', 'starter', 'pro', 'enterprise'],
|
|
67
69
|
prod: ['trial', 'starter', 'pro', 'enterprise'],
|
|
68
|
-
'cn-prod': ['trial', 'starter
|
|
69
|
-
|
|
70
|
-
'cn-stage': ['trial', 'starter-cn', 'pro-cn', 'enterprise-cn'],
|
|
70
|
+
'cn-prod': ['trial', 'starter', 'pro', 'enterprise', 'free'],
|
|
71
|
+
'cn-stage': ['trial', 'starter', 'pro', 'enterprise', 'free'],
|
|
71
72
|
};
|
|
72
73
|
function parseArgs(args) {
|
|
73
74
|
if (args.length === 0 || args[0] === '--help' || args[0] === '-h') {
|
|
@@ -75,7 +76,8 @@ function parseArgs(args) {
|
|
|
75
76
|
|
|
76
77
|
Options:
|
|
77
78
|
--plan <id> Plan: trial, starter, pro, enterprise (default: pro)
|
|
78
|
-
cn-prod/cn-stage
|
|
79
|
+
cn-prod/cn-stage additionally allow: free
|
|
80
|
+
(legacy *-cn ids are accepted and normalized to canonical)
|
|
79
81
|
--months <n> Duration in months (default: 1)
|
|
80
82
|
--env <env> Environment: stage, prod, cn-prod, cn-stage (default: stage)
|
|
81
83
|
-h, --help Show this help`);
|
|
@@ -97,7 +99,10 @@ Options:
|
|
|
97
99
|
}
|
|
98
100
|
}
|
|
99
101
|
(0, billing_http_1.validateEnvCnProd)(env);
|
|
100
|
-
|
|
102
|
+
// billing canonicalized plan ids (dropped the -cn suffix, optima-billing#181).
|
|
103
|
+
// Default to canonical `pro`; accept legacy `*-cn` input (operator muscle
|
|
104
|
+
// memory) and normalize so it still resolves after the -cn rows are deleted.
|
|
105
|
+
plan = (plan ?? 'pro').replace(/-cn$/, '');
|
|
101
106
|
const allowed = PLANS_BY_ENV[env];
|
|
102
107
|
if (!allowed.includes(plan)) {
|
|
103
108
|
console.error(`Unknown plan for ${env}: ${plan}. Available: ${allowed.join(', ')}`);
|