| 68 | } |
| 69 | |
| 70 | fn create_project_toml(&self) -> Result<(), String> { |
| 71 | let toml_path = self.project_path.join("project.toml"); |
| 72 | let username = whoami::username(); |
| 73 | |
| 74 | let toml_content = format!( |
| 75 | r#"[project] |
| 76 | name = "{}" |
| 77 | description = "An AIScript project" |
| 78 | version = "0.1.0" |
| 79 | authors = ["{}"] |
| 80 | |
| 81 | [network] |
| 82 | host = "0.0.0.0" |
| 83 | port = 8000 |
| 84 | |
| 85 | [apidoc] |
| 86 | enabled = true |
| 87 | type = "redoc" |
| 88 | path = "/docs" |
| 89 | "#, |
| 90 | self.project_name, username |
| 91 | ); |
| 92 | |
| 93 | let mut file = fs::File::create(&toml_path) |
| 94 | .map_err(|e| format!("Failed to create project.toml: {}", e))?; |
| 95 | |
| 96 | file.write_all(toml_content.as_bytes()) |
| 97 | .map_err(|e| format!("Failed to write to project.toml: {}", e))?; |
| 98 | |
| 99 | Ok(()) |
| 100 | } |
| 101 | |
| 102 | fn create_example_file(&self) -> Result<(), String> { |
| 103 | let routes_dir = self.project_path.join("routes"); |