nocobase-app-plugin-cli-example

Implements oclif-based CLI commands contributed by a NocoBase application plugin.

9|3|Updated Aug 14, 2026
One-click install
npx skills add https://github.com/nocobase/nocobase3 --skill nocobase-app-plugin-cli-example-nocobase
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: nocobase-app-plugin-cli-example
Source: https://github.com/nocobase/nocobase3/tree/main/packages/examples/app-plugin-cli-example/skills/nocobase-app-plugin-cli-example
Command: npx skills add https://github.com/nocobase/nocobase3 --skill nocobase-app-plugin-cli-example-nocobase

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires @oclif/core.

What problem does it solve? Adding custom commands to a NocoBase application's nocobase CLI requires understanding how plugins expose a ./cli entry, how topics are registered, and how oclif commands are assembled into one command tree. This Skill provides the reference implementation and rules for doing that correctly. ## Core Features & Use Cases - Command authoring: Write oclif Command subclasses with args, flags, examples, and --json output conventions. - CLI plugin entry: Use defineCliPlugin to declare a topic and map sub-command names (including colon-nested names like artifact:build) to command classes. - Manifest setup: Configure package.json exports for ./cli and declare @oclif/core as a peer dependency so the plugin and application share one copy. - Use Case: You are building a NocoBase plugin that needs a nocobase demo greet command. Follow this Skill to create the command class, wire it into cli/index.ts, register the plugin in the application's cli/plugins.ts, and verify it with pnpm nocobase demo --help. ## Quick Start Ask the assistant to scaffold a new oclif command for your NocoBase plugin and register it under a topic in the application's nocobase CLI.

Frequently Asked Questions about nocobase-app-plugin-cli-example

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I add a custom command to the NocoBase CLI from a plugin?▼

Create an oclif Command subclass, then export a ./cli entry that calls defineCliPlugin with a topic and a commands map. Register the plugin in the application's cli/plugins.ts, and the command appears under pnpm nocobase <topic> <command>.

How do I nest sub-commands in an oclif CLI plugin?▼

Use a colon in the command map key, such as 'artifact:build'. This nests the command one level deeper, so it runs as nocobase demo artifact build instead of a flat sub-command.

Why is @oclif/core a peer dependency in a CLI plugin?▼

Declaring @oclif/core as a peer dependency makes the plugin and the application share one copy, keeping help rendering and flag parsing consistent. The devDependency pins the version used inside the workspace.

Why is my plugin command missing from nocobase --help?▼

A missing command usually means the plugin is absent from the application's cli/plugins.ts registration file. Run pnpm plugin:inspect <name> --json and check the composition.cli field to confirm registration.

Can NocoBase CLI commands access the database or application services?▼

No. Plugin CLI commands are static: they operate on files and packages only. They do not start the application, connect to the database, or resolve services from the container.