setup

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2026 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ClaudeEject

func ClaudeEject(configDir string) []error

ClaudeEject removes mnemon integration from the given Claude Code config dir.

func ClaudeRegisterHooks

func ClaudeRegisterHooks(configDir string, sel HookSelection) (string, error)

ClaudeRegisterHooks registers selected hooks in settings.json. Prime (SessionStart) is always registered.

When the project-local config dir collides with the user-global one (setup run from $HOME), hook commands are written as absolute paths so they honor the global file's contract and resolve from any session directory.

func ClaudeWriteHook

func ClaudeWriteHook(configDir, filename string, content []byte) (string, error)

ClaudeWriteHook writes a hook script to the hooks dir.

func ClaudeWriteSkill

func ClaudeWriteSkill(configDir string) (string, error)

ClaudeWriteSkill writes the mnemon skill to the config dir.

func CodexEject

func CodexEject(configDir string) []error

CodexEject removes mnemon integration from the given Codex config dir.

func CodexRegisterHooks

func CodexRegisterHooks(configDir string) (string, error)

CodexRegisterHooks registers Mnemon lifecycle hooks in hooks.json.

func CodexWriteHook

func CodexWriteHook(configDir, filename string, content []byte) (string, error)

CodexWriteHook writes a hook script to the Codex hooks directory.

func CodexWriteSkill

func CodexWriteSkill(configDir string) (string, error)

CodexWriteSkill writes the mnemon skill to the Codex skills directory.

func Confirm

func Confirm(prompt string, defaultYes bool) bool

Confirm prompts the user for a yes/no answer.

func CursorEject

func CursorEject(configDir string) []error

CursorEject removes mnemon skill and hooks from the given Cursor config dir.

func CursorRegisterHooks

func CursorRegisterHooks(configDir string, sel HookSelection) (string, error)

CursorRegisterHooks registers selected Mnemon lifecycle hooks in hooks.json.

func CursorWriteHook

func CursorWriteHook(configDir, filename string, content []byte) (string, error)

CursorWriteHook writes a hook script to the Cursor hooks directory.

func CursorWriteSkill

func CursorWriteSkill(configDir string) (string, error)

CursorWriteSkill writes the mnemon skill to the Cursor skills directory.

func DetectionLine

func DetectionLine(detected bool, display, version, path string)

DetectionLine prints a detection result line.

func EjectMemoryBlock

func EjectMemoryBlock(filePath string) (bool, error)

EjectMemoryBlock removes everything between <!-- mnemon:start --> and <!-- mnemon:end --> inclusive. Returns true if the file was modified.

func HermesEject

func HermesEject(configDir string) []error

HermesEject removes mnemon integration from the given Hermes config dir.

func HermesRegisterHooks

func HermesRegisterHooks(configDir string, sel HookSelection) (string, error)

HermesRegisterHooks registers selected Mnemon lifecycle hooks in config.yaml.

func HermesWriteHook

func HermesWriteHook(configDir, filename string, content []byte) (string, error)

HermesWriteHook writes a shell hook script to the Hermes agent-hooks directory.

func HermesWriteSkill

func HermesWriteSkill(configDir string) (string, error)

HermesWriteSkill writes the mnemon skill to the Hermes skills directory.

func HomeDir

func HomeDir() string

HomeDir returns the user's home directory.

func IsInteractive

func IsInteractive() bool

IsInteractive returns true if stdin is a TTY.

func NanobotEject

func NanobotEject(configDir string) []error

NanobotEject removes mnemon skill from the given nanobot config dir.

func NanobotWriteSkill

func NanobotWriteSkill(configDir string) (string, error)

NanobotWriteSkill writes the SKILL.md to the nanobot skills directory.

func OpenClawEject

func OpenClawEject(configDir string) []error

OpenClawEject removes mnemon skill, hook, and plugin from the given OpenClaw config dir.

func OpenClawRegisterPlugin

func OpenClawRegisterPlugin(configDir string, sel HookSelection) (string, error)

OpenClawRegisterPlugin adds the mnemon plugin entry to openclaw.json, recording which optional hooks the user selected.

func OpenClawWriteHook

func OpenClawWriteHook(configDir string) (string, error)

OpenClawWriteHook writes the mnemon-prime internal hook to the OpenClaw hooks directory.

func OpenClawWritePlugin

func OpenClawWritePlugin(configDir, ver string) (string, error)

OpenClawWritePlugin writes the mnemon plugin to the OpenClaw extensions directory. ver is the mnemon version string (e.g. from ldflags); it replaces the embedded manifest's static version field so the installed plugin always reflects the running binary.

func OpenClawWriteSkill

func OpenClawWriteSkill(configDir string) (string, error)

OpenClawWriteSkill writes the SKILL.md to the OpenClaw skills directory.

func PiEject

func PiEject(configDir string) []error

PiEject removes mnemon skill and extension from the given Pi config dir.

func PiWriteExtension

func PiWriteExtension(configDir string) (string, error)

PiWriteExtension writes the Mnemon lifecycle extension to Pi.

func PiWriteSkill

func PiWriteSkill(configDir string) (string, error)

PiWriteSkill writes the mnemon skill to the Pi skills directory.

func PrintPreview

func PrintPreview(text string)

PrintPreview prints text in dim color with indentation, suitable for showing defaults.

func ReadJSONFile

func ReadJSONFile(path string) (map[string]interface{}, error)

ReadJSONFile reads a JSON file into a map. Returns empty map if file doesn't exist. Tolerates JSON5-style // line comments and trailing commas.

func ReadLine

func ReadLine(prompt string) string

ReadLine reads a single line of text input.

func ReadMultiLine

func ReadMultiLine(prompt string) string

ReadMultiLine reads multi-line text input until a blank line or EOF.

func RemoveClaudeHooks

func RemoveClaudeHooks(data map[string]interface{})

RemoveClaudeHooks removes all mnemon-related entries from Claude Code hooks. Cleans up empty hook arrays and the hooks map itself when nothing remains.

func SelectMulti

func SelectMulti(title string, options []string, defaults []bool) []bool

SelectMulti shows a multi-select prompt with arrow key navigation. Uses raw terminal mode for ↑↓ + space selection when possible, falls back to number-input toggle for non-TTY environments.

func SelectOne

func SelectOne(prompt string, options []string, defaultIdx int) int

SelectOne shows a single-select prompt with arrow key navigation. Returns the index of the selected option.

func StatusError

func StatusError(step, total int, label string, err error)

StatusError prints a red cross status line.

func StatusOK

func StatusOK(step, total int, label, detail string)

StatusOK prints a green checkmark status line.

func StatusSkipped

func StatusSkipped(step, total int, label, detail string)

StatusSkipped prints a dimmed dot status line.

func StatusUpdated

func StatusUpdated(step, total int, label, detail string)

StatusUpdated prints a green checkmark with "updated" note.

func WriteJSONFile

func WriteJSONFile(path string, data map[string]interface{}) error

WriteJSONFile writes a map to a JSON file atomically via .tmp + rename.

func WriteOrRemoveJSONFile

func WriteOrRemoveJSONFile(path string, data map[string]interface{}) error

WriteOrRemoveJSONFile writes the settings, or removes the file if the map is empty.

func WritePromptFiles

func WritePromptFiles() (string, error)

WritePromptFiles writes guide.md and skill.md under promptDir.

Types

type Environment

type Environment struct {
	Name      string // "claude-code", "codex", "cursor", "openclaw", "nanobot", "pi", "hermes"
	Display   string // "Claude Code", "Codex", "Cursor", "OpenClaw", "Nanobot", "Pi", "Hermes Agent"
	Detected  bool   // CLI binary or global config dir found
	BinPath   string // exec.LookPath result
	Installed bool   // mnemon integration present at ConfigDir
	Version   string // CLI version string
	ConfigDir string // target config dir (local or global)
}

Environment describes a detected LLM CLI environment.

func DetectEnvironments

func DetectEnvironments(global bool) []Environment

DetectEnvironments probes for all supported LLM CLI environments. When global is false, ConfigDir points to project-local config; when true, it points to the user-global config for each environment.

type HookSelection

type HookSelection struct {
	Remind  bool // UserPromptSubmit — remind agent to evaluate recall/remember
	Nudge   bool // Stop — remind about memory on session end
	Compact bool // PreCompact — save insights before context compaction
}

HookSelection describes which optional hooks to install. Prime is always installed (mandatory).

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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