vscplugit
v1.0.0
Published
A TypeScript CLI tool for downloading, installing, and uninstalling VSCode extensions.
Maintainers
Readme
vscplugit
Overview
vscplugit is an ESM-only, TypeScript-based CLI tool for downloading, installing, and uninstalling Visual Studio Code extensions. Leveraging modern packages like inquirer and ora alongside the robust vscode-marketplace-client API, vscplugit offers a streamlined way to manage your VSCode extensions directly from the command line.
Index
Features
- Download Extensions: Retrieve the latest VSCode extension VSIX file from the marketplace.
- Install Extensions: Install an extension either from an existing VSIX file or by downloading the latest version first.
- Uninstall Extensions: Remove a VSCode extension using its publisher and extension name.
- ESM-Only Architecture: Fully leverages modern ESM features in Node.js (v18+).
- Modular Command Registration: Built using SOLID principles for easy extension and maintenance.
- Clear Error Handling: Uses custom error classes to provide precise and descriptive error messages.
Installation
Install vscplugit globally using npm:
npm install -g vscplugitOr clone the repository and build it locally:
git clone https://github.com/ManuelGil/vscplugit.git
cd vscplugit
npm install
npm run buildUsage
After installation, use vscplugit from your command line. Below are some examples.
Download Extension
Download the latest VSCode extension VSIX file:
vscplugit download --publisher <publisher> --extension <extension> [--output <outputDir>]Options:
--publisher, -p: Publisher name of the extension.--extension, -e: Name of the extension.--output, -o: (Optional) Directory where the VSIX file will be saved (default:./downloads).
Install Extension
The install command is versatile—it can download the VSIX file before installing it or install directly from an existing VSIX file.
Example: Install from Existing VSIX File
vscplugit install --publisher <publisher> --extension <extension> --file /path/to/extension.vsixOptions:
--file, -f: Path to an existing VSIX file to install.
Example: Download Then Install
If you do not supply a VSIX file, the tool will download the latest VSIX file from the marketplace before installing it:
vscplugit install --publisher <publisher> --extension <extension> [--output <downloadDir>]Options:
--output, -o: (Optional) Directory to save the downloaded VSIX file (default:./downloads).
Combined Installation Example
You can combine options to customize your workflow. For example, to install an extension while specifying both a download directory and a fallback VSIX file path:
vscplugit install --publisher ms-vscode --extension cpptools --output ./my-downloads --file ./fallback/cpptools.vsixIn this scenario, if the fallback VSIX file isn’t found, the tool downloads the file to ./my-downloads before proceeding with the installation.
Debugging & Verbose Mode
For more detailed output during execution, you can enable verbose logging (if supported by your environment):
VERBOSE=true vscplugit download --publisher ms-vscode --extension cpptoolsNote: Ensure you are using Node.js v18+ and an ESM-compatible shell.
Uninstall Extension
Remove a VSCode extension by specifying its publisher and extension name:
vscplugit uninstall --publisher <publisher> --extension <extension>Options:
--publisher, -p: Publisher name of the extension.--extension, -e: Name of the extension.
Error Handling
vscplugit employs custom error classes for precise error management. For example:
try {
// Execute a command
} catch (error) {
if (error instanceof ExtensionNotFoundError) {
console.error('Extension not found:', error.message);
} else if (error instanceof VersionNotFoundError) {
console.error('Version not found:', error.message);
} else if (error instanceof VsixFileNotFoundError) {
console.error('VSIX file not found:', error.message);
} else {
console.error('An unexpected error occurred:', error);
}
}Support
If you encounter any issues or have suggestions for improvements, please open an issue on GitHub.
Feedback
If you enjoy using CodeMark+, please consider leaving a review on the VSCode Marketplace.
Follow Me
Stay updated on the latest features, improvements, and future projects by following me:
Contributing
We welcome contributions from the community! To contribute, fork the GitHub repository and submit a pull request.
Before contributing, please review our Contribution Guidelines for details on coding standards and best practices.
Code of Conduct
We strive to create a welcoming, inclusive, and respectful environment for all contributors. Please read our Code of Conduct before participating in this project.
Changelog
See the full list of changes in the CHANGELOG.md file.
License
This extension is licensed under the MIT License. See the MIT License for more details.
