identity

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Aug 17, 2026 License: MIT Imports: 2 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 identity implements lore's typed-prefix source identity scheme, decided in https://github.com/cheetahbyte/lore/issues/8.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ID

type ID string

ID is a canonical typed-prefix identity, e.g. "github:owner/repo" or "npm:react". The prefix names the Source adapter that owns it; the remainder is that adapter's own reference format.

func New

func New(t SourceType, ref string) ID

New builds an ID from a known type and reference without validating the reference's own format (that's the owning adapter's job).

func Parse

func Parse(s string) (ID, error)

Parse validates and returns s as an ID. s must contain a known type prefix followed by ":" and a non-empty reference.

func (ID) Ref

func (id ID) Ref() string

Ref returns the identity's reference, i.e. everything after the first ":".

func (ID) String

func (id ID) String() string

func (ID) Type

func (id ID) Type() SourceType

Type returns the identity's source-type prefix.

type SourceType

type SourceType string
const (
	GitHub    SourceType = "github"
	NPM       SourceType = "npm"
	PyPI      SourceType = "pypi"
	GoPackage SourceType = "pkg.go.dev"
	LLMsTxt   SourceType = "llms-txt"
	URL       SourceType = "url"
)

Jump to

Keyboard shortcuts

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