Skills

A Skill is a descrete piece of functionality that includes the full stack of an application. It’s a way to encapsulate a feature or set of features that can easily be deployed, installed, updated, configured, removed, etc.

Skill Lifecycle

To start, your Skill is only a BootLoader that looks for Features. Features map closely to the Concepts. Your Skill starts with no Features and the SpruceCLI installs them for you as you need them.

Folder Structure

Folder/FilePurpose
.vscodeVS Code workspace settings, tasks, and recommended extensions for the project.
buildCompiled TypeScript output. Tests run against built code for speed.
node_modulesInstalled npm/yarn dependencies.
srcSource code root directory.
src/__tests__Test files organized into behavioral and implementation subdirectories.
src/.spruceAuto-generated Spruce files including combined schemas, events, errors, and type definitions. Do not edit manually.
src/errorsCustom error definitions using SpruceError. Created via spruce create.error.
src/listenersEvent listeners that respond to Mercury events. Created via spruce create.listener.
src/permissionsPermission contracts defining access controls for your skill. Created via spruce create.permission.
src/schemasSchema definitions for data structures. Created via spruce create.schema.
src/skillViewControllersSkill-level view controllers (full pages/screens). Created via spruce create.view.
src/storesData store definitions for database operations. Created via spruce create.store.
src/viewControllersReusable view controllers (components). Created via spruce create.view.
src/viewPluginsView controller plugins for extending VC functionality. Created via spruce create.view.plugin.
.editorconfigEditor configuration ensuring consistent coding style across IDEs.
.eslintcacheESLint cache file for faster subsequent linting runs.
.npmignoreSpecifies files to exclude when publishing to npm.
.nvmrcSpecifies the Node.js version for the project. Use nvm use to switch.
eslint.config.mjsESLint configuration for code linting rules.
package.jsonnpm package manifest with dependencies, scripts, and metadata.
README.mdProject documentation and getting started guide.
tsconfig.jsonTypeScript compiler configuration.

Creating your Skill

When you’re ready to start building a new Skill, you can use the SpruceCLI to generate the Skill scaffolding.

spruce create.skill [directory]

Note: If you don’t provide a directory, the Skill will be created in the current directory.

Booting your Skill

If you want to boot your Skill in a local environment, you can use the boot command.

spruce boot

Registering your skill

If your skill uses an Events, Listeners or Views, you’ll need to register it with Mercury.

spruce register

Note: You will need to log into your personal account to register your skill. You can login using spruce login.

Listening to Skill Boot Events

The Event Feature allows you to listen to 2 events that are emitted during the boot process:

  1. will-boot - Fired ASAP when the skill is booted.
  2. did-boot - Fired after all features have booted.

You can add your listener by running:

spruce create.listener

Something Missing?

Request Documentation Enhancement
It looks like you are using Internet Explorer. While the basic content is available, this is no longer a supported browser by the manufacturer, and no attention is being given to having IE work well here.