sync

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Feb 3, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Comment

type Comment struct {
	ID        string
	Body      string
	Author    string
	CreatedAt time.Time
}

Comment represents a single comment on a syncable item.

type Item

type Item struct {
	ID        string // The unique ID on the remote platform (e.g., issue number "123").
	Type      string // "issue" or "pull_request".
	Title     string
	Body      string
	State     string // "open", "closed", "merged", etc.
	URL       string
	Labels    []string
	Assignees []string
	Milestone string
	UpdatedAt time.Time
	Comments  []*Comment
}

Item represents a generic syncable entity.

type Provider

type Provider interface {
	// Name returns the provider's name (e.g., "github").
	Name() string
	// Sync fetches all relevant items from the remote.
	Sync(config map[string]string, repoPath string) ([]*Item, error)
	// CreateItem creates a new item on the remote and returns the created item.
	CreateItem(item *Item, repoPath string) (*Item, error)
	// UpdateItem pushes changes for a single item to the remote and returns the updated item.
	UpdateItem(item *Item, repoPath string) (*Item, error)
	// AddComment posts a new comment to an item.
	AddComment(itemType, itemID, body, repoPath string) error
	// GetItem fetches a single item from the remote.
	GetItem(itemType, itemID, repoPath string) (*Item, error)
}

Provider defines the interface for a source of syncable items (e.g., GitHub).

type ProviderFactory

type ProviderFactory func() Provider

ProviderFactory is a function that creates a Provider instance.

type Report

type Report struct {
	Provider  string
	Created   int
	Updated   int
	Unchanged int
	Failed    int
	Errors    []string // Detailed error messages
}

Report summarizes the results of a sync operation.

type SyncConfig

type SyncConfig struct {
	Provider   string `mapstructure:"provider"`
	IssuesType string `mapstructure:"issues_type"`
	PRsType    string `mapstructure:"prs_type"`
}

SyncConfig holds the configuration for a single sync provider for a notebook.

func GetSyncConfigForNotebook

func GetSyncConfigForNotebook(cfg *coreconfig.Config, notebookName string) ([]SyncConfig, error)

GetSyncConfigForNotebook extracts the sync configurations for a specific notebook from the global grove.yml configuration.

type Syncer

type Syncer struct {
	// contains filtered or unexported fields
}

Syncer orchestrates the synchronization process.

func NewSyncer

func NewSyncer(svc *service.Service) *Syncer

NewSyncer creates a new Syncer.

func (*Syncer) RegisterProvider

func (s *Syncer) RegisterProvider(name string, factory ProviderFactory)

RegisterProvider registers a provider factory for a given provider name.

func (*Syncer) SyncWorkspace

func (s *Syncer) SyncWorkspace(ctx *service.WorkspaceContext) ([]*Report, error)

SyncWorkspace syncs a given workspace with its configured remote providers.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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