cmd

package
v0.5.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 1, 2026 License: MIT Imports: 30 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetInitScript

func GetInitScript(shell string) string

getInitScript returns the shell integration script for the given shell

func IsInTmux

func IsInTmux() bool

inTmux returns true if running inside tmux

func IsMCPManageSubcommand added in v0.3.0

func IsMCPManageSubcommand(s string) bool

IsMCPManageSubcommand reports whether `nib mcp <s>` is a management command (as opposed to the server-serving forms: bare, --http, --stdio, --addr).

func RunCLI

func RunCLI(ctx context.Context, cfg types.Config, streams Streams, shellJobs *wizmcp.ShellJobs, transports ...mcp.Transport) error

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

func RunMCPCommand(baseDir string, args []string) int

RunMCPCommand dispatches `nib mcp <sub> ...` and returns an exit code. baseDir overrides the config/plugins/skills root; empty means nib's default.

func RunPluginCommand

func RunPluginCommand(baseDir string, args []string) int

RunPluginCommand dispatches `nib plugin <sub> ...` and returns an exit code. baseDir overrides the config/plugins/skills root; empty means nib's default.

func RunSkillCommand

func RunSkillCommand(baseDir string, args []string) int

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

func RunTmuxSplit(height string) error

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

type Streams struct {
	In  io.Reader
	Out io.Writer
	Err io.Writer
}

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL