cli/enable: use Import/Skip confirm for single-agent import offer · Entire
cli/enable: use Import/Skip confirm for single-agent import offer
8142c50→main·
computermode·1w ago·1 file·+35 added/-3 removed
When only one agent is discoverable, the multi-select's "space to select, select none to skip" wording is confusing since there is nothing to choose between. Show a plain Import/Skip confirmation in that case instead; the multi-select is retained when multiple agents are eligible.
Co-Authored-By: Claude Opus 4.8 noreply@anthropic.com
Sessions
01KWW3KDRZ8DPKM1H8395SKWKJView transcript
Changes
1
cmd/entire/cli
Msetup_import.go+35/-3
115 unmodified lines
116
117
118
119
120
121
119
120
121
122
123
124
125
126
127
128
129
130
131
27 unmodified lines
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
115 unmodified lines
return nil
}
// promptImportSelection shows the agent multi-select (all unchecked) and
// returns the chosen subset. An empty selection (or user abort) returns an
// empty slice, which the caller treats as "skip import".
// promptImportSelection asks the user which discovered agents to import. With a
// single eligible agent a multi-select's "space to select / select none to
// skip" wording is confusing (there is nothing to choose between), so that case
// uses a plain Import/Skip confirmation instead. An empty selection (or user
// abort) returns an empty slice, which the caller treats as "skip import".
func promptImportSelection(ctx context.Context, w io.Writer, eligible []eligibleImport) ([]eligibleImport, error) {
if len(eligible) == 1 {
return promptImportConfirmSingle(ctx, w, eligible[0])
}
byName := make(map[string]eligibleImport, len(eligible))
options := make([]huh.Option[string], 0, len(eligible))
for _, e := range eligible {
27 unmodified lines
return out, nil
}
// promptImportConfirmSingle offers a single discovered agent's history with a
// plain Import/Skip confirmation. Declining (or aborting) returns an empty
// slice so the caller skips the import.
func promptImportConfirmSingle(ctx context.Context, w io.Writer, e eligibleImport) ([]eligibleImport, error) {
var confirmed bool
form := NewAccessibleForm(
huh.NewGroup(
huh.NewConfirm().
Title(fmt.Sprintf("Import existing %s sessions into Entire? (optional)", e.displayName)).
Description(fmt.Sprintf("%s from the last %d days. Enter to confirm.", pluralSessions(e.sessionCount), agentimport.LookbackDays)).
Affirmative("Import").
Negative("Skip").
Value(&confirmed),
),
)
if err := form.RunWithContext(ctx); err != nil {
// Cancellation (including a cancelled ctx) returns nil here => skip
// import; other errors are surfaced for the caller to downgrade.
return nil, handleFormCancellation(w, "Import", err)
}
if !confirmed {
return nil, nil
}
return []eligibleImport{e}, nil
}
// runSelectedImports imports each chosen agent's history, mirroring the
// standalone `entire import` command. Per-agent failures are logged and
// reported but do not stop the remaining imports or fail enable.