| | | 1 | | namespace Orchestrator; |
| | | 2 | | |
| | | 3 | | public static class PathUtility |
| | | 4 | | { |
| | | 5 | | /// <summary> |
| | | 6 | | /// Finds the solution root directory by looking for KicktippAi.slnx in parent directories. |
| | | 7 | | /// </summary> |
| | | 8 | | /// <returns>The path to the solution root directory.</returns> |
| | | 9 | | /// <exception cref="DirectoryNotFoundException">Thrown when the solution root cannot be found.</exception> |
| | | 10 | | public static string FindSolutionRoot() |
| | | 11 | | { |
| | 0 | 12 | | var currentDirectory = Directory.GetCurrentDirectory(); |
| | 0 | 13 | | var directory = new DirectoryInfo(currentDirectory); |
| | | 14 | | |
| | 0 | 15 | | while (directory != null) |
| | | 16 | | { |
| | 0 | 17 | | var solutionFile = Path.Combine(directory.FullName, "KicktippAi.slnx"); |
| | 0 | 18 | | if (File.Exists(solutionFile)) |
| | | 19 | | { |
| | 0 | 20 | | return directory.FullName; |
| | | 21 | | } |
| | 0 | 22 | | directory = directory.Parent; |
| | | 23 | | } |
| | | 24 | | |
| | 0 | 25 | | throw new DirectoryNotFoundException($"Could not find solution root (KicktippAi.slnx) starting from: {currentDir |
| | | 26 | | } |
| | | 27 | | |
| | | 28 | | /// <summary> |
| | | 29 | | /// Gets the path to the instructions template relative to the solution root. |
| | | 30 | | /// </summary> |
| | | 31 | | /// <returns>The full path to the instructions template.</returns> |
| | | 32 | | public static string GetInstructionsTemplatePath() |
| | | 33 | | { |
| | 0 | 34 | | var solutionRoot = FindSolutionRoot(); |
| | 0 | 35 | | return Path.Combine(solutionRoot, "prompts", "reasoning-models", "predict-one-match", "v0-handcrafted", "instruc |
| | | 36 | | } |
| | | 37 | | |
| | | 38 | | /// <summary> |
| | | 39 | | /// Gets the path to the .env file for a specific project relative to the solution root. |
| | | 40 | | /// </summary> |
| | | 41 | | /// <param name="projectName">The name of the project (e.g., "Orchestrator").</param> |
| | | 42 | | /// <returns>The full path to the .env file.</returns> |
| | | 43 | | public static string GetEnvFilePath(string projectName) |
| | | 44 | | { |
| | 0 | 45 | | var solutionRoot = FindSolutionRoot(); |
| | 0 | 46 | | return Path.Combine(solutionRoot, "..", "KicktippAi.Secrets", "src", projectName, ".env"); |
| | | 47 | | } |
| | | 48 | | |
| | | 49 | | /// <summary> |
| | | 50 | | /// Gets the path to the Firebase service account JSON file relative to the solution root. |
| | | 51 | | /// </summary> |
| | | 52 | | /// <returns>The full path to the firebase.json file.</returns> |
| | | 53 | | public static string GetFirebaseJsonPath() |
| | | 54 | | { |
| | 0 | 55 | | var solutionRoot = FindSolutionRoot(); |
| | 0 | 56 | | return Path.Combine(solutionRoot, "..", "KicktippAi.Secrets", "src", "Orchestrator", "firebase.json"); |
| | | 57 | | } |
| | | 58 | | } |