multi-lang-build 0.2.8__py3-none-any.whl → 0.2.10__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.
Files changed (38) hide show
  1. multi_lang_build/__init__.py +4 -4
  2. multi_lang_build/cli.py +3 -2
  3. multi_lang_build/compiler/__init__.py +1 -1
  4. multi_lang_build/compiler/go_compiler.py +388 -0
  5. multi_lang_build/compiler/go_support/__init__.py +19 -0
  6. multi_lang_build/compiler/go_support/binary.py +117 -0
  7. multi_lang_build/compiler/go_support/builder.py +228 -0
  8. multi_lang_build/compiler/go_support/cleaner.py +40 -0
  9. multi_lang_build/compiler/go_support/env.py +41 -0
  10. multi_lang_build/compiler/go_support/mirror.py +111 -0
  11. multi_lang_build/compiler/go_support/module.py +77 -0
  12. multi_lang_build/compiler/go_support/tester.py +199 -0
  13. multi_lang_build/compiler/pnpm.py +61 -209
  14. multi_lang_build/compiler/pnpm_support/__init__.py +6 -0
  15. multi_lang_build/compiler/pnpm_support/executor.py +148 -0
  16. multi_lang_build/compiler/pnpm_support/project.py +53 -0
  17. multi_lang_build/compiler/python.py +65 -222
  18. multi_lang_build/compiler/python_support/__init__.py +13 -0
  19. multi_lang_build/compiler/python_support/cleaner.py +56 -0
  20. multi_lang_build/compiler/python_support/cli.py +46 -0
  21. multi_lang_build/compiler/python_support/detector.py +64 -0
  22. multi_lang_build/compiler/python_support/installer.py +162 -0
  23. multi_lang_build/compiler/python_support/venv.py +63 -0
  24. multi_lang_build/ide_register.py +97 -0
  25. multi_lang_build/mirror/config.py +19 -0
  26. multi_lang_build/register/support/__init__.py +13 -0
  27. multi_lang_build/register/support/claude.py +94 -0
  28. multi_lang_build/register/support/codebuddy.py +100 -0
  29. multi_lang_build/register/support/opencode.py +62 -0
  30. multi_lang_build/register/support/trae.py +72 -0
  31. {multi_lang_build-0.2.8.dist-info → multi_lang_build-0.2.10.dist-info}/METADATA +1 -1
  32. multi_lang_build-0.2.10.dist-info/RECORD +40 -0
  33. multi_lang_build/compiler/go.py +0 -564
  34. multi_lang_build/register.py +0 -412
  35. multi_lang_build-0.2.8.dist-info/RECORD +0 -18
  36. {multi_lang_build-0.2.8.dist-info → multi_lang_build-0.2.10.dist-info}/WHEEL +0 -0
  37. {multi_lang_build-0.2.8.dist-info → multi_lang_build-0.2.10.dist-info}/entry_points.txt +0 -0
  38. {multi_lang_build-0.2.8.dist-info → multi_lang_build-0.2.10.dist-info}/licenses/LICENSE +0 -0
@@ -1,412 +0,0 @@
1
- """Register multi-lang-build as a skill for various IDEs."""
2
-
3
- from __future__ import annotations
4
-
5
- import json
6
- import os
7
- import subprocess
8
- import sys
9
- from pathlib import Path
10
- from typing import Literal
11
-
12
-
13
- def get_cli_path() -> str:
14
- """Get the path to the multi-lang-build CLI."""
15
- # Try to find the CLI in PATH
16
- result = subprocess.run(
17
- ["which", "multi-lang-build"],
18
- capture_output=True,
19
- text=True,
20
- )
21
- if result.returncode == 0:
22
- return result.stdout.strip()
23
-
24
- # Fallback: use Python module
25
- return f"{sys.executable} -m multi_lang_build"
26
-
27
-
28
- def register_claude_code(project_level: bool = True) -> bool:
29
- """Register as Claude Code skill.
30
-
31
- Args:
32
- project_level: If True (default), register to project-level .claude/multi-lang-build.md.
33
- If False, register to global ~/.claude/CLAUDE.md.
34
- """
35
- try:
36
- # Determine registration path
37
- if project_level:
38
- # Project-level: .claude/multi-lang-build.md in current directory
39
- config_dir = Path.cwd() / ".claude"
40
- config_dir.mkdir(exist_ok=True)
41
- skill_file = config_dir / "multi-lang-build.md"
42
- level_name = "project-level"
43
- is_new = not skill_file.exists()
44
- else:
45
- # Global-level: ~/.claude/CLAUDE.md (only check CLI for global)
46
- result = subprocess.run(
47
- ["which", "claude"],
48
- capture_output=True,
49
- text=True,
50
- )
51
-
52
- if result.returncode != 0:
53
- print("❌ Claude Code CLI not found. Please install it first:")
54
- print(" npm install -g @anthropic-ai/claude-code")
55
- return False
56
-
57
- claude_dir = Path.home() / ".claude"
58
- claude_dir.mkdir(exist_ok=True)
59
- skill_file = claude_dir / "CLAUDE.md"
60
- level_name = "global"
61
- is_new = not skill_file.exists()
62
-
63
- skill_content = """## Multi-Lang Build Tool
64
-
65
- You can use the `multi-lang-build` tool to compile projects:
66
-
67
- ### Available Commands:
68
- - `multi-lang-build pnpm <source> --output <dir>` - Build pnpm projects
69
- - `multi-lang-build go <source> --output <bin>` - Build Go projects
70
- - `multi-lang-build python <source> --output <dir>` - Build Python projects
71
- - `multi-lang-build mirror list|set|show` - Configure domestic mirrors
72
-
73
- ### Examples:
74
- ```bash
75
- # Build Go project
76
- multi-lang-build go ./src --output ./bin/app --mirror
77
-
78
- # Build with specific target (multi-entry support)
79
- multi-lang-build go ./src --output ./bin/server --target cmd/server/main.go
80
-
81
- # Build Python project
82
- multi-lang-build python ./src --output ./dist --mirror
83
-
84
- # Build pnpm project
85
- multi-lang-build pnpm ./src --output ./dist --mirror
86
-
87
- # Configure mirror
88
- multi-lang-build mirror set pip pip_aliyun
89
- multi-lang-build mirror set go
90
- ```
91
-
92
- When working with Go projects, check if there are multiple main packages and use the `--target` flag to specify which one to build.
93
- """
94
-
95
- if project_level:
96
- # Project-level: create dedicated file
97
- with open(skill_file, "w") as f:
98
- f.write(skill_content)
99
- print(f"✅ Registered with Claude Code ({level_name}, created {skill_file})")
100
- else:
101
- # Global-level: append to existing CLAUDE.md if not already present
102
- existing_content = ""
103
- if skill_file.exists():
104
- existing_content = skill_file.read_text()
105
-
106
- if "## Multi-Lang Build Tool" not in existing_content:
107
- with open(skill_file, "a") as f:
108
- f.write(skill_content)
109
- print(f"✅ Registered with Claude Code ({level_name}, added to {skill_file})")
110
- else:
111
- print(f"ℹ️ Already registered with Claude Code ({level_name}, {skill_file})")
112
-
113
- return True
114
-
115
- except Exception as e:
116
- print(f"❌ Failed to register with Claude Code: {e}")
117
- return False
118
- return False
119
-
120
-
121
- def register_opencode(project_level: bool = True) -> bool:
122
- """Register as OpenCode skill.
123
-
124
- Args:
125
- project_level: If True (default), register to project-level .opencode/skills.json.
126
- If False, register to global ~/.config/opencode/skills.json.
127
- """
128
- try:
129
- # Determine registration path
130
- if project_level:
131
- # Project-level: .opencode/skills.json in current directory
132
- base_dir = Path.cwd()
133
- config_dir = base_dir / ".opencode"
134
- config_dir.mkdir(exist_ok=True)
135
- skills_file = config_dir / "skills.json"
136
- level_name = "project-level"
137
- else:
138
- # Global-level: ~/.config/opencode/skills.json
139
- config_dir = Path.home() / ".config" / "opencode"
140
- config_dir.mkdir(parents=True, exist_ok=True)
141
- skills_file = config_dir / "skills.json"
142
- level_name = "global"
143
-
144
- # Create or update skills.json
145
- skills: dict = {}
146
-
147
- if skills_file.exists():
148
- with open(skills_file) as f:
149
- skills = json.load(f)
150
-
151
- # Add multi-lang-build skill
152
- skills["multi-lang-build"] = {
153
- "name": "multi-lang-build",
154
- "description": "Multi-language automated build tool with mirror acceleration",
155
- "commands": {
156
- "build-go": "multi-lang-build go <source> --output <output> [--mirror] [--target <target>]",
157
- "build-python": "multi-lang-build python <source> --output <output> [--mirror]",
158
- "build-pnpm": "multi-lang-build pnpm <source> --output <output> [--mirror]",
159
- },
160
- "examples": [
161
- "multi-lang-build go ./src --output ./bin/app --mirror",
162
- "multi-lang-build go ./src --output ./bin/server --target cmd/server/main.go",
163
- "multi-lang-build python ./src --output ./dist --mirror",
164
- "multi-lang-build pnpm ./src --output ./dist --mirror",
165
- ]
166
- }
167
-
168
- with open(skills_file, "w") as f:
169
- json.dump(skills, f, indent=2)
170
-
171
- print(f"✅ Registered with OpenCode ({level_name}, config: {skills_file})")
172
- return True
173
-
174
- except Exception as e:
175
- print(f"❌ Failed to register with OpenCode: {e}")
176
- return False
177
-
178
-
179
- def register_trae(project_level: bool = True) -> bool:
180
- """Register as Trae skill.
181
-
182
- Args:
183
- project_level: If True (default), register to project-level .trae/skills.json.
184
- If False, register to global ~/.trae/skills.json.
185
- """
186
- try:
187
- # Determine registration path
188
- if project_level:
189
- # Project-level: .trae/skills.json in current directory
190
- base_dir = Path.cwd()
191
- config_dir = base_dir / ".trae"
192
- config_dir.mkdir(exist_ok=True)
193
- skills_file = config_dir / "skills.json"
194
- level_name = "project-level"
195
- else:
196
- # Global-level: ~/.trae/skills.json
197
- config_dir = Path.home() / ".trae"
198
- config_dir.mkdir(exist_ok=True)
199
- skills_file = config_dir / "skills.json"
200
- level_name = "global"
201
-
202
- # Create or update skills.json
203
- skills: dict = {}
204
-
205
- if skills_file.exists():
206
- with open(skills_file) as f:
207
- skills = json.load(f)
208
-
209
- # Add multi-lang-build skill
210
- skills["multi-lang-build"] = {
211
- "name": "Multi-Lang Build",
212
- "description": "Automated build tool for Go, Python, and pnpm projects",
213
- "category": "build",
214
- "commands": [
215
- {
216
- "name": "build-go",
217
- "command": "multi-lang-build go {source} --output {output}",
218
- "description": "Build Go project",
219
- "args": ["source", "output", "target", "mirror"]
220
- },
221
- {
222
- "name": "build-python",
223
- "command": "multi-lang-build python {source} --output {output}",
224
- "description": "Build Python project",
225
- "args": ["source", "output", "mirror"]
226
- },
227
- {
228
- "name": "build-pnpm",
229
- "command": "multi-lang-build pnpm {source} --output {output}",
230
- "description": "Build pnpm project",
231
- "args": ["source", "output", "mirror"]
232
- }
233
- ]
234
- }
235
-
236
- with open(skills_file, "w") as f:
237
- json.dump(skills, f, indent=2)
238
-
239
- print(f"✅ Registered with Trae ({level_name}, config: {skills_file})")
240
- return True
241
-
242
- except Exception as e:
243
- print(f"❌ Failed to register with Trae: {e}")
244
- return False
245
-
246
-
247
- def register_codebuddy(project_level: bool = True) -> bool:
248
- """Register as CodeBuddy skill.
249
-
250
- Args:
251
- project_level: If True (default), register to project-level .codebuddy/skills.yaml.
252
- If False, register to global ~/.codebuddy/skills.yaml.
253
- """
254
- try:
255
- # Determine registration path
256
- if project_level:
257
- # Project-level: .codebuddy/skills.yaml in current directory
258
- base_dir = Path.cwd()
259
- config_dir = base_dir / ".codebuddy"
260
- config_dir.mkdir(exist_ok=True)
261
- skills_file = config_dir / "skills.yaml"
262
- level_name = "project-level"
263
- else:
264
- # Global-level: ~/.codebuddy/skills.yaml
265
- config_dir = Path.home() / ".codebuddy"
266
- config_dir.mkdir(exist_ok=True)
267
- skills_file = config_dir / "skills.yaml"
268
- level_name = "global"
269
-
270
- skill_config = """# Multi-Lang Build Skill
271
- skills:
272
- multi-lang-build:
273
- name: "Multi-Lang Build"
274
- description: "Multi-language automated build tool with mirror acceleration"
275
- version: "0.2.0"
276
-
277
- commands:
278
- build-go:
279
- description: "Build Go project"
280
- command: "multi-lang-build go {source} --output {output}"
281
- args:
282
- - name: source
283
- description: "Source directory"
284
- required: true
285
- - name: output
286
- description: "Output path"
287
- required: true
288
- - name: target
289
- description: "Build target (file or directory)"
290
- required: false
291
- - name: mirror
292
- description: "Enable mirror acceleration"
293
- type: flag
294
-
295
- build-python:
296
- description: "Build Python project"
297
- command: "multi-lang-build python {source} --output {output}"
298
- args:
299
- - name: source
300
- description: "Source directory"
301
- required: true
302
- - name: output
303
- description: "Output directory"
304
- required: true
305
- - name: mirror
306
- description: "Enable mirror acceleration"
307
- type: flag
308
-
309
- build-pnpm:
310
- description: "Build pnpm project"
311
- command: "multi-lang-build pnpm {source} --output {output}"
312
- args:
313
- - name: source
314
- description: "Source directory"
315
- required: true
316
- - name: output
317
- description: "Output directory"
318
- required: true
319
- - name: mirror
320
- description: "Enable mirror acceleration"
321
- type: flag
322
- """
323
-
324
- # Append or create
325
- if skills_file.exists():
326
- content = skills_file.read_text()
327
- if "multi-lang-build" not in content:
328
- with open(skills_file, "a") as f:
329
- f.write("\n" + skill_config)
330
- print(f"✅ Registered with CodeBuddy ({level_name}, updated {skills_file})")
331
- else:
332
- print(f"ℹ️ Already registered with CodeBuddy ({level_name}, {skills_file})")
333
- else:
334
- skills_file.write_text(skill_config)
335
- print(f"✅ Registered with CodeBuddy ({level_name}, created {skills_file})")
336
-
337
- return True
338
-
339
- except Exception as e:
340
- print(f"❌ Failed to register with CodeBuddy: {e}")
341
- return False
342
-
343
-
344
- def register_skill(
345
- ide: Literal["claude", "opencode", "trae", "codebuddy", "all"] = "claude",
346
- global_level: bool = False
347
- ) -> bool:
348
- """Register multi-lang-build as a skill for the specified IDE.
349
-
350
- Args:
351
- ide: The IDE to register with. Options: "claude", "opencode", "trae", "codebuddy", "all"
352
- Default is "claude".
353
- global_level: If True, register to global config. If False (default), register to project-level.
354
-
355
- Returns:
356
- True if registration succeeded, False otherwise.
357
- """
358
- print(f"📝 Registering multi-lang-build for {ide}...\n")
359
-
360
- if ide == "all":
361
- results = [
362
- ("Claude Code", register_claude_code(project_level=not global_level)),
363
- ("OpenCode", register_opencode(project_level=not global_level)),
364
- ("Trae", register_trae(project_level=not global_level)),
365
- ("CodeBuddy", register_codebuddy(project_level=not global_level)),
366
- ]
367
-
368
- print("\n" + "=" * 50)
369
- print("Registration Summary:")
370
- for name, success in results:
371
- status = "✅" if success else "❌"
372
- print(f" {status} {name}")
373
-
374
- return all(success for _, success in results)
375
-
376
- elif ide == "claude":
377
- return register_claude_code(project_level=not global_level)
378
- elif ide == "opencode":
379
- return register_opencode(project_level=not global_level)
380
- elif ide == "trae":
381
- return register_trae(project_level=not global_level)
382
- elif ide == "codebuddy":
383
- return register_codebuddy(project_level=not global_level)
384
- else:
385
- print(f"❌ Unknown IDE: {ide}")
386
- print("Supported IDEs: claude, opencode, trae, codebuddy, all")
387
- return False
388
-
389
-
390
- if __name__ == "__main__":
391
- import argparse
392
-
393
- parser = argparse.ArgumentParser(
394
- description="Register multi-lang-build as an IDE skill"
395
- )
396
- parser.add_argument(
397
- "ide",
398
- nargs="?",
399
- default="claude",
400
- choices=["claude", "opencode", "trae", "codebuddy", "all"],
401
- help="IDE to register with (default: claude)",
402
- )
403
- parser.add_argument(
404
- "--global",
405
- dest="global_level",
406
- action="store_true",
407
- help="Register to global config instead of project-level",
408
- )
409
-
410
- args = parser.parse_args()
411
- success = register_skill(args.ide, global_level=args.global_level)
412
- sys.exit(0 if success else 1)
@@ -1,18 +0,0 @@
1
- multi_lang_build/__init__.py,sha256=vPtnBTSpvhZ2eYxNuR6-4hsJxPBvG0nT20ULw5BB7Og,1777
2
- multi_lang_build/cli.py,sha256=cOlXyJKdb6sReBPyCLZgQhCkJOA_lbkY67Xfk-hGbPc,12949
3
- multi_lang_build/py.typed,sha256=c8jtFarMovqA5DdwhEzKPH4WrX85xaoiWilIlvuc6KU,84
4
- multi_lang_build/register.py,sha256=dbNXNTnxtbh3r3Giej3trHQmI2VO5ydbkkExvCdYm8w,14501
5
- multi_lang_build/types.py,sha256=iCyz_6KmEBU4xwpCtfJnpzXoiSsmOcOKOhzHJVx8Z4Q,1043
6
- multi_lang_build/compiler/__init__.py,sha256=y5vvVN6HdSzq4W1kXBMy_vQq9G3-TtiVcNMOyBQHbCw,484
7
- multi_lang_build/compiler/base.py,sha256=crtDW9bthfV-FSpp96O2Hi0DrViNqcIt4TjAVK2lPXE,9391
8
- multi_lang_build/compiler/go.py,sha256=RxDtLAFy6vpphNJb4Jvocl1KlQFffyYsht98VG6x45Y,18407
9
- multi_lang_build/compiler/pnpm.py,sha256=BDUVZCX5PuhqlFp_ARKUMbLqUDLraTlKp3tdom60hzk,15774
10
- multi_lang_build/compiler/python.py,sha256=8XqE_Jp_G-x6g5Qrux4tCV8Ag-zZqLLLXapSIzcSLJw,17662
11
- multi_lang_build/mirror/__init__.py,sha256=RrZOQ83bxImAR275zeAUKyyCgwqdGt5xH8tF_-UShJo,489
12
- multi_lang_build/mirror/cli.py,sha256=qv6RI6izxUIsfMCIDOtTK3avcNSJpAaUF3NPiK1W49A,9820
13
- multi_lang_build/mirror/config.py,sha256=d9KJoV80BUZOR9R3DpcT1r0nyxH1HK6hfLZU7IsUGcw,8552
14
- multi_lang_build-0.2.8.dist-info/METADATA,sha256=QWiPflg4EKYDJ6XMewlnmpiKW9AOS484Hw49b5Pn1gg,10073
15
- multi_lang_build-0.2.8.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
16
- multi_lang_build-0.2.8.dist-info/entry_points.txt,sha256=0vd5maQH5aZoqnpbr2Yr_IWB_-ncWX1rO3jGBCW3pHY,319
17
- multi_lang_build-0.2.8.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
18
- multi_lang_build-0.2.8.dist-info/RECORD,,