66import sys
77import subprocess
88from pathlib import Path
9- import yaml
109
1110# Add utils to path
1211sys .path .insert (0 , str (Path (__file__ ).parent .parent ))
1514from utils .system import ProjectDetector , BuildSystem
1615from utils .config import config
1716
17+ def parse_simple_yaml (content ):
18+ """Simple YAML parser for basic key-value and nested structures"""
19+ result = {}
20+ lines = content .strip ().split ('\n ' )
21+
22+ current_dict = result
23+ dict_stack = [result ]
24+ indent_stack = [0 ]
25+
26+ for line in lines :
27+ # Skip empty lines and comments
28+ stripped = line .strip ()
29+ if not stripped or stripped .startswith ('#' ):
30+ continue
31+
32+ # Calculate indentation
33+ indent = len (line ) - len (line .lstrip ())
34+
35+ # Handle indentation changes
36+ while indent < indent_stack [- 1 ]:
37+ dict_stack .pop ()
38+ indent_stack .pop ()
39+
40+ current_dict = dict_stack [- 1 ]
41+
42+ # Parse key-value pairs
43+ if ':' in stripped :
44+ key , value = stripped .split (':' , 1 )
45+ key = key .strip ()
46+ value = value .strip ()
47+
48+ if value :
49+ # Simple value
50+ # Try to convert to appropriate type
51+ if value .lower () == 'true' :
52+ current_dict [key ] = True
53+ elif value .lower () == 'false' :
54+ current_dict [key ] = False
55+ elif value .isdigit ():
56+ current_dict [key ] = int (value )
57+ else :
58+ current_dict [key ] = value
59+ else :
60+ # Nested object
61+ current_dict [key ] = {}
62+ dict_stack .append (current_dict [key ])
63+ indent_stack .append (indent )
64+
65+ return result
66+
1867def load_project_config (project_root ):
1968 """Load project configuration from fern.yaml"""
2069 config_file = project_root / "fern.yaml"
@@ -23,7 +72,8 @@ def load_project_config(project_root):
2372
2473 try :
2574 with open (config_file , 'r' ) as f :
26- return yaml .safe_load (f )
75+ content = f .read ()
76+ return parse_simple_yaml (content )
2777 except Exception as e :
2878 print_warning (f"Failed to load fern.yaml: { e } " )
2979 return None
@@ -530,7 +580,7 @@ def _run_web_project(self, project_root):
530580 port = project_config ['platforms' ]['web' ].get ('port' , 8000 )
531581
532582 print_info ("Starting local web server..." )
533- print_success ("🔥 Fern Fire started (web)!" )
583+ print_success ("Fern Fire started (web)!" )
534584 print ()
535585 print_info (f"Open your browser to: http://localhost:{ port } /main.html" )
536586 print_info ("Press Ctrl+C to stop the server" )
0 commit comments