roo

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jun 15, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

Package roo implements the Roo Code adapter for agentsync.

Roo Code (a VS Code extension) keeps clean, filesystem-based config under a `.roo/` tree at both scopes (per docs.roocode.com): project-level at <repo>/.roo and global at ~/.roo. agentsync projects three components:

  • MCP servers → .roo/mcp.json (a JSON `mcpServers` object; project-level). Roo's GLOBAL MCP lives in VS Code's globalStorage (an OS- and editor- variant-specific path no config-sync tool writes — rulesync, ruler, gaal, ai-rulez, and agentsmesh all skip it), so agentsync targets the clean project-level `.roo/mcp.json` and reports a skip for user-scope MCP. This matches the dominant prior-art pattern (rulesync + ruler both do exactly this).
  • Memory → .roo/rules/agentsync.md (a plain-markdown rule; Roo reads .roo/rules/ recursively). Both scopes (~/.roo/rules and <repo>/.roo/rules).
  • Commands → .roo/commands/<name>.md (markdown + YAML frontmatter: description + argument-hint). Both scopes.

Skills, subagents (Roo's "custom modes" are not a 1:1), hooks, and LSP have no faithful Roo target and are skipped. See docs/capability-matrix.md.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IngestMCPSpec

func IngestMCPSpec(raw map[string]any) source.MCPServerSpec

IngestMCPSpec translates one Roo-native server entry (the value under .roo/mcp.json `mcpServers.<id>`) into the canonical MCPServerSpec. Inverse of rooMCPSpec: `streamable-http` → http, `sse` → sse, otherwise stdio. Native keys agentsync doesn't model (cwd, timeout, alwaysAllow, …) are preserved in Extra.

Types

type Adapter

type Adapter struct {
	// contains filtered or unexported fields
}

Adapter implements adapter.Adapter for Roo Code.

func New

func New(opts Options) *Adapter

New constructs a Roo Code adapter.

func (*Adapter) Apply

func (a *Adapter) Apply(ops []adapter.FileOp, w adapter.DestWriter) error

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

func (a *Adapter) Detect() (bool, error)

func (*Adapter) Ingest

func (a *Adapter) Ingest(scope adapter.Scope, project string) (source.Canonical, error)

Ingest reads Roo's native config and returns a partial source.Canonical. It is the inverse of Render: MCP from the project-level .roo/mcp.json, rules + commands from the .roo/ tree at whichever scope was requested.

func (*Adapter) KeyMergeStrategy

func (a *Adapter) KeyMergeStrategy() string

KeyMergeStrategy is roo's single key-merge strategy: JSON (.roo/mcp.json — the only file whose keys agentsync co-owns; rules/commands are whole-file writes).

func (*Adapter) Name

func (a *Adapter) Name() string

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 Roo Code.

MCP renders at project scope only (.roo/mcp.json); Roo's global MCP is VS Code globalStorage, which agentsync intentionally does not target (the prior-art consensus), so user-scope MCP is reported as a skip. Memory and commands render at BOTH scopes (~/.roo and <repo>/.roo). Roo has no native plugin enable-state agentsync models, so there is no PluginIngester; it still receives plugin-projected components on apply.

func (*Adapter) SetStderr

func (a *Adapter) SetStderr(w io.Writer)

SetStderr replaces the warning sink. See claude.Adapter.SetStderr.

type Options

type Options struct {
	TargetRoot string // honors AGENTSYNC_TARGET_ROOT
	LookPath   func(file string) (string, error)
	Stderr     io.Writer // Ingest warnings; nil means os.Stderr
}

Options configure the adapter at construction.

type Paths

type Paths struct {
	ConfigDir   string // ~/.roo (or <proj>/.roo) — also the Detect probe
	MCP         string // <proj>/.roo/mcp.json (project scope only; "" at user)
	RulesDir    string // .roo/rules (both scopes)
	CommandsDir string // .roo/commands (both scopes)
}

Paths resolves the destination paths for a given (scope, project, target-root). Roo uses the same `.roo/` layout at user scope (~/.roo) and project scope (<repo>/.roo). MCP is project-only: Roo's global MCP lives in VS Code's globalStorage (intentionally not targeted), so MCP is empty at user scope.

func ResolvePaths

func ResolvePaths(targetRoot, project string, projectScope bool) Paths

ResolvePaths returns the Paths for the given target root and optional project.

Jump to

Keyboard shortcuts

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