Git Product home page Git Product logo

do's People

Stargazers

 avatar

Watchers

 avatar  avatar  avatar  avatar

do's Issues

Tests

We have plenty of testable logic in the app, and an easily mockable slackbot instance.

Let's write some tests! ๐Ÿ˜ˆ

First-class pm2 interface

Examples

  • @do pm2 start a: starts the a pm2 process
  • @do pm2 stop b: stops the b pm2 process
  • @do pm2 restart c: restarts the c pm2 process
  • @do pm2 list: List current processes

Clean up data avenues

Currently, the codebase is a bit murky in regards to what data is being sent where. Problems include inconsistent variable naming, and a relative lack of comments.

User trust system

Currently, anyone on a Slack team can invoke any command. This is suboptimal from a security perspective: consider a use case where Do is running on a production system.

Possible solution: a user is defined as the superuser (by handle or some other unique Slack identifier) in Do config, and commands are added to instruct Do to start and stop trusting additional users. Those users, in turn, can instruct Do to start or stop trusting any other users (except the user defined as superuser in the config).

Add self-updating mechanism

It'd be awesome to be able to update do via Slack.

Do could, itself, be a target, with an update verb that runs git pull and then exits, allowing the process manager running Do to restart it.

pm2 start fails

>>> pm2 restart -s wmsv-wmffmpeg 
/home/ubuntu/.nvm/versions/node/v4.2.6/lib/node_modules/pm2/node_modules/pm2-axon/node_modules/amp-message/index.js:126
  return new Buffer('j:' + JSON.stringify(arg));
                                ^
TypeError: Converting circular structure to JSON
    at Object.stringify (native)
    at pack (/home/ubuntu/.nvm/versions/node/v4.2.6/lib/node_modules/pm2/node_modules/pm2-axon/node_modules/amp-message/index.js:126:33)
    at encode (/home/ubuntu/.nvm/versions/node/v4.2.6/lib/node_modules/pm2/node_modules/pm2-axon/node_modules/amp-message/index.js:101:14)
    at Message.toBuffer (/home/ubuntu/.nvm/versions/node/v4.2.6/lib/node_modules/pm2/node_modules/pm2-axon/node_modules/amp-message/index.js:68:10)
    at ReqSocket.Socket.pack (/home/ubuntu/.nvm/versions/node/v4.2.6/lib/node_modules/pm2/node_modules/pm2-axon/lib/sockets/sock.js:92:14)
    at ReqSocket.send (/home/ubuntu/.nvm/versions/node/v4.2.6/lib/node_modules/pm2/node_modules/pm2-axon/lib/sockets/req.js:96:21)
    at Client.call (/home/ubuntu/.nvm/versions/node/v4.2.6/lib/node_modules/pm2/node_modules/pm2-axon-rpc/lib/client.js:34:13)
    at Object.executeRemote (/home/ubuntu/.nvm/versions/node/v4.2.6/lib/node_modules/pm2/lib/Satan.js:563:23)
    at /home/ubuntu/.nvm/versions/node/v4.2.6/lib/node_modules/pm2/lib/CLI.js:1047:13
    at /home/ubuntu/.nvm/versions/node/v4.2.6/lib/node_modules/pm2/node_modules/async/lib/async.js:181:20

I think there may be some isolation regarding our runner process system thatโ€™s keeping the pm2 binary from communicating with its god process.

Config wizard

We have an empty wizard.js file in the repository.

There should be a config wizard there ๐Ÿ˜„

  • Adopt sample PM2 file
  • walk user through obtaining a Slack token
  • set output channel and emoji

Extend sequence API

The sequence API is kinda weird, in that you usually end up passing an array of words broken by spaces, for example ['npm', 'install'].

I've yet to see a use case that breaks that pattern, actually.

We could save users some keystrokes (and headaches) by allowing them to pass in a string (for example, npm install, which will be broken down into the command and array of arguments to be passed into exec behind the scenes.

Do is unresponsive while a verb is being executed

Beacuse of the way the verb runner is written (that is, synchronously), Do is unable to handle any incoming requests while it's executing a verb sequence.

This may cause problems with Slack connectivity and state when running very long verb sequences.

We should refactor the verb runner to an asynchronous shell execution API, being careful to preserve the waterfall pattern of a sequence's execution.

ESLint

We should adopt the WeMash ESLint presets.

README updates

  • be more focused on end user
  • add bit about inviting bot to a room
  • need more clarity on the target api, sequences...
  • screenshots would be nice
  • developer section: overview of data flow, what reused variable names conceptually represent, etc

Improve target loader error messaging

If I forget to add a required key to a target, I get this:

Oops! There was a problem parsing targets/example.js: 
'AssertionError: expected { Object (verbs, description, ...) } to have keys 'verbs', 'name', 'description', and 'workingDir''

While this is helpful, it would be nice to be more user-friendly.

Tightly integrate PM2

Let's start using the PM2 API to start Do in the background, and package a local PM2 with Do so it works without needing to install PM2 globally.

Create module system for handlers

Currently, handlers for help, hello, and list are hardcoded into index.js.

We should break those out into a module system similar to targets, so they're easier to reason about and easier to create and customize.

Block verbs from being invoked while they're already in progress

This is a bug newly introduced by the resolution of #1.

Running child processes asynchronously allows us to kick off the same verb twice at once, which is a bad thing: being at two places in a build pipeline at once can cause some seriously subtle headaches to end users.

We should block a verb from starting if it's already running!

Support command arguments

Imagine we wanted a log verb that outputs the last n lines from a process manager.

Possible formats, where n = 100:

  • @do log example 100
  • @do log example n:100

Accepting arguments may require us to augment the sequence API (which is going on in #3 for 1.0 as well).

We'll also want to sanitize the argument inputs- though we can generally trust users, we can't Trust Usersโ„ข, so let's stay on the safe side.

Support older Node versions

Currently, due to ES6 presence in the codebase, Do requires node >=6.0.0.

We can transpile ES6 on the fly in older Node versions using Babel's require hook. This may have runtime performance implications, but IMO it's better to run more slowly in older Nodes than to not run at all ๐Ÿ˜ƒ

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.