home

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package home resolves and manages the per-user gskill home directory (default ~/.gskill, relocatable only via GSKILL_HOME). The home holds the global content-addressed store plus its cache, staging area, locks, advisory project registry, GC pins, quarantine, and user config — all under one root so atomic renames never cross filesystems.

Index

Constants

View Source
const EnvHome = "GSKILL_HOME"

EnvHome is the environment variable that relocates the entire gskill home. It is the only relocation mechanism; there is no config-file equivalent.

Variables

This section is empty.

Functions

func Dir

func Dir() (string, error)

Dir resolves the gskill home directory: $GSKILL_HOME if set, else ~/.gskill. It does not create anything.

func FilePerm

func FilePerm() fs.FileMode

FilePerm returns the owner-only file mode for files written under the home.

Types

type Finding

type Finding struct {
	// Path is the offending file or directory.
	Path string
	// Problem describes what is unsafe (e.g. world-writable).
	Problem string
	// Remedy is the suggested fix the user can run.
	Remedy string
}

Finding is one unsafe-permission observation under the home.

func (Finding) String

func (f Finding) String() string

String renders the finding as a one-line diagnostic.

type Home

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

Home is a resolved gskill home root with accessors for its fixed layout. Store, tmp, and locks all live under one root so staged content can be promoted with an atomic same-filesystem rename.

func New

func New(root string) *Home

New returns a Home rooted at root.

func Open

func Open() (*Home, error)

Open resolves the home via Dir and ensures its layout exists.

func (*Home) CacheDir

func (h *Home) CacheDir() string

CacheDir returns the download cache directory.

func (*Home) CheckPathSafety

func (h *Home) CheckPathSafety(path string) error

CheckPathSafety fails when path (a store object or other trusted location) is group/world-writable or owned by another user. Activation uses it to refuse unsafe objects fail-closed (FR-033).

func (*Home) CheckPerms

func (h *Home) CheckPerms() ([]Finding, error)

CheckPerms audits the home tree for dangerous permissions: group- or world-writable directories/files and entries owned by another user. It reports findings rather than failing, so callers decide whether to warn or refuse (FR-033).

func (*Home) ConfigFile

func (h *Home) ConfigFile() string

ConfigFile returns the user-level config file path inside the home.

func (*Home) Ensure

func (h *Home) Ensure() error

Ensure creates the home layout with owner-only permissions. It is idempotent and never loosens permissions on existing directories.

func (*Home) LocksDir

func (h *Home) LocksDir() string

LocksDir returns the directory holding all gskill lock files.

func (*Home) PinsDir

func (h *Home) PinsDir() string

PinsDir returns the directory of GC pin markers.

func (*Home) ProjectsDir

func (h *Home) ProjectsDir() string

ProjectsDir returns the advisory project-registry directory.

func (*Home) QuarantineDir

func (h *Home) QuarantineDir() string

QuarantineDir returns where corrupted store objects are moved.

func (*Home) Root

func (h *Home) Root() string

Root returns the home root directory.

func (*Home) StoreDir

func (h *Home) StoreDir() string

StoreDir returns the content-addressed global store root.

func (*Home) TmpDir

func (h *Home) TmpDir() string

TmpDir returns the staging area for in-flight object admissions.

Jump to

Keyboard shortcuts

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