@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.
package/CHANGELOG.md ADDED
@@ -0,0 +1,191 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ ## [0.4.0] - 2026-01-22
6
+
7
+ ### Added
8
+
9
+ - **Multi-Account Authentication** (`clicraft auth`)
10
+ - Support for multiple Microsoft/Minecraft accounts
11
+ - New unified `clicraft auth` command with subcommands:
12
+ - `auth login` - Add a new account or update existing
13
+ - `auth logout [account]` - Remove an account (interactive selection if multiple)
14
+ - `auth switch [account]` - Switch between saved accounts
15
+ - `auth status [account]` - Show all accounts or specific account details
16
+ - `auth list` - List all saved accounts
17
+ - Accounts stored in `~/.clicraft/auth/accounts.json`
18
+ - Active account highlighted with `â–ļ` marker in status
19
+ - Token status (valid/expired) shown for each account
20
+ - Automatic migration from legacy `auth.json` format
21
+
22
+ ### Changed
23
+
24
+ - **Auth Commands Restructured**
25
+ - Replaced standalone `login`, `logout`, `status` commands with `auth` subcommand
26
+ - Backward compatible `loadAuth()` and `refreshAuth()` exports maintained
27
+
28
+ ### Deprecated
29
+
30
+ - Old `clicraft login`, `clicraft logout`, `clicraft status` commands are now under `clicraft auth`
31
+
32
+ ## [0.3.2] - 2026-01-22
33
+
34
+ ### Changed
35
+
36
+ - **Major Codebase Refactoring**
37
+ - Created centralized helper modules for shared functionality
38
+ - `helpers/constants.js` - Centralized API URLs, user agent, pagination settings
39
+ - `helpers/utils.js` - Core utilities: fetchJson, downloadFile, loadConfig, saveConfig, paginatedSelect, mavenToPath
40
+ - `helpers/modrinth.js` - Modrinth API functions: getProject, getProjectVersions, searchMods, downloadMod, findMod
41
+ - `helpers/minecraft.js` - Minecraft/Fabric/Forge API: version fetching, library/asset downloads
42
+ - Eliminated 7+ duplicate function patterns across command files
43
+ - Reduced code duplication and improved maintainability
44
+ - All commands now use shared imports instead of local implementations
45
+
46
+ ## [0.3.1] - 2026-01-22
47
+
48
+ ### Added
49
+
50
+ - **Uninstall Command** (`clicraft uninstall`)
51
+ - Remove mods from your Minecraft instance
52
+ - Interactive multi-select when no mod specified
53
+ - Confirmation prompt before deletion (skip with `--force`)
54
+ - Removes mod file and updates mcconfig.json
55
+
56
+ ## [0.3.0] - 2026-01-19
57
+
58
+ ### Added
59
+
60
+ - **Config Command** (`clicraft config`)
61
+ - New command to manage CLI settings and game settings
62
+ - `config show` - Display CLI settings (Java path, memory, mod source)
63
+ - `config set <key> <value>` - Modify CLI settings
64
+ - `config ignore` - Show game settings ignore list
65
+ - `config ignore-add <pattern>` - Add pattern to ignore list (supports wildcards)
66
+ - `config ignore-remove <pattern>` - Remove pattern from ignore list
67
+ - `config defaults` - Show default game settings for new instances
68
+ - `config defaults-set <key> <value>` - Set a default game setting
69
+ - `config defaults-remove <key>` - Remove a default game setting
70
+ - `config defaults-clear` - Clear all default game settings
71
+ - `config capture` - Capture game settings from options.txt to mcconfig.json
72
+ - `config game-settings` - Show saved game settings in mcconfig
73
+ - `config clear-game-settings` - Remove game settings from mcconfig
74
+
75
+ - **Global Configuration Directory** (`~/.clicraft/`)
76
+ - Centralized config directory for CLI-wide settings
77
+ - `settings.json` - CLI settings (Java path, memory, mod source, etc.)
78
+ - `game-settings-ignore.json` - Patterns for settings to exclude when capturing
79
+ - `default-game-settings.json` - Default Minecraft settings applied to new instances
80
+ - `auth.json` - Authentication tokens (migrated from ~/.mcpkg/)
81
+
82
+ - **Game Settings in mcconfig.json**
83
+ - New `gameSettings` field to store Minecraft options
84
+ - Capture settings from options.txt with customizable ignore list
85
+ - Automatically apply game settings when creating from config
86
+
87
+ - **Create from Existing Config** (`clicraft create` with mcconfig.json)
88
+ - Detects mcconfig.json in current directory
89
+ - Creates new instance from existing configuration
90
+ - Installs same Minecraft version, mod loader, and loader version
91
+ - Automatically installs all mods from the config
92
+ - Applies game settings if present
93
+
94
+ - **Added `--mods` option to `clicraft info`**
95
+ - Shows only installed mods instead of the entire instance info
96
+
97
+ ### Changed
98
+
99
+ - Migrated auth storage from `~/.mcpkg/` to `~/.clicraft/`
100
+ - Improved mod installation with better error handling
101
+
102
+ ## [0.2.2] - 2026-01-19
103
+
104
+ - **Fixed Bugs**
105
+ - Fixed bug in `clicraft --version` where I forgot to put the exports
106
+ - Fixed bug from package.json where importing made a default object
107
+
108
+ ## [0.2.1] - 2026-01-18
109
+
110
+ ### Added
111
+
112
+ - **Version Command** (`clicraft -v, --version`)
113
+ - Displays cool art and version!
114
+
115
+ ## [0.2.0] - 2026-01-18
116
+
117
+ ### Added
118
+
119
+ - **Instance Info** (`clicraft info`)
120
+ - Display comprehensive instance information
121
+ - Shows instance name, type, mod loader, and versions
122
+ - Lists installed mods with version numbers
123
+ - Storage breakdown by directory (libraries, assets, mods, etc.)
124
+ - World saves count and details
125
+ - Verbose mode for detailed output (`--verbose`)
126
+
127
+ - **Upgrade Command** (`clicraft upgrade`)
128
+ - Interactive upgrade menu for mods, loader, or Minecraft version
129
+ - Upgrade all mods at once to latest compatible versions
130
+ - Upgrade individual mods by name (`clicraft upgrade sodium`)
131
+ - Upgrade Fabric loader version with automatic library downloads
132
+ - Config format migration for future compatibility
133
+ - Force upgrade option (`--force`)
134
+
135
+ - **Config Versioning**
136
+ - Added `configVersion` field to `mcconfig.json`
137
+ - Enables future migrations and compatibility checks
138
+
139
+ ### Changed
140
+
141
+ - Improved mod tracking with `updatedAt` timestamp on upgrades
142
+
143
+ ## [0.1.0] - 2026-01-17
144
+
145
+ ### Added
146
+
147
+ - **Instance Creation** (`clicraft create`)
148
+ - Interactive prompts for instance configuration
149
+ - Support for Fabric and Forge mod loaders
150
+ - Client and server instance types
151
+ - Automatic download of Minecraft client/server JAR
152
+ - Automatic download of all required libraries
153
+ - Automatic download of game assets
154
+ - Paginated version selection (10 items per page)
155
+ - Creates `mcconfig.json` with instance metadata
156
+
157
+ - **Mod Search** (`clicraft search`)
158
+ - Search mods on Modrinth by name
159
+ - Filter by Minecraft version (`--version`)
160
+ - Filter by mod loader (`--loader`)
161
+ - Limit results (`--limit`)
162
+ - Displays download counts, supported loaders, and Modrinth links
163
+
164
+ - **Mod Installation** (`clicraft install`)
165
+ - Install mods from Modrinth to instance
166
+ - Automatic version matching for Minecraft version and loader
167
+ - Dependency detection with warnings
168
+ - Force reinstall option (`--force`)
169
+ - Instance path option (`--instance`)
170
+
171
+ - **Microsoft Authentication** (`clicraft login`, `clicraft logout`, `clicraft status`)
172
+ - Microsoft OAuth login via browser
173
+ - Xbox Live and Minecraft Services authentication
174
+ - Token refresh for persistent sessions
175
+ - Secure token storage in `~/.mcpkg/auth.json`
176
+
177
+ - **Game Launching** (`clicraft launch`)
178
+ - Launch Minecraft directly from terminal
179
+ - Automatic classpath building for vanilla and Fabric libraries
180
+ - Support for offline mode (`--offline`)
181
+ - Verbose output option (`--verbose`)
182
+ - Instance path option (`--instance`)
183
+
184
+ ### Technical Details
185
+
186
+ - Built with Node.js ES modules
187
+ - Uses Commander.js for CLI interface
188
+ - Uses Inquirer.js for interactive prompts
189
+ - Chalk for colored terminal output
190
+ - Native fetch API (Node.js 18+)
191
+ - Supports Linux, macOS, and Windows
@@ -0,0 +1,261 @@
1
+ # Contributing to CLIcraft
2
+
3
+ Thank you for your interest in contributing to CLIcraft! We welcome contributions from the community.
4
+
5
+ ## 📋 Table of Contents
6
+
7
+ - [Code of Conduct](#code-of-conduct)
8
+ - [Getting Started](#getting-started)
9
+ - [Development Setup](#development-setup)
10
+ - [How to Contribute](#how-to-contribute)
11
+ - [Pull Request Process](#pull-request-process)
12
+ - [Coding Guidelines](#coding-guidelines)
13
+ - [Reporting Issues](#reporting-issues)
14
+ - [Community](#community)
15
+
16
+ ## 🤝 Code of Conduct
17
+
18
+ We are committed to providing a welcoming and inclusive environment for all contributors. Please be respectful and constructive in all interactions.
19
+
20
+ ### Our Standards
21
+
22
+ - **Be respectful**: Treat everyone with respect and kindness
23
+ - **Be constructive**: Provide helpful feedback and suggestions
24
+ - **Be patient**: Remember that everyone has different levels of experience
25
+ - **Be inclusive**: Welcome newcomers and help them get started
26
+
27
+ ## 🚀 Getting Started
28
+
29
+ Before you begin contributing, please:
30
+
31
+ 1. Read through the [documentation](https://benjamin.bsstudios.org/clicraft)
32
+ 2. Check the [existing issues](https://github.com/theinfamousben/clicraft/issues) to see if your idea or bug has already been reported
33
+ 3. Look at open [pull requests](https://github.com/theinfamousben/clicraft/pulls) to avoid duplicate work
34
+
35
+ ## đŸ’ģ Development Setup
36
+
37
+ ### Prerequisites
38
+
39
+ - **Node.js** 18 or higher
40
+ - **Java** 21 or higher (for testing Minecraft functionality)
41
+ - **Git** for version control
42
+
43
+ ### Setting Up Your Development Environment
44
+
45
+ 1. **Fork the repository** on GitHub
46
+
47
+ 2. **Clone your fork**:
48
+ ```bash
49
+ git clone https://github.com/YOUR-USERNAME/clicraft.git
50
+ cd clicraft
51
+ ```
52
+
53
+ 3. **Add the upstream remote**:
54
+ ```bash
55
+ git remote add upstream https://github.com/theinfamousben/clicraft.git
56
+ ```
57
+
58
+ 4. **Install dependencies**:
59
+ ```bash
60
+ npm install
61
+ ```
62
+
63
+ 5. **Link the package locally** (to test your changes):
64
+ ```bash
65
+ npm link
66
+ ```
67
+
68
+ 6. **Verify the installation**:
69
+ ```bash
70
+ clicraft --version
71
+ ```
72
+
73
+ ### Project Structure
74
+
75
+ ```
76
+ clicraft/
77
+ ├── commands/ # Command implementations
78
+ ├── helpers/ # Utility functions
79
+ ├── docs/ # Documentation
80
+ ├── index.js # Main entry point
81
+ └── package.json # Project metadata
82
+ ```
83
+
84
+ ## đŸ› ī¸ How to Contribute
85
+
86
+ ### Types of Contributions
87
+
88
+ We welcome various types of contributions:
89
+
90
+ - **Bug fixes**: Fix issues reported in the issue tracker
91
+ - **New features**: Add new functionality to CLIcraft
92
+ - **Documentation**: Improve or add documentation
93
+ - **Tests**: Add or improve test coverage
94
+ - **Code improvements**: Refactor code for better performance or readability
95
+
96
+ ### Making Changes
97
+
98
+ 1. **Create a new branch** for your work:
99
+ ```bash
100
+ git checkout -b feature/your-feature-name
101
+ ```
102
+
103
+ Use descriptive branch names:
104
+ - `feature/add-mod-search-filter`
105
+ - `bugfix/fix-launch-error`
106
+ - `docs/update-installation-guide`
107
+
108
+ 2. **Make your changes** following the [coding guidelines](#coding-guidelines)
109
+
110
+ 3. **Test your changes**:
111
+ ```bash
112
+ # Test the CLI manually
113
+ clicraft --help
114
+ clicraft create
115
+ # etc.
116
+ ```
117
+
118
+ 4. **Update documentation** if needed:
119
+ - Update `README.md` for user-facing changes
120
+ - Update docs in the `docs/` folder for detailed documentation
121
+ - Add inline comments for complex code
122
+
123
+ 5. **Commit your changes**:
124
+ ```bash
125
+ git add .
126
+ git commit -m "Brief description of changes"
127
+ ```
128
+
129
+ Write clear, concise commit messages:
130
+ - ✅ "Add filter option to search command"
131
+ - ✅ "Fix authentication error on Windows"
132
+ - ❌ "Update stuff"
133
+ - ❌ "WIP"
134
+
135
+ ## 🔄 Pull Request Process
136
+
137
+ 1. **Update your fork** with the latest upstream changes:
138
+ ```bash
139
+ git fetch upstream
140
+ git rebase upstream/main
141
+ ```
142
+
143
+ 2. **Push your branch** to your fork:
144
+ ```bash
145
+ git push origin feature/your-feature-name
146
+ ```
147
+
148
+ 3. **Create a Pull Request** on GitHub:
149
+ - Use a clear, descriptive title
150
+ - Describe what changes you made and why
151
+ - Reference any related issues (e.g., "Fixes #123")
152
+ - Include screenshots or examples if applicable
153
+
154
+ 4. **Wait for review**:
155
+ - A maintainer will review your PR
156
+ - Address any feedback or requested changes
157
+ - Once approved, your PR will be merged
158
+
159
+ ### Pull Request Guidelines
160
+
161
+ - **Keep PRs focused**: One feature or fix per PR
162
+ - **Write clear descriptions**: Explain what and why, not just how
163
+ - **Include examples**: Show how to use new features
164
+ - **Update CHANGELOG.md**: Add your changes under the "Unreleased" section
165
+ - **Be responsive**: Respond to review comments promptly
166
+
167
+ ## 📝 Coding Guidelines
168
+
169
+ ### JavaScript Style
170
+
171
+ - Use **ES6+ syntax** (arrow functions, const/let, template literals, etc.)
172
+ - Use **4 spaces** for indentation
173
+ - Use **descriptive variable names**
174
+ - Add **comments** for complex logic
175
+ - Follow existing code style in the project
176
+
177
+ ### Best Practices
178
+
179
+ - **Error handling**: Always handle errors gracefully with helpful messages
180
+ - **User feedback**: Use chalk for colored console output
181
+ - **Async/await**: Prefer async/await over callbacks or raw promises
182
+ - **Modularity**: Keep functions small and focused on a single task
183
+ - **Validation**: Validate user input before processing
184
+ - **Prettier**: Code styling should automatically applied by prettier (i think)
185
+
186
+ ### Example Code Style
187
+
188
+ ```javascript
189
+ import chalk from 'chalk';
190
+
191
+ async function searchMods(query, options = {}) {
192
+ try {
193
+ // Validate input
194
+ if (!query || query.trim() === '') {
195
+ console.error(chalk.red('Error: Search query cannot be empty'));
196
+ return;
197
+ }
198
+
199
+ // Perform search
200
+ const results = await fetchFromModrinth(query, options);
201
+
202
+ // Display results
203
+ if (results.length === 0) {
204
+ console.log(chalk.yellow('No mods found matching your query'));
205
+ return;
206
+ }
207
+
208
+ displayResults(results);
209
+ } catch (error) {
210
+ console.error(chalk.red(`Search failed: ${error.message}`));
211
+ }
212
+ }
213
+ ```
214
+
215
+ ## 🐛 Reporting Issues
216
+
217
+ ### Before Submitting an Issue
218
+
219
+ 1. **Search existing issues** to avoid duplicates
220
+ 2. **Update to the latest version** to see if the issue is already fixed
221
+ 3. **Gather information**:
222
+ - Your operating system and version
223
+ - Node.js version (`node --version`)
224
+ - CLIcraft version (`clicraft --version`)
225
+ - Steps to reproduce the issue
226
+ - Expected vs actual behavior
227
+ - Error messages or logs
228
+
229
+ ### Submitting an Issue
230
+
231
+ When creating an issue, please include:
232
+
233
+ - **Clear title**: Describe the issue in one line
234
+ - **Description**: Explain the issue in detail
235
+ - **Steps to reproduce**: List exact steps to trigger the issue
236
+ - **Expected behavior**: What should happen
237
+ - **Actual behavior**: What actually happens
238
+ - **Environment**: OS, Node.js version, etc.
239
+ - **Screenshots**: If applicable
240
+
241
+ ### Issue Labels
242
+
243
+ - `bug`: Something isn't working
244
+ - `enhancement`: New feature or request
245
+ - `documentation`: Documentation improvements
246
+ - `help wanted`: Extra attention needed
247
+ - `good first issue`: Good for newcomers
248
+
249
+ ## đŸ’Ŧ Community
250
+
251
+ - **GitHub Issues**: For bug reports and feature requests
252
+ - **GitHub Discussions**: For questions and general discussion
253
+ - **Pull Requests**: For code contributions
254
+
255
+ ## 📜 License
256
+
257
+ By contributing to CLIcraft, you agree that your contributions will be licensed under the ISC License.
258
+
259
+ ---
260
+
261
+ Thank you for contributing to CLIcraft! Your efforts help make this tool better for everyone. 🎮✨
package/LICENSE.md ADDED
@@ -0,0 +1,7 @@
1
+ ISC License
2
+
3
+ Copyright 2026 Benjamin Mueller
4
+
5
+ Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.
6
+
7
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,55 @@
1
+ # CLIcraft
2
+ ## [READ THE DOCS](https://benjamin.bsstudios.org/clicraft)
3
+
4
+
5
+ A simple Minecraft Mod Package Manager and launcher written in Node.js. Create and manage Minecraft instances with Fabric or Forge mod loaders, search and install mods from Modrinth, and launch the game directly from the command line.
6
+
7
+ ## Why CLIcraft?
8
+ Unlike other PMs or Launchers, CLIcraft can do both! Simply type a few commands and you're playing fabric or forge minecraft.
9
+
10
+ ## Features
11
+
12
+ - 🎮 **Create Instances** - Set up new Minecraft client or server instances with Fabric or Forge
13
+ - 🔍 **Search Mods** - Find mods on Modrinth with filters for version, loader, and more
14
+ - đŸ“Ļ **Install Mods** - Download and install mods directly to your instance
15
+ - īŋŊ **Upgrade** - Update mods, mod loader, or Minecraft version
16
+ - â„šī¸ **Instance Info** - View detailed information about your instances
17
+ - īŋŊ🔐 **Microsoft Login** - Authenticate with your Microsoft account to play online
18
+ - 🚀 **Launch Game** - Start Minecraft directly from the terminal
19
+
20
+ ## Installation
21
+
22
+ ### Cloning from Source
23
+ ```bash
24
+ # Clone the repository
25
+ git clone https://github.com/theinfamousben/clicraft.git
26
+ cd clicraft
27
+
28
+ # Install dependencies
29
+ npm install
30
+
31
+ # Link globally (optional, for using 'clicraft' command anywhere)
32
+ npm link
33
+ ```
34
+ ### Install NPM Package
35
+ **npm package coming soon!**
36
+
37
+
38
+ ## Requirements
39
+
40
+ - Node.js 18 or higher
41
+ - Java 21 or higher (for running Minecraft)
42
+
43
+ ## Supported Platforms
44
+
45
+ - ✅ Linux
46
+ - ✅ macOS
47
+ - ✅ Windows
48
+
49
+ ## License
50
+
51
+ ISC
52
+
53
+ ## Contributing
54
+
55
+ Contributions are welcome! Please read our [Contributing Guide](CONTRIBUTING.md) to learn how to get started. You can also open an issue or submit a pull request on [GitHub](https://github.com/theinfamousben/clicraft).