Pants plugin for compiling Clawthor Claude Code plugins
Project description
Pants Clawthor Plugin
A Pants build backend plugin that integrates Clawthor DSL compilation into your Pants build system.
Installation
Install from PyPI:
pip install jaymd96-pants-clawthor
Configuration
Add to your pants.toml:
[python]
plugins = [
"jaymd96-pants-clawthor==0.1.0",
]
Requirements
- Pants >= 2.18.0
- clawthor gem >= 0.3.0 (install with
gem install clawthor) - Python >= 3.9
- Ruby >= 3.0.0 (for clawthor gem)
Ensure clawthor executable is in your PATH:
gem install clawthor
which clawthor # Verify it's available
Usage
Define a Plugin Target
Create a BUILD file in your plugin directory:
claude_plugin(
name="my_plugin",
definition="definition.rb",
output_dir="output",
marketplace=False,
)
Options
- definition (required): Path to the Clawthor definition file (e.g.,
definition.rb) - output_dir (optional): Output directory for generated plugin files (default:
output) - marketplace (optional): Generate marketplace layout instead of plugin layout (
trueorfalse, default:false)
Build the Plugin
pants build //my_plugins:my_plugin
The generated plugin files will be in the output directory specified.
Marketplace Mode
To generate in marketplace layout:
claude_plugin(
name="my_plugin",
definition="definition.rb",
output_dir="output-marketplace",
marketplace=True,
)
Example
my_project/
├── BUILD
├── definition.rb
└── modules/
├── planning.rb
└── quality.rb
BUILD:
claude_plugin(
name="dev_tools",
definition="definition.rb",
output_dir="plugin",
marketplace=False,
)
definition.rb:
workspace :dev_tools do
version "1.0.0"
author "My Team"
end
require_module "./modules/planning.rb"
require_module "./modules/quality.rb"
use :planning
use :quality
Build:
pants build //my_project:dev_tools
Integration with Architect
Use the Architect reference plugin as a base:
# Copy from baseline/definition.rb
claude_plugin(
name="architect",
definition="architect/definition.rb",
output_dir="plugins/architect",
marketplace=False,
)
Then import modules:
require_module "../architect/modules/planning.rb"
require_module "../architect/modules/quality.rb"
use :planning
use :quality
How It Works
The plugin:
- Accepts a Clawthor definition file path
- Invokes
clawthor compilewith appropriate arguments - Generates plugin files in the specified output directory
- Returns the compilation result
No magic—just a clean bridge between Pants and Clawthor.
Troubleshooting
"clawthor command not found"
Install the clawthor gem:
gem install clawthor
Verify it's in PATH:
which clawthor
If using a Ruby version manager (rvm, rbenv, etc.), ensure it's configured:
which ruby # Should show your Ruby version manager's path
Compilation fails with "Definition file not found"
Ensure the definition file path is relative to the BUILD file:
claude_plugin(
name="my_plugin",
definition="definition.rb", # Same directory as BUILD file
)
Output directory is empty
Check that the definition file has valid declarations. Run manually to debug:
cd my_project
clawthor compile definition.rb output
Development
Setup
hatch env create
This creates a virtual environment configured via Hatch.
Run Tests
hatch run test
Formatting and Linting
hatch run format
hatch run lint
Or run individually:
hatch run black src/
hatch run isort src/
hatch run flake8 src/
Publishing
To publish a new version to PyPI:
hatch build
hatch publish
Hatch will use your PyPI credentials from ~/.pypirc or environment variables:
HATCH_INDEX_USER— PyPI usernameHATCH_INDEX_AUTH— PyPI API token
Architecture
Pants Build System
↓
pants-clawthor Plugin (jaymd96-pants-clawthor)
↓ invokes
Clawthor DSL Compiler (clawthor gem)
↓ generates
Claude Code Plugin Files
↓ can be tested with
claude --plugin-dir ./output
License
MIT — See ../clawthor/LICENSE
Related
- Clawthor gem — The DSL compiler
- Architect plugin — Reference implementation
- Pants — Build system
Questions? Open an issue on GitHub
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file jaymd96_pants_clawthor-0.1.0.tar.gz.
File metadata
- Download URL: jaymd96_pants_clawthor-0.1.0.tar.gz
- Upload date:
- Size: 5.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: Hatch/1.16.3 cpython/3.13.0 HTTPX/0.28.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
56dc1f549f3a30fdce1d34167d53fe27f211c68a2a47b3fdd069973556412d2a
|
|
| MD5 |
70d5e1fe2fcb0ff59252e0080253d894
|
|
| BLAKE2b-256 |
e897ae45681b861585717305b6b86ae3e00b1a40f6039da9a6461d137a9ae844
|
File details
Details for the file jaymd96_pants_clawthor-0.1.0-py3-none-any.whl.
File metadata
- Download URL: jaymd96_pants_clawthor-0.1.0-py3-none-any.whl
- Upload date:
- Size: 6.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: Hatch/1.16.3 cpython/3.13.0 HTTPX/0.28.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0a610c3f949965ec669283993997545e092a89f3e74f07ac934de47a3043ac62
|
|
| MD5 |
9c45d611472b6fbebb10445a85c3bd3a
|
|
| BLAKE2b-256 |
d6966ae319ee0bb2900a8f2b1e204c28bcd96889b2f4e15def9df254b1470d28
|