Skip to content

Feature: the package-mapping index — one project, one id per manager, without a full lore package #91

Description

@David-Noble-at-work

Epic: Lore Package Development (#74) · Raised from devlore-cli#872, the pkg provider's identity questions.

The question

Package names vary by package manager. jq is jq on brew, apt, dnf, pacman and choco, and
jqlang.jq on winget; GNU sed is gnu-sed on brew and gsed on port; pandoc is
JohnMacFarlane.Pandoc on winget. Every person who provisions machines answers "how do I get
foo on bar using one of its package managers" by hand, per box, in an Install-* script. The
answer is captured nowhere, so it is re-derived on every new box and differs between people.

What the registry has today, in three pieces that do not meet

Piece Where Direction Fills it
signatures: block each package's lifecycle.yaml, e.g. pandoc project → id per manager the package author
packages/cross-reference.yaml generated by update-indexes.yaml manager → native id → project the generator, from the signatures
synthetic cache NativeName cmd/internal/lorepackage/synthetic.go on each host project → id, learned nothing yet: resolveNative copies the bare name in

The gap: a mapping can exist only inside a full lore package, with a lifecycle, scripts and a
README. Ten packages have mappings and everything else improvises. Nothing in devlore-cli reads
cross-reference.yaml, so the one reverse index that exists is generated and never consulted.

Prior art

System What it does
Repology the canonical cross-repository name index, with an API: exactly "how do I get foo on bar"
mise registry short name → backend and native id
aqua registry community YAML registry of tools → install source
winget monikers a manifest carries a moniker, which is why winget install jq sometimes works by luck
Ubuntu command-not-found command → the package that provides it
Ansible, Chef no mapping at all: per-OS variables, which is the improvisation this feature retires

The proposal: one schema, three tiers

One row per project: a neutral key, an id per manager. The neutral key is the purl spec's own
generic type, pkg:generic/<name>, so the index is standards-shaped and a manifest can name a
project without naming a manager.

  1. Canonical. The registry gains the mapping as a first-class artifact that needs no lifecycle.
    A lore package's signatures: block is the same row, so cross-reference.yaml becomes generated
    from the union of the standalone rows and the packages' rows.
  2. Learned. When a host resolves a bare name (by manager search, by moniker, by Repology), the
    synthetic cache records the verified mapping in NativeName. A lore command promotes a
    learned mapping into a pull request against the registry. That is the step that turns
    "improvised on every new box" into "captured once".
  3. Authored. A manifest may carry an inline per-manager id for the odd case, and lint flags it
    as a registry candidate.

Two directions belong in the index:

  • project → id per manager, for installing;
  • command → project, for the command -v question every Install-* script asks first.

How it fits the pkg provider

The index is the data behind the broker's "are these one package?" brew:gnu-sed and port:gsed
are one project, and only a mapping can say so. Lookup runs against the local registry clone, so
plan time stays pure; Repology and manager searches happen at authoring time. The pkg design
document (devlore-cli#868) carries the
consumer side as a section; the tasks that implement it there follow that document.

Evidence of completion

  • A standalone mapping row can be authored without a lore package, validated by validate.yaml
  • cross-reference.yaml is generated from standalone rows and package signatures together
  • The schema records both directions: manager ids and provided commands
  • A learned mapping can be promoted from a host's synthetic cache into a registry pull request
  • Every package the noblefactor and thenobles manifests name has a row

Plan and design documents

Kind Document
Plan no branch has opened; the plan arrives with it

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions