resolve

package
v0.24.4 Latest Latest
Warning

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

Go to latest
Published: Jul 28, 2026 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package resolve maps a brand, domain, repo slug, package, or product name to its canonical entity id by querying the fact store facts in memory.

Feature: cli/studio/answers (REQ: resolve-verb, REQ: resolve-ambiguous-and-unknown)

Resolution is case-insensitive and draws candidates from two sources:

  • aliased-as facts: the object of an (entity, aliased-as, <name>) fact maps <name> back to the entity subject (the canonical id).
  • entity ids present in the store as subjects or objects of any fact.

Results are Unique (one canonical id + the citing fact), Ambiguous (two or more distinct canonical ids + their citations), or NotFound. The function is pure — no store, no network access — so it is directly consumed by both the `studio resolve` verb and the `studio ask` router (Task 4).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Candidate

type Candidate struct {
	ID       string
	Citation fact.Fact
}

Candidate is one resolution candidate: a canonical entity id and the fact that cites it (either the aliased-as fact whose object matched, or the first fact in the store whose subject/object equals the entity id).

type Kind

type Kind int

Kind classifies the outcome of a Resolve call.

const (
	// Unique means exactly one canonical id was found; Result.ID and
	// Result.Citation are populated.
	Unique Kind = iota
	// Ambiguous means more than one distinct canonical id matched the name;
	// Result.Candidates is populated.
	Ambiguous
	// NotFound means no candidate canonical id matched the name.
	NotFound
)

type Result

type Result struct {
	Kind Kind
	// ID is the canonical entity id for Unique results.
	ID string
	// Citation is the citing fact for Unique results.
	Citation fact.Fact
	// Candidates is the set of matching candidates for Ambiguous results.
	Candidates []Candidate
}

Result is the outcome of a Resolve call.

func Resolve

func Resolve(facts []fact.Fact, name string) Result

Resolve maps name to its canonical entity id(s) using the given facts. Matching is case-insensitive. The returned Result classifies the outcome and carries the citation(s) so callers can render evidence without additional store queries.

Jump to

Keyboard shortcuts

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