Work-in-progress Go CLI that scans a repository for basic Hugging Face model usage and emits a CycloneDX AI BOM (AIBOM).
What works today:
- Basic scanning for Hugging Face model IDs in Python-like sources via
from_pretrained("...") - AIBOM generation per detected model in JSON or XML including correct dependencies and BOMrefs
- Hugging Face Hub API fetch to populate metadata fields
- Hugging Face Repo README fetch to populate more metadata fields
- Completeness scoring and validation of existing AIBOM files
- Interactive or file based metadata enrichment
- Data components with dataset fetchers and linking them in the AIBOM
- Updated the UI to utilise Charm libraries
What is future work:
- Improving the scanner beyond the current regex-based Hugging Face detection
- Implementing the possibility to merge AIBOMs with existing sboms from a different source
- Implementing the possibility to sign AIBOMs with cosign
- Implementing check-vuln command to check AI vulnerability databases
- Implementing AIBOM generation based of model files not on Hugging Face
go test ./...
go build -o aibomgen-cli .
./aibomgen-cli --helpScans a directory for model usage and writes one AIBOM file per detected model.
./aibomgen-cli generate -i testdata/repo-basicBy default this writes JSON files under dist/ with filenames derived from the model ID, e.g.:
dist/google-bert_bert-base-uncased_aibom.jsondist/templates_model-card-example_aibom.json
Common options:
--format json|xml|auto(default:auto)--output <path>: the directory portion is used as output directory (default:dist/aibom.json→ outputs todist/)--hf-mode online|dummy(default:online)--hf-token <token>for gated/private models--hf-timeout <seconds>--log-level quiet|standard|debug--enrich: enable interactive metadata enrichment after generation
Validates an existing AIBOM file (JSON/XML), runs completeness checks, and can fail in strict mode.
./aibomgen-cli validate -i dist/google-bert_bert-base-uncased_aibom.json
./aibomgen-cli validate -i dist/google-bert_bert-base-uncased_aibom.json --strict --min-score 0.5Useful options:
--format json|xml|auto--strict(fail on missing required fields)--min-score 0.0-1.0--check-model-card(default:true)--log-level quiet|standard|debug
Computes and prints a completeness score for an existing AIBOM using the metadata field registry.
./aibomgen-cli completeness -i dist/google-bert_bert-base-uncased_aibom.jsonOptions:
--format json|xml|auto--log-level quiet|standard|debug
Enriches an existing AIBOM by filling missing metadata fields interactively or from a configuration file.
./aibomgen-cli enrich -i dist/google-bert_bert-base-uncased_aibom.json
./aibomgen-cli enrich -i dist/google-bert_bert-base-uncased_aibom.json --strategy interactive
./aibomgen-cli enrich -i dist/google-bert_bert-base-uncased_aibom.json --strategy file --config config/enrichment.yamlOptions:
--strategy interactive|file(default:interactive)--config <path>: configuration file for file-based enrichment--required-only: only enrich required fields--min-weight <float>: minimum weight threshold for fields to enrich--refetch: refetch metadata from Hugging Face Hub--no-preview: skip preview before applying changes--hf-token <token>: Hugging Face API token--log-level quiet|standard|debug
--no-color: disable ANSI coloring--config <path>: optional config file. If not provided, the app attempts to read a Viper config from the home directory (seecmd/root.go).
Each folder below is a Go package.
Entry point that calls the Cobra root command.
Cobra CLI wiring: root command, subcommands, flag parsing, and orchestration into internal/* packages.
Repository scanning.
- Current behavior: walks files and detects Hugging Face model IDs by regex matching
from_pretrained("<id>")in.py,.ipynb, and.txt. - Important limitation: weight-file detection is intentionally disabled right now.
- Future work: broaden detection beyond the current basic Hugging Face pattern.
HTTP clients for fetching model and dataset metadata from the Hugging Face Hub.
- Fetches model metadata via API (
/api/models/:id) and README (model cards) - Fetches dataset metadata via API (
/api/datasets/:id) and README (dataset cards) - Used when
generate --hf-mode onlineor when enriching with--refetch - Supports optional bearer token via
--hf-tokenfor gated/private resources - Includes dummy implementations for offline/testing scenarios
- Provides markdown extraction utilities for parsing model and dataset cards
Central "field registry" describing which CycloneDX AI-BOM fields we care about.
- Defines field specifications for model components, dataset components, and Hugging Face properties
- Each field has a key, weight, required status, apply logic, and presence check
- Supports multiple field types:
ComponentKey,ModelCardKey,HFPropsKey, andDatasetKey - Used by
internal/builderto populate the BOM and byinternal/completenessto score it - Used by
internal/enricherto identify missing fields and apply new values - Includes helpers for parsing and applying metadata from API responses and model/dataset cards
Turns a scan result (and optional Hugging Face API response) into a CycloneDX BOM.
- Creates a minimal ML model component skeleton.
- Applies the
internal/metadataregistry once to populate fields.
Orchestrates “per discovery” generation.
- For each detected model: fetch metadata (online mode) and build a BOM via the builder.
- Returns a list of generated BOMs back to the
generatecommand.
Read/write helpers for CycloneDX BOMs.
- Supports JSON and XML.
- Supports
format=autobased on file extension. - Supports optional CycloneDX spec version selection for output.
Computes a completeness score
Validates an existing AIBOM.
- Performs basic structural checks.
- Validates CycloneDX spec version.
- Runs completeness scoring and can enforce thresholds in strict mode.
Interactively or automatically fills missing metadata fields in an existing AIBOM.
- Supports two strategies:
interactive(prompts user for values) andfile(reads from config) - Can refetch metadata from Hugging Face Hub to fill known fields automatically
- Enriches both model components and dataset components
- Shows before/after preview with completeness scoring
- Integrates with the metadata field registry to identify and fill missing fields
- Respects field weights and required status when prompting
Comprehensive TUI (Terminal User Interface) system built with Charm libraries (Lipgloss, Bubbletea concepts).
- Provides rich, styled output for all commands (generate, validate, completeness, enrich)
- Implements workflow tracking with task progress indicators
- Defines a consistent color palette and text styles across the application
- Includes specialized UI components for each command:
generate.go: generation workflow with progress trackingvalidation.go: validation results with colored status indicatorscompleteness.go: completeness scoring with visual field breakdownworkflow.go: task-based progress trackingprogress.go: spinner and progress indicatorsstyles.go: centralized styling and color definitions
testdata/repo-basicis a small repository used in tests and examples.docs/contains design notes and mapping documentation.