Skip to content

Latest commit

 

History

History
3183 lines (1971 loc) · 105 KB

API.md

File metadata and controls

3183 lines (1971 loc) · 105 KB

ovos-skill-projen

This projen project template is used to create a new OVOS Skill, which can be used with both OVOS and Neon.AI voice assistants. It can also be used to retrofit an existing MycroftSkill to work with OVOS' most current development practices.

Installing projen

Projen was created by primarily TypeScript developers working in the AWS CDK ecosystem, so it is written in TypeScript and requires Node.js to run.

Generally, it is recommended to use nvm (Node Version Manager) to install Node.js on Linux and macOS. Instructions for installing nvm can be found at github.com/nvm-sh/nvm.

After you've installed Node, projen can be installed globally with:

npm install -g projen

Generally, most projen users alias the npx projen command to pj for convenience. This can be done with:

alias pj='npx projen'

Add that to your ~/.bashrc or ~/.zshrc file to make it permanent. Be sure to run source ~/.bashrc or source ~/.zshrc to reload your shell after adding the line above.

Create a new skill template

In a new directory, run:

npx projen new ovosskill --from "@mikejgray/ovos-skill-projen@latest"

NOTE: This repo is not yet available on NPM. Please add the following to your ~/.npmrc file (create one if it doesn't exist), with a GitHub token that has packages:read permissions:

//npm.pkg.github.com/:_authToken=ghp_aeojghxotdj583r38fgzrh48
@mikejgray:registry=https://npm.pkg.github.com

After the skill has been created with default options, a file called .projenrc.json will be generated. This file contains all of the options used to create the skill, and can be edited to change the skill's configuration. For a full list of supported options, see API.md.

Most commonly, you will want to change the name, author, authorAddress, authorHandle, skillClass, and repositoryUrl options. If you prefer to have an explicitly named directory for your source code instead of the default src, then packageDir should also be set. The type option should be left alone, as it is used to tell projen which project template to use.

Example:

{
  "type": "@mikejgray/ovos-skill-projen.OVOSSkillProject",
  "name": "test-skill",
  "author": "Mike Gray",
  "authorAddress": "[email protected]",
  "authorHandle": "mikejgray",
  "repositoryUrl": "https://github.com/mikejgray/test-skill",
  "packageDir": "test_skill",
  "skillClass": "TestSkill"
}

After editing .projenrc.json, run pj to regenerate the project files. This can automatically keep your project up to date with the latest changes, including managing your setup.py file.

Create a new PHAL plugin template

In a new directory, run:

npx projen new ovosphalproject --from "@mikejgray/ovos-skill-projen@latest"

The instructions are the same as for creating a new skill template, except that you have an additional option to set the PHAL plugin as admin or not. The default is false, indicating that the PHAL plugin will not run as root.

NOTE: If you do set the PHAL plugin to admin and thus run as root, you will also need to update your OVOS config to explicitly allow your root plugins. This is a security risk and should only be done if you understand the implications. For more information about Admin PHAL, see the OVOS technical manual.

Example OVOS config:

{
  "PHAL": {
    "admin": "ovos-phal-plugin-helloworld": {"enabled": true}
  }
}

setup.py ownership

Note that projen takes ownership of the setup.py file, and the expectation is that manual edits are not allowed. If you need to make changes to the setup.py file, you should do so by editing .projenrc.json and running pj to regenerate the file.

Taking manual ownership of the repository

If you prefer not to keep the skill repository under projen's management, simply delete node_modules, .projenrc.json, .gitattributes, .projen, and package.json from the skill directory. You can also delete .github/workflows if you do not want to use GitHub Actions automation workflows.

Retrofitting Mycroft skills (WIP, please open issues if it doesn't work for your use case)

If you have an existing Mycroft skill that you'd like to convert to an OVOS skill, you can do so by running the following command in your skill directory:

projen new ovosskill --from "@mikejgray/ovos-skill-projen@latest" --retrofit

This will:

  • Add the OVOS skill requirements to your requirements.txt file, creating one if it does not exist
  • Overwrite your .gitignore file with a standard Python .gitignore plus node_modules and .DS_Store
  • Create a dev branch, if one does not exist, and commit the changes to it
  • Add all of OVOS' standard GitHub Actions workflows to your .github/workflows directory
  • Move files in ui, intent, dialog, etc. directories to locale, respecting the language folders within
  • Replace Mycroft imports with their OVOS replacements in your __init__.py file, assuming it is in the root of the repo

It will not:

  • Overwrite your README.md file, if it exists, or create one if it does not exist
  • Create sample code
  • Touch your LICENSE file
    • Note that official OVOS and Neon skills have skill license requirements that may not be compatible with your existing license, if you want to submit it as part of one of those organizations. Please review the OVOS skill license requirements. If you are not submitting your skill to OVOS or Neon, you can use any license you like, and should set skillLicenseTest: false in your .projenrc.json file.

Once the retrofit is complete, you can review the changes needed for modernization with grep TODO __init__.py. This project attempts to handle as many as possible, but due to differences in code style and structure, some changes will need to be made manually.

If your skill code is not in __init__.py in the repository root, the retrofit code won't be able to find it. PRs welcome to add support for other skill structures.

API Reference

Structs

OVOSPHALProjectOptions

Initializer

import { OVOSPHALProjectOptions } from '@mikejgray/ovos-skill-projen'

const oVOSPHALProjectOptions: OVOSPHALProjectOptions = { ... }

Properties

Name Type Description
name string This is the name of your project.
commitGenerated boolean Whether to commit the managed files by default.
gitIgnoreOptions projen.IgnoreFileOptions Configuration options for .gitignore file.
gitOptions projen.GitOptions Configuration options for git.
logging projen.LoggerOptions Configure logging options such as verbosity.
outdir string The root directory of the project.
parent projen.Project The parent project, if this project is part of a bigger project.
projenCommand string The shell command to use in order to run the projen CLI.
projenrcJson boolean Generate (once) .projenrc.json (in JSON). Set to false in order to disable .projenrc.json generation.
projenrcJsonOptions projen.ProjenrcJsonOptions Options for .projenrc.json.
renovatebot boolean Use renovatebot to handle dependency upgrades.
renovatebotOptions projen.RenovatebotOptions Options for renovatebot.
autoApproveOptions projen.github.AutoApproveOptions Enable and configure the 'auto approve' workflow.
autoMerge boolean Enable automatic merging on GitHub.
autoMergeOptions projen.github.AutoMergeOptions Configure options for automatic merging on GitHub.
clobber boolean Add a clobber task which resets the repo to origin.
devContainer boolean Add a VSCode development environment (used for GitHub Codespaces).
github boolean Enable GitHub integration.
githubOptions projen.github.GitHubOptions Options for GitHub integration.
gitpod boolean Add a Gitpod development environment.
mergify boolean Whether mergify should be enabled on this repository or not.
mergifyOptions projen.github.MergifyOptions Options for mergify.
projectType projen.ProjectType Which type of project this is (library/app).
projenCredentials projen.github.GithubCredentials Choose a method of providing GitHub API access for projen workflows.
projenTokenSecret string The name of a secret which includes a GitHub Personal Access Token to be used by projen workflows.
readme projen.SampleReadmeProps The README setup.
stale boolean Auto-close of stale issues and pull request.
staleOptions projen.github.StaleOptions Auto-close stale issues and pull requests.
vscode boolean Enable VSCode integration.
author string The name of the skill's author.
authorAddress string The email address of the skill's author.
authorHandle string The GitHub handle of the skill's author.
condenseLocaleFolders boolean Restructure locale folders to be more OVOS-like?
githubWorkflows boolean Add Github Actions workflows?
license string The license of the skill.
packageDir string The name of the directory containing the skill's code.
pypiName string The name of the skill's PyPi package.
repositoryUrl string The URL of the skill's GitHub repository.
retrofit boolean Retrofit an existing Mycroft skill to OVOS?
sampleCode boolean Include sample code?
skillClass string The name of the skill class.
skillDescription string The description of the skill.
skillKeywords string Keywords for your skill package.
skillLicenseTest boolean Include a test to check that the skill's license is FOSS?
admin boolean Is this an admin PHAL plugin?

nameRequired
public readonly name: string;
  • Type: string
  • Default: $BASEDIR

This is the name of your project.


commitGeneratedOptional
public readonly commitGenerated: boolean;
  • Type: boolean
  • Default: true

Whether to commit the managed files by default.


gitIgnoreOptionsOptional
public readonly gitIgnoreOptions: IgnoreFileOptions;
  • Type: projen.IgnoreFileOptions

Configuration options for .gitignore file.


gitOptionsOptional
public readonly gitOptions: GitOptions;
  • Type: projen.GitOptions

Configuration options for git.


loggingOptional
public readonly logging: LoggerOptions;
  • Type: projen.LoggerOptions
  • Default: {}

Configure logging options such as verbosity.


outdirOptional
public readonly outdir: string;
  • Type: string
  • Default: "."

The root directory of the project.

Relative to this directory, all files are synthesized.

If this project has a parent, this directory is relative to the parent directory and it cannot be the same as the parent or any of it's other sub-projects.


parentOptional
public readonly parent: Project;
  • Type: projen.Project

The parent project, if this project is part of a bigger project.


projenCommandOptional
public readonly projenCommand: string;
  • Type: string
  • Default: "npx projen"

The shell command to use in order to run the projen CLI.

Can be used to customize in special environments.


projenrcJsonOptional
public readonly projenrcJson: boolean;
  • Type: boolean
  • Default: false

Generate (once) .projenrc.json (in JSON). Set to false in order to disable .projenrc.json generation.


projenrcJsonOptionsOptional
public readonly projenrcJsonOptions: ProjenrcJsonOptions;
  • Type: projen.ProjenrcJsonOptions
  • Default: default options

Options for .projenrc.json.


renovatebotOptional
public readonly renovatebot: boolean;
  • Type: boolean
  • Default: false

Use renovatebot to handle dependency upgrades.


renovatebotOptionsOptional
public readonly renovatebotOptions: RenovatebotOptions;
  • Type: projen.RenovatebotOptions
  • Default: default options

Options for renovatebot.


autoApproveOptionsOptional
public readonly autoApproveOptions: AutoApproveOptions;
  • Type: projen.github.AutoApproveOptions
  • Default: auto approve is disabled

Enable and configure the 'auto approve' workflow.


autoMergeOptional
public readonly autoMerge: boolean;
  • Type: boolean
  • Default: true

Enable automatic merging on GitHub.

Has no effect if github.mergify is set to false.


autoMergeOptionsOptional
public readonly autoMergeOptions: AutoMergeOptions;
  • Type: projen.github.AutoMergeOptions
  • Default: see defaults in AutoMergeOptions

Configure options for automatic merging on GitHub.

Has no effect if github.mergify or autoMerge is set to false.


clobberOptional
public readonly clobber: boolean;
  • Type: boolean
  • Default: true, but false for subprojects

Add a clobber task which resets the repo to origin.


devContainerOptional
public readonly devContainer: boolean;
  • Type: boolean
  • Default: false

Add a VSCode development environment (used for GitHub Codespaces).


githubOptional
public readonly github: boolean;
  • Type: boolean
  • Default: true

Enable GitHub integration.

Enabled by default for root projects. Disabled for non-root projects.


githubOptionsOptional
public readonly githubOptions: GitHubOptions;
  • Type: projen.github.GitHubOptions
  • Default: see GitHubOptions

Options for GitHub integration.


gitpodOptional
public readonly gitpod: boolean;
  • Type: boolean
  • Default: false

Add a Gitpod development environment.


mergifyOptional
  • Deprecated: use githubOptions.mergify instead
public readonly mergify: boolean;
  • Type: boolean
  • Default: true

Whether mergify should be enabled on this repository or not.


mergifyOptionsOptional
  • Deprecated: use githubOptions.mergifyOptions instead
public readonly mergifyOptions: MergifyOptions;
  • Type: projen.github.MergifyOptions
  • Default: default options

Options for mergify.


projectTypeOptional
  • Deprecated: no longer supported at the base project level
public readonly projectType: ProjectType;
  • Type: projen.ProjectType
  • Default: ProjectType.UNKNOWN

Which type of project this is (library/app).


projenCredentialsOptional
public readonly projenCredentials: GithubCredentials;
  • Type: projen.github.GithubCredentials
  • Default: use a personal access token named PROJEN_GITHUB_TOKEN

Choose a method of providing GitHub API access for projen workflows.


projenTokenSecretOptional
  • Deprecated: use projenCredentials
public readonly projenTokenSecret: string;
  • Type: string
  • Default: "PROJEN_GITHUB_TOKEN"

The name of a secret which includes a GitHub Personal Access Token to be used by projen workflows.

This token needs to have the repo, workflows and packages scope.


readmeOptional
public readonly readme: SampleReadmeProps;
  • Type: projen.SampleReadmeProps
  • Default: { filename: 'README.md', contents: '# replace this' }

The README setup.


Example

"{ filename: 'readme.md', contents: '# title' }"
staleOptional
public readonly stale: boolean;
  • Type: boolean
  • Default: false

Auto-close of stale issues and pull request.

See staleOptions for options.


staleOptionsOptional
public readonly staleOptions: StaleOptions;
  • Type: projen.github.StaleOptions
  • Default: see defaults in StaleOptions

Auto-close stale issues and pull requests.

To disable set stale to false.


vscodeOptional
public readonly vscode: boolean;
  • Type: boolean
  • Default: true

Enable VSCode integration.

Enabled by default for root projects. Disabled for non-root projects.


authorOptional
public readonly author: string;
  • Type: string
  • Default: "TODO: Your Name"

The name of the skill's author.


Example

"Mike Gray"
authorAddressOptional
public readonly authorAddress: string;
  • Type: string
  • Default: "TODO: Your Email"

The email address of the skill's author.


Example

authorHandleOptional
public readonly authorHandle: string;
  • Type: string
  • Default: ""

The GitHub handle of the skill's author.


Example

"mikejgray"
condenseLocaleFoldersOptional
public readonly condenseLocaleFolders: boolean;
  • Type: boolean
  • Default: true

Restructure locale folders to be more OVOS-like?


githubWorkflowsOptional
public readonly githubWorkflows: boolean;
  • Type: boolean
  • Default: true

Add Github Actions workflows?


licenseOptional
public readonly license: string;
  • Type: string
  • Default: Apache-2.0

The license of the skill.


Example

MIT
packageDirOptional
public readonly packageDir: string;
  • Type: string
  • Default: "" (root)

The name of the directory containing the skill's code.


Example

"hello_world_skill"
pypiNameOptional
public readonly pypiName: string;
  • Type: string

The name of the skill's PyPi package.


Example

ovos-hello-world-skill
repositoryUrlOptional
public readonly repositoryUrl: string;
  • Type: string
  • Default: "TODO: PLACEHOLDER"

The URL of the skill's GitHub repository.


Example

"https://github.com/OpenVoiceOS/ovos-hello-world-skill"
retrofitOptional
public readonly retrofit: boolean;
  • Type: boolean
  • Default: false

Retrofit an existing Mycroft skill to OVOS?


sampleCodeOptional
public readonly sampleCode: boolean;
  • Type: boolean
  • Default: true

Include sample code?


skillClassOptional
public readonly skillClass: string;
  • Type: string

The name of the skill class.


Example

HelloWorldSkill
skillDescriptionOptional
public readonly skillDescription: string;
  • Type: string
  • Default: ""

The description of the skill.

Used in setup.py.


Example

"A simple skill that says hello world"
skillKeywordsOptional
public readonly skillKeywords: string;
  • Type: string
  • Default: "ovos skill plugin"

Keywords for your skill package.


skillLicenseTestOptional
public readonly skillLicenseTest: boolean;
  • Type: boolean
  • Default: true

Include a test to check that the skill's license is FOSS?


adminOptional
public readonly admin: boolean;
  • Type: boolean
  • Default: false

Is this an admin PHAL plugin?


OVOSSkillProjectOptions

Initializer

import { OVOSSkillProjectOptions } from '@mikejgray/ovos-skill-projen'

const oVOSSkillProjectOptions: OVOSSkillProjectOptions = { ... }

Properties

Name Type Description
name string This is the name of your project.
commitGenerated boolean Whether to commit the managed files by default.
gitIgnoreOptions projen.IgnoreFileOptions Configuration options for .gitignore file.
gitOptions projen.GitOptions Configuration options for git.
logging projen.LoggerOptions Configure logging options such as verbosity.
outdir string The root directory of the project.
parent projen.Project The parent project, if this project is part of a bigger project.
projenCommand string The shell command to use in order to run the projen CLI.
projenrcJson boolean Generate (once) .projenrc.json (in JSON). Set to false in order to disable .projenrc.json generation.
projenrcJsonOptions projen.ProjenrcJsonOptions Options for .projenrc.json.
renovatebot boolean Use renovatebot to handle dependency upgrades.
renovatebotOptions projen.RenovatebotOptions Options for renovatebot.
autoApproveOptions projen.github.AutoApproveOptions Enable and configure the 'auto approve' workflow.
autoMerge boolean Enable automatic merging on GitHub.
autoMergeOptions projen.github.AutoMergeOptions Configure options for automatic merging on GitHub.
clobber boolean Add a clobber task which resets the repo to origin.
devContainer boolean Add a VSCode development environment (used for GitHub Codespaces).
github boolean Enable GitHub integration.
githubOptions projen.github.GitHubOptions Options for GitHub integration.
gitpod boolean Add a Gitpod development environment.
mergify boolean Whether mergify should be enabled on this repository or not.
mergifyOptions projen.github.MergifyOptions Options for mergify.
projectType projen.ProjectType Which type of project this is (library/app).
projenCredentials projen.github.GithubCredentials Choose a method of providing GitHub API access for projen workflows.
projenTokenSecret string The name of a secret which includes a GitHub Personal Access Token to be used by projen workflows.
readme projen.SampleReadmeProps The README setup.
stale boolean Auto-close of stale issues and pull request.
staleOptions projen.github.StaleOptions Auto-close stale issues and pull requests.
vscode boolean Enable VSCode integration.
author string The name of the skill's author.
authorAddress string The email address of the skill's author.
authorHandle string The GitHub handle of the skill's author.
condenseLocaleFolders boolean Restructure locale folders to be more OVOS-like?
githubWorkflows boolean Add Github Actions workflows?
license string The license of the skill.
packageDir string The name of the directory containing the skill's code.
pypiName string The name of the skill's PyPi package.
repositoryUrl string The URL of the skill's GitHub repository.
retrofit boolean Retrofit an existing Mycroft skill to OVOS?
sampleCode boolean Include sample code?
skillClass string The name of the skill class.
skillDescription string The description of the skill.
skillKeywords string Keywords for your skill package.
skillLicenseTest boolean Include a test to check that the skill's license is FOSS?

nameRequired
public readonly name: string;
  • Type: string
  • Default: $BASEDIR

This is the name of your project.


commitGeneratedOptional
public readonly commitGenerated: boolean;
  • Type: boolean
  • Default: true

Whether to commit the managed files by default.


gitIgnoreOptionsOptional
public readonly gitIgnoreOptions: IgnoreFileOptions;
  • Type: projen.IgnoreFileOptions

Configuration options for .gitignore file.


gitOptionsOptional
public readonly gitOptions: GitOptions;
  • Type: projen.GitOptions

Configuration options for git.


loggingOptional
public readonly logging: LoggerOptions;
  • Type: projen.LoggerOptions
  • Default: {}

Configure logging options such as verbosity.


outdirOptional
public readonly outdir: string;
  • Type: string
  • Default: "."

The root directory of the project.

Relative to this directory, all files are synthesized.

If this project has a parent, this directory is relative to the parent directory and it cannot be the same as the parent or any of it's other sub-projects.


parentOptional
public readonly parent: Project;
  • Type: projen.Project

The parent project, if this project is part of a bigger project.


projenCommandOptional
public readonly projenCommand: string;
  • Type: string
  • Default: "npx projen"

The shell command to use in order to run the projen CLI.

Can be used to customize in special environments.


projenrcJsonOptional
public readonly projenrcJson: boolean;
  • Type: boolean
  • Default: false

Generate (once) .projenrc.json (in JSON). Set to false in order to disable .projenrc.json generation.


projenrcJsonOptionsOptional
public readonly projenrcJsonOptions: ProjenrcJsonOptions;
  • Type: projen.ProjenrcJsonOptions
  • Default: default options

Options for .projenrc.json.


renovatebotOptional
public readonly renovatebot: boolean;
  • Type: boolean
  • Default: false

Use renovatebot to handle dependency upgrades.


renovatebotOptionsOptional
public readonly renovatebotOptions: RenovatebotOptions;
  • Type: projen.RenovatebotOptions
  • Default: default options

Options for renovatebot.


autoApproveOptionsOptional
public readonly autoApproveOptions: AutoApproveOptions;
  • Type: projen.github.AutoApproveOptions
  • Default: auto approve is disabled

Enable and configure the 'auto approve' workflow.


autoMergeOptional
public readonly autoMerge: boolean;
  • Type: boolean
  • Default: true

Enable automatic merging on GitHub.

Has no effect if github.mergify is set to false.


autoMergeOptionsOptional
public readonly autoMergeOptions: AutoMergeOptions;
  • Type: projen.github.AutoMergeOptions
  • Default: see defaults in AutoMergeOptions

Configure options for automatic merging on GitHub.

Has no effect if github.mergify or autoMerge is set to false.


clobberOptional
public readonly clobber: boolean;
  • Type: boolean
  • Default: true, but false for subprojects

Add a clobber task which resets the repo to origin.


devContainerOptional
public readonly devContainer: boolean;
  • Type: boolean
  • Default: false

Add a VSCode development environment (used for GitHub Codespaces).


githubOptional
public readonly github: boolean;
  • Type: boolean
  • Default: true

Enable GitHub integration.

Enabled by default for root projects. Disabled for non-root projects.


githubOptionsOptional
public readonly githubOptions: GitHubOptions;
  • Type: projen.github.GitHubOptions
  • Default: see GitHubOptions

Options for GitHub integration.


gitpodOptional
public readonly gitpod: boolean;
  • Type: boolean
  • Default: false

Add a Gitpod development environment.


mergifyOptional
  • Deprecated: use githubOptions.mergify instead
public readonly mergify: boolean;
  • Type: boolean
  • Default: true

Whether mergify should be enabled on this repository or not.


mergifyOptionsOptional
  • Deprecated: use githubOptions.mergifyOptions instead
public readonly mergifyOptions: MergifyOptions;
  • Type: projen.github.MergifyOptions
  • Default: default options

Options for mergify.


projectTypeOptional
  • Deprecated: no longer supported at the base project level
public readonly projectType: ProjectType;
  • Type: projen.ProjectType
  • Default: ProjectType.UNKNOWN

Which type of project this is (library/app).


projenCredentialsOptional
public readonly projenCredentials: GithubCredentials;
  • Type: projen.github.GithubCredentials
  • Default: use a personal access token named PROJEN_GITHUB_TOKEN

Choose a method of providing GitHub API access for projen workflows.


projenTokenSecretOptional
  • Deprecated: use projenCredentials
public readonly projenTokenSecret: string;
  • Type: string
  • Default: "PROJEN_GITHUB_TOKEN"

The name of a secret which includes a GitHub Personal Access Token to be used by projen workflows.

This token needs to have the repo, workflows and packages scope.


readmeOptional
public readonly readme: SampleReadmeProps;
  • Type: projen.SampleReadmeProps
  • Default: { filename: 'README.md', contents: '# replace this' }

The README setup.


Example

"{ filename: 'readme.md', contents: '# title' }"
staleOptional
public readonly stale: boolean;
  • Type: boolean
  • Default: false

Auto-close of stale issues and pull request.

See staleOptions for options.


staleOptionsOptional
public readonly staleOptions: StaleOptions;
  • Type: projen.github.StaleOptions
  • Default: see defaults in StaleOptions

Auto-close stale issues and pull requests.

To disable set stale to false.


vscodeOptional
public readonly vscode: boolean;
  • Type: boolean
  • Default: true

Enable VSCode integration.

Enabled by default for root projects. Disabled for non-root projects.


authorOptional
public readonly author: string;
  • Type: string
  • Default: "TODO: Your Name"

The name of the skill's author.


Example

"Mike Gray"
authorAddressOptional
public readonly authorAddress: string;
  • Type: string
  • Default: "TODO: Your Email"

The email address of the skill's author.


Example

authorHandleOptional
public readonly authorHandle: string;
  • Type: string
  • Default: ""

The GitHub handle of the skill's author.


Example

"mikejgray"
condenseLocaleFoldersOptional
public readonly condenseLocaleFolders: boolean;
  • Type: boolean
  • Default: true

Restructure locale folders to be more OVOS-like?


githubWorkflowsOptional
public readonly githubWorkflows: boolean;
  • Type: boolean
  • Default: true

Add Github Actions workflows?


licenseOptional
public readonly license: string;
  • Type: string
  • Default: Apache-2.0

The license of the skill.


Example

MIT
packageDirOptional
public readonly packageDir: string;
  • Type: string
  • Default: "" (root)

The name of the directory containing the skill's code.


Example

"hello_world_skill"
pypiNameOptional
public readonly pypiName: string;
  • Type: string

The name of the skill's PyPi package.


Example

ovos-hello-world-skill
repositoryUrlOptional
public readonly repositoryUrl: string;
  • Type: string
  • Default: "TODO: PLACEHOLDER"

The URL of the skill's GitHub repository.


Example

"https://github.com/OpenVoiceOS/ovos-hello-world-skill"
retrofitOptional
public readonly retrofit: boolean;
  • Type: boolean
  • Default: false

Retrofit an existing Mycroft skill to OVOS?


sampleCodeOptional
public readonly sampleCode: boolean;
  • Type: boolean
  • Default: true

Include sample code?


skillClassOptional
public readonly skillClass: string;
  • Type: string

The name of the skill class.


Example

HelloWorldSkill
skillDescriptionOptional
public readonly skillDescription: string;
  • Type: string
  • Default: ""

The description of the skill.

Used in setup.py.


Example

"A simple skill that says hello world"
skillKeywordsOptional
public readonly skillKeywords: string;
  • Type: string
  • Default: "ovos skill plugin"

Keywords for your skill package.


skillLicenseTestOptional
public readonly skillLicenseTest: boolean;
  • Type: boolean
  • Default: true

Include a test to check that the skill's license is FOSS?


Classes

OVOSPHALProject

Initializers

import { OVOSPHALProject } from '@mikejgray/ovos-skill-projen'

new OVOSPHALProject(options: OVOSPHALProjectOptions)
Name Type Description
options OVOSPHALProjectOptions No description.

optionsRequired

Methods

Name Description
addExcludeFromCleanup Exclude the matching files from pre-synth cleanup.
addGitIgnore Adds a .gitignore pattern.
addPackageIgnore Exclude these files from the bundled package.
addTask Adds a new task to this project.
addTip Prints a "tip" message during synthesis.
annotateGenerated Marks the provided file(s) as being generated.
postSynthesize Called after all components are synthesized.
preSynthesize Called before all components are synthesized.
removeTask Removes a task from a project.
runTaskCommand Returns the shell command to execute in order to run a task.
synth Synthesize all project files into outdir.
tryFindFile Finds a file at the specified relative path within this project and all its subprojects.
tryFindJsonFile Finds a json file by name.
tryFindObjectFile Finds an object file (like JsonFile, YamlFile, etc.) by name.
tryRemoveFile Finds a file at the specified relative path within this project and removes it.
addPythonGitIgnore No description.
createDevBranch Create a dev branch if it doesn't already exist, and set it as the default branch.
createGenericSkillCode Create a generic skill with sample code.

addExcludeFromCleanup
public addExcludeFromCleanup(globs: string): void

Exclude the matching files from pre-synth cleanup.

Can be used when, for example, some source files include the projen marker and we don't want them to be erased during synth.

globsRequired
  • Type: string

The glob patterns to match.


addGitIgnore
public addGitIgnore(pattern: string): void

Adds a .gitignore pattern.

patternRequired
  • Type: string

The glob pattern to ignore.


addPackageIgnore
public addPackageIgnore(_pattern: string): void

Exclude these files from the bundled package.

Implemented by project types based on the packaging mechanism. For example, NodeProject delegates this to .npmignore.

_patternRequired
  • Type: string

The glob pattern to exclude.


addTask
public addTask(name: string, props?: TaskOptions): Task

Adds a new task to this project.

This will fail if the project already has a task with this name.

nameRequired
  • Type: string

The task name to add.


propsOptional
  • Type: projen.TaskOptions

Task properties.


addTip
public addTip(message: string): void

Prints a "tip" message during synthesis.

messageRequired
  • Type: string

The message.


annotateGenerated
public annotateGenerated(glob: string): void

Marks the provided file(s) as being generated.

This is achieved using the github-linguist attributes. Generated files do not count against the repository statistics and language breakdown.

https://github.com/github/linguist/blob/master/docs/overrides.md

globRequired
  • Type: string

the glob pattern to match (could be a file path).


postSynthesize
public postSynthesize(): void

Called after all components are synthesized.

Order is not guaranteed.

preSynthesize
public preSynthesize(): void

Called before all components are synthesized.

removeTask
public removeTask(name: string): Task

Removes a task from a project.

nameRequired
  • Type: string

The name of the task to remove.


runTaskCommand
public runTaskCommand(task: Task): string

Returns the shell command to execute in order to run a task.

By default, this is npx projen@<version> <task>

taskRequired
  • Type: projen.Task

The task for which the command is required.


synth
public synth(): void

Synthesize all project files into outdir.

  1. Call "this.preSynthesize()"
  2. Delete all generated files
  3. Synthesize all sub-projects
  4. Synthesize all components of this project
  5. Call "postSynthesize()" for all components of this project
  6. Call "this.postSynthesize()"
tryFindFile
public tryFindFile(filePath: string): FileBase

Finds a file at the specified relative path within this project and all its subprojects.

filePathRequired
  • Type: string

The file path.

If this path is relative, it will be resolved from the root of this project.


tryFindJsonFile
public tryFindJsonFile(filePath: string): JsonFile

Finds a json file by name.

filePathRequired
  • Type: string

The file path.


tryFindObjectFile
public tryFindObjectFile(filePath: string): ObjectFile

Finds an object file (like JsonFile, YamlFile, etc.) by name.

filePathRequired
  • Type: string

The file path.


tryRemoveFile
public tryRemoveFile(filePath: string): FileBase

Finds a file at the specified relative path within this project and removes it.

filePathRequired
  • Type: string

The file path.

If this path is relative, it will be resolved from the root of this project.


addPythonGitIgnore
public addPythonGitIgnore(): void
createDevBranch
public createDevBranch(): void

Create a dev branch if it doesn't already exist, and set it as the default branch.

createGenericSkillCode
public createGenericSkillCode(dir: string): void

Create a generic skill with sample code.

Example

"neon_phal_plugin_audio_receiver"
dirRequired
  • Type: string

The name of the directory to create sample code in.


Properties

Name Type Description
buildTask projen.Task No description.
commitGenerated boolean Whether to commit the managed files by default.
compileTask projen.Task No description.
components projen.Component[] Returns all the components within this project.
deps projen.Dependencies Project dependencies.
ejected boolean Whether or not the project is being ejected.
files projen.FileBase[] All files in this project.
gitattributes projen.GitAttributesFile The .gitattributes file for this repository.
gitignore projen.IgnoreFile .gitignore.
logger projen.Logger Logging utilities.
name string Project name.
outdir string Absolute output directory of this project.
packageTask projen.Task No description.
postCompileTask projen.Task No description.
preCompileTask projen.Task No description.
projectBuild projen.ProjectBuild Manages the build process of the project.
projenCommand string The command to use in order to run the projen CLI.
root projen.Project The root project.
subprojects projen.Project[] Returns all the subprojects within this project.
tasks projen.Tasks Project tasks.
testTask projen.Task No description.
defaultTask projen.Task This is the "default" task, the one that executes "projen".
initProject projen.InitProject The options used when this project is bootstrapped via projen new.
parent projen.Project A parent project.
projectType projen.ProjectType No description.
autoApprove projen.github.AutoApprove Auto approve set up for this project.
devContainer projen.vscode.DevContainer Access for .devcontainer.json (used for GitHub Codespaces).
github projen.github.GitHub Access all github components.
gitpod projen.Gitpod Access for Gitpod.
vscode projen.vscode.VsCode Access all VSCode components.

buildTaskRequired
public readonly buildTask: Task;
  • Type: projen.Task

commitGeneratedRequired
public readonly commitGenerated: boolean;
  • Type: boolean

Whether to commit the managed files by default.


compileTaskRequired
public readonly compileTask: Task;
  • Type: projen.Task

componentsRequired
public readonly components: Component[];
  • Type: projen.Component[]

Returns all the components within this project.


depsRequired
public readonly deps: Dependencies;
  • Type: projen.Dependencies

Project dependencies.


ejectedRequired
public readonly ejected: boolean;
  • Type: boolean

Whether or not the project is being ejected.


filesRequired
public readonly files: FileBase[];
  • Type: projen.FileBase[]

All files in this project.


gitattributesRequired
public readonly gitattributes: GitAttributesFile;
  • Type: projen.GitAttributesFile

The .gitattributes file for this repository.


gitignoreRequired
public readonly gitignore: IgnoreFile;
  • Type: projen.IgnoreFile

.gitignore.


loggerRequired
public readonly logger: Logger;
  • Type: projen.Logger

Logging utilities.


nameRequired
public readonly name: string;
  • Type: string

Project name.


outdirRequired
public readonly outdir: string;
  • Type: string

Absolute output directory of this project.


packageTaskRequired
public readonly packageTask: Task;
  • Type: projen.Task

postCompileTaskRequired
public readonly postCompileTask: Task;
  • Type: projen.Task

preCompileTaskRequired
public readonly preCompileTask: Task;
  • Type: projen.Task

projectBuildRequired
public readonly projectBuild: ProjectBuild;
  • Type: projen.ProjectBuild

Manages the build process of the project.


projenCommandRequired
public readonly projenCommand: string;
  • Type: string

The command to use in order to run the projen CLI.


rootRequired
public readonly root: Project;
  • Type: projen.Project

The root project.


subprojectsRequired
public readonly subprojects: Project[];
  • Type: projen.Project[]

Returns all the subprojects within this project.


tasksRequired
public readonly tasks: Tasks;
  • Type: projen.Tasks

Project tasks.


testTaskRequired
public readonly testTask: Task;
  • Type: projen.Task

defaultTaskOptional
public readonly defaultTask: Task;
  • Type: projen.Task

This is the "default" task, the one that executes "projen".

Undefined if the project is being ejected.


initProjectOptional
public readonly initProject: InitProject;
  • Type: projen.InitProject

The options used when this project is bootstrapped via projen new.

It includes the original set of options passed to the CLI and also the JSII FQN of the project type.


parentOptional
public readonly parent: Project;
  • Type: projen.Project

A parent project.

If undefined, this is the root project.


projectTypeRequired
public readonly projectType: ProjectType;
  • Type: projen.ProjectType

autoApproveOptional
public readonly autoApprove: AutoApprove;
  • Type: projen.github.AutoApprove

Auto approve set up for this project.


devContainerOptional
public readonly devContainer: DevContainer;
  • Type: projen.vscode.DevContainer

Access for .devcontainer.json (used for GitHub Codespaces).

This will be undefined if devContainer boolean is false


githubOptional
public readonly github: GitHub;
  • Type: projen.github.GitHub

Access all github components.

This will be undefined for subprojects.


gitpodOptional
public readonly gitpod: Gitpod;
  • Type: projen.Gitpod

Access for Gitpod.

This will be undefined if gitpod boolean is false


vscodeOptional
public readonly vscode: VsCode;
  • Type: projen.vscode.VsCode

Access all VSCode components.

This will be undefined for subprojects.


Constants

Name Type Description
DEFAULT_TASK string The name of the default task (the task executed when projen is run without arguments).

DEFAULT_TASKRequired
public readonly DEFAULT_TASK: string;
  • Type: string

The name of the default task (the task executed when projen is run without arguments).

Normally this task should synthesize the project files.


OVOSSkillProject

Initializers

import { OVOSSkillProject } from '@mikejgray/ovos-skill-projen'

new OVOSSkillProject(options: OVOSSkillProjectOptions)
Name Type Description
options OVOSSkillProjectOptions No description.

optionsRequired

Methods

Name Description
addExcludeFromCleanup Exclude the matching files from pre-synth cleanup.
addGitIgnore Adds a .gitignore pattern.
addPackageIgnore Exclude these files from the bundled package.
addTask Adds a new task to this project.
addTip Prints a "tip" message during synthesis.
annotateGenerated Marks the provided file(s) as being generated.
postSynthesize Called after all components are synthesized.
preSynthesize Called before all components are synthesized.
removeTask Removes a task from a project.
runTaskCommand Returns the shell command to execute in order to run a task.
synth Synthesize all project files into outdir.
tryFindFile Finds a file at the specified relative path within this project and all its subprojects.
tryFindJsonFile Finds a json file by name.
tryFindObjectFile Finds an object file (like JsonFile, YamlFile, etc.) by name.
tryRemoveFile Finds a file at the specified relative path within this project and removes it.
addPythonGitIgnore Add a Python .gitignore file.
createDevBranch Create a dev branch if it doesn't already exist, and set it as the default branch.
createGenericSkillCode Create a generic skill with sample code.
createGithubWorkflows Create OVOS standard Github Actions workflows.
restructureLocaleFolders Restructure locale folders to be more OVOS-like.

addExcludeFromCleanup
public addExcludeFromCleanup(globs: string): void

Exclude the matching files from pre-synth cleanup.

Can be used when, for example, some source files include the projen marker and we don't want them to be erased during synth.

globsRequired
  • Type: string

The glob patterns to match.


addGitIgnore
public addGitIgnore(pattern: string): void

Adds a .gitignore pattern.

patternRequired
  • Type: string

The glob pattern to ignore.


addPackageIgnore
public addPackageIgnore(_pattern: string): void

Exclude these files from the bundled package.

Implemented by project types based on the packaging mechanism. For example, NodeProject delegates this to .npmignore.

_patternRequired
  • Type: string

The glob pattern to exclude.


addTask
public addTask(name: string, props?: TaskOptions): Task

Adds a new task to this project.

This will fail if the project already has a task with this name.

nameRequired
  • Type: string

The task name to add.


propsOptional
  • Type: projen.TaskOptions

Task properties.


addTip
public addTip(message: string): void

Prints a "tip" message during synthesis.

messageRequired
  • Type: string

The message.


annotateGenerated
public annotateGenerated(glob: string): void

Marks the provided file(s) as being generated.

This is achieved using the github-linguist attributes. Generated files do not count against the repository statistics and language breakdown.

https://github.com/github/linguist/blob/master/docs/overrides.md

globRequired
  • Type: string

the glob pattern to match (could be a file path).


postSynthesize
public postSynthesize(): void

Called after all components are synthesized.

Order is not guaranteed.

preSynthesize
public preSynthesize(): void

Called before all components are synthesized.

removeTask
public removeTask(name: string): Task

Removes a task from a project.

nameRequired
  • Type: string

The name of the task to remove.


runTaskCommand
public runTaskCommand(task: Task): string

Returns the shell command to execute in order to run a task.

By default, this is npx projen@<version> <task>

taskRequired
  • Type: projen.Task

The task for which the command is required.


synth
public synth(): void

Synthesize all project files into outdir.

  1. Call "this.preSynthesize()"
  2. Delete all generated files
  3. Synthesize all sub-projects
  4. Synthesize all components of this project
  5. Call "postSynthesize()" for all components of this project
  6. Call "this.postSynthesize()"
tryFindFile
public tryFindFile(filePath: string): FileBase

Finds a file at the specified relative path within this project and all its subprojects.

filePathRequired
  • Type: string

The file path.

If this path is relative, it will be resolved from the root of this project.


tryFindJsonFile
public tryFindJsonFile(filePath: string): JsonFile

Finds a json file by name.

filePathRequired
  • Type: string

The file path.


tryFindObjectFile
public tryFindObjectFile(filePath: string): ObjectFile

Finds an object file (like JsonFile, YamlFile, etc.) by name.

filePathRequired
  • Type: string

The file path.


tryRemoveFile
public tryRemoveFile(filePath: string): FileBase

Finds a file at the specified relative path within this project and removes it.

filePathRequired
  • Type: string

The file path.

If this path is relative, it will be resolved from the root of this project.


addPythonGitIgnore
public addPythonGitIgnore(): void

Add a Python .gitignore file.

createDevBranch
public createDevBranch(): void

Create a dev branch if it doesn't already exist, and set it as the default branch.

createGenericSkillCode
public createGenericSkillCode(dir: string): void

Create a generic skill with sample code.

Example

"hello_world_skill"
dirRequired
  • Type: string

The name of the directory to create sample code in.


createGithubWorkflows
public createGithubWorkflows(skillLicenseTest: boolean): void

Create OVOS standard Github Actions workflows.

skillLicenseTestRequired
  • Type: boolean

restructureLocaleFolders
public restructureLocaleFolders(sourceFolder: string): void

Restructure locale folders to be more OVOS-like.

sourceFolderRequired
  • Type: string

The name of the directory containing the Mycroft skill's code.


Static Functions

Name Description
modernizeSkillCode Load a Mycroft skill Python file and modernize it for OVOS.

modernizeSkillCode
import { OVOSSkillProject } from '@mikejgray/ovos-skill-projen'

OVOSSkillProject.modernizeSkillCode(file: string)

Load a Mycroft skill Python file and modernize it for OVOS.

fileRequired
  • Type: string

The file to modernize.


Properties

Name Type Description
buildTask projen.Task No description.
commitGenerated boolean Whether to commit the managed files by default.
compileTask projen.Task No description.
components projen.Component[] Returns all the components within this project.
deps projen.Dependencies Project dependencies.
ejected boolean Whether or not the project is being ejected.
files projen.FileBase[] All files in this project.
gitattributes projen.GitAttributesFile The .gitattributes file for this repository.
gitignore projen.IgnoreFile .gitignore.
logger projen.Logger Logging utilities.
name string Project name.
outdir string Absolute output directory of this project.
packageTask projen.Task No description.
postCompileTask projen.Task No description.
preCompileTask projen.Task No description.
projectBuild projen.ProjectBuild Manages the build process of the project.
projenCommand string The command to use in order to run the projen CLI.
root projen.Project The root project.
subprojects projen.Project[] Returns all the subprojects within this project.
tasks projen.Tasks Project tasks.
testTask projen.Task No description.
defaultTask projen.Task This is the "default" task, the one that executes "projen".
initProject projen.InitProject The options used when this project is bootstrapped via projen new.
parent projen.Project A parent project.
projectType projen.ProjectType No description.
autoApprove projen.github.AutoApprove Auto approve set up for this project.
devContainer projen.vscode.DevContainer Access for .devcontainer.json (used for GitHub Codespaces).
github projen.github.GitHub Access all github components.
gitpod projen.Gitpod Access for Gitpod.
vscode projen.vscode.VsCode Access all VSCode components.

buildTaskRequired
public readonly buildTask: Task;
  • Type: projen.Task

commitGeneratedRequired
public readonly commitGenerated: boolean;
  • Type: boolean

Whether to commit the managed files by default.


compileTaskRequired
public readonly compileTask: Task;
  • Type: projen.Task

componentsRequired
public readonly components: Component[];
  • Type: projen.Component[]

Returns all the components within this project.


depsRequired
public readonly deps: Dependencies;
  • Type: projen.Dependencies

Project dependencies.


ejectedRequired
public readonly ejected: boolean;
  • Type: boolean

Whether or not the project is being ejected.


filesRequired
public readonly files: FileBase[];
  • Type: projen.FileBase[]

All files in this project.


gitattributesRequired
public readonly gitattributes: GitAttributesFile;
  • Type: projen.GitAttributesFile

The .gitattributes file for this repository.


gitignoreRequired
public readonly gitignore: IgnoreFile;
  • Type: projen.IgnoreFile

.gitignore.


loggerRequired
public readonly logger: Logger;
  • Type: projen.Logger

Logging utilities.


nameRequired
public readonly name: string;
  • Type: string

Project name.


outdirRequired
public readonly outdir: string;
  • Type: string

Absolute output directory of this project.


packageTaskRequired
public readonly packageTask: Task;
  • Type: projen.Task

postCompileTaskRequired
public readonly postCompileTask: Task;
  • Type: projen.Task

preCompileTaskRequired
public readonly preCompileTask: Task;
  • Type: projen.Task

projectBuildRequired
public readonly projectBuild: ProjectBuild;
  • Type: projen.ProjectBuild

Manages the build process of the project.


projenCommandRequired
public readonly projenCommand: string;
  • Type: string

The command to use in order to run the projen CLI.


rootRequired
public readonly root: Project;
  • Type: projen.Project

The root project.


subprojectsRequired
public readonly subprojects: Project[];
  • Type: projen.Project[]

Returns all the subprojects within this project.


tasksRequired
public readonly tasks: Tasks;
  • Type: projen.Tasks

Project tasks.


testTaskRequired
public readonly testTask: Task;
  • Type: projen.Task

defaultTaskOptional
public readonly defaultTask: Task;
  • Type: projen.Task

This is the "default" task, the one that executes "projen".

Undefined if the project is being ejected.


initProjectOptional
public readonly initProject: InitProject;
  • Type: projen.InitProject

The options used when this project is bootstrapped via projen new.

It includes the original set of options passed to the CLI and also the JSII FQN of the project type.


parentOptional
public readonly parent: Project;
  • Type: projen.Project

A parent project.

If undefined, this is the root project.


projectTypeRequired
public readonly projectType: ProjectType;
  • Type: projen.ProjectType

autoApproveOptional
public readonly autoApprove: AutoApprove;
  • Type: projen.github.AutoApprove

Auto approve set up for this project.


devContainerOptional
public readonly devContainer: DevContainer;
  • Type: projen.vscode.DevContainer

Access for .devcontainer.json (used for GitHub Codespaces).

This will be undefined if devContainer boolean is false


githubOptional
public readonly github: GitHub;
  • Type: projen.github.GitHub

Access all github components.

This will be undefined for subprojects.


gitpodOptional
public readonly gitpod: Gitpod;
  • Type: projen.Gitpod

Access for Gitpod.

This will be undefined if gitpod boolean is false


vscodeOptional
public readonly vscode: VsCode;
  • Type: projen.vscode.VsCode

Access all VSCode components.

This will be undefined for subprojects.


Constants

Name Type Description
DEFAULT_TASK string The name of the default task (the task executed when projen is run without arguments).

DEFAULT_TASKRequired
public readonly DEFAULT_TASK: string;
  • Type: string

The name of the default task (the task executed when projen is run without arguments).

Normally this task should synthesize the project files.