identity

package
v0.2.0 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

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