Macro Registry

Topic: macro_registry

Explanation

An external ProtoML macro registry can be hosted as a simple static JSON file.

This kind of registry is a package index for external macros and pack metadata. It is not the same thing as protoparser register "<dir>" ..., which reports on document collections.

A registry may be used in three ways:

This makes decentralized registries possible:

Recommended minimal registry structure:

{
  "version": 1,
  "authors": [
    {
      "name": "Alice",
      "trust": "trusted",
      "keys": [
        {
          "id": "alice-main",
          "public_key": "-----BEGIN PUBLIC KEY-----\n...\n-----END PUBLIC KEY-----"
        }
      ]
    }
  ],
  "packages": [
    {
      "name": "legal-pack",
      "version": "1.2.0",
      "description": "Contract and signature macros",
      "author": "Alice",
      "trust": "trusted",
      "manifest": "packs/legal-pack/protoml-pack.json",
      "source": "packs/legal-pack"
    }
  ]
}

Recommended macro pack structure:

legal-pack/
  manifest.json
  macros/
    clause_box.pml
    signature_panel.pml
  themes/
    legal.css
  README.md

Recommended pack manifest:

{
  "name": "legal-pack",
  "version": "1.2.0",
  "author": "Example Org",
  "trust": "unknown",
  "description": "Contract and signature helpers",
  "macros": [
    "macros/clause_box.pml",
    "macros/signature_panel.pml"
  ],
  "themes": [
    "themes/legal.css"
  ],
  "keywords": ["legal", "contracts", "signatures"],
  "protoml": ">=1.3.0"
}

Recommended project definition file:

{
  "version": 1,
  "registries": [
    "https://example.org/protoml/registry.json"
  ],
  "packages": [
    {
      "name": "legal-pack",
      "version": "1.2.0"
    }
  ]
}

Recommended local install target:

.protoml/macro-packs/

That keeps the repository clean while still making the project reproducible through a single definition file.

Macro pack dependencies can be declared in protoml-pack.json. During protoparser macro_install sync, dependencies are resolved automatically. If a dependency entry omits a registry, the current registry is assumed.

Trust guidance:

Remote registry workflow:

Admin side:

User side:

Local company registry workflow:

Admin side:

User side:

Current local workflow:

Recommended trust-aware workflow:

1. Use bundled {{macro_dir}} macros first when the shipped set already covers the need. 2. Create a custom pack only when you need behavior or presentation that is not already covered. 3. Sign the custom macro files in the pack before treating them as production-ready. 4. Publish the signing authors in the registry authors list. 5. Install the pack in the project and verify it with trust, verify, or validate -trust=.... 6. Treat JavaScript and external URLs as explicit review points, even for registry-delivered macros.

Split-registry workflow:

1. keep package delivery in one registry if that fits your release process 2. keep trusted authors in a separate reviewed registry if that fits your security process 3. add both registries where needed 4. keep every relevant registry in the nearest project protoml.macros.json, or repeat -trustRegistry=... for ad hoc trust-oriented commands 5. expect install/search to care about packages, and trust/verify/validate to care about authors

How to choose between built-ins and registries:

Complete signed registry flow:

1. create the registry and the pack 2. create or edit the macro file inside the pack 3. sign the macro file with protoparser sign macro ... 4. add the signing author's public key to the registry authors list 5. add the pack to the registry index 6. consume the registry from a project 7. verify the macro or the full document through project auto-discovery or with explicit -trustRegistry=...

Detached sidecar workflow outside a registry:

Author side:

User side:

Examples

End-to-end signed macro registry example:

protoparser macro_install init_registry "./my-registry"
protoparser macro_install init_pack "legal-pack" "./my-registry"

Edit:
"./my-registry/packs/legal-pack/macros/legal_pack_sample.pml"

Sign the macro:
protoparser sign macro "./my-registry/packs/legal-pack/macros/legal_pack_sample.pml" "./keys/alice-private.pem" "Alice" alice-main

Add author key to `./my-registry/protoml.registry.json`:

{
  "version": 1,
  "name": "my-registry",
  "authors": [
    {
      "name": "Alice",
      "trust": "trusted",
      "keys": [
        {
          "id": "alice-main",
          "public_key": "-----BEGIN PUBLIC KEY-----\n...\n-----END PUBLIC KEY-----"
        }
      ]
    }
  ],
  "packages": []
}

protoparser macro_install registry_add "./my-registry" "./my-registry/packs/legal-pack"
protoparser macro_install add_registry "./my-registry"
protoparser macro_install add_package "legal-pack" 1.0.0
protoparser macro_install sync

Use in a meeting:

@macros_import ".protoml/macro-packs/macros.index.pml"
@meeting "Minutes"
@@macro=legal_pack_sample:title=Hello;text=Signed macro

Verify against the registry:
protoparser trust "./project/Meeting.pml"
protoparser trust "Meeting.pml" -trustRegistry="./my-registry"
protoparser verify macro "./my-registry/packs/legal-pack/macros/legal_pack_sample.pml" -trustRegistry="./my-registry"

Split registry example:
protoparser verify pml "./meetings/board.pml" -trustRegistry="./authors-registry" -trustRegistry="./macro-registry"

Company registry examples:
protoparser macro_install add_registry "https://intra.example.local/protoml/protoml.registry.json"
protoparser macro_install add_registry "Z:\\protoml-registry"
protoparser validate "./governance/release-checklist.pml" -trust=strict -trustRegistry="https://intra.example.local/protoml/protoml.registry.json"
protoparser validate "./governance/release-checklist.pml" -trust=strict -trustRegistry="Z:\\protoml-registry"