adapters

package
v0.20.3 Latest Latest
Warning

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

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

Documentation

Overview

Package adapters defines the ingestion-adapter contract for SpecScore Studio, the registry of built-in adapters, and the pipeline that runs every adapter over every resolved workspace repo and stamps the shared fact fields centrally.

Feature: cli/studio/index (REQ: fact-shape, REQ: partial-tolerance, REQ: adapter-specscore, REQ: adapter-codegraph, REQ: adapter-manifests, REQ: adapter-registries) Feature: cli/rehearse/evidence (REQ: adapter-rehearse, REQ: observed-at-run-time)

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Adapter

type Adapter interface {
	ID() string
	Version() string
	Ingest(repoPath string) ([]fact.Fact, []Warning)
}

Adapter is one ingestion source. Implementations are pure functions of the repo path: no store access, independently unit-testable against fixture repos. Emitted facts carry subject/predicate/object and Evidence only; subjects and objects that start with "#" are repo-relative spec refs and are prefixed with the repo slug by Run, which also stamps adapter id + version, observed_at, and the ecosystem name centrally.

func All

func All(opts Options) []Adapter

All returns the built-in adapters in run order — one per line, so each sibling adapter lands as a one-line append.

type Options

type Options struct {
	// Registries maps a resolved repo path to the extra registry file paths
	// (repo-relative) configured via the per-repo `registries:` entry form
	// in studio.yaml (workspace.Workspace.ResolveRegistries).
	Registries map[string][]string
}

Options carries workspace-level configuration into the adapters that need it; the zero value is a valid default.

type RepoSummary

type RepoSummary struct {
	// Path is the repo path as passed to Run.
	Path string
	// Slug is the stable repository ID minted for the path. Remoted repos use
	// normalized forge coordinates; local-only repos use a path-derived ID.
	Slug string
	// Facts is the number of facts ingested from the repo.
	Facts int
	// Warnings is the number of warnings collected for the repo.
	Warnings int
}

RepoSummary is the per-repo rollup for the run summary: how many facts and warnings one repo path contributed (REQ: partial-tolerance).

type Result

type Result struct {
	// Facts are the fully stamped facts, in repo-then-adapter emission order.
	Facts []fact.Fact
	// Warnings are the collected non-fatal problems, stamped with the repo
	// slug and adapter id they came from. Repo-level warnings (a repo path
	// that is not an existing directory) carry an empty Adapter.
	Warnings []Warning
	// FactsByAdapter counts the facts each adapter emitted, keyed by adapter
	// id; every adapter that ran has an entry (zero included).
	FactsByAdapter map[string]int
	// FactsByRepo groups the stamped facts by the slug of the repo whose
	// adapter run produced them — the provenance the INGR export needs to
	// attribute global-coordinate facts (e.g. registry domains) to a repo
	// (REQ: ingr-export). Skipped repos have no entry (zero facts).
	FactsByRepo map[string][]fact.Fact
	// Repos are the per-repo run summaries, in input repo order; skipped
	// repos are included (zero facts, one repo-level warning).
	Repos []RepoSummary
}

Result is the outcome of one ingestion run across all repos and adapters.

func Run

func Run(adapters []Adapter, repos []string, ecosystem string) Result

Run executes every adapter over every repo (sequentially) and stamps the shared fact fields centrally: the repo slug onto "#"-prefixed subjects and objects, the adapter id + version, a shared observed_at timestamp for the whole run (UTC, RFC 3339) onto facts whose adapter did not set its own, and the ecosystem name. The shared timestamp is NOT applied when the adapter already set ObservedAt (Feature: cli/rehearse/evidence, REQ: observed-at-run-time).

Partial tolerance (REQ: partial-tolerance) is enforced at repo and adapter granularity here (adapters handle file granularity themselves): a repo path that is not an existing directory becomes one repo-level warning and is skipped; a panicking adapter is recovered into a warning naming the adapter and repo, and the remaining adapters still run.

type Warning

type Warning = fact.Warning

Warning is a non-fatal ingestion problem collected by the pipeline. It is an alias of fact.Warning so adapter implementations depend only on the leaf fact package (the registry below imports them; a Warning type owned by this package would be an import cycle).

Directories

Path Synopsis
Package codegraph is the CodeGrapher-snapshot ingestion adapter: it reads committed `codegraph/` snapshot recordsets (INGR encoding, inGitDB layout) and emits package entities and `derived` facts for `imports` edges at package granularity.
Package codegraph is the CodeGrapher-snapshot ingestion adapter: it reads committed `codegraph/` snapshot recordsets (INGR encoding, inGitDB layout) and emits package entities and `derived` facts for `imports` edges at package granularity.
Package manifests is the dependency-manifest ingestion adapter: it parses `go.mod` and `package.json` files at the repo root plus one nested level (e.g.
Package manifests is the dependency-manifest ingestion adapter: it parses `go.mod` and `package.json` files at the repo root plus one nested level (e.g.
Package registries is the ops-registry ingestion adapter: it parses well-known ops registry files — `domains.json` (Sneat-ops shape) and curated `ecosystem*.yaml` maps — into domain/product entities and `declared` facts.
Package registries is the ops-registry ingestion adapter: it parses well-known ops registry files — `domains.json` (Sneat-ops shape) and curated `ecosystem*.yaml` maps — into domain/product entities and `declared` facts.
Package rehearse is the rehearse-report ingestion adapter: it reads `.specscore/rehearse/latest.json` from the repo and emits `verified-behavior` facts — one `verified-by` and one `has-verification-status` pair for every scenario–AC combination whose status is `pass` or `fail`.
Package rehearse is the rehearse-report ingestion adapter: it reads `.specscore/rehearse/latest.json` from the repo and emits `verified-behavior` facts — one `verified-by` and one `has-verification-status` pair for every scenario–AC combination whose status is `pass` or `fail`.
Package specscore is the SpecScore spec-tree ingestion adapter: it parses `spec/` trees of repos managed by SpecScore (marked by a `specscore.yaml` at the repo root) into idea/feature entities and `declared` facts.
Package specscore is the SpecScore spec-tree ingestion adapter: it parses `spec/` trees of repos managed by SpecScore (marked by a `specscore.yaml` at the repo root) into idea/feature entities and `declared` facts.

Jump to

Keyboard shortcuts

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