Documentation
¶
Index ¶
- func GetInitScript(shell string) string
- func IsInTmux() bool
- func IsMCPManageSubcommand(s string) bool
- func RunCLI(ctx context.Context, cfg types.Config, streams Streams, ...) error
- func RunMCP(ctx context.Context, cfg types.Config, args []string, ...) error
- func RunMCPCommand(baseDir string, args []string) int
- func RunPluginCommand(baseDir string, args []string) int
- func RunSkillCommand(baseDir string, args []string) int
- func RunTUI(ctx context.Context, cfg types.Config, height int, streams Streams, ...) error
- func RunTmuxSplit(height string) error
- type Streams
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetInitScript ¶
getInitScript returns the shell integration script for the given shell
func IsMCPManageSubcommand ¶ added in v0.3.0
IsMCPManageSubcommand reports whether `nib mcp <s>` is a management command (as opposed to the server-serving forms: bare, --http, --stdio, --addr).
func RunMCP ¶ added in v0.2.0
func RunMCP(ctx context.Context, cfg types.Config, args []string, shellJobs *wizmcp.ShellJobs, transports ...mcp.Transport) error
RunMCP serves nib's agent as an MCP server. args are the tokens after `nib mcp`; shellJobs is the shared background-shell registry; transports are the agent's tool servers.
func RunMCPCommand ¶ added in v0.3.0
RunMCPCommand dispatches `nib mcp <sub> ...` and returns an exit code. baseDir overrides the config/plugins/skills root; empty means nib's default.
func RunPluginCommand ¶
RunPluginCommand dispatches `nib plugin <sub> ...` and returns an exit code. baseDir overrides the config/plugins/skills root; empty means nib's default.
func RunSkillCommand ¶
RunSkillCommand dispatches `nib skill <sub> ...` and returns an exit code. baseDir overrides the config/plugins/skills root; empty means nib's default.
func RunTUI ¶
func RunTUI(ctx context.Context, cfg types.Config, height int, streams Streams, shellJobs *wizmcp.ShellJobs, transports ...mcp.Transport) error
RunTUI runs the Bubble Tea TUI.
Only streams.stdout() is honored, for the shell-capture line at the end. The interactive rendering deliberately stays on /dev/tty: the whole reason this function opens it is that stdout may be a pipe while the terminal is still there, and an embedder's Stdout is exactly as likely to be a pipe as the shell widget's. Rendering into a non-terminal writer would produce a frozen TUI, which is worse than ignoring the injection. An embedder that wants nib's output on its own streams should use CLI mode, which honors all three.
func RunTmuxSplit ¶
runTmuxSplit runs nib in a tmux split pane (like fzf-tmux -d).
`tmux split-window` returns as soon as the pane is spawned, not when its command exits, so we can't capture the inner nib's selected command from its stdout directly. Instead the inner nib writes its command to a temp file and signals a tmux channel on exit; we block on that channel, then relay the file to our own stdout — which is what the Ctrl+Space shell widget captures.
Types ¶
type Streams ¶ added in v0.5.0
Streams are the I/O endpoints a front end reads from and writes to. A nil field means the matching process stream, so the zero value reproduces standalone nib exactly and an embedder overrides only what it cares about.
The fields stay nil-able rather than being defaulted at construction so that "nobody said anything" survives the trip from app.Options, which needs that distinction to gate the TUI. Nothing in this package inspects nil-ness: every read goes through the accessors below, which resolve it to the process stream.