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.
Index ¶
- type AddMigCommand
- type AddMigRepoCommand
- type ArtifactsCommand
- type CreateMigRunCommand
- type CreateMigRunResult
- type ImportMigReposCommand
- type ListMigReposCommand
- type MigPullCommand
- type PullMode
- type RemoveMigCommand
- type RemoveMigRepoCommand
- type ResolveMigByNameCommand
- type RunPullCommand
- type SetMigArchivedCommand
- type SetMigSpecCommand
- type SetMigSpecResult
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) (domainapi.MigSummary, 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 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.
GitLabToken string
}
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 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) (domainapi.MigRepoImportResponse, error)
Run executes POST /v1/migs/{mig_id}/repos/bulk to import repos from CSV.
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 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) (*domainapi.PullResolutionResponse, 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 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) (*domainapi.PullResolutionResponse, error)
Run executes POST /v1/runs/{run_id}/pull with no request body.
type SetMigArchivedCommand ¶
type SetMigArchivedCommand struct {
Client *http.Client
BaseURL *url.URL
MigRef types.MigRef // Required: mig ID or name.
Archived bool
}
SetMigArchivedCommand sets the archived state of a mig project.
func (SetMigArchivedCommand) Run ¶
func (c SetMigArchivedCommand) Run(ctx context.Context) (domainapi.MigArchiveResponse, error)
Run executes the archive or unarchive endpoint selected by Archived.
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.