Authoring Plugins
Create reusable libraries that others can install via argsh add.
Structure
A plugin is a directory with:
Metadata
Fields
| Field | Required | Description |
|---|---|---|
name | yes | Plugin name. Must match [a-zA-Z0-9_-]+. |
version | for publish | Semver version (x.y.z, optional -pre suffix). Required for argsh publish, optional otherwise. |
description | no | Short description of the plugin. |
requires.argsh | no | Semver constraint for the minimum argsh version (e.g. >=0.9.0). On argsh add, a warning is printed if the installed argsh does not satisfy the constraint. |
depends | no | List of plugin dependencies. Each entry is a plugin name or name@version. Dependencies are auto-installed when the plugin is added via argsh add. |
Library file
The main .sh file is what import mylib sources. Follow argsh conventions:
Testing
Write bats tests alongside the library:
Run with:
Publishing
Plugins are distributed as OCI artifacts via the arg-sh/libs repository. You can also publish to your own OCI registry.
Validation
argsh publish validates your argsh-plugin.yml before pushing:
nameandversionfields must be present.namemust match[a-zA-Z0-9_-]+.versionmust be valid semver (x.y.zwith optional-presuffix). Tags likelatestor bare integers are rejected.
Publishing to a registry
Publishing requires the native builtin (.so) with OCI push support. Install it with argsh builtin install if missing.
Contributing to arg-sh/libs
- Fork
github.com/arg-sh/libs - Create your library directory with the structure above
- Add tests
- Submit a pull request
Optional: Rust builtins
For performance-critical operations, plugins can include a Rust builtin .so that provides native implementations of bash functions. See the libs repo for the workspace setup.
The .so is loaded automatically when available. The .sh file provides the pure-bash fallback.