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

model

package
v1.4.15 Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2026 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

Package model holds the wire types of the plugin catalog generator (contract:plugins.catalog v1, contract:plugins.registry, contract:plugins.counts).

Purpose: one definition of every document tools/catalog reads or writes, so tools/schemagen can generate schemas/catalog.v1.schema.json and schemas/releases.v1.schema.json from the same Go types the generator uses. Inputs: none (types only). Outputs: the types and enum values below. Constraints: standard library only; every optional key is omitempty and every nullable catalog key is a pointer, so a written document never carries a key the contract does not list.

Index

Constants

View Source
const (
	CatalogVersion  = 1
	ReleasesVersion = 1
	CountsVersion   = 1
	RegistryVersion = "2.0.0"

	TierFree     = "free"     // catalog and bundles.json license axis
	TierLicensed = "licensed" // catalog license axis
	WireFree     = "free"     // registry `tier` wire value, free
	WirePro      = "pro"      // registry `tier` wire value, licensed (kept for released CLIs)
	SigAlg       = "ed25519"

	// BinaryPattern is the name of a plugin command binary.
	BinaryPattern = `^nself-[a-z][a-z0-9-]*$`
)

Schema versions and tier wire values.

View Source
const Generated = "GENERATED BY tools/catalog — DO NOT HAND EDIT"

Generated marker written as `_generated` in every output file.

Variables

Tiers is the catalog `tier` enum.

Functions

This section is empty.

Types

type BundleEntry

type BundleEntry struct {
	Display string   `json:"display"`
	Tier    string   `json:"tier"`
	Plugins []string `json:"plugins"`
}

BundleEntry is one bundle of bundles.json. Tier is `free` or `paid` there.

type Bundles

type Bundles struct {
	SchemaVersion string                 `json:"schema_version"`
	Bundles       map[string]BundleEntry `json:"bundles"`
}

Bundles is bundles.json, the membership source of truth (ADR 0008). Only the keys the generator reads are decoded; prices and pages are not catalog data.

type CLICommand

type CLICommand struct {
	Name        string `json:"name"`
	Description string `json:"description"`
}

CLICommand is one cliCommands entry.

type Catalog

type Catalog struct {
	Generated     string                   `json:"_generated"`
	SchemaVersion int                      `json:"schema_version"`
	GeneratedFrom GeneratedFrom            `json:"generated_from"`
	Plugins       []CatalogPlugin          `json:"plugins"`
	Bundles       map[string]CatalogBundle `json:"bundles"`
	Counts        Counts                   `json:"counts"`
}

Catalog is catalog.json (contract:plugins.catalog v1). Plugins are sorted by (slug, tier); a tier-pair slug appears once per tier and counts once.

type CatalogBundle

type CatalogBundle struct {
	Display string   `json:"display"`
	Tier    string   `json:"tier"`
	Plugins []string `json:"plugins"`
}

CatalogBundle is one bundle of bundles.json: tier is free or licensed.

type CatalogPlugin

type CatalogPlugin struct {
	Slug             string     `json:"slug"`
	Tier             string     `json:"tier"`
	Version          string     `json:"version"`
	Description      string     `json:"description"`
	Category         string     `json:"category"`
	Maturity         string     `json:"maturity"`
	Installable      bool       `json:"installable"`
	ServiceKind      string     `json:"service_kind"`
	Commands         *Commands  `json:"commands"`
	Schema           *string    `json:"schema"`
	Requires         *Requires  `json:"requires"`
	DocsURL          *string    `json:"docs_url"`
	Bundles          []string   `json:"bundles"`
	TierPair         bool       `json:"tier_pair"`
	Checksum         string     `json:"checksum"`
	ReleaseSignature *Signature `json:"release_signature"`
	TarballURL       string     `json:"tarball_url"`
}

CatalogPlugin is one row of the catalog. Nullable keys are pointers and are always written (null), so a consumer never has to tell absent from empty.

type Checksums

type Checksums struct {
	SHA256    string            `json:"sha256"`
	Platforms map[string]string `json:"platforms,omitempty"`
}

Checksums is the nested checksum object of a free entry.

type Commands

type Commands struct {
	Command     string   `json:"command"`
	Subcommands []string `json:"subcommands"`
}

Commands is the command surface of a plugin: the root command and every subcommand path.

type Counts

type Counts struct {
	Generated     string        `json:"_generated"`
	SchemaVersion int           `json:"schema_version"`
	GeneratedFrom GeneratedFrom `json:"generated_from"`
	Free          TierCount     `json:"free"`
	Pro           TierCount     `json:"pro"`
	Overlap       Overlap       `json:"overlap"`
	Totals        Totals        `json:"totals"`
	Advertised    int           `json:"advertised"`
}

Counts is counts.json (contract:plugins.counts v1). The wire key `pro` is kept for the vendored consumer (internal/plugin/count). `generated_at` and `sources` of the old script are replaced by generated_from.

type GeneratedFrom

type GeneratedFrom struct {
	PluginsRef  string `json:"plugins_ref"`
	BundlesRef  string `json:"bundles_ref"`
	GeneratedAt string `json:"generated_at"`
}

GeneratedFrom records the inputs of a run. GeneratedAt is the only timestamp in any output and is supplied by the caller, never read from a clock.

type Implementation

type Implementation struct {
	Language   string `json:"language,omitempty"`
	Runtime    string `json:"runtime,omitempty"`
	EntryPoint string `json:"entryPoint,omitempty"`
	PluginType string `json:"pluginType,omitempty"`
	BinaryName string `json:"binaryName,omitempty"`
}

Implementation is the nested block released CLIs read for pluginType and binaryName (registry_json.go:107-127 at v1.4.12).

type Info

type Info struct {
	Maturity    string    `json:"maturity"`
	ServiceKind string    `json:"service_kind"`
	Commands    *Commands `json:"commands,omitempty"`
	Schema      string    `json:"schema,omitempty"`
	Requires    *Requires `json:"requires,omitempty"`
	DocsURL     string    `json:"docs_url,omitempty"`
}

Info is the manifest-only part of a catalog row. It travels inside each registry entry (key `catalog`) so a catalog can be built from registry.json alone: the public repo never parses licensed manifests (Epic D3).

type Overlap

type Overlap struct {
	SharedSlugs []string `json:"sharedSlugs"`
	TierPairs   []string `json:"tierPairs"`
	Duplicates  []string `json:"duplicates"`
}

Overlap lists slugs present in both registries: one two-tier product each, counted once. tierPairs and duplicates hold the same slugs.

type Registry

type Registry struct {
	Generated         string                   `json:"_generated"`
	GeneratedFrom     GeneratedFrom            `json:"generated_from"`
	SchemaVersion     string                   `json:"schema_version"`
	Tier              string                   `json:"tier"`
	ChecksumAlgorithm string                   `json:"checksum_algorithm"`
	PluginsCount      int                      `json:"plugins_count"`
	Plugins           map[string]RegistryEntry `json:"plugins"`
}

Registry is registry.json: the released-CLI registry v2 shape plus the `_generated` and `generated_from` keys. Plugins is keyed by slug.

type RegistryEntry

type RegistryEntry struct {
	Name            string `json:"name"`
	Version         string `json:"version"`
	Description     string `json:"description"`
	Category        string `json:"category"`
	Tier            string `json:"tier"`
	License         string `json:"license"`
	MinNselfVersion string `json:"minNselfVersion,omitempty"`
	// MinNselfVersionSnake duplicates MinNselfVersion under its older key.
	MinNselfVersionSnake string          `json:"min_nself_version,omitempty"`
	RequiresLicense      bool            `json:"requires_license"`
	Language             string          `json:"language,omitempty"`
	Tags                 []string        `json:"tags"`
	Tables               []string        `json:"tables"`
	Author               string          `json:"author,omitempty"`
	Port                 int             `json:"port,omitempty"`
	Installable          *bool           `json:"installable,omitempty"`
	Dependencies         json.RawMessage `json:"dependencies"`
	Implementation       *Implementation `json:"implementation,omitempty"`
	CLICommands          []CLICommand    `json:"cliCommands,omitempty"`
	TierPair             bool            `json:"tier_pair,omitempty"`
	Bundles              []string        `json:"bundles,omitempty"`

	Checksum         string     `json:"checksum"`
	Checksums        *Checksums `json:"checksums,omitempty"`
	Tarball          string     `json:"tarball,omitempty"`
	TarballURL       string     `json:"tarballUrl,omitempty"`
	DownloadURL      string     `json:"download_url,omitempty"`
	ReleaseTag       string     `json:"releaseTag,omitempty"`
	ReleaseSignature *Signature `json:"release_signature,omitempty"`
	Catalog          *Info      `json:"catalog,omitempty"`
}

RegistryEntry is one plugin in registry.json. Key names and types are the basis entries' (released CLIs decode them); ReleaseSignature and Catalog are additive keys that v1.4.12 ignores.

type Release

type Release struct {
	Version string `json:"version"`
	// SHA256 is the lowercase hex digest of the served tarball bytes.
	SHA256 string `json:"sha256"`
	// ReleaseSignature is null for an unsigned release.
	ReleaseSignature *Signature `json:"release_signature"`
	TarballURL       string     `json:"tarball_url,omitempty"`
	// ReleaseTag is the release tag the tarball is published under (free).
	ReleaseTag string `json:"release_tag,omitempty"`
	// Tarball is the asset name or URL released CLIs read as `tarball`.
	Tarball string `json:"tarball,omitempty"`
	// Binaries lists the command binaries the published tarball contains
	// (nself-<command>), written by the release pipeline from the archive. A
	// released CLI turns every cliCommands name and binaryName into a required
	// binary and fails the install when the archive lacks it, so the registry
	// carries them only for a release that lists them.
	Binaries []string `json:"binaries,omitempty"`
	// PlatformChecksums holds one sha256 per per-platform binary tarball.
	PlatformChecksums map[string]string `json:"platform_checksums,omitempty"`
}

Release is one slug's released artifact.

type Releases

type Releases struct {
	Generated     string             `json:"_generated,omitempty"`
	SchemaVersion int                `json:"schema_version"`
	Releases      map[string]Release `json:"releases"`
}

Releases is releases.json: release data written only by the release pipeline from published bytes, never by hand (Epic D3, D7). Checksums and signatures are release data, not manifest data.

type Requires

type Requires struct {
	Nself              string   `json:"nself,omitempty"`
	Plugins            []string `json:"plugins,omitempty"`
	PostgresExtensions []string `json:"postgres_extensions,omitempty"`
}

Requires mirrors manifest v2 `requires`.

type Signature

type Signature struct {
	KeyID string `json:"key_id"`
	Alg   string `json:"alg"`
	Sig   string `json:"sig"`
}

Signature is a release signature (contract:plugins.release-signature).

type TierCount

type TierCount struct {
	Entries        int      `json:"entries"`
	Installable    int      `json:"installable"`
	NonInstallable []string `json:"nonInstallable"`
}

TierCount is the entries and installable breakdown for one registry.

type Totals

type Totals struct {
	Entries     int `json:"entries"`
	Installable int `json:"installable"`
}

Totals is the combined view after de-duplication.

Jump to

Keyboard shortcuts

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