Giter Club home page Giter Club logo

nestor-cli's Introduction

Nestor Power Development Toolkit

The Nestor CLI lets you create, debug and deploy Nestor Bot Powers.

What is a Bot Power?

A Bot Power is functionality that you would like to add to Nestor. Examples of powers include Github and Trello. But what if you wanted to add your own?

Nestor CLI comes to the rescue.

Installation

The Nestor CLI can be downloaded from here. Downloads are available for OS X and Linux. (Windows coming soon).

Unpackage the archive and move the nestor binary to a well-known $PATH (such as /usr/local/bin).

Start creating your own power

To start creating your own power, run nestor new <Power Name>. So if you wanted to call your power "Hello World", run this command:

$ nestor new "Hello World"

Quotes are not needed if the name of your power is a single word.

This will create a NodeJS module with the following contents:

  1. index.js: Contains a sample power implementation
  2. package.json: Where you can add all your dependencies. The nestorbot dependency is added by default.
  3. nestor.json: A manifest file containing details about your power
  4. README.md: Contains the Nestor programming manual

Make Changes to your Power

You can now follow the Nestor Programming Manual to make changes to your power.

nestor.json

The nestor.json file located at the root of your power's directory contains important information that is required by Nestor:

  1. name: The name of your power
  2. permalink: The permalink that will uniquely identify your power. The permalink must not contain any spaces.
  3. Description: A short description of what users can do with this power.

These three fields are mandatory.

In addition if your power requires environment variables that need to be configured (for e.g. authentication tokens or keys), you can set them with the environment_keys fields.

An example of this setting can be found in the Mixpanel power

"environment_keys": {
  "NESTOR_MIXPANEL_API_KEY": {
    "required": true,
    "mode": "user"
  },
  "NESTOR_MIXPANEL_API_SECRET": {
    "required": true,
    "mode": "user"
  }
}

In this example, NESTOR_MIXPANEL_API_KEY and NESTOR_MIXPANEL_API_SECRET are both required (specified by "required":true) by the power to work and need to be set by the user (specified by "mode": "user")

By setting an environment variable to be "required", every time a user tries to use your power, she will be prompted to set this environment variable. This way you don't have to write additional code in your power to check whether your environment variable is set.

If you have an optional environment variable, then set the required field to false.

An example of an environment variable that is not required can be found in the Github power.

Save Your Power

To save your Nestor power, run nestor save inside the directory where you power is created and this will upload the code powering your power (pardon the pun) to Nestor's servers and your power is now ready to be tested.

$ nestor save

Saving your power does not make it available to your Slack team. You will still need to deploy your power (which we will cover later in this README).

Sidenote: Logging In

All of the remaining operations (including this one) require you to be authenticated with Nestor's service so you will be prompted to log in. If you are logging in for the first time, you will need to sign in to the website, go to "My Profile" by clicking on your profile picture on the left bottom side, and setting your password.

Keep note of your email address as that is required to log in.

Test Your Power

The Nestor Toolkit provides you with an interactive shell which will let you test your power before it is deployed. You can enter text commands as they would appear in Slack, and see how your power behaves.

You can keep editing your power, save-ing your changes and keep testing it with the shell until you are happy.

To start the shell, run the following command:

$ nestor shell

To quit the shell, enter the command exit.

Deploy Your Power

Deploying your power means that your power will now be available to your entire team. To deploy your power run the following command:

$ nestor deploy

This will give you a list of versions for your power (every time you save your power, a new version is created) and you can pick the version that you want to deploy.

If you want to deploy just the latest version, run:

$ nestor deploy --latest

Bugs/Feedback

To report bugs and make feature requests, please create an issue.

nestor-cli's People

Contributors

arunthampi avatar

Stargazers

Michael Leonard avatar Sylwester Lachiewicz avatar Ian Carroll avatar Montana Flynn avatar

Watchers

 avatar James Cloos avatar  avatar

nestor-cli's Issues

Path settings Windows?

Tbh, im not really sure what the issue really is.

Installed the Nestor setup for Windows. Creating a power seems to work. Running it in shell does not. Yet i think, the issue may be related to the creation process.

Error at hand - when running a power in shell:
Unable to import module 'index': Error
at Function.Module._resolveFilename (module.js:325:15)
at Function.Module._load (module.js:276:25)
at Module.require (module.js:353:17)
at require (internal/module.js:12:17)
at Object. (/var/task/index.js:1:74)
at Module._compile (module.js:409:26)
at Object.Module._extensions..js (module.js:416:10)
at Module.load (module.js:343:32)
at Function.Module._load (module.js:300:12)
at Module.require (module.js:353:17)

Yet creating a power may already have a false path setting:
c:...\AppData\Local\Programs\nestor\bin>nestor new test

  • Creating directory...
  • Running npm init...
  • Running npm install nestorbot...
  • Creating nestor.json...
  • Creating example at index.js...
  • Downloading README...
    Successfully created power test here: c:...\AppData\Local\Programs\ne
    stor\bin/test

I'm refering to the difference in "/" and "" at the end of that statement

regards

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.