@geek-fun/serverlessinsight 0.9.2 → 0.9.3

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 (101) 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 +4 -8
  4. package/.serverlessinsight/state-insight-poc-app-log-insight-poc-tencent-log.json.backup +3 -8
  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-poc-timer-app-insight-poc-timer.json.backup +28 -5
  8. package/.serverlessinsight/state-insight-volc-app-insight-volc.json.backup +2 -2
  9. package/.serverlessinsight/state-insight-volc-nested-app-insight-volc-nested.json.backup +3 -3
  10. package/.serverlessinsight/state-nested-drift-app-nested-drift-service.json.backup +20 -5
  11. package/.serverlessinsight/state-role-reconcile-test-app-role-reconcile-test-service.json.backup +3 -3
  12. package/AGENTS.md +10 -0
  13. package/CHANGELOG.md +34 -0
  14. package/README.md +29 -15
  15. package/README.zh-CN.md +7 -14
  16. package/dist/package.json +1 -1
  17. package/dist/src/commands/index.js +19 -3
  18. package/dist/src/commands/local.js +16 -3
  19. package/dist/src/commands/plan.js +10 -3
  20. package/dist/src/common/aliyunClient/apigwOperations.js +17 -1
  21. package/dist/src/common/aliyunClient/fc3Operations.js +7 -1
  22. package/dist/src/common/aliyunClient/ossOperations.js +214 -221
  23. package/dist/src/common/bucketPolicy.js +63 -0
  24. package/dist/src/common/domainUtils.js +4 -1
  25. package/dist/src/common/functionDefinition.js +25 -0
  26. package/dist/src/common/index.js +4 -0
  27. package/dist/src/common/jsonOutput.js +6 -1
  28. package/dist/src/common/nameBuilder.js +3 -1
  29. package/dist/src/common/planCapabilities.js +119 -0
  30. package/dist/src/common/planCompare.js +119 -66
  31. package/dist/src/common/planFormatter.js +22 -14
  32. package/dist/src/common/planRedaction.js +26 -0
  33. package/dist/src/common/refreshPlanner.js +66 -21
  34. package/dist/src/common/tencentClient/cosOperations.js +326 -322
  35. package/dist/src/common/tencentClient/scfOperations.js +9 -2
  36. package/dist/src/common/tencentClient/tdsqlcOperations.js +6 -11
  37. package/dist/src/common/triggerMapper.js +16 -1
  38. package/dist/src/common/volcengineClient/apigwOperations.js +82 -0
  39. package/dist/src/common/volcengineClient/iamOperations.js +27 -3
  40. package/dist/src/common/volcengineClient/tosOperations.js +62 -56
  41. package/dist/src/lang/en.js +28 -4
  42. package/dist/src/lang/zh-CN.js +28 -4
  43. package/dist/src/parser/eventParser.js +1 -0
  44. package/dist/src/parser/functionParser.js +1 -1
  45. package/dist/src/stack/aliyunStack/apigwExecutor.js +1 -1
  46. package/dist/src/stack/aliyunStack/apigwPlanner.js +103 -23
  47. package/dist/src/stack/aliyunStack/apigwResource.js +4 -3
  48. package/dist/src/stack/aliyunStack/apigwTypes.js +3 -7
  49. package/dist/src/stack/aliyunStack/deployer.js +2 -0
  50. package/dist/src/stack/aliyunStack/esServerlessTypes.js +8 -4
  51. package/dist/src/stack/aliyunStack/fc3Executor.js +7 -3
  52. package/dist/src/stack/aliyunStack/fc3Planner.js +124 -155
  53. package/dist/src/stack/aliyunStack/fc3Resource.js +48 -52
  54. package/dist/src/stack/aliyunStack/fc3Types.js +30 -16
  55. package/dist/src/stack/aliyunStack/ossPlanner.js +15 -1
  56. package/dist/src/stack/aliyunStack/ossResource.js +113 -102
  57. package/dist/src/stack/aliyunStack/ossTypes.js +20 -20
  58. package/dist/src/stack/localStack/aliyunFc.js +1 -6
  59. package/dist/src/stack/localStack/event.js +31 -60
  60. package/dist/src/stack/localStack/function.js +24 -65
  61. package/dist/src/stack/localStack/functionRunner.js +10 -2
  62. package/dist/src/stack/localStack/httpAdapter.js +54 -0
  63. package/dist/src/stack/localStack/httpError.js +5 -0
  64. package/dist/src/stack/localStack/legacyLambda.js +26 -0
  65. package/dist/src/stack/localStack/localContext.js +29 -0
  66. package/dist/src/stack/localStack/localRoute.js +12 -0
  67. package/dist/src/stack/localStack/localRuntimes.js +22 -0
  68. package/dist/src/stack/localStack/localServer.js +8 -3
  69. package/dist/src/stack/localStack/requestBody.js +24 -0
  70. package/dist/src/stack/localStack/requestId.js +18 -0
  71. package/dist/src/stack/localStack/tencent.js +147 -0
  72. package/dist/src/stack/localStack/timer.js +23 -2
  73. package/dist/src/stack/localStack/volcengine.js +68 -0
  74. package/dist/src/stack/scfStack/cosPlanner.js +9 -14
  75. package/dist/src/stack/scfStack/cosResource.js +42 -50
  76. package/dist/src/stack/scfStack/cosTypes.js +19 -14
  77. package/dist/src/stack/scfStack/deployer.js +2 -0
  78. package/dist/src/stack/scfStack/scfExecutor.js +7 -3
  79. package/dist/src/stack/scfStack/scfHttpTrigger.js +106 -0
  80. package/dist/src/stack/scfStack/scfPlanner.js +67 -16
  81. package/dist/src/stack/scfStack/scfResource.js +170 -321
  82. package/dist/src/stack/scfStack/scfTypes.js +4 -3
  83. package/dist/src/stack/scfStack/tdsqlcPlanner.js +10 -13
  84. package/dist/src/stack/volcengineStack/apigwDomains.js +64 -0
  85. package/dist/src/stack/volcengineStack/apigwPlanner.js +71 -15
  86. package/dist/src/stack/volcengineStack/apigwResource.js +60 -24
  87. package/dist/src/stack/volcengineStack/apigwTypes.js +5 -1
  88. package/dist/src/stack/volcengineStack/deployer.js +6 -0
  89. package/dist/src/stack/volcengineStack/tosPlanner.js +8 -13
  90. package/dist/src/stack/volcengineStack/tosResource.js +22 -35
  91. package/dist/src/stack/volcengineStack/tosTypes.js +5 -8
  92. package/dist/src/stack/volcengineStack/vefaasPlanner.js +142 -49
  93. package/dist/src/stack/volcengineStack/vefaasResource.js +17 -12
  94. package/dist/src/stack/volcengineStack/vefaasTypes.js +6 -3
  95. package/dist/tsconfig.tsbuildinfo +1 -1
  96. package/package.json +1 -1
  97. package/release-notes.md +79 -0
  98. package/samples/tencent-local/index.js +13 -0
  99. package/samples/tencent-local/serverlessinsight.yml +23 -0
  100. package/samples/volcengine-local/index.js +13 -0
  101. package/samples/volcengine-local/serverlessinsight.yml +28 -0
@@ -9,6 +9,6 @@
9
9
  "shared": {}
10
10
  }
11
11
  },
12
- "lineage": "82d648d2-3eef-4e24-8336-5dd537fb879d",
12
+ "lineage": "6d2a231a-895d-4113-a6dc-0a8956d0d700",
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-10-05T14:49:15.540Z"
25
+ "lastUpdated": "2026-10-24T09:46:08.930Z"
26
26
  }
27
27
  }
28
28
  }
29
29
  },
30
- "lineage": "d6afcb3e-804c-4f78-85a9-6c691d18ec9a",
30
+ "lineage": "85e03b0b-0403-48e5-ba77-e1204bc0bd7f",
31
31
  "serial": 3
32
32
  }
@@ -21,7 +21,8 @@
21
21
  "diskSize": null,
22
22
  "cfsConfig": null,
23
23
  "useGpu": null,
24
- "imageConfig": null
24
+ "imageConfig": null,
25
+ "logEnabled": false
25
26
  },
26
27
  "instances": [
27
28
  {
@@ -76,19 +77,14 @@
76
77
  "dnsCache": null,
77
78
  "intranetConfig": {},
78
79
  "instanceConcurrencyConfig": {}
79
- },
80
- {
81
- "sid": "si:tencent:scf:default:test-fn",
82
- "type": null,
83
- "id": "test-fn"
84
80
  }
85
81
  ],
86
- "lastUpdated": "2026-10-05T14:49:46.375Z"
82
+ "lastUpdated": "2026-10-24T09:46:45.563Z"
87
83
  }
88
84
  },
89
85
  "shared": {}
90
86
  }
91
87
  },
92
- "lineage": "6c7b9a3b-ec45-4fdd-a21c-41ba81171fe4",
88
+ "lineage": "bd0e7ed3-4d08-4ad7-9544-bff241577f5a",
93
89
  "serial": 4
94
90
  }
@@ -81,11 +81,6 @@
81
81
  "intranetConfig": {},
82
82
  "instanceConcurrencyConfig": {}
83
83
  },
84
- {
85
- "sid": "si:tencent:scf:default:test-log-fn",
86
- "type": null,
87
- "id": "test-log-fn"
88
- },
89
84
  {
90
85
  "sid": "si:tencent:cls-topic:default:insight-poc-tencent-log-default-log_fn-fn-logs",
91
86
  "type": "TENCENT_CLS_TOPIC",
@@ -93,7 +88,7 @@
93
88
  "topicName": "insight-poc-tencent-log-default-log_fn-fn-logs"
94
89
  }
95
90
  ],
96
- "lastUpdated": "2026-10-05T14:46:50.513Z"
91
+ "lastUpdated": "2026-10-24T09:42:22.479Z"
97
92
  }
98
93
  },
99
94
  "shared": {
@@ -113,11 +108,11 @@
113
108
  "logsetId": "logset-1"
114
109
  }
115
110
  ],
116
- "lastUpdated": "2026-10-05T14:46:50.488Z"
111
+ "lastUpdated": "2026-10-24T09:42:22.449Z"
117
112
  }
118
113
  }
119
114
  }
120
115
  },
121
- "lineage": "18440897-9452-47e9-b001-dd3bbe4b2b68",
116
+ "lineage": "1dd5e229-5a81-4989-87b8-3c6e8dbcc707",
122
117
  "serial": 4
123
118
  }
@@ -111,7 +111,7 @@
111
111
  ]
112
112
  }
113
113
  ],
114
- "lastUpdated": "2026-10-05T14:49:58.301Z",
114
+ "lastUpdated": "2026-10-24T09:46:58.661Z",
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-10-05T14:49:58.302Z"
189
+ "lastUpdated": "2026-10-24T09:46:58.666Z"
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-10-05T14:49:53.292Z"
208
+ "lastUpdated": "2026-10-24T09:46:53.659Z"
209
209
  }
210
210
  }
211
211
  }
212
212
  },
213
- "lineage": "ad95a71d-fd9c-4f1b-9fe5-859461238c47",
213
+ "lineage": "0325f40e-8920-407d-8276-90e594078696",
214
214
  "serial": 2
215
215
  }
@@ -9,6 +9,6 @@
9
9
  "shared": {}
10
10
  }
11
11
  },
12
- "lineage": "6eeca6bd-198c-4820-98f9-09687ec7ce9c",
12
+ "lineage": "9f879266-9a17-4af8-9cee-68351c9cb957",
13
13
  "serial": 1
14
14
  }
@@ -21,8 +21,25 @@
21
21
  "gpuConfig": null,
22
22
  "customContainerConfig": null,
23
23
  "nasConfig": null,
24
- "logConfig": null,
25
- "codeHash": "c96b718fa999add5e047823c3d7abfa1397fa8d0075bc6a4f3592785fcd4b76f"
24
+ "logConfig": {
25
+ "enableRequestMetrics": false,
26
+ "enableInstanceMetrics": false
27
+ },
28
+ "codeHash": "c96b718fa999add5e047823c3d7abfa1397fa8d0075bc6a4f3592785fcd4b76f",
29
+ "timers": [
30
+ {
31
+ "name": "billing-run",
32
+ "cron": "0 23 3 * * *",
33
+ "payload": "{\"job\":\"billing-run\"}",
34
+ "enable": true,
35
+ "description": "daily billing run"
36
+ },
37
+ {
38
+ "name": "report-hourly",
39
+ "cron": "@every 1h",
40
+ "enable": false
41
+ }
42
+ ]
26
43
  },
27
44
  "instances": [
28
45
  {
@@ -42,7 +59,13 @@
42
59
  "vpcConfig": {},
43
60
  "gpuConfig": {},
44
61
  "nasConfig": {},
45
- "logConfig": {},
62
+ "logConfig": {
63
+ "project": null,
64
+ "logstore": null,
65
+ "enableRequestMetrics": false,
66
+ "enableInstanceMetrics": false,
67
+ "logBeginRule": null
68
+ },
46
69
  "customContainerConfig": {},
47
70
  "description": null,
48
71
  "internetAccess": null,
@@ -98,12 +121,12 @@
98
121
  ]
99
122
  }
100
123
  ],
101
- "lastUpdated": "2026-10-05T14:48:23.124Z"
124
+ "lastUpdated": "2026-10-24T09:45:13.165Z"
102
125
  }
103
126
  },
104
127
  "shared": {}
105
128
  }
106
129
  },
107
- "lineage": "bc279628-644f-414b-b151-663e346b5b15",
130
+ "lineage": "b56a895e-0206-4c8b-8ea0-e5bdeae3d1f9",
108
131
  "serial": 3
109
132
  }
@@ -44,12 +44,12 @@
44
44
  "serverSideEncryptionConfiguration": null
45
45
  }
46
46
  ],
47
- "lastUpdated": "2026-10-05T14:50:14.852Z"
47
+ "lastUpdated": "2026-10-24T09:47:19.214Z"
48
48
  }
49
49
  },
50
50
  "shared": {}
51
51
  }
52
52
  },
53
- "lineage": "f0c451bb-e226-4714-be2f-ccfd5712b87b",
53
+ "lineage": "b0e4b648-ee9e-4e33-80f6-e40aa2370837",
54
54
  "serial": 4
55
55
  }
@@ -63,7 +63,7 @@
63
63
  }
64
64
  ],
65
65
  "status": "ready",
66
- "lastUpdated": "2026-10-05T14:46:53.601Z"
66
+ "lastUpdated": "2026-10-24T09:42:25.796Z"
67
67
  }
68
68
  },
69
69
  "shared": {
@@ -83,11 +83,11 @@
83
83
  "projectId": "proj-123"
84
84
  }
85
85
  ],
86
- "lastUpdated": "2026-10-05T14:46:50.558Z"
86
+ "lastUpdated": "2026-10-24T09:42:22.534Z"
87
87
  }
88
88
  }
89
89
  }
90
90
  },
91
- "lineage": "aa1bb86e-1a63-47b8-b559-faf855f7e046",
91
+ "lineage": "f3480143-7aa8-4e0f-b167-376825dd84ce",
92
92
  "serial": 5
93
93
  }
@@ -36,7 +36,16 @@
36
36
  }
37
37
  ]
38
38
  },
39
- "logConfig": null,
39
+ "nasStorage": [
40
+ {
41
+ "mount_path": "/mnt/data",
42
+ "storage_class": "STANDARD_PERFORMANCE"
43
+ }
44
+ ],
45
+ "logConfig": {
46
+ "enableRequestMetrics": false,
47
+ "enableInstanceMetrics": false
48
+ },
40
49
  "codeHash": "c96b718fa999add5e047823c3d7abfa1397fa8d0075bc6a4f3592785fcd4b76f"
41
50
  },
42
51
  "instances": [
@@ -73,7 +82,13 @@
73
82
  }
74
83
  ]
75
84
  },
76
- "logConfig": {},
85
+ "logConfig": {
86
+ "project": null,
87
+ "logstore": null,
88
+ "enableRequestMetrics": false,
89
+ "enableInstanceMetrics": false,
90
+ "logBeginRule": null
91
+ },
77
92
  "customContainerConfig": {},
78
93
  "description": null,
79
94
  "internetAccess": null,
@@ -137,12 +152,12 @@
137
152
  "accessGroupName": "nested-drift-fn-dev-nas-access-mnt-data"
138
153
  }
139
154
  ],
140
- "lastUpdated": "2026-10-05T14:46:50.462Z"
155
+ "lastUpdated": "2026-10-24T09:42:22.394Z"
141
156
  }
142
157
  },
143
158
  "shared": {}
144
159
  }
145
160
  },
146
- "lineage": "cde939d6-def6-4641-b671-8e75348d2589",
147
- "serial": 5
161
+ "lineage": "c1b8f5d7-306e-425d-a452-b650b0436fd0",
162
+ "serial": 4
148
163
  }
@@ -118,7 +118,7 @@
118
118
  ]
119
119
  }
120
120
  ],
121
- "lastUpdated": "2026-10-05T14:48:50.425Z",
121
+ "lastUpdated": "2026-10-24T09:45:43.481Z",
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-10-05T14:48:45.424Z"
141
+ "lastUpdated": "2026-10-24T09:45:38.480Z"
142
142
  }
143
143
  }
144
144
  }
145
145
  },
146
- "lineage": "bd0d6c03-492e-4d6e-b89c-d0adabefd9ed",
146
+ "lineage": "f512fbf2-43ab-4a0c-8e0b-33d1cbd1c1dd",
147
147
  "serial": 2
148
148
  }
package/AGENTS.md CHANGED
@@ -200,6 +200,16 @@ const policyName = `${roleName}-policy`;
200
200
  3. **In-place migration**: reuse branches key on instance type — existing deployments keep their recorded role/container and get trust/policy updated in place; new names apply only to newly created resources. Never recreate a role or container just to change its name.
201
201
  4. **SIDs are per-provider**: `si:<provider>:<service>:<stage>:<id>` — intentionally NOT unified cross-provider; a SID's lifecycle is bound to its physical resource.
202
202
 
203
+ ## Configuration Defaults and Ownership - MANDATORY
204
+
205
+ - Omission restores the documented si default on both creation and update. Never reuse the previous value of a defaulted field merely because the new YAML omits it.
206
+ - Resolve defaults in shared parsers or effective configuration builders before comparison, execution and state persistence. All providers must use the same field contract; provider-specific defaults must be explicit in their builders.
207
+ - Example: `www_bind_apex` defaults to `false`. Changing `true` to omission removes the owned www binding; changing `false` to omission is unchanged. This applies to bucket and event domains, including legacy forms.
208
+ - Defaults include function logging `false`, event-domain protocol `HTTP`, timer enablement `true`, website index `index.html`, and enabled CDN type/scope `web`/`global`. Function memory and timeout defaults are provider-specific and live in the effective builders.
209
+ - Removing an owned optional configuration block removes its recorded dependents. Persist provider-assigned identities immediately so update, retry and destroy can reconcile the exact resources si owns. Do not claim ownership of unrelated resources found during reads.
210
+ - A field with no si default may remain unmanaged when omitted only when its contract explicitly says so. Do not confuse YAML omission with an unavailable cloud field: failed reads propagate, confirmed absence is `null`, and unavailable dimensions are `undefined`.
211
+ - For each defaulted field, test non-default to omission, default to omission, execution and saved-state convergence. Reject a reset the provider cannot apply instead of saving unapplied defaults.
212
+
203
213
  ## Code Style
204
214
 
205
215
  ### TypeScript
package/CHANGELOG.md CHANGED
@@ -7,6 +7,40 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [0.9.3] - 2026-10-24
11
+
12
+ ### Added
13
+
14
+ - `si local` now invokes veFaaS functions with a veFaaS-native HTTP event and fires
15
+ `triggers.timer` schedules locally with the documented CloudEvents timer envelope,
16
+ so veFaaS HTTP- and timer-driven handlers can be debugged without deploying
17
+ ([#268](https://github.com/geek-fun/serverlessinsight/issues/268),
18
+ [#261](https://github.com/geek-fun/serverlessinsight/issues/261)).
19
+ - `si local` runs Tencent SCF functions with an SCF-native invocation context and
20
+ simulates the HTTP trigger contract si deploys (function URL delivering an
21
+ API-Gateway-compatible event), instead of falling back to a generic non-Aliyun
22
+ shape; unsupported contracts are reported clearly rather than silently substituted
23
+ ([#267](https://github.com/geek-fun/serverlessinsight/issues/267)).
24
+ - Plans now enforce lifecycle ownership for what si created: removing a bucket `iam`
25
+ policy, a bucket domain, a function HTTP trigger or custom domain, or
26
+ `triggers.timer` from the YAML deletes the corresponding cloud resources (and their
27
+ recorded dependents) on the next deploy instead of silently retaining them, and the
28
+ removals show up in the plan before/after
29
+ ([#264](https://github.com/geek-fun/serverlessinsight/issues/264)).
30
+
31
+ ### Fixed
32
+
33
+ - `si plan` and `si diff` now work for Volcengine stacks.
34
+ - Deployment diffs now reflect changes made to managed resources directly in the
35
+ cloud, restore documented defaults on update, and repair drifted dependents
36
+ ([#264](https://github.com/geek-fun/serverlessinsight/issues/264)).
37
+ - veFaaS functions with `logEnabled` or HTTP/domain triggers no longer crash during
38
+ planning.
39
+ - Bucket planning no longer fails when the account lacks permission to read ACL or
40
+ CORS settings: those optional sub-config values are treated as absent, while
41
+ identity and existence checks remain strict.
42
+ - `si local` no longer fails on non-JSON response metadata in function logs.
43
+
10
44
  ## [0.9.2] - 2026-10-05
11
45
 
12
46
  ### ⚠️ Breaking change
package/README.md CHANGED
@@ -1,5 +1,7 @@
1
1
  <div align="center">
2
2
 
3
+ <img src="docs/brand/brand.jpg" alt="ServerlessInsight" width="420" />
4
+
3
5
  # ServerlessInsight
4
6
 
5
7
  **Full life cycle cross-provider serverless management — describe your app, we handle the rest.**
@@ -95,6 +97,26 @@ si deploy -f serverless.yml -s prod
95
97
  si destroy -f serverless.yml
96
98
  ```
97
99
 
100
+ ### Standalone planning
101
+
102
+ `si plan` and its alias `si diff` preview changes on Alibaba Cloud, Tencent Cloud,
103
+ and Volcengine. Volcengine plans include functions, TOS buckets, and API Gateway
104
+ resources in dependency order. Planning reads the configured state backend and
105
+ cloud resources without applying changes or saving state.
106
+
107
+ ```bash
108
+ si plan -f serverlessinsight.yml --stage dev
109
+ si diff -f serverlessinsight.yml --stage dev --json
110
+ si plan -f serverlessinsight.yml --stage dev --region cn-beijing -p memory=1024
111
+ si diff -f serverlessinsight.yml --stage dev --no-refresh
112
+ ```
113
+
114
+ Use `-p, --parameter <key=value>` repeatedly to override configuration variables.
115
+ `--no-refresh` skips live drift checks for tracked resources; ownership probes
116
+ for new resources still run. Credentials and the selected state backend must be
117
+ configured. Read failures exit with an error. Migrated legacy state produces a
118
+ warning and remains unchanged.
119
+
98
120
  ### Using si with AI agents & scripts
99
121
 
100
122
  The CLI is built to be driven by agents and shell scripts: logs always go to
@@ -122,7 +144,7 @@ change under a new version):
122
144
  resourceCount, ... }`
123
145
  - failures (in `--json` mode) → `{ error: { code, message } }` on stdout
124
146
 
125
- **Exit codes**: `si plan` exits `0` when there are no changes, `2` when
147
+ **Exit codes**: `si plan` and `si diff` exit `0` when there are no changes, `2` when
126
148
  changes are present (terraform convention), `1` on errors. `si validate`
127
149
  exits `0` when valid, `1` when validation fails.
128
150
 
@@ -140,7 +162,9 @@ piped output clean in non-TTY environments.
140
162
  Run and debug your serverless functions locally without deploying to the cloud.
141
163
 
142
164
  - **LocalStack server** — test functions, buckets, and API endpoints locally
143
- - **Timer triggers fire locally** — `functions.*.triggers.timer` schedules run against UTC wall-clock (`@every` from server start) and invoke your handler with the provider's timer event shape
165
+ - **Timer triggers fire locally** — Aliyun, Tencent and Volcengine `functions.*.triggers.timer` schedules run against UTC wall-clock (`@every` from server start) and invoke your handler with the provider's timer event shape
166
+ - **Volcengine HTTP invocation** — veFaaS Node.js events, context and response translation for the [documented local subset](docs/local-development.md), with a [runnable example](samples/volcengine-local/serverlessinsight.yml)
167
+ - **Tencent SCF HTTP invocation** — SCF function-URL events, native context and response translation for `nodejs10`–`nodejs18` packages, with a [runnable example](samples/tencent-local/serverlessinsight.yml)
144
168
  - **Bucket file serving** — access local storage files via HTTP for rapid iteration
145
169
  - **Same config, different target** — `si local -f serverless.yml -s local` uses your existing config
146
170
 
@@ -285,12 +309,10 @@ More in the [samples](./samples) directory.
285
309
  ## Community
286
310
 
287
311
  <p align="center">
288
- <img src="https://www.geekfun.club/wechat-group.jpg" width="140" alt="WeChat Group">
312
+ <img src="docs/images/wechat_official.png" width="300" alt="WeChat Official Account">
289
313
  </p>
290
314
 
291
315
  <p align="center">
292
- <a href="https://discord.gg/5NSUyPK2E"><img src="https://img.shields.io/badge/Discord-Join-5865F2?logo=discord&logoColor=white" alt="Discord" /></a>
293
- &nbsp;&nbsp;&nbsp;
294
316
  <a href="https://x.com/geekfun_club"><img src="https://img.shields.io/badge/X-Follow-000000?logo=x&logoColor=white" alt="X / Twitter" /></a>
295
317
  &nbsp;&nbsp;&nbsp;
296
318
  <a href="https://www.youtube.com/@geekfun-club"><img src="https://img.shields.io/badge/YouTube-Subscribe-FF0000?logo=youtube&logoColor=white" alt="YouTube" /></a>
@@ -305,19 +327,11 @@ Contributions welcome! Open an issue or pull request. See the [AGENTS.md](AGENTS
305
327
  ## Sponsor
306
328
 
307
329
  <p align="center">
330
+ <img src="docs/images/wechat_ponsor.jpg" width="140" alt="WeChat Sponsor QR">
331
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
308
332
  <a href="https://github.com/sponsors/geek-fun"><img src="https://img.shields.io/badge/GitHub_Sponsors-%E2%9D%A4_Support-EA4AAA?logo=githubsponsors&logoColor=white" alt="GitHub Sponsors" /></a>
309
333
  </p>
310
334
 
311
- ## Star History
312
-
313
- <a href="https://www.star-history.com/?repos=geek-fun/serverlessinsight&type=date">
314
- <picture>
315
- <source media="(prefers-color-scheme: dark)" srcset="https://api.star-history.com/chart?repos=geek-fun/serverlessinsight&type=date&theme=dark" />
316
- <source media="(prefers-color-scheme: light)" srcset="https://api.star-history.com/chart?repos=geek-fun/serverlessinsight&type=date" />
317
- <img alt="Star History Chart" src="https://api.star-history.com/chart?repos=geek-fun/serverlessinsight&type=date" />
318
- </picture>
319
- </a>
320
-
321
335
  ## License
322
336
 
323
337
  [Apache 2.0](LICENSE) © GEEKFUN
package/README.zh-CN.md CHANGED
@@ -1,5 +1,7 @@
1
1
  <div align="center">
2
2
 
3
+ <img src="docs/brand/brand.jpg" alt="ServerlessInsight" width="420" />
4
+
3
5
  # ServerlessInsight
4
6
 
5
7
  **全生命周期跨云服务商的 Serverless 管理 —— 描述你的应用,其余交给我们。**
@@ -135,7 +137,8 @@ si schema | jq '.$id' # IaC 格式的自包含 draft-07 JSON Schema
135
137
  无需部署到云端,即可本地运行和调试你的 Serverless 函数。
136
138
 
137
139
  - **LocalStack 服务** —— 在本地测试函数、存储桶和 API 端点
138
- - **定时触发器本地触发** —— `functions.*.triggers.timer` 调度按 UTC 墙钟执行(`@every` 自服务启动起算),以对应云平台的 timer 事件形状调用你的处理函数
140
+ - **定时触发器本地触发** —— 阿里云、腾讯云与火山引擎 `functions.*.triggers.timer` 调度按 UTC 墙钟执行(`@every` 自服务启动起算),以对应云平台的 timer 事件形状调用你的处理函数
141
+ - **火山引擎 HTTP 调用** —— 为[文档化的本地子集](docs/local-development.md)提供 veFaaS Node.js 事件、context 与响应转换,附带[可运行示例](samples/volcengine-local/serverlessinsight.yml)
139
142
  - **存储桶文件服务** —— 通过 HTTP 访问本地存储文件,加速迭代
140
143
  - **同一配置,不同目标** —— `si local -f serverless.yml -s local` 复用你现有的配置
141
144
 
@@ -276,12 +279,10 @@ events:
276
279
  ## 社区
277
280
 
278
281
  <p align="center">
279
- <img src="https://www.geekfun.club/wechat-group.jpg" width="140" alt="WeChat Group">
282
+ <img src="docs/images/wechat_official.png" width="300" alt="微信公众号">
280
283
  </p>
281
284
 
282
285
  <p align="center">
283
- <a href="https://discord.gg/5NSUyPK2E"><img src="https://img.shields.io/badge/Discord-加入-5865F2?logo=discord&logoColor=white" alt="Discord" /></a>
284
- &nbsp;&nbsp;&nbsp;
285
286
  <a href="https://x.com/geekfun_club"><img src="https://img.shields.io/badge/X-关注-000000?logo=x&logoColor=white" alt="X / Twitter" /></a>
286
287
  &nbsp;&nbsp;&nbsp;
287
288
  <a href="https://www.youtube.com/@geekfun-club"><img src="https://img.shields.io/badge/YouTube-订阅-FF0000?logo=youtube&logoColor=white" alt="YouTube" /></a>
@@ -296,19 +297,11 @@ events:
296
297
  ## 赞助
297
298
 
298
299
  <p align="center">
300
+ <img src="docs/images/wechat_ponsor.jpg" width="140" alt="微信赞赏码">
301
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
299
302
  <a href="https://github.com/sponsors/geek-fun"><img src="https://img.shields.io/badge/GitHub_Sponsors-%E2%9D%A4_支持-EA4AAA?logo=githubsponsors&logoColor=white" alt="GitHub Sponsors" /></a>
300
303
  </p>
301
304
 
302
- ## Star 历史
303
-
304
- <a href="https://www.star-history.com/?repos=geek-fun/serverlessinsight&type=date">
305
- <picture>
306
- <source media="(prefers-color-scheme: dark)" srcset="https://api.star-history.com/chart?repos=geek-fun/serverlessinsight&type=date&theme=dark" />
307
- <source media="(prefers-color-scheme: light)" srcset="https://api.star-history.com/chart?repos=geek-fun/serverlessinsight&type=date" />
308
- <img alt="Star History Chart" src="https://api.star-history.com/chart?repos=geek-fun/serverlessinsight&type=date" />
309
- </picture>
310
- </a>
311
-
312
305
  ## 许可证
313
306
 
314
307
  [Apache 2.0](LICENSE) © GEEKFUN
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@geek-fun/serverlessinsight",
3
- "version": "0.9.2",
3
+ "version": "0.9.3",
4
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",
@@ -166,9 +166,15 @@ program
166
166
  .option('--no-refresh', lang_1.lang.__('OPT_NO_REFRESH'))
167
167
  .option('--json', lang_1.lang.__('OPT_JSON'))
168
168
  .option('--no-color', lang_1.lang.__('OPT_NO_COLOR'))
169
- .action(actionWrapper('plan', async ({ stage, file, region, provider, accessKeyId, accessKeySecret, securityToken, refresh, json, color, }) => {
169
+ .option('-p, --parameter <key=value>', lang_1.lang.__('OPT_PARAMETER'), (value, previous) => {
170
+ const [key, val] = value.split('=');
171
+ return { ...previous, [key]: val };
172
+ }, {})
173
+ .action(actionWrapper('plan', async ({ stage, parameter, file, region, provider, accessKeyId, accessKeySecret, securityToken, refresh, json, color, }) => {
174
+ (0, jsonOutput_1.setJsonMode)(!!json);
170
175
  const result = await (0, plan_1.plan)({
171
176
  stage,
177
+ parameters: parameter,
172
178
  location: file,
173
179
  region,
174
180
  provider,
@@ -200,9 +206,15 @@ program
200
206
  .option('--no-refresh', lang_1.lang.__('OPT_NO_REFRESH'))
201
207
  .option('--json', lang_1.lang.__('OPT_JSON'))
202
208
  .option('--no-color', lang_1.lang.__('OPT_NO_COLOR'))
203
- .action(actionWrapper('diff', async ({ stage, file, region, provider, accessKeyId, accessKeySecret, securityToken, refresh, json, color, }) => {
209
+ .option('-p, --parameter <key=value>', lang_1.lang.__('OPT_PARAMETER'), (value, previous) => {
210
+ const [key, val] = value.split('=');
211
+ return { ...previous, [key]: val };
212
+ }, {})
213
+ .action(actionWrapper('diff', async ({ stage, parameter, file, region, provider, accessKeyId, accessKeySecret, securityToken, refresh, json, color, }) => {
214
+ (0, jsonOutput_1.setJsonMode)(!!json);
204
215
  const result = await (0, plan_1.plan)({
205
216
  stage,
217
+ parameters: parameter,
206
218
  location: file,
207
219
  region,
208
220
  provider,
@@ -311,14 +323,18 @@ program
311
323
  .description(lang_1.lang.__('CMD_LOCAL_DESC'))
312
324
  .option('-f, --file <path>', lang_1.lang.__('OPT_FILE'))
313
325
  .option('-s, --stage <stage>', lang_1.lang.__('OPT_STAGE'), 'default')
326
+ .option('-r, --region <region>', lang_1.lang.__('OPT_REGION'))
327
+ .option('-v, --provider <provider>', lang_1.lang.__('OPT_PROVIDER'))
314
328
  .option('-d, --debug', lang_1.lang.__('OPT_DEBUG'))
315
329
  .option('-w, --watch', lang_1.lang.__('OPT_WATCH'), true)
316
- .action(actionWrapper('local', async ({ stage, debug, watch, file }) => {
330
+ .action(actionWrapper('local', async ({ stage, debug, watch, file, provider, region }) => {
317
331
  await (0, local_1.runLocal)({
318
332
  stage,
319
333
  debug: !!debug,
320
334
  watch: typeof watch === 'boolean' ? watch : true,
321
335
  location: file,
336
+ provider,
337
+ region,
322
338
  });
323
339
  }));
324
340
  program
@@ -6,12 +6,25 @@ const localStack_1 = require("../stack/localStack");
6
6
  const parser_1 = require("../parser");
7
7
  const lang_1 = require("../lang");
8
8
  const runLocal = async (opts) => {
9
- const { stage, debug, watch, location } = opts;
9
+ const { stage, debug, watch, location, provider, region } = opts;
10
10
  const iacLocation = (0, common_1.getIacLocation)(location);
11
11
  const rawIac = (0, parser_1.parseYaml)(iacLocation);
12
- await (0, common_1.setContext)({ stage, app: rawIac.app, service: rawIac.service, location });
12
+ await (0, common_1.setContext)({
13
+ stage,
14
+ app: rawIac.app,
15
+ service: rawIac.service,
16
+ location,
17
+ provider,
18
+ region,
19
+ iacProvider: rawIac.provider,
20
+ stages: rawIac.stages,
21
+ });
13
22
  const ctx = (0, common_1.getContext)();
14
- const iac = (0, parser_1.revalYaml)(iacLocation, ctx);
23
+ const evaluatedIac = (0, parser_1.revalYaml)(iacLocation, ctx);
24
+ const iac = {
25
+ ...evaluatedIac,
26
+ provider: { ...evaluatedIac.provider, name: ctx.provider, region: ctx.region },
27
+ };
15
28
  // Store IAC in context for access by all functions
16
29
  (0, common_1.setIac)(iac);
17
30
  common_1.logger.info(lang_1.lang.__('RUN_LOCAL_STARTING', {
@@ -8,6 +8,7 @@ const noColor_1 = require("../common/noColor");
8
8
  const parser_1 = require("../parser");
9
9
  const scfStack_1 = require("../stack/scfStack");
10
10
  const aliyunStack_1 = require("../stack/aliyunStack");
11
+ const volcengineStack_1 = require("../stack/volcengineStack");
11
12
  const lang_1 = require("../lang");
12
13
  const plan = async (options) => {
13
14
  common_1.logger.info(lang_1.lang.__('VALIDATING_YAML'));
@@ -26,9 +27,12 @@ const plan = async (options) => {
26
27
  const iac = (0, parser_1.revalYaml)(iacLocation, context);
27
28
  // Store IAC in context for access by all functions
28
29
  (0, common_1.setIac)(iac);
29
- const providerDisplayName = iac.provider.name === common_1.ProviderEnum.ALIYUN
30
- ? lang_1.lang.__('PROVIDER_ALIYUN')
31
- : lang_1.lang.__('PROVIDER_TENCENT');
30
+ const providerDisplayNames = {
31
+ [common_1.ProviderEnum.ALIYUN]: lang_1.lang.__('PROVIDER_ALIYUN'),
32
+ [common_1.ProviderEnum.TENCENT]: lang_1.lang.__('PROVIDER_TENCENT'),
33
+ [common_1.ProviderEnum.VOLCENGINE]: lang_1.lang.__('PROVIDER_VOLCENGINE'),
34
+ };
35
+ const providerDisplayName = providerDisplayNames[iac.provider.name] ?? iac.provider.name;
32
36
  common_1.logger.info(lang_1.lang.__('GENERATING_PLAN_FOR_PROVIDER', { provider: providerDisplayName }));
33
37
  // Read-only command: a migrated state only warns here (window-period
34
38
  // reconciliation still needs plan against the legacy copy).
@@ -44,6 +48,9 @@ const plan = async (options) => {
44
48
  else if (iac.provider.name === common_1.ProviderEnum.ALIYUN) {
45
49
  planResult = await (0, aliyunStack_1.generateAliyunPlan)(iac, backend);
46
50
  }
51
+ else if (iac.provider.name === common_1.ProviderEnum.VOLCENGINE) {
52
+ planResult = await (0, volcengineStack_1.generateVolcenginePlan)(iac, backend);
53
+ }
47
54
  else {
48
55
  common_1.logger.error(lang_1.lang.__('PLAN_COMMAND_NOT_SUPPORTED'));
49
56
  throw new Error(lang_1.lang.__('PLAN_COMMAND_NOT_SUPPORTED'));