Documentation
¶
Overview ¶
Package continue provides a client for Continue.dev CLI (cn).
Continue.dev is an open-source coding agent that supports local models via Ollama, MCP servers, and agentic file/shell operations. This package wraps the `cn` CLI for programmatic use.
Installation ¶
Install the Continue CLI:
npm i -g @continuedev/cli
Usage ¶
Via provider registry:
import _ "github.com/randalmurphal/llmkit/continue" // Register provider
client, err := provider.New("continue", provider.Config{
Provider: "continue",
Model: "llama3.2:latest",
WorkDir: "/path/to/project",
Options: map[string]any{
"config_path": "~/.continue/config.yaml",
},
})
Direct instantiation:
client := continue.NewContinueCLI(
continue.WithModel("llama3.2:latest"),
continue.WithConfigPath("~/.continue/config.yaml"),
continue.WithWorkdir("/path/to/project"),
)
Configuration ¶
Continue uses config.yaml for model and MCP server configuration. See https://docs.continue.dev/reference for full schema.
Example config.yaml:
name: my-config
version: 1.0.0
schema: v1
models:
- name: Ollama Llama3
provider: ollama
model: llama3.2:latest
apiBase: http://localhost:11434
roles: [chat, edit, apply]
mcpServers:
- name: filesystem
command: npx
args: ["@modelcontextprotocol/server-filesystem", "/workspace"]
Capabilities ¶
Continue provides full agentic capabilities:
- File read/write/edit
- Shell/bash execution
- MCP server integration
- Session resumption
- Tool permission control
Tool Permissions ¶
Control tool access with --allow, --ask, and --exclude flags:
client := continue.NewContinueCLI(
continue.WithAllowedTools([]string{"Write()", "Edit()"}),
continue.WithAskTools([]string{"Bash(curl*)"}),
continue.WithExcludedTools([]string{"Fetch"}),
)
Index ¶
- type Config
- type ContinueCLI
- func (c *ContinueCLI) Capabilities() provider.Capabilities
- func (c *ContinueCLI) Close() error
- func (c *ContinueCLI) Complete(ctx context.Context, req provider.Request) (*provider.Response, error)
- func (c *ContinueCLI) Provider() string
- func (c *ContinueCLI) Stream(ctx context.Context, req provider.Request) (<-chan provider.StreamChunk, error)
- func (c *ContinueCLI) StreamWithProcess(ctx context.Context, req provider.Request) (<-chan provider.StreamChunk, error)
- type Option
- func WithAPIKey(key string) Option
- func WithAllowedTools(tools []string) Option
- func WithAskTools(tools []string) Option
- func WithConfigPath(configPath string) Option
- func WithEnv(env map[string]string) Option
- func WithEnvVar(key, value string) Option
- func WithExcludedTools(tools []string) Option
- func WithModel(model string) Option
- func WithPath(path string) Option
- func WithResume() Option
- func WithRule(rule string) Option
- func WithTimeout(d time.Duration) Option
- func WithVerbose() Option
- func WithWorkdir(dir string) Option
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
// Path is the path to the cn binary.
// Default: "cn"
Path string `json:"path" yaml:"path"`
// ConfigPath is the path to config.yaml or a hub reference.
// Example: "~/.continue/config.yaml" or "continuedev/default-cli-config"
ConfigPath string `json:"config_path" yaml:"config_path"`
// Model is the model name to use (must be configured in config.yaml).
Model string `json:"model" yaml:"model"`
// WorkDir is the working directory for the CLI.
WorkDir string `json:"work_dir" yaml:"work_dir"`
// Timeout is the request timeout.
// Default: 5 minutes.
Timeout time.Duration `json:"timeout" yaml:"timeout"`
// AllowedTools are tool patterns to allow without prompting.
// Example: []string{"Write()", "Edit()"}
AllowedTools []string `json:"allowed_tools" yaml:"allowed_tools"`
// AskTools are tool patterns that require approval.
// Example: []string{"Bash(curl*)"}
AskTools []string `json:"ask_tools" yaml:"ask_tools"`
// ExcludedTools are tools to disable entirely.
// Example: []string{"Fetch"}
ExcludedTools []string `json:"excluded_tools" yaml:"excluded_tools"`
// Env provides additional environment variables.
Env map[string]string `json:"env" yaml:"env"`
// APIKey is the Continue API key for CI/headless environments.
// Can also be set via CONTINUE_API_KEY env var.
APIKey string `json:"api_key" yaml:"api_key"`
// Verbose enables detailed logging to ~/.continue/logs/cn.log.
Verbose bool `json:"verbose" yaml:"verbose"`
// Resume continues the previous conversation.
Resume bool `json:"resume" yaml:"resume"`
// Rule applies a specific rule from Mission Control.
// Example: "nate/spanish"
Rule string `json:"rule" yaml:"rule"`
}
Config holds Continue CLI configuration.
func DefaultConfig ¶
func DefaultConfig() Config
DefaultConfig returns a Config with sensible defaults.
func (Config) WithDefaults ¶
WithDefaults returns a copy of the config with defaults applied.
type ContinueCLI ¶
type ContinueCLI struct {
// contains filtered or unexported fields
}
ContinueCLI implements provider.Client using the Continue CLI binary (cn).
func NewContinueCLI ¶
func NewContinueCLI(opts ...Option) *ContinueCLI
NewContinueCLI creates a new Continue CLI client. Assumes "cn" is available in PATH unless overridden with WithPath.
func (*ContinueCLI) Capabilities ¶
func (c *ContinueCLI) Capabilities() provider.Capabilities
Capabilities implements provider.Client.
func (*ContinueCLI) Complete ¶
func (c *ContinueCLI) Complete(ctx context.Context, req provider.Request) (*provider.Response, error)
Complete implements provider.Client. Executes cn in headless mode with -p flag and returns the response.
func (*ContinueCLI) Provider ¶
func (c *ContinueCLI) Provider() string
Provider implements provider.Client.
func (*ContinueCLI) Stream ¶
func (c *ContinueCLI) Stream(ctx context.Context, req provider.Request) (<-chan provider.StreamChunk, error)
Stream implements provider.Client. Continue CLI doesn't have native streaming in headless mode, so we simulate it.
func (*ContinueCLI) StreamWithProcess ¶
func (c *ContinueCLI) StreamWithProcess(ctx context.Context, req provider.Request) (<-chan provider.StreamChunk, error)
StreamWithProcess implements streaming by reading process output line by line. This is an alternative implementation that provides incremental output.
type Option ¶
type Option func(*ContinueCLI)
Option configures a ContinueCLI.
func WithAllowedTools ¶
WithAllowedTools sets tools to allow without prompting.
func WithAskTools ¶
WithAskTools sets tools that require approval.
func WithConfigPath ¶
WithConfigPath sets the path to config.yaml.
func WithEnvVar ¶
WithEnvVar adds a single environment variable.
func WithExcludedTools ¶
WithExcludedTools sets tools to disable.