template

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: May 12, 2026 License: MIT Imports: 8 Imported by: 0

README

Adapter Template

Copy-paste boilerplate for adding a new tool integration to Sequoia.

Quick Start

  1. Copy this entire directory:

    cp -r adapters/_template adapters/my-tool
    
  2. Replace every TODO comment across all .go files:

    • adapter.go — adapter ID, name, detection logic, prompt strategy
    • paths.go — config directory path, system prompt filename
    • installer.go — system prompt injection logic
    • install.go — version constant, command file list
  3. Create the remaining command templates:

    cp templates/commands/sequoia-init.md templates/commands/sequoia-audit.md
    cp templates/commands/sequoia-init.md templates/commands/sequoia-review.md
    cp templates/commands/sequoia-init.md templates/commands/sequoia-fix.md
    cp templates/commands/sequoia-init.md templates/commands/sequoia-diff.md
    

    Then edit each command file with tool-specific content.

  4. Register the adapter in cmd/sequoia/main.go:

    import (
        // ... existing imports ...
        _ "sequoia-ai/adapters/my-tool"
    )
    
  5. Write tests using the checklist in CONTRIBUTING.md.

File Reference

File Purpose What to Replace
adapter.go ToolAdapter implementation ID, Name, Detect logic, PromptStrategy
paths.go OS-specific path helpers Config directory, system prompt filename
installer.go System prompt injection/removal Strategy (marker section, file replace, etc.)
install.go Install pipeline + helpers Version, command file list, template data
embed.go Embeds templates into binary Nothing — works as-is
templates/skill.md.tmpl SKILL.md template Agent roster content
templates/rules.md.tmpl System prompt content Tool-specific rules/sections
templates/commands/ Command files (5 total) Tool-specific command descriptions

Testing Checklist

See CONTRIBUTING.md for the complete testing checklist. Every adapter must have tests for:

  • Paths (skills, commands, system prompt, version file)
  • Interface (ID, name, strategy, detect, status)
  • Install (creates files, idempotent, preserves user content)
  • Uninstall (removes files, restores backups, safe on missing)

Reference Implementations

  • Cursor (adapters/cursor/) — cleanest, most up-to-date reference
  • Claude Code (adapters/claude/) — StrategyMarkdownSections example
  • OpenCode (adapters/opencode/) — StrategyFileReplace example
  • Gemini CLI (adapters/gemini/) — StrategyConfigMerge example
  • Codex (adapters/codex/) — StrategyTOMLMerge example

Need Help?

Read CONTRIBUTING.md at the repo root for the full step-by-step adapter development guide.

Documentation

Overview

Package template is a copy-paste boilerplate for creating new tool adapters. Replace every "TODO" comment with your tool-specific logic.

Steps to use this template:

  1. Copy this entire directory to adapters/{tool}/
  2. Replace "template" with your tool ID in all files
  3. Follow the TODO comments in order
  4. Register in cmd/sequoia/main.go with a blank import

See CONTRIBUTING.md for the full step-by-step guide.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateRulesMD

func GenerateRulesMD(path, content string) error

GenerateRulesMD writes Sequoia content to the system prompt file at path. If the file does not exist it is created. If it already contains Sequoia markers the file is replaced in place. If it contains other content the original file is backed up to path+".sequoia-backup" before replacement.

TODO: This function is for StrategyFileReplace. If your tool uses a different strategy, replace this with the appropriate injection logic:

  • StrategyMarkdownSections: InjectSection() / RemoveSection() (see adapters/claude/installer.go)
  • StrategyConfigMerge: similar to MarkdownSections (see adapters/gemini/installer.go)
  • StrategyTOMLMerge: TOML table merge (see adapters/codex/installer.go)

func RemoveRulesMD

func RemoveRulesMD(path string) error

RemoveRulesMD removes Sequoia from the system prompt file at path. If a backup exists the original content is restored. If no backup exists and the file is Sequoia-managed it is deleted. If the file is missing or contains no markers and no backup exists the function returns nil.

TODO: Match the approach used in GenerateRulesMD above.

Types

type Adapter

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

Adapter implements adapters.ToolAdapter. homeDir overrides os.UserHomeDir() for testing. Leave empty for production use.

func NewAdapter

func NewAdapter(homeDir string) *Adapter

NewAdapter creates an Adapter with an overridden home directory. Pass an empty string to use the real home directory (production use). Pass a temp directory in tests to avoid touching the real config directory.

func (*Adapter) CommandsPath

func (a *Adapter) CommandsPath() string

CommandsPath returns the absolute path to the commands directory.

func (*Adapter) Detect

func (a *Adapter) Detect() bool

Detect reports whether the tool appears to be installed on this machine.

TODO: Replace with tool-specific detection logic:

  • Check if the config directory exists (os.Stat)
  • Check if the binary is in PATH (exec.LookPath)
  • Return true if either check succeeds

func (*Adapter) ID

func (a *Adapter) ID() string

ID returns the unique machine-readable identifier.

TODO: Replace "template" with your adapter ID (e.g. "my-tool"). Must be lowercase, kebab-case, and unique across all adapters.

func (*Adapter) Install

func (a *Adapter) Install(opts adapters.InstallOpts) error

Install installs Sequoia files for this tool.

func (*Adapter) IsInstalled

func (a *Adapter) IsInstalled() bool

IsInstalled reports whether Sequoia has already been installed for this tool.

TODO: Choose the right check for your tool:

  • If the system prompt is a dedicated file, check os.Stat(systemPromptPath(base))
  • If it's a section in a config file, check for marker presence

func (*Adapter) Name

func (a *Adapter) Name() string

Name returns the human-readable display name.

TODO: Replace "Template Tool" with the tool's brand name (e.g. "My Tool").

func (*Adapter) PromptStrategy

func (a *Adapter) PromptStrategy() adapters.PromptStrategy

PromptStrategy returns the injection strategy used by this adapter.

TODO: Choose the right strategy for your tool:

  • StrategyMarkdownSections: inject markers into a Markdown file
  • StrategyFileReplace: dedicated file, full replace with backup
  • StrategyConfigMerge: config file with markers (non-Markdown format)
  • StrategyTOMLMerge: TOML config merge

See CONTRIBUTING.md for guidance on each strategy.

func (*Adapter) SkillsPath

func (a *Adapter) SkillsPath() string

SkillsPath returns the absolute path to the skills directory.

func (*Adapter) Status

func (a *Adapter) Status() adapters.AdapterStatus

Status returns the current installation status. It populates Version from the .sequoia-version file when present.

func (*Adapter) SystemPromptPath

func (a *Adapter) SystemPromptPath() string

SystemPromptPath returns the absolute path to the system prompt file.

func (*Adapter) Uninstall

func (a *Adapter) Uninstall(opts adapters.InstallOpts) error

Uninstall removes Sequoia files for this tool.

Jump to

Keyboard shortcuts

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