model

package
v1.14.0 Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2026 License: Apache-2.0 Imports: 0 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

Index

Constants

View Source
const (
	PlatformDarwin  = "darwin"
	PlatformWindows = "windows"
	PlatformLinux   = "linux"
)

Platform constants used by detectors, device info, and output formatters. These match the values returned by runtime.GOOS / executor.GOOS().

Variables

This section is empty.

Functions

func PlatformDisplayName added in v1.11.0

func PlatformDisplayName(platform string) string

PlatformDisplayName returns the human-readable name for a platform identifier.

Types

type AITool

type AITool struct {
	Name        string `json:"name"`
	Vendor      string `json:"vendor"`
	Type        string `json:"type"`
	Version     string `json:"version"`
	BinaryPath  string `json:"binary_path,omitempty"`
	InstallPath string `json:"install_path,omitempty"`
	ConfigDir   string `json:"config_dir,omitempty"`
	IsRunning   *bool  `json:"is_running,omitempty"`
}

AITool represents a detected AI agent, CLI tool, framework, or general agent. Fields are conditionally present based on type (cli_tool, general_agent, framework).

type AgentSkill added in v1.14.0

type AgentSkill struct {
	// Identity
	SkillSlug    string   `json:"skill_slug"`              // directory basename
	SkillName    string   `json:"skill_name"`              // frontmatter name, else slug
	Description  string   `json:"description,omitempty"`   // frontmatter description, ≤1024 runes (standard max)
	Version      string   `json:"version,omitempty"`       // frontmatter version (or metadata.version fallback)
	License      string   `json:"license,omitempty"`       // standard frontmatter license, ≤128 runes
	AllowedTools []string `json:"allowed_tools,omitempty"` // normalized from space/comma string or YAML list

	// Behavior/risk flags (frontmatter + body scan)
	DisableModelInvocation bool   `json:"disable_model_invocation,omitempty"`
	UserInvocableDisabled  bool   `json:"user_invocable_disabled,omitempty"` // frontmatter user-invocable: false
	ContextFork            bool   `json:"context_fork,omitempty"`            // context: fork (runs in subagent)
	ModelOverride          string `json:"model_override,omitempty"`          // frontmatter model
	HasHooks               bool   `json:"has_hooks,omitempty"`               // hooks key present in frontmatter
	HasShellInjection      bool   `json:"has_shell_injection,omitempty"`     // body has !`cmd` / “`! load-time exec

	// Attribution
	Agent  string `json:"agent"`  // "claude-code"|"codex"|"opencode"|"cursor"|"pi"|"factory"|"amp"|"copilot"|"gemini-cli"|"aider"|"shared"
	Source string `json:"source"` // atomic attribution key. "claude_user"|"claude_project"|
	//                              // "agents_user"|"agents_project"|"codex_user"|"codex_system"|"codex_admin"|
	//                              // "opencode_user"|"opencode_project"|"cursor_user"|"cursor_project"|"pi_user"|
	//                              // "pi_project"|"factory_user"|"factory_project"|"factory_agent_project"|
	//                              // "amp_user"|"copilot_user"|"github_project"|"gemini_user"|"gemini_project"|
	//                              // "aider_project"
	Scope       string `json:"scope"`                  // "global" | "project" | "system"
	ProjectPath string `json:"project_path,omitempty"` // project root for project scope
	PluginName  string `json:"plugin_name,omitempty"`  // owning plugin, from skills.sh lock pluginName

	// Location
	SkillDirPath   string   `json:"skill_dir_path,omitempty"` // absolute, symlink-resolved dir of the physical skill (the collapse group key)
	RootRelPath    string   `json:"root_rel_path,omitempty"`  // skill dir relative to its root, forward-slash ("frontend-design", "apps/web/frontend-design")
	SkillMDPath    string   `json:"skill_md_path,omitempty"`
	SymlinkSources []string `json:"symlink_sources,omitempty"` // sorted, deduped source labels that symlink to this physical skill dir; every entry is a symlink by definition

	// Content identity
	SkillMDHash string `json:"skill_md_hash,omitempty"` // hex(sha256(SKILL.md)) — identity/drift key

	// File census (all stat-derived — no file bytes read)
	FileCount         int   `json:"file_count,omitempty"`
	CodeFileCount     int   `json:"code_file_count,omitempty"`
	SymlinkCount      int   `json:"symlink_count,omitempty"`
	TotalSizeBytes    int64 `json:"total_size_bytes,omitempty"`
	HasCode           bool  `json:"has_code,omitempty"`
	HasPluginManifest bool  `json:"has_plugin_manifest,omitempty"` // .claude-plugin/plugin.json in skill dir
	LastModified      int64 `json:"last_modified,omitempty"`       // unix, max mtime in dir

	// Frontmatter health
	HasFrontmatter   bool   `json:"has_frontmatter"`
	FrontmatterError string `json:"frontmatter_error,omitempty"` // "" | "invalid_yaml" | "missing_name" | "missing_description" | "file_too_large" | "unreadable"

	// skills.sh lock provenance (empty when unmanaged)
	ManagedBy          string `json:"managed_by,omitempty"`  // "skills.sh" | ""
	SourceSlug         string `json:"source_slug,omitempty"` // "vercel-labs/agent-skills" (alias only for sourceType=local)
	SourceType         string `json:"source_type,omitempty"` // "github"|"mintlify"|"huggingface"|"local"|"well-known"
	SourceURL          string `json:"source_url,omitempty"`
	Ref                string `json:"ref,omitempty"`                  // branch|tag|sha as recorded
	SkillPath          string `json:"skill_path,omitempty"`           // subdir within upstream repo
	UpstreamFolderHash string `json:"upstream_folder_hash,omitempty"` // GitHub tree SHA from lock (NOT sha256)
	InstalledAt        string `json:"installed_at,omitempty"`         // ISO8601 from lock
	UpdatedAt          string `json:"updated_at,omitempty"`           // ISO8601 from lock
	LockFilePath       string `json:"lock_file_path,omitempty"`
}

AgentSkill represents one discovered agent skill: a physical SKILL.md directory, optionally enriched with skills.sh lock provenance. Symlink shadows of the same physical dir are collapsed into one record (the linked roots listed in SymlinkSources). Never carries file content — identity, provenance, hashes, and census counts only.

type AgentSkillScanInfo added in v1.14.0

type AgentSkillScanInfo struct {
	RootsScanned    []string `json:"roots_scanned"` // absolute root paths probed AND existing
	ProjectsScanned int      `json:"projects_scanned"`
	LockFilesParsed int      `json:"lock_files_parsed"`
	SkillsFound     int      `json:"skills_found"`
	Truncated       bool     `json:"truncated,omitempty"`         // any cap hit (roots/projects/skills/home-walk)
	Errors          []string `json:"errors,omitempty"`            // bounded: ≤50 entries, each ≤256 chars
	WalkDirsVisited int      `json:"walk_dirs_visited,omitempty"` // home-walk ReadDir count
	WalkRootsFound  int      `json:"walk_roots_found,omitempty"`  // project-root candidates the home walk emitted (pre-union)
	DurationMs      int64    `json:"duration_ms"`
}

AgentSkillScanInfo summarizes the skills phase. Its presence in the payload is the "scan ran" sentinel: a nil section means the scan did not run (no information), while a non-nil section with zero skills means "scan ran, nothing installed".

type BrewPackage added in v1.10.0

type BrewPackage struct {
	Name    string `json:"name"`
	Version string `json:"version"`

	// Metadata (populated from brew info --json=v2)
	Tap                   string `json:"tap,omitempty"`                     // Source tap: "homebrew/core", "homebrew/cask", or custom
	Description           string `json:"description,omitempty"`             // Package description
	License               string `json:"license,omitempty"`                 // SPDX license (formulae only)
	Homepage              string `json:"homepage,omitempty"`                // Upstream project URL
	InstallPath           string `json:"install_path,omitempty"`            // On-disk install path: <prefix>/Cellar/<name>/<version> (formulae) or <prefix>/Caskroom/<token> (casks)
	InstallTimeUnix       int64  `json:"install_time_unix,omitempty"`       // Unix epoch when installed
	InstalledAsDependency bool   `json:"installed_as_dependency,omitempty"` // true if pulled in by another package
	Deprecated            bool   `json:"deprecated,omitempty"`              // true if package is deprecated upstream
	PouredFromBottle      bool   `json:"poured_from_bottle,omitempty"`      // true if installed from pre-built binary
	AutoUpdates           bool   `json:"auto_updates,omitempty"`            // cask: app handles its own updates
}

BrewPackage represents a single installed Homebrew formula or cask.

type BrewScanResult added in v1.10.0

type BrewScanResult struct {
	ScanType        string `json:"scan_type"` // "formulae" or "casks"
	RawStdoutBase64 string `json:"raw_stdout_base64"`
	RawStderrBase64 string `json:"raw_stderr_base64"`
	Error           string `json:"error"`
	ExitCode        int    `json:"exit_code"`
	ScanDurationMs  int64  `json:"scan_duration_ms"`
	LineCount       int    `json:"line_count"`
}

BrewScanResult holds raw Homebrew scan output for enterprise telemetry.

type BunAudit added in v1.12.0

type BunAudit struct {
	Available      bool            `json:"bun_available"`
	BunVersion     string          `json:"bun_version,omitempty"`
	BunPath        string          `json:"bun_path,omitempty"`
	Files          []BunConfigFile `json:"files"`
	NPMRCFiles     []NPMRCFile     `json:"npmrc_files"`
	Env            []NPMRCEnvVar   `json:"env"`
	DiscoveryError string          `json:"discovery_error,omitempty"`
}

BunAudit has no Effective field — bun has no `config list` equivalent. Consumers render the union of parsed files. NPMRCFiles carries any .npmrc bun would read for auth.

type BunConfigFile added in v1.12.0

type BunConfigFile struct {
	Path        string       `json:"path"`
	Scope       string       `json:"scope"`
	Exists      bool         `json:"exists"`
	Readable    bool         `json:"readable"`
	SizeBytes   int64        `json:"size_bytes,omitempty"`
	ModTimeUnix int64        `json:"mtime_unix,omitempty"`
	Mode        string       `json:"mode,omitempty"`
	OwnerUID    int          `json:"owner_uid,omitempty"`
	OwnerName   string       `json:"owner_name,omitempty"`
	GroupGID    int          `json:"group_gid,omitempty"`
	GroupName   string       `json:"group_name,omitempty"`
	SHA256      string       `json:"sha256,omitempty"`
	SymlinkTo   string       `json:"symlink_target,omitempty"`
	InGitRepo   bool         `json:"in_git_repo,omitempty"`
	GitTracked  bool         `json:"git_tracked,omitempty"`
	Sections    []BunSection `json:"sections,omitempty"`
	ParseError  string       `json:"parse_error,omitempty"`
}

BunConfigFile is a single bunfig.toml. Scope: user | user-xdg | project.

type BunSection added in v1.12.0

type BunSection struct {
	Name    string       `json:"name"`
	Entries []NPMRCEntry `json:"entries"`
}

BunSection groups NPMRCEntry by dotted section path (e.g. "install", "install.scopes.@step-security"). Entry LineNum is always 0 — go-toml/v2 doesn't cheaply expose per-key positions.

type ConditionResult added in v1.12.0

type ConditionResult struct {
	ID      string `json:"id"`
	Kind    string `json:"kind"` // "regex" | "sha256"
	Matched bool   `json:"matched"`
}

ConditionResult reports the boolean outcome of one condition. No matched text is ever captured — only whether the condition matched.

type Device

type Device struct {
	Hostname     string           `json:"hostname"`
	SerialNumber string           `json:"serial_number"`
	OSVersion    string           `json:"os_version"`
	Platform     string           `json:"platform"`
	UserIdentity string           `json:"user_identity"`
	Resources    MachineResources `json:"resources"`
}

type EvaluatedRule added in v1.12.0

type EvaluatedRule struct {
	RuleID       string `json:"rule_id"`
	RuleRevision string `json:"rule_revision,omitempty"`
	Complete     bool   `json:"complete"`
}

EvaluatedRule records one rule the engine ran this scan, including rules that matched nothing. Complete is false if the rule hit its per-rule match cap (matches_truncated) or wasn't fully walked. RuleRevision is the opaque revision echoed back for backend audit/drift detection.

type Extension

type Extension struct {
	ID          string `json:"id"`
	Name        string `json:"name"`
	Version     string `json:"version"`
	Publisher   string `json:"publisher"`
	InstallPath string `json:"install_path,omitempty"`
	InstallDate int64  `json:"install_date"`
	IDEType     string `json:"ide_type"`
	Source      string `json:"source,omitempty"` // "bundled" or "user_installed"
}

func FilterUserInstalledExtensions added in v1.10.2

func FilterUserInstalledExtensions(exts []Extension) []Extension

FilterUserInstalledExtensions removes bundled/platform extensions, keeping only user-installed, marketplace, and dropins extensions.

type FileAttrs added in v1.12.0

type FileAttrs struct {
	SizeBytes  int64 `json:"size_bytes"`
	ModifiedAt int64 `json:"modified_at"` // mtime
	CreatedAt  int64 `json:"created_at"`  // birth time (best-effort)
	ChangedAt  int64 `json:"changed_at"`  // ctime
}

FileAttrs is file metadata only, never content. Times are unix seconds UTC, 0 when unavailable on the platform.

type GroupResult added in v1.12.0

type GroupResult struct {
	GroupID    string            `json:"group_id"`
	FullMatch  bool              `json:"full_match"`
	Conditions []ConditionResult `json:"conditions"`
}

GroupResult reports one condition group. FullMatch is true when every condition in the group matched (after applying negation).

type IDE

type IDE struct {
	IDEType     string `json:"ide_type"`
	Version     string `json:"version"`
	InstallPath string `json:"install_path"`
	Vendor      string `json:"vendor"`
	IsInstalled bool   `json:"is_installed"`
}

type MCPConfig

type MCPConfig struct {
	ConfigSource string `json:"config_source"`
	ConfigPath   string `json:"config_path"`
	Vendor       string `json:"vendor"`
}

MCPConfig represents a detected MCP server configuration (community mode).

type MCPConfigEnterprise

type MCPConfigEnterprise struct {
	ConfigSource        string `json:"config_source"`
	ConfigPath          string `json:"config_path"`
	Vendor              string `json:"vendor"`
	ConfigContentBase64 string `json:"config_content_base64,omitempty"`
}

MCPConfigEnterprise includes base64-encoded content for enterprise mode.

type MachineResources added in v1.11.3

type MachineResources struct {
	CPUModel        string `json:"cpu_model"`        // e.g. "Apple M3 Pro", "Intel(R) Core(TM) i9-13900K"
	CPUArchitecture string `json:"cpu_architecture"` // "arm64", "amd64"
	PhysicalCores   int    `json:"physical_cores"`   // 0 if undeterminable
	LogicalCores    int    `json:"logical_cores"`    // includes SMT/hyperthreads
	MemoryBytes     uint64 `json:"memory_bytes"`     // total installed RAM
	DiskTotalBytes  uint64 `json:"disk_total_bytes"` // capacity of the system/root volume
}

MachineResources captures the static hardware capacity of the machine — what's there, not what's currently in use. Answers "how much resource does this machine have?".

type NPMRCAudit added in v1.11.3

type NPMRCAudit struct {
	Available      bool            `json:"npm_available"`
	NPMVersion     string          `json:"npm_version,omitempty"`
	NPMPath        string          `json:"npm_path,omitempty"`
	Files          []NPMRCFile     `json:"files"`
	Effective      *NPMRCEffective `json:"effective,omitempty"`
	Env            []NPMRCEnvVar   `json:"env"`
	DiscoveryError string          `json:"discovery_error,omitempty"`
}

NPMRCAudit is the top-level structure produced by the npmrc detector.

type NPMRCEffective added in v1.11.3

type NPMRCEffective struct {
	SourceByKey map[string]string `json:"source_by_key,omitempty"`
	Config      map[string]any    `json:"config,omitempty"`
	Error       string            `json:"error,omitempty"`
}

NPMRCEffective mirrors the merged-config view emitted by `npm config ls -l --json`. Auth values are returned by npm as "(protected)" — that's what we surface.

type NPMRCEntry added in v1.11.3

type NPMRCEntry struct {
	Key          string   `json:"key"`
	DisplayValue string   `json:"display_value"`
	LineNum      int      `json:"line_num"`
	IsArray      bool     `json:"is_array,omitempty"`
	IsAuth       bool     `json:"is_auth,omitempty"`
	IsEnvRef     bool     `json:"is_env_ref,omitempty"`
	EnvRefVars   []string `json:"env_ref_vars,omitempty"`
	ValueSHA256  string   `json:"value_sha256,omitempty"`
	Quoted       bool     `json:"quoted,omitempty"`
}

NPMRCEntry is one parsed line of a .npmrc file. DisplayValue is always safe to print: auth values are redacted to ***last4 (or *** when the secret is short). The raw value is never stored — ValueSHA256 is the only fingerprint kept.

type NPMRCEnvVar added in v1.11.3

type NPMRCEnvVar struct {
	Name         string `json:"name"`
	Set          bool   `json:"set"`
	DisplayValue string `json:"display_value,omitempty"`
	ValueSHA256  string `json:"value_sha256,omitempty"`
}

NPMRCEnvVar is a single npm-relevant process environment variable. Set=false records are kept so the audit shape stays stable across hosts.

type NPMRCFile added in v1.11.3

type NPMRCFile struct {
	Path        string       `json:"path"`
	Scope       string       `json:"scope"` // builtin | global | user | project
	Exists      bool         `json:"exists"`
	Readable    bool         `json:"readable"`
	SizeBytes   int64        `json:"size_bytes,omitempty"`
	ModTimeUnix int64        `json:"mtime_unix,omitempty"`
	Mode        string       `json:"mode,omitempty"`
	OwnerUID    int          `json:"owner_uid,omitempty"`
	OwnerName   string       `json:"owner_name,omitempty"`
	GroupGID    int          `json:"group_gid,omitempty"`
	GroupName   string       `json:"group_name,omitempty"`
	SHA256      string       `json:"sha256,omitempty"`
	SymlinkTo   string       `json:"symlink_target,omitempty"`
	InGitRepo   bool         `json:"in_git_repo,omitempty"`
	GitTracked  bool         `json:"git_tracked,omitempty"`
	Entries     []NPMRCEntry `json:"entries,omitempty"`
	ParseError  string       `json:"parse_error,omitempty"`
}

NPMRCFile is a single .npmrc file. Metadata is best-effort: fields that could not be determined (e.g. owner_name on Windows) are omitted.

type NodePackage added in v1.13.0

type NodePackage struct {
	Name    string `json:"name"`
	Version string `json:"version"`
	// IsDirect marks a top-level dependency (declared in the project's
	// package.json) versus a transitive one pulled in by another package.
	// Derived from lockfile structure, not from running the package manager.
	IsDirect bool `json:"is_direct,omitempty"`
}

NodePackage is one installed Node package discovered by disk parsing.

Fields are intentionally limited to what the backend persists today (name, version, direct-vs-transitive) — see DeviceNPMPackageUsageInfo. The agent-api NodePackage additionally declares InstallPath and Dependencies, but both are parsed-then-discarded server-side and are omitted here on purpose. JSON tags match ddbmodels.NodePackage.

type NodeScanResult

type NodeScanResult struct {
	ProjectPath      string        `json:"project_path"`
	PackageManager   string        `json:"package_manager"`
	PMVersion        string        `json:"package_manager_version"`
	WorkingDirectory string        `json:"working_directory"`
	RawStdoutBase64  string        `json:"raw_stdout_base64,omitempty"`
	RawStderrBase64  string        `json:"raw_stderr_base64,omitempty"`
	Packages         []NodePackage `json:"packages,omitempty"`
	PackagesCount    int           `json:"packages_count"`
	Error            string        `json:"error"`
	ExitCode         int           `json:"exit_code"`
	ScanDurationMs   int64         `json:"scan_duration_ms"`
}

NodeScanResult holds one project's (or one global root's) scan output for enterprise telemetry. Used for both global packages and per-project scans.

Two mutually-exclusive shapes flow through this struct depending on how the scan was produced:

  • Legacy (command) path: RawStdoutBase64 carries the raw `npm ls`/`yarn`/ `pnpm`/`bun` output; the backend parses it into packages on ingest.
  • Disk-parse path: Packages is populated directly and RawStdoutBase64 is left empty. The backend's ParseNodeProjects passes a project through untouched when RawStdoutBase64 == "", so pre-parsed packages reach storage with no backend change. Never set both: a non-empty RawStdoutBase64 makes the backend re-parse and overwrite Packages.

JSON tags match agent-api's ddbmodels.NodeProject so the payload deserializes server-side without a schema change.

type PackageDetail added in v1.10.0

type PackageDetail struct {
	Name    string `json:"name"`
	Version string `json:"version"`
}

PackageDetail represents a single package name and version.

type PipAudit added in v1.11.3

type PipAudit struct {
	Available      bool            `json:"pip_available"`
	Invocation     string          `json:"pip_invocation,omitempty"` // "pip" | "pip3" | "python3 -m pip"
	Version        string          `json:"pip_version,omitempty"`
	Path           string          `json:"pip_path,omitempty"`
	Files          []PipConfigFile `json:"files"`
	EnvVars        []PipEnvVar     `json:"env_vars"`
	Effective      *PipEffective   `json:"effective,omitempty"`
	Netrc          *PipNetrcStatus `json:"netrc,omitempty"`
	Findings       []PipFinding    `json:"findings"`
	DiscoveryError string          `json:"discovery_error,omitempty"`
}

PipAudit is the top-level pip audit object.

type PipConfigFile added in v1.11.3

type PipConfigFile struct {
	Path        string       `json:"path"`
	Layer       string       `json:"layer"` // global | user | user-legacy | site | PIP_CONFIG_FILE
	Exists      bool         `json:"exists"`
	Readable    bool         `json:"readable"`
	SizeBytes   int64        `json:"size_bytes,omitempty"`
	ModTimeUnix int64        `json:"mtime_unix,omitempty"`
	Mode        string       `json:"mode,omitempty"`
	OwnerName   string       `json:"owner_name,omitempty"`
	GroupName   string       `json:"group_name,omitempty"`
	SHA256      string       `json:"sha256,omitempty"`
	InGitRepo   bool         `json:"in_git_repo,omitempty"`
	GitTracked  bool         `json:"git_tracked,omitempty"`
	Sections    []PipSection `json:"sections,omitempty"`
	ParseError  string       `json:"parse_error,omitempty"`
}

PipConfigFile is one pip.conf / pip.ini discovered on disk. Layer is the precedence layer pip itself assigns.

type PipEffective added in v1.11.3

type PipEffective struct {
	SourceByKey map[string]string `json:"source_by_key,omitempty"`
	Config      map[string]string `json:"config,omitempty"`
	Error       string            `json:"error,omitempty"`
}

PipEffective is the merged-config view from `pip config list -v`. The SourceByKey map keys are "<section>.<key>" to disambiguate the same key appearing in multiple sections.

type PipEnvVar added in v1.11.3

type PipEnvVar struct {
	Name    string `json:"name"`
	Set     bool   `json:"set"`
	Value   string `json:"-"` // raw; never serialized
	Display string `json:"display,omitempty"`
	SHA256  string `json:"sha256,omitempty"`
}

PipEnvVar captures one PIP_* environment variable. Display is the finding-grade safe-to-print form (creds redacted in URLs). Unset vars are kept (Set=false) so the audit shape stays stable across hosts and a future change-tracking layer can detect newly-set vars between runs.

type PipFinding added in v1.11.3

type PipFinding struct {
	ID          string `json:"id"`       // "pip-001" etc.
	Severity    string `json:"severity"` // CRITICAL | HIGH | MEDIUM | LOW | INFO
	Category    string `json:"category"`
	Source      string `json:"source"`            // file path or env var name
	Section     string `json:"section,omitempty"` // "global" / "install" / "" for env vars
	Key         string `json:"key,omitempty"`
	ValueShown  string `json:"value_shown,omitempty"`
	Detail      string `json:"detail"`
	Remediation string `json:"remediation,omitempty"`
}

PipFinding is one detection from the rule catalog (pip-001 .. pip-024). ValueShown is always pre-redacted; the raw value never leaves the detector.

type PipKeyValue added in v1.11.3

type PipKeyValue struct {
	Key string `json:"key"`
	// Values holds the raw, un-redacted parsed values. Used internally by
	// the findings engine (URL.User parsing, http-scheme detection, etc.)
	// — NEVER serialized to JSON or pretty output, since for keys like
	// `extra-index-url` it can hold a literal `user:pass@host` URL. Use
	// Display for any user-visible rendering.
	Values  []string `json:"-"`
	Display string   `json:"display,omitempty"` // human-readable single-line rendering, with creds redacted
	LineNum int      `json:"line_num"`
}

PipKeyValue is a single key/value (or key/multi-value) entry inside a section. Repeatable options surface as multiple Values.

type PipNetrcStatus added in v1.11.3

type PipNetrcStatus struct {
	Path   string `json:"path"`
	Exists bool   `json:"exists"`
	Mode   string `json:"mode,omitempty"` // empty on Windows
}

PipNetrcStatus is informational: pip falls back to ~/.netrc for credentials, so its presence + permissions matter even though we don't parse the contents (.netrc is shared with curl/wget/twine/etc.; auditing its content is a separate concern).

type PipSection added in v1.11.3

type PipSection struct {
	Name    string        `json:"name"` // "global", "install", "freeze", "wheel", "list", "hash", ...
	LineNum int           `json:"line_num"`
	Entries []PipKeyValue `json:"entries"`
}

PipSection is one [section] block in a pip config file.

type PkgManager

type PkgManager struct {
	Name    string `json:"name"`
	Version string `json:"version"`
	Path    string `json:"path"`
}

type PnpmAudit added in v1.12.0

type PnpmAudit struct {
	Available      bool           `json:"pnpm_available"`
	PnpmVersion    string         `json:"pnpm_version,omitempty"`
	PnpmPath       string         `json:"pnpm_path,omitempty"`
	Files          []NPMRCFile    `json:"files"`
	Effective      *PnpmEffective `json:"effective,omitempty"`
	Env            []NPMRCEnvVar  `json:"env"`
	DiscoveryError string         `json:"discovery_error,omitempty"`
}

PnpmAudit reuses NPMRCFile/NPMRCEnvVar — pnpm reads the same .npmrc syntax as npm. Only the effective view and env list diverge.

type PnpmEffective added in v1.12.0

type PnpmEffective struct {
	SourceByKey map[string]string `json:"source_by_key,omitempty"`
	Config      map[string]any    `json:"config,omitempty"`
	Error       string            `json:"error,omitempty"`
}

PnpmEffective mirrors `pnpm config list --json`. SourceByKey is kept on the struct for renderer parity with npm but is typically empty — pnpm doesn't emit per-key source attribution.

type ProjectInfo added in v1.10.0

type ProjectInfo struct {
	Path           string          `json:"path"`
	PackageManager string          `json:"package_manager,omitempty"`
	Packages       []PackageDetail `json:"packages,omitempty"`
}

ProjectInfo represents a detected project directory with its packages.

type PythonPackage added in v1.10.0

type PythonPackage struct {
	Name    string `json:"name"`
	Version string `json:"version"`
}

PythonPackage represents a single installed Python package.

type PythonScanResult added in v1.10.0

type PythonScanResult struct {
	PackageManager  string `json:"package_manager"`
	PMVersion       string `json:"package_manager_version"`
	BinaryPath      string `json:"binary_path"` // Resolved path to the package manager binary
	RawStdoutBase64 string `json:"raw_stdout_base64"`
	RawStderrBase64 string `json:"raw_stderr_base64"`
	Error           string `json:"error"`
	ExitCode        int    `json:"exit_code"`
	ScanDurationMs  int64  `json:"scan_duration_ms"`
}

PythonScanResult holds raw Python scan output for enterprise telemetry.

type RemovedProjectRef added in v1.13.0

type RemovedProjectRef struct {
	Path                    string `json:"path"`
	LastUploadedExecutionID string `json:"last_uploaded_execution_id,omitempty"`
}

RemovedProjectRef tells the backend a project has disappeared from disk. Backend drops Path from every matching row's ProjectPaths and bumps RecordUpdatedAt but not LastSeenAt.

type RuleFileMatch added in v1.12.0

type RuleFileMatch struct {
	Path         string        `json:"path"`
	MatchedGlob  string        `json:"matched_glob"`
	FileSHA256   string        `json:"file_sha256,omitempty"`
	SizeExceeded bool          `json:"size_exceeded,omitempty"`
	Groups       []GroupResult `json:"groups,omitempty"`
	FileAttrs    FileAttrs     `json:"file_attrs"`
}

RuleFileMatch is one candidate file reported for a rule. SizeExceeded is set when the file was larger than the rule's size guard: it is reported but not read, so FileSHA256 and Groups are empty. FileAttrs (Stat-only metadata) is always present.

type RuleResult added in v1.12.0

type RuleResult struct {
	RuleID           string          `json:"rule_id"`
	RuleRevision     string          `json:"rule_revision,omitempty"`
	MatchesTruncated bool            `json:"matches_truncated,omitempty"`
	Files            []RuleFileMatch `json:"files"`
}

RuleResult is one rule that matched at least one file. MatchesTruncated is true when more than the per-rule cap (200) of files matched; the Files slice is capped and the corresponding EvaluatedRule.Complete is false.

type RuleScan added in v1.12.0

type RuleScan struct {
	ScanComplete   bool            `json:"scan_complete"`
	EvaluatedRules []EvaluatedRule `json:"evaluated_rules"`
	Results        []RuleResult    `json:"results"`
}

RuleScan is the top-level result of one malicious-file scan. It carries the scan-level completeness flag, every rule the engine evaluated (even those with zero matches), and the per-rule match results. ScanComplete is false when a global file/time budget cut the walk short, which suppresses backend auto-resolution for the whole run.

type ScanResult

type ScanResult struct {
	AgentVersion      string          `json:"agent_version"`
	AgentURL          string          `json:"agent_url"`
	ScanTimestamp     int64           `json:"scan_timestamp"`
	ScanTimestampISO  string          `json:"scan_timestamp_iso"`
	Device            Device          `json:"device"`
	AIAgentsAndTools  []AITool        `json:"ai_agents_and_tools"`
	IDEInstallations  []IDE           `json:"ide_installations"`
	IDEExtensions     []Extension     `json:"ide_extensions"`
	MCPConfigs        []MCPConfig     `json:"mcp_configs"`
	NodePkgManagers   []PkgManager    `json:"node_package_managers"`
	NodePackages      []any           `json:"node_packages"`
	NodeProjects      []ProjectInfo   `json:"node_projects"`
	BrewPkgManager    *PkgManager     `json:"brew_package_manager,omitempty"`
	BrewFormulae      []BrewPackage   `json:"brew_formulae"`
	BrewCasks         []BrewPackage   `json:"brew_casks"`
	PythonPkgManagers []PkgManager    `json:"python_package_managers"`
	PythonPackages    []PythonPackage `json:"python_packages"`
	PythonProjects    []ProjectInfo   `json:"python_projects"`
	SystemPkgManager  *PkgManager     `json:"system_package_manager,omitempty"`
	SystemPackages    []SystemPackage `json:"system_packages"`
	SnapPkgManager    *PkgManager     `json:"snap_package_manager,omitempty"`
	SnapPackages      []SystemPackage `json:"snap_packages"`
	FlatpakPkgManager *PkgManager     `json:"flatpak_package_manager,omitempty"`
	FlatpakPackages   []SystemPackage `json:"flatpak_packages"`
	NPMRCAudit        *NPMRCAudit     `json:"npmrc_audit,omitempty"`
	PipAudit          *PipAudit       `json:"pip_audit,omitempty"`
	PnpmAudit         *PnpmAudit      `json:"pnpm_audit,omitempty"`
	BunAudit          *BunAudit       `json:"bun_audit,omitempty"`
	YarnAudit         *YarnAudit      `json:"yarn_audit,omitempty"`

	// AgentSkills is the flat list of discovered AI agent skills. AgentSkillScan
	// is the phase summary; its non-nil presence is the "scan ran" sentinel (a
	// nil section must never cause the backend to delete skill state).
	AgentSkills    []AgentSkill        `json:"agent_skills,omitempty"`
	AgentSkillScan *AgentSkillScanInfo `json:"agent_skill_scan,omitempty"`

	Summary Summary `json:"summary"`
}

ScanResult is the community-mode JSON output structure.

type Summary

type Summary struct {
	AIAgentsAndToolsCount int `json:"ai_agents_and_tools_count"`
	IDEInstallationsCount int `json:"ide_installations_count"`
	IDEExtensionsCount    int `json:"ide_extensions_count"`
	MCPConfigsCount       int `json:"mcp_configs_count"`
	NodeProjectsCount     int `json:"node_projects_count"`
	BrewFormulaeCount     int `json:"brew_formulae_count"`
	BrewCasksCount        int `json:"brew_casks_count"`
	PythonProjectsCount   int `json:"python_projects_count"`
	SystemPackagesCount   int `json:"system_packages_count"`
	SnapPackagesCount     int `json:"snap_packages_count"`
	FlatpakPackagesCount  int `json:"flatpak_packages_count"`
	AgentSkillsCount      int `json:"agent_skills_count"`
}

type SystemPackage added in v1.11.0

type SystemPackage struct {
	Name            string `json:"name"`
	Version         string `json:"version"`
	Arch            string `json:"arch,omitempty"`              // CPU architecture: x86_64, amd64, noarch, arm64, etc.
	Source          string `json:"source,omitempty"`            // Origin: source RPM, dpkg source, snap publisher, flatpak remote
	InstallPath     string `json:"install_path,omitempty"`      // On-disk install root. Populated for snap (/snap/<name>/current) and flatpak (~/.local/share/flatpak/app/<id> or /var/lib/flatpak/app/<id>). Not applicable for rpm/dpkg/pacman/apk (file collections).
	InstallTimeUnix int64  `json:"install_time_unix,omitempty"` // Unix epoch seconds when installed (rpm, dpkg, pacman)

	// Provenance & trust signals
	Vendor        string `json:"vendor,omitempty"`          // Distributor: rpm VENDOR, dpkg Origin
	Maintainer    string `json:"maintainer,omitempty"`      // Packager identity: rpm PACKAGER, dpkg Maintainer, apk maintainer, pacman Packager
	URL           string `json:"url,omitempty"`             // Upstream project URL
	License       string `json:"license,omitempty"`         // SPDX license expression
	Section       string `json:"section,omitempty"`         // dpkg Section category (e.g. "libs", "non-free/libs")
	Signature     string `json:"signature,omitempty"`       // Signature info: rpm SIGPGP/RSAHEADER, pacman Validated By
	BuildTimeUnix int64  `json:"build_time_unix,omitempty"` // Unix epoch when package was built (rpm, apk, pacman)

	// Size
	InstalledSize int64 `json:"installed_size,omitempty"` // Installed size in bytes (rpm SIZE, dpkg Installed-Size * 1024)

	// Sandboxing / confinement (snap, flatpak)
	Confinement string `json:"confinement,omitempty"` // snap: strict/classic/devmode
	Channel     string `json:"channel,omitempty"`     // snap tracking channel, flatpak branch
	Runtime     string `json:"runtime,omitempty"`     // flatpak runtime ref

	// Source control
	CommitHash string `json:"commit_hash,omitempty"` // apk commit, flatpak active commit
}

SystemPackage represents a package installed via the system package manager (rpm, dpkg, pacman, apk, snap, flatpak).

type SystemPackageScanResult added in v1.11.0

type SystemPackageScanResult struct {
	ScanType       string          `json:"scan_type"` // "rpm", "dpkg", "pacman", "apk", "snap", "flatpak"
	PackageManager *PkgManager     `json:"package_manager,omitempty"`
	Packages       []SystemPackage `json:"packages"`
	PackagesCount  int             `json:"packages_count"`
	Error          string          `json:"error,omitempty"`
	ScanDurationMs int64           `json:"scan_duration_ms"`
}

SystemPackageScanResult holds parsed system package data for enterprise telemetry. Unlike BrewScanResult (which sends raw base64), this sends pre-parsed packages since syspkg.go already handles the format-specific parsing edge cases.

type UnchangedGlobalRef added in v1.13.0

type UnchangedGlobalRef struct {
	PackageManager          string `json:"package_manager"`
	ScanOutputHash          string `json:"scan_output_hash"`
	LastUploadedExecutionID string `json:"last_uploaded_execution_id,omitempty"`
}

UnchangedGlobalRef tells the backend a PM's global package set is unchanged. Keyed by PM name (globals are PM-scoped, not path-scoped).

type UnchangedProjectRef added in v1.13.0

type UnchangedProjectRef struct {
	Path                    string `json:"path"`
	ScanOutputHash          string `json:"scan_output_hash"`
	LastUploadedExecutionID string `json:"last_uploaded_execution_id,omitempty"`
}

UnchangedProjectRef tells the backend a project is unchanged since the last successful upload. Backend bumps LastSeenAt on every package row whose ProjectPaths contains Path.

type YarnAudit added in v1.12.0

type YarnAudit struct {
	Available      bool             `json:"yarn_available"`
	YarnVersion    string           `json:"yarn_version,omitempty"`
	YarnPath       string           `json:"yarn_path,omitempty"`
	Flavor         string           `json:"flavor,omitempty"` // "classic" | "berry" | "unknown"
	Files          []YarnConfigFile `json:"files"`
	NPMRCFiles     []NPMRCFile      `json:"npmrc_files"` // auth side-channel
	Env            []NPMRCEnvVar    `json:"env"`
	DiscoveryError string           `json:"discovery_error,omitempty"`
}

YarnAudit covers both classic (v1.x, .yarnrc) and berry (v2+, .yarnrc.yml). Top-level Flavor reflects the binary's major; per-file Flavor reflects the file's own syntax — the renderer flags mismatches.

type YarnConfigFile added in v1.12.0

type YarnConfigFile struct {
	Path        string      `json:"path"`
	Scope       string      `json:"scope"`  // "user" | "project"
	Flavor      string      `json:"flavor"` // "classic" | "berry"
	Exists      bool        `json:"exists"`
	Readable    bool        `json:"readable"`
	SizeBytes   int64       `json:"size_bytes,omitempty"`
	ModTimeUnix int64       `json:"mtime_unix,omitempty"`
	Mode        string      `json:"mode,omitempty"`
	OwnerUID    int         `json:"owner_uid,omitempty"`
	OwnerName   string      `json:"owner_name,omitempty"`
	GroupGID    int         `json:"group_gid,omitempty"`
	GroupName   string      `json:"group_name,omitempty"`
	SHA256      string      `json:"sha256,omitempty"`
	SymlinkTo   string      `json:"symlink_target,omitempty"`
	InGitRepo   bool        `json:"in_git_repo,omitempty"`
	GitTracked  bool        `json:"git_tracked,omitempty"`
	Entries     []YarnEntry `json:"entries,omitempty"`
	ParseError  string      `json:"parse_error,omitempty"`
}

YarnConfigFile is a discovered .yarnrc (classic) or .yarnrc.yml (berry).

type YarnEntry added in v1.12.0

type YarnEntry struct {
	Key          string   `json:"key"`
	DisplayValue string   `json:"display_value"`
	LineNum      int      `json:"line_num,omitempty"`
	IsAuth       bool     `json:"is_auth,omitempty"`
	IsEnvRef     bool     `json:"is_env_ref,omitempty"`
	EnvRefVars   []string `json:"env_ref_vars,omitempty"`
	ValueSHA256  string   `json:"value_sha256,omitempty"`
	Quoted       bool     `json:"quoted,omitempty"`
}

YarnEntry is a parsed key/value from either flavor. Berry nested maps flatten to dotted keys (e.g. `npmScopes.@step-security.npmAuthToken`) so the same slice carries both flavors.

Jump to

Keyboard shortcuts

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