minercon 3.0.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.
Files changed (44) hide show
  1. package/CHANGELOG.md +439 -0
  2. package/LICENSE +22 -0
  3. package/README.md +401 -0
  4. package/images/icon.png +0 -0
  5. package/out/ansi.js +123 -0
  6. package/out/argumentHint.js +43 -0
  7. package/out/bukkitHelpParsing.js +62 -0
  8. package/out/cli.js +253 -0
  9. package/out/cliConfig.js +141 -0
  10. package/out/commandLine.js +28 -0
  11. package/out/commandSuggestions.js +202 -0
  12. package/out/commandTree.js +46 -0
  13. package/out/commandTreeCache.js +171 -0
  14. package/out/commandTreeCrawler.js +583 -0
  15. package/out/commandTreeParsingBrigadier.js +426 -0
  16. package/out/commandTreeParsingBukkit.js +116 -0
  17. package/out/commandTreeSuggestions.js +142 -0
  18. package/out/completionBackend.js +94 -0
  19. package/out/completionEngine.js +376 -0
  20. package/out/completionQueries.js +86 -0
  21. package/out/completionsBackend.js +97 -0
  22. package/out/connectionManager.js +209 -0
  23. package/out/displayArgumentHint.js +43 -0
  24. package/out/displayCommandTree.js +115 -0
  25. package/out/displaySuggestion.js +282 -0
  26. package/out/extension.js +190 -0
  27. package/out/helpTextParsing.js +445 -0
  28. package/out/historySearch.js +46 -0
  29. package/out/historyStore.js +126 -0
  30. package/out/lineEditor.js +525 -0
  31. package/out/localCommandTree.js +541 -0
  32. package/out/logger.js +14 -0
  33. package/out/minercon +253 -0
  34. package/out/pager.js +168 -0
  35. package/out/pagination.js +142 -0
  36. package/out/rconClient.js +97 -0
  37. package/out/rconConnectionManager.js +238 -0
  38. package/out/rconProtocol.js +421 -0
  39. package/out/rconSession.js +920 -0
  40. package/out/rconTerminal.js +80 -0
  41. package/out/suggestionDisplay.js +286 -0
  42. package/out/terminalOutput.js +110 -0
  43. package/out/unpaginate.js +30 -0
  44. package/package.json +138 -0
package/CHANGELOG.md ADDED
@@ -0,0 +1,439 @@
1
+ # Changelog
2
+
3
+ All notable changes to Minercon (formerly "Minecraft RCON Terminal") will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ---
9
+
10
+ ## [Unreleased]
11
+
12
+ ### Added
13
+
14
+ - De-pagination now stitches plugin commands that paginate their *own* output
15
+ (independently of `rcat`). The client recognises the page chrome, re-issues
16
+ the command for each page, strips the headers, and shows the full result in
17
+ the pager. Multiverse-Core (`mv …`) is supported; the pattern registry in
18
+ `src/pagination.ts` is open for adding more plugin formats. (Multiverse-Portals
19
+ has no command to request a specific page of the unfiltered list, so it can't
20
+ be stitched.)
21
+
22
+ ---
23
+
24
+ ## [3.0.0] - 2026-06-17
25
+
26
+ Minercon graduates from a VS Code–only extension into a dual-target tool: the
27
+ same RCON client now ships as a **standalone CLI** (`minercon`, runnable in any
28
+ terminal) *and* as the VS Code extension. This release also adds **server-side
29
+ TabComplete plugins/mod** (Paper, Spigot, Fabric) for live, in-game-accurate
30
+ completion, a full emacs-style line editor, persistent command history, and a
31
+ rebuilt command-tree engine.
32
+
33
+ > Renamed from **"Minecraft RCON Terminal"** to **Minercon** β€” same project,
34
+ > new name.
35
+
36
+ ### πŸš€ Highlights
37
+
38
+ - **Standalone CLI (`minercon`)** β€” run an RCON terminal in any shell, not just
39
+ inside VS Code. The VS Code extension now runs the same CLI directly as its
40
+ terminal process, so both targets share one implementation.
41
+ - **Server-side tab completion** β€” new [Paper](paper-plugin/),
42
+ [Spigot](spigot-plugin/), and [Fabric](fabric-mod/) TabComplete add-ons.
43
+ When installed, completions are fetched live from the server as you type,
44
+ identical to in-game tab completion ("plugin mode"). Without them, Minercon
45
+ falls back to crawling and caching `/help` ("local mode"). The mode is
46
+ detected automatically on connect.
47
+
48
+ ### ✨ Added
49
+
50
+ #### CLI
51
+ - `minercon [host] [port]` entry point with `--password`, `--save`,
52
+ `--log-file`, `--log-level`, `--history-size`, and `--no-plugin` flags.
53
+ - Environment variables `MCRCON_PASSWORD`, `MCRCON_LOG_FILE`,
54
+ `MCRCON_LOG_LEVEL`, and `MCRCON_HISTORY_SIZE`.
55
+ - Interactive host/port/password prompts (masked password input) via
56
+ [@clack/prompts](https://github.com/bombshell-dev/clack).
57
+ - Saved config at `~/.config/minercon/config.json` (`--save` persists
58
+ host/port/history-size; the password is never written to disk).
59
+ - In-process kill ring for cut/yank within the session.
60
+
61
+ #### Server-side TabComplete add-ons
62
+ - **Paper plugin** β€” uses
63
+ [paperweight-userdev](https://docs.papermc.io/paper/dev/userdev/) for direct
64
+ typed access to Paper's Brigadier command dispatcher (no NMS reflection).
65
+ Requires Java 21 and Paper 1.21+.
66
+ - **Spigot plugin** β€” equivalent completion for Spigot 1.21+ servers (Java 21).
67
+ - **Fabric mod** β€” equivalent completion for Fabric servers.
68
+
69
+ #### Line editing & history
70
+ - Full emacs-style line editor: character/word movement, Home/End, selection
71
+ (Shift + arrows/word/line), transpose (`Ctrl+T`), and kill/yank
72
+ (`Ctrl+K`/`Ctrl+U`/`Ctrl+W`/`Alt+D`/`Ctrl+Y`). The kill ring is
73
+ session-local in both the CLI and VS Code extension.
74
+ - Persistent command history stored as a plain text file, sized by
75
+ `--history-size`, with `Up`/`Down`, `Ctrl+P`/`Ctrl+N`, and reverse search
76
+ (`Ctrl+R`).
77
+
78
+ #### Built-in commands
79
+ - `.history` β€” show command history.
80
+ - `.tree <command>` β€” inspect the parsed command tree for a command (with
81
+ send/recv debug logging).
82
+
83
+ ### πŸ”§ Changed
84
+ - Logging now goes directly through [consola](https://github.com/unjs/consola)
85
+ instead of a custom `Logger`/`TerminalWriter` layer β€” output (CLI and VS
86
+ Code extension) is now formatted by consola's default reporters.
87
+ - The extension and CLI are now bundled with esbuild (`dist/extension.js`,
88
+ `dist/minercon.js`) for packaging, so runtime dependencies like consola
89
+ ship in the VSIX without including `node_modules`.
90
+ - Command-tree loading uses `@clack/prompts`'s `progress()` instead of a
91
+ hand-rolled `\r\x1b[K` progress bar; per-step narration goes through a
92
+ `report()`/`onMessage` callback so it no longer collides with the bar's
93
+ redraws. The cache-hit path skips the progress bar entirely.
94
+ - Command-tree internals rebuilt: a single recursive `commandTree` model
95
+ (`CommandNode`/`Parameter` unified), dedicated Brigadier and Bukkit parsers,
96
+ a crawler, an on-disk cache, and a suggestions layer. Modules were
97
+ reorganized into prefix-grouped clusters (`commandTree*`, `rcon*`,
98
+ `display*`, `completion*`).
99
+
100
+ ### πŸ› Fixed
101
+ - Parse Bukkit "Showing help for X" plugin help pages so plugin commands get
102
+ proper usage hints.
103
+ - Subcommand usage hint no longer shows the parent choice-list instead of the
104
+ specific subcommand usage.
105
+ - `Ctrl+D` on a non-empty line deletes forward instead of disconnecting.
106
+
107
+ ### πŸ“š Documentation
108
+ - Added `docs/ARCHITECTURE.md` (including a Terminology section covering
109
+ "plugin mode" vs "local mode").
110
+ - Rewrote `docs/TECHNICAL.md` against the current `rconProtocol`/`rconClient`.
111
+ - Refreshed `README.md`, `CONTRIBUTING.md`, and `SECURITY.md` for the current
112
+ project layout, CLI flags, and shortcuts; marked older technical writeups as
113
+ historical.
114
+
115
+ ---
116
+
117
+ ## [2.2.0] - 2025-10-03
118
+
119
+ ### πŸ› Fixed
120
+ - `rconTerminal.ts` use TCP keepalive and increase command response timeout
121
+ - `commandAutocomplete.ts` improve parsing of optional subcommands and arguments in autocomplete
122
+
123
+ ---
124
+
125
+ ## [2.1.0] - 2025-10-02
126
+
127
+ ### ⚠️ Security Update
128
+ - `extension.ts` now stores `defaultPassword` using VS Code secure storage
129
+ - Added functionality to `extension.ts` that automatically migrates previously stored plain-text passwords to secure storage
130
+ - Removed `defaultPassword` section from `package.json`
131
+
132
+ ---
133
+
134
+ ## [2.0.5] - 2025-10-02
135
+
136
+ ### Added
137
+ - Add extension icon `images/icon.png`
138
+
139
+ ### πŸ”§ Changed
140
+ - `package.json` now references the new icon
141
+
142
+ ---
143
+
144
+ ## [2.0.0] - 2025-10-02
145
+
146
+ ### πŸš€ Major Changes
147
+
148
+ #### Custom RCON Protocol Implementation
149
+ - **Replaced `rcon-client` library** with a native TypeScript implementation
150
+ - **Full fragmentation support** - Properly handles responses larger than 4096 bytes using double-packet technique
151
+ - **No more truncated responses** - Commands like `/help`, `/status`, `/cvarlist` now return complete data
152
+ - **Concurrent command execution** - Support for multiple simultaneous commands with request ID tracking
153
+
154
+ ### ✨ Added
155
+
156
+ #### Protocol & Networking
157
+ - Custom `RconProtocol` class with proper packet structure handling
158
+ - Double-packet fragmentation detection for reliable response completion
159
+ - Event-based error handling with 'error' and 'close' events
160
+ - Configurable timeout management (default 5s, extended 30s for help commands)
161
+ - Request queue management with proper cleanup on disconnect
162
+
163
+ #### Command Autocomplete Improvements
164
+ - **Fallback command system** - Common Minecraft commands available even if help parsing fails
165
+ - **Multiple help format support** - Works with vanilla, Bukkit/Spigot/Paper, and custom servers
166
+ - **Hyphenated command support** - Commands like `/titanium-rewards` now properly show parameters
167
+ - **Alternative help commands** - Tries `?` if `/help` returns empty
168
+ - **Case-insensitive command matching** - More robust parsing
169
+ - **UTF-8 color code handling** - Fixed double-byte encoding issues (§ sequences)
170
+
171
+ #### Terminal Rendering Fixes
172
+ - **Large output handling** - Fixed rendering corruption after commands with 300+ lines
173
+ - **Smart clearing** - Prevents duplicate suggestion lists and visual artifacts
174
+ - **Buffer overflow prevention** - Proper handling when terminal buffer scrolls
175
+ - **Full-line clearing** - Uses `\x1b[2K]` for complete line clearing
176
+ - **Cursor position tracking** - Better management after large outputs
177
+
178
+ #### Error Handling & Resilience
179
+ - Individual command failures don't break initialization
180
+ - Empty help response handling with fallbacks
181
+ - Graceful degradation when server limits RCON commands
182
+ - Continued operation with partial command lists
183
+ - Better socket error recovery
184
+
185
+ ### πŸ”§ Changed
186
+
187
+ #### Core Architecture
188
+ - `rconClient.ts` now uses internal `RconProtocol` instead of external library
189
+ - Cache version bumped to 2.1.0 (incompatible with v1.x caches)
190
+ - Improved lifecycle management with proper cleanup on disconnect
191
+ - Better state tracking throughout the connection lifecycle
192
+
193
+ #### Command Parsing
194
+ - Enhanced `parseHelpResponse()` with multiple regex patterns:
195
+ - Standard format: `/command <args>`
196
+ - No-slash format: `command <args>`
197
+ - Colon format: `/command: <args>`
198
+ - List formats: `- command`
199
+ - Normalized command comparison (case-insensitive, trim whitespace)
200
+ - Special handling for commands with hyphens and underscores
201
+ - Better tokenization of nested brackets and complex parameter structures
202
+
203
+ #### Debug & Diagnostics
204
+ - Extensive logging to VS Code output channel
205
+ - Command discovery metrics (bytes received, commands found)
206
+ - Parameter parsing debug output
207
+ - Token analysis for troubleshooting
208
+ - Connection state logging
209
+
210
+ #### Terminal Improvements
211
+ - Added `lastCommandOutputLines` tracking
212
+ - Implemented `needsClearBeforeSuggestions` flag
213
+ - Better suggestion list positioning after scrolling
214
+ - Improved argument hint display with proper line clearing
215
+ - Fixed cursor save/restore sequences
216
+
217
+ ### πŸ› Fixed
218
+
219
+ #### Critical Issues
220
+ - **Fragmentation bug** - Responses no longer truncated at 4096 bytes
221
+ - **Help command truncation** - `/help` now returns all commands (typically 10-20KB)
222
+ - **Hyphenated commands** - Parameters now display correctly for commands with hyphens
223
+ - **Rendering corruption** - Fixed duplicate suggestion lists after large outputs
224
+ - **UTF-8 encoding** - Color codes now stripped correctly regardless of encoding
225
+
226
+ #### Terminal Issues
227
+ - Cursor jumping after large command outputs
228
+ - Mixed text in suggestion displays
229
+ - Corrupted suggestion counter (was showing `[!!a!!/312]`)
230
+ - Incomplete line clearing causing artifacts
231
+ - ANSI escape sequence conflicts after buffer scrolling
232
+
233
+ #### Autocomplete Issues
234
+ - Empty help response crashes
235
+ - Partial command lists from fragmented responses
236
+ - Case-sensitive matching failures
237
+ - Silent initialization failures
238
+ - Missing parameters for special character commands
239
+
240
+ ### ⚠️ Breaking Changes
241
+
242
+ - **Removed `rcon-client` dependency** - Now using internal implementation
243
+ - **Cache format incompatible** - Version 2.1.0 cache not compatible with v1.x
244
+ - **Minimum Node.js version** - Requires Node.js 14+ for socket handling
245
+ - **Clear cache required** - Users must run `/clear-cache` after update
246
+
247
+ ### πŸ“ Technical Details
248
+
249
+ #### Packet Structure
250
+ ```
251
+ +--------+--------+--------+--------+
252
+ | Size | ID | Type | Body |
253
+ | 4 bytes| 4 bytes| 4 bytes| n bytes|
254
+ +--------+--------+--------+--------+
255
+ ```
256
+
257
+ #### Fragmentation Algorithm
258
+ 1. Send command packet with unique ID
259
+ 2. Send dummy packet immediately after
260
+ 3. Accumulate all response fragments with matching ID
261
+ 4. When dummy response arrives, concatenate accumulated fragments
262
+ 5. Return complete response
263
+
264
+ #### Performance Metrics
265
+ - First command load: 5-10 seconds (server dependent)
266
+ - Cached load: <1 second
267
+ - Maximum response size: Unlimited (was 4096 bytes)
268
+ - Concurrent commands: Supported
269
+ - Cache validity: 7 days
270
+
271
+ ### πŸ“š Documentation
272
+
273
+ - Updated `README.md` to include v2.0.0 information
274
+ - Updated `.gitignore` and `.vscodeignore` to streamline file & package management
275
+ - Updated inline code documentation
276
+ - Added comprehensive `docs/TECHNICAL.md` with protocol specifications
277
+ - Added `docs/technical/` folder with detailed fix documentation
278
+ - Added test suite in `src/test/rconProtocolTest.ts`
279
+ - Added `LICENSE`
280
+ - Added `CONTRIBUTING.md`
281
+
282
+ ---
283
+
284
+ ## [1.1.1] - 2025-10-01
285
+
286
+ ### Changed
287
+ - Updated VS Code engine requirement to ^1.95.0 for better compatibility
288
+ - Updated @types/vscode to ^1.95.0
289
+
290
+ ### Fixed
291
+ - Cleaned up repository by removing development files from version control
292
+ - Fixed .gitignore to properly exclude VS Code specific files
293
+
294
+ ### Removed
295
+ - Removed .vscode directory from repository
296
+ - Removed .vscode-test.mjs, .vscodeignore, and vsc-extension-quickstart.md files
297
+
298
+ ## [1.1.0] - 2025-10-01
299
+
300
+ ### Added
301
+ - **Command Autocomplete System** - Complete rewrite with intelligent parameter parsing
302
+ - Real-time command suggestions as you type
303
+ - Tab completion with Minecraft-style cycling
304
+ - Context-aware argument hints showing required/optional parameters
305
+ - Support for subcommands and deep command trees
306
+ - Command caching for fast autocomplete after initial load
307
+ - Cache management commands (`/reload-commands`, `/clear-cache`, `/cache-info`)
308
+ - **Enhanced Connection Management**
309
+ - Save connection settings as defaults
310
+ - Connect with saved credentials (automatic)
311
+ - Connect with new credentials (manual prompt)
312
+ - Improved error handling with retry options
313
+ - **Visual Improvements**
314
+ - Custom terminal icons (light/dark theme support)
315
+ - Progress bars for command loading
316
+ - Concealed text alignment in suggestion lists
317
+ - Paginated suggestion display with indicators
318
+ - Color-coded argument highlighting
319
+
320
+
321
+ ### Changed
322
+ - Improved suggestion list rendering with better alignment
323
+ - Enhanced argument hint display with context-aware help
324
+ - Optimized command database initialization with cache awareness
325
+ - Better handling of CHOICE_LIST parameters
326
+ - Improved tokenization for complex command structures
327
+
328
+ ### Fixed
329
+ - Fixed subcommand variant collection (no longer breaking after first variant)
330
+ - Defensive early returns and guards throughout terminal code
331
+ - Proper handling of nested command structures
332
+
333
+ ## [1.0.1] - 2025-09-30
334
+
335
+ ### Changed
336
+ - Updated package.json metadata
337
+ - Repository URL configuration
338
+
339
+ ### Fixed
340
+ - Minor configuration adjustments
341
+
342
+ ## [1.0.0] - 2025-09-30
343
+
344
+ ### Added
345
+ - **Full Terminal Interface** - Complete RCON terminal implementation
346
+ - Custom pseudoterminal with full ANSI support
347
+ - Minecraft color code support (Β§0-Β§f, Β§l, Β§o, etc.)
348
+ - Command history navigation (Up/Down arrows)
349
+ - Text selection, copy, cut, and paste functionality
350
+ - Multi-line output formatting
351
+ - **Connection Features**
352
+ - Auto-reconnection with exponential backoff
353
+ - Manual reconnect command (`/reconnect`)
354
+ - Connection status indicators
355
+ - Disconnect command (`/disconnect`)
356
+ - **Keyboard Shortcuts**
357
+ - Ctrl+L - Clear screen
358
+ - Ctrl+C - Copy/Cancel
359
+ - Ctrl+V - Paste
360
+ - Ctrl+A - Select all
361
+ - Ctrl+←/β†’ - Jump word
362
+ - Ctrl+W - Delete word backward
363
+ - Ctrl+U - Clear line
364
+ - Ctrl+D - Disconnect
365
+ - Esc - Clear line
366
+ - **Built-in Commands**
367
+ - `/help` - Show command help
368
+ - `/clear` - Clear terminal
369
+ - `/reconnect` - Reconnect to server
370
+ - `/disconnect` - Disconnect from server
371
+ - **Terminal Profile Integration**
372
+ - VS Code terminal profile provider
373
+ - Multiple concurrent RCON sessions
374
+ - Terminal lifecycle management
375
+
376
+ ### Changed
377
+ - Complete rewrite from prototype to production-ready extension
378
+ - Migrated from simple output channel to full terminal interface
379
+ - Improved error handling and connection management
380
+
381
+ ## [0.1.0] - 2025-09-30
382
+
383
+ ### Added
384
+ - Initial prototype release
385
+ - Basic RCON connection functionality
386
+ - Simple command execution via command palette
387
+ - Output channel for server responses
388
+ - Connection status bar indicator
389
+ - Configuration for default host and port
390
+
391
+ ### Dependencies
392
+ - rcon-client ^4.2.5
393
+ - TypeScript ^5.9.2
394
+
395
+ ---
396
+
397
+ ## Migration Guide
398
+
399
+ ### Upgrading to v2.0.0
400
+
401
+ 1. **Clear command cache**
402
+ ```
403
+ /clear-cache
404
+ ```
405
+
406
+ 2. **Reload commands after update**
407
+ ```
408
+ /reload-commands
409
+ ```
410
+
411
+ 3. **Check output channel for issues**
412
+ - View β†’ Output β†’ Minercon
413
+ - Look for initialization messages
414
+
415
+ 4. **Test fragmentation fix**
416
+ ```
417
+ /help
418
+ ```
419
+ Should return complete list without truncation
420
+
421
+ ### Compatibility
422
+
423
+ - βœ… Minecraft Java Edition 1.7+
424
+ - βœ… Vanilla servers
425
+ - βœ… Bukkit/Spigot/Paper
426
+ - βœ… Forge/Fabric servers
427
+ - βœ… Custom server software with RCON support
428
+
429
+ [Unreleased]: https://github.com/xton/minercon/compare/3.0.0...HEAD
430
+ [3.0.0]: https://github.com/xton/minercon/compare/2.2.0...3.0.0
431
+ [2.2.0]: https://github.com/jaketcooper/minecraft-rcon/compare/2.1.0...2.2.0
432
+ [2.1.0]: https://github.com/jaketcooper/minecraft-rcon/compare/2.0.5...2.1.0
433
+ [2.0.5]: https://github.com/jaketcooper/minecraft-rcon/compare/2.0.0...2.0.5
434
+ [2.0.0]: https://github.com/jaketcooper/minecraft-rcon/compare/1.1.1...2.0.0
435
+ [1.1.1]: https://github.com/jaketcooper/minecraft-rcon/compare/1.1.0...1.1.1
436
+ [1.1.0]: https://github.com/jaketcooper/minecraft-rcon/compare/1.0.1...1.1.0
437
+ [1.0.1]: https://github.com/jaketcooper/minecraft-rcon/compare/1.0.0...1.0.1
438
+ [1.0.0]: https://github.com/jaketcooper/minecraft-rcon/compare/0.1.0...1.0.0
439
+ [0.1.0]: https://github.com/jaketcooper/minecraft-rcon/releases/tag/0.1.0
package/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Jake T Cooper
4
+ Copyright (c) 2026 xton
5
+
6
+ Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ of this software and associated documentation files (the "Software"), to deal
8
+ in the Software without restriction, including without limitation the rights
9
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ copies of the Software, and to permit persons to whom the Software is
11
+ furnished to do so, subject to the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be included in all
14
+ copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
+ SOFTWARE.