devrun

package
v0.0.0-...-3776344 Latest Latest
Warning

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

Go to latest
Published: Jun 5, 2026 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HandleStaleState

func HandleStaleState(
	ctx context.Context,
	appDir string,
	dockerMgr docker.RuntimeContainerManager,
	composeMgr *compose.ComposeManager,
	output *Output,
) error

HandleStaleState checks for a stale state file and cleans up if needed. Returns an error if an active dev environment is already running.

func LoadStateForCommand

func LoadStateForCommand(appDir string) (*devstate.DevState, error)

LoadStateForCommand loads the state file and validates it for companion commands. Returns the state and an error if not found or stale.

func StopFromState

func StopFromState(
	ctx context.Context,
	appDir string,
	dockerMgr docker.RuntimeContainerManager,
	composeMgr *compose.ComposeManager,
	output *Output,
	logger *zap.Logger,
) error

StopFromState loads the state file and shuts down the environment. Used by `dev stop`.

Types

type HandlerWatcher

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

HandlerWatcher watches the source directory for handler changes and restarts the container when structural changes are detected.

func NewHandlerWatcher

func NewHandlerWatcher(config WatcherConfig, initialManifest *preprocess.HandlerManifest) *HandlerWatcher

NewHandlerWatcher creates a new file watcher.

func (*HandlerWatcher) Watch

func (w *HandlerWatcher) Watch(ctx context.Context) error

Watch starts watching the source directory for file changes. Blocks until the context is cancelled.

type Orchestrator

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

Orchestrator manages the full dev run lifecycle.

func NewOrchestrator

func NewOrchestrator(
	config OrchestratorConfig,
	dockerMgr docker.RuntimeContainerManager,
	composeMgr *compose.ComposeManager,
	extractor *preprocess.Extractor,
	output *Output,
	logger *zap.Logger,
) *Orchestrator

NewOrchestrator creates a new dev run orchestrator.

func (*Orchestrator) DumpLogs

func (o *Orchestrator) DumpLogs(ctx context.Context) string

DumpLogs syncs all container logs to files in .celerity/logs/ before teardown. This is called by `dev test` so logs are preserved after the environment is torn down. Returns the log directory path, or empty string if no logs were written.

func (*Orchestrator) RunDetached

func (o *Orchestrator) RunDetached(ctx context.Context) error

RunDetached starts the dev environment and exits, leaving containers running.

func (*Orchestrator) RunForeground

func (o *Orchestrator) RunForeground(ctx context.Context) error

RunForeground starts the dev environment and streams logs until interrupted.

func (*Orchestrator) Shutdown

func (o *Orchestrator) Shutdown(ctx context.Context) error

Shutdown stops the container, compose stack, and removes the state file. Shared between foreground Ctrl+C and the `dev stop` command.

func (*Orchestrator) ShutdownFromState

func (o *Orchestrator) ShutdownFromState(ctx context.Context, state *devstate.DevState) error

ShutdownFromState cleans up using a loaded state (for `dev stop`).

func (*Orchestrator) StartFull

func (o *Orchestrator) StartFull(ctx context.Context) error

StartFull runs the full startup sequence (dependencies, seeding, container) and writes state. Used by dev test when API tests are included.

func (*Orchestrator) StartInfraOnly

func (o *Orchestrator) StartInfraOnly(ctx context.Context) error

StartInfraOnly runs compose dependencies, seeds config/data, and applies SQL schemas, but does NOT start the app container. Used by dev test when only integration tests are requested.

type OrchestratorConfig

type OrchestratorConfig struct {
	AppDir              string
	Port                string
	ServiceName         string
	Image               string
	DeployTarget        string
	Runtime             string
	MergedBlueprintPath string
	ModulePath          string
	SeedDir             string
	ConfigDir           string
	SecretsDir          string

	Blueprint    *schema.Blueprint
	SpecFormat   schema.SpecFormat
	HandlerInfos []blueprint.HandlerInfo
	Manifest     *preprocess.HandlerManifest
	ContainerCfg *docker.ContainerConfig
	ComposeCfg   *compose.ComposeConfig
}

OrchestratorConfig holds all resolved configuration for a dev run.

type Output

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

Output handles all formatted stdout for the dev commands.

func NewOutput

func NewOutput(writer io.Writer, isColor bool) *Output

NewOutput creates a new Output writer.

func (*Output) PrintDetachedNotice

func (o *Output) PrintDetachedNotice()

PrintDetachedNotice prints the background mode notice.

func (*Output) PrintError

func (o *Output) PrintError(message string, err error)

PrintError prints a failed step with a red X and error detail.

func (*Output) PrintHealthReady

func (o *Output) PrintHealthReady(elapsed time.Duration)

PrintHealthReady prints a success message when the app is healthy.

func (*Output) PrintHealthWaiting

func (o *Output) PrintHealthWaiting()

PrintHealthWaiting prints a progress message while waiting for the app.

func (*Output) PrintInfo

func (o *Output) PrintInfo(message string)

PrintInfo prints an informational message.

func (*Output) PrintLogLine

func (o *Output) PrintLogLine(line devlogs.LogLine)

PrintLogLine formats and prints a parsed log line.

func (*Output) PrintNoEnvironment

func (o *Output) PrintNoEnvironment()

PrintNoEnvironment prints a message when no dev environment is running.

func (*Output) PrintProgress

func (o *Output) PrintProgress(message string)

PrintProgress prints an in-progress message for feedback during slow operations.

func (*Output) PrintShutdownComplete

func (o *Output) PrintShutdownComplete()

PrintShutdownComplete prints the shutdown completion message.

func (*Output) PrintShutdownStarting

func (o *Output) PrintShutdownStarting()

PrintShutdownStarting prints the shutdown notice.

func (*Output) PrintStartupSummary

func (o *Output) PrintStartupSummary(port string, handlers []blueprint.HandlerInfo)

PrintStartupSummary prints the URL and handler table after a successful startup.

func (*Output) PrintStatus

func (o *Output) PrintStatus(state *devstate.DevState, isRunning bool)

PrintStatus renders the status table for `dev status`.

func (*Output) PrintStep

func (o *Output) PrintStep(message string)

PrintStep prints a completed startup step with a green checkmark.

func (*Output) PrintStreamingNotice

func (o *Output) PrintStreamingNotice()

PrintStreamingNotice prints the streaming notice for foreground mode.

func (*Output) PrintTestFailed

func (o *Output) PrintTestFailed(exitCode int)

PrintTestFailed prints the failure message with the exit code.

func (*Output) PrintTestHeader

func (o *Output) PrintTestHeader(suites []string)

PrintTestHeader prints the test run header with the suites being executed.

func (*Output) PrintTestPassed

func (o *Output) PrintTestPassed()

PrintTestPassed prints the success message after all tests pass.

func (*Output) PrintWarning

func (o *Output) PrintWarning(message string, err error)

PrintWarning prints a warning with a yellow exclamation mark.

func (*Output) Writer

func (o *Output) Writer() io.Writer

Writer returns the underlying writer for piping external command output.

type WatcherConfig

type WatcherConfig struct {
	AppDir      string
	Runtime     string
	Extractor   *preprocess.Extractor
	Blueprint   *schema.Blueprint
	SpecFormat  schema.SpecFormat
	Docker      docker.RuntimeContainerManager
	ContainerID string
	Output      *Output
	Logger      *zap.Logger
}

WatcherConfig holds the dependencies for the file watcher.

Jump to

Keyboard shortcuts

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