FHIR AST cache
Restore, verify, seed and diagnose the prebuilt AST artefacts for an IG. Always try restore first: a full AST build via AstExportCli is expensive, a restore is fast. seed commits the IG API a layer above generates from the AST (ig-site:sidecars, via ig-api-cache.ts) as ig-api/ beside it, and the artefact index built from that tree (ig-index-cache.ts) as fhir-artifact-index/index.json, so a site reads both by raw URL at the cache commit.
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.
compiled-artefact-cache
The general pattern for caching expensive compiled artefacts (Lean .oleans, FHIR ASTs) across builds. Defines branch-based storage, validity checking, exit code protocol, safety guards, and the restore→build→contribute loop.
Source: cat-harness/skills/process/process-core/compiled-artefact-cache.md.
Also satisfied by: ig-ast-refresh.
The skill declares no I/O contract (schemas/skills/compiled-artefact-cache/{input,output}.schema.json).
ig-ast-delta
List and view what changed between two IG ASTs, check whether an AST is still valid for the IG’s current inputs, and render the delta as just-the-docs pages that carry the provisional mark. Read before trusting a cached AST, before reviewing an incremental IG build, and before rendering anything from a cache.
Source: fhir-harness/skills/fhir-ig-base/ig-ast-delta.md.
Also satisfied by: ig-ast-diff, ig-ast-jsonld, ig-ast-list, ig-ast-pages, ig-ast-plan, ig-ast-render, ig-ast-validity.
The skill declares no I/O contract (schemas/skills/ig-ast-delta/{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.
| port | type | required | description | constraint | |
|---|---|---|---|---|---|
| in | action | IgCacheAction | yes | The verb. doctor diagnoses a restore that missed. | string · one of status, restore, seed, contribute, verify, list, doctor · An ig-cache verb: restore AST, seed it, or diagnose. |
| in | igRoot | RepoPath | The IG whose AST is acted on. | string · pattern ^[A-Za-z0-9._][A-Za-z0-9._/-]*$ · A path relative to the repository root. No .. segments. | |
| in | package | PackageName | string · pattern ^[a-z][a-z0-9-]*$ · A skill package, e.g. folio-core | ||
| in | remote | PackageName | Git remote to fetch from / push to. Default ‘origin’. Use when the IG’s origin is upstream and the cache lives on a fork. | string · pattern ^[a-z][a-z0-9-]*$ · A skill package, e.g. folio-core | |
| out | result | Text | A real hit, a miss, or a diagnosis — never a miss that reads as a hit. | string · A short single-line human string. Not admissible as a command-line argument. |
Processes and tasks
Steps this Tool can carry out, because each names a skill it satisfies:
| process | step | lane | via skill |
|---|---|---|---|
| The cache process: restore and save every cache a run can use | Lean .oleans: restore / save | Build pipeline | compiled-artefact-cache |
| Is the incremental IG AST what a full build would have produced? | Check the base AST against the inputs | Incremental build (system) | ig-ast-delta |
| Is the incremental IG AST what a full build would have produced? | Diff the two ASTs | Incremental build (system) | ig-ast-delta |
| Is the incremental IG AST what a full build would have produced? | Read the delta | QC reviewer | ig-ast-delta |
| An IG site, built from the AST on its cache branch | Restore and judge the cached AST | Site build (agent, stage-local) | ig-ast-delta |
| An IG site, built from the AST on its cache branch | Seed the cache branch | AST refresh (GitHub runner: IG Publisher with the AST exporter) | compiled-artefact-cache |
| SMART Guideline end to end | Review each L3 asset (before / after if adapted) | Human adjudicators | ig-ast-delta |
How it is deployed and reached
- Command line. From the repository root:
fhir-harness/scripts/ig-cache.sh. - GitHub Actions. 4 workflow line(s) run its command:
| workflow | line | |
|---|---|---|
fhir-harness/.github/workflows/ig-ast-refresh.yml | 162 | [ -f fhir-harness/scripts/ig-cache.sh ] \|\| { echo "::error::the lock mounts no fhir-harness"; exit 2; } |
fhir-harness/.github/workflows/ig-ast-refresh.yml | 172 | if bash fhir-harness/scripts/ig-cache.sh restore --ig-root .; then |
fhir-harness/.github/workflows/ig-ast-refresh.yml | 552 | bash fhir-harness/scripts/ig-cache.sh seed --ig-root . --push |
fhir-harness/.github/workflows/ig-release.yml | 107 | [ -f fhir-harness/scripts/ig-cache.sh ] \|\| { echo "::error::the lock mounts no fhir-harness"; exit 2; } |
As an API: its operation in the OpenAPI document and the MCP tool list of its layer.
| install | none |
| runtime | bash, git |
| network | yes |
When a host it reaches is refused:
| host / error | remedy |
|---|---|
packages.fhir.org | tool fhir-cache-seed-npm |
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. |
What it is made of
| role | file | |
|---|---|---|
| definition | fhir-harness/tools/ig-cache/ig-cache.ts | |
| script | fhir-harness/scripts/ig-cache.sh |
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-cache.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-cache.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-cache",
"title": "FHIR AST cache",
"description": "Restore, verify, seed and diagnose the prebuilt AST artefacts for an IG. Always try `restore` first: a full AST build via AstExportCli is expensive, a restore is fast. `seed` commits the IG API a layer above generates from the AST (`ig-site:sidecars`, via `ig-api-cache.ts`) as `ig-api/` beside it, and the artefact index built from that tree (`ig-index-cache.ts`) as `fhir-artifact-index/index.json`, so a site reads both by raw URL at the cache commit.",
"install": {
"none": true
},
"invoke": {
"shell": "fhir-harness/scripts/ig-cache.sh"
},
"io": {
"inputs": [
{
"name": "action",
"schema": "https://litlfred.github.io/folio-assistant/cat-harness/tool-types.schema.json#/$defs/IgCacheAction",
"description": "The verb. `doctor` diagnoses a restore that missed.",
"required": true,
"arg": {
"positional": 0
}
},
{
"name": "igRoot",
"schema": "https://litlfred.github.io/folio-assistant/cat-harness/tool-types.schema.json#/$defs/RepoPath",
"description": "The IG whose AST is acted on.",
"required": false,
"arg": {
"flag": "--ig-root"
}
},
{
"name": "package",
"schema": "https://litlfred.github.io/folio-assistant/cat-harness/tool-types.schema.json#/$defs/PackageName",
"required": false,
"arg": {
"flag": "--package"
}
},
{
"name": "remote",
"schema": "https://litlfred.github.io/folio-assistant/cat-harness/tool-types.schema.json#/$defs/PackageName",
"description": "Git remote to fetch from / push to. Default 'origin'. Use when the IG's origin is upstream and the cache lives on a fork.",
"required": false,
"arg": {
"flag": "--remote"
}
}
],
"outputs": [
{
"name": "result",
"schema": "https://litlfred.github.io/folio-assistant/cat-harness/tool-types.schema.json#/$defs/Text",
"description": "A real hit, a miss, or a diagnosis — never a miss that reads as a hit."
}
]
},
"satisfies": [
"compiled-artefact-cache",
"ig-ast-delta"
],
"requirements": {
"runtime": [
"bash",
"git"
],
"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."
}
]
}