roo

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Jul 28, 2026 License: MIT Imports: 12 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` → http, `sse` → sse, and stdio otherwise. Native keys agentsync doesn't model (cwd, timeout, alwaysAllow, …) are preserved in Extra.

Transport normalization (documented in docs/capability-matrix.md → "Roo Code / MCP remote"): Roo records a remote server's transport in an explicit `type` (`streamable-http`/`sse`), so a native `sse` server round-trips `sse → sse` losslessly. A canonical server with NO explicit transport — Type == "" with a URL and no command — is treated as remote by rooMCPSpec.isRemote and rendered as `type: streamable-http`, so it canonicalizes to `http` on capture and thereafter round-trips `http → streamable-http → http` STABLY. To make that same normalization hold for a HAND-authored native entry that carries only a `url` (no `type`, no `command`), a url-bearing/command-less untyped entry is also canonicalized to `http` here — otherwise it would be misread as `stdio` and its URL dropped on the next render. So the single rule, in both directions, is: "url + no command, no explicit transport ⇒ remote http".

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

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

Detect reports whether Roo Code appears installed under the target root by the presence of its `.roo/` config dir. Roo Code is a VS Code(-family) extension with NO standalone `roo` CLI on PATH (see the package doc and docs.roocode.com), so — unlike agents backed by a real binary — there is no executable to probe: a `LookPath("roo")` check could only ever fire on an unrelated binary, so it is deliberately absent. Detection is the config-dir stat only. Informational (the `doctor` command consumes it); it never gates apply.

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.

func (*Adapter) VersionRoots added in v0.7.5

func (a *Adapter) VersionRoots(scope adapter.Scope, project string) []string

VersionRoots implements adapter.VersionedDirs: the user-scope ~/.roo config dir is the local-only git-backup root (issue #118). Returns nil at project scope.

type Options

type Options struct {
	TargetRoot string    // honors AGENTSYNC_TARGET_ROOT
	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