Fuse
Reference

Reducers

The per-type content reducers that shrink each file by its format, resolved by file extension.

A reducer compacts text according to file type. The output is context, not rewritten source: Fuse does not guarantee that reduced text compiles, parses, preserves behavior, or retains every private implementation detail. Format reducers handle web and configuration files; the C# reducer handles .cs.

This page is for engineers who want to know exactly which transforms run on a given file type and maintainers reasoning about token output.

Purpose and Scope

Each reducer declares the extensions it handles. When the Reduction stage processes a file, it looks up the reducer registered for that file's extension and applies it. A file whose extension has no registered reducer passes through with whitespace normalization only.

This page documents the transforms each reducer performs and the options that turn them on or off. It does not cover skeleton extraction or secret redaction, which are separate Reduction-stage steps described in Core Concepts.

Format Reducers

The format reducers handle web and configuration file types. Each strips comments and collapses whitespace in a way appropriate to its syntax. Minification is on by default for these file types when they appear in scoped context output.

ReducerExtensionsTransforms
CssReducer.cssRemoves block comments; collapses newlines; removes spaces around { } : ; ,; collapses multiple spaces.
HtmlReducer.html .htmRemoves HTML comments; collapses whitespace between tags; removes quotes from safe attribute values; collapses spaces.
JavaScriptReducer.js .ts .tsx .jsx .mjs .cjs .mts .ctsRemoves line and block comments; collapses double newlines; trims line whitespace; collapses spaces around delimiters. Covers TypeScript and JSX/TSX and ESM variants alongside plain JavaScript.
JsonReducer.jsonRemoves newlines; collapses whitespace around : and ,; removes spaces after [ and { and before ] and }.
MarkdownReducer.mdRemoves HTML comments; converts underline headings to ATX form; removes horizontal rules; normalizes pipe spacing and link titles; collapses excess newlines.
RazorReducer.razor .cshtmlRemoves HTML, block, line, and Razor comments; collapses tag whitespace; normalizes @() syntax; collapses spaces.
ScssReducer.scssRemoves line and block comments; collapses newlines; removes spaces around { } : ; ,; collapses spaces.
SqlReducer.sqlRemoves line and block comments; collapses blank lines.
XmlReducer.xml .csproj .targets .propsRemoves XML comments; collapses tag whitespace; normalizes the declaration; removes interior newlines; collapses spaces.
YamlReducer.yaml .ymlRemoves comment lines; removes trailing whitespace; collapses three or more newlines to two.

C# Reducer

The C# reducer handles .cs files. fuse reduce --level selects its reduction level. fuse context and fuse review assign a render tier per file and map that tier to a level internally.

The standard removals run together at --level standard (and at the levels above it):

RemovalRemoves
CommentsLine and block comments, preserving string-literal contents
Preprocessor and region directives#region and #endregion markers, and other preprocessor directives
Using statementsusing directives and using aliases
Namespace wrappersFile-scoped and block namespace declarations, and the indentation a block namespace adds

Aggressive mode, selected with --level aggressive, runs the standard removals and then applies a second tier:

  • Removes noise attributes such as DebuggerDisplay, MethodImpl, ExcludeFromCodeCoverage, and the assembly-info attributes.
  • Removes assembly-level SuppressMessage attributes.
  • Removes the this. prefix on member access.
  • Rewrites auto-properties to compact form, for example { get; set; } becomes {get;set;}.
  • Collapses whitespace around delimiters such as { } ; , : ( ) = [ ], while preserving the contents of string literals through placeholder substitution so literal text is never altered.

String and character literals, including raw and interpolated raw strings, are masked before comment and whitespace transforms and then restored. This prevents comment markers inside literals from being parsed as comments. The later secret-redaction pass can still replace a detected credential inside a literal.

No reduction level promises compilable output. aggressive applies both standard and aggressive transforms. skeleton removes bodies and keeps structural signatures; publicApi further limits output to public and protected structure. A positive token ceiling can truncate the final reduced result, so it does not guarantee that every declaration remains.

What This Does Not Cover

This page documents what each reducer does, not how to write a new one. The Adding A Format Reducer page covers registering a reducer for a new extension. For guidance on which combination of flags to use for a given goal, see the Reducing Tokens guide.

Next

See the Options reference for the full flag set, or the Reducing Tokens guide for the reduction levels in practice.

On this page