# mvdan/sh

A shell parser, formatter, and interpreter with bash and zsh support; includes shfmt

Repository: https://github.com/mvdan/sh
Canonical: https://ross.abutalabs.com/products/sh
Homepage: https://pkg.go.dev/mvdan.cc/sh/v3
Language: Go
License: BSD-3-Clause
License Family: permissive
Topics: go, parser, shell, bash, formatter, posix, mksh, interpreter, beautify, shfmt, zsh
Last push: 2026-08-23T23:27:47+00:00

## Health v2 (maintenance only)
Score: 83/100 (v2, computed 2026-09-03T02:20:16.233290+00:00)
- activity 99, release rhythm 54, longevity 100
- inputs: {"age_days": 3882, "days_push": 10, "days_rel": 149, "gap_med": 129.0, "n_releases_24m": 5}
- flags: none
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 9009, forks 446 (observed 2026-08-28T04:10:26.766921+00:00)

## What it is
A Go library and CLI tool (shfmt) that parses, formats, and interprets shell scripts supporting POSIX Shell, Bash, Zsh, and mksh. It exposes packages for syntax parsing, shell expansions, and script interpretation, plus a standalone formatter binary.

## Use cases
- format shell scripts consistently
- parse bash scripts into an AST in Go
- run shell scripts from a Go program
- check shell script syntax in CI
- beautify and normalize bash code style
- evaluate shell expansions on strings

## When to choose
- you need programmatic parsing or analysis of shell scripts in Go
- you want a deterministic formatter for bash/POSIX scripts
- you need to execute shell scripts embedded in Go applications

## When to avoid
- you need a fully POSIX/Bash-faithful interpreter with process forking semantics
- you need zsh-specific advanced features beyond parsing
- you just want shell linting with shellcheck-style checks

## Facets
- artifact type: library
- maturity: active
- function: parser, formatter, interpreter, cli, linter
- domain: developer-tools, parsers
- platform: go, windows, cross-platform, cli
- tags: shell, bash, zsh, posix, mksh, shfmt, code-formatting, static-analysis, command-line, automation, linux, macos

## Member repositories
- mvdan/sh (main) score 83

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:10:26.766921+00:00.
- Health v2: computed from the inputs above; adoption is never an input.
- Inferred fields (summary, facets, guidance): AI-extracted, prompt v1, taxonomy v1, on 2026-08-29T17:24:21.048616+00:00, confidence not recorded.
  - readme: https://github.com/mvdan/sh (fetched 2026-08-28T04:10:26.766921+00:00, sha cc5ae13e4856)
  - homepage: https://pkg.go.dev/mvdan.cc/sh/v3 (fetched 2026-08-29T08:24:16.619813+00:00, sha e2bc5b5435bf)
  - site_page: https://pkg.go.dev/about (fetched 2026-08-29T08:24:16.622560+00:00, sha 757852027879)
  - site_page: https://go.dev/project (fetched 2026-08-29T08:24:16.624476+00:00, sha d5ca00bb378b)
- Data as of 2026-08-30T08:39:29.467469+00:00.
