Documentation
¶
Overview ¶
Disk-based Node.js package discovery.
NodeDistDetector inventories installed Node packages by parsing on-disk lockfiles (package-lock.json / npm-shrinkwrap.json, pnpm-lock.yaml, yarn.lock, bun.lock) and, as a fallback, node_modules/**/package.json — instead of running `npm ls` / `yarn list` / `pnpm ls` / `bun pm ls`.
Why parse instead of exec:
- Robust: no dependency on a working PM binary, correct PATH under launchd/systemd, network access, or a non-broken interpreter. A package manager that errors or hangs can't drop a project to zero.
- Complete: lockfiles carry the FULL resolved graph; the command path truncated transitive deps at --depth=3.
- Read-only: never executes project code (no postinstall, no PnP loader).
Output is intentionally minimal — {name, version, is_direct} — matching exactly what the backend persists (DeviceNPMPackageUsageInfo). The lockfile is the source of truth for the resolved set and for direct-vs-transitive; callers gate on an actual install (node_modules / PnP present) so a project that was never installed isn't reported.
Security context: all reads go through the Executor (so the user-aware executor and test mocks both apply) and are size-bounded via maxLockfileSize before the bytes are pulled into memory. The node_modules walk uses filepath.WalkDir directly (matching nodeproject.go) and never follows directory symlinks, so a symlinked dependency can't redirect the walk out of the project tree.
Disk-based Python package discovery.
PythonDistDetector inventories installed Python packages by reading their on-disk install metadata — *.dist-info/METADATA (PEP 566) and the legacy *.egg-info/PKG-INFO — instead of running `pip list`. This is the same set pip itself reports, since pip derives its listing from these dirs.
Read-only: no pip/uv/conda subprocess. Per-file size is capped so a package shipping a giant METADATA description payload cannot blow up memory.
Filesystem walk-and-recognize discovery of installed Python packages.
Rather than enumerating exact site-packages paths (a location allow-list that silently misses any interpreter installed somewhere we didn't list), we hand the existing dist-info recognizer (PythonDistDetector.ScanRoots) a bounded set of Python *install-tree* roots and let it recognize *.dist-info / *.egg-info metadata ANYWHERE beneath them. A package is then found regardless of the interpreter's internal layout or version — the only thing that must be known is the install tree, not the exact site-packages directory.
No interpreter is executed: running python (even a tiny `python -c`) risks the macOS install-prompt / TCC behavior the disk-based scan exists to avoid. The walk itself is kept out of TCC-protected trees by the tcc.Skipper that ScanRoots already applies.
All filesystem access and the home directory go through the executor so the discovery is user-aware (a root-run launchd scan resolves the console user's home, not /var/root) and mockable in tests.
Index ¶
- func CollectProjectRoots(lists ...[]model.ProjectInfo) []string
- func DetectProjectPM(exec executor.Executor, projectDir string) string
- func DiscoverPythonInstallRoots(exec executor.Executor, log *progress.Logger) []string
- func GlobalPythonRoots(exec executor.Executor, log *progress.Logger) []string
- func NodeGlobalRoots(exec executor.Executor) []nodeGlobalRoot
- func PythonGlobalRoots(exec executor.Executor) []string
- type AICLIDetector
- type AgentDetector
- type BrewDetector
- func (d *BrewDetector) DetectBrew(ctx context.Context) *model.PkgManager
- func (d *BrewDetector) ListCasks(ctx context.Context) []model.BrewPackage
- func (d *BrewDetector) ListCasksRich(ctx context.Context) []model.BrewPackage
- func (d *BrewDetector) ListFormulae(ctx context.Context) []model.BrewPackage
- func (d *BrewDetector) ListFormulaeRich(ctx context.Context) []model.BrewPackage
- type BrewScanner
- type ExtensionDetector
- func (d *ExtensionDetector) Detect(ctx context.Context, searchDirs []string, ides []model.IDE) []model.Extension
- func (d *ExtensionDetector) DetectEclipsePlugins(ctx context.Context, ides []model.IDE) []model.Extension
- func (d *ExtensionDetector) DetectJetBrainsPlugins() []model.Extension
- func (d *ExtensionDetector) DetectVisualStudioExtensions(_ context.Context) []model.Extension
- func (d *ExtensionDetector) DetectXcodeExtensions(ctx context.Context) []model.Extension
- type FrameworkDetector
- type IDEDetector
- type JetBrainsPluginDetector
- type MCPDetector
- type NodeDistDetector
- func (d *NodeDistDetector) ScanGlobalModules(nmRoot string) []model.NodePackage
- func (d *NodeDistDetector) ScanProject(projectDir, pm string) []model.NodePackage
- func (d *NodeDistDetector) WithLogger(log *progress.Logger) *NodeDistDetector
- func (d *NodeDistDetector) WithSkipper(s *tcc.Skipper) *NodeDistDetector
- type NodePMDetector
- type NodeProjectDetector
- func (d *NodeProjectDetector) CountProjects(_ context.Context, searchDirs []string) int
- func (d *NodeProjectDetector) ListProjects(searchDirs []string) []model.ProjectInfo
- func (d *NodeProjectDetector) WithDiskScan(dist *NodeDistDetector) *NodeProjectDetector
- func (d *NodeProjectDetector) WithSkipper(s *tcc.Skipper) *NodeProjectDetector
- type NodeScanner
- func (s *NodeScanner) ScanGlobalPackages(ctx context.Context) []model.NodeScanResult
- func (s *NodeScanner) ScanProjects(ctx context.Context, searchDirs []string, ...) (results []model.NodeScanResult, discovered []string)
- func (s *NodeScanner) WithDiskScan(dist *NodeDistDetector) *NodeScanner
- func (s *NodeScanner) WithSkipper(skipper *tcc.Skipper) *NodeScanner
- type PythonDistDetector
- func (d *PythonDistDetector) ScanGlobalPackages() []model.PythonPackage
- func (d *PythonDistDetector) ScanRoots(roots []string) []model.PackageDetail
- func (d *PythonDistDetector) ScanVenv(venvPath string) []model.PackageDetail
- func (d *PythonDistDetector) WithLogger(log *progress.Logger) *PythonDistDetector
- func (d *PythonDistDetector) WithSkipper(s *tcc.Skipper) *PythonDistDetector
- type PythonPMDetector
- type PythonProjectDetector
- func (d *PythonProjectDetector) CountProjects(_ context.Context, searchDirs []string) int
- func (d *PythonProjectDetector) ListProjects(searchDirs []string, knownLastVerified map[string]time.Time) (projects []model.ProjectInfo, discovered []string)
- func (d *PythonProjectDetector) WithDiskScan(dist *PythonDistDetector) *PythonProjectDetector
- func (d *PythonProjectDetector) WithLogger(log *progress.Logger) *PythonProjectDetector
- func (d *PythonProjectDetector) WithSkipper(s *tcc.Skipper) *PythonProjectDetector
- type PythonScanner
- type SkillsDetector
- type SystemPkgDetector
- func (d *SystemPkgDetector) Detect(ctx context.Context) *model.PkgManager
- func (d *SystemPkgDetector) DetectAdditionalManagers(ctx context.Context) []model.PkgManager
- func (d *SystemPkgDetector) ListFlatpakPackages(ctx context.Context) []model.SystemPackage
- func (d *SystemPkgDetector) ListPackages(ctx context.Context) []model.SystemPackage
- func (d *SystemPkgDetector) ListPackagesApkDB(ctx context.Context) []model.SystemPackage
- func (d *SystemPkgDetector) ListSnapPackages(ctx context.Context) []model.SystemPackage
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CollectProjectRoots ¶ added in v1.14.0
func CollectProjectRoots(lists ...[]model.ProjectInfo) []string
CollectProjectRoots flattens the Path of one or more ProjectInfo lists into a deduplicated []string, dropping empties. It is the bridge from the node and python project scanners to the skills detector's extraProjectRoots argument on the community scan path (internal/scan). The enterprise telemetry path has its own twin (telemetry.collectProjectRoots) because it carries NodeScanResult rather than ProjectInfo. First occurrence wins for ordering — the skills detector re-resolves, re-dedupes and sorts internally, so callers need not.
func DetectProjectPM ¶
DetectProjectPM detects which package manager a project uses based on lock files.
func DiscoverPythonInstallRoots ¶ added in v1.14.0
DiscoverPythonInstallRoots expands pythonInstallTreeGlobs and returns the existing directories to walk, symlink-resolved, deduplicated, and with any root nested under another dropped. No interpreter is executed.
func GlobalPythonRoots ¶ added in v1.14.0
GlobalPythonRoots returns the roots ScanRoots should walk-and-recognize for global/system Python packages: the filesystem-discovered install trees unioned with the static PythonGlobalRoots list (belt-and-suspenders, so coverage never regresses below the previous behavior), deduped by resolved path with nested roots dropped.
func NodeGlobalRoots ¶ added in v1.13.0
NodeGlobalRoots enumerates global node_modules directories on the host, grouped by package manager, with no PM invocation (replaces `npm config get prefix` / `yarn global dir` / `pnpm root -g`). Only directories that exist are returned.
Globals are scattered across version managers and install prefixes, so this is a best-effort sweep of the well-known locations rather than an exhaustive resolution of the user's active prefix — the same trade-off as the Python global-roots scan. Where a manager (nvm/fnm/volta) keeps per-version trees, every installed version's global dir is included.
func PythonGlobalRoots ¶ added in v1.13.0
PythonGlobalRoots returns the global / user site-packages locations worth scanning for system-wide Python packages, keeping only those present on this host. These are the install roots the old `pip3 list` global scan reported from, plus user-site and version-manager locations the command-based scan tended to miss.
Types ¶
type AICLIDetector ¶
type AICLIDetector struct {
// contains filtered or unexported fields
}
AICLIDetector detects AI CLI tools.
func NewAICLIDetector ¶
func NewAICLIDetector(exec executor.Executor) *AICLIDetector
func (*AICLIDetector) WithLogger ¶ added in v1.14.0
func (d *AICLIDetector) WithLogger(log *progress.Logger) *AICLIDetector
WithLogger injects a logger (used to surface exec fallbacks when metadata version resolution misses). Chainable, mirrors configaudit's WithSkipper.
type AgentDetector ¶
type AgentDetector struct {
// contains filtered or unexported fields
}
AgentDetector detects general-purpose AI agents.
func NewAgentDetector ¶
func NewAgentDetector(exec executor.Executor) *AgentDetector
func (*AgentDetector) WithLogger ¶ added in v1.14.0
func (d *AgentDetector) WithLogger(log *progress.Logger) *AgentDetector
WithLogger injects a logger (used to surface exec fallbacks when metadata version resolution misses). Chainable, mirrors configaudit's WithSkipper.
type BrewDetector ¶ added in v1.10.0
type BrewDetector struct {
// contains filtered or unexported fields
}
BrewDetector detects Homebrew installation and packages.
func NewBrewDetector ¶ added in v1.10.0
func NewBrewDetector(exec executor.Executor) *BrewDetector
func (*BrewDetector) DetectBrew ¶ added in v1.10.0
func (d *BrewDetector) DetectBrew(ctx context.Context) *model.PkgManager
DetectBrew checks if Homebrew is installed and returns its version info. Returns nil if Homebrew is not found.
func (*BrewDetector) ListCasks ¶ added in v1.10.0
func (d *BrewDetector) ListCasks(ctx context.Context) []model.BrewPackage
ListCasks returns installed Homebrew casks with versions.
func (*BrewDetector) ListCasksRich ¶ added in v1.11.0
func (d *BrewDetector) ListCasksRich(ctx context.Context) []model.BrewPackage
ListCasksRich returns installed casks with metadata. Same strategy as ListFormulaeRich.
func (*BrewDetector) ListFormulae ¶ added in v1.10.0
func (d *BrewDetector) ListFormulae(ctx context.Context) []model.BrewPackage
ListFormulae returns installed Homebrew formulae with versions.
func (*BrewDetector) ListFormulaeRich ¶ added in v1.11.0
func (d *BrewDetector) ListFormulaeRich(ctx context.Context) []model.BrewPackage
ListFormulaeRich returns installed formulae with metadata. Uses two sources:
- brew info --json=v2 for desc/license/homepage (subprocess, but comprehensive)
- INSTALL_RECEIPT.json from Cellar for tap/install_time/dependency (file read, fast)
Falls back gracefully: if JSON command fails, reads receipts only. If receipts fail, falls back to basic `brew list --versions`.
type BrewScanner ¶ added in v1.10.0
type BrewScanner struct {
// contains filtered or unexported fields
}
BrewScanner produces a BrewScanResult for enterprise telemetry by synthesizing the raw `brew list --versions` format from the rich package data we already have.
We used to shell out to `brew list --formula|--cask --versions`, but on some hosts `brew list --cask --versions` crashes inside Homebrew itself (e.g. nil in a cask's depends_on triggers `undefined method 'to_sym' for nil` in cask_struct_generator.rb). The rich path (`brew info --json=v2`) is unaffected, so we reuse its data here.
func NewBrewScanner ¶ added in v1.10.0
func NewBrewScanner(_ executor.Executor, log *progress.Logger) *BrewScanner
NewBrewScanner keeps the (exec, log) signature for caller compatibility; exec is unused.
func (*BrewScanner) CasksResult ¶ added in v1.12.0
func (s *BrewScanner) CasksResult(pkgs []model.BrewPackage) model.BrewScanResult
CasksResult builds a casks scan result from rich package data.
func (*BrewScanner) FormulaeResult ¶ added in v1.12.0
func (s *BrewScanner) FormulaeResult(pkgs []model.BrewPackage) model.BrewScanResult
FormulaeResult builds a formulae scan result from rich package data.
type ExtensionDetector ¶
type ExtensionDetector struct {
// contains filtered or unexported fields
}
ExtensionDetector collects IDE extensions.
func NewExtensionDetector ¶
func NewExtensionDetector(exec executor.Executor) *ExtensionDetector
func (*ExtensionDetector) DetectEclipsePlugins ¶ added in v1.10.0
func (d *ExtensionDetector) DetectEclipsePlugins(ctx context.Context, ides []model.IDE) []model.Extension
DetectEclipsePlugins scans Eclipse installations for plugins. On macOS: scans features/dropins directories. On Windows: multi-stage pipeline using detected IDE paths, path probes, and drive letter scanning, with validation before reporting.
func (*ExtensionDetector) DetectJetBrainsPlugins ¶ added in v1.10.0
func (d *ExtensionDetector) DetectJetBrainsPlugins() []model.Extension
DetectJetBrainsPlugins scans JetBrains and Android Studio plugin directories and returns detected plugins as model.Extension entries. Bundled plugins (from app bundle) are tagged "bundled". User-installed plugins (from ~/Library/Application Support/) are tagged "user_installed".
func (*ExtensionDetector) DetectVisualStudioExtensions ¶ added in v1.13.0
func (d *ExtensionDetector) DetectVisualStudioExtensions(_ context.Context) []model.Extension
DetectVisualStudioExtensions discovers classic Visual Studio extensions. Windows-only; returns nil on other platforms.
func (*ExtensionDetector) DetectXcodeExtensions ¶ added in v1.10.0
func (d *ExtensionDetector) DetectXcodeExtensions(ctx context.Context) []model.Extension
DetectXcodeExtensions uses macOS pluginkit to find installed Xcode Source Editor extensions.
type FrameworkDetector ¶
type FrameworkDetector struct {
// contains filtered or unexported fields
}
FrameworkDetector detects AI frameworks and runtimes.
func NewFrameworkDetector ¶
func NewFrameworkDetector(exec executor.Executor) *FrameworkDetector
func (*FrameworkDetector) Detect ¶
func (d *FrameworkDetector) Detect(ctx context.Context) []model.AITool
func (*FrameworkDetector) WithLogger ¶ added in v1.14.0
func (d *FrameworkDetector) WithLogger(log *progress.Logger) *FrameworkDetector
WithLogger injects a logger (used to surface exec fallbacks when metadata version resolution misses). Chainable, mirrors configaudit's WithSkipper.
type IDEDetector ¶
type IDEDetector struct {
// contains filtered or unexported fields
}
IDEDetector detects installed IDEs and AI desktop apps.
func NewIDEDetector ¶
func NewIDEDetector(exec executor.Executor) *IDEDetector
type JetBrainsPluginDetector ¶ added in v1.10.1
type JetBrainsPluginDetector struct {
// contains filtered or unexported fields
}
JetBrainsPluginDetector collects user-installed plugins from JetBrains-family IDEs.
It reads product-info.json from each detected IDE's install path to obtain the dataDirectoryName and productVendor, then scans the platform-specific config directory for user-installed plugins:
- macOS: ~/Library/Application Support/<vendor>/<dataDirectoryName>/plugins/
- Windows: %APPDATA%/<vendor>/<dataDirectoryName>/plugins/
- Linux: ~/.config/<vendor>/<dataDirectoryName>/plugins/ (XDG_CONFIG_HOME respected)
Also checks for custom plugin path overrides in idea.properties. Plugin version is extracted from JAR filenames matching <pluginDirName>-<version>.jar.
func NewJetBrainsPluginDetector ¶ added in v1.10.1
func NewJetBrainsPluginDetector(exec executor.Executor) *JetBrainsPluginDetector
type MCPDetector ¶
type MCPDetector struct {
// contains filtered or unexported fields
}
MCPDetector collects MCP configuration files.
func NewMCPDetector ¶
func NewMCPDetector(exec executor.Executor) *MCPDetector
func (*MCPDetector) Detect ¶
func (d *MCPDetector) Detect(_ context.Context, userIdentity string, searchDirs []string, enterprise bool) []model.MCPConfig
Detect returns the MCP config locations found on the host as community-mode MCPConfig structs (path, source, and vendor only). It does not read config content — DetectEnterprise does that. The enterprise parameter is unused and kept only for call-site compatibility.
func (*MCPDetector) DetectEnterprise ¶
func (d *MCPDetector) DetectEnterprise(_ context.Context, searchDirs []string) []model.MCPConfigEnterprise
DetectEnterprise returns enterprise-mode MCP configs with base64 content.
func (*MCPDetector) WithSkipper ¶ added in v1.14.0
func (d *MCPDetector) WithSkipper(s *tcc.Skipper) *MCPDetector
WithSkipper attaches a TCC skipper so the discovery walk skips macOS-protected directories. A nil skipper is a no-op. Returns the detector for chaining.
type NodeDistDetector ¶ added in v1.13.0
type NodeDistDetector struct {
// contains filtered or unexported fields
}
NodeDistDetector parses installed Node packages from disk, with no package-manager subprocess.
func NewNodeDistDetector ¶ added in v1.13.0
func NewNodeDistDetector(exec executor.Executor) *NodeDistDetector
func (*NodeDistDetector) ScanGlobalModules ¶ added in v1.13.0
func (d *NodeDistDetector) ScanGlobalModules(nmRoot string) []model.NodePackage
ScanGlobalModules reads a global node_modules directory (e.g. an npm prefix's lib/node_modules, or pnpm's global store), reporting installed packages. A package is direct when it sits immediately under the global root (a package the user installed with `-g`); anything below a further node_modules is a transitive dependency of one of those.
func (*NodeDistDetector) ScanProject ¶ added in v1.13.0
func (d *NodeDistDetector) ScanProject(projectDir, pm string) []model.NodePackage
ScanProject returns the packages installed for a project, parsed from disk.
pm is the package manager already detected for the project (see DetectProjectPM). It selects which lockfile parser to try first; if that lockfile is absent or unparseable, ScanProject falls back to walking node_modules. The result is de-duplicated by (name, version) and sorted by name then version for stable output.
func (*NodeDistDetector) WithLogger ¶ added in v1.13.0
func (d *NodeDistDetector) WithLogger(log *progress.Logger) *NodeDistDetector
WithLogger attaches a progress logger. A nil logger falls back to the no-op default. Returns the detector for chaining.
func (*NodeDistDetector) WithSkipper ¶ added in v1.13.0
func (d *NodeDistDetector) WithSkipper(s *tcc.Skipper) *NodeDistDetector
WithSkipper attaches a TCC skipper so the node_modules fallback walk skips macOS-protected directories. A nil skipper is a no-op. Returns the detector for chaining.
type NodePMDetector ¶
type NodePMDetector struct {
// contains filtered or unexported fields
}
NodePMDetector detects installed Node.js package managers.
func NewNodePMDetector ¶
func NewNodePMDetector(exec executor.Executor) *NodePMDetector
func (*NodePMDetector) DetectManagers ¶
func (d *NodePMDetector) DetectManagers(ctx context.Context) []model.PkgManager
func (*NodePMDetector) WithLogger ¶ added in v1.14.0
func (d *NodePMDetector) WithLogger(log *progress.Logger) *NodePMDetector
WithLogger injects a logger (used to surface exec fallbacks when metadata version resolution misses). Chainable, mirrors configaudit's WithSkipper.
type NodeProjectDetector ¶
type NodeProjectDetector struct {
// contains filtered or unexported fields
}
NodeProjectDetector scans for Node.js projects.
func NewNodeProjectDetector ¶
func NewNodeProjectDetector(exec executor.Executor) *NodeProjectDetector
func (*NodeProjectDetector) CountProjects ¶
func (d *NodeProjectDetector) CountProjects(_ context.Context, searchDirs []string) int
CountProjects counts the number of Node.js projects found under the given directories.
func (*NodeProjectDetector) ListProjects ¶ added in v1.10.0
func (d *NodeProjectDetector) ListProjects(searchDirs []string) []model.ProjectInfo
ListProjects returns Node.js project paths with their detected package manager and the dependencies listed in package.json.
func (*NodeProjectDetector) WithDiskScan ¶ added in v1.13.0
func (d *NodeProjectDetector) WithDiskScan(dist *NodeDistDetector) *NodeProjectDetector
WithDiskScan switches per-project package listing to disk parsing (resolved name@version from the lockfile / node_modules) via the supplied detector. A nil detector leaves the legacy package.json-range path in place. Returns the detector for chaining.
func (*NodeProjectDetector) WithSkipper ¶ added in v1.11.4
func (d *NodeProjectDetector) WithSkipper(s *tcc.Skipper) *NodeProjectDetector
WithSkipper attaches a TCC skipper so the walk skips macOS-protected directories. A nil skipper is a no-op. Returns the detector for chaining.
type NodeScanner ¶
type NodeScanner struct {
// ProgressHook, when non-nil, is invoked from inside ScanProjects /
// ScanGlobalPackages with a short human-readable detail string ("project
// 12 of 47", "scanning yarn", ...). Telemetry plumbs this into
// PhaseTracker.UpdateDetail so heartbeats surface mid-phase progress.
ProgressHook func(detail string)
// contains filtered or unexported fields
}
NodeScanner performs enterprise-mode node scanning (raw output, base64 encoded).
func NewNodeScanner ¶
func (*NodeScanner) ScanGlobalPackages ¶
func (s *NodeScanner) ScanGlobalPackages(ctx context.Context) []model.NodeScanResult
ScanGlobalPackages returns globally-installed packages, one NodeScanResult per package manager. In disk mode it parses each PM's global node_modules; otherwise it runs npm/yarn/pnpm list -g and returns raw base64 output.
func (*NodeScanner) ScanProjects ¶
func (s *NodeScanner) ScanProjects(ctx context.Context, searchDirs []string, knownLastVerified map[string]time.Time) (results []model.NodeScanResult, discovered []string)
ScanProjects finds package.json files and scans them within the size cap.
Ordering: never-before-seen projects (paths absent from knownLastVerified) come first, sorted by mtime descending. Already-known projects follow, sorted by their LastVerifiedAt ascending so the stalest are re-checked first. Pass a nil map for plain mtime-descending order.
The second return is every project directory discovered on disk (before the cap), so callers can distinguish "missing from disk" from "dropped by the cap" when comparing against prior state.
func (*NodeScanner) WithDiskScan ¶ added in v1.13.0
func (s *NodeScanner) WithDiskScan(dist *NodeDistDetector) *NodeScanner
WithDiskScan switches package discovery to on-disk parsing via the supplied detector (no `npm ls` / `yarn` / `pnpm` / `bun` subprocess). A nil detector leaves the legacy command path in place. Returns the scanner for chaining.
func (*NodeScanner) WithSkipper ¶ added in v1.11.4
func (s *NodeScanner) WithSkipper(skipper *tcc.Skipper) *NodeScanner
WithSkipper attaches a TCC skipper so the discovery walk skips macOS-protected directories. A nil skipper is a no-op.
type PythonDistDetector ¶ added in v1.13.0
type PythonDistDetector struct {
// contains filtered or unexported fields
}
PythonDistDetector discovers installed Python packages from install metadata on disk, with no package-manager subprocess.
func NewPythonDistDetector ¶ added in v1.13.0
func NewPythonDistDetector(exec executor.Executor) *PythonDistDetector
func (*PythonDistDetector) ScanGlobalPackages ¶ added in v1.13.0
func (d *PythonDistDetector) ScanGlobalPackages() []model.PythonPackage
ScanGlobalPackages walks the host's global / user site-packages roots and returns the installed packages, replacing the `pip3 list` global scan.
func (*PythonDistDetector) ScanRoots ¶ added in v1.13.0
func (d *PythonDistDetector) ScanRoots(roots []string) []model.PackageDetail
ScanRoots walks each root and returns every distinct package discovered via install metadata. Packages are de-duplicated by (lowercased name, version) so the same install surfaced once is reported once, and the result is sorted by name then version for stable output.
func (*PythonDistDetector) ScanVenv ¶ added in v1.13.0
func (d *PythonDistDetector) ScanVenv(venvPath string) []model.PackageDetail
ScanVenv returns the packages installed in a single virtual environment by reading the dist-info/egg-info metadata under it (typically lib/python*/site-packages or Lib/site-packages). Replaces the per-venv `pip list` call.
func (*PythonDistDetector) WithLogger ¶ added in v1.13.0
func (d *PythonDistDetector) WithLogger(log *progress.Logger) *PythonDistDetector
WithLogger attaches a progress logger. A nil logger falls back to the no-op default. Returns the detector for chaining.
func (*PythonDistDetector) WithSkipper ¶ added in v1.13.0
func (d *PythonDistDetector) WithSkipper(s *tcc.Skipper) *PythonDistDetector
WithSkipper attaches a TCC skipper so the walk skips macOS-protected directories. A nil skipper is a no-op. Returns the detector for chaining.
type PythonPMDetector ¶ added in v1.10.0
type PythonPMDetector struct {
// contains filtered or unexported fields
}
PythonPMDetector detects installed Python package managers.
func NewPythonPMDetector ¶ added in v1.10.0
func NewPythonPMDetector(exec executor.Executor) *PythonPMDetector
func (*PythonPMDetector) DetectManagers ¶ added in v1.10.0
func (d *PythonPMDetector) DetectManagers(ctx context.Context) []model.PkgManager
func (*PythonPMDetector) ListPackages ¶ added in v1.10.0
func (d *PythonPMDetector) ListPackages(ctx context.Context) []model.PythonPackage
ListPackages returns installed Python packages using pip3.
func (*PythonPMDetector) WithLogger ¶ added in v1.14.0
func (d *PythonPMDetector) WithLogger(log *progress.Logger) *PythonPMDetector
WithLogger injects a logger (used to surface exec fallbacks when metadata version resolution misses). Chainable, mirrors configaudit's WithSkipper.
type PythonProjectDetector ¶ added in v1.10.0
type PythonProjectDetector struct {
// contains filtered or unexported fields
}
PythonProjectDetector scans for Python projects with virtual environments.
func NewPythonProjectDetector ¶ added in v1.10.0
func NewPythonProjectDetector(exec executor.Executor) *PythonProjectDetector
func (*PythonProjectDetector) CountProjects ¶ added in v1.10.0
func (d *PythonProjectDetector) CountProjects(_ context.Context, searchDirs []string) int
CountProjects counts Python projects with virtual environments.
func (*PythonProjectDetector) ListProjects ¶ added in v1.10.0
func (d *PythonProjectDetector) ListProjects(searchDirs []string, knownLastVerified map[string]time.Time) (projects []model.ProjectInfo, discovered []string)
ListProjects returns Python projects that have a virtual environment, along with the packages installed in each venv.
Ordering: paths absent from knownLastVerified come first by mtime descending; known paths follow by LastVerifiedAt ascending. Pass nil for discovery-order behavior.
ProjectInfo.Path is the venv directory itself (not the project root, unlike node detection). Multiple venvs sharing a parent each surface as their own entry. PackageManager is derived from marker files in the parent.
The second return is every venv path discovered on disk (before the cap), so callers can distinguish "missing from disk" from "dropped by the cap" when comparing against prior state.
func (*PythonProjectDetector) WithDiskScan ¶ added in v1.13.0
func (d *PythonProjectDetector) WithDiskScan(dist *PythonDistDetector) *PythonProjectDetector
WithDiskScan switches per-venv package listing to read on-disk install metadata (via the supplied PythonDistDetector) instead of running `pip list`. A nil detector leaves the legacy pip path in place. Returns the detector for chaining.
func (*PythonProjectDetector) WithLogger ¶ added in v1.13.0
func (d *PythonProjectDetector) WithLogger(log *progress.Logger) *PythonProjectDetector
WithLogger attaches a progress logger so venv discovery and per-venv scans surface in the agent log, on par with the Node project scanner. A nil logger falls back to the no-op default. Returns the detector for chaining.
func (*PythonProjectDetector) WithSkipper ¶ added in v1.11.4
func (d *PythonProjectDetector) WithSkipper(s *tcc.Skipper) *PythonProjectDetector
WithSkipper attaches a TCC skipper so the walk skips macOS-protected directories. A nil skipper is a no-op. Returns the detector for chaining.
type PythonScanner ¶ added in v1.10.0
type PythonScanner struct {
// ProgressHook, when non-nil, is invoked from inside ScanGlobalPackages
// with a short human-readable detail string ("scanning pip3", ...).
// Telemetry plumbs this into PhaseTracker.UpdateDetail so heartbeats
// surface mid-phase progress.
ProgressHook func(detail string)
// contains filtered or unexported fields
}
PythonScanner performs enterprise-mode Python scanning (raw output, base64 encoded).
func NewPythonScanner ¶ added in v1.10.0
func NewPythonScanner(exec executor.Executor, log *progress.Logger) *PythonScanner
func (*PythonScanner) ScanGlobalPackages ¶ added in v1.10.0
func (s *PythonScanner) ScanGlobalPackages(ctx context.Context) []model.PythonScanResult
ScanGlobalPackages runs pip3/conda/uv list and returns raw base64-encoded results.
func (*PythonScanner) ScanGlobalPackagesFromDisk ¶ added in v1.13.0
func (s *PythonScanner) ScanGlobalPackagesFromDisk(skipper *tcc.Skipper) []model.PythonScanResult
ScanGlobalPackagesFromDisk inventories global / user site-packages by reading install metadata on disk (no pip/conda/uv subprocess) and returns the result in the same PythonScanResult shape as ScanGlobalPackages: the package list is JSON-encoded ([{"name","version"},...]) into RawStdoutBase64 so the existing backend decoder needs no change. Returns nil when no global site-packages roots exist on the host.
type SkillsDetector ¶ added in v1.14.0
type SkillsDetector struct {
// contains filtered or unexported fields
}
SkillsDetector discovers installed AI agent skills across every recognized root (global, project, and skills.sh lock-managed). It performs pure filesystem reads only — no subprocesses — so it needs no user shell.
func NewSkillsDetector ¶ added in v1.14.0
func NewSkillsDetector(exec executor.Executor) *SkillsDetector
NewSkillsDetector constructs a SkillsDetector.
func (*SkillsDetector) Detect ¶ added in v1.14.0
func (d *SkillsDetector) Detect(ctx context.Context, extraProjectRoots []string, searchDirs []string) (skills []model.AgentSkill, info *model.AgentSkillScanInfo)
Detect discovers skills across all roots. extraProjectRoots are additional project roots surfaced by the node/python scanners (may be nil); the detector also self-discovers projects from ~/.claude.json. It never returns a hard error — every failure degrades to an AgentSkillScanInfo.Errors entry and the phase keeps going. A non-nil scan info is always returned (the backend "scan ran" sentinel), even on partial results. searchDirs (default $HOME) are swept for project-convention marker dirs so projects the user never registered in ~/.claude.json and that no node/python scanner surfaced are still inventoried; passing nil disables the walk (the registry + extra roots still apply).
func (*SkillsDetector) WithSkipper ¶ added in v1.14.0
func (d *SkillsDetector) WithSkipper(s *tcc.Skipper) *SkillsDetector
WithSkipper attaches a TCC skipper so discovery skips macOS-protected directories (and projects registered inside them, e.g. under ~/Documents) without triggering a permission prompt. A nil skipper is a no-op, matching the --include-tcc-protected opt-in. Returns the detector for chaining.
type SystemPkgDetector ¶ added in v1.11.0
type SystemPkgDetector struct {
// contains filtered or unexported fields
}
SystemPkgDetector detects installed system packages on Linux.
func NewSystemPkgDetector ¶ added in v1.11.0
func NewSystemPkgDetector(exec executor.Executor) *SystemPkgDetector
func (*SystemPkgDetector) Detect ¶ added in v1.11.0
func (d *SystemPkgDetector) Detect(ctx context.Context) *model.PkgManager
Detect finds the active system package manager and returns its info. Returns nil on non-Linux platforms or if no known PM is found.
func (*SystemPkgDetector) DetectAdditionalManagers ¶ added in v1.11.0
func (d *SystemPkgDetector) DetectAdditionalManagers(ctx context.Context) []model.PkgManager
DetectAdditionalManagers returns snap and/or flatpak if installed. These coexist with the system PM — a machine can have rpm + snap + flatpak.
func (*SystemPkgDetector) ListFlatpakPackages ¶ added in v1.11.0
func (d *SystemPkgDetector) ListFlatpakPackages(ctx context.Context) []model.SystemPackage
ListFlatpakPackages returns installed flatpak applications with runtime and branch info.
func (*SystemPkgDetector) ListPackages ¶ added in v1.11.0
func (d *SystemPkgDetector) ListPackages(ctx context.Context) []model.SystemPackage
ListPackages returns all installed system packages. Uses the first detected package manager from sysPkgSpecs. For apk, it prefers reading /lib/apk/db/installed directly for richer metadata.
func (*SystemPkgDetector) ListPackagesApkDB ¶ added in v1.11.0
func (d *SystemPkgDetector) ListPackagesApkDB(ctx context.Context) []model.SystemPackage
ListPackagesApkDB reads /lib/apk/db/installed directly for rich metadata. Falls back to the standard apk list --installed approach if the file is unreadable.
func (*SystemPkgDetector) ListSnapPackages ¶ added in v1.11.0
func (d *SystemPkgDetector) ListSnapPackages(ctx context.Context) []model.SystemPackage
ListSnapPackages returns installed snap packages with confinement and channel info.
Source Files
¶
- agent.go
- aicli.go
- brew.go
- brewscan.go
- claudeprojects.go
- eclipse_plugins.go
- extension.go
- framework.go
- ide.go
- jetbrains.go
- jetbrains_plugins.go
- mcp.go
- mcp_discovery.go
- nodedist.go
- nodedist_bun.go
- nodedist_global.go
- nodedist_modules.go
- nodedist_npm.go
- nodedist_pnpm.go
- nodedist_yarn.go
- nodepm.go
- nodepm_fallback.go
- nodeproject.go
- nodescan.go
- nodescan_cache.go
- process.go
- process_other.go
- pythondist.go
- pythonenv.go
- pythonpm.go
- pythonproject.go
- pythonscan.go
- registry_other.go
- shellcmd.go
- skills.go
- skills_census.go
- skills_frontmatter.go
- skills_lock.go
- syspkg.go
- visualstudio.go
- visualstudio_extensions.go
- xcode_extensions.go
Directories
¶
| Path | Synopsis |
|---|---|
|
Package rules implements the malicious-file detection engine for the enterprise agent.
|
Package rules implements the malicious-file detection engine for the enterprise agent. |