adapter

package
v0.1.7 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const InstructionBlockLint = `` /* 222-byte string literal not displayed */

InstructionBlockLint is the instruction block for lint-based adapters (aider).

View Source
const InstructionBlockMCP = `` /* 1324-byte string literal not displayed */

InstructionBlockMCP is the instruction block for MCP-capable adapters.

Variables

This section is empty.

Functions

func AppendInstruction

func AppendInstruction(filePath, block string) (bool, error)

AppendInstruction upserts the devtap instruction block in filePath. If a devtap block exists, it is replaced with block; otherwise block is appended. Returns true if the file content changed.

func ConfigHasDevtap

func ConfigHasDevtap(path string) bool

ConfigHasDevtap checks whether the config file at path exists and already contains a devtap configuration entry.

func ConfirmOverwrite

func ConfirmOverwrite(path string) bool

ConfirmOverwrite prompts the user to confirm overwriting an existing devtap configuration. Returns true if the user answers yes.

func FindProjectInstruction

func FindProjectInstruction(paths []string) string

FindProjectInstruction returns the path of the first existing file from paths, or an empty string if none exist.

func InstallInstruction

func InstallInstruction(projectDir string, projectFiles []string, block string)

InstallInstruction handles the full instruction injection flow:

  • Find the first existing project instruction file → append (idempotent)
  • If not found → create the highest priority project file

Types

type Adapter

type Adapter interface {
	// Name returns the adapter identifier (e.g., "claude-code", "codex", "aider").
	Name() string

	// DiscoverSessions finds active sessions for this tool in the given project dir.
	DiscoverSessions(projectDir string) ([]Session, error)

	// Install configures the tool to integrate with devtap.
	// For MCP-capable tools, this writes .mcp.json in the project dir.
	// For tools without MCP, this creates tool-specific integration files.
	Install(config InstallConfig) error
}

Adapter abstracts the integration with different AI coding tools.

type InstallConfig

type InstallConfig struct {
	ProjectDir string
	AutoLoop   bool
	MaxRetries int
	// ExtraArgs are additional CLI flags appended to mcp-serve / drain commands
	// (e.g. ["--session", "myproject", "--store", "greptimedb"]).
	ExtraArgs []string
}

InstallConfig holds configuration for installing devtap integration.

type Session

type Session struct {
	ID         string
	ProjectDir string
	Label      string // human-readable label for display
}

Session represents an active AI coding tool session.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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