DSH plugins typically exist as local directories or private repositories. To sync or share plugins across multiple machines, developers often have to manually handle GitHub repository creation, manifest validation, topic setting, and update strategies. dsh-plugin-publish solves this workflow, allowing developers to publish plugins to a public GitHub repository with a single command, enabling other machines to install them directly.
Core Features¶
- Local Validation: Validates the plugin’s manifest and bundle locally before making any network requests. This avoids silent failures caused by manifest errors, such as checking if
dsh.bundleand patch files exist, and whether the browser’s partially registeredidmatches the package name. - Repository Management: Automatically creates the GitHub repository. If the repository already exists, the tool reuses it instead of throwing an error.
- Directory Tree Commit: Uploads the entire local directory tree to GitHub as a single commit. This means publishing acts as a mirror; files deleted locally will also be deleted remotely.
- Topic Protection: Automatically adds the
dsh-plugintopic while preserving existing user topics, preventing them from being overwritten. - Installation Instructions: After publishing, the tool prints the command to install the plugin on other machines.
- Security Mechanism:
- Tokens are scrubbed from every message and are never leaked.
- Never publishes credentials; it reports suspected credential files in advance.
- Never force pushes unless the
--forceargument is explicitly provided.
Installation and Activation¶
Once installed as a DSH plugin, the /publish-plugin command can be invoked directly within a DSH session.
dsh plugin --profile desktop add github:Gty2408/dsh-plugin-publish
Once enabled, it can be used in any session:
/publish-plugin # Validate plugins in the workspace
/publish-plugin --push # Validate and publish
/publish-plugin ./my-plugin --push --repo custom-name
Typical Usage¶
As a standalone CLI (non-DSH environment):
npx dsh-plugin-publish ./my-plugin --token <token> --yes
As a DSH plugin (requires Node.js 20+):
Invoke the publish command directly within the DSH process:
/publish-plugin --push
Use Cases and Notes¶
This tool is suitable for scenarios where DSH plugins need to be distributed across multiple machines.
- Environment Requirements: Requires Node.js 20+.
- Authentication Methods:
- Device Code Flow (Default): Interactive authorization, suitable for interactive environments.
--token: Non-interactive method, suitable for scripts. The token can be read from~/.dsh/.github-token(classic token, requires repo permissions) or the plugin’s token configuration.
- Known Limitations:
- GitHub API has a 40MB limit for single file transfers, and the tool enforces this limit accordingly.
- The
--forceargument overwrites the branch. - This tool only publishes to GitHub; it does not submit to plugin marketplaces or publish to npm.
- Repo permissions cannot delete repositories; manual cleanup is required.
Summary¶
dsh-plugin-publish simplifies the DSH plugin publishing workflow through local validation, directory tree mirror synchronization, and topic protection. It standardizes and automates plugin sharing and distribution.