Skip to content

feat(go-sdk): add Exec interface to Go SDK#327

Merged
DorianZheng merged 1 commit intoboxlite-ai:mainfrom
yan5xu:feat/go-sdk-exec
Mar 4, 2026
Merged

feat(go-sdk): add Exec interface to Go SDK#327
DorianZheng merged 1 commit intoboxlite-ai:mainfrom
yan5xu:feat/go-sdk-exec

Conversation

@yan5xu
Copy link
Copy Markdown
Contributor

@yan5xu yan5xu commented Mar 2, 2026

Summary

Add box.Exec() method to the Go SDK, enabling command execution inside running boxes with full parameter support.

Closes #198

Changes

Three-layer implementation:

Layer Files What
Rust C Bridge rust/src/lib.rs boxlite_go_box_exec with JSON opts parsing
Go CGo Binding binding/exec.go, exec_bridge.c ExecOptions/ExecResult + goOutputCallback
Go Client client/box.go, types.go Box.Exec() with time.Duration timeout conversion

Box.Exec() supports:

  • command, args, env, tty, user, timeout, working_dir
  • stdout/stderr streaming via CGo callback
  • Returns ExecResult{ExitCode, Stdout, Stderr}

Also includes:

  • dep_stubs.c for BOXLITE_DEPS_STUB=1 test builds
  • darwin framework LDFLAGS (IOKit, DiskArbitration)
  • Unit tests + integration test

Test

# Unit tests (stub mode)
cd sdks/go && BOXLITE_DEPS_STUB=1 go test ./pkg/client/ -v

# Integration test (requires boxlite runtime)
cd sdks/go && go test ./pkg/client/ -run TestExecIntegration -v

Add box.Exec() method with full parameter support:
- command, args, env, tty, user, timeout, working_dir
- stdout/stderr streaming via CGo callback
- Returns ExecResult{ExitCode, Stdout, Stderr}

Three-layer implementation:
- Rust C Bridge: boxlite_go_box_exec with opts_json parsing
- Go CGo Binding: ExecOptions/ExecResult + goOutputCallback
- Go Client: Box.Exec with time.Duration timeout conversion

Also adds dep_stubs.c for BOXLITE_DEPS_STUB=1 test builds and
darwin framework LDFLAGS (IOKit, DiskArbitration).

Closes boxlite-ai#198

Co-Authored-By: Claude Opus 4.6 <[email protected]>
@yan5xu
Copy link
Copy Markdown
Contributor Author

yan5xu commented Mar 2, 2026

Opened by mistake, closing.

@yan5xu yan5xu closed this Mar 2, 2026
@yan5xu yan5xu reopened this Mar 2, 2026
@DorianZheng DorianZheng merged commit 98aa088 into boxlite-ai:main Mar 4, 2026
16 of 19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature Request] Implement Go SDK

2 participants