@geek-fun/serverlessinsight 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.
Files changed (82) 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 +3 -3
  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 +3 -3
  9. package/.serverlessinsight/state-nested-drift-app-nested-drift-service.json.backup +2 -2
  10. package/.serverlessinsight/state-role-reconcile-test-app-role-reconcile-test-service.json.backup +3 -3
  11. package/README.md +2 -2
  12. package/README.zh-CN.md +2 -2
  13. package/dist/package.json +2 -2
  14. package/dist/src/commands/deploy.js +9 -3
  15. package/dist/src/commands/destroy.js +8 -2
  16. package/dist/src/commands/forceUnlock.js +5 -5
  17. package/dist/src/commands/index.js +98 -62
  18. package/dist/src/commands/login.js +12 -1
  19. package/dist/src/commands/migrate.js +287 -0
  20. package/dist/src/commands/plan.js +7 -1
  21. package/dist/src/commands/show.js +37 -25
  22. package/dist/src/common/aliyunClient/apigwOperations.js +4 -4
  23. package/dist/src/common/aliyunClient/ecsOperations.js +22 -13
  24. package/dist/src/common/aliyunClient/fc3Operations.js +7 -3
  25. package/dist/src/common/aliyunClient/nasOperations.js +4 -3
  26. package/dist/src/common/aliyunClient/ossOperations.js +52 -8
  27. package/dist/src/common/aliyunClient/slsOperations.js +3 -2
  28. package/dist/src/common/aliyunClient/tablestoreOperations.js +22 -11
  29. package/dist/src/common/apiClient.js +22 -5
  30. package/dist/src/common/context.js +5 -4
  31. package/dist/src/common/lockManager.js +1 -1
  32. package/dist/src/common/migrationMarker.js +34 -0
  33. package/dist/src/common/runtimeMapper.js +7 -3
  34. package/dist/src/common/stateBackend/cosStateBackend.js +1 -1
  35. package/dist/src/common/stateBackend/index.js +5 -2
  36. package/dist/src/common/stateBackend/localStateBackend.js +8 -2
  37. package/dist/src/common/stateBackend/ossStateBackend.js +1 -1
  38. package/dist/src/common/stateBackend/remoteStateBackend.js +19 -2
  39. package/dist/src/common/stateBackend/saasStateBackend.js +83 -5
  40. package/dist/src/common/stateManager.js +56 -5
  41. package/dist/src/common/tencentClient/cosOperations.js +1 -1
  42. package/dist/src/common/tencentClient/scfOperations.js +2 -1
  43. package/dist/src/common/volcengineClient/apigwOperations.js +2 -2
  44. package/dist/src/common/volcengineClient/index.js +6 -2
  45. package/dist/src/common/volcengineClient/vefaasOperations.js +3 -3
  46. package/dist/src/lang/en.js +211 -1
  47. package/dist/src/lang/zh-CN.js +210 -1
  48. package/dist/src/parser/index.js +1 -1
  49. package/dist/src/stack/aliyunStack/apigwExecutor.js +2 -2
  50. package/dist/src/stack/aliyunStack/apigwResource.js +22 -10
  51. package/dist/src/stack/aliyunStack/databaseExecutor.js +5 -5
  52. package/dist/src/stack/aliyunStack/databasePlanner.js +2 -2
  53. package/dist/src/stack/aliyunStack/databaseResource.js +18 -10
  54. package/dist/src/stack/aliyunStack/esServerlessTypes.js +2 -1
  55. package/dist/src/stack/aliyunStack/fc3Executor.js +2 -2
  56. package/dist/src/stack/aliyunStack/fc3Resource.js +31 -11
  57. package/dist/src/stack/aliyunStack/ossExecutor.js +2 -2
  58. package/dist/src/stack/aliyunStack/ossResource.js +5 -1
  59. package/dist/src/stack/aliyunStack/rdsTypes.js +5 -1
  60. package/dist/src/stack/aliyunStack/tablestoreExecutor.js +2 -2
  61. package/dist/src/stack/aliyunStack/tablestoreResource.js +3 -3
  62. package/dist/src/stack/aliyunStack/tablestoreTypes.js +3 -2
  63. package/dist/src/stack/deploy.js +2 -3
  64. package/dist/src/stack/localStack/functionRunner.js +5 -4
  65. package/dist/src/stack/scfStack/cosExecutor.js +2 -2
  66. package/dist/src/stack/scfStack/cosResource.js +2 -2
  67. package/dist/src/stack/scfStack/esServerlessExecutor.js +5 -5
  68. package/dist/src/stack/scfStack/esServerlessResource.js +7 -3
  69. package/dist/src/stack/scfStack/esServerlessTypes.js +2 -1
  70. package/dist/src/stack/scfStack/scfExecutor.js +2 -2
  71. package/dist/src/stack/scfStack/scfResource.js +32 -11
  72. package/dist/src/stack/scfStack/tdsqlcExecutor.js +5 -5
  73. package/dist/src/stack/scfStack/tdsqlcResource.js +7 -3
  74. package/dist/src/stack/volcengineStack/apigwExecutor.js +2 -2
  75. package/dist/src/stack/volcengineStack/apigwResource.js +7 -4
  76. package/dist/src/stack/volcengineStack/tosExecutor.js +2 -2
  77. package/dist/src/stack/volcengineStack/tosResource.js +1 -1
  78. package/dist/src/stack/volcengineStack/vefaasExecutor.js +2 -2
  79. package/dist/src/stack/volcengineStack/vefaasResource.js +6 -2
  80. package/dist/src/validator/rootSchema.js +29 -2
  81. package/dist/tsconfig.tsbuildinfo +1 -1
  82. package/package.json +2 -2
@@ -9,6 +9,6 @@
9
9
  "shared": {}
10
10
  }
11
11
  },
12
- "lineage": "233e4512-e98b-43c1-a683-4f82bc34b54e",
12
+ "lineage": "4b92b5c0-d6aa-474a-9d3e-6d5ddd7cd74d",
13
13
  "serial": 5
14
14
  }
@@ -22,11 +22,11 @@
22
22
  "id": "iam-test-app-dev-sls"
23
23
  }
24
24
  ],
25
- "lastUpdated": "2026-09-11T07:02:53.250Z"
25
+ "lastUpdated": "2026-09-28T07:53:57.646Z"
26
26
  }
27
27
  }
28
28
  }
29
29
  },
30
- "lineage": "b648b31f-6842-48e4-87a6-f77b66819584",
30
+ "lineage": "f4e072c4-527c-4b17-94e2-5448b7210f41",
31
31
  "serial": 3
32
32
  }
@@ -83,12 +83,12 @@
83
83
  "id": "test-fn"
84
84
  }
85
85
  ],
86
- "lastUpdated": "2026-09-11T07:03:28.942Z"
86
+ "lastUpdated": "2026-09-28T07:54:35.152Z"
87
87
  }
88
88
  },
89
89
  "shared": {}
90
90
  }
91
91
  },
92
- "lineage": "784f7c51-0231-44fd-b881-2a73cfaacc0a",
92
+ "lineage": "602f671c-2492-49f2-af5a-ab73426a2fd4",
93
93
  "serial": 4
94
94
  }
@@ -93,7 +93,7 @@
93
93
  "topicName": "insight-poc-tencent-log-default-log_fn-fn-logs"
94
94
  }
95
95
  ],
96
- "lastUpdated": "2026-09-11T07:00:32.269Z"
96
+ "lastUpdated": "2026-09-28T07:51:33.333Z"
97
97
  }
98
98
  },
99
99
  "shared": {
@@ -113,11 +113,11 @@
113
113
  "logsetId": "logset-1"
114
114
  }
115
115
  ],
116
- "lastUpdated": "2026-09-11T07:00:32.238Z"
116
+ "lastUpdated": "2026-09-28T07:51:33.303Z"
117
117
  }
118
118
  }
119
119
  }
120
120
  },
121
- "lineage": "4654b309-9ae8-42b1-b2ea-c90165a43d7d",
121
+ "lineage": "3a6eb07a-93b9-49d4-8933-eec9b09a743e",
122
122
  "serial": 4
123
123
  }
@@ -111,7 +111,7 @@
111
111
  ]
112
112
  }
113
113
  ],
114
- "lastUpdated": "2026-09-11T07:03:41.297Z",
114
+ "lastUpdated": "2026-09-28T07:54:47.725Z",
115
115
  "status": "ready"
116
116
  },
117
117
  "events.gateway_event": {
@@ -186,7 +186,7 @@
186
186
  "stageName": "RELEASE"
187
187
  }
188
188
  ],
189
- "lastUpdated": "2026-09-11T07:03:41.299Z"
189
+ "lastUpdated": "2026-09-28T07:54:47.727Z"
190
190
  }
191
191
  },
192
192
  "shared": {
@@ -205,11 +205,11 @@
205
205
  "id": "insight-poc-deploy-app-dev-sls"
206
206
  }
207
207
  ],
208
- "lastUpdated": "2026-09-11T07:03:36.295Z"
208
+ "lastUpdated": "2026-09-28T07:54:42.722Z"
209
209
  }
210
210
  }
211
211
  }
212
212
  },
213
- "lineage": "d9474c84-88b9-4426-b4d4-dc9d30f18037",
213
+ "lineage": "952498ea-991d-4a18-9649-95dfd6eecf3a",
214
214
  "serial": 2
215
215
  }
@@ -9,6 +9,6 @@
9
9
  "shared": {}
10
10
  }
11
11
  },
12
- "lineage": "0b564f96-b540-4da5-9045-3d3ddd5649b8",
12
+ "lineage": "4be35f22-dcad-4ae5-81ec-8af8a6e7dcf9",
13
13
  "serial": 1
14
14
  }
@@ -44,12 +44,12 @@
44
44
  "serverSideEncryptionConfiguration": null
45
45
  }
46
46
  ],
47
- "lastUpdated": "2026-09-11T07:03:49.044Z"
47
+ "lastUpdated": "2026-09-28T07:54:55.881Z"
48
48
  }
49
49
  },
50
50
  "shared": {}
51
51
  }
52
52
  },
53
- "lineage": "e6248607-3291-4b99-aa3c-169ce20e0a61",
53
+ "lineage": "788ce9fe-2b75-413e-9546-7852ccadef9b",
54
54
  "serial": 4
55
55
  }
@@ -63,7 +63,7 @@
63
63
  }
64
64
  ],
65
65
  "status": "ready",
66
- "lastUpdated": "2026-09-11T07:00:35.380Z"
66
+ "lastUpdated": "2026-09-28T07:51:36.440Z"
67
67
  }
68
68
  },
69
69
  "shared": {
@@ -83,11 +83,11 @@
83
83
  "projectId": "proj-123"
84
84
  }
85
85
  ],
86
- "lastUpdated": "2026-09-11T07:00:32.324Z"
86
+ "lastUpdated": "2026-09-28T07:51:33.388Z"
87
87
  }
88
88
  }
89
89
  }
90
90
  },
91
- "lineage": "7b44e48e-2a00-4803-8b4f-acc09fc24bb1",
91
+ "lineage": "6c068bd3-79b2-42b0-be6f-b41bf086db9a",
92
92
  "serial": 5
93
93
  }
@@ -137,12 +137,12 @@
137
137
  "accessGroupName": "nested-drift-fn-dev-nas-access-mnt-data"
138
138
  }
139
139
  ],
140
- "lastUpdated": "2026-09-11T07:00:32.208Z"
140
+ "lastUpdated": "2026-09-28T07:51:33.274Z"
141
141
  }
142
142
  },
143
143
  "shared": {}
144
144
  }
145
145
  },
146
- "lineage": "697cdcc1-a370-401d-b26d-b27c3f78d4a1",
146
+ "lineage": "18c3d191-8cbc-4c3d-bd8b-aa4b01a7ca8c",
147
147
  "serial": 5
148
148
  }
@@ -118,7 +118,7 @@
118
118
  ]
119
119
  }
120
120
  ],
121
- "lastUpdated": "2026-09-11T07:02:27.775Z",
121
+ "lastUpdated": "2026-09-28T07:53:31.919Z",
122
122
  "status": "ready"
123
123
  }
124
124
  },
@@ -138,11 +138,11 @@
138
138
  "id": "role-reconcile-test-app-dev-sls"
139
139
  }
140
140
  ],
141
- "lastUpdated": "2026-09-11T07:02:22.774Z"
141
+ "lastUpdated": "2026-09-28T07:53:26.917Z"
142
142
  }
143
143
  }
144
144
  }
145
145
  },
146
- "lineage": "e534bbf0-81f3-4889-9a6c-aad9525fb6da",
146
+ "lineage": "0dbe5765-cfd8-4a3c-9da8-a567b567ffe8",
147
147
  "serial": 2
148
148
  }
package/README.md CHANGED
@@ -19,7 +19,7 @@
19
19
  <img src="https://img.shields.io/badge/TypeScript-3178C6&logo=typescript&logoColor=white"/>
20
20
  <img src="https://img.shields.io/badge/Alibaba%20Cloud-FF6A00&logo=alibabacloud&logoColor=white"/>
21
21
  <img src="https://img.shields.io/badge/Tencent%20Cloud-0A9AED&logo=tencentqq&logoColor=white"/>
22
- <img src="https://img.shields.io/badge/Huawei%20Cloud-FF0000&logo=hauwei&logoColor=white"/>
22
+ <img src="https://img.shields.io/badge/Huawei%20Cloud-FF0000?logo=huawei&logoColor=white"/>
23
23
  <img src="https://img.shields.io/badge/AWS-232F3E&logo=amazonwebservices&logoColor=white"/>
24
24
  </p>
25
25
 
@@ -65,7 +65,7 @@ Define your infrastructure once in YAML and deploy across Alibaba Cloud, Tencent
65
65
  | **Alibaba Cloud** | ✅ FC3 | ✅ API Gateway | ✅ OSS | ✅ RDS, OTS, ESS | Stable |
66
66
  | **Tencent Cloud** | ✅ SCF | 🚧 Coming Soon | ✅ COS | ✅ TDSQL-C | Stable |
67
67
  | **Volcengine** | ✅ veFaaS | ✅ API Gateway | ✅ TOS | — | Stable |
68
- | **Huawei Cloud** | ✅ FunctionGraph | 🚧 Coming Soon | 🚧 Coming Soon | 🚧 Coming Soon | Beta |
68
+ | **Huawei Cloud** | 🚧 Coming Soon | 🚧 Coming Soon | 🚧 Coming Soon | 🚧 Coming Soon | Planned |
69
69
  | **AWS** | 🔜 Planned | 🔜 Planned | 🔜 Planned | 🔜 Planned | Planned |
70
70
  | **Azure** | 🔜 Planned | 🔜 Planned | 🔜 Planned | 🔜 Planned | Planned |
71
71
  | **Google Cloud** | 🔜 Planned | 🔜 Planned | 🔜 Planned | 🔜 Planned | Planned |
package/README.zh-CN.md CHANGED
@@ -19,7 +19,7 @@
19
19
  <img src="https://img.shields.io/badge/TypeScript-3178C6&logo=typescript&logoColor=white"/>
20
20
  <img src="https://img.shields.io/badge/Alibaba%20Cloud-FF6A00&logo=alibabacloud&logoColor=white"/>
21
21
  <img src="https://img.shields.io/badge/Tencent%20Cloud-0A9AED&logo=tencentqq&logoColor=white"/>
22
- <img src="https://img.shields.io/badge/Huawei%20Cloud-FF0000&logo=hauwei&logoColor=white"/>
22
+ <img src="https://img.shields.io/badge/Huawei%20Cloud-FF0000?logo=huawei&logoColor=white"/>
23
23
  <img src="https://img.shields.io/badge/AWS-232F3E&logo=amazonwebservices&logoColor=white"/>
24
24
  </p>
25
25
 
@@ -65,7 +65,7 @@ si --version
65
65
  | **阿里云** | ✅ FC3 | ✅ API 网关 | ✅ OSS | ✅ RDS, OTS, ESS | 稳定 |
66
66
  | **腾讯云** | ✅ SCF | 🚧 即将推出 | ✅ COS | ✅ TDSQL-C | 稳定 |
67
67
  | **火山引擎** | ✅ veFaaS | ✅ API 网关 | ✅ TOS | — | 稳定 |
68
- | **华为云** | ✅ FunctionGraph | 🚧 即将推出 | 🚧 即将推出 | 🚧 即将推出 | 测试版 |
68
+ | **华为云** | 🚧 即将推出 | 🚧 即将推出 | 🚧 即将推出 | 🚧 即将推出 | 计划中 |
69
69
  | **AWS** | 🔜 计划中 | 🔜 计划中 | 🔜 计划中 | 🔜 计划中 | 计划中 |
70
70
  | **Azure** | 🔜 计划中 | 🔜 计划中 | 🔜 计划中 | 🔜 计划中 | 计划中 |
71
71
  | **Google Cloud** | 🔜 计划中 | 🔜 计划中 | 🔜 计划中 | 🔜 计划中 | 计划中 |
package/dist/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@geek-fun/serverlessinsight",
3
- "version": "0.9.0",
4
- "description": "Full life cycle cross providers serverless application management for your fast-growing business.",
3
+ "version": "0.9.1",
4
+ "description": "Full-lifecycle serverless IaC — one open-source platform to develop, deploy and operate serverless across clouds.",
5
5
  "homepage": "https://serverlessinsight.com",
6
6
  "main": "dist/src/index.js",
7
7
  "types": "dist/src/index.d.ts",
@@ -49,8 +49,7 @@ const volcengineStack_1 = require("../stack/volcengineStack");
49
49
  const lang_1 = require("../lang");
50
50
  const askConfirmation = async () => {
51
51
  if (!process.stdin.isTTY) {
52
- throw new Error('Interactive confirmation required but stdin is not a TTY. ' +
53
- 'Use --auto-approve (-y) to skip confirmation in non-interactive environments.');
52
+ throw new Error(lang_1.lang.__('CONFIRMATION_STDIN_NOT_TTY'));
54
53
  }
55
54
  const rl = readline.createInterface({
56
55
  input: process.stdin,
@@ -79,7 +78,14 @@ const deploy = async (options) => {
79
78
  const context = (0, common_1.getContext)();
80
79
  const iac = (0, parser_1.revalYaml)(iacLocation, context);
81
80
  (0, common_1.setIac)(iac);
82
- const backend = (0, stateBackend_1.createStateBackend)(iac.backend, { ...context, siApiKey: options.siApiKey });
81
+ // D-4: deploy mutates state — a migrated (managedBy=saas) legacy state must
82
+ // fail closed here and route the user to the Console backend.
83
+ const backend = (0, stateBackend_1.createStateBackend)(iac.backend, {
84
+ ...context,
85
+ declaredOrg: iac.org,
86
+ siApiKey: options.siApiKey,
87
+ migrationMarker: 'refuse',
88
+ });
83
89
  // ADR-005: wire the backend's event reporter into the global context so
84
90
  // executors can emit per-resource deployment events via context.reportEvent.
85
91
  if (backend.reportEvent) {
@@ -26,7 +26,13 @@ const destroyStack = async (options) => {
26
26
  provider: context.provider,
27
27
  region: context.region,
28
28
  }));
29
- const backend = (0, stateBackend_1.createStateBackend)(iac.backend, context);
29
+ // D-4: destroy mutates state — a migrated (managedBy=saas) legacy state must
30
+ // fail closed here and route the user to the Console backend.
31
+ const backend = (0, stateBackend_1.createStateBackend)(iac.backend, {
32
+ ...context,
33
+ declaredOrg: iac.org,
34
+ migrationMarker: 'refuse',
35
+ });
30
36
  // Initialize backend stage/deployment context before withLock. SaaS backends
31
37
  // need loadState() to provision the deployment and set the active stage.
32
38
  await backend.loadState(iac.provider.name, context.app, context.service, context.stage);
@@ -80,7 +86,7 @@ const destroyStack = async (options) => {
80
86
  await (0, volcengineStack_1.destroyVolcengineStack)(backend);
81
87
  }
82
88
  else {
83
- throw new Error(`Unsupported provider: ${iac.provider.name}`);
89
+ throw new Error(lang_1.lang.__('UNSUPPORTED_PROVIDER', { provider: iac.provider.name }));
84
90
  }
85
91
  }, {}, (lockId) => {
86
92
  currentLockId = lockId;
@@ -69,19 +69,19 @@ const forceUnlockCommand = async (lockId, options = {}) => {
69
69
  readLock: async () => (0, lockManager_1.readLockFileForCommand)(statePath),
70
70
  forceUnlock: async (id) => (0, lockManager_1.forceUnlock)(statePath, id),
71
71
  loadState: async () => {
72
- throw new Error('Not supported in no-location mode');
72
+ throw new Error(lang_1.lang.__('FORCE_UNLOCK_NO_LOCATION_MODE'));
73
73
  },
74
74
  saveState: async () => {
75
- throw new Error('Not supported in no-location mode');
75
+ throw new Error(lang_1.lang.__('FORCE_UNLOCK_NO_LOCATION_MODE'));
76
76
  },
77
77
  acquireLock: async () => {
78
- throw new Error('Not supported in no-location mode');
78
+ throw new Error(lang_1.lang.__('FORCE_UNLOCK_NO_LOCATION_MODE'));
79
79
  },
80
80
  releaseLock: async () => {
81
- throw new Error('Not supported in no-location mode');
81
+ throw new Error(lang_1.lang.__('FORCE_UNLOCK_NO_LOCATION_MODE'));
82
82
  },
83
83
  withLock: async () => {
84
- throw new Error('Not supported in no-location mode');
84
+ throw new Error(lang_1.lang.__('FORCE_UNLOCK_NO_LOCATION_MODE'));
85
85
  },
86
86
  };
87
87
  }
@@ -13,6 +13,7 @@ const show_1 = require("./show");
13
13
  const login_1 = require("./login");
14
14
  const logout_1 = require("./logout");
15
15
  const whoami_1 = require("./whoami");
16
+ const migrate_1 = require("./migrate");
16
17
  const lang_1 = require("../lang");
17
18
  const parser_1 = require("../parser");
18
19
  const MAX_ERROR_MESSAGE_LENGTH = 2000;
@@ -66,31 +67,31 @@ const actionWrapper = (commandName, handler) => {
66
67
  };
67
68
  };
68
69
  const program = new commander_1.Command();
69
- program.name('si').description('CLI for ServerlessInsight').version((0, common_1.getVersion)());
70
+ program.name('si').description(lang_1.lang.__('CMD_ROOT_DESC')).version((0, common_1.getVersion)());
70
71
  program
71
72
  .command('login')
72
- .description('authenticate with ServerlessInsight Console')
73
- .option('--si-api-key <key>', 'authenticate with an existing API key')
73
+ .description(lang_1.lang.__('CMD_LOGIN_DESC'))
74
+ .option('--si-api-key <key>', lang_1.lang.__('OPT_SI_API_KEY_EXISTING'))
74
75
  .action(actionWrapper('login', async ({ siApiKey }) => {
75
76
  await (0, login_1.login)({ siApiKey });
76
77
  }));
77
78
  program
78
79
  .command('logout')
79
- .description('revoke API key and clear local credentials')
80
+ .description(lang_1.lang.__('CMD_LOGOUT_DESC'))
80
81
  .action(actionWrapper('logout', async () => {
81
82
  await (0, logout_1.logout)();
82
83
  }));
83
84
  program
84
85
  .command('whoami')
85
- .description('show current login status')
86
+ .description(lang_1.lang.__('CMD_WHOAMI_DESC'))
86
87
  .action(actionWrapper('whoami', async () => {
87
88
  await (0, whoami_1.whoami)();
88
89
  }));
89
90
  program
90
91
  .command('show')
91
- .description('show deployed resources from state')
92
- .option('-f, --file <path>', 'specify the yaml file')
93
- .option('-s, --stage <stage>', 'specify the stage')
92
+ .description(lang_1.lang.__('CMD_SHOW_DESC'))
93
+ .option('-f, --file <path>', lang_1.lang.__('OPT_FILE'))
94
+ .option('-s, --stage <stage>', lang_1.lang.__('OPT_STAGE'))
94
95
  .action(actionWrapper('show', async ({ file, stage }) => {
95
96
  const iacLocation = (0, common_1.getIacLocation)(file);
96
97
  const rawIac = (0, parser_1.parseYaml)(iacLocation);
@@ -109,24 +110,24 @@ program
109
110
  }));
110
111
  program
111
112
  .command('validate')
112
- .description('validate serverless Iac yaml')
113
- .option('-f, --file <path>', 'specify the yaml file')
114
- .option('-s, --stage <stage>', 'specify the stage')
113
+ .description(lang_1.lang.__('CMD_VALIDATE_DESC'))
114
+ .option('-f, --file <path>', lang_1.lang.__('OPT_FILE'))
115
+ .option('-s, --stage <stage>', lang_1.lang.__('OPT_STAGE'))
115
116
  .action(actionWrapper('validate', async ({ file, stage }) => {
116
117
  common_1.logger.debug(lang_1.lang.__('LOG_COMMAND_INFO'));
117
118
  await (0, validate_1.validate)({ stage, location: file });
118
119
  }));
119
120
  program
120
121
  .command('plan')
121
- .description('generate and show deployment plan')
122
- .option('-f, --file <path>', 'specify the yaml file')
123
- .option('-s, --stage <stage>', 'specify the stage')
124
- .option('-r, --region <region>', 'specify the region')
125
- .option('-v, --provider <provider>', 'specify the provider')
126
- .option('-k, --accessKeyId <accessKeyId>', 'specify the AccessKeyId')
127
- .option('-x, --accessKeySecret <accessKeySecret>', 'specify the AccessKeySecret')
128
- .option('-n, --securityToken <securityToken>', 'specify the SecurityToken')
129
- .option('--no-refresh', 'skip live cloud probing; diff config against state only (no drift detection)')
122
+ .description(lang_1.lang.__('CMD_PLAN_DESC'))
123
+ .option('-f, --file <path>', lang_1.lang.__('OPT_FILE'))
124
+ .option('-s, --stage <stage>', lang_1.lang.__('OPT_STAGE'))
125
+ .option('-r, --region <region>', lang_1.lang.__('OPT_REGION'))
126
+ .option('-v, --provider <provider>', lang_1.lang.__('OPT_PROVIDER'))
127
+ .option('-k, --accessKeyId <accessKeyId>', lang_1.lang.__('OPT_ACCESS_KEY_ID'))
128
+ .option('-x, --accessKeySecret <accessKeySecret>', lang_1.lang.__('OPT_ACCESS_KEY_SECRET'))
129
+ .option('-n, --securityToken <securityToken>', lang_1.lang.__('OPT_SECURITY_TOKEN'))
130
+ .option('--no-refresh', lang_1.lang.__('OPT_NO_REFRESH'))
130
131
  .action(actionWrapper('plan', async ({ stage, file, region, provider, accessKeyId, accessKeySecret, securityToken, refresh, }) => {
131
132
  await (0, plan_1.plan)({
132
133
  stage,
@@ -143,15 +144,15 @@ program
143
144
  // flow; `plan` stays for compatibility.
144
145
  program
145
146
  .command('diff')
146
- .description('show changes between your config and the live cloud (alias of plan)')
147
- .option('-f, --file <path>', 'specify the yaml file')
148
- .option('-s, --stage <stage>', 'specify the stage')
149
- .option('-r, --region <region>', 'specify the region')
150
- .option('-v, --provider <provider>', 'specify the provider')
151
- .option('-k, --accessKeyId <accessKeyId>', 'specify the AccessKeyId')
152
- .option('-x, --accessKeySecret <accessKeySecret>', 'specify the AccessKeySecret')
153
- .option('-n, --securityToken <securityToken>', 'specify the SecurityToken')
154
- .option('--no-refresh', 'skip live cloud probing; diff config against state only (no drift detection)')
147
+ .description(lang_1.lang.__('CMD_DIFF_DESC'))
148
+ .option('-f, --file <path>', lang_1.lang.__('OPT_FILE'))
149
+ .option('-s, --stage <stage>', lang_1.lang.__('OPT_STAGE'))
150
+ .option('-r, --region <region>', lang_1.lang.__('OPT_REGION'))
151
+ .option('-v, --provider <provider>', lang_1.lang.__('OPT_PROVIDER'))
152
+ .option('-k, --accessKeyId <accessKeyId>', lang_1.lang.__('OPT_ACCESS_KEY_ID'))
153
+ .option('-x, --accessKeySecret <accessKeySecret>', lang_1.lang.__('OPT_ACCESS_KEY_SECRET'))
154
+ .option('-n, --securityToken <securityToken>', lang_1.lang.__('OPT_SECURITY_TOKEN'))
155
+ .option('--no-refresh', lang_1.lang.__('OPT_NO_REFRESH'))
155
156
  .action(actionWrapper('diff', async ({ stage, file, region, provider, accessKeyId, accessKeySecret, securityToken, refresh, }) => {
156
157
  await (0, plan_1.plan)({
157
158
  stage,
@@ -166,18 +167,18 @@ program
166
167
  }));
167
168
  program
168
169
  .command('deploy')
169
- .description('deploy serverless Iac yaml')
170
- .option('-f, --file <path>', 'specify the yaml file')
171
- .option('-s, --stage <stage>', 'specify the stage')
172
- .option('-r, --region <region>', 'specify the region')
173
- .option('-v, --provider <provider>', 'specify the provider')
174
- .option('-k, --accessKeyId <accessKeyId>', 'specify the AccessKeyId')
175
- .option('-x, --accessKeySecret <accessKeySecret>', 'specify the AccessKeySecret')
176
- .option('-n, --securityToken <securityToken>', 'specify the SecurityToken')
177
- .option('--si-api-key <key>', 'ServerlessInsight API key (overrides SI_API_KEY env)')
178
- .option('-y, --auto-approve', 'skip interactive approval of plan before deploying')
179
- .option('--no-refresh', 'skip live cloud probing; diff config against state only (no drift detection)')
180
- .option('-p, --parameter <key=value>', 'override parameters', (value, previous) => {
170
+ .description(lang_1.lang.__('CMD_DEPLOY_DESC'))
171
+ .option('-f, --file <path>', lang_1.lang.__('OPT_FILE'))
172
+ .option('-s, --stage <stage>', lang_1.lang.__('OPT_STAGE'))
173
+ .option('-r, --region <region>', lang_1.lang.__('OPT_REGION'))
174
+ .option('-v, --provider <provider>', lang_1.lang.__('OPT_PROVIDER'))
175
+ .option('-k, --accessKeyId <accessKeyId>', lang_1.lang.__('OPT_ACCESS_KEY_ID'))
176
+ .option('-x, --accessKeySecret <accessKeySecret>', lang_1.lang.__('OPT_ACCESS_KEY_SECRET'))
177
+ .option('-n, --securityToken <securityToken>', lang_1.lang.__('OPT_SECURITY_TOKEN'))
178
+ .option('--si-api-key <key>', lang_1.lang.__('OPT_SI_API_KEY'))
179
+ .option('-y, --auto-approve', lang_1.lang.__('OPT_AUTO_APPROVE'))
180
+ .option('--no-refresh', lang_1.lang.__('OPT_NO_REFRESH'))
181
+ .option('-p, --parameter <key=value>', lang_1.lang.__('OPT_PARAMETER'), (value, previous) => {
181
182
  const [key, val] = value.split('=');
182
183
  previous[key] = val;
183
184
  return previous;
@@ -197,16 +198,51 @@ program
197
198
  refresh,
198
199
  });
199
200
  }));
201
+ program
202
+ .command('migrate')
203
+ .description(lang_1.lang.__('CMD_MIGRATE_DESC'))
204
+ .option('-f, --file <path>', lang_1.lang.__('OPT_FILE'))
205
+ .option('-s, --stage <stage>', lang_1.lang.__('OPT_STAGE'))
206
+ .option('-r, --region <region>', lang_1.lang.__('OPT_REGION'))
207
+ .option('-v, --provider <provider>', lang_1.lang.__('OPT_PROVIDER'))
208
+ .option('-k, --accessKeyId <accessKeyId>', lang_1.lang.__('OPT_ACCESS_KEY_ID'))
209
+ .option('-x, --accessKeySecret <accessKeySecret>', lang_1.lang.__('OPT_ACCESS_KEY_SECRET'))
210
+ .option('-n, --securityToken <securityToken>', lang_1.lang.__('OPT_SECURITY_TOKEN'))
211
+ .option('--si-api-key <key>', lang_1.lang.__('OPT_SI_API_KEY'))
212
+ .option('-y, --auto-approve', lang_1.lang.__('OPT_AUTO_APPROVE'))
213
+ .option('--force', lang_1.lang.__('OPT_FORCE'))
214
+ .option('--no-marker', lang_1.lang.__('OPT_NO_MARKER'))
215
+ .option('--dry-run', lang_1.lang.__('OPT_DRY_RUN'))
216
+ .option('--rollback', lang_1.lang.__('OPT_ROLLBACK'))
217
+ .action(actionWrapper('migrate', async ({ stage, file, region, provider, accessKeyId, accessKeySecret, securityToken, siApiKey, autoApprove, force, marker, dryRun, rollback, }) => {
218
+ await (0, migrate_1.migrate)({
219
+ stage,
220
+ location: file,
221
+ region,
222
+ provider,
223
+ accessKeyId,
224
+ accessKeySecret,
225
+ securityToken,
226
+ siApiKey,
227
+ autoApprove,
228
+ force,
229
+ // Commander models `--no-marker` as the negation of an implicit
230
+ // `marker` boolean (default true).
231
+ noMarker: marker === false,
232
+ dryRun,
233
+ rollback,
234
+ });
235
+ }));
200
236
  program
201
237
  .command('destroy')
202
- .option('-f, --file <path>', 'specify the yaml file')
203
- .option('-s, --stage <stage>', 'specify the stage')
204
- .option('-r, --region <region>', 'specify the region')
205
- .option('-v, --provider <provider>', 'specify the provider')
206
- .option('-k, --accessKeyId <accessKeyId>', 'specify the AccessKeyId')
207
- .option('-x, --accessKeySecret <accessKeySecret>', 'specify the AccessKeySecret')
208
- .option('-n, --securityToken <securityToken>', 'specify the SecurityToken')
209
- .description('destroy serverless stack')
238
+ .option('-f, --file <path>', lang_1.lang.__('OPT_FILE'))
239
+ .option('-s, --stage <stage>', lang_1.lang.__('OPT_STAGE'))
240
+ .option('-r, --region <region>', lang_1.lang.__('OPT_REGION'))
241
+ .option('-v, --provider <provider>', lang_1.lang.__('OPT_PROVIDER'))
242
+ .option('-k, --accessKeyId <accessKeyId>', lang_1.lang.__('OPT_ACCESS_KEY_ID'))
243
+ .option('-x, --accessKeySecret <accessKeySecret>', lang_1.lang.__('OPT_ACCESS_KEY_SECRET'))
244
+ .option('-n, --securityToken <securityToken>', lang_1.lang.__('OPT_SECURITY_TOKEN'))
245
+ .description(lang_1.lang.__('CMD_DESTROY_DESC'))
210
246
  .action(actionWrapper('destroy', async ({ file, stage, region, provider, accessKeyId, accessKeySecret, securityToken }) => {
211
247
  await (0, destroy_1.destroyStack)({
212
248
  location: file,
@@ -220,11 +256,11 @@ program
220
256
  }));
221
257
  program
222
258
  .command('local')
223
- .description('run Serverless application locally for debugging')
224
- .option('-f, --file <path>', 'specify the yaml file')
225
- .option('-s, --stage <stage>', 'specify the stage', 'default')
226
- .option('-d, --debug', 'enable debug mode')
227
- .option('-w, --watch', 'enable file watch', true)
259
+ .description(lang_1.lang.__('CMD_LOCAL_DESC'))
260
+ .option('-f, --file <path>', lang_1.lang.__('OPT_FILE'))
261
+ .option('-s, --stage <stage>', lang_1.lang.__('OPT_STAGE'), 'default')
262
+ .option('-d, --debug', lang_1.lang.__('OPT_DEBUG'))
263
+ .option('-w, --watch', lang_1.lang.__('OPT_WATCH'), true)
228
264
  .action(actionWrapper('local', async ({ stage, debug, watch, file }) => {
229
265
  await (0, local_1.runLocal)({
230
266
  stage,
@@ -235,14 +271,14 @@ program
235
271
  }));
236
272
  program
237
273
  .command('force-unlock <lockId>')
238
- .description('manually remove a stuck lock (use with caution)')
239
- .option('-f, --file <path>', 'specify the yaml file (required for remote backends)')
240
- .option('-s, --stage <stage>', 'specify the stage')
241
- .option('-r, --region <region>', 'specify the region')
242
- .option('-v, --provider <provider>', 'specify the provider')
243
- .option('-k, --accessKeyId <accessKeyId>', 'specify the AccessKeyId')
244
- .option('-x, --accessKeySecret <accessKeySecret>', 'specify the AccessKeySecret')
245
- .option('-n, --securityToken <securityToken>', 'specify the SecurityToken')
274
+ .description(lang_1.lang.__('CMD_FORCE_UNLOCK_DESC'))
275
+ .option('-f, --file <path>', lang_1.lang.__('OPT_FILE_REMOTE_REQUIRED'))
276
+ .option('-s, --stage <stage>', lang_1.lang.__('OPT_STAGE'))
277
+ .option('-r, --region <region>', lang_1.lang.__('OPT_REGION'))
278
+ .option('-v, --provider <provider>', lang_1.lang.__('OPT_PROVIDER'))
279
+ .option('-k, --accessKeyId <accessKeyId>', lang_1.lang.__('OPT_ACCESS_KEY_ID'))
280
+ .option('-x, --accessKeySecret <accessKeySecret>', lang_1.lang.__('OPT_ACCESS_KEY_SECRET'))
281
+ .option('-n, --securityToken <securityToken>', lang_1.lang.__('OPT_SECURITY_TOKEN'))
246
282
  .action(actionWrapper('force-unlock', async (lockId, { file, stage, region, provider, accessKeyId, accessKeySecret, securityToken }) => {
247
283
  await (0, forceUnlock_1.forceUnlockCommand)(lockId, {
248
284
  location: file,
@@ -66,6 +66,7 @@ const loginWithKey = async (apiKey, consoleUrl) => {
66
66
  consoleUrl,
67
67
  orgId: result.orgId,
68
68
  orgName: result.orgName,
69
+ orgSlug: result.orgSlug,
69
70
  userEmail: result.userEmail,
70
71
  });
71
72
  common_1.logger.info(lang_1.lang.__('LOGIN_SUCCESS_KEY', { orgName: result.orgName }));
@@ -122,7 +123,17 @@ const loginWithBrowser = async (consoleUrl) => {
122
123
  const orgId = url.searchParams.get('org_id') || '';
123
124
  const orgName = url.searchParams.get('org_name') || '';
124
125
  const userEmail = url.searchParams.get('user_email') || '';
125
- (0, credentialStore_1.saveCredentials)({ apiKey, consoleUrl, orgId, orgName, userEmail });
126
+ // The authorize callback doesn't carry the org slug; fetch the full
127
+ // identity once so the yml `org:` cross-check works out of the box.
128
+ // Degrade to the callback params if the validate roundtrip fails.
129
+ let orgSlug;
130
+ try {
131
+ orgSlug = (await (0, apiClient_1.validateApiKey)(apiKey, consoleUrl)).orgSlug;
132
+ }
133
+ catch {
134
+ orgSlug = undefined;
135
+ }
136
+ (0, credentialStore_1.saveCredentials)({ apiKey, consoleUrl, orgId, orgName, orgSlug, userEmail });
126
137
  common_1.logger.info(lang_1.lang.__('LOGIN_SUCCESS', { userEmail, orgName }));
127
138
  resolve(true);
128
139
  }