Artifact 3b3cfa08b71841c1537f80f227f67ac4f5cd0a170bd233dcf7f1bb3bdd30341c:
- File
cmd/edgesync/sync_start.go
— part of check-in
[eda7960b81]
at
2026-04-23 19:23:42
on branch trunk
— rename module to github.com/danmestas/EdgeSync
Fix the case-sensitive module path to match the actual GitHub repo URL (danmestas/EdgeSync). Remove tracked leaf/leaf binary and ignore .claude/skills/ scratchpad dirs. (user: [email protected], size: 1451) [annotate] [blame] [check-ins using] [more...]
package main import ( "fmt" "log/slog" "os" "os/signal" "syscall" "time" "github.com/danmestas/libfossil/cli" "github.com/danmestas/EdgeSync/leaf/agent" ) 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 *cli.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() }