# @agreed/cli

> Agreed is a tool for Consumer Driven Contract with JSON mock server

Latest version **6.0.0** (published 2024-03-14) · MIT license · 0 weekly downloads

## Install

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

Provides the commands `agreed-ui`, `agreed-client`, `agreed-server`.

## Health

**Score 30/100 (F)** — status: abandoned.

Positive: no vulnerabilities; high maintenance score.

Warnings: low downloads; no types; no esm support.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 6.0.0 |
| Published | 2024-03-14 |
| First published | 2019-10-12 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 7 |
| Unpacked size | 112.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 215 |
| Author | yosuke-furukawa |
| Maintainers | yosuke-furukawa, maxmellon |
| Keywords | agreed, consumer, driven, contract, mock, json, server |

## Links

- npm: https://www.npmjs.com/package/@agreed/cli
- Repository: github.com/recruit-tech/agreed
- Homepage: https://github.com/recruit-tech/agreed#readme
- npm.io page: https://npm.io/package/@agreed/cli

## Dependencies (7)

- [colo](https://npm.io/package/colo.md) ^1.0.0
- [json5](https://npm.io/package/json5.md) ^2.0.0
- [minimist](https://npm.io/package/minimist.md) ^1.2.0
- [@agreed/ui](https://npm.io/package/@agreed/ui.md) ^6.0.0
- [@agreed/typed](https://npm.io/package/@agreed/typed.md) ^6.0.0
- [@agreed/client](https://npm.io/package/@agreed/client.md) ^6.0.0
- [@agreed/server](https://npm.io/package/@agreed/server.md) ^6.0.0

## Alternatives

- [@mapbox/jsonlint-lines-primitives](https://npm.io/package/@mapbox/jsonlint-lines-primitives.md) — 5.3M weekly downloads
- [reftools](https://npm.io/package/reftools.md) — 3.5M weekly downloads
- [@hey-api/openapi-ts](https://npm.io/package/@hey-api/openapi-ts.md) — 3.5M weekly downloads
- [@mapbox/geojson-rewind](https://npm.io/package/@mapbox/geojson-rewind.md) — 2.4M weekly downloads
- [turbo-stream](https://npm.io/package/turbo-stream.md) — 1.7M weekly downloads

## Recent versions

- 6.0.0 (latest) — 2024-03-14
- 5.3.2-alpha.0 — 2022-08-25
- 5.3.1 — 2022-08-16
- 5.3.0 — 2022-07-21
- 5.2.1 — 2021-07-06
- 5.2.0 — 2021-01-29
- 5.1.10 — 2020-09-01
- 5.1.9 — 2020-08-07
- 5.1.8 — 2020-08-03
- 5.1.7 — 2020-05-28
- 5.1.6 — 2020-05-27
- 5.1.5 — 2020-04-06
- 5.1.4 — 2020-04-06
- 5.1.3 — 2020-03-30
- 5.1.2 — 2020-03-30
- … 13 more at https://npm.io/package/@agreed/cli/versions

## README

# <img src="https://recruit-tech.github.io/agreed/media/logo-with-text.svg" width="300" />

[![Build Status](https://travis-ci.org/recruit-tech/agreed.svg?branch=master)](https://travis-ci.org/recruit-tech/agreed)


agreed is Consumer Driven Contract tool with JSON mock server.

agreed has 3 features.

1. Create contract file as json(json5/yaml/etc) file
1. mock server for frontend development.
1. test client for backend development

# Install

```
$ npm install agreed -g
```

# Usage

## Usage as Frontend Mock Server

- Create agreed file (this file is used as a contract between frontend and backend)

```javascript
// save as agreed.js
module.exports = [
  {
    request: {
      path: '/user/:id',
      method: 'GET',
      query: {
        q: '{:someQueryStrings}',
      },
      values: {
        id: 'yosuke',
        someQueryStrings: 'foo'
      },
    },
    response: {
      headers: {
        'x-csrf-token': 'csrf-token', 
      },
      body: {
        message: '{:greeting} {:id} {:someQueryStrings}',
        images: '{:images}',
        themes: '{:themes}',
      },
      values: {
        greeting: 'hello',
        images: [
          'http://example.com/foo.jpg',
          'http://example.com/bar.jpg',
        ],
        themes: {
          name: 'green',
        },
      }
    },
  },
]
```

- Run server

```
$ agreed-server --path ./agreed.js --port 3010
```

- curl to the mock server

```
$ curl http://localhost:3010/user/yosuke?q=foo
{
  "message": "hello yosuke foo",
  "images": [
    "http://example.com/foo.jpg",
    "http://example.com/bar.jpg"
  ],
  "themes": {
    "name": "green"
  }
}
```

## Usage as Backend test client

- Run test client for confirm response

```
$ agreed-client --path ./agreed.js --port 3030 --host example.com
```

## Usage: Agreed Documentation

- Run documentation server

```
$ agreed-ui --path ./agreed.js --port 3031
```

![ScreenShot](https://raw.githubusercontent.com/recruit-tech/agreed-ui/master/screenshot.png)

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