Skip to content
LexBuild
On this page

Commands

Every LexBuild command follows the {action}-{source} naming pattern. The action describes what to do (download, convert, enrich) and the source identifies the legal dataset.

Command Summary

CommandDescription
download-uscDownload U.S. Code XML from the OLRC
convert-uscConvert U.S. Code XML to Markdown
list-release-pointsList available OLRC release points
download-ecfrDownload eCFR XML from ecfr.gov or govinfo
convert-ecfrConvert eCFR XML to Markdown
download-frDownload Federal Register XML and JSON metadata
convert-frConvert Federal Register XML to Markdown
enrich-frPatch FR Markdown frontmatter with API metadata

Running lexbuild download or lexbuild convert without a source suffix prints an error listing the available source-specific commands.

Common Workflow

Each source follows the same general pattern:

  1. Download the raw XML from the official source
  2. Convert the XML into structured Markdown files
  3. Enrich (FR govinfo bulk only) the converted files with additional API metadata

Title Specification

The --titles flag accepts flexible input for selecting which titles to process. This applies to USC and eCFR commands.

FormatExampleSelects
Single number--titles 1Title 1
Comma-separated--titles 1,5,11Titles 1, 5, and 11
Range--titles 1-5Titles 1 through 5
Mixed--titles 1-5,8,11Titles 1 through 5, plus 8 and 11

Use --all instead of --titles to process every available title.

Shared Options

These flags are available on all convert commands:

FlagDefaultDescription
-o, --output <dir>./outputOutput directory for converted Markdown
-g, --granularity <level>sectionOutput granularity (varies by source)
--link-style <style>plaintextCross-reference link style: plaintext, relative, or canonical
--dry-runoffParse and report statistics without writing files
-v, --verboseoffPrint detailed output including file paths
--include-notes / --no-include-notesonInclude or exclude all notes
--include-editorial-notesoffInclude only editorial notes
--include-statutory-notesoffInclude only statutory notes
--include-amendmentsoffInclude only amendment history

[!NOTE] Setting any selective note flag (--include-editorial-notes, --include-statutory-notes, --include-amendments) automatically disables the broad --include-notes flag.

Full Pipeline Examples

U.S. Code

# Download all 54 titles
lexbuild download-usc --all

# Convert all titles to Markdown
lexbuild convert-usc --all

eCFR

# Download all 50 titles from the eCFR API
lexbuild download-ecfr --all

# Convert all titles to Markdown
lexbuild convert-ecfr --all

Federal Register

# Download the last 30 days of FR documents (XML + JSON from FR API)
lexbuild download-fr --recent 30

# Convert all downloaded documents (JSON sidecar used automatically for rich frontmatter)
lexbuild convert-fr --all

[!NOTE] The enrich-fr step is only needed when using --source govinfo (bulk XML without JSON metadata). The default fr-api source downloads both XML and JSON, so the converter produces rich frontmatter automatically.

Update Scripts

For routine updates, wrapper scripts handle the full pipeline (detect changes, download, convert, generate artifacts, deploy):

./scripts/update.sh                      # All sources
./scripts/update.sh --source ecfr        # One source
./scripts/update-ecfr.sh --skip-deploy   # eCFR, local only
./scripts/update-fr.sh --days 3          # FR, last 3 days
./scripts/update-usc.sh                  # USC, checks release point

Each script auto-detects what changed and only processes updates. See Incremental Updates for details.

Getting Help

Every command supports --help for a full description of its options and usage examples:

lexbuild convert-usc --help
lexbuild download-ecfr --help

For complete flag tables and option details, see the CLI Reference.