gitlink-cli/cmd
刘焱 b2136559bf fix(interactive): initialize RuntimeContext via NewRuntimeContext to prevent nil-Client panic
Selecting a command showed no output because Execute built the
RuntimeContext as a bare struct literal (&RuntimeContext{Args: args}),
leaving Client == nil. Any command calling ctx.CallAPI then panicked with
a nil pointer dereference inside the executor goroutine; the panic aborted
the goroutine before w.Close()/stdout restore, so the execResultMsg never
fired and the REPL hung silently.

Fix: use common.NewRuntimeContext(args) (initializes Client/Format/Owner/Repo,
matching runner.go), and wrap s.Run in safeRun() so a panic converts to an
error and stdout is always restored.

Adds regression tests: nil-Client assertion, panic-safe stdout restore, and
an end-to-end test that runs the real repo +list shortcut and asserts
Execute never returns (empty output, nil error).
2026-06-08 19:16:40 +08:00
..
api init gitlink-cli 2026-04-17 10:01:30 +08:00
auth feat: add user account settings shortcuts and OAuth2 authentication 2026-06-02 08:57:52 +08:00
cmdutil feat: optimize existing commands (P1-P4) 2026-06-04 10:45:32 +08:00
config init gitlink-cli 2026-04-17 10:01:30 +08:00
interactive fix(interactive): initialize RuntimeContext via NewRuntimeContext to prevent nil-Client panic 2026-06-08 19:16:40 +08:00
root.go feat(interactive): add REPL with command palette, form, and cobra entry 2026-06-08 18:52:23 +08:00