Skip to content

Commit 1121f9f

Browse files
wesmclaude
andcommitted
docs(sync): document config-driven remote_hosts in help
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent d66ed1b commit 1121f9f

2 files changed

Lines changed: 33 additions & 2 deletions

File tree

cmd/agentsview/cli.go

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,16 @@ func newServeCommand() *cobra.Command {
100100
func newSyncCommand() *cobra.Command {
101101
var cfg SyncConfig
102102
cmd := &cobra.Command{
103-
Use: "sync",
104-
Short: "Sync session data without serving",
103+
Use: "sync",
104+
Short: "Sync session data without serving",
105+
Long: "Sync session data into the local database without starting the\n" +
106+
"HTTP server.\n\n" +
107+
"With no --host, sync runs the local sync and then fans out to\n" +
108+
"every host listed in the [[remote_hosts]] array in config.toml,\n" +
109+
"syncing each over SSH. A failure on one configured host is logged\n" +
110+
"and the run continues; the command exits non-zero if any\n" +
111+
"configured host failed.\n\n" +
112+
"With --host, sync ignores remote_hosts and syncs only that host.",
105113
GroupID: groupCore,
106114
SilenceUsage: true,
107115
Args: cobra.NoArgs,
@@ -483,6 +491,14 @@ func writeRootHelp(w io.Writer, root *cobra.Command) {
483491
fmt.Fprintln(w, " When set, these override default directory. Environment variables")
484492
fmt.Fprintln(w, " override config file arrays.")
485493
fmt.Fprintln(w)
494+
fmt.Fprintln(w, "Remote hosts:")
495+
fmt.Fprintln(w, " Add a [[remote_hosts]] array to ~/.agentsview/config.toml so that")
496+
fmt.Fprintln(w, " \"agentsview sync\" (no --host) also syncs each host over SSH:")
497+
fmt.Fprintln(w, " [[remote_hosts]]")
498+
fmt.Fprintln(w, " host = \"devbox1\"")
499+
fmt.Fprintln(w, " user = \"jesse\" # optional")
500+
fmt.Fprintln(w, " port = 22 # optional")
501+
fmt.Fprintln(w)
486502
fmt.Fprintln(w, "Data stored in ~/.agentsview/ by default.")
487503
}
488504

cmd/agentsview/cli_test.go

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,3 +175,18 @@ func TestExecuteCLIWithLegacyFlagCompatWarnsOnce(t *testing.T) {
175175
want := "warning: deprecated single-dash long flags detected; use GNU-style long flags instead: -version -> --version\n"
176176
assert.Equal(t, want, stderr.String())
177177
}
178+
179+
func TestRootHelpDocumentsRemoteHosts(t *testing.T) {
180+
help, err := executeCommand(newRootCommand(), "--help")
181+
require.NoError(t, err, "Execute")
182+
assert.Contains(t, help, "remote_hosts",
183+
"root help should document the remote_hosts config block")
184+
}
185+
186+
func TestSyncHelpMentionsConfiguredHosts(t *testing.T) {
187+
help, err := executeCommand(newRootCommand(), "sync", "--help")
188+
require.NoError(t, err, "Execute")
189+
for _, want := range []string{"remote_hosts", "--host"} {
190+
assert.Contains(t, help, want, "sync help missing %q", want)
191+
}
192+
}

0 commit comments

Comments
 (0)