Artifact 08c84d3d4fa80b0606c362b37f567a48a066036b93f35bde00865563cb34073e:
- File
cli/sync_start.go
— part of check-in
[38efed7a12]
at
2026-08-12 20:50:57
on branch main
— chore(deps): migrate to go-libfossil v0.9.0 (#195)
* chore(deps): migrate to go-libfossil v0.9.0 (renamed module path)
- import path danmestas/libfossil → danmestas/go-libfossil everywhere - CloneOpts.ProjectCode removed upstream; assert via CloneResult instead - Timeline now takes TimelineOpts (cursor pagination, newest-first) - testutil.HasFossil removed; check FossilBinary() != ""
* ci: retrigger checks
---------
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> (user: [email protected], size: 1682) [annotate] [blame] [check-ins using]
package cli import ( "fmt" "log/slog" "os" "os/signal" "syscall" "time" "github.com/danmestas/EdgeSync/leaf/agent" libfossilcli "github.com/danmestas/go-libfossil/cli" ) // SyncCmd is the top-level command group for leaf agent sync. type SyncCmd struct { Start SyncStartCmd `cmd:"" help:"Start leaf agent daemon"` Now SyncNowCmd `cmd:"" help:"Trigger immediate sync"` } type SyncStartCmd struct { NATSUrl string `help:"NATS server URL" default:"nats://localhost:4222"` PollInterval time.Duration `help:"Sync poll interval" default:"5s"` Push bool `help:"Enable push" default:"true" negatable:""` Pull bool `help:"Enable pull" default:"true" negatable:""` UV bool `help:"Sync unversioned files" default:"false"` Notify bool `help:"Enable notify messaging (requires notify.fossil next to repo)" default:"false"` } func (c *SyncStartCmd) Run(g *libfossilcli.Globals) error { if g.Repo == "" { return fmt.Errorf("repository required (use -R <path>)") } a, err := agent.New(agent.Config{ RepoPath: g.Repo, NATSUpstream: c.NATSUrl, PollInterval: c.PollInterval, Push: c.Push, Pull: c.Pull, UV: c.UV, NotifyEnabled: c.Notify, }) if err != nil { return fmt.Errorf("agent: %w", err) } if err := a.Start(); err != nil { return fmt.Errorf("start: %w", err) } slog.Info("edgesync sync agent running", "repo", g.Repo, "nats", c.NATSUrl, "poll", c.PollInterval, "notify", c.Notify) sig := make(chan os.Signal, 1) signal.Notify(sig, syscall.SIGINT, syscall.SIGTERM) <-sig slog.Info("shutting down") return a.Stop() }