jaymd96-pants-clawthor 0.1.0__py3-none-any.whl → 0.1.2__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.
@@ -0,0 +1,242 @@
1
+ Metadata-Version: 2.4
2
+ Name: jaymd96-pants-clawthor
3
+ Version: 0.1.2
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
+ Provides-Extra: dev
26
+ Requires-Dist: black>=23.0; extra == 'dev'
27
+ Requires-Dist: flake8>=6.0; extra == 'dev'
28
+ Requires-Dist: isort>=5.0; extra == 'dev'
29
+ Requires-Dist: pytest-cov>=4.0; extra == 'dev'
30
+ Requires-Dist: pytest>=7.0; extra == 'dev'
31
+ Description-Content-Type: text/markdown
32
+
33
+ # Pants Clawthor Plugin
34
+
35
+ Optional Pants backend that compiles Clawthor plugins as part of your build.
36
+
37
+ **Use this when**: You define plugins in `BUILD` files and want automatic compilation via Pants.
38
+
39
+ **Don't use if**: You just want to compile manually with `clawthor compile` (use the gem directly instead).
40
+
41
+ ## Installation
42
+
43
+ ### 1. Install clawthor gem
44
+
45
+ ```bash
46
+ gem install clawthor
47
+ which clawthor # Verify it's available
48
+ ```
49
+
50
+ ### 2. Add to pants.toml
51
+
52
+ ```toml
53
+ [GLOBAL]
54
+ plugins = [
55
+ "jaymd96-pants-clawthor==0.1.0",
56
+ ]
57
+ ```
58
+
59
+ ### Requirements
60
+
61
+ - **Pants** 2.18+
62
+ - **Python** 3.9+
63
+ - **Ruby** 3.0+
64
+ - **clawthor gem** 0.3.0+
65
+
66
+ ## Quick Start
67
+
68
+ ### 1. Create a BUILD file
69
+
70
+ ```python
71
+ # plugins/my_plugin/BUILD
72
+ claude_plugin(
73
+ name="my_plugin",
74
+ definition="definition.rb",
75
+ )
76
+ ```
77
+
78
+ ### 2. Create definition.rb
79
+
80
+ ```ruby
81
+ # plugins/my_plugin/definition.rb
82
+ workspace :my_plugin do
83
+ version "1.0.0"
84
+ author "My Team"
85
+ end
86
+
87
+ skill :example do
88
+ description "Example skill"
89
+ end
90
+
91
+ command :hello do
92
+ description "Say hello"
93
+ template { prompt "Say hello" }
94
+ end
95
+ ```
96
+
97
+ ### 3. Build
98
+
99
+ ```bash
100
+ pants build //plugins/my_plugin:my_plugin
101
+ ```
102
+
103
+ That's it! Generated plugin is in `plugins/my_plugin/output/`.
104
+
105
+ ## Target Options
106
+
107
+ | Option | Type | Default | Description |
108
+ |--------|------|---------|-------------|
109
+ | `definition` | string | required | Path to `definition.rb` |
110
+ | `output_dir` | string | `output` | Where to generate files |
111
+ | `marketplace` | bool | `false` | Use marketplace layout? |
112
+
113
+ ## Examples
114
+
115
+ ### Basic plugin
116
+
117
+ ```python
118
+ # plugins/docs/BUILD
119
+ claude_plugin(
120
+ name="docs",
121
+ definition="definition.rb",
122
+ )
123
+ ```
124
+
125
+ ### With modules
126
+
127
+ ```python
128
+ # plugins/dev/BUILD
129
+ claude_plugin(
130
+ name="dev",
131
+ definition="definition.rb",
132
+ output_dir="plugin",
133
+ )
134
+ ```
135
+
136
+ ```ruby
137
+ # plugins/dev/definition.rb
138
+ workspace :dev_tools do
139
+ version "1.0.0"
140
+ end
141
+
142
+ require_relative './modules/planning'
143
+ use :planning
144
+ ```
145
+
146
+ ### Marketplace layout
147
+
148
+ ```python
149
+ claude_plugin(
150
+ name="release",
151
+ definition="definition.rb",
152
+ marketplace=True,
153
+ )
154
+ ```
155
+
156
+ ## Reusing Claudo modules
157
+
158
+ Copy Claudo modules into your project:
159
+
160
+ ```bash
161
+ cp ../baseline/modules/planning.rb plugins/my_plugin/
162
+ ```
163
+
164
+ Then use them:
165
+
166
+ ```ruby
167
+ require_relative './modules/planning'
168
+
169
+ workspace :my_plugin do
170
+ use :planning
171
+ end
172
+ ```
173
+
174
+ ## Troubleshooting
175
+
176
+ ### "clawthor command not found"
177
+
178
+ 1. Install: `gem install clawthor`
179
+ 2. Verify: `which clawthor`
180
+ 3. If using rbenv/rvm, check Ruby version: `ruby --version`
181
+
182
+ ### Compilation fails
183
+
184
+ Check definition file manually:
185
+ ```bash
186
+ cd plugins/my_plugin
187
+ clawthor compile definition.rb output/
188
+ ```
189
+
190
+ ### Path issues
191
+
192
+ Make sure `definition` is relative to the BUILD file:
193
+
194
+ ```python
195
+ claude_plugin(
196
+ name="my_plugin",
197
+ definition="definition.rb", # Same dir as BUILD
198
+ )
199
+ ```
200
+
201
+ ## Development
202
+
203
+ ### Setup
204
+
205
+ ```bash
206
+ cd pants-plugin
207
+ hatch env create
208
+ hatch run test
209
+ ```
210
+
211
+ ### Test your backend
212
+
213
+ ```bash
214
+ hatch run test
215
+ ```
216
+
217
+ ### Format code
218
+
219
+ ```bash
220
+ hatch run fmt
221
+ ```
222
+
223
+ ## How It Works
224
+
225
+ This backend:
226
+ 1. Takes a `definition.rb` file
227
+ 2. Runs `clawthor compile` automatically
228
+ 3. Generates plugin files
229
+ 4. Makes them available to Pants
230
+
231
+ That's all—it's a simple bridge between Pants and Clawthor.
232
+
233
+ ## Related
234
+
235
+ - [Clawthor Gem](../clawthor/README.md) — The DSL compiler
236
+ - [Baseline Plugin](../baseline/README.md) — Reference & modules
237
+ - [Clawthor Monorepo](../README.md) — Overview
238
+ - [Pants Docs](https://www.pantsbuild.org/) — Build system
239
+
240
+ ## License
241
+
242
+ MIT — See [../clawthor/LICENSE](../clawthor/LICENSE)
@@ -0,0 +1,8 @@
1
+ pants_clawthor/__init__.py,sha256=dK1Vo_AAC_Y-Ga9xq2EtBsy8XolwPrX4ZCM_Vb_zEF4,96
2
+ pants_clawthor/register.py,sha256=1-Xh9V6ZDIMS7pIPxto4wim6EpSHb2gJpEo5XDEBlmU,366
3
+ pants_clawthor/rules.py,sha256=Rpf9dmikcbBHzwDbfGschRZEW3RxnNcRELoXfKcKte0,1781
4
+ pants_clawthor/targets.py,sha256=pvApklAA94qNlkLlX5yRzkkdqBsJiKqor51y4UDeqgQ,1288
5
+ jaymd96_pants_clawthor-0.1.2.dist-info/METADATA,sha256=kKn7kktthocG6EYYHfwIR-tiZ40ltGf0otp1jmNk7X0,4859
6
+ jaymd96_pants_clawthor-0.1.2.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
7
+ jaymd96_pants_clawthor-0.1.2.dist-info/licenses/LICENSE,sha256=y8CeiP6Qd9jxidfFjPkyZhsRjs9XarMIMVDP91lZsJE,1066
8
+ jaymd96_pants_clawthor-0.1.2.dist-info/RECORD,,
@@ -1,17 +1,12 @@
1
1
  """Register clawthor plugin with Pants."""
2
2
 
3
- from pants.engine.rules import collect_rules
4
- from pants.engine.target import TargetRuleset
5
-
6
3
  from pants_clawthor.rules import rules as clawthor_rules
7
4
  from pants_clawthor.targets import ClaudoPluginTarget
8
5
 
9
6
 
10
7
  def rules():
11
8
  """Register all rules for the clawthor plugin."""
12
- return [
13
- *collect_rules(clawthor_rules),
14
- ]
9
+ return [*clawthor_rules()]
15
10
 
16
11
 
17
12
  def target_types():
pants_clawthor/rules.py CHANGED
@@ -1,22 +1,29 @@
1
1
  """Build rules for Clawthor plugin compilation."""
2
2
 
3
- import os
4
- import shutil
5
3
  import subprocess
6
- from pathlib import Path
4
+ from dataclasses import dataclass
7
5
 
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
6
+ from pants.engine.rules import collect_rules, goal_rule, rule
12
7
  from pants.engine.target import Target
13
- from pants.util.dirutil import safe_mkdir
14
8
 
15
- from pants_clawthor.targets import ClaudoPluginTarget
9
+ from pants_clawthor.targets import (
10
+ ClaudoPluginDefinitionField,
11
+ ClaudoPluginMarketplaceModeField,
12
+ ClaudoPluginOutputDirField,
13
+ ClaudoPluginTarget,
14
+ )
15
+
16
+
17
+ @dataclass(frozen=True)
18
+ class ClawthorCompileResult:
19
+ """Result of compiling a Clawthor definition."""
20
+ exit_code: int
21
+ stdout: str
22
+ stderr: str
16
23
 
17
24
 
18
25
  @rule
19
- async def compile_claude_plugin(target: ClaudoPluginTarget) -> ProcessResult:
26
+ async def compile_claude_plugin(target: ClaudoPluginTarget) -> ClawthorCompileResult:
20
27
  """Compile a Clawthor definition into a Claude Code plugin."""
21
28
 
22
29
  definition_file = target[ClaudoPluginDefinitionField].value
@@ -32,7 +39,7 @@ async def compile_claude_plugin(target: ClaudoPluginTarget) -> ProcessResult:
32
39
  try:
33
40
  result = subprocess.run(
34
41
  cmd,
35
- cwd=target.address.spec_path,
42
+ cwd=target.address.spec_path or ".",
36
43
  capture_output=True,
37
44
  text=True,
38
45
  check=False,
@@ -43,7 +50,7 @@ async def compile_claude_plugin(target: ClaudoPluginTarget) -> ProcessResult:
43
50
  f"Clawthor compilation failed:\n{result.stderr}"
44
51
  )
45
52
 
46
- return ProcessResult(
53
+ return ClawthorCompileResult(
47
54
  exit_code=result.returncode,
48
55
  stdout=result.stdout,
49
56
  stderr=result.stderr,
@@ -54,4 +61,5 @@ async def compile_claude_plugin(target: ClaudoPluginTarget) -> ProcessResult:
54
61
  )
55
62
 
56
63
 
57
- rules = [compile_claude_plugin]
64
+ def rules():
65
+ return collect_rules()
@@ -1,293 +0,0 @@
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)
@@ -1,8 +0,0 @@
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,,