feat: register shell execution capabilities to jsmod

This commit is contained in:
AI Engineer 2026-05-30 18:43:36 +08:00
parent a7bae5b876
commit 7fee89413e
4 changed files with 17 additions and 0 deletions

View File

@ -1,5 +1,8 @@
# CHANGELOG - shell
## [v1.3.2] - 2026-05-30
- **新增**: 注册到 `jsmod`,提供 `run``runCommand` 能力并标记为高危方法unsafeList
## [v1.0.4] - 2026-05-02
- **重构**: 优化颜色常量命名(如 TextBlack, BgBlack以符合 Go 现代规范。
- **重构**: 迁移测试用例至 'shell_test' 包以强化 API 测试封装。

2
go.mod
View File

@ -3,3 +3,5 @@ module apigo.cc/go/shell
go 1.25.0
require apigo.cc/go/cast v1.3.3
require apigo.cc/go/jsmod v1.0.0

2
go.sum
View File

@ -1,2 +1,4 @@
apigo.cc/go/cast v1.3.3 h1:aln5eDR5DZVWVzZ/y5SJh1gQNgWv2sT82I25NaO9g34=
apigo.cc/go/cast v1.3.3/go.mod h1:lGlwImiOvHxG7buyMWhFzcdvQzmSaoKbmr7bcDfUpHk=
apigo.cc/go/jsmod v1.0.0 h1:lVQMq0tCno4kbHlQ3j5wzsm+v24J+bznIoHxpton0pE=
apigo.cc/go/jsmod v1.0.0/go.mod h1:bmyeZtOAP/j5am+YRnaiM89smysK24K7ebk0koFtsSw=

10
js_export.go Normal file
View File

@ -0,0 +1,10 @@
package shell
import "apigo.cc/go/jsmod"
func init() {
jsmod.Register("shell", map[string]any{
"run": Run,
"runCommand": RunCommand,
}, "run", "runCommand")
}