# @atomist/automation-seed

> Atomist automation client seed project

Latest version **0.12.0** (published 2018-08-19) · Apache-2.0 license · 0 weekly downloads

## Install

```sh
npm install @atomist/automation-seed
pnpm add @atomist/automation-seed
yarn add @atomist/automation-seed
bun add @atomist/automation-seed
```

## Health

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

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.12.0 |
| Published | 2018-08-19 |
| First published | 2017-11-22 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | bundled |
| Module format | CommonJS |
| Node | >=8.0.0 |
| Dependencies | 3 |
| Unpacked size | 170.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2 |
| Author | Atomist |
| Maintainers | atomist |
| Keywords | atomist, automation, seed |

## Links

- npm: https://www.npmjs.com/package/@atomist/automation-seed
- Repository: https://github.com/atomist/automation-seed-ts
- Homepage: https://github.com/atomist/automation-seed-ts#readme
- Issues: https://github.com/atomist/automation-seed-ts/issues
- npm.io page: https://npm.io/package/@atomist/automation-seed

## Dependencies (3)

- [app-root-path](https://npm.io/package/app-root-path.md) ^2.0.1
- [@types/app-root-path](https://npm.io/package/@types/app-root-path.md) ^1.2.4
- [@atomist/automation-client](https://npm.io/package/@atomist/automation-client.md) ^0.21.1

## Recent versions

- 0.12.0 (latest) — 2018-08-19
- 0.12.1-master.20180903023406 (branch-master) — 2018-09-03
- 0.12.1-master.20180902181645 — 2018-09-02
- 0.12.1-de-deprecate.20180901235629 — 2018-09-01
- 0.12.1-master.20180829154543 — 2018-08-29
- 0.12.1-20180822161843 — 2018-08-22
- 0.12.1-20180822020716 — 2018-08-22
- 0.12.1-20180821192601 — 2018-08-21
- 0.12.1-20180821142050 — 2018-08-21
- 0.12.1-20180819020933 — 2018-08-19
- 0.12.0-20180819020446 — 2018-08-19
- 0.11.1-20180817180629 — 2018-08-17
- 0.11.0 — 2018-08-17
- 0.11.0-20180817173946 — 2018-08-17
- 0.11.0-20180817134623 — 2018-08-17
- … 20 more at https://npm.io/package/@atomist/automation-seed/versions

## README

# @atomist/automation-seed

[![npm version](https://badge.fury.io/js/%40atomist%2Fautomation-seed.svg)](https://badge.fury.io/js/%40atomist%2Fautomation-seed)

This repository contains examples demonstrating use of the
[Atomist][atomist] API for software.  You will find examples
illustrating:

-   Creating bot commands using _command handlers_
-   Responding to DevOps events, e.g., commits pushed to a repository,
    using _event handlers_

These examples use the [`@atomist/automation-client`][client] node
module to implement a local client that connects to the Atomist API
for software.  See the [Atomist documentation][atomist-doc] for more
information about Atomist, software delivery machines (SDM), and the
Atomist API for software.

[client]: https://github.com/atomist/automation-client-ts (@atomist/automation-client Node Module)
[atomist-doc]: https://docs.atomist.com/ (Atomist Documentation)

## Prerequisites

Before you can run this project, you will need an Atomist workspace.
See the [Atomist Getting Started Guide][atomist-start] for
instructions on how to get an Atomist workspace and connect it to your
source code repositories, continuous integration, chat platform, etc.

You will also need several other prerequisites to successfully run
this project.  See the [Atomist Developer Guide][atomist-dev] for
instructions on setting up your development environment.  Briefly, you
will need [Git][git], [Node.js][node], and the [Atomist
CLI][atomist-cli] installed and properly configured on your system.

[atomist-start]: https://docs.atomist.com/user/ (Atomist - Getting Started)
[atomist-dev]: https://docs.atomist.com/developer/prerequisites/ (Atomist - Developer Prerequisites)
[git]: https://git-scm.com/ (Git)
[node]: https://nodejs.org/ (Node.js)
[atomist-cli]: https://github.com/atomist/cli (Atomist Command-Line Interface)

## Running

Once the prerequisites are met on your system, use `npm` to install
dependencies and build the project.

```
$ npm install
$ npm run build
```

You can start up your SDM in the usual `npm` way.

```
$ npm start
```

The [Atomist API Client documentation][atomist-client] has more
complete instructions for running an SDM or other Atomist API client.

[atomist-client]: https://docs.atomist.com/developer/client/ (Atomist - API Client)

## Using

### Invoking a command handler from Slack

This project contains the code to create and respond to a simple
`hello world` bot command.  The code that defines the bot command and
implements responding to the command, i.e., the _command handler_, can
be found in [`HelloWorld.ts`][hello].  Once you have your local
automation client running (the previous step in this guide), you can
invoke the command handler by sending the Atomist bot the command as a
message.  Be sure the Atomist bot is in the channel before sending it
the message.

```
/invite @atomist
@atomist hello world
```

Once you've submitted the command in Slack, you'll see the incoming
and outgoing messages show up in the logs of your locally running
automation-client.  Ultimately, you should see the response from the
bot in Slack.

[hello]: https://github.com/atomist/automation-seed-ts/blob/master/src/commands/HelloWorld.ts (HelloWorld Command Handler)

Feel free to modify the code in the `HelloWorld` command handler,
Node.js will automatically reload the client, and see what happens!

### Triggering an event handler

While command handlers respond to commands you send the Atomist bot,
_event handlers_ take action when different types of events occur in
your development and operations environment.  Some examples of events
are commits pushed to a repo, or a CI build that fails, or an instance
of a running service that becomes unhealthy.  Example responses to those
events are showing the commits in a Slack message, automatically
restarting the build, and triggering a PagerDuty alert, respectively.

The sample event handler in this project, [NotifyOnPush][nop-handler],
will notice when someone pushes new commits to a repository in the
GitHub organization and send a notice of that push to all Slack
channels associated with that repository.

If you have followed the instructions above and are running these
automations against the atomist-playground Slack team and GitHub
organization, go ahead and edit the [notify-on-push][nop-repo]
repository by adding some text to its [README][nop-readme].  Once you
have saved your changes, you should see that event appear in the
console logs of your locally running automation client, followed by a
log of the actions the event handler is taking.  Once those actions
are complete, you should see a new message in the
[`#notify-on-push`][nop-channel] channel in the atomist-playground
Slack team.

[nop-handler]: https://github.com/atomist/automation-seed-ts/blob/master/src/events/NotifyOnPush.ts (Atomist NotifyOnPush Event Handler)
[nop-repo]: https://github.com/atomist-playground/notify-on-push (Atomist NotifyOnPush Repository)
[nop-readme]: https://github.com/atomist-playground/notify-on-push/edit/master/README.md (Edit NotifyOnPush README)
[nop-channel]: https://atomist-playground.slack.com/messages/C7GNF6743/ (NotifyOnPush Slack Channel)

## Support

General support questions should be discussed in the `#support`
channel in the [Atomist community Slack workspace][slack].

If you find a problem, please create an [issue][].

[issue]: https://github.com/atomist/automation-seed-ts/issues

## Development

You will need to install [node][] to build and test this project.

### Build and Test

Use the following package scripts to build, test, and perform other
development tasks.

Command | Reason
------- | ------
`npm install` | install project dependencies
`npm run build` | compile, test, lint, and generate docs
`npm start` | start the Atomist API client
`npm run autostart` | run the client, refreshing when files change
`npm run lint` | run TSLint against the TypeScript
`npm run compile` | generate types from GraphQL and compile TypeScript
`npm test` | run tests
`npm run autotest` | run tests every time a file changes
`npm run clean` | remove files generated during the build

### Release

Releases are managed by the [Atomist SDM][atomist-sdm].  Press the
release button in the Atomist dashboard or Slack.

[atomist-sdm]: https://github.com/atomist/atomist-sdm (Atomist Software Delivery Machine)

---

Created by [Atomist][atomist].
Need Help?  [Join our Slack team][slack].

[atomist]: https://atomist.com/ (Atomist - How Teams Deliver Software)
[slack]: https://join.atomist.com/ (Atomist Community Slack)

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