Documentation
¶
Overview ¶
Package cli provides all CLI commands centian offers, including init, stdio, server, logs, config and all of their sub-commands.
Index ¶
Constants ¶
const Fish string = "fish"
Fish is an animal living underwater...
Variables ¶
var AuthCommand = &cli.Command{ Name: "auth", Usage: "Manage Centian authentication", Commands: []*cli.Command{ AuthNewKeyCommand, }, }
AuthCommand provides authentication utilities.
var AuthNewKeyCommand = &cli.Command{
Name: "new-key",
Usage: "centian auth new-key",
Description: `Generate a new API key for the HTTP proxy.
The key is printed once to the console, then hashed with bcrypt and stored in:
~/.centian/api_keys.json
`,
Action: handleAuthNewKeyCommand,
}
AuthNewKeyCommand generates and stores a new API key.
var DemoCommand = &cli.Command{ Name: "demo", Usage: "Start a self-contained Centian demo workspace", Description: `Create a local Centian demo workspace, start Centian, launch a supported coding agent against it, and print the live UI URL. Examples: centian demo --agent claude centian demo --agent claude --path ./my-demo `, Action: handleDemoCommand, Flags: []cli.Flag{ &cli.StringFlag{ Name: "agent", Aliases: []string{"a"}, Usage: "Agent to run for the demo (v1 supports: claude)", Required: true, }, &cli.StringFlag{ Name: "path", Aliases: []string{"p"}, Usage: "Path where the demo workspace should be created", }, }, }
DemoCommand launches a self-contained Centian demo workspace.
var InitCommand = &cli.Command{ Name: "init", Usage: "Initialize centian with default configuration", Description: "Creates ~/.centian/config.json with default settings and guides initial setup", Action: initCentian, Flags: []cli.Flag{ &cli.BoolFlag{ Name: "quickstart", Aliases: []string{"q"}, Usage: "Create a ready-to-run config (requires npx)", }, &cli.BoolFlag{ Name: "force", Aliases: []string{"f"}, Usage: "Overwrite existing configuration if it exists", }, &cli.StringFlag{ Name: "from-path", Aliases: []string{"p"}, Usage: "Import servers from a specific MCP config file path", }, }, }
InitCommand initializes a new centian setup with default configuration.
var LogsCommand = &cli.Command{ Name: "logs", Usage: "Displays logs: centian logs [--limit <n>]", Description: `Display formatted Centian MCP proxy logs ordered by timestamp (newest first). Examples: centian logs centian logs --limit 10`, Flags: []cli.Flag{ &cli.IntFlag{ Name: "limit", Usage: "Number of log entries to display (0 shows all)", Value: defaultLogDisplayLimit, }, }, Action: handleLogsCommand, }
LogsCommand displays Centian log entries in descending timestamp order.
var ProcessorAddCommand = &cli.Command{ Name: "add", Usage: "Add a processor to the configuration", Description: "Register a processor script in the global config. Name is inferred from the filename unless --name is provided.", Flags: []cli.Flag{ &cli.StringFlag{ Name: "path", Aliases: []string{"p"}, Usage: "Path to the processor script (required for --type cli)", }, &cli.StringFlag{ Name: "name", Aliases: []string{"n"}, Usage: "Processor name (default: inferred from filename)", }, &cli.StringFlag{ Name: "type", Aliases: []string{"t"}, Usage: "Processor type", Value: "cli", }, &cli.StringFlag{ Name: "url", Usage: "Webhook URL (required for --type webhook)", }, &cli.StringSliceFlag{ Name: "header", Usage: "Webhook header in Key=Value form (repeatable, only for --type webhook)", Value: []string{}, }, }, Action: handleProcessorAdd, }
ProcessorAddCommand registers an existing processor script in the global config.
var ProcessorCommand = &cli.Command{ Name: "processor", Usage: "Manage Centian processors", Commands: []*cli.Command{ ProcessorInitCommand, ProcessorAddCommand, }, }
ProcessorCommand provides processor management functionality.
var ProcessorInitCommand = &cli.Command{
Name: "new",
Usage: "centian processor new",
Description: "Interactively scaffold a new processor.",
Action: handleProcessorInit,
}
ProcessorInitCommand scaffolds a new processor.
var StartCommand = &cli.Command{ Name: "start", Usage: "Start Centian proxy: centian start [--config-path <path>]", Description: `Start Centian proxy server for configured MCP servers. Currently supports HTTP transport. The HTTP proxy creates endpoints for each configured HTTP MCP server at: /mcp/<gateway_name>/<server_name> Configuration is loaded from ~/.centian/config.json by default. Example config structure: { "version": "1.0.0", "name": "My Centian Server", "proxy": { "port": "8080", "timeout": 30 }, "gateways": { "my-gateway": { "mcpServers": { "github": { "url": "https://api.githubcopilot.com/mcp/", "headers": { "Authorization": "Bearer ${MY_GH_TOKEN_ENV_VAR}" } } } } } } Examples: centian start centian start --config-path ./custom-config.json `, Action: handleServerStartCommand, Flags: []cli.Flag{ &cli.StringFlag{ Name: "config-path", Usage: "Path to config file (default: ~/.centian/config.json)", }, }, }
StartCommand starts the Centian proxy server.
Functions ¶
func SetupShellCompletion ¶
func SetupShellCompletion() error
SetupShellCompletion offers to set up shell completion for the user.
Types ¶
type InitOption ¶
type InitOption int
InitOption represents the user's choice for initialization method.
const ( // InitOptionEmpty creates an empty config with no servers. InitOptionEmpty InitOption = iota // InitOptionQuickstart creates a ready-to-run config with a default MCP server. InitOptionQuickstart // InitOptionFromPath imports servers from a specific config file. InitOptionFromPath )
type InitUI ¶
type InitUI struct {
// contains filtered or unexported fields
}
InitUI provides user interface functions for the init command.
type ShellInfo ¶
type ShellInfo struct {
Name string // bash, zsh, fish, etc.
RCFile string // path to RC file (~/.bashrc, ~/.zshrc, etc.)
CompletionLine string // the line to add for completion
}
ShellInfo contains information about the current shell and its configuration.
func DetectShell ¶
DetectShell detects the current shell and returns shell information.