setup

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: May 3, 2026 License: MIT Imports: 12 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.

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 Confirm

func Confirm(prompt string, defaultYes bool) bool

Confirm prompts the user for a yes/no answer.

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 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 OpenClawEject

func OpenClawEject(configDir string) []error

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

func OpenClawRegisterPlugin added in v0.1.1

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 added in v0.1.1

func OpenClawWriteHook(configDir string) (string, error)

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

func OpenClawWritePlugin added in v0.1.1

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 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 to ~/.mnemon/prompt/.

Types

type Environment

type Environment struct {
	Name      string // "claude-code", "openclaw"
	Display   string // "Claude Code", "OpenClaw"
	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 (.claude/); when true, it points to the user-global config (~/.claude/).

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