sync

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Jun 7, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package sync exporta los commits de nem a JSONL versionable por git, los sincroniza con un remoto, y reimporta lo que llega. El scrubbing de secretos corre SIEMPRE en la exportación: es la única frontera por la que el contenido sale de la máquina.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Clone

func Clone(url, dir string) error

Clone clona url en dir (que no debe existir o estar vacío).

func EnsureRepo

func EnsureRepo(dir string) error

EnsureRepo inicializa el repo git en dir (si no lo es) y escribe el .gitignore que excluye la DB binaria y la config local.

func RemoteAdd

func RemoteAdd(dir, name, url string) error

RemoteAdd configura el remote del store.

func RemoteList

func RemoteList(dir string) (string, error)

RemoteList devuelve los remotes configurados (`git remote -v`).

Types

type Option

type Option func(*config) error

Option configura el Syncer.

func WithDir

func WithDir(dir string) Option

WithDir fija el directorio del store (default ~/.nem, vía paths del caller).

func WithRedactor

func WithRedactor(r redact.Redactor) Option

WithRedactor inyecta un redactor propio (default redact.New()).

func WithRemote

func WithRemote(name string) Option

WithRemote fija el nombre del remote (default "origin").

type Report

type Report struct {
	Exported int
	Imported int
	Redacted map[string]int
	Pushed   bool
}

Report resume una corrida de sync.

type Syncer

type Syncer interface {
	// Sync ejecuta el ciclo completo export → git → import.
	Sync() (*Report, error)
	// Import solo reimporta los archivos de commit del store a la DB (para clone).
	Import() (int, error)
}

Syncer orquesta export → git → import.

func NewSyncer

func NewSyncer(store db.Store, options ...Option) (Syncer, error)

NewSyncer crea un Syncer. dir es obligatorio (raíz del store, p.ej. ~/.nem).

Jump to

Keyboard shortcuts

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