command

package
v1.261116.0 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2026 License: MPL-2.0 Imports: 52 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	BuildVersion   = "dev"
	BuildGitCommit = "unknown"
	BuildBuildTime = "unknown"
	BuildGoVersion = "unknown"
	BuildPlatform  = "unknown"
)

Build information set by cli/tingly-box/main_kong.go at startup.

Functions

func BotPairEnable added in v1.261023.0

func BotPairEnable(appManager *app.AppManager, botUUID string, enable bool) error

BotPairEnable enables or disables RequirePairing for a bot. Takes effect at next bot start.

func BotPairRevoke added in v1.261023.0

func BotPairRevoke(appManager *app.AppManager, botUUID, chatID string) error

BotPairRevoke forgets the pairing for a specific chat. The chat will need to re-bind to issue commands.

func BotPairStatus added in v1.261023.0

func BotPairStatus(appManager *app.AppManager, botUUID string) error

BotPairStatus shows whether RequirePairing is on and where to find the code.

func ClearLine

func ClearLine()

ClearLine clears the current line in terminal

func DisplayQR

func DisplayQR(qrURL string) error

DisplayQR displays a QR code in the terminal It tries multiple methods and falls back to showing the URL

func PrintError

func PrintError(message string)

PrintError prints an error message

func PrintInfo

func PrintInfo(message string)

PrintInfo prints an info message

func PrintSuccess

func PrintSuccess(message string)

PrintSuccess prints a success message

func PrintWarning

func PrintWarning(message string)

PrintWarning prints a warning message

func StopRunningServer added in v1.261006.2

func StopRunningServer(configDir string) error

StopRunningServer stops the server holding configDir's single-instance lock (CLI, npx or GUI), exactly as `stop` does — a no-op if none is running. It reads only the lock file, never the database, so a launcher that wants to take over (the GUI's "stop it and restart as app") can use it before building AppConfig.

Types

type APIStyle

type APIStyle = protocol.APIStyle

APIStyle is re-exported from internal/protocol for the CLI prompts.

type AgentApplyFlagCmdKong added in v0.260507.1

type AgentApplyFlagCmdKong struct {
	AgentType  string `kong:"arg,optional,help='Agent type (cc/claude-code, oc/opencode, codex)'"`
	Provider   string `kong:"flag,name='provider',help='Provider UUID (optional, uses routing rule if not specified)'"`
	Model      string `kong:"flag,name='model',help='Model name (optional, uses routing rule if not specified)'"`
	Unified    bool   `kong:"flag,name='unified',default='true',hidden,help='Deprecated and ignored: Claude Code has no modes, use slots'"`
	StatusLine bool   `kong:"flag,name='status-line',help='Install status line integration (claude-code only)'"`
	Yes        bool   `kong:"flag,name='yes',short='y',help='Skip the confirmation prompt'"`
	Preview    bool   `kong:"flag,name='preview',help='Preview without applying'"`
}

AgentApplyFlagCmdKong applies agent configuration via flags

func (*AgentApplyFlagCmdKong) Run added in v0.260507.1

func (a *AgentApplyFlagCmdKong) Run(appManager *app.AppManager) error

type AgentCmdKong added in v0.260507.1

type AgentCmdKong struct {
	// Flag-based operations (primary interface)
	List    AgentListFlagCmdKong    `kong:"cmd,name='list',default='1',hidden,help='List configured agents (default)'"`
	Apply   AgentApplyFlagCmdKong   `kong:"cmd,help='Apply agent configuration'"`
	Show    AgentShowFlagCmdKong    `kong:"cmd,help='Show agent configuration details'"`
	Restore AgentRestoreFlagCmdKong `kong:"cmd,help='Restore agent configuration from backup'"`
}

AgentCmdKong is the Kong version of agent command with flag-based operations. The default behavior (no subcommand) is to list agents.

type AgentListFlagCmdKong added in v0.260507.1

type AgentListFlagCmdKong struct{}

AgentListFlagCmdKong lists configured agents (default behavior)

func (*AgentListFlagCmdKong) Run added in v0.260507.1

func (a *AgentListFlagCmdKong) Run(appManager *app.AppManager) error

type AgentRestoreFlagCmdKong added in v0.260507.1

type AgentRestoreFlagCmdKong struct {
	AgentType string `kong:"arg,optional,help='Agent type to restore'"`
	Yes       bool   `kong:"flag,name='yes',short='y',help='Skip the confirmation prompt'"`
}

AgentRestoreFlagCmdKong restores agent configuration from backup

func (*AgentRestoreFlagCmdKong) Run added in v0.260507.1

func (a *AgentRestoreFlagCmdKong) Run(appManager *app.AppManager) error

type AgentShowFlagCmdKong added in v0.260507.1

type AgentShowFlagCmdKong struct {
	AgentType string `kong:"arg,optional,help='Agent type to show'"`
}

AgentShowFlagCmdKong shows agent configuration details via flags

func (*AgentShowFlagCmdKong) Run added in v0.260507.1

func (a *AgentShowFlagCmdKong) Run(appManager *app.AppManager) error

type BannerConfig

type BannerConfig struct {
	Port         int
	Host         string
	EnableUI     bool
	GlobalConfig *serverconfig.Config
	IsDaemon     bool
}

BannerConfig holds configuration for banner display

type BotAddCmdKong added in v1.261023.0

type BotAddCmdKong struct{}

BotAddCmdKong adds a new bot configuration (interactive).

func (*BotAddCmdKong) Run added in v1.261023.0

func (r *BotAddCmdKong) Run(appManager *app.AppManager) error

type BotCmdKong added in v1.261023.0

type BotCmdKong struct {
	Default BotListCmdKong   `kong:"cmd,name='default',default='1',hidden,help='List bots (default)'"`
	List    BotListCmdKong   `kong:"cmd,help='List bots'"`
	Config  BotConfigCmdKong `kong:"cmd,help='Show or change the settings of a bot'"`
	Add     BotAddCmdKong    `kong:"cmd,help='Add a new bot configuration'"`
	Pair    BotPairCmdKong   `kong:"cmd,help='Manage TOFU pairing for an imbot'"`
}

BotCmdKong manages the IM bots. The hidden Default subcommand is marked default so `tingly-box bot` (no further args) lists them. Bots run in the server (`tingly-box start`), where chats talk to Claude Code through Projects.

type BotConfigCmdKong added in v1.261023.0

type BotConfigCmdKong struct {
	Bot        string `kong:"arg,help='Bot UUID, or its number in bot list'"`
	Name       string `kong:"flag,name='name',help='Rename the bot'"`
	DefaultCwd string `kong:"flag,name='default-cwd',help='Folder a chat works in until it picks one with /cd'"`
	Enable     bool   `kong:"flag,name='enable',xor='enabled',help='Run the bot'"`
	Disable    bool   `kong:"flag,name='disable',xor='enabled',help='Stop the bot'"`
}

BotConfigCmdKong shows a bot's settings, or changes the ones given.

func (*BotConfigCmdKong) Run added in v1.261023.0

func (r *BotConfigCmdKong) Run(appManager *app.AppManager) error

type BotListCmdKong added in v1.261023.0

type BotListCmdKong struct{}

BotListCmdKong lists the bots

func (*BotListCmdKong) Run added in v1.261023.0

func (r *BotListCmdKong) Run(appManager *app.AppManager) error

type BotPairCmdKong added in v1.261023.0

type BotPairCmdKong struct {
	Enable  BotPairEnableCmdKong  `kong:"cmd,help='Turn on RequirePairing for a bot'"`
	Disable BotPairDisableCmdKong `kong:"cmd,help='Turn off RequirePairing for a bot'"`
	Revoke  BotPairRevokeCmdKong  `kong:"cmd,help='Forget the pairing for a specific chat'"`
	Status  BotPairStatusCmdKong  `kong:"cmd,help='Show pairing status for a bot'"`
}

BotPairCmdKong manages TOFU pairing for imbots

func (*BotPairCmdKong) Run added in v1.261023.0

func (r *BotPairCmdKong) Run(appManager *app.AppManager) error

type BotPairDisableCmdKong added in v1.261023.0

type BotPairDisableCmdKong struct {
	BotUUID string `kong:"arg,help='Bot UUID'"`
}

BotPairDisableCmdKong turns off RequirePairing for a bot

func (*BotPairDisableCmdKong) Run added in v1.261023.0

func (r *BotPairDisableCmdKong) Run(appManager *app.AppManager) error

type BotPairEnableCmdKong added in v1.261023.0

type BotPairEnableCmdKong struct {
	BotUUID string `kong:"arg,help='Bot UUID'"`
}

BotPairEnableCmdKong turns on RequirePairing for a bot

func (*BotPairEnableCmdKong) Run added in v1.261023.0

func (r *BotPairEnableCmdKong) Run(appManager *app.AppManager) error

type BotPairRevokeCmdKong added in v1.261023.0

type BotPairRevokeCmdKong struct {
	BotUUID string `kong:"arg,help='Bot UUID'"`
	ChatID  string `kong:"arg,help='Chat ID to unpair'"`
}

BotPairRevokeCmdKong forgets the pairing for a specific chat

func (*BotPairRevokeCmdKong) Run added in v1.261023.0

func (r *BotPairRevokeCmdKong) Run(appManager *app.AppManager) error

type BotPairStatusCmdKong added in v1.261023.0

type BotPairStatusCmdKong struct {
	BotUUID string `kong:"arg,help='Bot UUID'"`
}

BotPairStatusCmdKong shows pairing status for a bot

func (*BotPairStatusCmdKong) Run added in v1.261023.0

func (r *BotPairStatusCmdKong) Run(appManager *app.AppManager) error

type CCmdKong added in v0.260507.1

type CCmdKong struct {
	Profile string   `kong:"flag,name='profile',help='Claude Code profile to use (deprecated: prefer \"tingly-box profile <id>\")'"`
	Port    int      `kong:"flag,name='port',help='Tingly-Box server port (default: detected from running server, else config or 12580)'"`
	Args    []string `kong:"arg,optional,passthrough='all',help='Additional arguments to pass to Claude Code (e.g., --model opus)'"`
}

CCmdKong launches Claude Code with tingly-box-specific flags. Put tingly-box flags before Claude Code args; unknown flags are passed through to Claude Code so users do not need to insert a literal '--'.

--profile duplicates `tingly-box profile <id>` (both resolve through runCC below) and is kept only for existing scripts/muscle memory; prefer `profile` for anything profile-related; see profile_command.go.

func (*CCmdKong) Run added in v0.260507.1

func (c *CCmdKong) Run(appManager *app.AppManager) error

type ImportOptions

type ImportOptions struct {
	// Quiet suppresses progress output.
	Quiet bool
}

ImportOptions controls provider import behavior.

type ImportResult

type ImportResult struct {
	ProvidersCreated int
	Providers        []ProviderImportInfo
	ProviderMap      map[string]string
}

ImportResult contains the results of a provider import.

func ImportProviders added in v0.260813.1

func ImportProviders(cfg *serverconfig.Config, data string, format dataio.Format, opts ImportOptions) (*ImportResult, error)

ImportProviders imports provider data without requiring an AppManager.

type LaunchSource added in v0.260801.1

type LaunchSource string

LaunchSource is how the running tingly-box process was invoked (binary, npx, npm) — see internal/shortcut for the source constants. It comes from the global --source flag and is bound into Kong's Run() calls, so any subcommand that needs it (shortcut, start, restart) can read it directly without persisting it anywhere.

type LogCmdKong added in v0.260514.1

type LogCmdKong struct {
	Once     bool          `kong:"flag,name='once',help='Fetch logs once and exit (default is real-time follow)'"`
	Limit    int           `kong:"flag,name='limit',short='n',default='50',help='Number of recent log entries per fetch (max 1000)'"`
	Interval time.Duration `kong:"flag,name='interval',short='i',default='2s',help='Poll interval for real-time follow mode'"`
	Level    string        `kong:"flag,name='level',help='Filter by minimum log level (debug|info|warn|error)'"`
	Host     string        `kong:"flag,name='host',default='localhost',help='Server host'"`
	Port     int           `kong:"flag,name='port',short='p',help='Server port (defaults to configured port)'"`
}

LogCmdKong streams or fetches system logs from the running tingly-box server via its HTTP API (/api/v1/system/logs). Default mode is real-time follow.

func (*LogCmdKong) Run added in v0.260514.1

func (l *LogCmdKong) Run(appManager *app.AppManager) error

type MCPBuiltinCmdKong added in v0.260507.1

type MCPBuiltinCmdKong struct{}

MCPBuiltinCmdKong starts the builtin MCP server. Registered at the top level as "mcp-builtin" to match the legacy command path, which is consumed by internal/mcp/runtime/builtin_registry.go.

Run takes no *app.AppManager: this process is spawned BY the running server as a stdio child and lives as long as it does. It serves web tools over stdio and has no business in the config directory — before AppManager became lazy it opened tingly.db and ran every migration just by being dispatched, a long-lived second writer next to the server (#1912).

func (*MCPBuiltinCmdKong) Run added in v0.260507.1

func (m *MCPBuiltinCmdKong) Run() error

type OAuthCmdKong added in v0.260507.1

type OAuthCmdKong struct {
	// Positional argument (optional)
	Provider string `kong:"arg,optional,help='Provider type (e.g., claude_code, qwen_code, codex)'"`

	// Flags
	Name     string `kong:"flag,name='name',short='n',help='Custom name for the provider'"`
	Port     int    `kong:"flag,name='port',short='p',help='Callback server port'"`
	ProxyURL string `kong:"flag,name='proxy',short='x',help='Proxy URL for OAuth requests'"`
}

OAuthCmdKong handles OAuth authentication

func (*OAuthCmdKong) Run added in v0.260507.1

func (o *OAuthCmdKong) Run(appManager *app.AppManager) error

type OpenCmdKong added in v0.260507.1

type OpenCmdKong struct {
	// Embed StartCmdKong to share server flags
	StartCmdKong
}

OpenCmdKong opens the web UI

func (*OpenCmdKong) Run added in v0.260507.1

func (o *OpenCmdKong) Run(appManager *app.AppManager, source LaunchSource) error

type ProfileCmdKong added in v0.260611.1

type ProfileCmdKong struct {
	List      bool     `kong:"flag,name='list',help='List all profiles (non-interactive)'"`
	Show      bool     `kong:"flag,name='show',help='Show profile details instead of launching'"`
	Port      int      `` /* 127-byte string literal not displayed */
	ProfileID string   `kong:"arg,optional,help='Profile name or ID to launch Claude Code with'"`
	Args      []string `kong:"arg,optional,passthrough='all',help='Additional arguments to pass to Claude Code (e.g., --model opus)'"`
}

ProfileCmdKong is the Kong command for managing and using Claude Code profiles. It is also reachable via the `use` alias (`tb use p1`), the shorthand for the common "launch with this profile" case.

Management mode:

tingly-box profile --list             → list all profiles (non-interactive)
tingly-box profile --show p1          → show profile details

Launch mode:

tingly-box profile                    → list profiles (interactive on TTY, select to launch)
tingly-box profile p1                 → launch Claude Code with profile p1
tingly-box use p1                     → same as above, via the `use` alias
tingly-box profile --port 12580 p1    → launch Claude Code with profile p1 on port 12580
tingly-box profile p1 --model opus    → launch with profile p1, passing --model opus to Claude
tingly-box profile p1 -p hi           → launch with profile p1, using Claude's print mode

Put tingly-box flags before the profile name; after the profile name, flags are treated as Claude Code arguments. A literal '--' still works for compatibility.

func (*ProfileCmdKong) Run added in v0.260611.1

func (p *ProfileCmdKong) Run(appManager *app.AppManager) error

type ProviderAddCmdKong added in v0.260507.1

type ProviderAddCmdKong struct {
	Name     string `kong:"arg,optional,help='Provider name'"`
	BaseURL  string `kong:"arg,optional,help='API base URL'"`
	Token    string `kong:"arg,optional,help='API token'"`
	APIStyle string `kong:"arg,optional,help='API style (openai, anthropic)'"`
}

ProviderAddCmdKong adds a new provider. All four positional args runs non-interactively; anything else is a clear error — see runAdd.

func (*ProviderAddCmdKong) Run added in v0.260507.1

func (c *ProviderAddCmdKong) Run(appManager *app.AppManager) error

Run is a pure CI command with no interactive fallback of any kind: all four fields are required, or it fails with a clear error naming what to pass instead — picking values interactively is `tingly-box tui` or Web UI work.

type ProviderCmdKong added in v0.260507.1

type ProviderCmdKong struct {
	List   ProviderListCmdKong   `kong:"cmd,name='list',default='1',help='List all providers'"`
	Add    ProviderAddCmdKong    `kong:"cmd,help='Add a new provider (CI: pass all four positional args)'"`
	Get    ProviderGetCmdKong    `kong:"cmd,help='Get provider details by UUID'"`
	Update ProviderUpdateCmdKong `kong:"cmd,help='Update one or more fields on an existing provider'"`
	Delete ProviderDeleteCmdKong `kong:"cmd,help='Delete a provider (-y required)'"`
}

ProviderCmdKong is the top-level `provider` command: a pure CI surface for managing providers by UUID/flags, one operation per invocation, never interactive. Browsing and picking a provider to edit/delete is TUI/Web UI work (`tingly-box tui`) — this command family intentionally has no picker of its own to duplicate that.

type ProviderDeleteCmdKong added in v0.260507.1

type ProviderDeleteCmdKong struct {
	UUID string `kong:"arg,required,help='Provider UUID'"`
	Yes  bool   `kong:"flag,name='yes',short='y',help='Confirm deletion (required — this command never prompts)'"`
}

ProviderDeleteCmdKong deletes a provider. -y/--yes is required: this command never prompts, so the flag is the only way to confirm intent.

func (*ProviderDeleteCmdKong) Run added in v0.260507.1

func (c *ProviderDeleteCmdKong) Run(appManager *app.AppManager) error

type ProviderGetCmdKong added in v0.260903.1

type ProviderGetCmdKong struct {
	UUID string `kong:"arg,required,help='Provider UUID'"`
}

ProviderGetCmdKong displays a provider's details by UUID. Names are not unique (UUID is the PK), so UUID is required — no picker to fall back to.

func (*ProviderGetCmdKong) Run added in v0.260903.1

func (c *ProviderGetCmdKong) Run(appManager *app.AppManager) error

type ProviderImportInfo added in v0.260414.2000

type ProviderImportInfo struct {
	UUID    string
	Name    string
	Action  string
	Renamed bool
}

ProviderImportInfo describes one imported provider.

type ProviderInfo

type ProviderInfo struct {
	Type        string
	DisplayName string
	Description string
}

ProviderInfo holds information about an OAuth provider

type ProviderListCmdKong added in v0.260507.1

type ProviderListCmdKong struct{}

ProviderListCmdKong lists all providers.

func (*ProviderListCmdKong) Run added in v0.260507.1

func (c *ProviderListCmdKong) Run(appManager *app.AppManager) error

type ProviderOAuthConfig

type ProviderOAuthConfig struct {
	Type          string
	DisplayName   string
	APIBase       string
	APIStyle      string
	OAuthMethod   string // "pkce", "device_code" or "server_poll"
	NeedsPort1455 bool
	// CallbackPort is the provider's required local callback port (0 = no
	// fixed requirement), e.g. xAI's OAuth app needs 56121.
	CallbackPort int
	// LoopbackHost is the hostname to use for the local OAuth callback URL.
	// Some OAuth apps (e.g. xAI) register their redirect URI against the
	// literal loopback IP (127.0.0.1) and reject "localhost".
	LoopbackHost string
}

ProviderOAuthConfig holds OAuth configuration for a provider

type ProviderUpdateCmdKong added in v0.260507.1

type ProviderUpdateCmdKong struct {
	UUID     string `kong:"arg,required,help='Provider UUID'"`
	Name     string `kong:"flag,name='name',help='New name'"`
	BaseURL  string `kong:"flag,name='base-url',help='New API base URL'"`
	Token    string `kong:"flag,name='token',help='New API token'"`
	APIStyle string `kong:"flag,name='api-style',help='New API style: openai or anthropic'"`
	ProxyURL string `kong:"flag,name='proxy-url',help='New proxy URL'"`
}

ProviderUpdateCmdKong updates one or more fields on an existing provider. Only fields whose flag was actually passed change; the rest are left as-is (fetched from the current record first). At least one field flag is required — otherwise there is nothing to do.

func (*ProviderUpdateCmdKong) Run added in v0.260507.1

func (c *ProviderUpdateCmdKong) Run(appManager *app.AppManager) error

type QRDisplay

type QRDisplay struct {
	URL       string
	ExpiresIn int // seconds
}

QRDisplay represents the QR code display

type QuickstartCmdKong added in v0.260507.1

type QuickstartCmdKong struct{}

QuickstartCmdKong is a hidden alias kept for backward compatibility with scripts and muscle memory; it goes straight to the guided wizard rather than the mode menu.

func (*QuickstartCmdKong) Run added in v0.260604.1

func (q *QuickstartCmdKong) Run(appManager *app.AppManager) error

type QuotaCmdKong added in v0.260507.1

type QuotaCmdKong struct {
	NoRefresh    bool   `kong:"flag,name='no-refresh',help='Skip refresh and show cached data only'"`
	AllProviders bool   `kong:"flag,name='all',short='a',help='Show all providers instead of interactive mode'"`
	Provider     string `kong:"arg,optional,help='Provider name or UUID (interactive mode if omitted)'"`
}

QuotaCmdKong is the streamlined quota command. Default behavior: interactive mode to select provider.

func (*QuotaCmdKong) Run added in v0.260625.1

func (q *QuotaCmdKong) Run(appManager *app.AppManager) error

type RestartCmdKong added in v0.260507.1

type RestartCmdKong struct {
	StartCmdKong
	// Kept as a hidden no-op: `restart` no longer asks for confirmation (the
	// verb itself is the intent), but the npx entrypoint, the Docker pm2
	// wrapper and user scripts still pass -y.
	Yes bool `kong:"flag,name='yes',short='y',hidden"`
}

RestartCmdKong is the Kong version of restart command

func (*RestartCmdKong) Run added in v0.260507.1

func (r *RestartCmdKong) Run(appManager *app.AppManager, source LaunchSource) error

type RuleAddCmdKong added in v0.260903.1

type RuleAddCmdKong struct {
	Scenario     string `kong:"flag,name='scenario',help='Rule scenario (e.g. openai, anthropic, claude_code)'"`
	RequestModel string `kong:"flag,name='request-model',help='Request model (e.g. gpt-4o, tingly/cc)'"`
	Provider     string `kong:"flag,name='provider',help='Provider UUID or name'"`
	Model        string `kong:"flag,name='model',help='Model name on the provider'"`
}

RuleAddCmdKong adds a rule. All four flags are required — there is no partial or interactive form; use `tingly-box tui` for interactive setup.

func (*RuleAddCmdKong) Run added in v0.260903.1

func (c *RuleAddCmdKong) Run(appManager *app.AppManager) error

type RuleCmdKong added in v0.260903.1

type RuleCmdKong struct {
	List   RuleListCmdKong   `kong:"cmd,name='list',default='1',help='List all rules'"`
	Add    RuleAddCmdKong    `kong:"cmd,help='Add a rule (all four flags required)'"`
	Update RuleUpdateCmdKong `kong:"cmd,help='Update the service on an existing rule'"`
	Delete RuleDeleteCmdKong `kong:"cmd,help='Delete a rule (-y required)'"`
	Export RuleExportCmdKong `kong:"cmd,help='Export a rule with its providers'"`
	Import RuleImportCmdKong `kong:"cmd,help='Import a rule with its providers'"`
}

RuleCmdKong is the top-level `rule` command: a pure CI surface for managing routing rules by UUID/flags, one operation per invocation, never interactive. Rule operations are deliberately simpler than provider operations: add/update only let the operator pick a single service (one provider + model); for richer multi-service rules use `rule import` or the Web UI. Browsing and picking a rule to edit/delete is TUI/Web UI work (`tingly-box tui`) — this command family intentionally has no picker of its own to duplicate that.

type RuleDeleteCmdKong added in v0.260903.1

type RuleDeleteCmdKong struct {
	UUID string `kong:"arg,required,help='Rule UUID'"`
	Yes  bool   `kong:"flag,name='yes',short='y',help='Confirm deletion (required — this command never prompts)'"`
}

RuleDeleteCmdKong deletes a rule. -y/--yes is required: this command never prompts, so the flag is the only way to confirm intent.

func (*RuleDeleteCmdKong) Run added in v0.260903.1

func (c *RuleDeleteCmdKong) Run(appManager *app.AppManager) error

type RuleExportCmdKong added in v0.260903.1

type RuleExportCmdKong struct {
	UUID   string `kong:"arg,required,help='Rule UUID'"`
	Format string `kong:"flag,name='format',default='jsonl',help='Export format: jsonl or base64'"`
	Output string `kong:"flag,name='output',help='Output file path (default: stdout)'"`
}

RuleExportCmdKong exports a rule (with its referenced providers). UUID is required — no picker to fall back to. Format/output stay as flags so scripts can pipe deterministically.

func (*RuleExportCmdKong) Run added in v0.260903.1

func (c *RuleExportCmdKong) Run(appManager *app.AppManager) error

type RuleImportCmdKong added in v0.260903.1

type RuleImportCmdKong struct {
	File   string `kong:"arg,optional,help='Import file path (reads from stdin if omitted)'"`
	Format string `kong:"flag,name='format',default='auto',help='Import format: auto, jsonl, or base64'"`
}

RuleImportCmdKong imports a rule (with its providers) from a bundle.

func (*RuleImportCmdKong) Run added in v0.260903.1

func (c *RuleImportCmdKong) Run(appManager *app.AppManager) error

type RuleListCmdKong added in v0.260903.1

type RuleListCmdKong struct{}

RuleListCmdKong lists all rules.

func (*RuleListCmdKong) Run added in v0.260903.1

func (c *RuleListCmdKong) Run(appManager *app.AppManager) error

type RuleUpdateCmdKong added in v0.260903.1

type RuleUpdateCmdKong struct {
	UUID     string `kong:"arg,required,help='Rule UUID'"`
	Provider string `kong:"flag,name='provider',help='New provider UUID or name'"`
	Model    string `kong:"flag,name='model',help='New model name on the provider'"`
}

RuleUpdateCmdKong re-picks the service (provider + model) on an existing rule. Everything else on the rule (request-model, scenario, flags, tactic) stays as-is. Both flags are required — there is no partial or interactive form.

func (*RuleUpdateCmdKong) Run added in v0.260903.1

func (c *RuleUpdateCmdKong) Run(appManager *app.AppManager) error

type ServerFlagsKong added in v1.261002.1

type ServerFlagsKong struct {
	Port        int    `kong:"flag,name='port',short='p',help='Server port'"`
	Host        string `kong:"flag,name='host',help='Server host'"`
	EnableUI    bool   `kong:"flag,name='ui',short='u',default='true',help='Enable web UI'"`
	EnableDebug bool   `kong:"flag,name='debug',help='Enable debug mode'"`
	// ProjectsDir is where Projects keeps its database and thread worktrees.
	ProjectsDir string `kong:"flag,name='projects-dir',help='Projects data directory, remembered for later starts (default: <config-dir>-project)'"`
}

ServerFlagsKong are the flags that configure the gateway itself. They are shared by every entry point that can start one: the CLI's start / restart / open (through StartCmdKong) and the GUI binary's root command (gui/wails3/main.go), so a server flag added here reaches both.

Host has no default on purpose: the CLI binds every interface when it is empty (Docker relies on that), while the GUI pins it to localhost itself.

func (ServerFlagsKong) Resolve added in v1.261002.1

Resolve merges these flags into rest (the caller's own flags, e.g. daemon or log file) and resolves the result against the config: an explicit --debug wins over the config's debug setting, a zero --port falls back to the config and a non-zero one is persisted to it.

type ShortcutCmdKong added in v0.260801.1

type ShortcutCmdKong struct {
	Name      string `kong:"flag,name='name',default='Tingly Box',help='Shortcut name'"`
	NoDesktop bool   `kong:"flag,name='no-desktop',help='Do not create a desktop shortcut'"`
	NoMenu    bool   `kong:"flag,name='no-menu',help='Do not create a Start Menu / application menu entry'"`
}

ShortcutCmdKong creates a desktop / start-menu shortcut that launches Tingly Box (restart in daemon mode and open the web UI) with a double-click, so users don't have to remember and type the startup command — especially on Windows.

func (*ShortcutCmdKong) Run added in v0.260801.1

func (s *ShortcutCmdKong) Run(source LaunchSource) error

type StartCmdKong added in v0.260507.1

type StartCmdKong struct {
	ServerFlagsKong
	EnableOpenBrowser    bool   `kong:"flag,name='browser',default='true',help='Auto-open browser'"`
	EnableStyleTransform bool   `kong:"flag,name='adapter',default='true',help='Enable API style transform'"`
	Daemon               bool   `kong:"flag,name='daemon',default='true',negatable,help='Run in the background (default; pass --no-daemon for foreground)'"`
	LogFile              string `kong:"flag,name='log-file',help='Log file path'"`
	EnableShortcut       bool   `kong:"flag,name='shortcut',help='Also create/refresh a desktop shortcut for next time'"`
}

StartCmdKong is the Kong version of start command

func (*StartCmdKong) Run added in v0.260507.1

func (s *StartCmdKong) Run(appManager *app.AppManager, source LaunchSource) error

type StatusCmdKong added in v0.260507.1

type StatusCmdKong struct{}

StatusCmdKong is the Kong version of status command

func (*StatusCmdKong) Run added in v0.260507.1

func (s *StatusCmdKong) Run(appManager *app.AppManager) error

type StopCmdKong added in v0.260507.1

type StopCmdKong struct{}

StopCmdKong is the Kong version of stop command

func (*StopCmdKong) Run added in v0.260507.1

func (s *StopCmdKong) Run(appManager *app.AppManager) error

type SwaggerCmdKong added in v0.260507.1

type SwaggerCmdKong struct {
	Output string `kong:"flag,name='output',short='o',help='Output file path'"`
	Stdout bool   `kong:"flag,name='stdout',help='Write to stdout'"`
}

SwaggerCmdKong generates OpenAPI schema

func (*SwaggerCmdKong) Run added in v0.260507.1

func (s *SwaggerCmdKong) Run(appManager *app.AppManager) error

type TUICmdKong added in v0.260507.1

type TUICmdKong struct{}

TUICmdKong runs the interactive TUI. On entry users pick a mode (QuickStart, Provider, Rule, Agent) and manage that area of config freely. Backward-compatible: `tingly-box quickstart` still drops straight into the guided wizard via QuickstartCmdKong.

func (*TUICmdKong) Run added in v0.260507.1

func (t *TUICmdKong) Run(appManager *app.AppManager) error

type TokenCmdKong added in v0.260514.1

type TokenCmdKong struct {
	List    TokenListCmdKong    `kong:"cmd,name='list',default='1',hidden,help='List tingly-box tokens (default)'"`
	View    TokenViewCmdKong    `kong:"cmd,help='View a tingly-box token (auth or model)'"`
	Refresh TokenRefreshCmdKong `kong:"cmd,help='Refresh (rotate) a tingly-box token (auth or model)'"`
}

TokenCmdKong manages tingly-box's own auth and model tokens. Upstream provider credentials are not handled here — those live under the `provider` and `oauth` commands.

type TokenKind added in v0.260514.1

type TokenKind string

TokenKind identifies which tingly-box token a sub-command operates on. "auth" is the UserToken (control panel + control API). "model" is the ModelToken (used by AI clients hitting the box's OpenAI/Anthropic endpoints). Both are managed independently from upstream provider creds.

type TokenListCmdKong added in v0.260514.1

type TokenListCmdKong struct{}

TokenListCmdKong prints both tokens with masked previews.

func (*TokenListCmdKong) Run added in v0.260514.1

func (t *TokenListCmdKong) Run(appManager *app.AppManager) error

type TokenRefreshCmdKong added in v0.260514.1

type TokenRefreshCmdKong struct {
	Kind   string `kong:"arg,optional,help='Which token to refresh: auth or model'"`
	Reveal bool   `kong:"flag,name='reveal',short='r',help='Print the full rotated token after success'"`
	Yes    bool   `kong:"flag,name='yes',short='y',help='Skip the rotation confirmation prompt'"`
}

TokenRefreshCmdKong rotates a tingly-box token (auth or model) and persists the new value. Existing clients using the old token will need to be updated.

func (*TokenRefreshCmdKong) Run added in v0.260514.1

func (t *TokenRefreshCmdKong) Run(appManager *app.AppManager) error

type TokenViewCmdKong added in v0.260514.1

type TokenViewCmdKong struct {
	Kind   string `kong:"arg,optional,help='Which token to view: auth or model (both, if omitted)'"`
	Reveal bool   `kong:"flag,name='reveal',short='r',help='Print the full token instead of a masked preview'"`
}

TokenViewCmdKong shows a tingly-box token. When kind is omitted, both tokens are shown directly — viewing either is harmless, so there is nothing worth picking one over the other for.

func (*TokenViewCmdKong) Run added in v0.260514.1

func (t *TokenViewCmdKong) Run(appManager *app.AppManager) error

type VersionCmdKong added in v0.260507.1

type VersionCmdKong struct{}

VersionCmdKong is the Kong version of version command.

Run takes no *app.AppManager on purpose: printing build metadata must not touch the config directory, let alone the database. Docker's HEALTHCHECK used to run this every 30s, and before AppManager became lazy that was a second SQLite writer next to the server (#1912).

func (*VersionCmdKong) Run added in v0.260507.1

func (v *VersionCmdKong) Run() error

Directories

Path Synopsis
Package readiness answers "can the server I just launched actually be reached yet?" for every entry point that starts one (start, restart, open, the TUI).
Package readiness answers "can the server I just launched actually be reached yet?" for every entry point that starts one (start, restart, open, the TUI).
Package tui provides interactive terminal prompts for the tingly-box CLI.
Package tui provides interactive terminal prompts for the tingly-box CLI.

Jump to

Keyboard shortcuts

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