@loontail/minecraft-kit 0.6.0 → 0.6.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/README.md +55 -8
- package/dist/cli/index.cjs +2330 -1234
- package/dist/cli/index.cjs.map +1 -1
- package/dist/cli/index.mjs +2329 -1233
- package/dist/cli/index.mjs.map +1 -1
- package/dist/index.cjs +1689 -851
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +678 -417
- package/dist/index.d.ts +678 -417
- package/dist/index.mjs +1682 -852
- package/dist/index.mjs.map +1 -1
- package/package.json +6 -2
- package/LICENSE.md +0 -22
package/README.md
CHANGED
|
@@ -1,17 +1,27 @@
|
|
|
1
1
|
# @loontail/minecraft-kit
|
|
2
2
|
|
|
3
|
-
A stateless TypeScript Minecraft launcher library and interactive CLI for vanilla, Fabric,
|
|
3
|
+
A stateless TypeScript Minecraft launcher library and interactive CLI for vanilla, Fabric,
|
|
4
|
+
and modern Forge.
|
|
4
5
|
|
|
5
6
|
**Documentation:** https://loontail.github.io/minecraft-kit/
|
|
6
7
|
|
|
7
8
|
## Features
|
|
8
9
|
|
|
9
|
-
-
|
|
10
|
-
-
|
|
11
|
-
|
|
12
|
-
-
|
|
13
|
-
-
|
|
14
|
-
- **
|
|
10
|
+
- **Install** vanilla Minecraft, Fabric, and modern Forge end-to-end.
|
|
11
|
+
- **Java runtimes** — install Mojang's `java-runtime-gamma` / `delta` / `jre-legacy` /
|
|
12
|
+
others, either bundled with a target or standalone.
|
|
13
|
+
- **Verify, repair, launch.** Per-aspect verifiers tell you exactly which files are missing
|
|
14
|
+
or corrupted; repair re-downloads only those.
|
|
15
|
+
- **Microsoft OAuth.** Built-in device-code sign-in returns a `MojangSession` ready for
|
|
16
|
+
online launches. Token storage stays in your launcher's hands.
|
|
17
|
+
- **Typed events.** Discriminated-union `onEvent` callbacks cover every download, integrity
|
|
18
|
+
check, archive extraction, processor invocation, and launch transition.
|
|
19
|
+
- **Defence in depth.** URL scheme allow-list on every download, optional host pinning,
|
|
20
|
+
manifest shape validation, zip-bomb caps, zip-slip rejection, atomic writes.
|
|
21
|
+
- **Interactive CLI** (`mckit`) — install / verify / repair / launch / sign-in from a single
|
|
22
|
+
menu.
|
|
23
|
+
- **Stateless** — writes only the files Minecraft itself needs; no profile registry, no
|
|
24
|
+
session files, no launcher-private metadata.
|
|
15
25
|
|
|
16
26
|
## Install
|
|
17
27
|
|
|
@@ -19,6 +29,8 @@ A stateless TypeScript Minecraft launcher library and interactive CLI for vanill
|
|
|
19
29
|
npm install @loontail/minecraft-kit
|
|
20
30
|
```
|
|
21
31
|
|
|
32
|
+
Requires Node ≥ 20.11.
|
|
33
|
+
|
|
22
34
|
## Usage
|
|
23
35
|
|
|
24
36
|
```ts
|
|
@@ -43,13 +55,48 @@ const session = kit.launch.run(composition);
|
|
|
43
55
|
await session.exited;
|
|
44
56
|
```
|
|
45
57
|
|
|
58
|
+
### Online launch via Microsoft
|
|
59
|
+
|
|
60
|
+
```ts
|
|
61
|
+
const session = await kit.auth.login({
|
|
62
|
+
clientId: process.env.MINECRAFT_KIT_MSA_CLIENT_ID,
|
|
63
|
+
onPrompt: (prompt) => {
|
|
64
|
+
console.log(`Open ${prompt.verificationUri} and enter ${prompt.userCode}`);
|
|
65
|
+
},
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
// Persist `session.microsoft.refreshToken` somewhere your launcher controls.
|
|
69
|
+
// Next start: kit.auth.refresh(savedRefreshToken).
|
|
70
|
+
|
|
71
|
+
const composition = await kit.launch.compose(target, {
|
|
72
|
+
auth: toOnlineAuth(session),
|
|
73
|
+
});
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
See [docs/guides/auth](https://loontail.github.io/minecraft-kit/guides/auth) for Azure AD
|
|
77
|
+
registration steps and the full error taxonomy.
|
|
78
|
+
|
|
46
79
|
## CLI
|
|
47
80
|
|
|
48
81
|
```bash
|
|
49
82
|
mckit
|
|
50
83
|
```
|
|
51
84
|
|
|
52
|
-
The CLI is fully interactive — no required arguments. Run inside the directory that should
|
|
85
|
+
The CLI is fully interactive — no required arguments. Run inside the directory that should
|
|
86
|
+
host your installations. Flags: `--help`, `--version`, `--debug`.
|
|
87
|
+
|
|
88
|
+
## Security
|
|
89
|
+
|
|
90
|
+
The kit goes through three defence layers on untrusted input. See
|
|
91
|
+
[docs/guides/security](https://loontail.github.io/minecraft-kit/guides/security) for the
|
|
92
|
+
full model. Highlights:
|
|
93
|
+
|
|
94
|
+
- Downloads accept only `http(s)` URLs; opt-in `hostAllowList` pins to a known set of hosts.
|
|
95
|
+
- Manifests pass through runtime shape guards before any code trusts them.
|
|
96
|
+
- Zip extraction caps entry count, per-entry size, total size, and compression ratio;
|
|
97
|
+
rejects path traversal, null bytes, reserved Windows names, and drive letters.
|
|
98
|
+
- Auth tokens never touch disk inside the kit. `kit.auth.login()` returns a session; the
|
|
99
|
+
launcher decides how to persist the refresh token.
|
|
53
100
|
|
|
54
101
|
## License
|
|
55
102
|
|