Skip to content

Support multiple base catalogs in builder #2

@rsnodgrass

Description

@rsnodgrass

Summary

The Build() function and CLI --catalog flag currently accept a single CatalogData as the base. Users with multiple catalogs (hand-crafted + team-shared + previous build) must manually merge them before building.

Proposed Changes

  • Library: Add MergeCatalogs(catalogs ...CatalogData) CatalogData that deduplicates by pattern (lower-cased), keeping the entry with highest confidence when duplicates exist. Last-writer-wins for version string.
  • CLI: Change --catalog to accept multiple values (cobra StringSliceVar), load each, merge, then pass to Build().
  • Build() signature stays the same — callers that want multi-catalog support call MergeCatalogs() first. No breaking change.

Example Usage

frictionax catalog build \
  --catalog hand-crafted.json \
  --catalog team-shared.json \
  --server https://api.sageox.ai/v1/agentx/myapp/friction/patterns \
  --output catalog.json

Why

AgentX users will have hand-crafted catalogs they want to preserve when building from SageOx telemetry patterns. Forcing manual pre-merge adds friction to the catalog building workflow.

Current Behavior

  • --catalog accepts one file (default: default_catalog.json)
  • Build() takes one CatalogData as existing
  • Deduplication works against that single base
  • Hand-crafted entries are preserved in the output

Merge Strategy

When the same pattern (case-insensitive) appears in multiple catalogs:

  1. Keep the entry with highest confidence
  2. If equal, prefer the entry with a non-empty target
  3. Tokens: deduplicate by pattern + kind key

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions