Nikita "core" package
The core
package provides the Nikita engine and the core Nikita actions and plugins.
Documentation
The Nikita website covers:
- The API created by this package
- several guides to learn the Foundamental concepts.
- The actions registered in this package.
Architecture
The package is composed of:
- The core engine:
- The package entry point to instantiate Nikita sessions loaded with plugins and which register the actions present in this package.
- The session module which is the internal engine.
- The registry module to associate action names to modules.
- The scheduler to orchestrate the execution of actions and their children.
- The register script to register the package's actions.
- Foundamental actions covering:
- Basic actions such as
assert
,call
andwait
. - Execute actions to interact with Unix commands and process.
- SSH related actions.
- Filesystem related actions.
- Basic actions such as
- Plugins which extends Nikita in various ways such as:
- Assertions to validate action behavior.
- Conditions to enable and disable action execution.
- Metadata to modify action's behaviors.
- Tools to provide usefull data and functions to actions.
Usage
Nikita is commonly imported by refering to the nikita
package. However, it will load a lot of actions which are potentially not necessary. By using the core
package directly, you reduce your dependencies and the number of modules loaded in your Node.js process.
To import the module:
const nikita = require('@nikitajs/core');
Then, call the register
scripts to register additionnal actions, for example the lxd
actions:
require('@nikitajs/lxd/lib/register');
Following this example, you can now use any action present in the core
and the lxd
packages:
// Use the `execute` action from the `core` package
const {
stdout: whoami
} = await nikita.execute('whoami', { trim: true });
// Use the `lxc.init` action from the `lxd` package
nikita.lxc.init({
image: 'images:alpine/3.13',
container: `nikita-${whoami}`
});
Actions
- assert
- call
- execute.assert
- execute.wait
- fs.base.chmod
- fs.base.chown
- fs.base.copy
- fs.base.createReadStream
- fs.base.createWriteStream
- fs.base.exists
- fs.base.lstat
- fs.base.mkdir
- fs.base.readdir
- fs.base.readFile
- fs.base.readlink
- fs.base.rename
- fs.base.rmdir
- fs.base.stat
- fs.base.symlink
- fs.base.unlink
- fs.base.writeFile
- fs.assert
- fs.chmod
- fs.chown
- fs.copy
- fs.glob
- fs.hash
- fs.link
- fs.mkdir
- fs.move
- fs.remove
- fs.wait
- ssh.open
- ssh.close
- ssh.root
- wait
- execute