# AGENTS ## Role Exporter producing a Trivy-compatible database artifact for self-hosting or offline use. v0: JSON list + metadata; v1: integrate official trivy-db builder or write BoltDB directly; pack and optionally push via ORAS. ## Scope - Read canonical advisories; serialize payload for builder or intermediate; write metadata.json (generatedAt, counts). - Output root: exports/trivy/; deterministic path components. - OCI/Trivy expectations: layer media type application/vnd.aquasec.trivy.db.layer.v1.tar+gzip; config media type application/vnd.aquasec.trivy.config.v1+json; tag (e.g., 2). - Optional ORAS push; optional offline bundle (db.tar.gz + metadata.json). - DI: TrivyExporter + Jobs.TrivyExportJob registered by TrivyExporterDependencyInjectionRoutine. - Export_state recording: capture digests, counts, start/end timestamps for idempotent reruns and incremental packaging. ## Participants - Storage.Mongo.AdvisoryStore as input. - Core scheduler runs export job; WebService/Plugins trigger it. - JSON exporter (optional precursor) if choosing the builder path. ## Interfaces & contracts - IFeedExporter.Name = "trivy-db"; ExportAsync(IServiceProvider, CancellationToken). - ConcelierOptions.packaging.trivy governs repo/tag/publish/offline_bundle. - Deterministic sorting and timestamp discipline (UTC; consider build reproducibility knobs). ## In/Out of scope In: assembling builder inputs, packing tar.gz, pushing to registry when configured. Out: signing (external pipeline), scanner behavior. ## Observability & security expectations - Metrics: export.trivy.records, size_bytes, duration, oras.push.success/fail. - Logs: export path, repo/tag, digest; redact credentials; backoff on push errors. ## Tests - Author and review coverage in `../StellaOps.Concelier.Exporter.TrivyDb.Tests`. - Shared fixtures (e.g., `MongoIntegrationFixture`, `ConnectorTestHarness`) live in `../StellaOps.Concelier.Testing`. - Keep fixtures deterministic; match new cases to real-world advisories or regression scenarios. ## Required Reading - `docs/modules/concelier/architecture.md` - `docs/modules/platform/architecture-overview.md` ## Working Agreement - 1. Update task status to `DOING`/`DONE` in both `docs/implplan/SPRINTS.md` and the local `TASKS.md` when you start or finish work. - 2. Review this charter and the Required Reading documents before coding; confirm prerequisites are met. - 3. Keep changes deterministic (stable ordering, timestamps, hashes) and align with offline/air-gap expectations. - 4. Coordinate doc updates, tests, and cross-guild communication whenever contracts or workflows change. - 5. Revert to `TODO` if you pause the task without shipping changes; leave notes in commit/PR descriptions for context.