Product
Introducing Enhanced Alert Actions and Triage Functionality
Socket now supports four distinct alert actions instead of the previous two, and alert triaging allows users to override the actions taken for all individual alerts.
makitso
Advanced tools
Readme
A Framework for building composable interactive commandline apps.
The goal is to have a framework that can be used to build a single customised commandline app that developers in an organisation can easily install and use to do common tasks, hopefully without much instruction.
To that end, Makitso allows a nested command structure, suggestions and auto-complete for commands and arguments, and prompting and storage of configuration properties specific to the user (or app, workspace, etc).
Makitso plugin modules can be used to define commands, context (config) schema, and storage options. Once defined, context values can be used by commands from other plugins. If a value is not set the user is prompted to provide it. Once set, the value can be used as a default answer to a prompt, or returned to the command directly, depending on it's configuration.
The schema defines context properties, the storage to use, and a prompt for collecting the value of the property. Property values are stored in the memory, file, or keychain stores for immediate and later use. When an unset value is requested by a command action the user is prompted for the required value and it is stored in context and returned to the action.
{
schema: {
my: {
name: {
store: "file",
ask: {
header: `We'll only ask once..`,
prompt: `{variant} name> `,
footer: `Run this command again when you're done.`
}
}
}
}
}
Commands define the arguments and options format, help description, an action function, and optional suggest function for autocomplete.
Commands can be nested to allow grouping commands as sub-commands. Suggestions and auto-complete are supported for each of the command levels.
Commands can also provide a "suggest" function which will allow autocomplete to provide available options for the command.
Command action functions receive context & input objects which gives access to properties handled by other plugins and the current command on the commandline. If a required property has not already been set then the plugin which is handling it will prompt the user to enter it and then return the entered value.
arguments
define the positional command arguments. The last argument may be
[optional]
, a list..
, or [both...]
.
description
is displayed as part of the help
command and as inline helpers
in the input prompts.
action
is the code to run when the command is used. It receives an object as
it's only arg, containing the context instance and an input object containing
the command arguments and options entered. It can get and set context properties
defined in the context schema and run custom code to get stuff done.
suggest
recieves the same argiments as action
and returns a list of commands
or arguments which are displayed to the user. This list is later filtered using
the partial command or argument entered by the user. Auto-complete can be triggered
by the user with the tab key.
const Makitso = require("makitso");
const commands = {
up: {
description: "Bring up one or more services with docker compose",
arguments: ["services... - the service/s to bring up"],
action: async ({ context, input }) => {
const services = input.args.services.join(" ");
console.log(`shelljs.exec docker-compose up -d ${services}`);
},
suggest: async ({ context, input }) => {
// read and parse docker-compose.yml and return the services keys
return ["foo", "bar", "baz"];
}
},
down: {
description: "Bring down the stack",
action: async ({ context, input }) => {
console.log(`shelljs.exec docker-compose down`);
}
}
};
const myMakitsoPlugin = { commands };
Makitso({ plugins: myMakitsoPlugin }).catch(console.error);
See examples for examples of different Makitso features.
$ yarn global add makitso
$ makitso
FAQs
A Framework for building composable interactive commandline apps
The npm package makitso receives a total of 5 weekly downloads. As such, makitso popularity was classified as not popular.
We found that makitso demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Product
Socket now supports four distinct alert actions instead of the previous two, and alert triaging allows users to override the actions taken for all individual alerts.
Security News
Polyfill.io has been serving malware for months via its CDN, after the project's open source maintainer sold the service to a company based in China.
Security News
OpenSSF is warning open source maintainers to stay vigilant against reputation farming on GitHub, where users artificially inflate their status by manipulating interactions on closed issues and PRs.