Skip to content

Commit

Permalink
cEP-0009.md: Cobot enhancement and porting
Browse files Browse the repository at this point in the history
Closes #75
  • Loading branch information
meetmangukiya committed May 27, 2017
1 parent 3c5ec97 commit 9584f8a
Showing 1 changed file with 159 additions and 0 deletions.
159 changes: 159 additions & 0 deletions cEP-0009.md
@@ -0,0 +1,159 @@
cobot Enhancement and porting
=============================

|Metadata| |
|--------|---------------------------------------|
|cEP |0009 |
|Version |1.0 |
|Title |cobot Enhancement and porting |
|Authors |Meet Mangukiya <meetmangukiya@coala.io>|
|Status |Proposed |
|Type |Process |

Abstract
--------

This cEP describes the details of the process of porting
[cobot](https://gitlab.com/coala/cobot) from hubot(coffeescript framework) to
[errbot](http://errbot.io)(python framework) and about the new features that are
to be added to cobot as a part of the
[GSoC project](https://summerofcode.withgoogle.com/projects/#4913450777051136).

## 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](https://github.com/mvantellingen/python-zeep) can be used.

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

<!-- TODOs:
1. Preprocessing part
2. Finding the topic of the question.
3. Back Tracing the document for the topic.
4. Reply with a summary of the document and optionally a link to that part of
documentation.
-->

## Sample Plugin

```py
from errbot import BotPlugin, botcmd

class HelloWorld(BotPlugin):

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

0 comments on commit 9584f8a

Please sign in to comment.