jaymd96-pants-clawthor 0.1.2__py3-none-any.whl → 0.1.3__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: jaymd96-pants-clawthor
3
- Version: 0.1.2
3
+ Version: 0.1.3
4
4
  Summary: Pants plugin for compiling Clawthor Claude Code plugins
5
5
  Project-URL: Homepage, https://github.com/anthropics/clawthor
6
6
  Project-URL: Documentation, https://github.com/anthropics/clawthor/tree/main/pants-plugin
@@ -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=KUFUc_odXd1icaCaIeiPIR4mqQGpXlSlEel7IIWHyEU,2663
4
+ pants_clawthor/targets.py,sha256=pvApklAA94qNlkLlX5yRzkkdqBsJiKqor51y4UDeqgQ,1288
5
+ jaymd96_pants_clawthor-0.1.3.dist-info/METADATA,sha256=qBs7kuccEqOJrvxYeFZTzYUKQgFzOhEjxWedN-M3Sgo,4859
6
+ jaymd96_pants_clawthor-0.1.3.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
7
+ jaymd96_pants_clawthor-0.1.3.dist-info/licenses/LICENSE,sha256=y8CeiP6Qd9jxidfFjPkyZhsRjs9XarMIMVDP91lZsJE,1066
8
+ jaymd96_pants_clawthor-0.1.3.dist-info/RECORD,,
pants_clawthor/rules.py CHANGED
@@ -3,8 +3,10 @@
3
3
  import subprocess
4
4
  from dataclasses import dataclass
5
5
 
6
- from pants.engine.rules import collect_rules, goal_rule, rule
7
- from pants.engine.target import Target
6
+ from pants.engine.console import Console
7
+ from pants.engine.goal import Goal, GoalSubsystem
8
+ from pants.engine.rules import collect_rules, goal_rule
9
+ from pants.engine.target import Targets
8
10
 
9
11
  from pants_clawthor.targets import (
10
12
  ClaudoPluginDefinitionField,
@@ -14,51 +16,69 @@ from pants_clawthor.targets import (
14
16
  )
15
17
 
16
18
 
17
- @dataclass(frozen=True)
18
- class ClawthorCompileResult:
19
- """Result of compiling a Clawthor definition."""
20
- exit_code: int
21
- stdout: str
22
- stderr: str
19
+ class ClawthorCompileSubsystem(GoalSubsystem):
20
+ name = "clawthor-compile"
21
+ help = "Compile Clawthor definitions into Claude Code plugins."
23
22
 
24
23
 
25
- @rule
26
- async def compile_claude_plugin(target: ClaudoPluginTarget) -> ClawthorCompileResult:
27
- """Compile a Clawthor definition into a Claude Code plugin."""
24
+ class ClawthorCompile(Goal):
25
+ subsystem_cls = ClawthorCompileSubsystem
26
+ environment_behavior = Goal.EnvironmentBehavior.LOCAL_ONLY
28
27
 
29
- definition_file = target[ClaudoPluginDefinitionField].value
30
- output_dir = target[ClaudoPluginOutputDirField].value
31
- marketplace_mode = target[ClaudoPluginMarketplaceModeField].value.lower() == "true"
32
28
 
33
- # Build clawthor command
34
- cmd = ["clawthor", "compile", definition_file, output_dir]
35
- if marketplace_mode:
36
- cmd.append("--marketplace")
29
+ @goal_rule
30
+ async def clawthor_compile(
31
+ targets: Targets,
32
+ console: Console,
33
+ ) -> ClawthorCompile:
34
+ """Compile Clawthor definitions into Claude Code plugins."""
35
+ exit_code = 0
37
36
 
38
- # Run clawthor
39
- try:
40
- result = subprocess.run(
41
- cmd,
42
- cwd=target.address.spec_path or ".",
43
- capture_output=True,
44
- text=True,
45
- check=False,
37
+ claude_targets = [t for t in targets if isinstance(t, ClaudoPluginTarget)]
38
+
39
+ if not claude_targets:
40
+ console.print_stderr("No claude_plugin targets found.")
41
+ return ClawthorCompile(exit_code=1)
42
+
43
+ for target in claude_targets:
44
+ definition_file = target[ClaudoPluginDefinitionField].value
45
+ output_dir = target[ClaudoPluginOutputDirField].value
46
+ marketplace_mode = target[ClaudoPluginMarketplaceModeField].value.lower() == "true"
47
+
48
+ # Build clawthor command
49
+ cmd = ["clawthor", "compile", definition_file, output_dir]
50
+ if marketplace_mode:
51
+ cmd.append("--marketplace")
52
+
53
+ spec_path = target.address.spec_path or "."
54
+ console.print_stdout(
55
+ f"Compiling {target.address} ({definition_file} -> {output_dir}/)..."
46
56
  )
47
57
 
48
- if result.returncode != 0:
49
- raise RuntimeError(
50
- f"Clawthor compilation failed:\n{result.stderr}"
58
+ try:
59
+ result = subprocess.run(
60
+ cmd,
61
+ cwd=spec_path,
62
+ capture_output=True,
63
+ text=True,
64
+ check=False,
51
65
  )
52
66
 
53
- return ClawthorCompileResult(
54
- exit_code=result.returncode,
55
- stdout=result.stdout,
56
- stderr=result.stderr,
57
- )
58
- except FileNotFoundError:
59
- raise RuntimeError(
60
- "clawthor command not found. Install the clawthor gem: gem install clawthor"
61
- )
67
+ if result.returncode != 0:
68
+ console.print_stderr(f"Compilation failed for {target.address}:")
69
+ console.print_stderr(result.stderr)
70
+ exit_code = 1
71
+ else:
72
+ console.print_stdout(f"Successfully compiled {target.address}")
73
+ if result.stdout.strip():
74
+ console.print_stdout(result.stdout.strip())
75
+ except FileNotFoundError:
76
+ console.print_stderr(
77
+ "clawthor command not found. Install the clawthor gem: gem install clawthor"
78
+ )
79
+ exit_code = 1
80
+
81
+ return ClawthorCompile(exit_code=exit_code)
62
82
 
63
83
 
64
84
  def rules():
@@ -1,8 +0,0 @@
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,,