synclone

package
v0.0.0-...-066f56d Latest Latest
Warning

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

Go to latest
Published: Aug 21, 2026 License: MIT Imports: 32 Imported by: 0

Documentation

Overview

Package synclone provides commands for synchronizing and cloning repositories from GitHub, GitLab, Gitea, and other Git platforms.

Package synclone provides CLI commands for bulk repository synchronization across multiple Git forge providers (GitHub, GitLab, Gitea).

The forge subcommand uses the gzh-cli-gitforge orchestration engine with gzh-cli-gitforge providers to enable unified, resumable sync operations with parallel execution and progress tracking.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewSyncCloneCmd

func NewSyncCloneCmd(appCtx *app.AppContext) *cobra.Command

NewSyncCloneCmd creates a new cobra command for synchronous repository cloning. This command enables cloning multiple repositories from various Git hosting services including GitHub, GitLab, Gitea, and Gogs using configuration files or command-line flags.

ctx를 받지 않는다. 예전에는 받았지만 RunE가 cmd.Context()를 쓰게 되면서 쓰이지 않게 되었고, 애초에 준 쪽(register.go)이 넣던 값은 취소되지 않는 context.Background()였다. 남겨 두면 진짜 맥락처럼 보인다.

Returns a configured cobra.Command ready for execution.

func RegisterSyncCloneCmd

func RegisterSyncCloneCmd(appCtx *app.AppContext)

func WriteForgeGzhYaml

func WriteForgeGzhYaml(opts GzhYamlWriteOptions, repos []ForgeGzhRepo) error

WriteForgeGzhYaml writes a gzh.yaml for the given repository list. It creates the target directory when missing.

Types

type ForgeGzhRepo

type ForgeGzhRepo struct {
	Name        string `yaml:"name"`
	CloneURL    string `yaml:"clone_url"`
	Description string `yaml:"description,omitempty"`
	Private     bool   `yaml:"private,omitempty"`
	Archived    bool   `yaml:"archived,omitempty"`
	Fork        bool   `yaml:"fork,omitempty"`
}

ForgeGzhRepo is a provider-agnostic repository entry written to gzh.yaml. Field names align with common clone metadata (name + clone URL required).

func GzhReposFromPlan

func GzhReposFromPlan(plan reposync.Plan) []ForgeGzhRepo

GzhReposFromPlan extracts clone/update repo entries from a forge plan. Delete/skip-only actions without a clone URL are omitted.

func TryReuseForgeGzhYaml

func TryReuseForgeGzhYaml(targetPath, organization, provider string) ([]ForgeGzhRepo, bool, error)

TryReuseForgeGzhYaml loads existing gzh.yaml when organization and provider match. Returns (repos, true, nil) on reuse, (nil, false, nil) when no reusable file.

type ForgeGzhYamlConfig

type ForgeGzhYamlConfig struct {
	Organization string         `yaml:"organization"`
	Provider     string         `yaml:"provider"`
	GeneratedAt  time.Time      `yaml:"generated_at"`
	SyncMode     SyncMode       `yaml:"sync_mode"`
	Repositories []ForgeGzhRepo `yaml:"repositories"`
}

ForgeGzhYamlConfig is the multi-provider gzh.yaml written by the forge path.

func LoadForgeGzhYaml

func LoadForgeGzhYaml(targetPath string) (*ForgeGzhYamlConfig, error)

LoadForgeGzhYaml loads a forge-format gzh.yaml from the target directory. Returns (nil, error) when the file is missing or invalid.

type GzhYamlConfig

type GzhYamlConfig struct {
	Organization string            `yaml:"organization"`
	Provider     string            `yaml:"provider"`
	GeneratedAt  time.Time         `yaml:"generated_at"`
	SyncMode     SyncMode          `yaml:"sync_mode"`
	Repositories []github.RepoInfo `yaml:"repositories"`
}

GzhYamlConfig represents the structure of gzh.yaml file generated in target directory

type GzhYamlWriteOptions

type GzhYamlWriteOptions struct {
	TargetPath     string
	Organization   string
	Provider       string
	CleanupOrphans bool
}

GzhYamlWriteOptions configures forge gzh.yaml generation.

type SyncMode

type SyncMode struct {
	CleanupOrphans bool `yaml:"cleanup_orphans"`
}

SyncMode represents synchronization configuration

Jump to

Keyboard shortcuts

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