Let server init ask for what it needs, and node add take several nodes

In a terminal and without --admin, server init shows a short form: the
administrator's email, the other names nodes will use (with the addresses
it found), SQLite or PostgreSQL, and the mirror, node and starter model.
Its own lines then fill in as a list — read from the writer init already
uses, so nothing in init changed — with downloads updating in place and the
password in a box until the end. The whole run, password included, is
printed again when the screen closes, so it is in the terminal's history.
The last screen says how to add a node and to back up the authority's key.

node add takes several addresses and adds them in turn, with a summary.
Suggested fabrics carry what the adapters report them to be, so a name
given for one node is used for the next on the same fabric without asking.

Tried on empty VMs: init from the form through to the starter model
serving, and two nodes added to that cluster in one command. The first
attempt at the form lost its keystrokes to the terminal colour query in a
pseudo-terminal that never answers it; a real terminal does.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Ilker ManapandClaude Opus 5.5 committed 2026-09-29 21:54:18 +02:00
1 parent 7071c67487
commit a1b5daceb8
9 files changed
+670 -42

No files matched your search

+12 -11
View File
@@ -176,7 +176,7 @@ func (m nodeModel) key(k tea.KeyMsg) (tea.Model, tea.Cmd) {
var out []onboard.Fabric
for i, in := range m.inputs {
if name := strings.TrimSpace(in.Value()); name != "" {
out = append(out, onboard.Fabric{Name: name, HCAs: m.fabrics.suggested[i].HCAs})
out = append(out, onboard.Fabric{Name: name, HCAs: m.fabrics.suggested[i].HCAs, Key: m.fabrics.suggested[i].Key})
}
}
m.fabrics.reply <- out
@@ -297,15 +297,15 @@ func wrap(s string, width int, indent string) string {
return strings.Join(lines, "\n"+indent)
}
// runTUI adds the node with the screen above.
func (na *nodeAdd) runTUI(ctx context.Context) error {
// runTUI adds one node with the screen above.
func (na *nodeAdd) runTUI(ctx context.Context, o onboard.Options, title string) (string, error) {
ctx, cancel := context.WithCancel(ctx)
defer cancel()
m := newNodeModel("llmgw · adding "+na.opts.Addr, cancel)
m := newNodeModel(title, cancel)
p := tea.NewProgram(m)
emit := func(e onboard.Event) { p.Send(evMsg(e)) }
na.opts.AskFabrics = func(s []onboard.Fabric) []onboard.Fabric {
o.AskFabrics = na.rememberFabrics(func(s []onboard.Fabric) []onboard.Fabric {
reply := make(chan []onboard.Fabric)
p.Send(askFabricsMsg{s, reply})
select {
@@ -314,8 +314,8 @@ func (na *nodeAdd) runTUI(ctx context.Context) error {
case <-ctx.Done():
return nil
}
}
na.opts.AskContinue = func(fails int) bool {
})
o.AskContinue = func(fails int) bool {
reply := make(chan bool)
p.Send(askContinueMsg{fails, reply})
select {
@@ -327,7 +327,7 @@ func (na *nodeAdd) runTUI(ctx context.Context) error {
}
go func() {
res, err := onboard.New(na.opts, emit).Run(ctx)
res, err := onboard.New(o, emit).Run(ctx)
node := ""
if res != nil {
node = res.Node
@@ -344,11 +344,12 @@ func (na *nodeAdd) runTUI(ctx context.Context) error {
final, err := p.Run()
if err != nil {
return err
return "", err
}
fm := final.(nodeModel)
if fm.quitAsked && !fm.done {
return fmt.Errorf("stopped; the node may be half set up, and running this again finishes it")
cancel()
return fm.node, fmt.Errorf("stopped; the node may be half set up, and running this again finishes it")
}
return fm.err
return fm.node, fm.err
}