@moostjs/event-cli
v0.6.31
Published
@moostjs/event-cli
Maintainers
Readme
@moostjs/event-cli
Welcome to @moostjs/event-cli, a Moostjs library designed to handle CLI events within your Moost application. This package provides decorators that simplify the creation of command line interface handlers in a structured and declarative manner.
Note: As @moostjs/event-cli is under active development, breaking changes can be expected.
Overview
The @moostjs/event-cli module is crucial for making Moost applications responsive to CLI events. By leveraging this module, you can create handlers for these events in a structured, and clear manner.
Installation
npm install @moostjs/event-cliQuick Start
import { CliApp, Cli, CliOption, Controller, Param } from '@moostjs/event-cli'
@Controller()
class Commands {
@Cli('hello/:name')
greet(
@Param('name') name: string,
@CliOption('uppercase', 'u') uppercase: boolean,
) {
const output = `Hello, ${name}!`
return uppercase ? output.toUpperCase() : output
}
}
new CliApp()
.controllers(Commands)
.useHelp({ name: 'my-cli' })
.useOptions([{ keys: ['help'], description: 'Display instructions for the command.' }])
.start()my-cli hello World # → Hello, World!
my-cli hello World -u # → HELLO, WORLD!
my-cli hello --help # → generated help outputSee the official documentation for commands, options, controllers, the help system, and interceptors.
Getting Started
To start a new Moost CLI project, you can run the following command:
npm create moost -- --cliYou can also provide a name for your project:
npm create moost my-cli-app -- --cliThis command will initiate a setup tool that will guide you through the project initialization process. It will prompt you to configure:
- Project and package name.
- Whether to add OXC lint and formatter (oxlint + oxfmt).
Official Documentation
AI Agent Skills
A unified Moost skill for AI coding agents (Claude Code, Cursor, Windsurf, Codex, etc.) is available:
npx skills add moostjs/moostjsContributing
We are excited to welcome contributors who are passionate about improving Moostjs. No matter your level of experience, your unique perspective and skills can make valuable contributions to our growing community.
Here are some basic steps to get you started:
Fork the Repo: Navigate to moostjs and fork the repository to your own GitHub account.
Clone the Repo: Clone the forked repository to your local machine.
Create a Branch: Make a new branch for your feature or bug fix.
Make your Changes: Implement your feature or fix the bug and commit the changes to your branch.
Make a Pull Request: Navigate back to your forked repo and press the "New pull request" button.
Don't hesitate to ask for help if you need it. We believe in fostering a friendly and respectful environment for all contributors.
Thank you for your interest in Moostjs. We look forward to building something amazing together!
