@moostjs/event-cli 0.6.24 → 0.6.26
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +41 -17
- package/dist/index.cjs +0 -2
- package/dist/index.mjs +0 -2
- package/package.json +5 -5
package/README.md
CHANGED
|
@@ -15,6 +15,44 @@ Welcome to `@moostjs/event-cli`, a Moostjs library designed to handle CLI events
|
|
|
15
15
|
|
|
16
16
|
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.
|
|
17
17
|
|
|
18
|
+
## Installation
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
npm install @moostjs/event-cli
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## Quick Start
|
|
25
|
+
|
|
26
|
+
```ts
|
|
27
|
+
import { CliApp, Cli, CliOption, Controller, Param } from '@moostjs/event-cli'
|
|
28
|
+
|
|
29
|
+
@Controller()
|
|
30
|
+
class Commands {
|
|
31
|
+
@Cli('hello/:name')
|
|
32
|
+
greet(
|
|
33
|
+
@Param('name') name: string,
|
|
34
|
+
@CliOption('uppercase', 'u') uppercase: boolean,
|
|
35
|
+
) {
|
|
36
|
+
const output = `Hello, ${name}!`
|
|
37
|
+
return uppercase ? output.toUpperCase() : output
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
new CliApp()
|
|
42
|
+
.controllers(Commands)
|
|
43
|
+
.useHelp({ name: 'my-cli' })
|
|
44
|
+
.useOptions([{ keys: ['help'], description: 'Display instructions for the command.' }])
|
|
45
|
+
.start()
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
my-cli hello World # → Hello, World!
|
|
50
|
+
my-cli hello World -u # → HELLO, WORLD!
|
|
51
|
+
my-cli hello --help # → generated help output
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
See the [official documentation](https://moost.org/cliapp/) for commands, options, controllers, the help system, and interceptors.
|
|
55
|
+
|
|
18
56
|
## Getting Started
|
|
19
57
|
|
|
20
58
|
To start a new Moost CLI project, you can run the following command:
|
|
@@ -32,30 +70,16 @@ npm create moost my-cli-app -- --cli
|
|
|
32
70
|
This command will initiate a setup tool that will guide you through the project initialization process. It will prompt you to configure:
|
|
33
71
|
|
|
34
72
|
- Project and package name.
|
|
35
|
-
- Whether to add
|
|
73
|
+
- Whether to add OXC lint and formatter (oxlint + oxfmt).
|
|
36
74
|
|
|
37
75
|
## [Official Documentation](https://moost.org/cliapp/)
|
|
38
76
|
|
|
39
77
|
## AI Agent Skills
|
|
40
78
|
|
|
41
|
-
|
|
79
|
+
A unified Moost skill for AI coding agents (Claude Code, Cursor, Windsurf, Codex, etc.) is available:
|
|
42
80
|
|
|
43
81
|
```bash
|
|
44
|
-
|
|
45
|
-
npx moostjs-event-cli-skill
|
|
46
|
-
|
|
47
|
-
# Global (available across all your projects)
|
|
48
|
-
npx moostjs-event-cli-skill --global
|
|
49
|
-
```
|
|
50
|
-
|
|
51
|
-
To keep skills automatically up-to-date, add a postinstall script to your `package.json`:
|
|
52
|
-
|
|
53
|
-
```json
|
|
54
|
-
{
|
|
55
|
-
"scripts": {
|
|
56
|
-
"postinstall": "moostjs-event-cli-skill --postinstall"
|
|
57
|
-
}
|
|
58
|
-
}
|
|
82
|
+
npx skills add moostjs/moostjs
|
|
59
83
|
```
|
|
60
84
|
|
|
61
85
|
## Contributing
|
package/dist/index.cjs
CHANGED
|
@@ -109,7 +109,6 @@ function _define_property$1(obj, key, value) {
|
|
|
109
109
|
return obj;
|
|
110
110
|
}
|
|
111
111
|
const LOGGER_TITLE = "moost-cli";
|
|
112
|
-
const CONTEXT_TYPE = "CLI";
|
|
113
112
|
/**
|
|
114
113
|
* ## Moost Cli Adapter
|
|
115
114
|
*
|
|
@@ -168,7 +167,6 @@ const CONTEXT_TYPE = "CLI";
|
|
|
168
167
|
const makePath = (p) => `${prefix}/${p}`.replaceAll(/\/\/+/g, "/").replaceAll(/\/\\:/g, "\\:").replaceAll(/^\/+/g, "");
|
|
169
168
|
const targetPath = makePath(path);
|
|
170
169
|
fn = (0, moost.defineMoostEventHandler)({
|
|
171
|
-
contextType: CONTEXT_TYPE,
|
|
172
170
|
loggerTitle: LOGGER_TITLE,
|
|
173
171
|
getIterceptorHandler: opts.getIterceptorHandler,
|
|
174
172
|
getControllerInstance: opts.getInstance,
|
package/dist/index.mjs
CHANGED
|
@@ -108,7 +108,6 @@ function _define_property$1(obj, key, value) {
|
|
|
108
108
|
return obj;
|
|
109
109
|
}
|
|
110
110
|
const LOGGER_TITLE = "moost-cli";
|
|
111
|
-
const CONTEXT_TYPE = "CLI";
|
|
112
111
|
/**
|
|
113
112
|
* ## Moost Cli Adapter
|
|
114
113
|
*
|
|
@@ -167,7 +166,6 @@ const CONTEXT_TYPE = "CLI";
|
|
|
167
166
|
const makePath = (p) => `${prefix}/${p}`.replaceAll(/\/\/+/g, "/").replaceAll(/\/\\:/g, "\\:").replaceAll(/^\/+/g, "");
|
|
168
167
|
const targetPath = makePath(path);
|
|
169
168
|
fn = defineMoostEventHandler({
|
|
170
|
-
contextType: CONTEXT_TYPE,
|
|
171
169
|
loggerTitle: LOGGER_TITLE,
|
|
172
170
|
getIterceptorHandler: opts.getIterceptorHandler,
|
|
173
171
|
getControllerInstance: opts.getInstance,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@moostjs/event-cli",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.26",
|
|
4
4
|
"description": "@moostjs/event-cli",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"composables",
|
|
@@ -38,15 +38,15 @@
|
|
|
38
38
|
}
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@wooksjs/event-cli": "^0.7.
|
|
41
|
+
"@wooksjs/event-cli": "^0.7.19"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
44
|
"vitest": "3.2.4"
|
|
45
45
|
},
|
|
46
46
|
"peerDependencies": {
|
|
47
|
-
"@wooksjs/event-core": "^0.7.
|
|
48
|
-
"wooks": "^0.7.
|
|
49
|
-
"moost": "^0.6.
|
|
47
|
+
"@wooksjs/event-core": "^0.7.19",
|
|
48
|
+
"wooks": "^0.7.19",
|
|
49
|
+
"moost": "^0.6.26"
|
|
50
50
|
},
|
|
51
51
|
"scripts": {
|
|
52
52
|
"pub": "pnpm publish --access public",
|