preview

package
v0.43.0 Latest Latest
Warning

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

Go to latest
Published: May 4, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package preview provides orchestration logic for the 'devx preview' command. It manages isolated PR sandbox environments using git worktrees, namespaced database containers, and per-sandbox tunnel configurations.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Sandbox

type Sandbox struct {
	PRNumber    int
	BranchName  string
	WorktreeDir string
	ProjectName string // namespace prefix for containers (e.g., "pr-42")
	TunnelName  string // derived from project name
	LocalBranch string // local tracking branch (e.g., "devx-pr-42")
	// contains filtered or unexported fields
}

Sandbox holds all state for an isolated PR preview environment.

func New

func New(prNumber int) *Sandbox

New creates a Sandbox with all derived names computed from the PR number.

func (*Sandbox) DryRun

func (s *Sandbox) DryRun() string

DryRun returns a human-readable summary of what would happen.

func (*Sandbox) JSON

func (s *Sandbox) JSON() ([]byte, error)

JSON returns a structured representation for --json output.

func (*Sandbox) Run

func (s *Sandbox) Run(ctx context.Context, globalFlags []string) error

Run starts `devx up` inside the worktree with the project override. It blocks until the subprocess exits or the context is cancelled.

func (*Sandbox) Setup

func (s *Sandbox) Setup() error

Setup validates prerequisites, fetches the PR, and creates a git worktree.

func (*Sandbox) Teardown

func (s *Sandbox) Teardown()

Teardown performs best-effort cleanup of all sandbox resources. Errors are collected rather than fatal — we want to clean up as much as possible.

Jump to

Keyboard shortcuts

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