@crustjs/core 0.0.19 → 0.2.1

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Chenxin Yan
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,8 +1,6 @@
1
1
  # @crustjs/core
2
2
 
3
- The core library for the [Crust](https://crustjs.com) CLI framework.
4
-
5
- Provides command definition, argument/flag parsing, subcommand routing, lifecycle hooks, and a plugin system.
3
+ Core library for the Crust CLI framework.
6
4
 
7
5
  ## Install
8
6
 
@@ -10,51 +8,6 @@ Provides command definition, argument/flag parsing, subcommand routing, lifecycl
10
8
  bun add @crustjs/core
11
9
  ```
12
10
 
13
- ## Quick Example
14
-
15
- ```ts
16
- import { Crust } from "@crustjs/core";
17
-
18
- const app = new Crust("greet")
19
- .meta({ description: "Say hello" })
20
- .args([{ name: "name", type: "string", default: "world" }] as const)
21
- .flags({
22
- loud: { type: "boolean", description: "Shout it", alias: "l" },
23
- })
24
- .run(({ args, flags }) => {
25
- const msg = `Hello, ${args.name}!`;
26
- console.log(flags.loud ? msg.toUpperCase() : msg);
27
- });
28
-
29
- app.execute();
30
- ```
31
-
32
- ## Built-in value types
33
-
34
- Flags and positional arguments support six built-in `type` literals:
35
-
36
- - `"string"` — raw string token
37
- - `"number"` — coerced via `Number(raw)`
38
- - `"boolean"` — toggle (`--flag` / `--no-flag`)
39
- - `"url"` — `new URL(raw)` → `URL` instance
40
- - `"path"` — `~` expanded, resolved to an absolute `string`
41
- - `"json"` — `JSON.parse(raw)` → `unknown`
42
-
43
- For formats that aren't built in, attach a synchronous `parse` to a `type: "string"` flag or arg. The inferred type flows from `ReturnType<parse>`:
44
-
45
- ```ts
46
- flags: {
47
- port: { type: "string", parse: (s) => Number(s), default: "3000" },
48
- }
49
- // flags.port: number
50
- ```
51
-
52
- See the [Types](https://crustjs.com/docs/guide/types) guide for the full contract, error modes, and copy-paste recipes.
53
-
54
11
  ## Documentation
55
12
 
56
- See the full docs at [crustjs.com](https://crustjs.com).
57
-
58
- ## License
59
-
60
- MIT
13
+ Full docs: [crustjs.com/docs/modules/core](https://crustjs.com/docs/modules/core)