mvdan/sh

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

View on GitHub ↗Jump to charts ↓Open shareable report →

Data as of . Signed-in members get hourly updates — create a free account.

Summary Information

Updated 1 hour ago
Added to GitGenius on September 7th, 2026
Created on January 16th, 2016
Open Issues & Pull Requests: 84 (+0)
GitHub issues: Enabled
Number of forks: 455
Total Stargazers: 9,121 (+0)
Total Subscribers: 62 (+0)

Repository Insights (GitGenius)

Median issue/PR response: 29.8 hours
Mean response time: 31.4 days
90th percentile: 58.3 days
Tracked items: 256

Maintainer activity

2 people did triage or write work on this repository in the last 12 months.

Counts unlabeled, assigned, unassigned, milestoned, demilestoned, locked, unlocked over the last 12 months. These are issue and pull request events that require triage or write permission. Commits and code review are not counted. labeled and renamed are excluded because GitHub issue forms record the issue author as the actor. Figures from October 11, 2026. This count is not comparable across projects: each project's automation decides which of these events a person emits.

How this project is maintained

About 5% of issues opened in the past year have never received a reply. 89% of open issues come from outside the core team, so the backlog reflects real-world use rather than internal planning. 88% of issues opened in the past year have been closed, leaving a working backlog. Three people close 94% of everything that gets resolved.

Charts & Analytics

Fetching additional details & charts...

Issue Activity (beta)

Open issues: 36
New in 7 days: 0
Closed in 7 days: 0
Avg open age: 624 days
Stale 30+ days: 33
Stale 90+ days: 21

Recent activity

Opened in 7 days: 0
Closed in 7 days: 0
Comments in 7 days: 0
Events in 7 days: 0

Top labels

  • zsh (50)
  • needs info (10)
  • help wanted (6)
  • enhancement (5)
  • bash (4)
  • bug (3)

Most active issues this week

Sign in to see which issues are moving.
Sign in

Detailed Description

sh is a shell parser, formatter, and interpreter written in Go that supports POSIX Shell, Bash, Zsh, and mksh.

The tool addresses the need to programmatically work with shell scripts in Go applications. It provides three main capabilities: parsing shell code into an abstract syntax tree through its syntax package, performing high-level operations like shell expansions through its shell package, and interpreting or executing shell scripts through its interp package. The shfmt command-line tool formats shell programs according to a canonical style, with options to list differences or write changes in place.

Developers should choose this tool when they need to integrate shell script processing into Go applications or want a standalone formatter for shell code. It suits projects that require parsing shell syntax without spawning external processes, or teams seeking consistent shell script formatting. The tool's pure Go implementation means it runs anywhere Go runs without external dependencies, though this design choice limits how closely the interpreter can follow POSIX and Bash semantics in edge cases like process forking and file descriptor handling. The formatter intentionally avoids partial-file formatting and minimizes configuration options to maintain consistency and reduce maintenance burden.

Development activity shows a disciplined approach to scope and quality. The project explicitly discourages drive-by patches from non-active contributors, requesting detailed issues instead. The maintainer has established clear caveats about parser limitations, such as the inability to handle certain ambiguities in Bash syntax without backtracking, and documents these transparently in the README. The project maintains a philosophy against adding formatting flags beyond necessity, acknowledging that each option multiplies complexity across development, testing, and documentation. The tool is packaged across numerous distributions and platforms, indicating sustained maintenance and broad compatibility testing.