Documentation
¶
Overview ¶
Package migs provides CLI client implementations for Migs operations. This file implements mig project management commands (add, list, remove, archive, unarchive).
These commands call the server endpoints: - POST /v1/migs (create mig) - GET /v1/migs (list migs) - DELETE /v1/migs/{mig_ref} (delete mig) - PATCH /v1/migs/{mig_ref}/archive (archive mig) - PATCH /v1/migs/{mig_ref}/unarchive (unarchive mig)
These commands implement the mig management surfaces (create, list, delete, archive).
Package migs provides CLI client implementations for Migs operations. This file implements mig repo set management commands (add, list, remove, import).
These commands call the server endpoints: - POST /v1/migs/{mig_id}/repos (add repo) - GET /v1/migs/{mig_id}/repos (list repos) - DELETE /v1/migs/{mig_id}/repos/{repo_id} (delete repo) - POST /v1/migs/{mig_id}/repos/bulk (bulk import from CSV)
These commands implement mig repo set management (add, list, remove, import).
Package migs provides CLI client implementations for Migs operations. This file implements the mig run command for creating waves from a mig project.
This command calls POST /v1/migs/{mig_id}/waves with repo selection. Implements the control-plane call for `ploy mig run` after the public CLI has resolved any positional repo selectors to canonical repo URLs. User-facing selector resolution happens in internal/cli/mig before this command sends canonical repo URLs to the control-plane API.
pull.go provides CLI client implementations for pull resolution APIs.
These commands call the server endpoints:
- POST /v1/runs/{run_id}/pull (resolve repo metadata for a run)
- POST /v1/migs/{mig_id}/pull (resolve repo for a mig)
These endpoints help CLI clients resolve repo execution identifiers needed to pull diffs from the server.
Package migs provides CLI client implementations for Migs operations. This file implements the run lifecycle client for create/list/stop/status operations against the control-plane /v1/runs endpoints.
RunClient encapsulates HTTP calls to the control-plane and maps responses to domain types for CLI consumption. It follows the same Command pattern used by SubmitCommand and InspectCommand.
status.go provides CLI client implementations for fetching diffs and patches.
This file implements helpers used by `ploy run apply` and `ploy mig pull`:
- ListRunDiffsCommand: Fetches run-scoped diffs via GET /v1/runs/{run_id}/diffs.
- DownloadDiffCommand: Downloads a single diff via GET /v1/runs/{run_id}/diffs?download=true&diff_id=<uuid>.
- DownloadDiffGzipCommand: Downloads raw gzip bytes for a single diff from the same endpoint.
Index ¶
- type AddMigCommand
- type AddMigRepoCommand
- type AddMigResult
- type ArchiveMigCommand
- type ArchiveMigResult
- type ArtifactsCommand
- type CreateMigRunCommand
- type CreateMigRunResult
- type DiffEntry
- type DownloadDiffCommand
- type DownloadDiffGzipCommand
- type ImportError
- type ImportMigReposCommand
- type ImportMigReposResult
- type ListMigReposCommand
- type ListMigsCommand
- type ListRunDiffsCommand
- type ListRunsCommand
- type MigPullCommand
- type PullMode
- type PullResolution
- type RemoveMigCommand
- type RemoveMigRepoCommand
- type ResolveMigByNameCommand
- type RunPullCommand
- type SetMigSpecCommand
- type SetMigSpecResult
- type SubmitCommand
- type UnarchiveMigCommand
- type UnarchiveMigResult
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AddMigCommand ¶
type AddMigCommand struct {
Client *http.Client
BaseURL *url.URL
Name string // Required: unique mig name.
Spec *json.RawMessage // Optional: initial spec (creates spec row and sets migs.spec_id).
CreatedBy *string // Optional: creator identifier.
}
AddMigCommand creates a new mig project. Endpoint: POST /v1/migs Creates a mig with unique name and optional initial spec.
func (AddMigCommand) Run ¶
func (c AddMigCommand) Run(ctx context.Context) (AddMigResult, error)
Run executes POST /v1/migs to create a mig project.
type AddMigRepoCommand ¶
type AddMigRepoCommand struct {
Client *http.Client
BaseURL *url.URL
MigRef domaintypes.MigRef // Required: mig ID or name.
RepoURL string // Required: git repository URL.
BaseRef string // Required: base git ref.
}
AddMigRepoCommand adds a repo to a mig's repo set. Endpoint: POST /v1/migs/{mig_id}/repos Adds a repo with URL and base ref.
func (AddMigRepoCommand) Run ¶
func (c AddMigRepoCommand) Run(ctx context.Context) (domainapi.MigRepoSummary, error)
Run executes POST /v1/migs/{mig_id}/repos to add a repo.
type AddMigResult ¶
type AddMigResult = domainapi.MigSummary
AddMigResult contains the response from creating a mig.
type ArchiveMigCommand ¶
type ArchiveMigCommand struct {
Client *http.Client
BaseURL *url.URL
MigRef types.MigRef // Required: mig ID or name to archive.
}
ArchiveMigCommand archives a mig project. Endpoint: PATCH /v1/migs/{mig_ref}/archive Refuses archival if the mig has running jobs.
func (ArchiveMigCommand) Run ¶
func (c ArchiveMigCommand) Run(ctx context.Context) (ArchiveMigResult, error)
Run executes PATCH /v1/migs/{mig_ref}/archive to archive a mig.
type ArchiveMigResult ¶
type ArchiveMigResult struct {
ID types.MigID `json:"id"`
Name string `json:"name"`
Archived bool `json:"archived"`
}
ArchiveMigResult contains the response from archiving a mig.
type ArtifactsCommand ¶
type ArtifactsCommand struct {
Client *http.Client
BaseURL *url.URL
RunID domaintypes.RunID
Output io.Writer
}
ArtifactsCommand lists artifacts attached to a Migs run by stage.
type CreateMigRunCommand ¶
type CreateMigRunCommand struct {
Client *http.Client
BaseURL *url.URL
MigRef domaintypes.MigRef // Required: mig ID or name.
RepoURLs []string // Optional: canonical repo URLs for "explicit" mode.
Failed bool // If true, use "failed" mode; otherwise "all" or "explicit".
CreatedBy *string // Optional: creator identifier.
}
CreateMigRunCommand creates a launch wave from a mig project with repo selection. Endpoint: POST /v1/migs/{mig_id}/waves Creates a wave with run selection based on mode: all, explicit, or failed.
func (CreateMigRunCommand) Run ¶
func (c CreateMigRunCommand) Run(ctx context.Context) (CreateMigRunResult, error)
Run executes POST /v1/migs/{mig_id}/waves to create a wave with repo selection. Selection behavior:
- canonical repo URLs select explicit repos by repo_url identity within the mig
- --failed selects repos with last terminal state Fail
- omitted repo selection selects all repos in the mig repo set
type CreateMigRunResult ¶
type CreateMigRunResult struct {
WaveID domaintypes.WaveID `json:"wave_id"`
MigID domaintypes.MigID `json:"mig_id"`
SpecID domaintypes.SpecID `json:"spec_id"`
RunCount int `json:"run_count"`
}
CreateMigRunResult contains the response from creating a mig wave.
type DiffEntry ¶
type DiffEntry struct {
ID domaintypes.DiffID `json:"id"`
JobID domaintypes.JobID `json:"job_id"`
CreatedAt time.Time `json:"created_at"`
Size int `json:"gzipped_size"`
Summary domaintypes.DiffSummary `json:"summary,omitempty"`
}
DiffEntry represents a single diff record from the list diffs response.
type DownloadDiffCommand ¶
type DownloadDiffCommand struct {
Client *http.Client
BaseURL *url.URL
RunID domaintypes.RunID // Run ID (KSUID-backed domain type)
RepoID domaintypes.RepoID
DiffID domaintypes.DiffID
// Accumulated requests cumulative patch content up to DiffID.
Accumulated bool
}
DownloadDiffCommand downloads a single diff patch via: GET /v1/runs/{run_id}/diffs?download=true&diff_id=<uuid> Returns the decompressed patch bytes ready for application via `git apply`.
type DownloadDiffGzipCommand ¶
type DownloadDiffGzipCommand struct {
Client *http.Client
BaseURL *url.URL
RunID domaintypes.RunID // Run ID (KSUID-backed domain type)
RepoID domaintypes.RepoID
DiffID domaintypes.DiffID
// Accumulated requests cumulative patch content up to DiffID.
Accumulated bool
}
DownloadDiffGzipCommand downloads a single diff patch as raw gzip bytes via: GET /v1/runs/{run_id}/diffs?download=true&diff_id=<uuid>
type ImportError ¶
ImportError represents a per-line error from CSV import.
type ImportMigReposCommand ¶
type ImportMigReposCommand struct {
Client *http.Client
BaseURL *url.URL
MigRef domaintypes.MigRef // Required: mig ID or name.
CSVData []byte // Required: CSV content with header: repo_url,base_ref
}
ImportMigReposCommand bulk imports repos for a mig from CSV. Endpoint: POST /v1/migs/{mig_id}/repos/bulk Imports repos from CSV with header: repo_url,base_ref.
func (ImportMigReposCommand) Run ¶
func (c ImportMigReposCommand) Run(ctx context.Context) (ImportMigReposResult, error)
Run executes POST /v1/migs/{mig_id}/repos/bulk to import repos from CSV.
type ImportMigReposResult ¶
type ImportMigReposResult struct {
Created int `json:"created"`
Updated int `json:"updated"`
Failed int `json:"failed"`
Errors []ImportError `json:"errors"`
}
ImportMigReposResult contains the response from bulk importing repos.
type ListMigReposCommand ¶
type ListMigReposCommand struct {
Client *http.Client
BaseURL *url.URL
MigRef domaintypes.MigRef // Required: mig ID or name.
}
ListMigReposCommand lists repos in a mig's repo set. Endpoint: GET /v1/migs/{mig_id}/repos Returns repos with ID, REPO_URL, BASE_REF, ADDED_AT.
func (ListMigReposCommand) Run ¶
func (c ListMigReposCommand) Run(ctx context.Context) ([]domainapi.MigRepoSummary, error)
Run executes GET /v1/migs/{mig_id}/repos to list repos.
type ListMigsCommand ¶
type ListMigsCommand struct {
Client *http.Client
BaseURL *url.URL
Limit int32 // Max results to return (default 50, max 100).
Offset int32 // Number of results to skip.
NameSubstring *string // Optional: filter by name substring.
Archived *bool // Optional: filter by archived status.
RepoURL *string // Optional: filter by repo URL in repo set.
}
ListMigsCommand lists mig projects with optional filters. Endpoint: GET /v1/migs Returns migs with ID, NAME, CREATED_AT, ARCHIVED status.
func (ListMigsCommand) Run ¶
func (c ListMigsCommand) Run(ctx context.Context) ([]domainapi.MigSummary, error)
Run executes GET /v1/migs to list migs with pagination and filters.
type ListRunDiffsCommand ¶
type ListRunDiffsCommand struct {
Client *http.Client
BaseURL *url.URL
RunID domaintypes.RunID // Run ID (KSUID-backed domain type)
RepoID domaintypes.RepoID
}
ListRunDiffsCommand fetches run-scoped diffs via GET /v1/runs/{run_id}/diffs.
Returns diffs filtered by repo_id via jobs.repo_id join. Diffs for repo A are excluded from repo B listing. Response shape is unchanged from legacy endpoint.
type ListRunsCommand ¶
type ListRunsCommand struct {
Client *http.Client
BaseURL *url.URL
Limit int32 // Max results to return (default 50, max 100).
Offset int32 // Number of results to skip.
RepoURL string
CreatedBy string
All bool
}
ListRunsCommand lists runs from the control plane.
func (ListRunsCommand) Run ¶
func (c ListRunsCommand) Run(ctx context.Context) ([]domaintypes.RunSummary, error)
Run executes GET /v1/runs to list runs with pagination.
type MigPullCommand ¶
type MigPullCommand struct {
Client *http.Client
BaseURL *url.URL
MigRef domaintypes.MigRef
RepoURL string // Repository URL to match
Mode PullMode // Pull mode (last-succeeded or last-failed)
}
MigPullCommand resolves a repo_url to execution identifiers for a mig. Endpoint: POST /v1/migs/{mig_id}/pull
Server performs the lookup using mig_id + repo_url to find mig_repos.id, then selects the appropriate runs by created_at DESC, filtering by the requested terminal status (Success or Fail). Mode values:
- "last-succeeded" (default): newest runs with status=Success
- "last-failed": newest runs with status=Fail
Returns 404 if no repo matches or no run with matching status found.
func (MigPullCommand) Run ¶
func (c MigPullCommand) Run(ctx context.Context) (*PullResolution, error)
Run executes POST /v1/migs/{mig_id}/pull with the provided repo_url and mode. Returns the PullResolution containing run_id and repo_id.
type PullMode ¶
type PullMode string
PullMode specifies which run to select for mig pull resolution.
type PullResolution ¶
type PullResolution struct {
RunID domaintypes.RunID `json:"run_id"`
RepoID domaintypes.RepoID `json:"repo_id"`
RepoURL string `json:"repo_url,omitempty"`
SourceCommitSHA string `json:"source_commit_sha,omitempty"`
}
PullResolution is the response from pull resolution endpoints. It provides the identifiers needed to fetch diffs:
- RunID: the run containing the execution
- RepoID: the mig_repos.id for the matched repo
type RemoveMigCommand ¶
type RemoveMigCommand struct {
Client *http.Client
BaseURL *url.URL
MigRef types.MigRef // Required: mig ID or name to delete.
}
RemoveMigCommand deletes a mig project. Endpoint: DELETE /v1/migs/{mig_ref} Refuses deletion if the mig has any runs.
type RemoveMigRepoCommand ¶
type RemoveMigRepoCommand struct {
Client *http.Client
BaseURL *url.URL
MigRef domaintypes.MigRef // Required: mig ID or name.
RepoID domaintypes.MigRepoID
}
RemoveMigRepoCommand deletes a repo from a mig's repo set. Endpoint: DELETE /v1/migs/{mig_id}/repos/{repo_id} Refuses deletion if there are historical executions referencing this repo.
type ResolveMigByNameCommand ¶
type ResolveMigByNameCommand struct {
Client *http.Client
BaseURL *url.URL
MigRef types.MigRef // Mig reference (could be ID or name).
}
ResolveMigByNameCommand attempts to resolve a mig reference (ID or name) to a mig ID. It queries the server to find an exact name match, supporting both ID and name lookups. This command does NOT use any client-side heuristics to distinguish IDs from names; it always queries the server for resolution.
func (ResolveMigByNameCommand) Run ¶
func (c ResolveMigByNameCommand) Run(ctx context.Context) (string, error)
Run attempts to resolve a mig ID from a name reference. Returns the mig ID if found by exact name match, or the reference as-is if no match. No client-side heuristics are used to distinguish IDs from names.
type RunPullCommand ¶
RunPullCommand resolves execution identifiers and source metadata for a run. Endpoint: POST /v1/runs/{run_id}/pull
func (RunPullCommand) Run ¶
func (c RunPullCommand) Run(ctx context.Context) (*PullResolution, error)
Run executes POST /v1/runs/{run_id}/pull with no request body.
type SetMigSpecCommand ¶
type SetMigSpecCommand struct {
Client *http.Client
BaseURL *url.URL
MigRef types.MigRef // Required: mig ID or name.
Spec json.RawMessage // Required: spec content (YAML/JSON parsed to JSON).
Name *string // Optional: spec name.
CreatedBy *string // Optional: creator identifier.
}
SetMigSpecCommand creates a new spec row and updates migs.spec_id. Endpoint: POST /v1/migs/{mig_ref}/specs Sets the mig's current spec by creating a new spec row.
func (SetMigSpecCommand) Run ¶
func (c SetMigSpecCommand) Run(ctx context.Context) (SetMigSpecResult, error)
Run executes POST /v1/migs/{mig_ref}/specs to set the mig's spec.
type SetMigSpecResult ¶
type SetMigSpecResult struct {
ID types.SpecID `json:"id"` // spec_id
CreatedAt time.Time `json:"created_at"`
}
SetMigSpecResult contains the response from setting a mig spec.
type SubmitCommand ¶
type SubmitCommand struct {
Client *http.Client
BaseURL *url.URL
Request domainapi.RunSubmitRequest
}
SubmitCommand submits a Migs run to the control plane. The command submits a single-repo run via POST /v1/runs, then fetches the canonical Migs-style RunSummary via GET /v1/runs/{id}/status for display.
func (SubmitCommand) Run ¶
func (c SubmitCommand) Run(ctx context.Context) (migsapi.RunSummary, error)
Run executes the submission against the control plane endpoint. POST /v1/runs returns 201 Created with {run_id, mig_id, spec_id}. GET /v1/runs/{id}/status returns the canonical RunSummary.
type UnarchiveMigCommand ¶
type UnarchiveMigCommand struct {
Client *http.Client
BaseURL *url.URL
MigRef types.MigRef // Required: mig ID or name to unarchive.
}
UnarchiveMigCommand unarchives a mig project. Endpoint: PATCH /v1/migs/{mig_ref}/unarchive Restores an archived mig to active status.
func (UnarchiveMigCommand) Run ¶
func (c UnarchiveMigCommand) Run(ctx context.Context) (UnarchiveMigResult, error)
Run executes PATCH /v1/migs/{mig_ref}/unarchive to unarchive a mig.