@akaanakbaik/pterodactyl-gateway 0.3.0

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/BLUEPRINT.md ADDED
@@ -0,0 +1,254 @@
1
+ # Cetak Biru Akadev Pterodactyl Gateway
2
+
3
+ Dokumen ini adalah acuan utama pengembangan `@akadev/pterodactyl-gateway`. Semua fitur baru wajib tetap sinkron dengan blueprint ini.
4
+
5
+ ## Visi
6
+
7
+ `@akadev/pterodactyl-gateway` adalah SDK, CLI, dan nantinya TUI untuk mempermudah project Node.js mengelola Pterodactyl Panel.
8
+
9
+ Target utama:
10
+
11
+ - pemula bisa connect hanya dengan domain, PTLA, dan PTLC
12
+ - developer bisa memakai wrapper high-level dan raw request
13
+ - create user dan create server dibuat mudah melalui smart create
14
+ - field sulit seperti docker image, startup, environment, default allocation, dan additional allocation bisa otomatis
15
+ - error harus jelas dan berisi tutorial perbaikan
16
+ - semua versi dikembangkan melalui test sebelum lanjut
17
+
18
+ Package ini bukan package resmi dari Pterodactyl.
19
+
20
+ ## Istilah utama
21
+
22
+ - `domain`: URL panel Pterodactyl
23
+ - `ptla`: Application API Key untuk aksi admin
24
+ - `ptlc`: Client API Key untuk kontrol server
25
+ - `nodeId`: ID node Pterodactyl
26
+ - `nestId`: ID nest Pterodactyl
27
+ - `eggId`: ID egg di dalam nest
28
+
29
+ ## Prinsip pengembangan
30
+
31
+ 1. Kode harus TypeScript strict.
32
+ 2. Source code minim komentar, kecuali bagian penting.
33
+ 3. README dan dokumen repo utama berbahasa Indonesia.
34
+ 4. Fitur destructive harus aman secara default.
35
+ 5. API key, password, dan Authorization header tidak boleh dilog.
36
+ 6. Fitur yang belum pasti di semua versi Pterodactyl masuk `experimental`.
37
+ 7. Raw mode wajib tersedia untuk panel custom atau endpoint baru.
38
+ 8. Setiap versi wajib lulus `npm run typecheck`, `npm test`, dan `npm run build`.
39
+ 9. Website docs lengkap dibuat terakhir di repo berbeda setelah core stabil.
40
+
41
+ ## Mode koneksi
42
+
43
+ - `full`: domain + PTLA + PTLC valid
44
+ - `admin`: domain + PTLA valid
45
+ - `client`: domain + PTLC valid
46
+ - `raw`: hanya domain atau key belum dicek
47
+ - `invalid`: key diberikan tetapi tidak valid
48
+
49
+ ## API utama
50
+
51
+ ```ts
52
+ import { createPtero } from "@akadev/pterodactyl-gateway";
53
+
54
+ const ptero = createPtero({
55
+ domain: "https://panel.example.com",
56
+ ptla: process.env.PTERO_PTLA,
57
+ ptlc: process.env.PTERO_PTLC
58
+ });
59
+ ```
60
+
61
+ ## Fitur wajib v0.1.0
62
+
63
+ - `createPtero()`
64
+ - `createPtero.fromEnv()`
65
+ - `connect()`
66
+ - `health()`
67
+ - `doctor()` dasar
68
+ - `compatibility()` dasar
69
+ - raw request application/client
70
+ - `users.createSmart()`
71
+ - `users.getOrCreate()`
72
+ - `servers.previewCreate()`
73
+ - `servers.createSmart()`
74
+ - `servers.createFromPreset()`
75
+ - `servers.createRaw()`
76
+ - `server(identifier).start()`
77
+ - `server(identifier).stop()`
78
+ - `server(identifier).restart()`
79
+ - `server(identifier).kill()`
80
+ - `server(identifier).command()`
81
+ - `server(identifier).resources()`
82
+ - parser RAM, disk, CPU
83
+ - error tutorial
84
+ - CLI dasar
85
+ - GitHub Actions CI
86
+
87
+ ## Create user smart
88
+
89
+ Field wajib:
90
+
91
+ - username
92
+ - email
93
+ - password
94
+ - administrator
95
+
96
+ Auto-fill:
97
+
98
+ - firstName kosong menjadi username
99
+ - lastName kosong menjadi username
100
+ - password `auto` membuat password aman
101
+ - administrator menerima boolean, yes/no, true/false, 1/0
102
+
103
+ ## Create server smart
104
+
105
+ Field wajib:
106
+
107
+ - name
108
+ - email atau userId
109
+ - description
110
+ - nodeId
111
+ - nestId
112
+ - eggId
113
+ - memory
114
+ - disk
115
+ - cpu
116
+ - databases
117
+ - allocations
118
+ - backups
119
+
120
+ Auto-fill:
121
+
122
+ - docker image dari egg
123
+ - startup command dari egg
124
+ - environment variables dari egg
125
+ - default allocation dari node
126
+ - additional allocations sesuai allocation limit
127
+ - swap default `0`
128
+ - block IO default `500`
129
+ - CPU pinning default kosong
130
+ - OOM disabled default `false`
131
+ - start on completion default `true`
132
+
133
+ ## Preview dan dryRun
134
+
135
+ `previewCreate()` wajib ada agar user bisa melihat hasil auto-sync sebelum server dibuat.
136
+
137
+ `dryRun: true` wajib ada agar payload final bisa dicek tanpa mengirim request create server.
138
+
139
+ ## Allocation strategy
140
+
141
+ Default: `top`.
142
+
143
+ Strategy yang direncanakan:
144
+
145
+ - `top`
146
+ - `lowest-port`
147
+ - `highest-port`
148
+ - `random`
149
+ - `range`
150
+
151
+ Jika allocation limit lebih dari 1:
152
+
153
+ - allocation pertama menjadi default
154
+ - sisanya menjadi additional allocation
155
+
156
+ ## Error tutorial
157
+
158
+ Setiap error penting harus berisi:
159
+
160
+ - code
161
+ - message
162
+ - hint
163
+ - steps
164
+ - example jika perlu
165
+
166
+ Contoh error wajib:
167
+
168
+ - `PTLA_REQUIRED`
169
+ - `PTLC_REQUIRED`
170
+ - `DOMAIN_REQUIRED`
171
+ - `USER_NOT_FOUND`
172
+ - `NODE_NOT_FOUND`
173
+ - `NEST_EGG_MISMATCH`
174
+ - `DOCKER_IMAGE_NOT_FOUND`
175
+ - `STARTUP_NOT_FOUND`
176
+ - `EGG_VARIABLE_REQUIRED`
177
+ - `NO_FREE_ALLOCATION`
178
+ - `VALIDATION_ERROR`
179
+ - `DANGEROUS_COMMAND_BLOCKED`
180
+
181
+ ## Security
182
+
183
+ - mask PTLA dan PTLC
184
+ - jangan log password
185
+ - jangan log Authorization header
186
+ - command berbahaya diblokir default
187
+ - delete dan force delete harus butuh confirm pada versi mendatang
188
+ - tidak ada telemetry default
189
+
190
+ ## CLI
191
+
192
+ Binary:
193
+
194
+ - `ptero-gateway`
195
+ - `ptg`
196
+
197
+ Command awal:
198
+
199
+ - `doctor`
200
+ - `connect`
201
+ - `ids`
202
+ - `ids --nest <nestId>`
203
+ - `server <identifier> resources`
204
+ - `server <identifier> start`
205
+ - `server <identifier> stop`
206
+ - `server <identifier> restart`
207
+ - `server <identifier> kill`
208
+ - `server <identifier> command "npm start"`
209
+
210
+ ## TUI atau GUI CLI
211
+
212
+ TUI bagus ditambahkan setelah core stabil, bukan di v0.1.0.
213
+
214
+ Target v0.5.0:
215
+
216
+ - dashboard terminal
217
+ - doctor check visual
218
+ - list IDs
219
+ - create user wizard
220
+ - create server wizard
221
+ - preview screen
222
+ - server manager
223
+ - realtime console viewer
224
+ - settings `.env`
225
+
226
+ ## Roadmap
227
+
228
+ ### v0.1.0
229
+
230
+ Core SDK, smart create user, smart create server, preview, dryRun, doctor dasar, raw request, CLI dasar, test, CI.
231
+
232
+ ### v0.2.0
233
+
234
+ File manager, database manager, backup manager, startup variables, network allocations, schedules, cache, pagination, preset lebih matang.
235
+
236
+ ### v0.3.0
237
+
238
+ WebSocket console, realtime stats, polling fallback, token refresh, audit event, event emitter.
239
+
240
+ ### v0.4.0
241
+
242
+ CLI lengkap: init, create-user wizard, create-server wizard, ids, server manager, console command.
243
+
244
+ ### v0.5.0
245
+
246
+ TUI terminal interaktif.
247
+
248
+ ### v0.6.0
249
+
250
+ Experimental nest/egg create/update/delete, import/export egg, compatibility adapter.
251
+
252
+ ### v1.0.0
253
+
254
+ API stabil, docs lengkap, examples lengkap, test coverage kuat, siap publish npm stabil.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 aka
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.