# @octoherd/cli

> CLI to run a custom script on one or multiple repositories

Latest version **5.0.8** (published 2025-11-04) · ISC license · 0 weekly downloads

## Install

```sh
npm install @octoherd/cli
pnpm add @octoherd/cli
yarn add @octoherd/cli
bun add @octoherd/cli
```

Provides the command `octoherd`.

## Health

**Score 65/100 (B)** — status: stable.

Positive: has types; esm support; no vulnerabilities; high maintenance score; high quality score.

Warnings: low downloads.

## Facts

| | |
|---|---|
| Version | 5.0.8 |
| Published | 2025-11-04 |
| First published | 2020-12-16 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | bundled |
| Module format | ESM |
| Dependencies | 11 |
| Unpacked size | 202.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 100 |
| Author | Gregor Martynus |
| Maintainers | gr2m |
| Keywords | github, repository, maintenance, cli |

## Links

- npm: https://www.npmjs.com/package/@octoherd/cli
- Repository: https://github.com/octoherd/cli
- Homepage: https://github.com/octoherd/cli#readme
- Issues: https://github.com/octoherd/cli/issues
- npm.io page: https://npm.io/package/@octoherd/cli

## Dependencies (11)

- [chalk](https://npm.io/package/chalk.md) ^5.0.0
- [tempy](https://npm.io/package/tempy.md) ^3.0.0
- [yargs](https://npm.io/package/yargs.md) ^18.0.0
- [mkdirp](https://npm.io/package/mkdirp.md) ^3.0.0
- [enquirer](https://npm.io/package/enquirer.md) ^2.3.6
- [jsonfile](https://npm.io/package/jsonfile.md) ^6.0.1
- [clipboardy](https://npm.io/package/clipboardy.md) ^5.0.0
- [@octoherd/octokit](https://npm.io/package/@octoherd/octokit.md) ^5.0.0
- [@octokit/openapi-types](https://npm.io/package/@octokit/openapi-types.md) ^27.0.0
- [@octokit/auth-oauth-device](https://npm.io/package/@octokit/auth-oauth-device.md) ^8.0.0
- [semantic-release-plugin-update-version-in-files](https://npm.io/package/semantic-release-plugin-update-version-in-files.md) ^2.0.0

## Alternatives

- [@salesforce/cli](https://npm.io/package/@salesforce/cli.md) — 389.7K weekly downloads
- [@mintlify/cli](https://npm.io/package/@mintlify/cli.md) — 208.9K weekly downloads
- [@grafana/e2e-selectors](https://npm.io/package/@grafana/e2e-selectors.md) — 128.7K weekly downloads
- [mintlify](https://npm.io/package/mintlify.md) — 112.0K weekly downloads
- [@intlayer/cli](https://npm.io/package/@intlayer/cli.md) — 22.8K weekly downloads

## Recent versions

- 5.0.8 (latest) — 2025-11-04
- 5.1.0-beta.2 (beta) — 2025-05-06
- 5.0.7 — 2025-09-26
- 5.0.6 — 2025-09-16
- 5.0.5 — 2025-05-29
- 5.0.4 — 2025-05-20
- 5.1.0-beta.1 — 2025-05-05
- 5.0.3 — 2025-04-10
- 5.0.2 — 2025-02-21
- 5.0.1 — 2025-01-13
- 5.0.0 — 2024-04-10
- 4.0.5 — 2024-04-06
- 4.0.4 — 2024-04-01
- 4.0.3 — 2024-03-07
- 4.0.2 — 2023-10-23
- … 55 more at https://npm.io/package/@octoherd/cli/versions

## README

# Octoherd CLI

> CLI to run a custom script on one or multiple repositories

## Usage

```
Usage: octoherd run -S path/to/script.js [options]

Options:
      --help                      Show help                                            [boolean]
  -S, --octoherd-script           Path to *.js script. Must be an ES Module. [string] [required]
  -T, --octoherd-token            Requires the "public_repo" scope for public repositories, "rep
                                  o" scope for private repositories. Creates an OAuth token if n
                                  ot set.                                               [string]
  -R, --octoherd-repos            One or multiple repositories in the form of 'repo-owner/repo-n
                                  ame'. 'repo-owner/*' will find all repositories for one owner.
                                   '*' will find all repositories the user has access to.
                                  To exclude a repository use '!repo-owner/repo'. Will prompt
                                  for repositories if not set.                           [array]
      --octoherd-cache            Cache responses for debugging. Creates a ./cache folder if fla
                                  g is set. Override by passing custom path             [string]
      --octoherd-debug            Show debug logs                     [boolean] [default: false]
      --octoherd-bypass-confirms  Bypass prompts to confirm mutating requests
                                                                      [boolean] [default: false]
      --octoherd-base-url         When using with GitHub Enterprise Server, set to the root URL 
                                  of the API. For example, if your GitHub Enterprise Server's h
                                  ostname is github.acme-inc.com, then set to https://github.ac
                                  me-inc.com/api/v3.                                    [string]
      --version                   Show version number                                  [boolean]

Examples:
  octoherd run -S path/to/script.js                 Minimal usage example
  octoherd run -S path/to/script.js -T $TOKEN  -R   Pass token and repos as CLI flags
  octoherd/cli
  octoherd run -S path/to/script.js -T $TOKEN  -R   Avoid prompts for token and repos
  octoherd/cli
  octoherd run -S path/to/script.js -T $TOKEN  -R   Avoid any prompts
  octoherd/cli --octoherd-bypass-confirms
  octoherd run -S path/to/script.js -T $TOKEN  -R   Will fetch all repositories except repo-owner/hello-world
  'repo-owner/*' -R '!repo-owner/hello-world
  octoherd run -S path/to/script.js                 Run octoherd script against GHES
  --octoherd-base-url 
  https://github.acme-inc.com/api/v3
```

The `script` must export a `script` function which takes three parameters:

```js
export async function script(octokit, repository, options) {
  // do something here
}
```

- `octokit` is an instance of [`octokit.js`'s Octokit](https://github.com/octokit/octokit.js)
- `repository` is the response data of [`GET /repos/{owner}/{repo}`](https://developer.github.com/v3/repos/#get-a-repository)
- `options` are all options passed to the CLI which are not used by `octoherd`.

## Examples

- https://github.com/topics/octoherd-script

## Similar projects

- [NerdWalletOSS/shepherd](https://github.com/NerdWalletOSS/shepherd) - A utility for applying code changes across many repositories.
- [FormidableLabs/multibot](https://github.com/FormidableLabs/multibot) - A friendly multi-repository robot

## License

[ISC](LICENSE.md)

---
_Source: https://npm.io/package/@octoherd/cli · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
