onboarding

package
v1.1.2 Latest Latest
Warning

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

Go to latest
Published: May 15, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package onboarding implements the 6-stage onboarding funnel check for nself doctor --install-check.

Each stage is checked in order; a failed stage marks subsequent stages as skipped. Telemetry events are fired for each PASS via the telemetry package (fire-and-forget, opt-in only).

Package onboarding reads state files written by existing CLI commands to determine where a user is in the 6-stage onboarding funnel.

State files live under ~/.config/nself/ and are written by:

  • install-id — Q07 telemetry client (install identity)
  • projects.json — nself init
  • last-start.timestamp — nself start
  • plugin-state.yaml — nself plugin install
  • query-count — Hasura telemetry hook (optional)
  • usage.log — nself start (one line per invocation)

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FirstInstalledPlugin

func FirstInstalledPlugin() (name, tier string)

FirstInstalledPlugin returns the name of the first installed plugin from ~/.config/nself/plugin-state.yaml, plus a tier string. Returns ("", "") if absent.

func InstallID

func InstallID() string

InstallID reads ~/.config/nself/install-id. Returns empty string if absent (Q07 not yet run).

func LastStartTime

func LastStartTime() time.Time

LastStartTime reads ~/.config/nself/last-start.timestamp. Returns zero time if absent.

func ProjectsCount

func ProjectsCount() int

ProjectsCount returns the number of initialized projects from ~/.config/nself/projects.json. Returns 0 if absent.

func QueryCount

func QueryCount() int

QueryCount reads ~/.config/nself/query-count. Returns -1 if absent (UNKNOWN, e.g. self-host without telemetry hook). Returns 0+ when the file exists.

func RecentStartCount

func RecentStartCount() int

RecentStartCount returns the number of nself start invocations in the last 7 days by counting lines in ~/.config/nself/usage.log that contain a timestamp within the window. Returns 0 if absent.

Types

type FunnelReport

type FunnelReport struct {
	Stages   []StageResult `json:"stages"`
	Position int           `json:"funnel_position"` // highest passing stage (1-6), 0 if none
	Next     string        `json:"next_action"`
}

FunnelReport is the full 6-stage funnel result.

func RunFunnel

func RunFunnel() FunnelReport

RunFunnel executes all 6 stages and returns the report. Telemetry events are fired for each passing stage (no-op when opt-out).

type StageResult

type StageResult struct {
	ID          int                    `json:"id"`
	Name        string                 `json:"name"`
	Status      StageStatus            `json:"status"`
	Message     string                 `json:"message"`
	Remediation string                 `json:"remediation,omitempty"`
	Metadata    map[string]interface{} `json:"metadata,omitempty"`
}

StageResult is the outcome of one funnel stage.

type StageStatus

type StageStatus string

StageStatus is the result of a single funnel stage check.

const (
	StatusPass    StageStatus = "pass"
	StatusFail    StageStatus = "fail"
	StatusUnknown StageStatus = "unknown" // file absent, cannot determine
	StatusSkipped StageStatus = "skipped" // prior stage failed
)

Jump to

Keyboard shortcuts

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