@anduin/pangea
v0.7.1
Published
Parser for Blueprint that outputs the Blueprint Intermediate Represenation
Readme
PANGEA - Blueprint Intermediate Representation toolchain
This project can be run by both Bun and Node.js, however, the test suite for this project is written to run with Bun Test.
Installation
npm install @anduin/pangea
# or
bun add @anduin/pangeaUsage
const pangea = require('@anduin/pangea')
const rawRule =
`\`\`\`catala
scope Individual_Part_I:
definition for_subscription_documents__fn_disable_and_clear_data equals
fn_has_option_values of gatingbox,
[gatingbox_options.check_this_box_if_you_would_li]
\`\`\``
const result = await pangea.parseBIRFromCatalaEn(rawRule)
console.log(result)Documentation
For detail design of Intermediate Representation, see the documentation at: Notion

Package Development
Setup
bun install
bun run init # inlines committed wasm files into src/*-wasm-uint8array.tsNote: the tree-sitter-catala git submodule is only required if you need to regenerate the grammar WASM (see below). For normal development you don't need to initialize it — the pre-built .wasm is committed at scripts/tree-sitter-catala_en.wasm.
Develop
bun run devTest
bun testBuild
bun run buildOutputs compiled JS + .d.ts to dist/.
Maintainer Guide
Publish a new version to npm
- Bump
versioninpackage.json. - Commit and push.
- Trigger the Publish NPM workflow in GitHub Actions (
workflow_dispatch).
Publishing uses npm Trusted Publishers via OIDC — no npm token secret is involved. The workflow runs bun install, bun test, bun run build, then npm publish --provenance from the repo root. Only files matching the files field (dist/) are shipped.
Regenerate the tree-sitter-catala grammar WASM
Only needed when the upstream CatalaLang/tree-sitter-catala grammar changes.
Requires the tree-sitter CLI (installed on demand via bunx; if the download fails, install globally with npm i -g tree-sitter-cli).
bun run rebuild:grammarWhat it does:
- Initializes the
src/tree-sitter-catalasubmodule if missing. - Runs
tree-sitter generateandtree-sitter build --wasminsidesrc/tree-sitter-catala/en. - Copies the resulting
.wasmtoscripts/tree-sitter-catala_en.wasm. - Runs
bun run initto base64-inline both that file andweb-tree-sitter.wasmintosrc/*-wasm-uint8array.ts.
After it completes, run bun run build && bun test, then commit:
scripts/tree-sitter-catala_en.wasmsrc/tree-sitter-catala_en-wasm-uint8array.ts
Model generation
If generating models for other languages is needed, consider using quicktype.
