oclif: The Open CLI Framework
  • Getting Started
  • API Reference
  • Blog
  • GitHub

›Architecture

Getting Started

  • Introduction
  • Features
  • FAQs
  • Generator Commands

Architecture

  • Command Execution
  • Plugin Loading

API Reference

  • Commands
  • Command Arguments
  • Command Flags
  • Configuration
  • Topics
  • Topic Separators
  • Hooks
  • Plugins
  • Help Classes
  • Error Handling
  • JSON

How to

  • Release
  • Testing
  • Running Commands Programmatically
  • Aliases
  • Custom Base Class
  • Prompting
  • Spinner
  • Table
  • Notifications
  • Debugging
  • Flexible Taxonomy
  • Global Flags
  • Single Command CLI
  • ESM

Also See

  • Examples
  • External Links
  • Related Repositories
  • How We Work
  • Feedback
Edit

Plugin Loading

Below is a diagram that outlines how a plugin is loaded into the CLI.

There are a couple of important takeaways from this diagram:

Plugin Resolution Order

Plugins are resolved in the following order:

  1. User plugins (i.e. plugins installed by the users)
  2. Dev plugins (i.e. plugins listed under devPlugins)
  3. Core plugins (i.e. plugins listed under plugins)

Manifests Improve Performance

When loading a plugin, oclif needs to require each command file in order to get the static properties of the command - the description, examples, flags, etc...

However, oclif can skip this step if the plugin has an oclif.manifest.json (generated by oclif manifest). The manifest caches all of these properties so that there's no need to require every single command on every command execution.

Plugin Loading Diagram

plugin loading

Last updated on 2/22/2023
← Command ExecutionCommands →
Made with 💜 by Salesforce — MIT License