golf-mcp 0.2.12__py3-none-any.whl → 0.2.13__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.
Potentially problematic release.
This version of golf-mcp might be problematic. Click here for more details.
- golf/__init__.py +1 -1
- golf/core/builder.py +112 -0
- {golf_mcp-0.2.12.dist-info → golf_mcp-0.2.13.dist-info}/METADATA +1 -1
- {golf_mcp-0.2.12.dist-info → golf_mcp-0.2.13.dist-info}/RECORD +8 -8
- {golf_mcp-0.2.12.dist-info → golf_mcp-0.2.13.dist-info}/WHEEL +0 -0
- {golf_mcp-0.2.12.dist-info → golf_mcp-0.2.13.dist-info}/entry_points.txt +0 -0
- {golf_mcp-0.2.12.dist-info → golf_mcp-0.2.13.dist-info}/licenses/LICENSE +0 -0
- {golf_mcp-0.2.12.dist-info → golf_mcp-0.2.13.dist-info}/top_level.txt +0 -0
golf/__init__.py
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
__version__ = "0.2.
|
|
1
|
+
__version__ = "0.2.13"
|
golf/core/builder.py
CHANGED
|
@@ -383,6 +383,22 @@ class CodeGenerator:
|
|
|
383
383
|
console.print()
|
|
384
384
|
console.print(get_status_text("success", f"Build completed successfully in {output_dir_display}"))
|
|
385
385
|
|
|
386
|
+
def _generate_root_file_imports(self) -> list[str]:
|
|
387
|
+
"""Generate import statements for automatically discovered root files."""
|
|
388
|
+
root_file_imports = []
|
|
389
|
+
discovered_files = discover_root_files(self.project_path)
|
|
390
|
+
|
|
391
|
+
if discovered_files:
|
|
392
|
+
root_file_imports.append("# Import root-level Python files")
|
|
393
|
+
|
|
394
|
+
for filename in sorted(discovered_files.keys()):
|
|
395
|
+
module_name = Path(filename).stem # env.py -> env
|
|
396
|
+
root_file_imports.append(f"import {module_name}")
|
|
397
|
+
|
|
398
|
+
root_file_imports.append("") # Blank line
|
|
399
|
+
|
|
400
|
+
return root_file_imports
|
|
401
|
+
|
|
386
402
|
def _create_directory_structure(self) -> None:
|
|
387
403
|
"""Create the output directory structure"""
|
|
388
404
|
# Create main directories
|
|
@@ -810,6 +826,11 @@ class CodeGenerator:
|
|
|
810
826
|
"",
|
|
811
827
|
]
|
|
812
828
|
|
|
829
|
+
# Add imports for root files
|
|
830
|
+
root_file_imports = self._generate_root_file_imports()
|
|
831
|
+
if root_file_imports:
|
|
832
|
+
imports.extend(root_file_imports)
|
|
833
|
+
|
|
813
834
|
# Add auth imports if auth is configured
|
|
814
835
|
if auth_components.get("has_auth"):
|
|
815
836
|
imports.extend(auth_components["imports"])
|
|
@@ -1575,6 +1596,17 @@ def build_project(
|
|
|
1575
1596
|
shutil.copy2(health_path, output_dir)
|
|
1576
1597
|
console.print(get_status_text("success", "Health script copied to build directory"))
|
|
1577
1598
|
|
|
1599
|
+
# Copy any additional Python files from project root
|
|
1600
|
+
discovered_root_files = discover_root_files(project_path)
|
|
1601
|
+
|
|
1602
|
+
for filename, file_path in discovered_root_files.items():
|
|
1603
|
+
dest_path = output_dir / filename
|
|
1604
|
+
try:
|
|
1605
|
+
shutil.copy2(file_path, dest_path)
|
|
1606
|
+
console.print(get_status_text("success", f"Root file {filename} copied to build directory"))
|
|
1607
|
+
except (OSError, shutil.Error) as e:
|
|
1608
|
+
console.print(f"[red]Error copying {filename}: {e}[/red]")
|
|
1609
|
+
|
|
1578
1610
|
# Create a simple README
|
|
1579
1611
|
readme_content = f"""# {settings.name}
|
|
1580
1612
|
|
|
@@ -1674,6 +1706,86 @@ from golf.auth.providers import RemoteAuthConfig, JWTAuthConfig, StaticTokenConf
|
|
|
1674
1706
|
)
|
|
1675
1707
|
|
|
1676
1708
|
|
|
1709
|
+
def discover_root_files(project_path: Path) -> dict[str, Path]:
|
|
1710
|
+
"""Automatically discover all Python files in the project root directory.
|
|
1711
|
+
|
|
1712
|
+
This function finds all .py files in the project root, excluding:
|
|
1713
|
+
- Special Golf files (startup.py, health.py, readiness.py, auth.py, server.py)
|
|
1714
|
+
- Component directories (tools/, resources/, prompts/)
|
|
1715
|
+
- Hidden files and common exclusions (__pycache__, .git, etc.)
|
|
1716
|
+
|
|
1717
|
+
Args:
|
|
1718
|
+
project_path: Path to the project root directory
|
|
1719
|
+
|
|
1720
|
+
Returns:
|
|
1721
|
+
Dictionary mapping filenames to their full paths
|
|
1722
|
+
"""
|
|
1723
|
+
import ast
|
|
1724
|
+
|
|
1725
|
+
discovered_files = {}
|
|
1726
|
+
|
|
1727
|
+
# Files that are handled specially by Golf and should not be auto-copied
|
|
1728
|
+
reserved_files = {
|
|
1729
|
+
"startup.py",
|
|
1730
|
+
"health.py",
|
|
1731
|
+
"readiness.py",
|
|
1732
|
+
"auth.py",
|
|
1733
|
+
"server.py",
|
|
1734
|
+
"pre_build.py", # Legacy auth file
|
|
1735
|
+
"golf.json",
|
|
1736
|
+
"golf.toml", # Config files
|
|
1737
|
+
"__init__.py", # Package files
|
|
1738
|
+
}
|
|
1739
|
+
|
|
1740
|
+
# Find all .py files in the project root (not in subdirectories)
|
|
1741
|
+
try:
|
|
1742
|
+
for file_path in project_path.iterdir():
|
|
1743
|
+
if not file_path.is_file():
|
|
1744
|
+
continue
|
|
1745
|
+
|
|
1746
|
+
filename = file_path.name
|
|
1747
|
+
|
|
1748
|
+
# Skip non-Python files
|
|
1749
|
+
if not filename.endswith(".py"):
|
|
1750
|
+
continue
|
|
1751
|
+
|
|
1752
|
+
# Skip reserved/special files
|
|
1753
|
+
if filename in reserved_files:
|
|
1754
|
+
continue
|
|
1755
|
+
|
|
1756
|
+
# Skip hidden files and temporary files
|
|
1757
|
+
if filename.startswith(".") or filename.startswith("_") or filename.endswith("~"):
|
|
1758
|
+
continue
|
|
1759
|
+
|
|
1760
|
+
# Validate it's a readable Python file
|
|
1761
|
+
try:
|
|
1762
|
+
with open(file_path, encoding="utf-8") as f:
|
|
1763
|
+
# Read first 200 chars to validate it's a proper Python file
|
|
1764
|
+
content = f.read(200)
|
|
1765
|
+
|
|
1766
|
+
# Basic Python syntax validation
|
|
1767
|
+
try:
|
|
1768
|
+
ast.parse(content + "\n# truncated for validation")
|
|
1769
|
+
except SyntaxError:
|
|
1770
|
+
# Still include files with syntax errors, but warn
|
|
1771
|
+
console.print(f"[yellow]Warning: {filename} has syntax issues but will be included[/yellow]")
|
|
1772
|
+
|
|
1773
|
+
except (OSError, UnicodeDecodeError) as e:
|
|
1774
|
+
console.print(f"[yellow]Warning: Cannot read {filename}, skipping: {e}[/yellow]")
|
|
1775
|
+
continue
|
|
1776
|
+
|
|
1777
|
+
discovered_files[filename] = file_path
|
|
1778
|
+
|
|
1779
|
+
except OSError as e:
|
|
1780
|
+
console.print(f"[yellow]Warning: Error scanning project directory: {e}[/yellow]")
|
|
1781
|
+
|
|
1782
|
+
if discovered_files:
|
|
1783
|
+
file_list = ", ".join(sorted(discovered_files.keys()))
|
|
1784
|
+
console.print(f"[dim]Found root Python files: {file_list}[/dim]")
|
|
1785
|
+
|
|
1786
|
+
return discovered_files
|
|
1787
|
+
|
|
1788
|
+
|
|
1677
1789
|
# Legacy function removed - replaced by parse_shared_files in parser module
|
|
1678
1790
|
|
|
1679
1791
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
golf/__init__.py,sha256=
|
|
1
|
+
golf/__init__.py,sha256=C0atO05M0rfDTTHt02NxNa4jt0eSqXM4AxShEhb2epA,23
|
|
2
2
|
golf/auth/__init__.py,sha256=sYWjWXGR70Ae87znseeBK2YWl8S1-qn_hndKf2xMULk,8173
|
|
3
3
|
golf/auth/api_key.py,sha256=OonqTlG6USJxqK8TlPviJTv7sgYmTVfCxG_JsEjnEM4,2320
|
|
4
4
|
golf/auth/factory.py,sha256=3-il1GbjjZlQfvWUZs-09r61Y_-b5cYEegWF7sY_cUs,13128
|
|
@@ -13,7 +13,7 @@ golf/commands/build.py,sha256=sLq9lSW4naq2vIlBreKI5SGnviQrhBWw13zfOZOKhuM,2293
|
|
|
13
13
|
golf/commands/init.py,sha256=KkAg_3-KxBDFOcZqUHqcPAkDipykFVaLWpQ2tydnVPk,9617
|
|
14
14
|
golf/commands/run.py,sha256=2fdjqTfzQL-dFOqptkl-K2jel8VWpevAx0somcjNsPI,4576
|
|
15
15
|
golf/core/__init__.py,sha256=4bKeskJ2fPaZqkz2xQScSa3phRLLrmrczwSL632jv-o,52
|
|
16
|
-
golf/core/builder.py,sha256=
|
|
16
|
+
golf/core/builder.py,sha256=7NuRoIGpmqT0vg2ZF5vMA-T6kBfcJOEi1oPwVUKJBes,80427
|
|
17
17
|
golf/core/builder_auth.py,sha256=f0w9TmxvNjxglcWY8NGULZJ8mwLqtUFFb2QHzgC0xAk,8219
|
|
18
18
|
golf/core/builder_metrics.py,sha256=wrXdE4_XWx7fUXnp61WU7rCBO-aG-4YzCMV6yO0z9Dg,8594
|
|
19
19
|
golf/core/builder_telemetry.py,sha256=86bp7UlMUN6JyQRrZ5EizovP6AJ_q65OANJTeJXDIKc,3421
|
|
@@ -44,9 +44,9 @@ golf/utilities/__init__.py,sha256=X9iY9yi3agz1GVcn8-qWeOCt8CSSsruHxqPNtiF63TY,53
|
|
|
44
44
|
golf/utilities/context.py,sha256=DGGvhVe---QMhy0wtdWhNp-_WVk1NvAcOFn0uBKBpYo,1579
|
|
45
45
|
golf/utilities/elicitation.py,sha256=MParZZZsY45s70-KXduHa6IvpWXnLW2FCPfrGijMaHs,5223
|
|
46
46
|
golf/utilities/sampling.py,sha256=88nDv-trBE4gZQbcnMjXl3LW6TiIhv5zR_cuEIGjaIM,7233
|
|
47
|
-
golf_mcp-0.2.
|
|
48
|
-
golf_mcp-0.2.
|
|
49
|
-
golf_mcp-0.2.
|
|
50
|
-
golf_mcp-0.2.
|
|
51
|
-
golf_mcp-0.2.
|
|
52
|
-
golf_mcp-0.2.
|
|
47
|
+
golf_mcp-0.2.13.dist-info/licenses/LICENSE,sha256=5_j2f6fTJmvfmUewzElhkpAaXg2grVoxKouOA8ihV6E,11348
|
|
48
|
+
golf_mcp-0.2.13.dist-info/METADATA,sha256=P-2vXyg5M1YIAvvgMr7NBeViHlPSTs7wGpc0RUyUQys,9414
|
|
49
|
+
golf_mcp-0.2.13.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
50
|
+
golf_mcp-0.2.13.dist-info/entry_points.txt,sha256=5y7rHYM8jGpU-nfwdknCm5XsApLulqsnA37MO6BUTYg,43
|
|
51
|
+
golf_mcp-0.2.13.dist-info/top_level.txt,sha256=BQToHcBUufdyhp9ONGMIvPE40jMEtmI20lYaKb4hxOg,5
|
|
52
|
+
golf_mcp-0.2.13.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|