continuedev

package
v1.6.1 Latest Latest
Warning

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

Go to latest
Published: Feb 8, 2026 License: MIT Imports: 10 Imported by: 0

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

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) Validate

func (c *Config) Validate() error

Validate checks if the configuration is valid.

func (Config) WithDefaults

func (c Config) WithDefaults() Config

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) Close

func (c *ContinueCLI) Close() error

Close 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 WithAPIKey

func WithAPIKey(key string) Option

WithAPIKey sets the Continue API key.

func WithAllowedTools

func WithAllowedTools(tools []string) Option

WithAllowedTools sets tools to allow without prompting.

func WithAskTools

func WithAskTools(tools []string) Option

WithAskTools sets tools that require approval.

func WithConfigPath

func WithConfigPath(configPath string) Option

WithConfigPath sets the path to config.yaml.

func WithEnv

func WithEnv(env map[string]string) Option

WithEnv adds environment variables.

func WithEnvVar

func WithEnvVar(key, value string) Option

WithEnvVar adds a single environment variable.

func WithExcludedTools

func WithExcludedTools(tools []string) Option

WithExcludedTools sets tools to disable.

func WithModel

func WithModel(model string) Option

WithModel sets the model name.

func WithPath

func WithPath(path string) Option

WithPath sets the path to the cn binary.

func WithResume

func WithResume() Option

WithResume enables session resumption.

func WithRule

func WithRule(rule string) Option

WithRule sets a rule to apply.

func WithTimeout

func WithTimeout(d time.Duration) Option

WithTimeout sets the request timeout.

func WithVerbose

func WithVerbose() Option

WithVerbose enables verbose logging.

func WithWorkdir

func WithWorkdir(dir string) Option

WithWorkdir sets the working directory.

Jump to

Keyboard shortcuts

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