Help us shape the future of Go! Take the 2026 Go Developer Survey

onboardingclient

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2026 License: MIT Imports: 15 Imported by: 0

Documentation

Overview

Package onboardingclient prepares complete assistant settings in a private, isolated home. It never installs a candidate or writes an active config.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Candidate

type Candidate struct {
	Client          Client     `json:"client"`
	ActivePath      string     `json:"active_path"`
	Path            string     `json:"path"`
	IsolationDir    string     `json:"isolation_dir"`
	OriginalSHA256  string     `json:"original_sha256"`
	CandidateSHA256 string     `json:"candidate_sha256"`
	OriginalExists  bool       `json:"original_exists"`
	Validation      Validation `json:"validation"`
	// contains filtered or unexported fields
}

func Plan

func Plan(ctx context.Context, options Options) (_ *Candidate, err error)

Plan copies the complete original settings, applies only the Questlock server through the native CLI when available, and validates the full result. The caller must close the candidate even after a separate install transaction.

func (*Candidate) Close

func (c *Candidate) Close() error

Close removes private copies of complete settings, which can contain secrets.

type Client

type Client string
const (
	Codex         Client = "codex"
	ClaudeCode    Client = "claude-code"
	ClaudeDesktop Client = "claude-desktop"
)

type CodexSnapshot

type CodexSnapshot struct {
	Config map[string]any `json:"config"`
	Layers []struct {
		Name struct {
			Type string `json:"type"`
			File string `json:"file"`
		} `json:"name"`
		Config map[string]any `json:"config"`
	} `json:"layers"`
}

type Command

type Command struct {
	Executable string
	Args       []string
	Env        []string
	Dir        string
}

type Options

type Options struct {
	Client        Client
	HomeDir       string
	CodexHome     string
	ConfigPath    string
	Executable    string
	QuestlockPath string
	Workspace     string
	StateDir      string
	Runner        Runner // Optional test/host injection; nil runs native binaries.
	// SkipNativeMCPRead keeps Inspect from running Claude's MCP get command.
	// Exact static settings are still checked; native validation stays false.
	SkipNativeMCPRead bool
	// contains filtered or unexported fields
}

type Report

type Report struct {
	Client          Client     `json:"client"`
	ConfigPath      string     `json:"config_path"`
	Executable      string     `json:"executable,omitempty"`
	ClientAvailable bool       `json:"client_available"`
	ConfigExists    bool       `json:"config_exists"`
	ConfigSHA256    string     `json:"config_sha256,omitempty"`
	ServerPresent   bool       `json:"server_present"`
	OtherServers    int        `json:"other_servers"`
	NotifyArguments int        `json:"notify_arguments,omitempty"`
	Status          string     `json:"status"`
	Validation      Validation `json:"validation"`
}

Report contains redacted facts only. Native command output and settings values must never appear in diagnostic output, including native command failures.

func Inspect

func Inspect(ctx context.Context, options Options) (Report, error)

Inspect reads the active bytes, but native parsing happens in a private copy. It never runs the active app, reveals config values, or changes active files.

type Runner

type Runner interface {
	Run(context.Context, Command) ([]byte, error)
	CodexRead(context.Context, Command) (CodexSnapshot, error)
}

Runner runs only configuration commands. CodexRead performs initialize, initialized, then config/read with includeLayers=true; it starts no thread.

type Validation

type Validation struct {
	Status             string `json:"status"`
	NativeValidated    bool   `json:"native_validated"`
	PreservedSettings  bool   `json:"preserved_settings"`
	ExactServer        bool   `json:"exact_server"`
	NotifyPreserved    bool   `json:"notify_preserved"`
	RequiresNativeRead bool   `json:"requires_native_read"`
}

Validation separates a syntactically preserved candidate from a native client read. Desktop has no documented isolated config reader and always requires native application verification before an active-file transaction can commit.

func CheckLive

func CheckLive(ctx context.Context, options Options) (Validation, error)

CheckLive asks a CLI to read the actual installed file without generating or installing settings. Unlike Inspect, Claude Code's native command may perform its own bookkeeping or start the configured local MCP server. No model turn or paid API is requested. Call only during an explicit config transaction.

func CheckLiveBaseline

func CheckLiveBaseline(ctx context.Context, options Options) (Validation, error)

CheckLiveBaseline verifies a restored complete live configuration without requiring the newly generated Questlock command. Codex can read the complete user layer directly. Claude Code and Desktop do not expose a documented non-mutating native whole-config reader for an arbitrary prior configuration; restoration must remain explicitly unverified until native evidence exists. In particular, this method never adds or removes a live validation probe.

func Validate

func Validate(ctx context.Context, options Options, data []byte) (Validation, error)

Validate independently stages complete candidate bytes and requires the exact Questlock command. It does not compare a baseline; Plan/ValidateCandidate do.

func ValidateBaseline

func ValidateBaseline(ctx context.Context, options Options, data []byte) (Validation, error)

ValidateBaseline asks the native client to read a complete existing config without requiring a Questlock server to have already been installed.

func ValidateCandidate

func ValidateCandidate(ctx context.Context, c *Candidate) (Validation, error)

Jump to

Keyboard shortcuts

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