Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var RootCmd = &cobra.Command{ Use: "oni3 [directory]", Short: "Oni3 — AI agent CLI", Long: `Oni3 is a command line interface for AI agents. Optionally pass a working directory; tools resolve relative paths against it. The same directory can be given with --cwd/-C.`, Version: version.Version, Args: cobra.MaximumNArgs(1), RunE: func(cmd *cobra.Command, args []string) error { cfg := config.GetConfig() name, err := resolveDefaultAgent(cfg) if err != nil { return err } return startAgentSession(name) }, PersistentPreRunE: func(cmd *cobra.Command, args []string) error { dir := workDir if cmd.Name() != "run" { d, err := workDirFromArgs(args, workDir) if err != nil { return err } dir = d } if err := enterWorkDir(dir); err != nil { return err } created, err := config.EnsureConfigFile(configPath) if err != nil { return fmt.Errorf("failed to prepare configuration file: %w", err) } if created { fmt.Fprintf(os.Stderr, "Created a starter configuration at %s\n", configPath) fmt.Fprintln(os.Stderr, "Oni3 ships built-in providers: pick one in the provider list to enter an API key and import models. Edit the file only for custom endpoints.") } cfg, err := config.LoadConfig(configPath) if err != nil { return fmt.Errorf("failed to load configuration file: %w", err) } if _, err := ensureBuiltinAgent(cfg); err != nil { fmt.Fprintf(os.Stderr, "Note: built-in agent unavailable: %v\n", err) } if cmd.Name() != "mcp" && cmd.Name() != "web" && cmd.Name() != "serve" { go func() { ctx := cmd.Context() if ctx == nil { ctx = context.Background() } if err := mcp.InitializeGlobalManager(ctx, cfg); err != nil { logger.Error("MCP", fmt.Sprintf("Failed to initialize MCP manager: %v", err)) } }() } return nil }, }
RootCmd represents the base command when called without any subcommands
Functions ¶
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.