Skip to content

Latest commit

 

History

History
156 lines (117 loc) · 4.55 KB

cEP-0013.md

File metadata and controls

156 lines (117 loc) · 4.55 KB

cobot Enhancement and porting

Metadata
cEP 13
Version 1.0
Title cobot Enhancement and porting
Authors Meet Mangukiya mailto:[email protected]
Status Proposed
Type Process

Abstract

This cEP describes the details of the process of porting cobot from hubot(coffeescript framework) to errbot(python framework) and about the new features that are to be added to cobot as a part of the GSoC project.

Why port?

coala community has grown substantially over last few months. To make it easier on maintainers to cope up and still be a welcoming community for new contributors, cobot is used. Currently, cobot is a hubot instance, scripts for which are written in Coffeescript.

coala is a python-inclined community, it makes sense to write the coala automation bot plugins in python. Writing the bot in python framework will appeal to more contributors and hence leading to more contributions. Also, having a python framework allows writing well tested plugins so buggy plugins are not merged. In cobot-hubot such merges have occured because the scripts in cobot-hubot weren't written with tests.

Why errbot?

Errbot has many useful features:

  1. Internal support for webhooks.
  2. pytest testing plugin.
  3. Support for multiple backends.
  4. Logs can be accessed via chat
  5. Plugins can be enabled, disabled without having to interact with the server, via chat.
  6. One can write plugins that can manage other plugins, opens many possibilities.
  7. Allows writing complex plugins that requires some statefulness through flows.

One other competitive alternative for errbot: chatterbot. It has built in support for AI and ML. It is stateful. But it is not useful for searching and answering over technical documentation. Also, it is more useful for casual conversations, etc.

New Features

Search API and User docs

Construct the url from the search string and return it as a message.

> cobot search api|user this is a search string
Have a look at this : http://api.coala.io/en/latest/search.html?q=this+is+a+search+string

List Bears

Query webservices.coala.io according to the filters that are applied/acquired from the trigger command.

When this command is triggered, plugin will use the lang argument as a filter to filter out the bears according to language. The list of bears will be retrieved from webservices.coala.io/list/bears.

> cobot ls bears [lang]*
### lang1
1. ...
2. ...
3. ...
### lang2
1. ...
2. ...
3. ...
See more at <link>

stats(bears, languages, contribution)

Query the webservices at appropriate end point according to the stat requested.

Endpoints:

  1. /list/bears for both bear and language stats. Language stats will be computed from the languages key of the given object.
  2. /contrib for contribution stats.
> cobot contrib stats <user>
User @<user> has:
1. Opened x issues
2. commited y commits
3. done z reviews

> cobot bear stats [lang]
There are x bears for [lang]

> cobot bear stats
There are total x bears.

> cobot lang stats
coala supports x languages.

> cobot stats
coala supports x bears across y languages.

Run Bear

Query the webservices with the parsed and retrieved code from the message and pass it along with the bears to be ran. Print the response that contains the diffs and results appropriately as a message.

> cobot run BearName setting1=value setting2=value ...
..BearName2 setting1=value setting2=value ...

coala python API wrapper

It is always better to make and use API wrapper rather than making raw API calls. The API wrapper can be generated using WSDL(web services description language) reducing work. Maybe python-zeep can be used.

Auto-Reply on a question. [See Topic-Modelling section]

Sample Plugin

from errbot import BotPlugin, botcmd

class HelloWorld(BotPlugin):

    @botcmd
    def hello(self, msg, args):
        return "Hello world!!"