The DSH ecosystem emphasizes modularity, and plugin development typically involves maintaining a dist/ directory to store distribution packages. As versions iterate, the directory accumulates a large number of old files, making manual management error-prone. dsh-dist-manager aims to solve this problem by automatically managing version archiving within the dist/ directory.
Core Functions¶
This plugin provides a complete distribution directory management solution, with core capabilities including:
- Automatic Archiving: Scans plugin packages in the
dist/directory, groups them by plugin name, and sorts them by version number. - Version Management: Keeps the latest version in the root of the
dist/directory and moves old versions to the archive directory. - WebUI Management: Provides a management interface in the DSH Settings page → Plugin Archive section.
- One-click Operations: Supports archiving all plugins with one click and clearing all archives with one click.
- Status View: Displays the total number of plugins, current version count, and archived version count in real-time.
- Version Recovery: Restores specific versions from the archive directory to the root of the
dist/directory. - Archive Cleaning: Cleans archives for specific plugins or all plugins.
Installation¶
Install the plugin via the following command:
dsh plugin --profile web add <插件目录>
After installation, restart the WebUI to apply the changes.
Typical Usage¶
After releasing a new version
1. Run pnpm pack to generate a new .tgz file into the distribution directory.
2. Open the WebUI Settings page and click “📦 Archive All”.
When needing to restore an old version
Find the target version in the archive details and click the “Restore” button.
To clean up storage space
Click “🗑️ Clean” or “🗑️ Clean All Archives” in the plugin list.
Configuration¶
The configuration read priority is: Config field in cordis.yml > config.json file > Default path.
If not configured, it defaults to the dist/ directory in the parent directory of the plugin directory (applicable to link installation scenarios). It is recommended to configure it directly in cordis.yml:
{
"distDir": "<你的插件分发目录>/dist",
"archiveDir": "<你的插件分发目录>/dist/archive",
"autoArchive": true,
"keepVersions": 1
}
Configuration descriptions:
* distDir: Path to the dist directory.
* archiveDir: Path to the archive directory.
* autoArchive: Whether to auto-archive (reserved feature).
* keepVersions: Number of versions to keep (reserved feature).
Notes¶
- Path Security: All file operations undergo path verification to prevent path traversal attacks.
- Error Handling: All operations have robust error handling and user feedback.
- Real-time Updates: The interface refreshes automatically after status changes.
- Configuration Persistence: Settings are stored in the plugin directory and persist across restarts.
License¶
- Code (
index.js,client.js, and other source files): MIT. - Documentation: CC BY 4.0 (Attribution to Lydia / @feverZHONG is required).