Skip to main content

@ossl-dev/differens-tiers

The parsing pipeline. A content router picks a tier by file extension and magic bytes. The tier adapter parses the file into a Node tree for @ossl-dev/differens-core. If a tier fails to parse, or its diff falls back, the pipeline drops to the next lower tier. Raw line diff is the floor. Install:

Tiers

Exports

classifyFile

Extension-based routing, with a binary sniff (NUL bytes or failed UTF-8 decode) on top. Markdown goes to Tier.Raw, not prose. Lines are structure in docs.

diffWithTier

Behavior worth knowing:
  • Entirely new or removed files become a single Insert/Delete of a kind: "file" node. That is one fact, not a tree diff.
  • Identical sources short-circuit with no changes.
  • A tier result is kept only if it parses and produces a usable tree diff; the core’s fallback verdict propagates instead of being reported as “no changes”.
  • On any failure the pipeline falls back to raw lines, with fallback: "lines".

LanguageExtractor

Each code language is a LanguageExtractor: a few dozen match arms that map tree-sitter CST node types to canonical concepts. It is not a parser.
getExtractors() reports them as ExtractorInfo { language, level: "L6" | "L5", extensions }, where L6 extractors have semantic mappings and L5 are generic.

Usage