Documentation
¶
Index ¶
- func AddCommand(runner git.Runner) *cli.Command
- func ArchiveCommand(runner git.Runner) *cli.Command
- func ConfigCommand() *cli.Command
- func DeleteCommand(runner git.Runner) *cli.Command
- func ExecCommand() *cli.Command
- func NewCommand(runner git.Runner) *cli.Command
- func PathCommand() *cli.Command
- func PushCommand(runner git.Runner) *cli.Command
- func RebaseCommand(runner git.Runner) *cli.Command
- func RemoveCommand(runner git.Runner) *cli.Command
- func RepoCommand(runner git.Runner) *cli.Command
- func RunFetch(cfg *config.Config, runner git.Runner, args []string, out io.Writer) error
- func RunRepoArchive(cfg *config.Config, runner git.Runner, args RepoArchiveArgs, out io.Writer) error
- func RunRepoStatus(cfg *config.Config, runner git.Runner, args []string, long bool, out io.Writer) error
- func RunRepoUnarchive(cfg *config.Config, args RepoUnarchiveArgs, out io.Writer) error
- func RunSpaceAdd(cfg *config.Config, runner git.Runner, args SpaceAddArgs, out io.Writer) error
- func RunSpaceDelete(cfg *config.Config, runner git.Runner, args SpaceDeleteArgs, in io.Reader, ...) error
- func RunSpaceExec(spaceName string, args []string, parallel bool, out io.Writer) error
- func RunSpaceNew(cfg *config.Config, runner git.Runner, args SpaceNewArgs, out io.Writer) error
- func RunSpacePush(runner git.Runner, spaceName string, out io.Writer) error
- func RunSpaceRebase(runner git.Runner, spaceName, onto string, progress bool, out io.Writer) error
- func RunSpaceRemove(cfg *config.Config, runner git.Runner, args SpaceRemoveArgs, in io.Reader, ...) error
- func RunSpaceStatus(runner git.Runner, names []string, detailed bool, out io.Writer) error
- func RunSync(cfg *config.Config, runner git.Runner, args []string, progress bool, ...) error
- func StatusCommand(runner git.Runner) *cli.Command
- func UnarchiveCommand() *cli.Command
- type RepoArchiveArgs
- type RepoUnarchiveArgs
- type SpaceAddArgs
- type SpaceDeleteArgs
- type SpaceNewArgs
- type SpaceRemoveArgs
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddCommand ¶
AddCommand returns the `wtg add` command.
func ArchiveCommand ¶ added in v1.6.0
ArchiveCommand returns the `wtg repo archive` subcommand.
func ConfigCommand ¶
ConfigCommand returns the `wtg config` command group. With no subcommand it prints the resolved config file's raw contents.
func DeleteCommand ¶
DeleteCommand returns the `wtg delete` command.
func NewCommand ¶
NewCommand returns the `wtg new` command.
func PathCommand ¶
PathCommand returns the `wtg path` command (hidden; used by shell wcd functions).
func PushCommand ¶
PushCommand returns the `wtg push` command.
func RebaseCommand ¶ added in v1.7.0
RebaseCommand returns the `wtg rebase` command.
func RemoveCommand ¶
RemoveCommand returns the `wtg remove` command.
func RepoCommand ¶
RepoCommand returns the `wtg repo` command with its subcommands.
func RunFetch ¶
RunFetch fetches from origin for each repo without fast-forwarding. If args is empty, all discovered repos are fetched. Otherwise args are short names (relative to a discovery root dir) to fetch.
func RunRepoArchive ¶ added in v1.6.0
func RunRepoArchive(cfg *config.Config, runner git.Runner, args RepoArchiveArgs, out io.Writer) error
RunRepoArchive moves one or more main repo clones into archive.root_dir and records their provenance. It never deletes anything. Pending work (uncommitted files, commits not on any remote, stashes) aborts the run unless args.Force is set; a clone that is in use (live or stale worktrees, referenced by a space, or listed in always.repos) aborts the run unconditionally.
With args.Remote, each repo is also archived upstream on GitHub via gh, after an auth pre-flight and as part of the same saga, so a failure rolls the local moves back. See docs/adr/0013-repo-archive.md.
func RunRepoStatus ¶
func RunRepoStatus(cfg *config.Config, runner git.Runner, args []string, long bool, out io.Writer) error
RunRepoStatus prints a status table for all discovered repos (or the named subset). Each row shows the repo name, current branch, working-tree state, and ahead/behind counts relative to origin. When long is true, the remote URL and absolute path are appended in a muted style.
func RunRepoUnarchive ¶ added in v1.6.0
RunRepoUnarchive restores one or more archived repo clones to the exact paths recorded when they were archived, and removes their provenance records. It never deletes anything. With args.Remote each repo is also unarchived upstream on GitHub, after an auth pre-flight and as part of the same saga, so a failure rolls the local restores back. See docs/adr/0013-repo-archive.md.
func RunSpaceAdd ¶
RunSpaceAdd adds one or more repos to a workspace by creating worktrees on the space's branch and updating the go.work file and state. If a requested repo is currently a symlink in the space (added via always.repos), the symlink is replaced with a proper worktree on the space's branch.
func RunSpaceDelete ¶
func RunSpaceDelete(cfg *config.Config, runner git.Runner, args SpaceDeleteArgs, in io.Reader, out io.Writer) error
RunSpaceDelete removes all worktrees belonging to a space. If -d or -D is set, branches are also deleted. Prompts the user when uncommitted changes or unpushed commits are detected; only deletes state once all removals succeed.
func RunSpaceExec ¶
RunSpaceExec runs a command in each worktree of the named space. When parallel is false it runs sequentially, streaming output as it goes. When parallel is true all commands run concurrently; a progress indicator (matching the sync --progress style) shows live status, and each repo's complete buffered output is printed serially in repo order once all commands have finished. In both modes execution continues past failures and all failed repos are reported at the end.
func RunSpaceNew ¶
RunSpaceNew creates a new workspace, checking out a worktree in each selected repo and writing a go.work file if any repos are Go modules. Repos listed in cfg.Always.Repos are symlinked into the space unless they are also explicitly named in args.Repos (in which case they get a worktree). Files listed in cfg.Always.Files are copied into the space root. Paths in cfg.Always.Secrets are copied from each source repo into its worktree when present.
func RunSpacePush ¶
RunSpacePush pushes each repo's branch to origin in parallel.
func RunSpaceRebase ¶ added in v1.7.0
RunSpaceRebase fetches origin and rebases each repo's workspace branch onto its base branch in parallel. See docs/adr/0018-workspace-rebase.md.
func RunSpaceRemove ¶
func RunSpaceRemove(cfg *config.Config, runner git.Runner, args SpaceRemoveArgs, in io.Reader, out io.Writer) error
RunSpaceRemove removes one or more repos from a workspace by deleting their worktrees and updating the go.work file and state. It mirrors the safety checks of RunSpaceDelete: uncommitted changes and unpushed commits prompt for confirmation before proceeding.
Special handling for always.repos entries: if the removed repo is in cfg.Always.Repos and was a real worktree (not already a symlink), a symlink is restored in its place rather than leaving the repo absent from the space. Removing a repo that is currently a symlink leaves it absent (the user explicitly opted out for this space).
func RunSpaceStatus ¶
RunSpaceStatus shows workspace status. With no arguments it prints per-repo detail for every space; the space containing the current directory is shown first. With named spaces it shows full per-repo detail for each. The --detailed flag adds individual modified-file listings under each repo row.
func RunSync ¶
func RunSync(cfg *config.Config, runner git.Runner, args []string, progress bool, out io.Writer) error
RunSync fetches and fast-forwards each repo's default branch. If args is empty, all discovered repos are synced. Otherwise, args are short names (relative to a discovery root dir) to sync. When progress is true, a bracketed row of placeholder dots is printed upfront — one per repo — and each dot is replaced in-place with the result symbol (✓ ↑ ⚠ !) as soon as that repo finishes, by reprinting the whole line from column 0 with \r.
func StatusCommand ¶
StatusCommand returns the top-level `wtg status` command.
func UnarchiveCommand ¶ added in v1.6.0
UnarchiveCommand returns the `wtg repo unarchive` subcommand.
Types ¶
type RepoArchiveArgs ¶ added in v1.6.0
type RepoArchiveArgs struct {
Repos []string // repo names to archive (at least one)
Force bool // proceed despite pending work
DryRun bool // report the plan without moving anything
ArchiveDir string // overrides cfg.Archive.RootDir when non-empty
Remote bool // also archive each repo upstream on GitHub via gh
// GH is the gh client used when Remote is set. It is nil in normal use (the
// system gh CLI is used); tests inject a fake here.
GH remote.Runner
}
RepoArchiveArgs holds the parsed arguments for RunRepoArchive.
type RepoUnarchiveArgs ¶ added in v1.6.0
type RepoUnarchiveArgs struct {
Repos []string // archived repo names to restore (at least one)
DryRun bool // report the plan without moving anything
Remote bool // also unarchive each repo upstream on GitHub via gh
ArchiveDir string // overrides cfg.Archive.RootDir when non-empty
// GH is the gh client used when Remote is set. It is nil in normal use (the
// system gh CLI is used); tests inject a fake here.
GH remote.Runner
}
RepoUnarchiveArgs holds the parsed arguments for RunRepoUnarchive.
type SpaceAddArgs ¶
SpaceAddArgs holds the parsed arguments for RunSpaceAdd.
type SpaceDeleteArgs ¶
type SpaceDeleteArgs struct {
Name string
DeleteBranch bool // -d: delete branch if fully merged
ForceBranch bool // -D: force-delete branch regardless of merge state
}
SpaceDeleteArgs holds the parsed arguments for RunSpaceDelete.
type SpaceNewArgs ¶
type SpaceNewArgs struct {
Name string
Branch string // overrides cfg.Git.BranchPrefix+Name when set
Path string // overrides cfg.Spaces.RootDir/Name when set
Base string // commit-ish to branch from (default: HEAD)
Repos []string // short names; at least one required
}
SpaceNewArgs holds the parsed arguments for RunSpaceNew.
type SpaceRemoveArgs ¶
type SpaceRemoveArgs struct {
Name string
Repos []string // short names of repos to remove (required)
DeleteBranch bool // -d: delete branch if fully merged
ForceBranch bool // -D: force-delete branch regardless of merge state
}
SpaceRemoveArgs holds the parsed arguments for RunSpaceRemove.