# 使用 Homebrew, Nix 安装 keep-sorted

查看 keep-sorted 的安装路径、可执行文件、元数据以及面向 AI 代理工作流的安全说明。

## 安装

```sh
sudo av install brew:keep-sorted
```

其他安装命令:

### macOS

- Homebrew (100%):

```sh
brew install keep-sorted
```

  证据: local Homebrew formula metadata

### Linux

- Nix (92%):

```sh
nix profile install nixpkgs#keep-sorted
```

  证据: nixpkgs package indexes: pkgs/by-name/ke/keep-sorted/package.nix from https://api.github.com/repos/NixOS/nixpkgs/git/trees/master?recursive=1

## 软件包事实

- **软件包键:** brew:keep-sorted
- **软件包管理器:** Homebrew
- **版本:** 0.9.1
- **来源摘要:** Language-agnostic formatter that sorts selected lines
- **主页:** <https://github.com/google/keep-sorted>
- **仓库:** <https://github.com/google/keep-sorted>
- **最后更新:** 2026-07-27T21:58:38+02:00
- **已生成:** 2026-08-03T19:37:03+00:00

## 可执行文件

- keep-sorted (别名)

## 安装行为

- Bottle: 不可用

## 版本和新鲜度

- 页面生成时间: 2026-08-03
- 管理器版本: 0.9.1
## 项目历史与用法

keep-sorted is Google's language-agnostic formatter for sorting marked blocks of lines inside larger files. Instead of trying to parse a whole language, it asks maintainers to mark regions with `keep-sorted start` and `keep-sorted end`, then sorts just those regions.

### 项目历史

The GitHub repository was created on 2023-02-23. The README presents the tool as a general formatter for sorted blocks and documents installation through `go install` and pre-commit integration. Public GitHub releases began with the 0.1.x line in January 2024, followed by rapid feature growth around nested blocks, numeric sorting, YAML-style option lists, regex sorting, release binaries, and skip/group options.

### 采用历史

Adoption is strongest in repositories that want deterministic ordering for generated-looking lists without adopting a language-specific formatter. The pre-commit hook documented in the README is the main adoption path: projects can enforce sorted blocks in review and CI while keeping the tool independent of file type.

### 使用方式

Users wrap a section of code, configuration, documentation, or data with keep-sorted markers and run `keep-sorted` over files or stdin. Options on the marker control grouping, block parsing, case sensitivity, duplicate removal, descending order, regex-based sorting, and blank-line handling.

### 为什么软件包爱好者会关心

keep-sorted is package-nerdy because it solves a recurring maintenance itch with a tiny explicit contract: the source file says which lines are machine-sortable. That makes it a useful complement to gofmt-style whole-file formatters and to pre-commit-driven hygiene stacks.

### 时间线

- 2023-02-23: GitHub repository created.
- 2024-01-23: v0.1.1, v0.2.0, and v0.3.0 releases published.
- 2024-03-05: v0.4.0 added skip_lines and group_prefixes options.
- 2024-09-27: v0.5.0 added YAML-list support for multi-valued options.
- 2025-03-18: v0.6.0 added by_regex and a --version flag.
- 2026-06-30: v0.9.1 published.

### Related projects

- keep-sorted is related to pre-commit, Go module distribution, repository-formatting tools, and language-specific formatters such as gofmt and clang-format, but it intentionally stays language-agnostic.

### 来源

- <https://api.github.com/repos/google/keep-sorted>
- <https://github.com/google/keep-sorted>
- <https://github.com/google/keep-sorted/releases>


## 安全说明

narrow executable package without higher-risk signals.

- **Geiger 风险:** 绿色 / 低
- narrow executable package without higher-risk signals

## 其他软件包管理器记录

- Nix - keep-sorted: normalized package name match | nixpkgs package indexes: pkgs/by-name/ke/keep-sorted/package.nix from https://api.github.com/repos/NixOS/nixpkgs/git/trees/master?recursive=1


## Combined YAML source

View the package source record on GitHub. [combined/keep-sorted.yml](https://github.com/mxcl/pkgdb/blob/main/combined/keep-sorted.yml)


## 来源

- pkg.so package database
- Geiger risk classifier
- curated package history
- pkgdb category and tag curation
- external package-manager database matches
- cross-ecosystem install command graph
