jaymd96-pants-clawthor 0.1.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- jaymd96_pants_clawthor-0.1.0.dist-info/METADATA +293 -0
- jaymd96_pants_clawthor-0.1.0.dist-info/RECORD +8 -0
- jaymd96_pants_clawthor-0.1.0.dist-info/WHEEL +4 -0
- jaymd96_pants_clawthor-0.1.0.dist-info/licenses/LICENSE +21 -0
- pants_clawthor/__init__.py +5 -0
- pants_clawthor/register.py +19 -0
- pants_clawthor/rules.py +57 -0
- pants_clawthor/targets.py +47 -0
|
@@ -0,0 +1,293 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: jaymd96-pants-clawthor
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Pants plugin for compiling Clawthor Claude Code plugins
|
|
5
|
+
Project-URL: Homepage, https://github.com/anthropics/clawthor
|
|
6
|
+
Project-URL: Documentation, https://github.com/anthropics/clawthor/tree/main/pants-plugin
|
|
7
|
+
Project-URL: Repository, https://github.com/anthropics/clawthor.git
|
|
8
|
+
Project-URL: Issues, https://github.com/anthropics/clawthor/issues
|
|
9
|
+
Author-email: jaymd96 <jay@anthropic.com>
|
|
10
|
+
License: MIT
|
|
11
|
+
License-File: LICENSE
|
|
12
|
+
Keywords: claude,clawthor,dsl,pants,plugin
|
|
13
|
+
Classifier: Development Status :: 3 - Alpha
|
|
14
|
+
Classifier: Environment :: Plugins
|
|
15
|
+
Classifier: Intended Audience :: Developers
|
|
16
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
17
|
+
Classifier: Operating System :: OS Independent
|
|
18
|
+
Classifier: Programming Language :: Python :: 3
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
23
|
+
Classifier: Topic :: Software Development :: Build Tools
|
|
24
|
+
Requires-Python: >=3.9
|
|
25
|
+
Requires-Dist: pants>=2.18.0
|
|
26
|
+
Provides-Extra: dev
|
|
27
|
+
Requires-Dist: black>=23.0; extra == 'dev'
|
|
28
|
+
Requires-Dist: flake8>=6.0; extra == 'dev'
|
|
29
|
+
Requires-Dist: isort>=5.0; extra == 'dev'
|
|
30
|
+
Requires-Dist: pytest-cov>=4.0; extra == 'dev'
|
|
31
|
+
Requires-Dist: pytest>=7.0; extra == 'dev'
|
|
32
|
+
Description-Content-Type: text/markdown
|
|
33
|
+
|
|
34
|
+
# Pants Clawthor Plugin
|
|
35
|
+
|
|
36
|
+
A Pants build backend plugin that integrates Clawthor DSL compilation into your Pants build system.
|
|
37
|
+
|
|
38
|
+
## Installation
|
|
39
|
+
|
|
40
|
+
Install from PyPI:
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
pip install jaymd96-pants-clawthor
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## Configuration
|
|
47
|
+
|
|
48
|
+
Add to your `pants.toml`:
|
|
49
|
+
|
|
50
|
+
```toml
|
|
51
|
+
[python]
|
|
52
|
+
plugins = [
|
|
53
|
+
"jaymd96-pants-clawthor==0.1.0",
|
|
54
|
+
]
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
## Requirements
|
|
58
|
+
|
|
59
|
+
- **Pants** >= 2.18.0
|
|
60
|
+
- **clawthor gem** >= 0.3.0 (install with `gem install clawthor`)
|
|
61
|
+
- **Python** >= 3.9
|
|
62
|
+
- **Ruby** >= 3.0.0 (for clawthor gem)
|
|
63
|
+
|
|
64
|
+
Ensure `clawthor` executable is in your PATH:
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
gem install clawthor
|
|
68
|
+
which clawthor # Verify it's available
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
## Usage
|
|
72
|
+
|
|
73
|
+
### Define a Plugin Target
|
|
74
|
+
|
|
75
|
+
Create a BUILD file in your plugin directory:
|
|
76
|
+
|
|
77
|
+
```python
|
|
78
|
+
claude_plugin(
|
|
79
|
+
name="my_plugin",
|
|
80
|
+
definition="definition.rb",
|
|
81
|
+
output_dir="output",
|
|
82
|
+
marketplace=False,
|
|
83
|
+
)
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
### Options
|
|
87
|
+
|
|
88
|
+
- **definition** (required): Path to the Clawthor definition file (e.g., `definition.rb`)
|
|
89
|
+
- **output_dir** (optional): Output directory for generated plugin files (default: `output`)
|
|
90
|
+
- **marketplace** (optional): Generate marketplace layout instead of plugin layout (`true` or `false`, default: `false`)
|
|
91
|
+
|
|
92
|
+
### Build the Plugin
|
|
93
|
+
|
|
94
|
+
```bash
|
|
95
|
+
pants build //my_plugins:my_plugin
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
The generated plugin files will be in the output directory specified.
|
|
99
|
+
|
|
100
|
+
### Marketplace Mode
|
|
101
|
+
|
|
102
|
+
To generate in marketplace layout:
|
|
103
|
+
|
|
104
|
+
```python
|
|
105
|
+
claude_plugin(
|
|
106
|
+
name="my_plugin",
|
|
107
|
+
definition="definition.rb",
|
|
108
|
+
output_dir="output-marketplace",
|
|
109
|
+
marketplace=True,
|
|
110
|
+
)
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
## Example
|
|
114
|
+
|
|
115
|
+
```
|
|
116
|
+
my_project/
|
|
117
|
+
├── BUILD
|
|
118
|
+
├── definition.rb
|
|
119
|
+
└── modules/
|
|
120
|
+
├── planning.rb
|
|
121
|
+
└── quality.rb
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
**BUILD**:
|
|
125
|
+
```python
|
|
126
|
+
claude_plugin(
|
|
127
|
+
name="dev_tools",
|
|
128
|
+
definition="definition.rb",
|
|
129
|
+
output_dir="plugin",
|
|
130
|
+
marketplace=False,
|
|
131
|
+
)
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
**definition.rb**:
|
|
135
|
+
```ruby
|
|
136
|
+
workspace :dev_tools do
|
|
137
|
+
version "1.0.0"
|
|
138
|
+
author "My Team"
|
|
139
|
+
end
|
|
140
|
+
|
|
141
|
+
require_module "./modules/planning.rb"
|
|
142
|
+
require_module "./modules/quality.rb"
|
|
143
|
+
|
|
144
|
+
use :planning
|
|
145
|
+
use :quality
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
**Build**:
|
|
149
|
+
```bash
|
|
150
|
+
pants build //my_project:dev_tools
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
## Integration with Architect
|
|
154
|
+
|
|
155
|
+
Use the Architect reference plugin as a base:
|
|
156
|
+
|
|
157
|
+
```python
|
|
158
|
+
# Copy from baseline/definition.rb
|
|
159
|
+
claude_plugin(
|
|
160
|
+
name="architect",
|
|
161
|
+
definition="architect/definition.rb",
|
|
162
|
+
output_dir="plugins/architect",
|
|
163
|
+
marketplace=False,
|
|
164
|
+
)
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
Then import modules:
|
|
168
|
+
|
|
169
|
+
```ruby
|
|
170
|
+
require_module "../architect/modules/planning.rb"
|
|
171
|
+
require_module "../architect/modules/quality.rb"
|
|
172
|
+
|
|
173
|
+
use :planning
|
|
174
|
+
use :quality
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
## How It Works
|
|
178
|
+
|
|
179
|
+
The plugin:
|
|
180
|
+
1. Accepts a Clawthor definition file path
|
|
181
|
+
2. Invokes `clawthor compile` with appropriate arguments
|
|
182
|
+
3. Generates plugin files in the specified output directory
|
|
183
|
+
4. Returns the compilation result
|
|
184
|
+
|
|
185
|
+
No magic—just a clean bridge between Pants and Clawthor.
|
|
186
|
+
|
|
187
|
+
## Troubleshooting
|
|
188
|
+
|
|
189
|
+
### "clawthor command not found"
|
|
190
|
+
Install the clawthor gem:
|
|
191
|
+
```bash
|
|
192
|
+
gem install clawthor
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
Verify it's in PATH:
|
|
196
|
+
```bash
|
|
197
|
+
which clawthor
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
If using a Ruby version manager (rvm, rbenv, etc.), ensure it's configured:
|
|
201
|
+
```bash
|
|
202
|
+
which ruby # Should show your Ruby version manager's path
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
### Compilation fails with "Definition file not found"
|
|
206
|
+
Ensure the definition file path is relative to the BUILD file:
|
|
207
|
+
|
|
208
|
+
```python
|
|
209
|
+
claude_plugin(
|
|
210
|
+
name="my_plugin",
|
|
211
|
+
definition="definition.rb", # Same directory as BUILD file
|
|
212
|
+
)
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
### Output directory is empty
|
|
216
|
+
Check that the definition file has valid declarations. Run manually to debug:
|
|
217
|
+
|
|
218
|
+
```bash
|
|
219
|
+
cd my_project
|
|
220
|
+
clawthor compile definition.rb output
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
## Development
|
|
224
|
+
|
|
225
|
+
### Setup
|
|
226
|
+
|
|
227
|
+
```bash
|
|
228
|
+
hatch env create
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
This creates a virtual environment configured via Hatch.
|
|
232
|
+
|
|
233
|
+
### Run Tests
|
|
234
|
+
|
|
235
|
+
```bash
|
|
236
|
+
hatch run test
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
### Formatting and Linting
|
|
240
|
+
|
|
241
|
+
```bash
|
|
242
|
+
hatch run format
|
|
243
|
+
hatch run lint
|
|
244
|
+
```
|
|
245
|
+
|
|
246
|
+
Or run individually:
|
|
247
|
+
|
|
248
|
+
```bash
|
|
249
|
+
hatch run black src/
|
|
250
|
+
hatch run isort src/
|
|
251
|
+
hatch run flake8 src/
|
|
252
|
+
```
|
|
253
|
+
|
|
254
|
+
## Publishing
|
|
255
|
+
|
|
256
|
+
To publish a new version to PyPI:
|
|
257
|
+
|
|
258
|
+
```bash
|
|
259
|
+
hatch build
|
|
260
|
+
hatch publish
|
|
261
|
+
```
|
|
262
|
+
|
|
263
|
+
Hatch will use your PyPI credentials from `~/.pypirc` or environment variables:
|
|
264
|
+
- `HATCH_INDEX_USER` — PyPI username
|
|
265
|
+
- `HATCH_INDEX_AUTH` — PyPI API token
|
|
266
|
+
|
|
267
|
+
## Architecture
|
|
268
|
+
|
|
269
|
+
```
|
|
270
|
+
Pants Build System
|
|
271
|
+
↓
|
|
272
|
+
pants-clawthor Plugin (jaymd96-pants-clawthor)
|
|
273
|
+
↓ invokes
|
|
274
|
+
Clawthor DSL Compiler (clawthor gem)
|
|
275
|
+
↓ generates
|
|
276
|
+
Claude Code Plugin Files
|
|
277
|
+
↓ can be tested with
|
|
278
|
+
claude --plugin-dir ./output
|
|
279
|
+
```
|
|
280
|
+
|
|
281
|
+
## License
|
|
282
|
+
|
|
283
|
+
MIT — See [../clawthor/LICENSE](../clawthor/LICENSE)
|
|
284
|
+
|
|
285
|
+
## Related
|
|
286
|
+
|
|
287
|
+
- [Clawthor gem](../clawthor/) — The DSL compiler
|
|
288
|
+
- [Architect plugin](../baseline/) — Reference implementation
|
|
289
|
+
- [Pants](https://www.pantsbuild.org/) — Build system
|
|
290
|
+
|
|
291
|
+
---
|
|
292
|
+
|
|
293
|
+
**Questions?** Open an issue on [GitHub](https://github.com/anthropics/clawthor/issues)
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
pants_clawthor/__init__.py,sha256=dK1Vo_AAC_Y-Ga9xq2EtBsy8XolwPrX4ZCM_Vb_zEF4,96
|
|
2
|
+
pants_clawthor/register.py,sha256=quSgKINdumPxMpyNGpgcFu_xeX06Z_UivIjhaoD9MGo,486
|
|
3
|
+
pants_clawthor/rules.py,sha256=LOvRBq4nqiNAcD2T0zoIqVKmD9SCqgdJwH8hjbZO97M,1667
|
|
4
|
+
pants_clawthor/targets.py,sha256=pvApklAA94qNlkLlX5yRzkkdqBsJiKqor51y4UDeqgQ,1288
|
|
5
|
+
jaymd96_pants_clawthor-0.1.0.dist-info/METADATA,sha256=ADy5lwWGM-E9ih4QnykSD8JTD2hfZqoIjlxHI4U2n4E,6056
|
|
6
|
+
jaymd96_pants_clawthor-0.1.0.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
|
|
7
|
+
jaymd96_pants_clawthor-0.1.0.dist-info/licenses/LICENSE,sha256=y8CeiP6Qd9jxidfFjPkyZhsRjs9XarMIMVDP91lZsJE,1066
|
|
8
|
+
jaymd96_pants_clawthor-0.1.0.dist-info/RECORD,,
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Anthropic
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"""Register clawthor plugin with Pants."""
|
|
2
|
+
|
|
3
|
+
from pants.engine.rules import collect_rules
|
|
4
|
+
from pants.engine.target import TargetRuleset
|
|
5
|
+
|
|
6
|
+
from pants_clawthor.rules import rules as clawthor_rules
|
|
7
|
+
from pants_clawthor.targets import ClaudoPluginTarget
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
def rules():
|
|
11
|
+
"""Register all rules for the clawthor plugin."""
|
|
12
|
+
return [
|
|
13
|
+
*collect_rules(clawthor_rules),
|
|
14
|
+
]
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
def target_types():
|
|
18
|
+
"""Register target types for the clawthor plugin."""
|
|
19
|
+
return [ClaudoPluginTarget]
|
pants_clawthor/rules.py
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"""Build rules for Clawthor plugin compilation."""
|
|
2
|
+
|
|
3
|
+
import os
|
|
4
|
+
import shutil
|
|
5
|
+
import subprocess
|
|
6
|
+
from pathlib import Path
|
|
7
|
+
|
|
8
|
+
from pants.engine.engine_types import ProcessResult
|
|
9
|
+
from pants.engine.fs import Digest, MergedDigest
|
|
10
|
+
from pants.engine.process import Process, ProcessResult
|
|
11
|
+
from pants.engine.rules import rule
|
|
12
|
+
from pants.engine.target import Target
|
|
13
|
+
from pants.util.dirutil import safe_mkdir
|
|
14
|
+
|
|
15
|
+
from pants_clawthor.targets import ClaudoPluginTarget
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
@rule
|
|
19
|
+
async def compile_claude_plugin(target: ClaudoPluginTarget) -> ProcessResult:
|
|
20
|
+
"""Compile a Clawthor definition into a Claude Code plugin."""
|
|
21
|
+
|
|
22
|
+
definition_file = target[ClaudoPluginDefinitionField].value
|
|
23
|
+
output_dir = target[ClaudoPluginOutputDirField].value
|
|
24
|
+
marketplace_mode = target[ClaudoPluginMarketplaceModeField].value.lower() == "true"
|
|
25
|
+
|
|
26
|
+
# Build clawthor command
|
|
27
|
+
cmd = ["clawthor", "compile", definition_file, output_dir]
|
|
28
|
+
if marketplace_mode:
|
|
29
|
+
cmd.append("--marketplace")
|
|
30
|
+
|
|
31
|
+
# Run clawthor
|
|
32
|
+
try:
|
|
33
|
+
result = subprocess.run(
|
|
34
|
+
cmd,
|
|
35
|
+
cwd=target.address.spec_path,
|
|
36
|
+
capture_output=True,
|
|
37
|
+
text=True,
|
|
38
|
+
check=False,
|
|
39
|
+
)
|
|
40
|
+
|
|
41
|
+
if result.returncode != 0:
|
|
42
|
+
raise RuntimeError(
|
|
43
|
+
f"Clawthor compilation failed:\n{result.stderr}"
|
|
44
|
+
)
|
|
45
|
+
|
|
46
|
+
return ProcessResult(
|
|
47
|
+
exit_code=result.returncode,
|
|
48
|
+
stdout=result.stdout,
|
|
49
|
+
stderr=result.stderr,
|
|
50
|
+
)
|
|
51
|
+
except FileNotFoundError:
|
|
52
|
+
raise RuntimeError(
|
|
53
|
+
"clawthor command not found. Install the clawthor gem: gem install clawthor"
|
|
54
|
+
)
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
rules = [compile_claude_plugin]
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"""Target types for Clawthor plugin compilation."""
|
|
2
|
+
|
|
3
|
+
from pants.engine.target import (
|
|
4
|
+
COMMON_TARGET_FIELDS,
|
|
5
|
+
SingleSourceField,
|
|
6
|
+
StringField,
|
|
7
|
+
Target,
|
|
8
|
+
)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class ClaudoPluginDefinitionField(SingleSourceField):
|
|
12
|
+
"""Path to the Clawthor definition.rb file."""
|
|
13
|
+
|
|
14
|
+
alias = "definition"
|
|
15
|
+
help = "Path to the Clawthor definition file (e.g., 'definition.rb')"
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
class ClaudoPluginOutputDirField(StringField):
|
|
19
|
+
"""Output directory for the generated plugin."""
|
|
20
|
+
|
|
21
|
+
alias = "output_dir"
|
|
22
|
+
default = "output"
|
|
23
|
+
help = "Output directory for generated plugin files (default: 'output')"
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
class ClaudoPluginMarketplaceModeField(StringField):
|
|
27
|
+
"""Whether to generate marketplace layout."""
|
|
28
|
+
|
|
29
|
+
alias = "marketplace"
|
|
30
|
+
default = "false"
|
|
31
|
+
help = "Generate marketplace layout instead of plugin layout ('true' or 'false')"
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
class ClaudoPluginTarget(Target):
|
|
35
|
+
"""A Claude Code plugin built from a Clawthor definition."""
|
|
36
|
+
|
|
37
|
+
alias = "claude_plugin"
|
|
38
|
+
core_fields = (
|
|
39
|
+
*COMMON_TARGET_FIELDS,
|
|
40
|
+
ClaudoPluginDefinitionField,
|
|
41
|
+
ClaudoPluginOutputDirField,
|
|
42
|
+
ClaudoPluginMarketplaceModeField,
|
|
43
|
+
)
|
|
44
|
+
help = (
|
|
45
|
+
"A Claude Code plugin compiled from a Clawthor definition.\n\n"
|
|
46
|
+
"Requires the clawthor gem to be installed."
|
|
47
|
+
)
|