Documentation
¶
Overview ¶
Package workspacecli provides CLI commands for managing local workspaces with config-based repository synchronization.
This package handles local config file operations:
- workspace init: Create empty config file
- workspace scan: Scan directory for git repos and generate config
- workspace sync: Clone/update repos based on config
- workspace status: Check workspace health
- workspace add: Add repository to config
- workspace validate: Validate config file
For Forge API operations (GitHub, GitLab, Gitea), use reposynccli package.
Index ¶
- Constants
- Variables
- type AddOptions
- type CommandFactory
- type ConfigData
- type ConfigKind
- type ConfigType
- type ConflictInfo
- type FileChangeSummary
- type FileSpecLoader
- type InitOptions
- type PlanningSpinnerModel
- type RepoChanges
- type SpecLoader
- type SyncProgressModel
- type SyncRepoJSON
- type SyncResultJSON
- type TreeNode
- type ValidationResult
Constants ¶
const ( ConflictTypeLocalChanges = "local-changes" ConflictTypeDivergedBranches = "diverged-branches" ConflictTypeDirtyWorktree = "dirty-worktree" )
ConflictType constants
const ( CloneKindGroups = "groups" CloneKindFlat = "flat" CloneKindGroup = "group" // deprecated alias for groups )
Clone config kind values.
const DefaultConfigFile = ".gz-git.yaml"
DefaultConfigFile is the default workspace config filename.
Variables ¶
var ValidCloneStrategies = []string{"skip", "pull", "reset", "rebase", "fetch"}
ValidCloneStrategies contains valid strategy values for clone config.
var ValidStrategies = []string{"reset", "pull", "rebase", "fetch", "skip"}
ValidStrategies for sync operations.
Functions ¶
This section is empty.
Types ¶
type AddOptions ¶
AddOptions holds options for the add command.
type CommandFactory ¶
CommandFactory builds workspace CLI commands.
func (CommandFactory) NewQuickSyncCmd ¶
func (f CommandFactory) NewQuickSyncCmd() *cobra.Command
NewQuickSyncCmd returns the top-level `gz-git sync` (alias: `gz-git s`) command.
Design principles:
- 무적(invincible): works from zero – runs init if config is missing
- Full parity with `gz-git workspace sync` flags
- --dry-run applies to auto-init too (no files written)
- Clear, actionable error messages when repos are not found
- Optional --check runs `workspace status` after sync
func (CommandFactory) NewRootCmd ¶
func (f CommandFactory) NewRootCmd() *cobra.Command
NewRootCmd returns the workspace root command.
type ConfigData ¶
type ConfigData struct {
Plan reposync.PlanRequest
Run reposync.RunOptions
}
ConfigData holds loaded configuration.
type ConfigKind ¶
type ConfigKind string
ConfigKind represents the type of configuration to generate.
const ( // KindWorkspace is the canonical hierarchical workspace format (default). KindWorkspace ConfigKind = "workspace" // KindRepositories is the flat repositories list format. KindRepositories ConfigKind = "repositories" )
const ( // KindWorkspaces is deprecated alias for KindWorkspace. KindWorkspaces ConfigKind = "workspaces" // KindRepository is deprecated alias for KindRepositories. KindRepository ConfigKind = "repository" )
Kind aliases (deprecated, will warn).
func NormalizeKind ¶
func NormalizeKind(kind string) (ConfigKind, string, error)
NormalizeKind normalizes kind value and returns canonical form. Returns (canonical kind, warning message, error).
type ConfigType ¶
type ConfigType string
ConfigType represents the detected configuration type.
const ( // ConfigTypeWorkspace is workspace/repositories config (.gz-git.yaml). ConfigTypeWorkspace ConfigType = "workspace" // ConfigTypeClone is clone config with named groups (repos-config.yaml). ConfigTypeClone ConfigType = "clone" // ConfigTypeUnknown is when the config type cannot be determined. ConfigTypeUnknown ConfigType = "unknown" )
type ConflictInfo ¶
type ConflictInfo struct {
FilePath string
ConflictType string // "local-changes", "diverged-branches", "dirty-worktree"
LocalChanges bool // Has uncommitted local changes
RemoteChanges bool // Has incoming remote changes
Description string // Human-readable description
}
ConflictInfo describes a detected conflict.
type FileChangeSummary ¶
FileChangeSummary holds file-level change statistics.
type FileSpecLoader ¶
type FileSpecLoader struct{}
FileSpecLoader loads specs from YAML files.
func (FileSpecLoader) Load ¶
func (l FileSpecLoader) Load(ctx context.Context, path string) (*ConfigData, error)
Load reads and parses a YAML config file.
type InitOptions ¶
type InitOptions struct {
Path string
Output string
Depth int
ExcludePattern string
IncludePattern string
NoGitIgnore bool
Force bool
Template bool
Kind string // repositories or workspaces
Strategy string // reset, pull, rebase, fetch, skip
ExplainDefaults bool // include commented defaults for omitted fields
}
InitOptions holds options for workspace init command.
type PlanningSpinnerModel ¶
type PlanningSpinnerModel struct {
// contains filtered or unexported fields
}
PlanningSpinnerModel shows a single-line spinner during the planning phase.
func (PlanningSpinnerModel) Init ¶
func (m PlanningSpinnerModel) Init() tea.Cmd
func (PlanningSpinnerModel) View ¶
func (m PlanningSpinnerModel) View() string
type RepoChanges ¶
type RepoChanges struct {
RepoName string
Action reposync.ActionType
Path string
URL string
Files FileChangeSummary
Conflicts []ConflictInfo
Warnings []string
Diverged bool // Tracks if local branch has diverged from remote
}
RepoChanges holds detailed change information for a single repository.
type SpecLoader ¶
type SpecLoader interface {
Load(ctx context.Context, path string) (*ConfigData, error)
}
SpecLoader loads sync specifications from various sources.
type SyncProgressModel ¶
type SyncProgressModel struct {
// contains filtered or unexported fields
}
SyncProgressModel is a Bubble Tea model for displaying sync progress in an alternate screen buffer. It supports viewport scrolling when the repository list exceeds terminal height.
func (SyncProgressModel) Init ¶
func (m SyncProgressModel) Init() tea.Cmd
Init starts the spinner tick.
func (SyncProgressModel) View ¶
func (m SyncProgressModel) View() string
View renders the TUI in the alternate screen.
type SyncRepoJSON ¶
type SyncResultJSON ¶
type SyncResultJSON struct {
Total int `json:"total"`
Succeeded int `json:"succeeded"`
Failed int `json:"failed"`
Duration int64 `json:"duration_ms"`
Repos []SyncRepoJSON `json:"repositories"`
}
sync 결과 JSON 구조
type TreeNode ¶
type TreeNode struct {
Name string
Status string // "synced", "failed", "skipped"
Message string // compact status (e.g. "master|↓2")
Children []*TreeNode
}
TreeNode represents a node in the workspace hierarchy tree.
type ValidationResult ¶
type ValidationResult struct {
ConfigType ConfigType // Detected config type
Errors []string // Critical errors that must be fixed
Warnings []string // Deprecated or non-standard usage
Suggestions []string // Recommendations for improvement
}
ValidationResult holds the result of config validation.
func (*ValidationResult) HasIssues ¶
func (r *ValidationResult) HasIssues() bool
HasIssues returns true if there are any errors, warnings, or suggestions.
func (*ValidationResult) IsValid ¶
func (r *ValidationResult) IsValid() bool
IsValid returns true if there are no errors.