profilesync

package
v0.16.399 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2026 License: AGPL-3.0 Imports: 21 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package profilesync syncs a person's Claude Code profile through the hub's store: the room is the person's (filestore.Profile), sealed with a room key that the hub's safe keeps for the person, and the plugins the settings enable are installed on each machine. It takes over from design-sync's profile agents (design-sync-profile-*), whose rooms and key it keeps: a machine that still has a design-sync identity opens the key wrapped for it once and puts it in the safe, and from then on every machine of the person reads it from there.

Index

Constants

View Source
const KeySecret = "profile-room-key"

KeySecret is the name the room key is kept under in the person's folder of the hub's safe.

Variables

View Source
var ErrNoKey = errors.New("the profile's room key is neither in the hub's safe nor wrapped for this machine")

ErrNoKey: the room has a key, and neither the safe nor any design-sync identity on this machine opens it. Another machine of the person that has one puts it in the safe as soon as it runs.

Functions

func Identities

func Identities(state string) []string

Identities are design-sync's identities on this machine: its profile agents kept them in the profile's state folder (state, absolute), as agent-<person>/identity.age.

func Key

func Key(ctx context.Context, safe Safe, folder string, room Room, identities []string) ([]byte, error)

Key finds the room key: the safe's; else the one design-sync wrapped for an identity on this machine (put in the safe then); else, for a room nobody keyed yet and that holds nothing, a new one (put in the safe). folder is the safe's folder of the person ("me").

func Mark

func Mark(dir string, plugins, skills bool) error

Mark tells the platform that plugins or skills changed: it reloads them in idle Claude tabs. The file is claude-reload.json in the profile's state folder (dir, absolute), `{"plugins": ms, "skills": ms}`, written atomically.

func Run

func Run(ctx context.Context, o Options)

Run keeps the profile in step with its room until ctx ends: it waits for the room key, then syncs HOME and keeps the plugins the settings enable installed.

Types

type Options

type Options struct {
	Home      string
	Workspace string
	// State is the HOME-relative folder of the sync's state, design-sync's identities and the reload mark
	// ("" = storelink.DefaultProfileState).
	State string
	// LocalKeys are settings keys that stay on the machine besides filesync.DefaultLocalKeys ("env.MY_ROOT").
	LocalKeys []string
	// Claude is the CLI the plugins are installed with ("" = claude on PATH).
	Claude string
	// Safe is the hub's safe, the person's secrets under Folder.
	Safe   Safe
	Folder string
	Link   *storelink.Link
	Log    *slog.Logger
}

Options say whose profile syncs and how.

type Reconciler

type Reconciler struct {
	Home   string
	Claude string // the CLI; "" = `claude` on PATH
	Log    *slog.Logger
	// contains filtered or unexported fields
}

Reconciler installs and updates one person's plugins with the official CLI (`claude plugin …`), as that person.

func (*Reconciler) Reconcile

func (r *Reconciler) Reconcile(ctx context.Context) (bool, error)

Reconcile refreshes the marketplaces, installs enabled plugins that are missing, updates enabled plugins of every marketplace that moved, and reports whether anything changed.

type Room

type Room interface {
	Keys(ctx context.Context) ([]filestore.WrappedKey, error)
	Changes(ctx context.Context, since int64, wait time.Duration) (filestore.Changes, error)
}

Room is what the key needs of the profile's room.

type Safe

type Safe interface {
	Read(ctx context.Context, path string) (map[string]string, error)
	Write(ctx context.Context, path string, data map[string]string) error
}

Safe is the person's folder of the hub's safe (agent.LocalSafe under "me/").

Jump to

Keyboard shortcuts

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