Documentation
¶
Overview ¶
Package cline implements the Cline adapter for agentsync.
Cline's config is scope-asymmetric (verified against docs.cline.bot and the prior art of rulesync/ruler/agentsmesh):
- MCP servers: Cline has NO project-level MCP file, and its VS Code-extension MCP lives in OS/editor-specific globalStorage that no config-sync tool writes. Cline's CLI, however, reads a clean `~/.cline/mcp.json`, so agentsync targets THAT at user scope and skips (reports) project-scope MCP.
- Rules (memory): `.clinerules/` directory of plain markdown at the repo root (Cline concatenates them). Cline's global rules live in `~/Documents/Cline/` (a non-XDG app path agentsync does not target), so memory renders at project scope only.
- Workflows (slash commands): `.clinerules/workflows/<name>.md`, plain markdown invoked as `/<name>.md`. Project scope only (Cline's global rules/workflows live under the non-XDG ~/Documents/Cline/ path agentsync deliberately does not target).
Skills, subagents, hooks, and LSP have no Cline concept and are skipped. Rules/ workflows are plain markdown (no frontmatter parsing), so the adapter emits no Ingest warnings and does not implement WarnEmitter. See docs/capability-matrix.md.
Index ¶
- func IngestMCPSpec(raw map[string]any) source.MCPServerSpec
- type Adapter
- func (a *Adapter) Apply(ops []adapter.FileOp, w adapter.DestWriter) error
- func (a *Adapter) Capabilities() adapter.Capability
- func (a *Adapter) Detect() (bool, error)
- func (a *Adapter) Ingest(scope adapter.Scope, project string) (source.Canonical, error)
- func (a *Adapter) KeyMergeStrategy() string
- func (a *Adapter) Name() string
- func (a *Adapter) Render(r secrets.Resolved, scope adapter.Scope, project string) ([]adapter.FileOp, []adapter.Skip, error)
- type Options
- type Paths
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IngestMCPSpec ¶
func IngestMCPSpec(raw map[string]any) source.MCPServerSpec
IngestMCPSpec translates one Cline-native server entry (the value under ~/.cline/mcp.json `mcpServers.<id>`) into the canonical MCPServerSpec. A server carrying a `url` is canonicalised to the http transport (Cline does not record a sse/http distinction), otherwise stdio. Native keys agentsync doesn't model (disabled, autoApprove, …) are preserved in Extra.
Types ¶
type Adapter ¶
type Adapter struct {
// contains filtered or unexported fields
}
Adapter implements adapter.Adapter for Cline.
func (*Adapter) Apply ¶
Apply routes every destination write through the supplied DestWriter rather than calling iox.AtomicWrite directly. The DestWriter owns the foreign-collision backup invariant — see the doc on adapter.DestWriter.
func (*Adapter) Capabilities ¶
func (a *Adapter) Capabilities() adapter.Capability
func (*Adapter) Ingest ¶
Ingest reads Cline's native config and returns a partial source.Canonical. It is the inverse of Render, honoring the same scope asymmetry: MCP from the CLI's ~/.cline/mcp.json (user scope), rules + workflows from the .clinerules/ tree.
func (*Adapter) KeyMergeStrategy ¶
KeyMergeStrategy is cline's single key-merge strategy: JSON (~/.cline/mcp.json). Rules/workflows are whole-file markdown writes.
func (*Adapter) Render ¶
func (a *Adapter) Render(r secrets.Resolved, scope adapter.Scope, project string) ([]adapter.FileOp, []adapter.Skip, error)
Render converts the resolved canonical into FileOps for Cline.
Scope-asymmetric: MCP renders at user scope (the Cline CLI's ~/.cline/mcp.json; Cline has no project MCP file), while memory + commands render at project scope (.clinerules/; Cline's global rules are a non-XDG app path agentsync does not target). The non-applicable scope reports a skip for each affected item. Cline has no native plugin enable-state agentsync models, so there is no PluginIngester; it still receives plugin-projected components on apply.
type Options ¶
type Options struct {
TargetRoot string // honors AGENTSYNC_TARGET_ROOT
LookPath func(file string) (string, error)
}
Options configure the adapter at construction.
type Paths ¶
type Paths struct {
ConfigDir string // ~/.cline (user) — also the Detect probe
MCP string // ~/.cline/mcp.json (user scope only; "" at project)
RulesDir string // <proj>/.clinerules (project scope only; "" at user)
WorkflowsDir string // <proj>/.clinerules/workflows (project scope only; "" at user)
}
Paths resolves the destination paths for a given (scope, project, target-root).
Scope-asymmetric (mirrors Cline's layout): MCP is the CLI's global ~/.cline/mcp.json (empty at project scope — Cline has no project MCP file), while rules/workflows live in the project's .clinerules/ tree (empty at user scope — Cline's global rules are a non-XDG app path agentsync does not target).
func ResolvePaths ¶
ResolvePaths returns the Paths for the given target root and optional project.