Registry / security / firetree

firetree

JSON →
library0.1.5jsnpmunverified

AST parser and generator for Firebase Firestore and Storage security rules. Current stable version is 0.1.5, with irregular releases. Unlike general-purpose parsers, Firetree is purpose-built for Firebase security rules, supporting both parsing rules into an AST and generating rules from an AST. It provides a library interface for programmatic use and a CLI binary.

npm install firetree
INSTALL
IMPORT
SIG · FIRETREE
F
firetree
securityjavascriptv0.1.5
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

generate
import { generate } from 'firetree'
const firetree = require('firetree'); const generate = firetree.generate
Package is ESM-only.
parse
import { parse } from 'firetree'
Required context must be set up before parsing.
setupContext
import { setupContext } from 'firetree'
Context setup is required before parsing or generating.

Parses a Firestore rules file into an AST and then generates rules from that AST.

import { generate, parse, setupContext } from 'firetree'; import { readFile, writeFile } from 'fs/promises'; import { join } from 'path'; const context = setupContext(); const rulesContent = await readFile(join(process.cwd(), 'firestore.rules'), 'utf-8'); const ast = await parse(context, { content: rulesContent }); const generated = await generate(context, { ast }); await writeFile('generated.rules', generated);
Debug
Known issues
gotchaPackage version 0.1.5 is pre-1.0.0, API may change without major version bump.
fix
Pin to exact version and regularly check for breaking changes.
affects: >=0.0.0
gotchaparse() requires a context from setupContext(), which is not optional.
fix
Always call setupContext() before parse or generate.
affects: >=0.0.0
breakingparse() expects filePath or content; omitting both causes an error.
fix
Provide either a filePath or content string in the options object.
affects: >=0.1.0
deprecatedThe binary installation instruction uses 'npm install -g firemin', which seems to be a typo and should be 'firetree'.
fix
Use 'npm install -g firetree' instead.
affects: >=0.1.0
Errors
Common errors & fixes
TypeError: Cannot destructure property 'filePath' of 'undefined' as it is undefined.
parse() called without options or with empty object.
fix
Pass an options object with either filePath or content property.
Error: No file specified
CLI parse or generate command used without -f flag.
fix
Use 'firetree parse -f <file>' or 'firetree generate -f <file>'
Upgrade
Version history
0.1.5latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
19 hits · last 30 days
node
16
Amazon
1
OpenAI (training)
1
Resources
firetree — npm install firetree · libregistry