Documentation
¶
Overview ¶
Package cli implements the interactive TolleCode CLI.
Index ¶
- Variables
- func MaterializeCloudAgent(configJSON string) (name string, skillNames []string, err error)
- func PrintComposerFooter(model, mode string, activeSkills []string, agentLabel string)
- func PrintHelp()
- func PrintIntro(workspace string, sessionCount int)
- func PrintReady(providerID, model, mode string)
- func PrintSubagentCards(subagents []map[string]any)
- func RenderAssistantMarkdown(src string, width int) string
- func Run(cfg Config)
- func RunConfigure(workspace string)
- func RunConfigureAdd()
- func RunConfigureRemoveByID(id string)
- func RunConfigureRemoveInteractive()
- func RunConfigureSetKey(providerID, key string)
- func RunConfigureSettings()
- func RunFilePicker(workspace, initialQuery string) string
- func RunMultiSelect(title string, items []pickItem, preselected []string) ([]string, bool)
- func RunSingleSelect(title string, items []pickItem, allowNone bool) (string, bool)
- type AgentPickerResult
- type Config
- type StreamRenderer
- type TolleREPL
Constants ¶
This section is empty.
Variables ¶
var Version = "3.0.1"
Version is the CLI version. It defaults to the value below and is overridden at build time via:
-ldflags "-X github.com/tolle-ai/tollecode/internal/cli.Version=<v>"
so every published binary reports a distinct, verifiable version.
Functions ¶
func MaterializeCloudAgent ¶
MaterializeCloudAgent writes a cloud-provided agent definition into the local agents.json so the existing agent picker / --agent selection flow can apply it. Any embedded skills are written as ~/.tollecode/skills/<name>.md files (the same location the runtime skill loader scans), so the existing skill-injection path applies them unchanged.
configJSON is the agent's stored config (AgentVersion.ConfigJson from the cloud, with skills resolved to full definitions by the cloud API). Returns the agent name to pass as --agent and the list of active skill names to activate on the session. Returns name "" (with nil error) when there is no usable systemPrompt.
func PrintComposerFooter ¶
PrintComposerFooter prints the rule + status/hint line that immediately precedes the input prompt on every turn — the legacy (non-pinned) fallback used when the pinned composer is unavailable (non-TTY, tiny terminal).
func PrintIntro ¶
PrintIntro renders the startup banner as a bordered box, sized to the terminal but capped so it doesn't stretch absurdly wide on a large one.
func PrintReady ¶
func PrintReady(providerID, model, mode string)
PrintReady shows the resolved provider/model/mode once at startup. The per-turn composer footer (PrintComposerFooter) repeats the model/mode on every prompt, so this doesn't need its own hint list or trailing rule.
func PrintSubagentCards ¶
PrintSubagentCards displays sub-agent execution history — shown when switching sessions or after session load (mirrors Python's print_subagent_cards).
func RenderAssistantMarkdown ¶
RenderAssistantMarkdown formats a full assistant message for the terminal. The returned string ends with a trailing newline (empty input → "").
func Run ¶
func Run(cfg Config)
Run starts the interactive CLI or executes a one-shot task and exits.
func RunConfigure ¶
func RunConfigure(workspace string)
func RunConfigureAdd ¶
func RunConfigureAdd()
func RunConfigureRemoveByID ¶
func RunConfigureRemoveByID(id string)
func RunConfigureRemoveInteractive ¶
func RunConfigureRemoveInteractive()
func RunConfigureSetKey ¶
func RunConfigureSetKey(providerID, key string)
func RunConfigureSettings ¶
func RunConfigureSettings()
func RunFilePicker ¶
RunFilePicker shows an interactive fuzzy file/folder picker in raw terminal mode. initialQuery pre-filters the list on open. Returns the selected path relative to workspace, or "" if the user cancels.
func RunMultiSelect ¶
func RunSingleSelect ¶
RunSingleSelect shows an interactive single-choice picker. Enter (or Space) selects the highlighted row. Returns the chosen id, or "" when the user cancels (ok=false). When allowNone is true, an explicit "(none)" row is offered first.
Types ¶
type AgentPickerResult ¶
type AgentPickerResult struct {
Kind string // "agent" or "team"
ID string
Name string
Role string // agent role (used as an identity fallback when SystemPrompt is empty)
SystemPrompt string
Model string // override model from agent config (may be empty)
Skills []string // agent skills to activate on the session
TeamMemberIDs []string // populated when Kind == "team"
LeadAgentID string // team lead agent ID (populated when Kind == "team")
}
AgentPickerResult holds the selection from RunAgentPicker.
func RunAgentPicker ¶
func RunAgentPicker(initialQuery string) *AgentPickerResult
RunAgentPicker shows an interactive fuzzy picker for agents and teams. initialQuery pre-filters on open. Returns nil if the user cancels.
type Config ¶
type Config struct {
Workspace string
Mode string // "build" or "plan"
ThinkingBudget int
ProviderID string
Model string
Task string // non-empty → one-shot mode
SessionID string // non-empty → resume this session prefix
AgentArg string // pre-select agent by name or ID
TeamArg string // pre-select team by name or ID
Skills []string // skill names to activate on the session (cloud mode)
}
Config holds startup options for the CLI.
type StreamRenderer ¶
type StreamRenderer struct {
// contains filtered or unexported fields
}
func NewStreamRenderer ¶
func NewStreamRenderer() *StreamRenderer
func (*StreamRenderer) HandleEvent ¶
func (r *StreamRenderer) HandleEvent(m map[string]any)
func (*StreamRenderer) Reset ¶
func (r *StreamRenderer) Reset()
func (*StreamRenderer) SetSession ¶
func (r *StreamRenderer) SetSession(workspace, sessionID string)
func (*StreamRenderer) StartLoader ¶
func (r *StreamRenderer) StartLoader(effortLabel string)
StartLoader begins the turn's status line. effortLabel (e.g. "thinking 32k") is shown in the hint parenthetical when non-empty.
func (*StreamRenderer) StopLoader ¶
func (r *StreamRenderer) StopLoader()
type TolleREPL ¶
type TolleREPL struct {
// contains filtered or unexported fields
}
TolleREPL is the interactive CLI loop.