# @mermaidchart/cli

> CLI for interacting with https://mermaid.ai, the platform that makes collaborating with Mermaid diagrams easy

Latest version **0.1.1** (published 2026-02-04) · MIT license · 0 weekly downloads

## Install

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

Provides the command `mermaid-chart`.

## Health

**Score 50/100 (C)** — status: stable.

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types; pre 1.0.

## Facts

| | |
|---|---|
| Version | 0.1.1 |
| Published | 2026-02-04 |
| First published | 2024-04-11 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Node | ^18.18.0 \|\| ^20.0.0 \|\| ^22.0.0 \|\| ^24.0.0 |
| Dependencies | 13 |
| Unpacked size | 102.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 7 |
| Author | Alois Klink |
| Maintainers | ashish4mc, aloisklink, sidv |
| Keywords | mermaid, mermaidchart, cli |

## Links

- npm: https://www.npmjs.com/package/@mermaidchart/cli
- Repository: https://github.com/Mermaid-Chart/plugins
- Homepage: https://github.com/Mermaid-Chart/plugins/tree/main/packages/cli#readme
- Issues: https://github.com/Mermaid-Chart/plugins/issues
- npm.io page: https://npm.io/package/@mermaidchart/cli

## Dependencies (13)

- [yaml](https://npm.io/package/yaml.md) ^2.3.4
- [remark](https://npm.io/package/remark.md) ^15.0.1
- [to-vfile](https://npm.io/package/to-vfile.md) ^8.0.0
- [commander](https://npm.io/package/commander.md) ^11.1.0
- [remark-gfm](https://npm.io/package/remark-gfm.md) ^4.0.0
- [@iarna/toml](https://npm.io/package/@iarna/toml.md) ^2.2.5
- [@inquirer/input](https://npm.io/package/@inquirer/input.md) ^1.2.14
- [@inquirer/select](https://npm.io/package/@inquirer/select.md) ^1.3.1
- [unist-util-visit](https://npm.io/package/unist-util-visit.md) ^5.0.0
- [@inquirer/confirm](https://npm.io/package/@inquirer/confirm.md) ^2.0.15
- [@mermaidchart/sdk](https://npm.io/package/@mermaidchart/sdk.md) ^0.2.2
- [remark-frontmatter](https://npm.io/package/remark-frontmatter.md) ^5.0.0
- [@commander-js/extra-typings](https://npm.io/package/@commander-js/extra-typings.md) ^11.1.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

- 0.1.1 (latest) — 2026-02-04
- 0.1.0-alpha.1 (alpha) — 2024-04-12
- 0.1.0 — 2024-04-22
- 0.1.0-alpha.0 — 2024-04-11

## README

# @mermaidchart/cli

CLI for interacting with https://MermaidChart.com, the platform that makes collaborating with Mermaid diagrams easy!

## Installation

`@mermaidcart/cli` is tested to work with Node.JS v18.18.0 or later.

We recommend installation using [npx](https://docs.npmjs.com/cli/v10/commands/npx)
to automatically download, cache, and run `@mermaidcart/cli`, as it comes with
most Node.JS installations.

```bash
npx @mermaidchart/cli --help
```

## Usage

```bash
npx @mermaidchart/cli <command>
```

Use `--help` to see options!

```bash
npx @mermaidchart/cli --help
```

`@mermaidchart/cli` allows you to easily sync local diagrams with your diagrams
on https://mermaidchart.com.

These local diagrams can either be stored in `.mmd` or `.mermaid` files, or
they can be stored within ```` ```mermaid```` code blocks within `.md`
[GFM](https://github.github.com/gfm/) markdown files.

### `login`

Firstly, go to https://www.mermaidchart.com/app/user/settings and generate an
API key, which you can then setup by running:

```bash
npx @mermaidchart/cli login
```

### `link` an existing Mermaid diagram to MermaidChart.com

You can link a local Mermaid diagram to MermaidChart using:

```bash
npx @mermaidchart/cli link ./path/to/my/mermaid-digram.mmd
```

This will add an `id: xxxx-xxxxx-xxxxx` field to your diagram's YAML frontmatter,
which points to the diagram on MermaidChart.com:

````markdown
```mermaid
---
title: My diagram
id: https://www.mermaidchart.com/d/xxxx-xxxxx-xxxxx # this field is created by @mermaidchart/cli
---
flowchart
  x[My Diagram]
```
````

### `push` local changes to MermaidChart.com

Once you've made some local changes, you can `push` your changes to MermaidChart.com

```console
$ npx @mermaidchart/cli push ./path/to/my/mermaid-digram.mmd
✅ - ./path/to/my/mermaid-digram.mmd was pushed
```

### `pull` changes from MermaidChart.com

You can use `pull` to pull down changes from MermaidChart.com.

```console
$ npx @mermaidchart/cli pull ./path/to/my/mermaid-digram.mmd
✅ - ./path/to/my/mermaid-digram.mmd was updated
```

Or use the `--check` flag to throw an error if your local file would have been
updated:

```console
$ npx @mermaidchart/cli pull ./path/to/my/mermaid-digram.mmd
❌ - ./path/to/my/mermaid-digram.mmd would be updated
```

## Contributing

For local development and testing, you can `pnpm dev` to run the CLI,
`pnpm run lint` to run linting, and `pnpm test` to run unit tests.

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