profile

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Apr 20, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package profile manages css profiles: saving, restoring, listing, deleting, and tracking the active profile.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ValidateName

func ValidateName(name string) error

ValidateName checks that name is safe to use as a profile identifier.

Types

type Profile

type Profile struct {
	Name      string    `json:"name"`
	CreatedAt time.Time `json:"created_at"`
	UpdatedAt time.Time `json:"updated_at"`
}

Profile is a saved subscription snapshot.

type State

type State struct {
	Active string `json:"active,omitempty"`
}

State is the persisted global css state.

type Store

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

Store is the profile repository.

func Open

func Open() (*Store, error)

Open initialises (if necessary) and opens the Store in the user home directory.

func (*Store) Activate

func (s *Store) Activate(name string) error

Activate switches to the named profile.

Sequence:

  1. If another profile is currently active, write its current state back to disk first (preserves session, context, todos, etc.).
  2. Remove all Claude files/dirs from the home directory.
  3. Restore the target profile payload into the home directory.
  4. Update state.json.

func (*Store) Active

func (s *Store) Active() (string, error)

Active returns the name of the active profile (empty string when none).

func (*Store) Delete

func (s *Store) Delete(name string) error

Delete permanently removes a saved profile. If the deleted profile was active, the active flag is cleared.

func (*Store) Exists

func (s *Store) Exists(name string) bool

Exists reports whether a profile with the given name is saved.

func (*Store) List

func (s *Store) List() ([]Profile, error)

List returns all saved profiles sorted by name.

func (*Store) Root

func (s *Store) Root() string

Root returns the css root directory path.

func (*Store) Save

func (s *Store) Save(name string) (Profile, error)

Save snapshots the current Claude state under the given profile name. Overwrites any existing snapshot with the same name.

func (*Store) SetActive

func (s *Store) SetActive(name string) error

SetActive sets or clears (name == "") the active profile.

func (*Store) State

func (s *Store) State() (State, error)

State loads the global state.json.

Jump to

Keyboard shortcuts

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