dev

package
v0.2.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 31, 2026 License: MIT Imports: 19 Imported by: 0

Documentation

Overview

Package dev provides development session management for Flutter and React Native hot reload.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EnsureCustomDevice

func EnsureCustomDevice(mobaiURL string) error

EnsureCustomDevice ensures Flutter custom_devices.json has mobai-ios configured.

func FindIPA

func FindIPA(distDir string) (string, error)

FindIPA lists IPAs in distDir and lets user select if multiple.

Types

type FlutterHandler added in v0.2.0

type FlutterHandler struct {
	// contains filtered or unexported fields
}

FlutterHandler implements FrameworkHandler for Flutter projects.

func NewFlutterHandler added in v0.2.0

func NewFlutterHandler(mobaiURL string, noAttach bool) *FlutterHandler

NewFlutterHandler creates a new Flutter handler.

func (*FlutterHandler) Attach added in v0.2.0

func (h *FlutterHandler) Attach(ctx context.Context, deviceID string, debugOutput <-chan mobai.DebugOutput) error

Attach finds the VM Service URL and runs flutter attach.

func (*FlutterHandler) DebugConfig added in v0.2.0

func (h *FlutterHandler) DebugConfig() *mobai.DebugConfig

DebugConfig returns nil for Flutter (no special environment needed).

func (*FlutterHandler) Setup added in v0.2.0

func (h *FlutterHandler) Setup(ctx context.Context) error

Setup configures Flutter custom device for MobAI.

func (*FlutterHandler) Stop added in v0.2.0

func (h *FlutterHandler) Stop()

type FrameworkHandler added in v0.2.0

type FrameworkHandler interface {
	// Setup runs before app install (e.g., Flutter custom device, Metro start)
	Setup(ctx context.Context) error
	// DebugConfig returns environment variables and arguments for app launch
	DebugConfig() *mobai.DebugConfig
	// Attach runs after app launch to enable hot reload
	Attach(ctx context.Context, deviceID string, debugOutput <-chan mobai.DebugOutput) error
	// Stop cleans up resources
	Stop()
}

FrameworkHandler handles framework-specific dev workflow.

type ReactNativeHandler added in v0.2.0

type ReactNativeHandler struct {
	// contains filtered or unexported fields
}

ReactNativeHandler implements FrameworkHandler for React Native projects.

func NewReactNativeHandler added in v0.2.0

func NewReactNativeHandler(metroPort int, showLogs bool, mobaiURL string) *ReactNativeHandler

NewReactNativeHandler creates a new React Native handler.

func (*ReactNativeHandler) Attach added in v0.2.0

func (h *ReactNativeHandler) Attach(ctx context.Context, deviceID string, debugOutput <-chan mobai.DebugOutput) error

Attach monitors app output for React Native development.

func (*ReactNativeHandler) DebugConfig added in v0.2.0

func (h *ReactNativeHandler) DebugConfig() *mobai.DebugConfig

DebugConfig returns launch arguments to configure Metro connection. React Native reads RCT_jsLocation from NSUserDefaults, which can be set via launch arguments.

func (*ReactNativeHandler) Setup added in v0.2.0

func (h *ReactNativeHandler) Setup(ctx context.Context) error

Setup checks if Metro is running and starts it if not.

func (*ReactNativeHandler) Stop added in v0.2.0

func (h *ReactNativeHandler) Stop()

Stop cleans up Metro if we started it.

type RuntimeError

type RuntimeError struct {
	Err error
}

RuntimeError wraps runtime errors to distinguish from CLI errors

func (*RuntimeError) Error

func (e *RuntimeError) Error() string

type Session

type Session struct {
	// contains filtered or unexported fields
}

Session manages a development session with MobAI.

func NewSession

func NewSession(mobaiURL, deviceID, ipaPath string, h FrameworkHandler) *Session

NewSession creates a new development session.

func (*Session) SetSkipInstall

func (s *Session) SetSkipInstall(skip bool, bundleID string)

SetSkipInstall configures the session to skip installation.

func (*Session) Start

func (s *Session) Start(ctx context.Context) error

Start runs the full dev session: setup, install, launch, attach.

func (*Session) Stop

func (s *Session) Stop()

Stop cleans up resources.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL