migs

package
v0.1.18-rc14 Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2026 License: MIT Imports: 16 Imported by: 0

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

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

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

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.

func (ArtifactsCommand) Run

Run performs GET /v1/runs/{id}/status and prints per-stage artifacts.

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

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

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

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

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.

const (
	// PullModeLastSucceeded selects the newest terminal run with status=Success (default).
	PullModeLastSucceeded PullMode = "last-succeeded"
	// PullModeLastFailed selects the newest terminal run with status=Fail.
	PullModeLastFailed PullMode = "last-failed"
)

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.

func (RemoveMigCommand) Run

Run executes DELETE /v1/migs/{mig_ref} to delete a mig.

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.

func (RemoveMigRepoCommand) Run

Run executes DELETE /v1/migs/{mig_id}/repos/{repo_id} to delete a 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

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

type RunPullCommand struct {
	Client  *http.Client
	BaseURL *url.URL
	RunID   domaintypes.RunID
}

RunPullCommand resolves execution identifiers and source metadata for a run. Endpoint: POST /v1/runs/{run_id}/pull

func (RunPullCommand) Run

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

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

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.

Jump to

Keyboard shortcuts

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