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 Use --projects to restrict the key to specific projects (comma-separated slugs). Omit the flag to allow all projects. `, Flags: []cli.Flag{ &cli.StringFlag{ Name: "projects", Usage: "Comma-separated list of project slugs this key is allowed to access (empty = all)", }, }, Action: handleAuthNewKeyCommand, }
AuthNewKeyCommand generates and stores a new API key.
var BenchmarkCommand = &cli.Command{ Name: "benchmark", Usage: "Run local taskverification benchmarks", Commands: []*cli.Command{ BenchmarkRunCommand, }, }
BenchmarkCommand groups local benchmark subcommands.
var BenchmarkRunCommand = &cli.Command{ Name: "run", Usage: "Run a benchmark suite locally", Flags: []cli.Flag{ &cli.StringFlag{ Name: "suite", Usage: "Path to the benchmark suite root", Required: true, }, &cli.StringSliceFlag{ Name: "case", Usage: "Benchmark case ids to execute (repeat or comma-separate)", }, &cli.StringSliceFlag{ Name: "agent", Usage: "Agents to execute (repeat or comma-separate)", Required: true, }, &cli.IntFlag{ Name: "repeat", Usage: "Number of attempts per matrix cell", Value: 1, }, &cli.StringSliceFlag{ Name: "template-dir", Usage: "Template variant in name=path form (repeatable)", }, &cli.DurationFlag{ Name: "timeout", Usage: "Per-run timeout", Value: 15 * time.Minute, }, &cli.StringFlag{ Name: "output-root", Usage: "Output root for preserved benchmark artifacts", }, &cli.StringFlag{ Name: "model", Aliases: []string{"m"}, Usage: singleModelFlagUsage(), }, &cli.StringFlag{ Name: "profile", Usage: "Codex Ollama profile for single-agent codex-ollama runs (" + codexOllamaProfileHelp + ")", }, &cli.StringFlag{ Name: "claude-model", Usage: "Override Claude model (" + claudeModelHelp + ")", }, &cli.StringFlag{ Name: "gemini-model", Usage: "Override Gemini model (" + geminiModelHelp + ")", }, &cli.StringFlag{ Name: "codex-model", Usage: "Override Codex model (" + codexModelHelp + ")", }, &cli.StringFlag{ Name: "codex-config", Usage: "Base Codex config to copy and patch for codex or codex-ollama runs", }, &cli.StringFlag{ Name: "centian-config", Usage: "Base Centian config to copy and patch for benchmark runs", }, &cli.BoolFlag{ Name: "keep-centian-running", Usage: "Print the benchmark UI URL and prompt whether to shut down the Centian server after the agent finishes", }, }, Action: handleBenchmarkRunCommand, }
BenchmarkRunCommand executes one benchmark suite locally and preserves raw artifacts.
var DemoCommand = &cli.Command{ Name: "demo", Usage: "Start an in-memory Centian demonstration server", Description: `Start a diskless Centian demo server, seed the bundled IT Ops scenario into an in-memory event database, and open the task detail view for post-hoc inspection. Deprecated --file, --agent, and --path flows are no longer available from this command and will likely be moved or removed in a future release. Examples: centian demo Deprecated: centian demo --file ./demo_scenario.json centian demo --agent claude centian demo --agent gemini centian demo --agent codex --model gpt-5.4-mini centian demo --agent codex-ollama --codex-config ~/.codex/config.toml --profile my-local-oss centian demo --agent claude --path ./my-demo `, Action: handleDemoCommand, Flags: []cli.Flag{ &cli.StringFlag{ Name: "agent", Aliases: []string{"a"}, Usage: "Deprecated: agent to run instead of the static IT Ops demo (v1 supports: claude, gemini, codex, codex-ollama)", }, &cli.StringFlag{ Name: "file", Aliases: []string{"f"}, Usage: "Deprecated: synthetic demo scenario JSON file to seed immediately", }, &cli.StringFlag{ Name: "path", Aliases: []string{"p"}, Usage: "Deprecated: disk-backed demo workspace path is no longer supported", }, &cli.StringFlag{ Name: "model", Aliases: []string{"m"}, Usage: singleModelFlagUsage(), }, &cli.StringFlag{ Name: "profile", Usage: "Codex Ollama profile from the supplied Codex config (" + codexOllamaProfileHelp + ")", }, &cli.StringFlag{ Name: "codex-config", Usage: "Base Codex config to copy and patch for codex or codex-ollama runs", }, }, }
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": "9666", "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.