Expand description
Shared infrastructure for the GitHub-native text formats:
--format github-annotations (workflow commands on stdout) and
--format github-summary (step-summary markdown).
The escaping contract is byte-compatible with the strict typed fallback in
action/scripts/annotate.sh, NOT the legacy jq san helper: message
bodies escape % to %25, CR to %0D, and LF to %0A; property values
(file=, title=) additionally escape , to %2C and : to %3A.
Non-ASCII text passes through as UTF-8. Line numbers below 1 clamp to 1,
and fallow’s 0-based columns convert to GitHub’s 1-based workflow-command
columns at this boundary.
Structs§
- Annotation
- One GitHub workflow-command annotation, pre-escaping.
messageholds real newlines;render_annotationapplies the escaping contract. - Render
Options - Ambient options for the GitHub renderers, resolved once per render at the CLI print boundary so the pure render functions stay deterministic.
Enums§
- Annotation
Level - Annotation severity, ordered most-severe-first so a plain sort puts errors ahead of warnings ahead of notices (GitHub shows at most 10 annotations per type per step; the worst findings must sort into view).
- Package
Manager - Package manager for fix-command hints, mirroring the jq layer’s
PKG_MANAGERparameterization plus native lockfile sniffing (bun is new relative to the jq layer). - Path
Rebase - How report paths are rebased onto the git repository root. CI platforms
address files by repo-root-relative path (GitHub annotations, GitLab’s
Code Quality widget, the review-discussion APIs), while fallow emits
analysis-root-relative paths; when the analysis root is a subdirectory
(e.g.
packages/app/), every path needs the offset prefixed.
Functions§
- arr
- Iterate an optional array field (
.[key][]?in jq terms). - b
- Boolean field, or
falsewhen missing. - budget_
notice - The trailing total notice: always emitted after the annotation stream when
at least one annotation exists, so consumers know when GitHub’s 10-per-type
display cap truncated the visible set. There is deliberately no
producer-side cap (the bundled action keeps its own
MAX_ANNOTATIONSduring migration). - clamp_
line - Clamp a line number below 1 to 1: GitHub rejects
line=0, and the typed annotation fallback inannotate.shapplies the same floor. - escape_
message - Escape a workflow-command message body:
%to%25, CR to%0D, LF to%0A. The%escape runs first so already-escaped input escapes again (matching the jqeschelper’sgsuborder). - escape_
property - Escape a workflow-command property value (
file=,title=): message escaping plus,to%2Cand:to%3A, because commas separate properties and colons terminate the command prefix. - fmt_num
- Format a JSON number the way jq interpolates it: integers without a decimal point, floats in shortest round-trip form.
- init_
report_ prefix - Resolve the presentation prefix once, after
--report-path-prefixis recorded. Call at most once. - num
- Format a numeric field, or
"0"when missing. - one_
based_ col - Convert fallow’s 0-based column to GitHub’s 1-based workflow-command
column (the jq layer’s
col + 1convention). - render_
annotation - Render one annotation as a workflow-command line. Property order matches
the jq layer:
file,line,endLine,col,title. - report_
prefix - The prefix prepended to every CI-facing path emitted this run. Empty when the analysis root is the repository root, or when no CLI run resolved it.
- report_
rebase - Rebase every CI-facing report path emitted for this run onto the repo root.
- resolve_
package_ manager - Resolve the package manager: an explicit
PKG_MANAGERenv value wins (action parity; unrecognized values fall back to npm exactly like the jqelsebranch), otherwise lockfile sniffing at the analysis root. - resolve_
render_ options - Resolve render options from the process environment and the analysis root.
- s
- String field, or
""when missing or not a string. - set_
report_ path_ prefix - Record the
--report-path-prefixflag value. Call at most once. - sort_
annotations - Sort annotations most-severe-first, then by path, then by line. Default result ordering is path-sorted (ADR-004), so without this sort GitHub’s visible 10 per type would be the lexicographically first paths, not the worst findings.
- u
- Unsigned number field, or 0 when missing.