workflow

package
v0.1.5-0...-b5400da Latest Latest
Warning

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

Go to latest
Published: Aug 22, 2026 License: MIT Imports: 37 Imported by: 0

Documentation

Overview

Package workflow contains the final, clean-break pt project and administration workflows. It is additive until the coordinated cutover.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrAPI     = errors.New("workflow: API request failed")
	ErrProblem = errors.New("workflow: server rejected request")
	ErrBuild   = errors.New("workflow: local build failed")
)
View Source
var (
	ErrManifest = errors.New("workflow: invalid plumtree.json")
	ErrProject  = errors.New("workflow: invalid project")
	ErrConfirm  = errors.New("workflow: confirmation required")
	ErrTarget   = errors.New("workflow: target is not selected")
)

Functions

func NewScaffold

func NewScaffold(parent, name string, kind scaffold.Kind, access string) (string, error)

NewScaffold requires the app mode explicitly and writes the clean manifest with an explicit access policy. There is no implicit target or history file.

func OpenProfile

func OpenProfile(profile Profile) (runner.Capabilities, func(), error)

func SSHInstruction

func SSHInstruction(record paired.ServerRecord, handle string) (string, error)

SSHInstruction returns a direct leaf command. It intentionally does not route through pt or expose a control URL/token.

Types

type API

type API struct {
	HTTP  *http.Client
	Close io.Closer
}

func NewAPI

func NewAPI(connection *paired.ControlConnection) (*API, error)

func (*API) Access

func (a *API) Access(ctx context.Context, id string) (AccessResult, error)

func (*API) AddAccess

func (a *API) AddAccess(ctx context.Context, appID, name, publicKey, fingerprint string) error

func (*API) App

func (a *API) App(ctx context.Context, id string) (AppResult, error)

func (*API) Apps

func (a *API) Apps(ctx context.Context) (AppsResult, error)

func (*API) Audit

func (a *API) Audit(ctx context.Context) (AuditResult, error)

func (*API) DeleteSecret

func (a *API) DeleteSecret(ctx context.Context, appID, key string) error

func (*API) Deploy

func (a *API) Deploy(ctx context.Context, input ArtifactRequest, previous string) (DeployResult, error)

func (*API) Devices

func (a *API) Devices(ctx context.Context) (DevicesResult, error)

func (*API) Egress

func (a *API) Egress(ctx context.Context, id string) (EgressResult, error)

func (*API) FollowSessions

func (a *API) FollowSessions(ctx context.Context, appID string, interval time.Duration, emit func(SessionsResult) error) error

func (*API) InviteDevice

func (a *API) InviteDevice(ctx context.Context, deviceName string) (Invitation, error)

func (*API) RemoveAccess

func (a *API) RemoveAccess(ctx context.Context, appID, keyID string) error

func (*API) RevokeDevice

func (a *API) RevokeDevice(ctx context.Context, deviceID string) error

func (*API) Secrets

func (a *API) Secrets(ctx context.Context, id string) (SecretsResult, error)

func (*API) Sessions

func (a *API) Sessions(ctx context.Context, id string) (SessionsResult, error)

func (*API) SetEgress

func (a *API) SetEgress(ctx context.Context, appID, host string, allowed bool) error

func (*API) SetSecret

func (a *API) SetSecret(ctx context.Context, appID, key, value string) error

func (*API) Version

func (a *API) Version(ctx context.Context) (Version, error)

type AccessResult

type AccessResult struct {
	Keys []json.RawMessage `json:"keys"`
}

type App

type App struct{ ID, AuthorID, Name, Kind, AccessMode, ActiveDeployID string }

type AppResult

type AppResult struct {
	App              App             `json:"app"`
	ActiveDeployment json.RawMessage `json:"activeDeployment"`
}

type AppsResult

type AppsResult struct {
	Apps []App `json:"apps"`
}

type ArtifactRequest

type ArtifactRequest struct {
	Name          string
	Type          string
	Access        string
	SourceDigest  string
	BuildMetadata map[string]string
	ABIVersion    uint8
	WASM          []byte
}

type AuditResult

type AuditResult struct {
	Events []json.RawMessage `json:"events"`
}

type BuildResult

type BuildResult struct {
	Manifest Manifest
	Artifact build.Artifact
}

func Build

func Build(ctx context.Context, project, workspaceRoot string) (BuildResult, error)

type ConfirmFunc

type ConfirmFunc func(string) bool

type DeployResult

type DeployResult struct {
	API      int             `json:"apiVersion"`
	App      json.RawMessage `json:"app"`
	Deploy   json.RawMessage `json:"deploy"`
	Artifact json.RawMessage `json:"artifact"`
}

type Device

type Device struct {
	ID, AuthorID, Name, PublicKey, Fingerprint string
	RevokedAt                                  *time.Time
}

type DevicesResult

type DevicesResult struct {
	Devices []Device `json:"devices"`
}

type EgressResult

type EgressResult struct {
	Hosts []string `json:"hosts"`
}

type Invitation

type Invitation struct {
	ID, Secret, DeviceName string
	ExpiresAt              time.Time
}

type Manifest

type Manifest struct {
	Name   string `json:"name"`
	Type   string `json:"type"`
	Access string `json:"access"`
}

func ReadManifest

func ReadManifest(project string) (Manifest, error)

func (Manifest) Validate

func (m Manifest) Validate() error

type OpenFunc

type OpenFunc func(context.Context, paired.ServerRecord) (*API, error)

type ProblemError

type ProblemError struct {
	Status int    `json:"status"`
	Code   string `json:"code"`
	Title  string `json:"title"`
	Detail string `json:"detail"`
}

func (*ProblemError) Error

func (e *ProblemError) Error() string

type Profile

type Profile struct {
	Root     string
	KVPath   string
	MaxKeys  int
	MaxBytes int
	Reset    bool
}

Profile is the hosted-parity local development profile. It is persistent by default and reset only when explicitly requested.

type Runner

type Runner struct {
	Context   context.Context
	In        io.Reader
	Out       io.Writer
	Err       io.Writer
	StorePath string
	KeyDir    string
	Workspace string
	Open      OpenFunc
	Confirm   ConfirmFunc
	Probe     transport.Probe
	Pair      paired.PairExchange
}

Runner is the explicit clean command surface. It receives all I/O and network opening through fields, so tests and JSON/CI callers do not inherit global argv, environment, or stdio mutations.

func (Runner) Run

func (r Runner) Run(args []string) error

type SecretsResult

type SecretsResult struct {
	Secrets []json.RawMessage `json:"secrets"`
}

type SessionsResult

type SessionsResult struct {
	Sessions []json.RawMessage `json:"sessions"`
}

type Version

type Version struct {
	Product    string           `json:"product"`
	Version    string           `json:"version"`
	APIVersion int              `json:"apiVersion"`
	ABIVersion int              `json:"abiVersion"`
	Limits     map[string]int64 `json:"limits"`
}

Jump to

Keyboard shortcuts

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