scan

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: May 12, 2026 License: MIT Imports: 18 Imported by: 0

Documentation

Overview

Package scan orchestrates artifact discovery: walks the repo, dispatches adapters, and upserts artifacts/revisions/todos/criteria into the store.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SourceTypeDisplayLabel

func SourceTypeDisplayLabel(sourceType string) string

SourceTypeDisplayLabel returns human-facing copy for `ds scan` summaries. Internal pipeline IDs remain markdown / openspec / adr in config and the DB; this layer is display-only.

Types

type Result

type Result struct {
	Found            map[string]int       `json:"Found"`
	SourcesBreakdown []SourceBreakdownRow `json:"sources_breakdown"`
	New              int                  `json:"New"`
	Updated          int                  `json:"Updated"`
	Unchanged        int                  `json:"Unchanged"`
	Hints            []ScanHint           `json:"hints,omitempty"`
	// contains filtered or unexported fields
}

Result holds scan summary counts and per-source breakdown for CLI output.

JSON shape (see ds scan --json):

  • "Found": map of adapter/source pipeline name → count of successfully indexed artifacts
  • "sources_breakdown": array of { source_type, label, count, formats }
  • "New", "Updated", "Unchanged": revision outcomes
  • "hints": optional; only when all adapters indexed zero artifacts AND at least one hint candidate exists. Empty candidate list omits the key (encoding/json omitempty on []ScanHint).

type ScanHint

type ScanHint struct {
	Path           string `json:"path"`
	SourceType     string `json:"source_type,omitempty"`
	SuggestCommand string `json:"suggest_command,omitempty"`
}

ScanHint is one recovery hint when a scan finds zero artifacts (`hints` in ds scan --json).

type Scanner

type Scanner struct {
	// contains filtered or unexported fields
}

Scanner runs adapters against a repo and persists results.

func New

func New(db *store.DB, ids *idgen.Factory, adpts []adapters.Adapter) *Scanner

New creates a Scanner with the given store and adapters.

func (*Scanner) Run

func (s *Scanner) Run(ctx context.Context, repoRoot string, cfg *config.RepoConfig) (*Result, error)

Run scans the repo at repoRoot, using config if available.

type SourceBreakdownRow

type SourceBreakdownRow struct {
	SourceType string         `json:"source_type"`
	Label      string         `json:"label"`
	Count      int            `json:"count"`
	Formats    map[string]int `json:"formats"`
}

SourceBreakdownRow is one element of `ds scan --json` field "sources_breakdown".

Jump to

Keyboard shortcuts

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