setup

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2026 License: MIT Imports: 15 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 setup owns the user-facing installation state: which transport is installed, where its artifacts live, which global clients are registered, and how all of that is diagnosed and removed. It deliberately lives outside the browser engine because installation is a local-filesystem concern and must not create a Chrome process.

Index

Constants

View Source
const (
	DefaultClients = "claude,codex,grok"
)

Variables

View Source
var BundledSkillNames = []string{"ghostchrome"}

BundledSkillNames lists every skill ghostchrome ships, used for removal even when the embed is empty (e.g. a stripped build).

Functions

func BinarySuffix

func BinarySuffix() string

func Home

func Home() (string, error)

func InstallEmbeddedSkills

func InstallEmbeddedSkills() ([]string, error)

InstallEmbeddedSkills writes each bundled skill to ~/.claude/skills/<name>/. Returns the installed paths. Best-effort: failures are reported, not fatal.

func InstalledSkillDirs

func InstalledSkillDirs() []string

InstalledSkillDirs returns the on-disk dirs of bundled skills that exist.

func InstructionPath

func InstructionPath(home, client string) string

func LegacyMCPPresent

func LegacyMCPPresent(paths Paths, clients []string) (bool, error)

func ParseClients

func ParseClients(value string) ([]string, error)

func PrintDoctor

func PrintDoctor(out io.Writer, checks []DoctorCheck, strict, asJSON bool) error

func PrintStatus

func PrintStatus(out io.Writer, status Status, asJSON bool) error

func RemoveInstalledSkills

func RemoveInstalledSkills() int

RemoveInstalledSkills deletes every bundled skill dir from ~/.claude/skills. Returns the count removed.

func RunInstructions

func RunInstructions(out io.Writer, write bool, clientsFlag string) error

RunInstructions rewrites the managed policy block in every selected client instruction file. write must be the confirmation the caller obtained; clientsFlag is the raw comma-separated client list.

func SetEmbeddedSkill

func SetEmbeddedSkill(name, content string)

SetEmbeddedSkill registers an embedded skill's content (called from the binary entrypoint that owns the embed).

func SetEmbeddedSkillFile

func SetEmbeddedSkillFile(path, content string)

SetEmbeddedSkillFile registers one path from the complete embedded skill tree. Paths are relative to the skill directory and must not escape it.

func SetVersion

func SetVersion(v string)

SetVersion records the binary version written into the manifest.

func Uninstall

func Uninstall(yes, purge bool, out, errOut io.Writer) error

func UserSkillsDir

func UserSkillsDir() (string, error)

Types

type Check

type Check struct {
	Name   string `json:"name"`
	Status string `json:"status"`
	Detail string `json:"detail,omitempty"`
}

Check is one line of the runtime diagnostic reported by `ghostchrome doctor`.

func Diagnose

func Diagnose() []Check

Diagnose inspects the local runtime: Chrome, profiles, extensions, init scripts, CDP reachability, proxy and vault configuration. It never starts a browser; the CDP probe only looks for one that is already listening.

type DoctorCheck

type DoctorCheck struct {
	Name   string `json:"name"`
	Status string `json:"status"`
	Detail string `json:"detail,omitempty"`
}

func RunDoctor

func RunDoctor(strict bool) ([]DoctorCheck, error)

type Manifest

type Manifest struct {
	SchemaVersion int      `json:"schema_version"`
	Mode          Mode     `json:"mode"`
	Version       string   `json:"version"`
	InstallRoot   string   `json:"install_root"`
	Binary        string   `json:"binary"`
	Clients       []string `json:"clients"`
	SkillSHA256   string   `json:"skill_sha256,omitempty"`
	ManagedFiles  []string `json:"managed_files"`
	InstalledAt   string   `json:"installed_at"`
}

Manifest is intentionally small and forward-compatible. Paths are absolute so a client can consume the file without having to expand `~`. managed_files contains files Ghostchrome may update/remove; it never grants permission to remove arbitrary user files.

func Install

func Install(mode Mode, clients []string, force bool) (*Manifest, error)

func ReadManifest

func ReadManifest(paths Paths) (*Manifest, error)

type Mode

type Mode string

func ParseMode

func ParseMode(value string) (Mode, error)

type Paths

type Paths struct {
	Home         string
	Root         string
	BinDir       string
	Manifest     string
	Lock         string
	CLI          string
	MCP          string
	ClaudeConfig string
	CodexConfig  string
	GrokConfig   string
}

func PathsForHome

func PathsForHome(home string) Paths

type Status

type Status struct {
	Configured bool                `json:"configured"`
	Manifest   *Manifest           `json:"manifest,omitempty"`
	Artifacts  []string            `json:"artifacts"`
	Clients    []setupClientStatus `json:"clients"`
}

func GatherStatus

func GatherStatus() (Status, error)

Jump to

Keyboard shortcuts

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