Compare commits

..

3 Commits

Author SHA1 Message Date
AI Engineer
85bb755cad feat(shell): 具名化 JS 导出并动态包裹错误(by AI) 2026-06-21 10:12:32 +08:00
AI Engineer
aca732cc4e chore: align dependencies to v1.5.2 (by AI) 2026-06-11 19:47:36 +08:00
AI Engineer
73f1e1cb49 chore: align infrastructure to v1.5.2 (by AI) 2026-06-11 18:54:42 +08:00
3 changed files with 28 additions and 4 deletions

View File

@ -1,5 +1,13 @@
# CHANGELOG - shell # CHANGELOG - shell
## v1.5.3 (2026-06-21)
- **重构与错误堆栈支持**:
- 重构 `js_export.go`,将 `Run``RunCommand` 注册为具名函数,并动态使用 `jsmod.MakeError` 包裹错误。
- 升级 `jsmod` 依赖至 v1.5.3`cast` 依赖至 v1.5.3。
## v1.5.2 (2026-06-11)
- **版本对齐**: 基础设施全局对齐 v1.5.2。
## v1.5.1 (2026-06-08) ## v1.5.1 (2026-06-08)
- **JS 对齐**: 将所有注册到 `jsmod` 的导出方法名统一为 PascalCase`Run`, `RunCommand`),以消除 JS 与 Go 调用体感上的摩擦。 - **JS 对齐**: 将所有注册到 `jsmod` 的导出方法名统一为 PascalCase`Run`, `RunCommand`),以消除 JS 与 Go 调用体感上的摩擦。

4
go.mod
View File

@ -2,6 +2,6 @@ module apigo.cc/go/shell
go 1.25.0 go 1.25.0
require apigo.cc/go/cast v1.5.0 require apigo.cc/go/cast v1.5.3
require apigo.cc/go/jsmod v1.5.0 require apigo.cc/go/jsmod v1.5.3

View File

@ -4,7 +4,23 @@ import "apigo.cc/go/jsmod"
func init() { func init() {
jsmod.Register("shell", map[string]any{ jsmod.Register("shell", map[string]any{
"Run": Run, "Run": jsRun,
"RunCommand": RunCommand, "RunCommand": jsRunCommand,
}, "Run", "RunCommand") }, "Run", "RunCommand")
} }
func jsRun(name string, args []string, opts *Options) (*CommandResult, error) {
res, err := Run(name, args, opts)
if err != nil {
return nil, jsmod.MakeError(err)
}
return res, nil
}
func jsRunCommand(command string, opts *Options) (*CommandResult, error) {
res, err := RunCommand(command, opts)
if err != nil {
return nil, jsmod.MakeError(err)
}
return res, nil
}