gitops

package
v0.1.2 Latest Latest
Warning

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

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

Documentation

Overview

Package gitops 封裝所有 git 操作,根據 workspace config 決定 monorepo 或 multi-repo 模式。

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Branch

func Branch(featureID string) string

Branch 回傳 feature 對應的 branch 名稱(兩種模式共用)。

func CopyFileIfExists

func CopyFileIfExists(src, dst string) error

CopyFileIfExists 複製檔案,來源不存在時靜默忽略(回 nil);讀寫失敗回傳 error。供外部 package 使用。

func CopyFileIfNewer

func CopyFileIfNewer(src, dst string) (copied bool, err error)

CopyFileIfNewer 僅在來源比目標新(或目標不存在)時複製,用於差量化 worktree sync, 避免每輪 final sync 與每 2 秒 live-sync 對未變更檔案重複全量複製。 回傳是否實際複製、以及錯誤;來源不存在視為靜默成功(false, nil)。 比對採 mtime-only:dst 不存在則複製;兩者皆存在時 srcInfo.ModTime().After(dstInfo.ModTime()) 才複製。

func Dir

func Dir(root, featureID string) string

Dir 回傳 worktree 組合目錄的路徑(兩種模式共用)。

Types

type MergeResult

type MergeResult struct {
	Skipped      bool
	Conflict     bool
	Error        string
	Files        []string
	ConflictRepo string
}

MergeResult 描述 Merge 操作的結果。

type Ops

type Ops interface {
	SetupWorktree(featureID string) (wtRoot string, err error)
	Commit(wtRoot, featureID, msg string) error
	Merge(featureID, featureName string) MergeResult
	Cleanup(featureID string) error
	DetectChangedRepos() []string
	CaptureBaseline(featureID string, featureRepos []string) error
	IsMultiRepo() bool
}

Ops 封裝所有 git 操作,根據 workspace config 決定 monorepo 或 multi-repo 模式。

func New

func New(root string, ws *protocol.Workspace, cfg protocol.Config) Ops

New 根據 workspace config 建立對應的 Ops 實作。

Jump to

Keyboard shortcuts

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