installmeta

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: 8 Imported by: 0

Documentation

Overview

Package installmeta persists install-time metadata to ~/.nself/install-meta.json.

The install source (NSELF_INSTALL_REF env var) is captured at install time by install.sh and persisted here. The value is sanitized to prevent injection.

Schema (v1):

{
  "install_source": "hn",       // sanitized ref from ?ref= query param or NSELF_INSTALL_REF env
  "install_date":  "2026-04-20T10:00:00Z",
  "cli_version":   "1.0.9",
  "schema_version": 1,
  "_p95_note": "install_source included in ping_api telemetry from v1.1.0 (S54-T05)"
}

P95 integration point: the telemetry package reads InstallSource() and sends it in the ping_api telemetry payload as "install_source" (S54-T05, v1.1.0).

S57-T11 — 2026-04-20

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InstallSource

func InstallSource() string

InstallSource returns the sanitized install source string, or "unknown" if not set. Safe to call at any time — never errors.

func SanitizeRef

func SanitizeRef(raw string) string

SanitizeRef strips disallowed characters and caps length. Input: raw ref from NSELF_INSTALL_REF or ?ref= query param. Output: safe ASCII string suitable for JSON and logging.

func Write

func Write(rawRef string) error

Write creates or overwrites ~/.nself/install-meta.json with the given ref. The nself home directory is created if it does not exist.

Types

type Meta

type Meta struct {
	InstallSource string `json:"install_source"`
	InstallDate   string `json:"install_date"`
	CLIVersion    string `json:"cli_version"`
	SchemaVersion int    `json:"schema_version"`
	P95Note       string `json:"_p95_note"`
}

Meta holds install-time metadata.

func Read

func Read() (Meta, error)

Read reads the current install-meta.json. Returns zero Meta if the file does not exist.

Jump to

Keyboard shortcuts

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