Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

copilot-core

Package Overview
Dependencies
Maintainers
1
Versions
32
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

copilot-core

copilot

  • 0.0.37
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
15
increased by66.67%
Maintainers
1
Weekly downloads
 
Created
Source

A tool like Alfred on Mac

This is a core library,NOT a client with user interface, Here is a GUI program,Here is a CLI program

NOTE

This project is still building, and it was tested only under Ubuntu 16.04

FEATURE

  • Windows management
  • System utils
  • Process management
  • Launch applications (by name)
  • Extendible
  • Alias
  • Pipe
  • Namespace

[TOC]

How does it work

Big Picture

User gives a input to copilot ,copilot gives a list (called IResult list) back to user, then user select an item from the list to execute a action related to this item.

If ignore how user interactive with copilot,it's GUI's business,let's use user> and copilot> to represent the communication between user and copilot

For example:

user> a google
copilot>
1. google chrome
2. google earth
user> exec 1
copilot> Active google chrome

Translate it to humans' language:

User: Active a window which has a title looks like google
Copilot: Fine, there are too windows that looks satisfied your requirement.Here there are.
User: OK, active the first.

NOTE

a is an alias that means active

Processor

A function which takes option and IResult list to generate a new IResult list

Action

A mechanism to do something ,such as copy, run cmd and so on, according to an IResult item

Pipe

Copilot puts a processor's output to the next processors's input to make processors work together.

For example:

buildin.apps.list | buildin.filter.grep -i chrome | buildin.apps.launch

processor buildin.apps.list generates a list of application installed in system,it is an IResult list, and buildin.filter.grep -i filter all matched items out, the last one add launch action to items.

  buildin.apps.list's output      buildin.filter.grep's output   buildin.apps.launch's output
(buildin.filter.grep's input)    (buildin.apps.launch's input)


  +----------------------+           +-------------------+        +-------------------------+
  | google chrome        |           | google chrome     |        | Active google chrome    |
  +----------------------+---------->+-------------------+------->+-------------------------+
  | firefox              |           | google earth      |        | Active google earth     |
  +----------------------+           +-------------------+        +-------------------------+
  | leafpad              |
  +----------------------+
  | google earth         |
  +----------------------+

Alias

Of cause it is to long to type in order to make chrome run. So I added an useful feature to copilot that is alias An alias of run a matched application

run: buildin.apps.list | buildin.filter.grep -i __arg__ | buildin.apps.launch

Dependencies

Some processors are dependent on some external command,if those command are missing processors will give hint text on it's output IResult

User Interface

Here is an javafx GUI

A CLI user interface is coming.

Processors

list

namedescription
buildin.apps.listlist all applications
buildin.apps.launchadd run to app items
buildin.dict.icibaA dictionary
buildin.dict.oxfordoxford dictionary
buildin.file.openOpen a file
buildin.filter.grepfilter by regexp
buildin.filter.searchuse fuse.js search
buildin.process.listlist all process
buildin.process.killkill process
buildin.sys.suspendSuspend system
buildin.sys.rebootReboot system
buildin.sys.wifitoggle WiFi on/off
buildin.sys.iplist ip address
buildin.tldr.listlist cmds ,integrate tldr
buildin.tldr.showshow short usage info
buildin.tools.headoutput first n items
buildin.tools.tailoutput last n items
buildin.tools.countcount
buildin.tools.nowshow time
buildin.tools.toPipeconvert cmd arguments to IResult
buildin.tools.calcA math express calculator
buildin.tools.echoCmd to IResult
buildin.tools.timeoutTo do something after specified time out
buildin.tools.notifySend a notification
buildin.tools.copychange IResult's field to copy
buildin.tools.cmdExcutate cmd by shell
buildin.win.listlist all windows
buildin.win.activeactive window
buildin.win.closeclose window
buildin.win.movemove window
buildin.chrome.*Chrome intergration

oxford dict

oxford API has a limitation related to query times per month. You'd better to register a new account to get a key to replace to default one. Oxford link

External processor

There are two types external processor at the moment,they are js processor and script processor. The js processor are written by javascript and it has the same structure of internal processor and it can use the internal services of cause. The script processor are executable scripts which output data in yaml format. Copilot put arguments to script's cmd line argument and put IResult items to script's stdin stream.

The config section external.processor tells copilot where to find external processor.

external.processor:
  js:
    path:
      - ~/.config/copilot/processors/js
  script:
    path:
      - ~/.config/copilot/processors/script

For example: For the below dir structure:

js
  --qianba
    -- hello.js
    -- demo.js
    -- config.yaml
  -- foo
    -- bar.js
script
  --qianba
    -- hello.sh
    -- config.yaml

Copilot will try to load js processors from qianba/*.js and script processors from qianba/*.hello and it will also read all those config.yaml. The differences is that each .js many contains many processors but each script processor file just contains only one processor.

name prefix

  • js.[dir].[file].[function] for js processors (js.qianba.hello.hello)
  • spt.[dir].[file] for script processors (spt.qianba.hello)

NOTE

Only processors and processorsInfo sections are approved in config.yaml on external processor dirs

Todo list

  • Ding integration
  • Notification framework
  • Improve app launch
  • Improve processor name match

FAQs

Package last updated on 21 Sep 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc