mapper

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2026 License: Apache-2.0 Imports: 16 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package mapper builds a model-free map of a target: its languages, frameworks, entry points, trust boundaries, and how to build and test it. The planner and investigators start from this map instead of rediscovering the layout on every run.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Boundary

type Boundary struct {
	Kind string `json:"kind"` // http-input|env|process|database|outbound-http|filesystem|deserialization
	File string `json:"file"`
	Line int    `json:"line"`
}

Boundary is a line where data crosses a trust boundary.

type EntryPoint

type EntryPoint struct {
	Kind   string `json:"kind"` // http-route|main|cli|handler
	File   string `json:"file"`
	Line   int    `json:"line"`
	Detail string `json:"detail"`
}

EntryPoint is a place where execution or outside input enters the program.

type Harness

type Harness struct {
	Language     string `json:"language,omitempty"` // primary language: go|python|javascript|typescript
	TestCommand  string `json:"test_command,omitempty"`
	BuildCommand string `json:"build_command,omitempty"`
	HasTests     bool   `json:"has_tests"`
}

Harness says how the target is built and tested, as far as can be told without running anything.

type LangCount

type LangCount struct {
	Lang  string `json:"lang"`
	Files int    `json:"files"`
}

LangCount is how many files a language has.

type Map

type Map struct {
	Commit     string       `json:"commit,omitempty"`
	FileCount  int          `json:"file_count"`
	Languages  []LangCount  `json:"languages"`
	Frameworks []string     `json:"frameworks,omitempty"`
	Entry      []EntryPoint `json:"entry_points,omitempty"`
	Boundaries []Boundary   `json:"trust_boundaries,omitempty"`
	InfraFiles []string     `json:"infra_files,omitempty"`
	Tests      Harness      `json:"tests"`
	Skipped    []walk.Skip  `json:"skipped,omitempty"`

	// Files is the listing the map was built from. It is not cached: it
	// holds absolute paths, which belong to one machine.
	Files []walk.File `json:"-"`
}

Map describes a target on disk.

func Build

func Build(ctx context.Context, root string, opts Options) (Map, error)

Build maps the target at root.

func (Map) LanguageNames

func (m Map) LanguageNames() []string

LanguageNames returns the language names, most files first.

type Options

type Options struct {
	// CacheDir, when set, enables the commit-keyed cache.
	CacheDir string
	// Walk holds the configured path exclusions and inclusions. The cache
	// is not used when any are set, because it is keyed by commit alone.
	Walk walk.Options
	// Texts, when set, receives the text of every file the mapper reads,
	// so the seeders that run next do not read those files again.
	Texts *walk.Texts
	// Changed, when set, lists the files (relative to root, with forward
	// slashes) that differ from HEAD: the uncommitted work of a --changed
	// scan. With a cached map of HEAD, only those files are read again and
	// the rest of the map is taken from the cache. Without it, a tree with
	// local changes is mapped in full.
	Changed map[string]bool
}

Options control mapping.

Jump to

Keyboard shortcuts

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