# @antsa/cli

> Antsa Command Line Interface

Latest version **1.0.0** (published 2023-03-16) · Apache-2.0 license · 0 weekly downloads

## Install

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

Provides the command `antsa`.

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2023-03-16 |
| First published | 2023-03-16 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Unpacked size | 14.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Antsa |
| Maintainers | huukhai |
| Keywords | antsa, fhir, healthcare, interoperability, json, serialization, hl7, standards, clinical, dstu2, stu3, r4, normative |

## Links

- npm: https://www.npmjs.com/package/@antsa/cli
- Repository: https://git.powergatevn.com/division2/antsa
- Homepage: https://www.antsa.com/
- npm.io page: https://npm.io/package/@antsa/cli

## Dependencies (3)

- [dotenv](https://npm.io/package/dotenv.md) 16.0.3
- [node-fetch](https://npm.io/package/node-fetch.md) 2.6.9
- [@antsa/core](https://npm.io/package/@antsa/core.md) *

## 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

- 1.0.0 (latest) — 2023-03-16

## README

# Antsa Command Line Interface

The Antsa CLI (Command Line Interface) is a set of command line tools to quickly deploy Antsa web applications and Antsa bots.

## Installation

Add as a dependency:

```bash
npm install @antsa/cli
```

## Config file

Create a Antsa config file called `antsa.config.json`:

```json
{
  "bots": [
    {
      "name": "hello-world",
      "id": "f0465c2e-11d4-4c36-b834-8e86f7472b4b",
      "source": "src/index.ts",
      "dist": "dist/index.js"
    }
  ]
}
```

The `name` property is a friendly name you can use to reference the Bot in commands.

The `id` property refers to the Bot ID in your Antsa project.

The `source` property is the file path to the original source. When you "save" the Bot, the contents of this file will be saved to the Bot `code` property. This file can be JavaScript or TypeScript.

The `dist` property is the optional file path to the compiled source. If omitted, the command falls back to using the `source` property. When you "deploy" the Bot, the contents of this file will be deployed to the Bot runtime. This file must be JavaScript.

## Usage

Syntax:

```bash
npx antsa <command> <args>
```

### save-bot

Updates the `code` value on a `Bot` resource

Syntax:

```bash
npx antsa save-bot <bot name>
```

Example:

```bash
npx antsa save-bot hello-world
```

### deploy-bot

Deploys the Bot code

Syntax:

```bash
npx antsa deploy-bot <bot name>
```

Example:

```bash
npx antsa-deploy-bot <bot name>
```

## Authentication

Authentication requires client credentials in environment variables `ANTSA_CLIENT_ID` and `ANTSA_CLIENT_SECRET`. This supports most use cases, including secrets from CI/CD. `dotenv` is enabled, so you can store them in a `.env` file.

## Example

Create a Antsa config file `antsa.config.json`:

```json
{
  "bots": [
    {
      "name": "hello-world",
      "id": "f0465c2e-11d4-4c36-b834-8e86f7472b4b",
      "source": "src/hello-world.ts",
      "dist": "dist/hello-world.js"
    }
  ]
}
```

Replace the sample `id` with your Bot's ID.

Write your bot in `src/hello-world.ts`. This can be TypeScript. It can reference `@antsa/core` and `node-fetch`:

```ts
import { AntsaClient } from '@antsa/core';
import { Resource } from '@antsa/fhirtypes';

export async function handler(antsa: AntsaClient, event: BotEvent): Promise<any> {
  console.log('Hello world');
}
```

You can use the Antsa CLI to save it:

```bash
npx antsa save-bot hello-world
```

Compile with vanilla `tsc` (no bundler required)

```bash
npx tsc
```

The result will be JavaScript output in `dist/hello-world.js`:

```javascript
export async function handler(antsa, input) {
  console.log('Hello world');
}
```

You can then use the Antsa CLI to deploy it.

```bash
npx antsa deploy-bot hello-world
```

## About Antsa

Antsa is a healthcare platform that helps you quickly develop high-quality compliant applications. Antsa includes a FHIR server, React component library, and developer app.

## License

Apache 2.0. Copyright &copy; Antsa 2023

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