Build an IG and write its AST

Run one ordinary IG Publisher build through AstPublisher (a subclass that overrides nothing) and write the AST beside output/: one JSON file per resource keyed canonical|version, dependencies.json (upstream’s DependencyAnalyser plus the Library/PlanDefinition/ActivityDefinition/Measure edges it leaves empty), SUSHI’s fsh-index.json, and a manifest that declares itself a cache and records the inputs it is valid for.

Skills it satisfies

A skill states the capability; this Tool is one way to exercise it. Each skill’s declared input and output contract follows, where it has one.

ig-publisher-fork

Requirements for an agent working a local experimental fork of the IG Publisher — which repositories, what the AST must carry, what must not change, and the acceptance criteria. Read before forking, and before reporting a fork’s work complete.

Source: fhir-harness/skills/fhir-ig-base/ig-publisher-fork.md.

Also satisfied by: fhir-cache-seed-npm, fhir-package-mirror, ig-ast-incremental-build, ig-ast-measure-real-igs, ig-ast-plan, smart-fhir-cache-seed.

The skill declares no I/O contract (schemas/skills/ig-publisher-fork/{input,output}.schema.json).

Inputs and outputs

Each port names a shared type by IRI, so two Tools for one skill can be checked for interchangeability.

porttyperequireddescriptionconstraint
inigFilesystemPathyesThe IG root.string · A filesystem path, possibly outside the repository. Not admissible as a command-line argument.
inast-outFilesystemPathDefault <ig>/output-ast, OUTSIDE the Publisher’s output/.string · A filesystem path, possibly outside the repository. Not admissible as a command-line argument.
outresourcesCountResources written, one file each.integer · A non-negative count — how many of something, or how many to show. Zero is a real answer.
outedgesCountDependency edges, including those whose target is outside the IG (kept, resolved: null).integer · A non-negative count — how many of something, or how many to show. Zero is a real answer.

Processes and tasks

Steps this Tool can carry out, because each names a skill it satisfies:

processsteplanevia skill
An IG site, built from the AST on its cache branchBuild the IG with the AST exporterAST refresh (GitHub runner: IG Publisher with the AST exporter)ig-publisher-fork

How it is deployed and reached

  • Command line. From the repository root: java -cp "target/classes:$(cat cp.txt)" org.hl7.fhir.igtools.ast.AstExportCli -ig <ig> [-ast-out <dir>].
  • GitHub Actions. No workflow in this checkout runs its command.

As an API: its operation in the OpenAPI document and the MCP tool list of its layer.

installcli: git clone -b claude/ast-export https://github.com/litlfred/fhir-ig-publisher && cd fhir-ig-publisher/ast-export && mvn -q package && mvn -q dependency:build-classpath -Dmdep.outputFile=cp.txt
runtimejava, maven, sushi, jekyll
networkyes

When a host it reaches is refused:

host / errorremedy
packages.fhir.orgtool fhir-cache-seed-npm
tx.fhir.orgnone: No declared Tool replaces the terminology server. The HL7 IG Publisher’s own -tx n/a skips terminology validation, at the cost of not validating it.
repo1.maven.orgnone: The Maven build needs Maven Central; a populated ~/.m2 from an earlier build is the only other source.
when to choose it
whenProducing a base AST for incremental work, or measuring what an IG’s logic layer depends on.
limitsTaken AFTER the build, so resources carry generated narratives. It is a full Publisher run: it needs the package registry and a terminology server, and an environment without them cannot run it.
costA full IG build: minutes to tens of minutes.

What it is made of

Linked data

The Tool is published as its own JSON-LD document at its IRI, https://litlfred.github.io/folio-assistant/fhir-harness/tools/ig-ast-export.jsonld, partOf its layer’s document. The node below is the definition this page was drawn from, and is embedded in the page as application/ld+json.

{
  "@context": "https://litlfred.github.io/folio-assistant/fhir-harness/fhir-harness.context.jsonld",
  "@id": "https://litlfred.github.io/folio-assistant/fhir-harness/tools/ig-ast-export.jsonld",
  "@type": "https://litlfred.github.io/cat-harness/v0/ns/Tool",
  "partOf": "https://litlfred.github.io/folio-assistant/fhir-harness/fhir-harness.jsonld",
  "name": "ig-ast-export",
  "title": "Build an IG and write its AST",
  "description": "Run one ordinary IG Publisher build through `AstPublisher` (a subclass that overrides nothing) and write the AST beside `output/`: one JSON file per resource keyed `canonical|version`, `dependencies.json` (upstream's DependencyAnalyser plus the Library/PlanDefinition/ActivityDefinition/Measure edges it leaves empty), SUSHI's `fsh-index.json`, and a manifest that declares itself a cache and records the inputs it is valid for.",
  "install": {
    "cli": "git clone -b claude/ast-export https://github.com/litlfred/fhir-ig-publisher && cd fhir-ig-publisher/ast-export && mvn -q package && mvn -q dependency:build-classpath -Dmdep.outputFile=cp.txt"
  },
  "invoke": {
    "shell": "java -cp \"target/classes:$(cat cp.txt)\" org.hl7.fhir.igtools.ast.AstExportCli -ig <ig> [-ast-out <dir>]"
  },
  "io": {
    "inputs": [
      {
        "name": "ig",
        "schema": "https://litlfred.github.io/folio-assistant/cat-harness/tool-types.schema.json#/$defs/FilesystemPath",
        "description": "The IG root.",
        "required": true
      },
      {
        "name": "ast-out",
        "schema": "https://litlfred.github.io/folio-assistant/cat-harness/tool-types.schema.json#/$defs/FilesystemPath",
        "description": "Default `<ig>/output-ast`, OUTSIDE the Publisher's `output/`.",
        "required": false
      }
    ],
    "outputs": [
      {
        "name": "resources",
        "schema": "https://litlfred.github.io/folio-assistant/cat-harness/tool-types.schema.json#/$defs/Count",
        "description": "Resources written, one file each."
      },
      {
        "name": "edges",
        "schema": "https://litlfred.github.io/folio-assistant/cat-harness/tool-types.schema.json#/$defs/Count",
        "description": "Dependency edges, including those whose target is outside the IG (kept, `resolved: null`)."
      }
    ]
  },
  "satisfies": [
    "ig-publisher-fork"
  ],
  "requirements": {
    "runtime": [
      "java",
      "maven",
      "sushi",
      "jekyll"
    ],
    "network": true
  },
  "remedies": [
    {
      "host": "packages.fhir.org",
      "tool": "fhir-cache-seed-npm"
    },
    {
      "host": "tx.fhir.org",
      "none": "No declared Tool replaces the terminology server. The HL7 IG Publisher's own `-tx n/a` skips terminology validation, at the cost of not validating it."
    },
    {
      "host": "repo1.maven.org",
      "none": "The Maven build needs Maven Central; a populated `~/.m2` from an earlier build is the only other source."
    }
  ],
  "selection": {
    "when": "Producing a base AST for incremental work, or measuring what an IG's logic layer depends on.",
    "limits": "Taken AFTER the build, so resources carry generated narratives. It is a full Publisher run: it needs the package registry and a terminology server, and an environment without them cannot run it.",
    "cost": "A full IG build: minutes to tens of minutes."
  }
}

folio-assistant — code under the Apache License 2.0, documentation under CC BY 3.0. Generated schema and API references are rebuilt from source on every push to main.

deployed dev