@geek-fun/serverlessinsight 0.8.9 → 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.
Files changed (102) hide show
  1. package/.serverlessinsight/state-cdn-flow-app-cdn-flow-service.json.backup +1 -1
  2. package/.serverlessinsight/state-iam-test-app-iam-test-service.json.backup +2 -2
  3. package/.serverlessinsight/state-insight-poc-app-insight-poc-tencent.json.backup +2 -2
  4. package/.serverlessinsight/state-insight-poc-app-log-insight-poc-tencent-log.json.backup +123 -0
  5. package/.serverlessinsight/state-insight-poc-deploy-app-insight-poc-deploy.json.backup +4 -4
  6. package/.serverlessinsight/state-insight-poc-destroy-app-insight-poc-destroy.json.backup +1 -1
  7. package/.serverlessinsight/state-insight-volc-app-insight-volc.json.backup +2 -2
  8. package/.serverlessinsight/state-insight-volc-nested-app-insight-volc-nested.json.backup +93 -0
  9. package/.serverlessinsight/state-nested-drift-app-nested-drift-service.json.backup +148 -0
  10. package/.serverlessinsight/state-role-reconcile-test-app-role-reconcile-test-service.json.backup +3 -3
  11. package/CHANGELOG.md +29 -0
  12. package/README.md +2 -2
  13. package/README.zh-CN.md +2 -2
  14. package/dist/package.json +2 -2
  15. package/dist/src/commands/deploy.js +12 -4
  16. package/dist/src/commands/destroy.js +8 -2
  17. package/dist/src/commands/forceUnlock.js +5 -5
  18. package/dist/src/commands/index.js +114 -53
  19. package/dist/src/commands/login.js +12 -1
  20. package/dist/src/commands/migrate.js +287 -0
  21. package/dist/src/commands/plan.js +7 -1
  22. package/dist/src/commands/show.js +37 -25
  23. package/dist/src/common/aliyunClient/apigwOperations.js +4 -4
  24. package/dist/src/common/aliyunClient/ecsOperations.js +22 -13
  25. package/dist/src/common/aliyunClient/fc3Operations.js +12 -3
  26. package/dist/src/common/aliyunClient/nasOperations.js +4 -3
  27. package/dist/src/common/aliyunClient/ossOperations.js +52 -8
  28. package/dist/src/common/aliyunClient/slsOperations.js +3 -2
  29. package/dist/src/common/aliyunClient/tablestoreOperations.js +22 -11
  30. package/dist/src/common/apiClient.js +22 -5
  31. package/dist/src/common/context.js +5 -4
  32. package/dist/src/common/lockManager.js +1 -1
  33. package/dist/src/common/migrationMarker.js +34 -0
  34. package/dist/src/common/nameBuilder.js +13 -1
  35. package/dist/src/common/planCompare.js +31 -1
  36. package/dist/src/common/planFormatter.js +69 -54
  37. package/dist/src/common/refreshPlanner.js +31 -8
  38. package/dist/src/common/runtimeMapper.js +7 -3
  39. package/dist/src/common/stateBackend/cosStateBackend.js +1 -1
  40. package/dist/src/common/stateBackend/index.js +5 -2
  41. package/dist/src/common/stateBackend/localStateBackend.js +8 -2
  42. package/dist/src/common/stateBackend/ossStateBackend.js +1 -1
  43. package/dist/src/common/stateBackend/remoteStateBackend.js +19 -2
  44. package/dist/src/common/stateBackend/saasStateBackend.js +83 -5
  45. package/dist/src/common/stateManager.js +56 -5
  46. package/dist/src/common/tencentClient/cosOperations.js +1 -1
  47. package/dist/src/common/tencentClient/scfOperations.js +2 -1
  48. package/dist/src/common/volcengineClient/apigwOperations.js +2 -2
  49. package/dist/src/common/volcengineClient/index.js +6 -2
  50. package/dist/src/common/volcengineClient/vefaasOperations.js +3 -3
  51. package/dist/src/lang/en.js +231 -7
  52. package/dist/src/lang/zh-CN.js +230 -7
  53. package/dist/src/parser/index.js +1 -1
  54. package/dist/src/stack/aliyunStack/apigwExecutor.js +2 -2
  55. package/dist/src/stack/aliyunStack/apigwPlanner.js +26 -5
  56. package/dist/src/stack/aliyunStack/apigwResource.js +22 -10
  57. package/dist/src/stack/aliyunStack/databaseExecutor.js +5 -5
  58. package/dist/src/stack/aliyunStack/databasePlanner.js +8 -3
  59. package/dist/src/stack/aliyunStack/databaseResource.js +28 -12
  60. package/dist/src/stack/aliyunStack/deployer.js +30 -13
  61. package/dist/src/stack/aliyunStack/esServerlessTypes.js +2 -1
  62. package/dist/src/stack/aliyunStack/fc3Executor.js +2 -2
  63. package/dist/src/stack/aliyunStack/fc3Planner.js +46 -25
  64. package/dist/src/stack/aliyunStack/fc3Resource.js +80 -31
  65. package/dist/src/stack/aliyunStack/ossExecutor.js +2 -2
  66. package/dist/src/stack/aliyunStack/ossPlanner.js +6 -1
  67. package/dist/src/stack/aliyunStack/ossResource.js +14 -3
  68. package/dist/src/stack/aliyunStack/rdsTypes.js +5 -1
  69. package/dist/src/stack/aliyunStack/tablestoreExecutor.js +2 -2
  70. package/dist/src/stack/aliyunStack/tablestorePlanner.js +2 -1
  71. package/dist/src/stack/aliyunStack/tablestoreResource.js +5 -4
  72. package/dist/src/stack/aliyunStack/tablestoreTypes.js +3 -2
  73. package/dist/src/stack/deploy.js +12 -7
  74. package/dist/src/stack/localStack/functionRunner.js +5 -4
  75. package/dist/src/stack/scfStack/cosExecutor.js +2 -2
  76. package/dist/src/stack/scfStack/cosPlanner.js +6 -1
  77. package/dist/src/stack/scfStack/cosResource.js +8 -4
  78. package/dist/src/stack/scfStack/deployer.js +21 -6
  79. package/dist/src/stack/scfStack/esServerlessExecutor.js +5 -5
  80. package/dist/src/stack/scfStack/esServerlessPlanner.js +6 -1
  81. package/dist/src/stack/scfStack/esServerlessResource.js +12 -4
  82. package/dist/src/stack/scfStack/esServerlessTypes.js +2 -1
  83. package/dist/src/stack/scfStack/scfExecutor.js +2 -2
  84. package/dist/src/stack/scfStack/scfPlanner.js +26 -27
  85. package/dist/src/stack/scfStack/scfResource.js +38 -13
  86. package/dist/src/stack/scfStack/tdsqlcExecutor.js +5 -5
  87. package/dist/src/stack/scfStack/tdsqlcPlanner.js +6 -1
  88. package/dist/src/stack/scfStack/tdsqlcResource.js +12 -4
  89. package/dist/src/stack/volcengineStack/apigwExecutor.js +2 -2
  90. package/dist/src/stack/volcengineStack/apigwPlanner.js +5 -1
  91. package/dist/src/stack/volcengineStack/apigwResource.js +7 -4
  92. package/dist/src/stack/volcengineStack/deployer.js +15 -4
  93. package/dist/src/stack/volcengineStack/tosExecutor.js +2 -2
  94. package/dist/src/stack/volcengineStack/tosPlanner.js +6 -1
  95. package/dist/src/stack/volcengineStack/tosResource.js +11 -4
  96. package/dist/src/stack/volcengineStack/vefaasExecutor.js +2 -2
  97. package/dist/src/stack/volcengineStack/vefaasPlanner.js +39 -11
  98. package/dist/src/stack/volcengineStack/vefaasResource.js +11 -3
  99. package/dist/src/validator/rootSchema.js +29 -2
  100. package/dist/src/validator/semanticValidation.js +24 -0
  101. package/dist/tsconfig.tsbuildinfo +1 -1
  102. package/package.json +2 -2
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.createSaasStateBackend = void 0;
7
7
  const apiClient_1 = require("../apiClient");
8
8
  const credentialStore_1 = require("../credentialStore");
9
+ const logger_1 = require("../logger");
9
10
  const types_1 = require("../../types");
10
11
  const stateManager_1 = require("../stateManager");
11
12
  const eventQueue_1 = require("../eventQueue");
@@ -19,14 +20,25 @@ const getDefaultState = (provider, app, service) => ({
19
20
  stages: {},
20
21
  resources: {},
21
22
  });
22
- const createSaasStateBackend = (context) => {
23
+ const createSaasStateBackend = (context, options) => {
23
24
  const creds = (0, credentialStore_1.loadCredentials)();
24
- const apiKey = creds?.apiKey;
25
+ const apiKey = options?.apiKey || creds?.apiKey;
25
26
  const consoleUrl = (0, credentialStore_1.getConsoleUrl)();
26
27
  const orgId = creds?.orgId ?? '';
27
28
  if (!apiKey) {
28
29
  throw new Error(lang_1.lang.__('SAAS_BACKEND_NO_CREDENTIALS'));
29
30
  }
31
+ // D-6 fast path: when both the yaml declaration and the stored slug are
32
+ // known, fail before touching the network at all.
33
+ if (context.declaredOrg && creds?.orgSlug && context.declaredOrg !== creds.orgSlug) {
34
+ throw new Error(lang_1.lang.__('SAAS_ORG_MISMATCH', {
35
+ declared: context.declaredOrg,
36
+ actual: creds.orgSlug,
37
+ }));
38
+ }
39
+ if (!context.declaredOrg && creds?.orgName) {
40
+ logger_1.logger.info(lang_1.lang.__('SAAS_ORG_FROM_CREDENTIALS', { orgName: creds.orgName }));
41
+ }
30
42
  const client = (0, apiClient_1.createApiClient)({
31
43
  apiKey,
32
44
  baseUrl: consoleUrl,
@@ -66,11 +78,57 @@ const createSaasStateBackend = (context) => {
66
78
  flushOnExit: true,
67
79
  });
68
80
  };
81
+ /**
82
+ * D-6: resolve the API key's org identity (id + slug). Credentials written
83
+ * before the slug field existed lack it — fetch it from the validate endpoint
84
+ * once, cache it for this backend instance and heal the stored file so later
85
+ * commands check locally. Unresolvable (network / version skew) degrades to
86
+ * skipping the checks: the key still only ever writes to its own org.
87
+ */
88
+ let resolvedIdentity = null;
89
+ const resolveKeyOrgIdentity = async () => {
90
+ if (resolvedIdentity) {
91
+ return resolvedIdentity;
92
+ }
93
+ const local = {
94
+ orgId: creds?.orgId || undefined,
95
+ orgSlug: creds?.orgSlug,
96
+ };
97
+ if (local.orgId && local.orgSlug) {
98
+ resolvedIdentity = local;
99
+ return local;
100
+ }
101
+ try {
102
+ const fetched = await client.get('/api/v1/auth/api-keys/validate');
103
+ if (fetched.orgSlug && creds) {
104
+ (0, credentialStore_1.saveCredentials)({ ...creds, orgSlug: fetched.orgSlug });
105
+ }
106
+ resolvedIdentity = {
107
+ orgId: local.orgId ?? fetched.orgId,
108
+ orgSlug: local.orgSlug ?? fetched.orgSlug,
109
+ };
110
+ }
111
+ catch {
112
+ resolvedIdentity = local;
113
+ }
114
+ return resolvedIdentity;
115
+ };
69
116
  /**
70
117
  * Provision the deployment by calling the unified POST endpoint.
71
118
  * This resolves YAML names to Console UUIDs and caches them.
72
119
  */
73
120
  const provision = async (provider, stage) => {
121
+ // D-6: the org declaration must match the key's org BEFORE provisioning —
122
+ // this POST is what auto-creates app/service, i.e. the wrong-org write.
123
+ if (context.declaredOrg) {
124
+ const { orgSlug } = await resolveKeyOrgIdentity();
125
+ if (orgSlug && orgSlug !== context.declaredOrg) {
126
+ throw new Error(lang_1.lang.__('SAAS_ORG_MISMATCH', {
127
+ declared: context.declaredOrg,
128
+ actual: orgSlug,
129
+ }));
130
+ }
131
+ }
74
132
  const result = await client.post('/api/v1/deployments/', {
75
133
  appName: context.app,
76
134
  serviceName: context.service,
@@ -99,6 +157,20 @@ const createSaasStateBackend = (context) => {
99
157
  try {
100
158
  const state = await client.get(`/api/v1/apps/${resolvedAppId}/services/${resolvedServiceId}/state/current?stage=${encodeURIComponent(stage)}`);
101
159
  const migrated = (0, stateManager_1.migrateState)(state.stateJson);
160
+ // D-6 identity anchor: the state records the org id that owns this
161
+ // service (persisted on every SaaS save / migrate backfill). A mismatch
162
+ // with the current key's org means a wrong key — or an org deleted and
163
+ // recreated under the same slug (name matches, identity does not).
164
+ // Refuse before anything downstream reads or writes this state.
165
+ if (migrated.orgId) {
166
+ const { orgId: keyOrgId } = await resolveKeyOrgIdentity();
167
+ if (keyOrgId && migrated.orgId !== keyOrgId) {
168
+ throw new Error(lang_1.lang.__('SAAS_STATE_ORG_MISMATCH', {
169
+ stateOrgId: migrated.orgId,
170
+ keyOrgId,
171
+ }));
172
+ }
173
+ }
102
174
  // Legacy Console states hold fresh resources only in the top-level
103
175
  // field (pre-stage-syncing saves) — prefer the stage store, fall back.
104
176
  const stageResources = migrated.stages?.[stage]?.resources;
@@ -116,7 +188,13 @@ const createSaasStateBackend = (context) => {
116
188
  serviceId: resolvedServiceId,
117
189
  };
118
190
  }
119
- catch {
191
+ catch (error) {
192
+ // Only a genuine 404 ("no state yet for this service+stage") may start
193
+ // from an empty state. Network/5xx failures must surface — treating
194
+ // them as empty would make the next plan propose full re-creation.
195
+ if (!(error instanceof apiClient_1.ApiError && error.status === 404)) {
196
+ throw error;
197
+ }
120
198
  const defaultState = getDefaultState(provider, app, service);
121
199
  return {
122
200
  ...defaultState,
@@ -191,10 +269,10 @@ const createSaasStateBackend = (context) => {
191
269
  },
192
270
  withLock: async (operation, fn, _options, onLockAcquired) => {
193
271
  if (!currentStage) {
194
- throw new Error('SaaS state backend: call loadState() first to set stage');
272
+ throw new Error(lang_1.lang.__('SAAS_BACKEND_SET_STAGE_FIRST'));
195
273
  }
196
274
  if (!currentDeploymentId) {
197
- throw new Error('SaaS state backend: no deployment available, call loadState() first');
275
+ throw new Error(lang_1.lang.__('SAAS_BACKEND_NO_DEPLOYMENT'));
198
276
  }
199
277
  // Acquire lock via phase:start (server checks for 409 conflicts)
200
278
  await client.patch(`/api/v1/deployments/${currentDeploymentId}`, { phase: 'start' });
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.getRoleArnFromState = exports.removeSharedResource = exports.setSharedResource = exports.getSharedResource = exports.getAllSharedResources = exports.getAllResources = exports.removeResource = exports.setResource = exports.getResource = exports.saveStateWithLock = exports.saveState = exports.loadState = exports.toPersistedState = exports.migrateState = exports.clearStateMigrations = exports.registerStateMigration = exports.ensureStateDir = exports.getStatePath = void 0;
6
+ exports.getRoleArnFromState = exports.removeSharedResource = exports.setSharedResource = exports.getSharedResource = exports.getAllSharedResources = exports.getAllResources = exports.removeResource = exports.setResource = exports.getResource = exports.saveStateWithLock = exports.patchPersistedState = exports.writeStateFileAtomically = exports.saveState = exports.loadState = exports.toPersistedState = exports.migrateState = exports.clearStateMigrations = exports.registerStateMigration = exports.ensureStateDir = exports.getStatePath = void 0;
7
7
  const node_fs_1 = __importDefault(require("node:fs"));
8
8
  const node_path_1 = __importDefault(require("node:path"));
9
9
  const node_crypto_1 = __importDefault(require("node:crypto"));
@@ -147,8 +147,6 @@ exports.loadState = loadState;
147
147
  const saveState = (state, app, service, stage, baseDir = process.cwd()) => {
148
148
  (0, exports.ensureStateDir)(baseDir);
149
149
  const statePath = (0, exports.getStatePath)(app, service, baseDir);
150
- const tmpPath = `${statePath}.tmp`;
151
- const backupPath = `${statePath}.backup`;
152
150
  // Read the existing file to preserve other stages
153
151
  let existing = {
154
152
  version: types_1.CURRENT_STATE_VERSION,
@@ -184,13 +182,23 @@ const saveState = (state, app, service, stage, baseDir = process.cwd()) => {
184
182
  },
185
183
  };
186
184
  // Atomic write: back up the previous state, then write tmp + fsync + rename
185
+ (0, exports.writeStateFileAtomically)(statePath, JSON.stringify(stateToSave, null, 2));
186
+ };
187
+ exports.saveState = saveState;
188
+ /**
189
+ * Back up the previous state file, then write tmp + fsync + rename. Shared by
190
+ * saveState and patchPersistedState.
191
+ */
192
+ const writeStateFileAtomically = (statePath, content) => {
193
+ const tmpPath = `${statePath}.tmp`;
194
+ const backupPath = `${statePath}.backup`;
187
195
  try {
188
196
  if (node_fs_1.default.existsSync(statePath)) {
189
197
  node_fs_1.default.copyFileSync(statePath, backupPath);
190
198
  }
191
199
  const fd = node_fs_1.default.openSync(tmpPath, 'w');
192
200
  try {
193
- node_fs_1.default.writeFileSync(fd, JSON.stringify(stateToSave, null, 2), 'utf-8');
201
+ node_fs_1.default.writeFileSync(fd, content, 'utf-8');
194
202
  node_fs_1.default.fsyncSync(fd);
195
203
  }
196
204
  finally {
@@ -210,7 +218,50 @@ const saveState = (state, app, service, stage, baseDir = process.cwd()) => {
210
218
  throw error;
211
219
  }
212
220
  };
213
- exports.saveState = saveState;
221
+ exports.writeStateFileAtomically = writeStateFileAtomically;
222
+ /**
223
+ * Merge top-level fields into the persisted state file without touching
224
+ * stages/resources. A patch value of `undefined` deletes the key. Written as
225
+ * a new persisted version (serial+1, previous file backed up). Used by
226
+ * `si migrate` for the console-UUID backfill and the migration marker.
227
+ */
228
+ /* istanbul ignore next */
229
+ const patchPersistedState = (app, service, patch, baseDir = process.cwd()) => {
230
+ (0, exports.ensureStateDir)(baseDir);
231
+ const statePath = (0, exports.getStatePath)(app, service, baseDir);
232
+ let existing = {
233
+ version: types_1.CURRENT_STATE_VERSION,
234
+ provider: '',
235
+ app,
236
+ service,
237
+ stages: {},
238
+ };
239
+ try {
240
+ if (node_fs_1.default.existsSync(statePath)) {
241
+ const content = node_fs_1.default.readFileSync(statePath, 'utf-8');
242
+ existing = (0, exports.toPersistedState)(JSON.parse(content));
243
+ }
244
+ }
245
+ catch {
246
+ // use default
247
+ }
248
+ const patched = { ...existing };
249
+ for (const [key, value] of Object.entries(patch)) {
250
+ if (value === undefined) {
251
+ delete patched[key];
252
+ }
253
+ else {
254
+ patched[key] = value;
255
+ }
256
+ }
257
+ const stateToSave = {
258
+ ...patched,
259
+ version: types_1.CURRENT_STATE_VERSION,
260
+ serial: (existing.serial ?? 0) + 1,
261
+ };
262
+ (0, exports.writeStateFileAtomically)(statePath, JSON.stringify(stateToSave, null, 2));
263
+ };
264
+ exports.patchPersistedState = patchPersistedState;
214
265
  /**
215
266
  * Save state with automatic locking.
216
267
  * This should be used by high-level operations like deploy/destroy.
@@ -190,7 +190,7 @@ const createCosOperations = (cosClient, region, dnsOps) => {
190
190
  }
191
191
  catch (error) {
192
192
  logger_1.logger.warn(lang_1.lang.__('COS_DNS_DOMAIN_NOT_MANAGED', { domain, cname: cosEndpoint }));
193
- logger_1.logger.debug(`DNS error: ${error}`);
193
+ logger_1.logger.debug(lang_1.lang.__('DNS_OPERATION_ERROR', { error: String(error) }));
194
194
  return { domain, cname: cosEndpoint, bucketDomainBound };
195
195
  }
196
196
  };
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.createScfOperations = void 0;
4
4
  const polling_1 = require("../polling");
5
5
  const constants_1 = require("../constants");
6
+ const lang_1 = require("../../lang");
6
7
  const createScfOperations = (scfClient, deps) => {
7
8
  const { tag: tagClient, cam: camClient, region, namespace } = deps;
8
9
  const getAccountUin = async () => {
@@ -13,7 +14,7 @@ const createScfOperations = (scfClient, deps) => {
13
14
  const res = await camClient.GetUserAppId(null);
14
15
  const uin = res?.OwnerUin || res?.Uin;
15
16
  if (!uin) {
16
- throw new Error('Failed to resolve Tencent Cloud account Uin for resource tagging');
17
+ throw new Error(lang_1.lang.__('SCF_RESOLVE_UIN_FAILED'));
17
18
  }
18
19
  return uin;
19
20
  };
@@ -175,7 +175,7 @@ const APIGW_POLL_MAX_ATTEMPTS = 120; // up to 20 minutes
175
175
  const reason = info.message
176
176
  ? `: ${info.message}`
177
177
  : ` (status ${info.status}) — check the Volcengine console for the gateway instance`;
178
- throw new Error(`API Gateway ${gatewayId} creation failed${reason}`);
178
+ throw new Error(lang_1.lang.__('VOLC_APIGW_CREATE_FAILED', { gatewayId, reason }));
179
179
  }
180
180
  return info;
181
181
  },
@@ -192,7 +192,7 @@ const APIGW_POLL_MAX_ATTEMPTS = 120; // up to 20 minutes
192
192
  },
193
193
  });
194
194
  if (!gateway) {
195
- throw new Error(`API Gateway ${gatewayId} disappeared while waiting for Running`);
195
+ throw new Error(lang_1.lang.__('VOLC_APIGW_DISAPPEARED', { gatewayId }));
196
196
  }
197
197
  return gateway;
198
198
  },
@@ -16,6 +16,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  exports.createVolcengineClient = void 0;
18
18
  const openapi_1 = require("@volcengine/openapi");
19
+ const lang_1 = require("../../lang");
19
20
  const tls_1 = require("@volcengine/openapi/lib/services/tls");
20
21
  const vefaasOperations_1 = require("./vefaasOperations");
21
22
  const tosOperations_1 = require("./tosOperations");
@@ -41,8 +42,11 @@ const wrapService = (service) => {
41
42
  if (apiError?.Code) {
42
43
  const requestId = response?.ResponseMetadata?.RequestId;
43
44
  const action = params.Action || '';
44
- const error = new Error(`Volcengine ${action} failed: ${apiError.Code}: ${apiError.Message ?? ''}` +
45
- (requestId ? ` (RequestId: ${requestId})` : ''));
45
+ const error = new Error(lang_1.lang.__('VOLC_API_FAILED', {
46
+ service: action,
47
+ code: apiError.Code,
48
+ message: apiError.Message ?? '',
49
+ }) + (requestId ? lang_1.lang.__('VOLC_API_REQUEST_ID', { requestId }) : ''));
46
50
  error.code = apiError.Code;
47
51
  error.requestId = requestId;
48
52
  error.action = action;
@@ -210,7 +210,7 @@ const createVefaasOperations = (client) => {
210
210
  },
211
211
  });
212
212
  if (releaseStatus === 'failed') {
213
- throw new Error(`veFaaS function ${functionId} release failed`);
213
+ throw new Error(lang_1.lang.__('VEFAAS_RELEASE_FAILED', { functionId }));
214
214
  }
215
215
  return releaseRecordId;
216
216
  },
@@ -226,7 +226,7 @@ const createVefaasOperations = (client) => {
226
226
  }
227
227
  catch (e) {
228
228
  if (e instanceof polling_1.PollingTimeoutError) {
229
- throw new Error(`Timed out waiting for veFaaS function ${functionId} to be deleted`, {
229
+ throw new Error(lang_1.lang.__('VEFAAS_TIMEOUT_DELETED', { functionId }), {
230
230
  cause: e,
231
231
  });
232
232
  }
@@ -313,7 +313,7 @@ const createVefaasOperations = (client) => {
313
313
  const result = (response.Result || {});
314
314
  const functionId = result.Id ?? result.FunctionId;
315
315
  if (!functionId) {
316
- throw new Error(`CreateFunction did not return a function Id for ${config.functionName}`);
316
+ throw new Error(lang_1.lang.__('VEFAAS_CREATE_NO_ID', { functionName: config.functionName }));
317
317
  }
318
318
  const releaseRecordId = await operations.releaseFunction(functionId);
319
319
  logger_1.logger.info(lang_1.lang.__('FUNCTION_CREATED', { functionName: config.functionName }));
@@ -109,17 +109,29 @@ exports.en = {
109
109
  PLAN_WILL_CREATE: 'will be created',
110
110
  PLAN_WILL_UPDATE: 'will be updated in-place',
111
111
  PLAN_WILL_DESTROY: 'will be destroyed',
112
- PLAN_WILL_REFRESH: 'will be refreshed',
112
+ PLAN_WILL_RECREATE: 'will be recreated',
113
113
  PLAN_NO_CHANGES: 'no changes',
114
114
  PLAN_HEADER: 'ServerlessInsight will perform the following actions:',
115
- PLAN_LEGEND_CREATE: ' + create',
116
- PLAN_LEGEND_UPDATE: ' ~ update in-place',
117
- PLAN_LEGEND_DESTROY: ' - destroy',
118
- PLAN_SUMMARY: 'Plan: {{createCount}} to add, {{updateCount}} to change, {{deleteCount}} to destroy.',
115
+ PLAN_SUMMARY: 'Plan: {{addCount}} add, {{modifyCount}} modify, {{removeCount}} remove, {{recreateCount}} recreate, {{unchangedCount}} unchanged.',
119
116
  PLAN_UNCHANGED_ATTRS: '({{count}} unchanged attributes hidden)',
120
117
  PLAN_COMPUTED_VALUE: '(known after deploy)',
118
+ PLAN_REVERT_ANNOTATION: '(changed in the cloud, will be restored to config)',
121
119
  PLAN_DRIFTED_MARKER: '(drifted — cloud changed outside of this config, will be reconciled)',
122
- PLAN_DRIFTED_SUMMARY: 'Drift: {{driftedCount}} resource(s) changed in the cloud outside of this config.',
120
+ PLAN_LIVE_READ_FAILED: 'Failed to read live state for {{logicalId}}; planning a create instead: {{error}}',
121
+ PLAN_DRIFT_ROLE_MISSING: 'IAM role missing in the cloud',
122
+ PLAN_DRIFT_ROLE_POLICY: 'IAM role policy changed in the cloud',
123
+ PLAN_DRIFT_LOGSTORE: 'function log resources changed in the cloud',
124
+ PLAN_DRIFT_SG_RULES: 'security group rules changed in the cloud',
125
+ PLAN_DRIFT_NAS_MOUNT: 'NAS mount target deleted in the cloud',
126
+ PLAN_DRIFT_TLS_TOPIC: 'log topic configuration changed in the cloud',
127
+ PLAN_DRIFT_CLS_TOPIC: 'log topic configuration changed in the cloud',
128
+ PLAN_DRIFT_TRIGGERS: 'API triggers changed in the cloud',
129
+ RESOURCE_EXISTS_NOT_OWNED: '{{resourceType}} {{resourceName}} already exists in provider but is not owned by this stack (missing {{tagKey}} tag). Refusing to create — resolve manually.',
130
+ RESOURCE_EXISTS_NOT_OWNED_ADOPT: '{{resourceType}} {{resourceName}} already exists in provider but is not owned by this stack (missing {{tagKey}} tag). Refusing to adopt — resolve manually.',
131
+ TABLESTORE_EXISTS_UNVERIFIABLE: 'Table {{tableName}} already exists in provider but ownership cannot be verified (Tablestore does not support table-level tags). Refusing to adopt — resolve manually.',
132
+ TABLESTORE_EXISTS_UNVERIFIABLE_PROBE: 'Table {{tableName}} already exists in provider but ownership cannot be verified (no table-level tags). Refusing to adopt — resolve manually.',
133
+ TAINTED_RECOVERY_SKIP_CREATE: '{{resourceType}} {{resourceName}} already exists in provider (tainted recovery), skipping create and refreshing state',
134
+ OWNERSHIP_VERIFYING: '{{resourceType}} {{resourceName}} already exists in provider, verifying ownership tag before adopting',
123
135
  // TDSQL-C database messages
124
136
  TDSQL_CLUSTER_CREATION_INITIATED: 'TDSQL-C cluster creation initiated',
125
137
  TDSQL_CLUSTER_CREATION_FAILED: 'Failed to create TDSQL-C cluster',
@@ -314,7 +326,10 @@ exports.en = {
314
326
  'After DNS CNAME is configured, register {{domain}} in OSS console: ' +
315
327
  'https://oss.console.aliyun.com/bucket/oss-{{region}}/{{bucket}}/domain/cname',
316
328
  OSS_BUCKET_CNAME_BOUND: 'Bound custom domain to bucket: {{domain}}',
317
- OSS_BUCKET_CNAME_EXISTS: 'Custom domain already bound to bucket: {{domain}}',
329
+ OSS_BUCKET_CNAME_EXISTS: 'Custom domain already bound to bucket (verified via ListCname): {{domain}}',
330
+ OSS_BUCKET_CNAME_CONFLICT: 'Failed to bind custom domain {{domain}} to bucket {{bucketName}}: the domain is already ' +
331
+ 'bound to another bucket or used as an image-processing domain ({{error}}). ' +
332
+ 'Remove the conflicting binding before retrying.',
318
333
  OSS_BUCKET_CNAME_UNBOUND: 'Unbound custom domain from bucket: {{domain}}',
319
334
  OSS_BUCKET_CNAME_BIND_FAILED: 'Failed to bind bucket CNAME: {{error}}',
320
335
  OSS_BUCKET_CNAME_UNBIND_FAILED: 'Failed to unbind bucket CNAME: {{error}}',
@@ -426,6 +441,8 @@ exports.en = {
426
441
  // Pre-deploy semantic validation (issue #222)
427
442
  PARSE_BACKEND_BUCKET_STORE_FIELDS_REQUIRED: 'Backend type BUCKET_STORE requires both "bucket" and "key" fields',
428
443
  SEMANTIC_DUPLICATE_TRIGGER: 'Duplicate trigger in event "{{eventKey}}": {{method}} {{path}} is defined more than once',
444
+ SEMANTIC_CONTAINER_CODE_CONFLICT: 'Function "{{fnKey}}" cannot define both "container" and "code" — they are mutually exclusive sources',
445
+ SEMANTIC_FUNCTION_SOURCE_REQUIRED: 'Function "{{fnKey}}" must define either "code" or "container"',
429
446
  SEMANTIC_DUPLICATE_GENERATED_API_NAME: 'Generated API Gateway apiName "{{apiName}}" collides between "{{firstPath}}" and "{{secondPath}}" in this deployment; shorten the event name or differentiate trigger method/path',
430
447
  SEMANTIC_DUPLICATE_ROUTE_NAME: 'Generated API Gateway route name "{{routeName}}" collides between "{{firstPath}}" and "{{secondPath}}" in this deployment; shorten the event name or differentiate trigger method/path',
431
448
  SEMANTIC_UNRESOLVED_FUNCTION_BACKEND: 'Trigger backend "{{reference}}" in event "{{eventKey}}" does not match any function definition in the configuration',
@@ -793,12 +810,55 @@ exports.en = {
793
810
  SAAS_BACKEND_LOCK_CHECK: 'Checking deployment lock status...',
794
811
  SAAS_BACKEND_NO_CREDENTIALS: 'SaaS state requires Console login.\nRun `si login`, or:\n- Set SI_API_KEY environment variable\n- Use --si-api-key flag\n- Configure a local or bucket backend in serverlessinsight.yml',
795
812
  SAAS_BACKEND_CONSOLE_UNREACHABLE: 'Unable to reach Console. Deploy requires Console connectivity.',
813
+ SAAS_ORG_MISMATCH: 'The org "{{declared}}" declared in your YAML does not match the org "{{actual}}" of the current API key.\nVerify your credentials (run `si login` again) or fix the org declaration in the YAML. Nothing was written.',
814
+ SAAS_ORG_FROM_CREDENTIALS: 'Target org: {{orgName}} (from credentials; declare a top-level `org` in the YAML to pin it explicitly)',
815
+ SAAS_STATE_ORG_MISMATCH: 'The org recorded in state ({{stateOrgId}}) does not match the org of the current credentials ({{keyOrgId}}) — either the wrong API key is in use, or the organization was deleted and recreated under the same name.\nVerify your credentials (`si login`) or the organization state before retrying; nothing was written.',
796
816
  // API error messages
797
817
  API_ERROR_401: 'API key is invalid or expired. Run `si login` to update.',
798
818
  API_ERROR_403: 'Access forbidden. Contact your administrator.',
819
+ API_ERROR_404: 'Not found. If you expected existing state, check the app/service/stage names.',
799
820
  API_ERROR_409: 'State conflict: {{message}}',
800
821
  API_ERROR_NETWORK: 'Network error: {{message}}. Check your connection.',
801
822
  API_ERROR_UNKNOWN: 'API error ({{status}}): {{message}}',
823
+ // ===== `si migrate` — legacy state → Console (docs/state-migration-saas.md) =====
824
+ CMD_MIGRATE_DESC: 'Migrate a local/bucket state to the Console (one-time; run AFTER upgrading every writer CLI)',
825
+ OPT_FORCE: 'Import as a new version even when the target stage already has Console state',
826
+ OPT_NO_MARKER: 'Skip writing the migration marker into the legacy state (NOT recommended: the legacy path stays writable until cutover)',
827
+ OPT_DRY_RUN: 'Show the migration mapping and impact without writing anything',
828
+ OPT_ROLLBACK: 'Clear the migration marker from the legacy state (explicit undo)',
829
+ MIGRATE_NO_BACKEND_SOURCE: 'No legacy state to migrate: this stack has no backend.state_manager block (it already uses the Console by default), or it is explicitly SAAS.',
830
+ MIGRATE_NEED_CREDENTIALS: 'Console credentials required. Run `si login` first, or pass --si-api-key.',
831
+ MIGRATE_PREFLIGHT_OK: 'Console identity OK: org {{orgName}} ({{orgId}})',
832
+ MIGRATE_WRITER_CONFIRMATION: 'Have ALL writers already upgraded to this CLI version (every CI image and teammate machine)? The marker is invisible to older CLIs. Confirm to continue (y/N)',
833
+ MIGRATE_CONFIRMATION: 'Proceed with the migration above? (y/N)',
834
+ MIGRATE_DRY_RUN_NOTICE: 'Dry run — nothing was written (no Console upload, no marker).',
835
+ MIGRATE_TARGETS_HEADER: 'Migration targets (org: {{orgName}}) — existing targets are mapped by name, the rest will be auto-created:',
836
+ MIGRATE_TARGET_APP_EXISTS: ' app "{{app}}" → exists, mapped by name ({{appId}})',
837
+ MIGRATE_TARGET_APP_CREATE: ' app "{{app}}" → will be auto-created',
838
+ MIGRATE_TARGET_SERVICE_EXISTS: ' service "{{service}}" → exists, mapped by name ({{serviceId}}, provider {{provider}})',
839
+ MIGRATE_TARGET_SERVICE_CREATE: ' service "{{service}}" → will be auto-created (provider {{provider}})',
840
+ MIGRATE_TARGET_STAGE_NEW: ' stage {{stage}}: {{count}} resource(s) → stage will be registered, import as v1',
841
+ MIGRATE_TARGET_STAGE_EMPTY: ' stage {{stage}}: {{count}} resource(s) → import as v1',
842
+ MIGRATE_TARGET_STAGE_EXISTS: ' stage {{stage}}: {{count}} resource(s) → Console already has v{{version}}; --force imports as a new version, otherwise this stage fails',
843
+ MIGRATE_TARGETS_HINT: 'Targets are matched by name. To control the destination (members, naming, …), pre-create the app/service in the Console first — si migrate maps onto them instead of creating new ones.',
844
+ MIGRATE_PROVIDER_MISMATCH_TARGET: 'Service "{{service}}" already exists with provider "{{existingProvider}}", but the YAML declares "{{ymlProvider}}" — importing {{ymlProvider}} state into it is not supported.',
845
+ MIGRATE_NOTHING_TO_MIGRATE: 'The legacy state has no deployed resources to migrate.',
846
+ MIGRATE_STAGE_NOT_FOUND: 'Stage "{{stage}}" does not exist in the legacy state.',
847
+ MIGRATE_PROVIDER_MISMATCH: 'Provider mismatch: state says "{{stateProvider}}" but YAML says "{{ymlProvider}}".',
848
+ MIGRATE_ALREADY_MARKED: 'Legacy state already carries the migration marker — continuing (re-upload is idempotent).',
849
+ MIGRATE_UPLOADING: 'Uploading stage {{stage}} to Console...',
850
+ MIGRATE_UPLOADED: ' ✓ stage {{stage}} → version {{version}}{{deduped}} (app {{appId}}, service {{serviceId}})',
851
+ MIGRATE_UPLOADED_DEDUPLICATED: ' (unchanged, deduplicated)',
852
+ MIGRATE_VERIFY_FAILED: 'Read-back verification FAILED for stage {{stage}} — the migration marker was NOT written. Compare the Console state version with your legacy state, then re-run `si migrate`.',
853
+ MIGRATE_CONFLICT: 'The target stage already has Console state. Re-run with --force to adopt it as a new imported version (history is kept).',
854
+ MIGRATE_MARKER_WRITTEN: 'Migration marker written: the legacy state is now read-only (managedBy=saas).',
855
+ MIGRATE_MARKER_SKIPPED: 'WARNING: --no-marker was set. The legacy backend stays writable until cutover — complete the YAML cutover immediately.',
856
+ MIGRATE_ROLLBACK_NO_MARKER: 'No migration marker found on the legacy state — nothing to roll back.',
857
+ MIGRATE_ROLLBACK_DONE: 'Migration marker cleared. The legacy backend is writable again.',
858
+ MIGRATE_ROLLBACK_DONE_HINT: 'If you already removed the backend.state_manager block from your YAML, restore it before deploying via the legacy backend.',
859
+ MIGRATE_CUTOVER_STEPS: 'Cutover checklist:\n 1. Remove the backend.state_manager block from serverlessinsight.yml, add a top-level org declaration (org: <slug> — see your org settings in Console), and merge\n 2. Run `si plan` — it MUST report no changes (that is the proof of a lossless migration)\n 3. Resume deploys; the Console now owns the deployment timeline',
860
+ MIGRATION_MARKER_REFUSED: 'This state has been migrated to the ServerlessInsight Console (managedBy=saas) and the legacy backend is closed for changes.\n • To continue with the Console: remove the backend.state_manager block from your YAML, declare a top-level org: <slug>, then deploy again.\n • To deliberately use the legacy backend: run `si migrate --rollback` to clear the marker.',
861
+ MIGRATION_MARKER_WARN: 'This state has been migrated to the Console (managedBy=saas) — the copy shown here is read-only and may be stale. Do not deploy from this backend.',
802
862
  // HTTP trigger messages
803
863
  HTTP_TRIGGER_AUTH_TYPE_REQUIRED: "HTTP trigger '{{functionName}}' requires 'auth_type' (public or iam)",
804
864
  CREATING_HTTP_TRIGGER: "Creating HTTP trigger '{{triggerName}}' for function '{{functionName}}'...",
@@ -816,4 +876,168 @@ exports.en = {
816
876
  EVENT_FLUSH_FAILED: 'Failed to flush deployment events for {{deploymentId}} ({{count}} events): {{error}}',
817
877
  EVENT_REPLAY_FAILED: 'Failed to replay event queue file {{file}}: {{error}}',
818
878
  INVALID_HTTP_TRIGGER_AUTH_TYPE: "Invalid HTTP trigger auth_type '{{authType}}'; must be 'public' or 'iam'",
879
+ // ===== Issue #251: previously hardcoded messages (now i18n) =====
880
+ UNSUPPORTED_PROVIDER: 'Unsupported provider: {{provider}}',
881
+ FORCE_UNLOCK_NO_LOCATION_MODE: 'Not supported in no-location mode',
882
+ SHOW_LOADING_STATE: 'Loading state for app: {{app}}, service: {{service}}, stage: {{stage}}...',
883
+ SHOW_SAAS_BACKEND_FALLBACK: 'SaaS backend unavailable: {{error}}. Using local state.',
884
+ SHOW_REMOTE_BACKEND_FALLBACK: 'Failed to load state from remote backend: {{error}}. Using local state.',
885
+ SHOW_NO_RESOURCES: 'No resources found in state.',
886
+ SHOW_STATE_LOCATION: 'State location: {{stateLocation}}',
887
+ SHOW_BACKEND_REMOTE: 'Backend: Remote',
888
+ SHOW_DEPLOY_HINT: 'To deploy resources, run: si deploy',
889
+ SHOW_HEADER_DEPLOYED: 'DEPLOYED RESOURCES',
890
+ SHOW_CATEGORY_HEADER: '📦 {{label}}',
891
+ SHOW_HEADER_SUMMARY: 'SUMMARY',
892
+ SHOW_SUMMARY_PROVIDER: ' Provider: {{value}}',
893
+ SHOW_SUMMARY_APP: ' App: {{value}}',
894
+ SHOW_SUMMARY_SERVICE: ' Service: {{value}}',
895
+ SHOW_SUMMARY_STAGE: ' Stage: {{value}}',
896
+ SHOW_SUMMARY_RESOURCES: ' Resources: {{value}}',
897
+ SHOW_SUMMARY_LAST_UPDATED: ' Last Updated: {{value}}',
898
+ SHOW_LOCKED_BY: 'Lock Status: LOCKED by {{user}}',
899
+ SHOW_UNLOCKED: 'Lock Status: UNLOCKED',
900
+ APIGW_CHECKING_DNS_STATUS: 'Checking DNS record status...',
901
+ APIGW_GROUP_CREATE_NO_ID: 'Failed to create API Gateway group: no groupId returned',
902
+ APIGW_API_CREATE_NO_ID: 'Failed to create API: no apiId returned',
903
+ APIGW_GROUP_NO_SUBDOMAIN: 'API group {{groupName}} has no subDomain — cannot configure domain binding',
904
+ SG_INVALID_RULE_FORMAT: 'Invalid security group rule format: {{rule}}',
905
+ SG_CREATE_FAILED: 'Failed to create security group',
906
+ SG_SKIP_INVALID_INGRESS: 'Skipping invalid ingress rule: {{rule}}. {{error}}',
907
+ SG_INGRESS_ALREADY_EXISTS: 'Ingress rule already exists, skipping: {{rule}}',
908
+ SG_ADD_INGRESS_FAILED: 'Failed to add ingress rule: {{rule}}. {{error}}',
909
+ SG_SKIP_INVALID_EGRESS: 'Skipping invalid egress rule: {{rule}}. {{error}}',
910
+ SG_EGRESS_ALREADY_EXISTS: 'Egress rule already exists, skipping: {{rule}}',
911
+ SG_ADD_EGRESS_FAILED: 'Failed to add egress rule: {{rule}}. {{error}}',
912
+ SG_AUTHORIZE_RULE_FAILED: 'Failed to authorize {{ruleType}} rule for {{target}}: {{error}}',
913
+ SG_REVOKE_RULE_FAILED: 'Failed to revoke {{ruleType}} rule for {{target}}: {{error}}',
914
+ SG_GET_INGRESS_FAILED: 'Failed to get ingress rules: {{error}}',
915
+ SG_GET_EGRESS_FAILED: 'Failed to get egress rules: {{error}}',
916
+ FC3_FUNCTION_FAILED_STATE: 'FC3 function {{functionName}} is in Failed state (reason: {{reason}})',
917
+ FC3_TIMEOUT_ACTIVE: 'Timed out waiting for FC3 function {{functionName}} to become Active',
918
+ FC3_TIMEOUT_DELETED: 'Timed out waiting for FC3 function {{functionName}} to be deleted',
919
+ NAS_CREATE_FS_FAILED: 'Failed to create NAS file system',
920
+ NAS_CREATE_MOUNT_TARGET_FAILED: 'Failed to create NAS mount target',
921
+ NAS_LIST_MOUNT_TARGETS_FAILED: 'Failed to list mount targets: {{error}}',
922
+ DNS_OPERATION_ERROR: 'DNS error: {{error}}',
923
+ SLS_WAITING_PROJECT: 'Waiting for SLS project {{projectName}} to be ready (current status: {{status}})',
924
+ SLS_WAITING_LOGSTORE: 'Waiting for SLS logstore {{projectName}}/{{logstoreName}} to be ready...',
925
+ OTS_WAITING_TABLE: 'Waiting for table {{tableName}} to be ready... (attempt {{attempt}}/{{maxAttempts}})',
926
+ OTS_TABLE_READY: 'Table {{tableName}} is ready',
927
+ OTS_TABLE_TIMEOUT: 'Timeout waiting for table {{tableName}} to be ready',
928
+ OTS_CREATE_TABLE_FAILED: 'Failed to create table {{tableName}}: {{error}}',
929
+ OTS_TABLE_CREATED: 'Successfully created table {{tableName}}',
930
+ OTS_DESCRIBE_TABLE_FAILED: 'Failed to describe table {{tableName}}: {{error}}',
931
+ OTS_UPDATE_TABLE_FAILED: 'Failed to update table {{tableName}}: {{error}}',
932
+ OTS_TABLE_UPDATED: 'Successfully updated table {{tableName}}',
933
+ OTS_TABLE_ALREADY_DELETED: 'Table {{tableName}} already deleted or does not exist',
934
+ OTS_DELETE_TABLE_FAILED: 'Failed to delete table {{tableName}}: {{error}}',
935
+ OTS_TABLE_DELETED: 'Successfully deleted table {{tableName}}',
936
+ CONTEXT_NO_IAC_FILE: 'No IaC file found. Tried: {{attemptedList}}',
937
+ CONTEXT_NOT_FOUND: 'No context found',
938
+ CONTEXT_IAC_REQUIRES_CONTEXT: 'Context must be set before setting IAC',
939
+ RUNTIME_UNSUPPORTED_STANDARD: 'Unsupported standard runtime: {{standardRuntime}}',
940
+ SAAS_BACKEND_SET_STAGE_FIRST: 'SaaS state backend: call loadState() first to set stage',
941
+ SAAS_BACKEND_NO_DEPLOYMENT: 'SaaS state backend: no deployment available, call loadState() first',
942
+ SCF_RESOLVE_UIN_FAILED: 'Failed to resolve Tencent Cloud account Uin for resource tagging',
943
+ VOLC_APIGW_CREATE_FAILED: 'API Gateway {{gatewayId}} creation failed{{reason}}',
944
+ VOLC_APIGW_DISAPPEARED: 'API Gateway {{gatewayId}} disappeared while waiting for Running',
945
+ VEFAAS_RELEASE_FAILED: 'veFaaS function {{functionId}} release failed',
946
+ VEFAAS_TIMEOUT_DELETED: 'Timed out waiting for veFaaS function {{functionId}} to be deleted',
947
+ VEFAAS_CREATE_NO_ID: 'CreateFunction did not return a function Id for {{functionName}}',
948
+ IAC_FILE_NOT_FOUND: 'File does not exist at path: {{path}}',
949
+ RESOURCE_EVENT_NOT_FOUND: 'Event not found for logical ID: {{logicalId}}',
950
+ APIGW_GROUP_OWNED_REUSE: 'API group {{groupName}} found and owned by this stack, reusing',
951
+ APIGW_GROUP_ADOPT_REFUSED: 'API group {{groupName}} already exists but is not owned by this stack (missing {{tag}} tag). Refusing to adopt — resolve manually.',
952
+ APIGW_GROUP_CONFLICT_ADOPT: 'API group {{groupName}} exists after create conflict and carries ownership tag ({{tag}}), adopting idempotently',
953
+ APIGW_GROUP_INFO_AFTER_CREATE_FAILED: 'Failed to get API group info after creation: {{error}}',
954
+ APIGW_GROUP_NO_SUBDOMAIN_CDN: 'API Gateway group {{groupName}} has no subDomain for CDN origin',
955
+ APIGW_GROUP_INFO_AFTER_UPDATE_FAILED: 'Failed to get API group info after update: {{error}}',
956
+ APIGW_DOMAIN_UNCHANGED_SKIP: 'Domain configuration unchanged and previously bound, skipping DNS verification',
957
+ RESOURCE_DATABASE_NOT_FOUND: 'Database not found for logical ID: {{logicalId}}',
958
+ EXECUTOR_STATE_NOT_FOUND: 'State not found for {{logicalId}}',
959
+ RESOURCE_INSTANCE_ID_NOT_FOUND: 'Instance ID not found in state for {{logicalId}}',
960
+ DATABASE_TYPE_UNSUPPORTED: 'Unsupported database type: {{type}}',
961
+ RESOURCE_OWNERSHIP_TAG_ADOPT: '{{resourceType}}ES app {{name}} exists and carries ownership tag ({{tag}}), adopting idempotently',
962
+ REFRESH_STATE_ES_APP: 'Failed to refresh state for ES app: {{appId}}',
963
+ REFRESH_STATE_RDS_INSTANCE: 'Failed to refresh state for RDS instance: {{instanceId}}',
964
+ RESOURCE_TYPE_UNSUPPORTED: 'Unsupported resource type: {{type}}',
965
+ ES_DB_TYPE_VERSION_UNSUPPORTED: 'Unsupported ES database type/version: {{type}}-{{version}}',
966
+ RESOURCE_FUNCTION_NOT_FOUND: 'Function not found for logical ID: {{logicalId}}',
967
+ FC3_UPLOADING_CODE: 'Code package {{zipPath}} is {{size}}MB, uploading to OSS bucket {{bucketName}}',
968
+ FC3_HTTP_TRIGGER_DEPENDENT_CLEANUP: "HTTP trigger '{{triggerName}}' should be deleted before reaching dependent resource cleanup",
969
+ FC3_CREATE_RECOVERABLE_RECONCILE: 'Create function returned recoverable error for {{functionName}}, reconciling with provider state: {{error}}',
970
+ FC3_FAILED_AFTER_CREATE: 'FC3 function {{functionName}} is in Failed state after create (reason: {{reason}})',
971
+ FC3_FOUND_AFTER_CREATE_RECONCILE: 'Function {{functionName}} found after create error reconciliation, continuing deployment flow',
972
+ FC3_FOUND_AFTER_DELAYED_RECONCILE: 'Function {{functionName}} found after delayed reconciliation, continuing deployment flow',
973
+ REFRESH_STATE_FUNCTION: 'Failed to refresh state for function: {{name}}',
974
+ RESOURCE_BUCKET_NOT_FOUND: 'Bucket not found for logical ID: {{logicalId}}',
975
+ RDS_DB_TYPE_VERSION_UNSUPPORTED: 'Unsupported RDS database type/version: {{type}}-{{version}}',
976
+ RESOURCE_TABLE_NOT_FOUND: 'Table not found for logical ID: {{logicalId}}',
977
+ REFRESH_STATE_TABLE: 'Failed to refresh state for table: {{tableName}}',
978
+ OTS_TABLE_MISSING_SKIP_DELETE: 'Table {{tableName}} in instance {{instanceId}} not found in provider, skipping deletion',
979
+ OTS_TABLE_TYPE_UNSUPPORTED: 'Unsupported table type: {{type}}',
980
+ OTS_ATTRIBUTE_NOT_FOUND: 'Attribute not found for key: {{key}}',
981
+ LOCAL_HANDLER_NOT_FOUND: 'Handler "{{handlerMethod}}" not found or is not a function in {{handlerPath}}',
982
+ LOCAL_EXECUTION_TIMEOUT: 'Function execution timed out after {{timeoutMs}}ms',
983
+ LOCAL_PORT_CLOSED: 'Port closed before receiving response',
984
+ LOCAL_WORKER_EXITED: 'Worker stopped with exit code {{code}}',
985
+ REFRESH_STATE_BUCKET: 'Failed to refresh state for bucket: {{name}}',
986
+ RESOURCE_SPACE_ID_NOT_FOUND: 'Space ID not found in state for {{logicalId}}',
987
+ REFRESH_STATE_ES_SPACE: 'Failed to refresh state for ES space: {{spaceId}}',
988
+ SCF_HTTP_TRIGGER_ALREADY_ATTACHED: 'HTTP trigger {{triggerName}} already attached to {{functionName}}, skipping creation',
989
+ SCF_HTTP_TRIGGER_ALREADY_EXISTS: 'HTTP trigger {{triggerName}} already exists on {{functionName}}, continuing: {{error}}',
990
+ SCF_HANDLER_IMMUTABLE: 'Handler is immutable in Tencent SCF and cannot be changed on update ({{oldHandler}} -> {{newHandler}}). Delete and recreate the function instead.',
991
+ SCF_RUNTIME_IMMUTABLE: 'Runtime is immutable in Tencent SCF and cannot be changed on update ({{oldRuntime}} -> {{newRuntime}}). Delete and recreate the function instead.',
992
+ RESOURCE_CLUSTER_ID_NOT_FOUND: 'Cluster ID not found in state for {{logicalId}}',
993
+ REFRESH_STATE_CLUSTER: 'Failed to refresh state for cluster: {{clusterId}}',
994
+ VOLC_BACKEND_FUNCTION_ID_UNRESOLVED: 'Cannot resolve veFaaS function Id for backend {{backend}} (functions.{{functionKey}} has no functionId in state). Deploy the function first.',
995
+ VOLC_APIGW_NETWORK_REQUIRED: 'events.{{eventKey}}: network (vpc_id + subnet_ids) is required to create the API Gateway instance — add it to the event config',
996
+ VOLC_APIGW_ADOPT_REFUSED: 'API Gateway {{gatewayName}} already exists but is not owned by this stack (missing {{tag}} tag). Refusing to adopt — resolve manually.',
997
+ VOLC_APIGW_CREATE_OR_REUSE_FAILED: 'Failed to create or reuse an API Gateway instance',
998
+ VOLC_EXTERNAL_ROLE_SKIP_DELETE: 'Skipping deletion of external IAM role: {{roleName}} (managed externally)',
999
+ CONFIRMATION_STDIN_NOT_TTY: 'Interactive confirmation required but stdin is not a TTY. Use --auto-approve (-y) to skip confirmation in non-interactive environments.',
1000
+ RUNTIME_NOT_SUPPORTED_FOR_PROVIDER: 'Runtime {{runtime}} is not supported for provider {{provider}}. Supported providers for this runtime: {{supportedProviders}}',
1001
+ VOLC_API_FAILED: 'Volcengine {{service}} failed: {{code}}: {{message}}',
1002
+ VOLC_API_REQUEST_ID: ' (RequestId: {{requestId}})',
1003
+ HUAWEI_DEPLOY_NOT_IMPLEMENTED: 'Huawei deployment is not yet implemented. The provider currently generates HCL templates but does not deploy them. Please use Aliyun or Tencent providers, or contribute Huawei deployment support.',
1004
+ CONTEXT_REGION_DEPRECATED: 'Warning: ROS_REGION_ID environment variable is deprecated. Please use SI_REGION instead.',
1005
+ SHOW_CAT_FUNCTIONS: 'Functions',
1006
+ SHOW_CAT_API_GATEWAY: 'API Gateway',
1007
+ SHOW_CAT_STORAGE: 'Storage',
1008
+ SHOW_CAT_DATABASES: 'Databases',
1009
+ SHOW_CAT_DNS: 'DNS Records',
1010
+ SHOW_CAT_OTHER: 'Other Resources',
1011
+ SHOW_TIME_JUST_NOW: 'just now',
1012
+ SHOW_TIME_DAYS_AGO: '{{count}} day(s) ago',
1013
+ SHOW_TIME_HOURS_AGO: '{{count}} hour(s) ago',
1014
+ SHOW_TIME_MINUTES_AGO: '{{count}} minute(s) ago',
1015
+ // ===== Issue #251: CLI help text (commander) =====
1016
+ CMD_ROOT_DESC: 'CLI for ServerlessInsight',
1017
+ CMD_LOGIN_DESC: 'authenticate with ServerlessInsight Console',
1018
+ CMD_LOGOUT_DESC: 'revoke API key and clear local credentials',
1019
+ CMD_WHOAMI_DESC: 'show current login status',
1020
+ CMD_SHOW_DESC: 'show deployed resources from state',
1021
+ CMD_VALIDATE_DESC: 'validate serverless Iac yaml',
1022
+ CMD_PLAN_DESC: 'generate and show deployment plan',
1023
+ CMD_DIFF_DESC: 'show changes between your config and the live cloud (alias of plan)',
1024
+ CMD_DEPLOY_DESC: 'deploy serverless Iac yaml',
1025
+ CMD_DESTROY_DESC: 'destroy serverless stack',
1026
+ CMD_LOCAL_DESC: 'run Serverless application locally for debugging',
1027
+ CMD_FORCE_UNLOCK_DESC: 'manually remove a stuck lock (use with caution)',
1028
+ OPT_SI_API_KEY_EXISTING: 'authenticate with an existing API key',
1029
+ OPT_FILE: 'specify the yaml file',
1030
+ OPT_FILE_REMOTE_REQUIRED: 'specify the yaml file (required for remote backends)',
1031
+ OPT_STAGE: 'specify the stage',
1032
+ OPT_REGION: 'specify the region',
1033
+ OPT_PROVIDER: 'specify the provider',
1034
+ OPT_ACCESS_KEY_ID: 'specify the AccessKeyId',
1035
+ OPT_ACCESS_KEY_SECRET: 'specify the AccessKeySecret',
1036
+ OPT_SECURITY_TOKEN: 'specify the SecurityToken',
1037
+ OPT_NO_REFRESH: 'skip live cloud probing; diff config against state only (no drift detection)',
1038
+ OPT_SI_API_KEY: 'ServerlessInsight API key (overrides SI_API_KEY env)',
1039
+ OPT_AUTO_APPROVE: 'skip interactive approval of plan before deploying',
1040
+ OPT_PARAMETER: 'override parameters',
1041
+ OPT_DEBUG: 'enable debug mode',
1042
+ OPT_WATCH: 'enable file watch',
819
1043
  };