Skip to content

Manifests and tabular data

A manifest describes several model inputs and generated outputs. It reuses Nexus Script for that description; it does not create another composition or reference language.

Generate two files from one catalog

Use Catalog.nxscript and Catalog.mustache from Artifacts. Add a second template:

Summary.mustache
Catalog: {{Shop.Title}}
Featured range:
{{#_nx.Collections.Product}}- {{_nx.Name}}
{{/_nx.Collections.Product}}

Create the manifest:

Publish.NexusManifest.nxscript
dialect "NexusManifest/NexusManifest.Language.nxscript";

NexusManifest Publish {
    Model Catalog { Source: "Catalog.nxscript"; }
    Template PriceList {
        Source: "Catalog.mustache";
        Output: "prices.txt";
    }
    Template Summary {
        Source: "Summary.mustache";
        Output: "summary.txt";
    }
}

Run it with the installation's dialect catalog as the fallback location:

NexusScript /manifest=Publish.NexusManifest.nxscript /output=generated /dialect-root="<Nexus installation>/scripts/packages/nexus-packages/nxscript/language"

Replace <Nexus installation> with the actual installation directory. The output directory contains prices.txt and summary.txt. From a Nexus source checkout, the dialect catalog is packages/nexus-packages/nxscript/language.

Context and ordering

Model paths and template source paths resolve from the manifest. Template output paths resolve beneath /output. References and text composition in those properties use ordinary Nexus Script; they are not Mustache expressions.

Each model compiles with its own imports, includes, dialect, and scope. Their artifact roots combine into one JSON context, so root names must be unique. The manifest does not prefix roots with Model entry names or merge same-named roots. A shared included file contributes once. Listing the same model source twice directly is an error.

The manifest is validated. /validate additionally applies each model's declared dialect. Models compile and the combined JSON is prepared before templates render in declaration order. Processing stops at failure; files already generated by earlier templates remain.

External tabular data

A model can declare an external table as a dependency. Add the following data declaration to the header of Catalog.nxscript, before its Catalog definition:

data Shipping "shipping.csv";

Save the data:

shipping.csv
REGION,PRICE_CENTS
US,300
EU,500

This dependency is collected separately from the catalog's definitions. It is not a new root, a module, or a value addressable as @Shipping.

Create a template for one source table:

Shipping.mustache
Source: {{DataSource._nx.Name}}
{{#DataSource.Records}}
{{#.}}[{{.}}]{{/.}}
{{/DataSource.Records}}

Add this fragment inside the manifest's NexusManifest definition:

SourceTemplate ShippingData {
    Types: [csv, jcsv];
    Compiler: CommaDelimited;
    Source: "Shipping.mustache";
    OutputDirectory: "tables";
    OutputExtension: ".txt";
}

Run the manifest again. It also produces generated/tables/shipping.txt. The table template receives a DataSource object with _nx identity metadata, an ordered Fields array, and Records containing positional row arrays. Its context is separate from the combined catalog JSON.

Every declared data source must match one source-template rule. CommaDelimited handles csv/jcsv; TabDelimited handles tsv/tab. Sources are collected from models, modules, and includes, not from dialect documents. Malformed rows, duplicate/blank headers, output collisions, and unsafe output paths produce errors rather than partial interpretations of the input.

Continue with Practical applications or consult the CLI reference.