@bobschlowinskii/clicraft 0.4.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.
@@ -0,0 +1,376 @@
1
+ ---
2
+ layout: default
3
+ title: auth
4
+ parent: Commands
5
+ nav_order: 4
6
+ description: "Manage Minecraft accounts"
7
+ permalink: /commands/auth
8
+ ---
9
+
10
+ # auth Command
11
+
12
+ Manage your Microsoft/Minecraft accounts. CLIcraft supports multiple accounts with easy switching between them.
13
+
14
+ ## 📝 Synopsis
15
+
16
+ ```bash
17
+ clicraft auth [action] [args...] [options]
18
+ ```
19
+
20
+ ## 📖 Description
21
+
22
+ The auth command provides a unified interface for managing Microsoft account authentication. You can have multiple accounts saved and easily switch between them.
23
+
24
+ ### Available Actions
25
+
26
+ | Action | Description |
27
+ |--------|-------------|
28
+ | `login` | Add a new account or update existing |
29
+ | `logout [account]` | Remove an account |
30
+ | `switch [account]` | Switch to a different account |
31
+ | `status [account]` | Show all accounts or specific account details |
32
+ | `list` | List all saved accounts |
33
+
34
+ ## 🎯 Options
35
+
36
+ | Option | Description | Default |
37
+ |--------|-------------|---------|
38
+ | `-f, --force` | Skip confirmation prompts | false |
39
+ | `--verbose` | Enable verbose output | false |
40
+
41
+ ## 📋 Examples
42
+
43
+ ### Add a new account
44
+ ```bash
45
+ clicraft auth login
46
+ ```
47
+
48
+ ### Check all accounts
49
+ ```bash
50
+ clicraft auth status
51
+ ```
52
+ Output:
53
+ ```
54
+ 🎮 Account Status
55
+
56
+ 2 account(s) saved:
57
+
58
+ ▶ Player123 (4a903277...) (valid)
59
+ AltAccount (8b374a68...) (expired)
60
+
61
+ Use "clicraft auth status <username>" for detailed info.
62
+ ```
63
+
64
+ ### View specific account details
65
+ ```bash
66
+ clicraft auth status Player123
67
+ ```
68
+ Output:
69
+ ```
70
+ 🎮 Account Status
71
+
72
+ Username: Player123 (active)
73
+ UUID: 4a903277a1014eaebc5a82f746e36682
74
+ Authenticated: 2026-01-19T16:13:46.840Z
75
+ Token valid for 45 minutes
76
+ ```
77
+
78
+ ### Switch between accounts
79
+ ```bash
80
+ clicraft auth switch AltAccount
81
+ ```
82
+ Or interactively:
83
+ ```bash
84
+ clicraft auth switch
85
+ ```
86
+
87
+ ### Remove an account
88
+ ```bash
89
+ clicraft auth logout Player123
90
+ ```
91
+ Or remove current account:
92
+ ```bash
93
+ clicraft auth logout
94
+ ```
95
+
96
+ ### List all accounts
97
+ ```bash
98
+ clicraft auth list
99
+ ```
100
+
101
+ ## 🎮 Login Process
102
+
103
+ ### Step-by-Step
104
+
105
+ ```bash
106
+ $ clicraft auth login
107
+
108
+ 🔐 Microsoft Login
109
+
110
+ You have 1 account(s) saved.
111
+ This will add a new account or update an existing one.
112
+
113
+ Please open this URL in your browser to login:
114
+
115
+ https://login.live.com/oauth20_authorize.srf\?...
116
+
117
+ (Browser opened automatically)
118
+
119
+ After logging in, you will be redirected to a blank page.
120
+ Copy the ENTIRE URL from your browser's address bar and paste it below:
121
+
122
+ Paste the redirect URL here:
123
+ ```
124
+
125
+ 1. **Browser Opens**: Your default browser opens to Microsoft's login page
126
+ 2. **Sign In**: Login with your Microsoft account (the one that owns Minecraft)
127
+ 3. **Authorization**: Approve the authentication request
128
+ 4. **Copy URL**: After approval, you'll be redirected - copy the entire URL
129
+ 5. **Paste URL**: Paste it into the terminal
130
+ 6. **Complete**: Account is saved and set as active
131
+
132
+ ### Example Session
133
+
134
+ ```bash
135
+ $ clicraft auth login
136
+
137
+ 🔐 Microsoft Login
138
+
139
+ Please open this URL in your browser to login:
140
+
141
+ https://login.live.com/oauth20_authorize.srf\?...
142
+
143
+ Paste the redirect URL here: https://login.live.com/oauth20_desktop.srf\?code\=M.R3_BAY...
144
+
145
+ Getting Microsoft token...
146
+ Getting Xbox Live token...
147
+ Getting XSTS token...
148
+ Getting Minecraft token...
149
+ Getting Minecraft profile...
150
+
151
+ ✅ Successfully added account: Player123
152
+ UUID: 4a903277a1014eaebc5a82f746e36682
153
+ Total accounts: 2
154
+ This account is now active.
155
+ ```
156
+
157
+ ## 🔀 Switching Accounts
158
+
159
+ ### Interactive Switch
160
+ ```bash
161
+ $ clicraft auth switch
162
+
163
+ 🔄 Switch Account
164
+
165
+ ? Select an account to switch to:
166
+ ❯ Player123 (current)
167
+ AltAccount
168
+ TestPlayer
169
+ ```
170
+
171
+ ### Direct Switch
172
+ ```bash
173
+ $ clicraft auth switch AltAccount
174
+
175
+ 🔄 Switch Account
176
+
177
+ ✅ Switched to: AltAccount
178
+ ```
179
+
180
+ ### Switch by UUID
181
+ ```bash
182
+ clicraft auth switch 8b374a68-9338-41b9-81a1-c65e5a02fedf
183
+ ```
184
+
185
+ ## 🚪 Logging Out
186
+
187
+ ### Remove Specific Account
188
+ ```bash
189
+ $ clicraft auth logout AltAccount
190
+
191
+ 🔐 Logout
192
+
193
+ ✔ Are you sure you want to logout AltAccount? Yes
194
+ ✅ Logged out: AltAccount
195
+ Remaining accounts: 1
196
+ Active account: Player123
197
+ ```
198
+
199
+ ### Interactive Selection (Multiple Accounts)
200
+ ```bash
201
+ $ clicraft auth logout
202
+
203
+ 🔐 Logout
204
+
205
+ ? Which account do you want to logout?
206
+ ❯ Player123 (4a903277...)
207
+ AltAccount (8b374a68...)
208
+ Cancel
209
+ ```
210
+
211
+ ### Force Logout (Skip Confirmation)
212
+ ```bash
213
+ clicraft auth logout AltAccount --force
214
+ ```
215
+
216
+ ## 📊 Status Display
217
+
218
+ ### All Accounts
219
+ ```bash
220
+ $ clicraft auth status
221
+
222
+ 🎮 Account Status
223
+
224
+ 2 account(s) saved:
225
+
226
+ ▶ Player123 (4a903277...) (valid)
227
+ AltAccount (8b374a68...) (expired)
228
+
229
+ Use "clicraft auth status <username>" for detailed info.
230
+ ```
231
+
232
+ **Legend:**
233
+ - `▶` - Currently active account
234
+ - `(valid)` - Token is still valid
235
+ - `(expired)` - Token needs refresh (automatic on launch)
236
+
237
+ ### Specific Account
238
+ ```bash
239
+ $ clicraft auth status Player123
240
+
241
+ 🎮 Account Status
242
+
243
+ Username: Player123 (active)
244
+ UUID: 4a903277a1014eaebc5a82f746e36682
245
+ Authenticated: 2026-01-19T16:13:46.840Z
246
+ Last Refreshed: 2026-01-22T14:30:00.000Z
247
+ Token valid for 45 minutes
248
+ ```
249
+
250
+ ## 🔒 Token Storage
251
+
252
+ ### Storage Location
253
+ Authentication data is stored at:
254
+ ```
255
+ ~/.clicraft/auth/accounts.json
256
+ ```
257
+
258
+ ### Structure
259
+ ```json
260
+ {
261
+ "accounts": {
262
+ "uuid1": { "username": "Player123", ... },
263
+ "uuid2": { "username": "AltAccount", ... }
264
+ },
265
+ "currentAccount": "uuid1"
266
+ }
267
+ ```
268
+
269
+ ### Security
270
+ - **Keep this file secure/home/benjamin/GitHub/clicraft/docs/commands/login.md /home/benjamin/GitHub/clicraft/docs/commands/auth.md* It contains authentication tokens
271
+ - Tokens are automatically refreshed when they expire
272
+ - Old tokens are invalidated when you logout
273
+
274
+ ## 🔄 Token Management
275
+
276
+ ### Automatic Refresh
277
+ CLIcraft automatically refreshes tokens when:
278
+ - They're about to expire (within 5 minutes)
279
+ - You launch the game
280
+ - The token check during game launch
281
+
282
+ ### Manual Refresh
283
+ Re-login to force a fresh token:
284
+ ```bash
285
+ clicraft auth login
286
+ # Login with the same account to refresh
287
+ ```
288
+
289
+ ## 🎯 Use Cases
290
+
291
+ ### Multiple Players on Same Computer
292
+ ```bash
293
+ # Add first account
294
+ clicraft auth login
295
+ # Login as Player1
296
+
297
+ # Add second account
298
+ clicraft auth login
299
+ # Login as Player2
300
+
301
+ # Switch between them
302
+ clicraft auth switch Player1
303
+ clicraft launch
304
+
305
+ clicraft auth switch Player2
306
+ clicraft launch
307
+ ```
308
+
309
+ ### Development/Testing
310
+ ```bash
311
+ # Use test account for mod testing
312
+ clicraft auth switch TestAccount
313
+ clicraft launch
314
+
315
+ # Switch back to main account
316
+ clicraft auth switch MainAccount
317
+ ```
318
+
319
+ ### Shared Computer
320
+ ```bash
321
+ # Each user logs in with their own account
322
+ clicraft auth login
323
+
324
+ # Before leaving, remove your account
325
+ clicraft auth logout YourUsername
326
+ ```
327
+
328
+ ## ⚠️ Common Issues
329
+
330
+ ### "Token expired"
331
+ Tokens automatically refresh on launch. If issues persist:
332
+ ```bash
333
+ clicraft auth login
334
+ # Re-login with the same account
335
+ ```
336
+
337
+ ### "Account not found"
338
+ Check available accounts:
339
+ ```bash
340
+ clicraft auth list
341
+ ```
342
+
343
+ ### "No accounts logged in"
344
+ Add an account:
345
+ ```bash
346
+ clicraft auth login
347
+ ```
348
+
349
+ ### "Browser didn't open"
350
+ Copy the URL manually:
351
+ ```bash
352
+ clicraft auth login
353
+ # Copy the URL shown and paste in browser
354
+ ```
355
+
356
+ ## 🔗 Migration from Legacy Format
357
+
358
+ If you used an older version of CLIcraft, your existing auth is automatically migrated:
359
+ - Old file: `~/.clicraft/auth.json`
360
+ - New location: `~/.clicraft/auth/accounts.json`
361
+ - A backup is created at `~/.clicraft/auth.json.backup`
362
+
363
+ ## 📚 Related Commands
364
+
365
+ - [`clicraft launch`](launch.md) - Launch requires login for online play
366
+ - [`clicraft config`](config.md) - CLI configuration
367
+
368
+ ## 🔗 External Resources
369
+
370
+ - [Microsoft Account](https://account.microsoft.com/)
371
+ - [Minecraft Account](https://www.minecraft.net/profile)
372
+ - [Get Minecraft](https://www.minecraft.net/get-minecraft)
373
+
374
+ ---
375
+
376
+ [← Back to Commands](../commands.md) | [Next: launch →](launch.md)
@@ -0,0 +1,294 @@
1
+ ---
2
+ layout: default
3
+ title: config
4
+ parent: Commands
5
+ nav_order: 8
6
+ description: "Manage CLI settings and game settings"
7
+ permalink: /commands/config
8
+ ---
9
+
10
+ # config Command
11
+
12
+ Manage CLIcraft settings and Minecraft game settings.
13
+
14
+ ## 📝 Synopsis
15
+
16
+ ```bash
17
+ clicraft config [action] [args...] [options]
18
+ ```
19
+
20
+ ## 📖 Description
21
+
22
+ The `config` command provides access to:
23
+ - **CLI Settings** - Global CLIcraft configuration (Java path, memory, etc.)
24
+ - **Game Settings Ignore List** - Control which Minecraft settings are captured
25
+ - **Game Settings** - Capture and manage Minecraft options in mcconfig.json
26
+
27
+ ## 🎯 Options
28
+
29
+ | Option | Description |
30
+ |--------|-------------|
31
+ | `-i, --instance <path>` | Path to instance directory (for game settings actions) |
32
+ | `--verbose` | Show detailed output |
33
+
34
+ ## 📋 Actions
35
+
36
+ ### `show` (default)
37
+
38
+ Display current CLI settings.
39
+
40
+ ```bash
41
+ clicraft config
42
+ clicraft config show
43
+ ```
44
+
45
+ **Output:**
46
+ ```
47
+ ⚙️ CLI Settings
48
+
49
+ Config directory: /home/user/.clicraft
50
+
51
+ checkUpdates: true
52
+ autoSaveToConfig: true
53
+ *...other config options*
54
+ ```
55
+
56
+ ### `set <key> <value>`
57
+
58
+ Modify a CLI setting.
59
+
60
+ ```bash
61
+ # Set maximum memory
62
+ clicraft config set checkUpdates false
63
+
64
+ # Reset to auto-detect
65
+ clicraft config set checkUpdates auto #sets to true
66
+ ```
67
+
68
+ **Available Settings:**
69
+
70
+ | Key | Description | Example Values | Default|
71
+ |-----|-------------|----------------|--------|
72
+ | `checkUpdates` | whether to check for updates | `true, false` | `true` |
73
+ | `autoSaveToConfig` | whether to automatically save minecraft settings to mcconfig.json | `true, false` | `true` |
74
+
75
+ *Do NOT change settingsVersion, unless you want to mess around and fix my bugs ;)*
76
+
77
+ ### `ignore`
78
+
79
+ Show the game settings ignore list. These patterns determine which Minecraft settings are excluded when capturing.
80
+
81
+ ```bash
82
+ clicraft config ignore
83
+ ```
84
+
85
+ **Output:**
86
+ ```
87
+ 🚫 Game Settings Ignore List
88
+
89
+ File: /home/user/.clicraft/game-settings-ignore.json
90
+ These settings are excluded when saving game settings to mcconfig.json
91
+
92
+ - fullscreen
93
+ - overrideWidth
94
+ - overrideHeight
95
+ - key_*
96
+ - narrator
97
+ ...
98
+
99
+ Tip: Use * as wildcard (e.g., key_* ignores all keybinds)
100
+ ```
101
+
102
+ ### `ignore-add <pattern>`
103
+
104
+ Add a pattern to the ignore list.
105
+
106
+ ```bash
107
+ # Ignore mouse sensitivity
108
+ clicraft config ignore-add mouseSensitivity
109
+
110
+ # Ignore all sound categories (wildcard)
111
+ clicraft config ignore-add soundCategory_*
112
+ ```
113
+
114
+ ### `ignore-remove <pattern>`
115
+
116
+ Remove a pattern from the ignore list.
117
+
118
+ ```bash
119
+ # Stop ignoring keybinds (include them when capturing)
120
+ clicraft config ignore-remove key_*
121
+ ```
122
+
123
+ ### `defaults`
124
+
125
+ Show default game settings that are applied to all new instances.
126
+
127
+ ```bash
128
+ clicraft config defaults
129
+ ```
130
+
131
+ **Output:**
132
+ ```
133
+ 🎮 Default Game Settings
134
+
135
+ File: /home/user/.clicraft/default-game-settings.json
136
+ These settings are applied to all new instances
137
+
138
+ renderDistance: 16
139
+ fov: 80
140
+ ```
141
+
142
+ ### `defaults-set <key> <value>`
143
+
144
+ Set a default game setting. This will be applied to all new instances.
145
+
146
+ ```bash
147
+ # Set render distance
148
+ clicraft config defaults-set renderDistance 16
149
+
150
+ # Set field of view
151
+ clicraft config defaults-set fov 80
152
+
153
+ # Disable auto-jump
154
+ clicraft config defaults-set autoJump false
155
+ ```
156
+
157
+ ### `defaults-remove <key>`
158
+
159
+ Remove a default game setting.
160
+
161
+ ```bash
162
+ clicraft config defaults-remove renderDistance
163
+ ```
164
+
165
+ ### `defaults-clear`
166
+
167
+ Clear all default game settings.
168
+
169
+ ```bash
170
+ clicraft config defaults-clear
171
+ ```
172
+
173
+ ### `capture`
174
+
175
+ Capture game settings from an instance's `options.txt` and save them to `mcconfig.json`.
176
+
177
+ ```bash
178
+ # In an instance directory
179
+ clicraft config capture
180
+
181
+ # Or specify instance
182
+ clicraft config capture --instance ~/my-instance
183
+
184
+ # With verbose output to see all captured settings
185
+ clicraft config capture --verbose
186
+ ```
187
+
188
+ **Requirements:**
189
+ - Must have an `mcconfig.json` in the instance
190
+ - Must have an `options.txt` (run Minecraft at least once)
191
+
192
+ **What it does:**
193
+ 1. Reads `options.txt` from the instance
194
+ 2. Filters out settings in the ignore list
195
+ 3. Saves remaining settings to `mcconfig.json` as `gameSettings`
196
+
197
+ ### `game-settings`
198
+
199
+ Show game settings saved in an instance's `mcconfig.json`.
200
+
201
+ ```bash
202
+ clicraft config game-settings
203
+ clicraft config game-settings --instance ~/my-instance
204
+ ```
205
+
206
+ **Output:**
207
+ ```
208
+ ⚙️ Game Settings (15 saved)
209
+
210
+ renderDistance: 12
211
+ fov: 70
212
+ guiScale: 2
213
+ gamma: 0.5
214
+ ...
215
+ ```
216
+
217
+ ### `clear-game-settings`
218
+
219
+ Remove all game settings from an instance's `mcconfig.json`.
220
+
221
+ ```bash
222
+ clicraft config clear-game-settings
223
+ ```
224
+
225
+ ## 💡 Examples
226
+
227
+ ### Set up for a powerful machine
228
+ ```bash
229
+ clicraft config set maxMemory 8G
230
+ clicraft config set minMemory 4G
231
+ ```
232
+
233
+ ### Configure default game settings for new instances
234
+ ```bash
235
+ # Set your preferred defaults
236
+ clicraft config defaults-set renderDistance 16
237
+ clicraft config defaults-set fov 80
238
+ clicraft config defaults-set guiScale 2
239
+ clicraft config defaults-set autoJump false
240
+
241
+ # Now all new instances will have these settings
242
+ clicraft create
243
+ ```
244
+
245
+ ### Capture and share settings
246
+ ```bash
247
+ # Play Minecraft and configure your preferred settings
248
+ # Then capture them
249
+ cd my-instance
250
+ clicraft config capture --verbose
251
+
252
+ # Your mcconfig.json now includes gameSettings
253
+ # Share it with others
254
+ ```
255
+
256
+ ### Include keybinds in shared config
257
+ ```bash
258
+ # By default, keybinds are ignored
259
+ # Remove them from ignore list to include
260
+ clicraft config ignore-remove key_*
261
+
262
+ # Now capture will include keybinds
263
+ clicraft config capture
264
+ ```
265
+
266
+ ### Check what will be captured
267
+ ```bash
268
+ # First, see what's ignored
269
+ clicraft config ignore
270
+
271
+ # Then capture with verbose to see what's included
272
+ clicraft config capture --verbose
273
+ ```
274
+
275
+ ## 📁 Config Files
276
+
277
+ All global config files are stored in `~/.clicraft/`:
278
+
279
+ | File | Description |
280
+ |------|-------------|
281
+ | `settings.json` | CLI settings (memory, Java path, etc.) |
282
+ | `default-game-settings.json` | Default Minecraft settings for new instances |
283
+ | `game-settings-ignore.json` | Patterns to exclude when capturing |
284
+ | `auth.json` | Authentication tokens |
285
+
286
+ ## 🔗 See Also
287
+
288
+ - [Configuration Guide](../configuration.md) - Full configuration documentation
289
+ - [create Command](create.md) - Uses game settings when creating from config
290
+ - [info Command](info.md) - Shows instance information
291
+
292
+ ---
293
+
294
+ [← Back to Commands](../commands.md)