Skip to content

Commit 15a180e

Browse files
fix: Resolve repo root path correctly from infra/scripts/ location
Scripts now compute REPO_ROOT as two levels up from their location in infra/scripts/, so all src/ and .azure/ paths resolve correctly. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 43560f3 commit 15a180e

4 files changed

Lines changed: 26 additions & 22 deletions

File tree

infra/scripts/deploy_to_azure.ps1

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,10 @@ $ErrorActionPreference = "Stop"
3131
# ==============================================================================
3232

3333
$ScriptDir = Split-Path -Parent $MyInvocation.MyCommand.Path
34-
$BackendDir = Join-Path $ScriptDir "src\backend"
35-
$McpDir = Join-Path $ScriptDir "src\mcp_server"
36-
$FrontendDir = Join-Path $ScriptDir "src\App"
34+
$RepoRoot = (Resolve-Path (Join-Path $ScriptDir "..\..")).Path
35+
$BackendDir = Join-Path $RepoRoot "src\backend"
36+
$McpDir = Join-Path $RepoRoot "src\mcp_server"
37+
$FrontendDir = Join-Path $RepoRoot "src\App"
3738

3839
$BackendImageName = "macaebackend"
3940
$McpImageName = "macaemcp"

infra/scripts/deploy_to_azure.sh

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ _winpath() {
4040
# ==============================================================================
4141

4242
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
43+
REPO_ROOT="$(cd "$SCRIPT_DIR/../.." && pwd)"
4344
RESOURCE_GROUP=""
4445
ACR_INPUT=""
4546
SERVICES=""
@@ -55,9 +56,9 @@ MCP_IMAGE_NAME="macaemcp"
5556
FRONTEND_IMAGE_NAME="macaefrontend"
5657

5758
# Service paths
58-
BACKEND_DIR="$SCRIPT_DIR/src/backend"
59-
MCP_DIR="$SCRIPT_DIR/src/mcp_server"
60-
FRONTEND_DIR="$SCRIPT_DIR/src/App"
59+
BACKEND_DIR="$REPO_ROOT/src/backend"
60+
MCP_DIR="$REPO_ROOT/src/mcp_server"
61+
FRONTEND_DIR="$REPO_ROOT/src/App"
6162

6263
# ==============================================================================
6364
# Logging

infra/scripts/setup_local_dev.ps1

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,13 @@ param(
2222

2323
$ErrorActionPreference = "Stop"
2424

25-
# Script directory (repo root)
25+
# Resolve repo root (script lives in infra/scripts/)
2626
$ScriptDir = $PSScriptRoot
2727
if (-not $ScriptDir) { $ScriptDir = Get-Location }
28-
$BackendDir = Join-Path $ScriptDir "src\backend"
29-
$McpDir = Join-Path $ScriptDir "src\mcp_server"
30-
$FrontendDir = Join-Path $ScriptDir "src\App"
28+
$RepoRoot = (Resolve-Path (Join-Path $RepoRoot "..\..")).Path
29+
$BackendDir = Join-Path $RepoRoot "src\backend"
30+
$McpDir = Join-Path $RepoRoot "src\mcp_server"
31+
$FrontendDir = Join-Path $RepoRoot "src\App"
3132

3233
# ==============================================================================
3334
# Helper Functions
@@ -255,7 +256,7 @@ function Fetch-Configuration {
255256
# PATH 2: No RG given — look for .azure/<env>/.env written by 'azd up' / local deployment
256257
Write-LogInfo "No -ResourceGroup provided. Looking for existing config in .azure/ folder..."
257258

258-
$azdDir = Join-Path $ScriptDir ".azure"
259+
$azdDir = Join-Path $RepoRoot ".azure"
259260
$azdEnvFile = $null
260261
$detectedEnvName = ""
261262

@@ -761,7 +762,7 @@ function Setup-VSCode {
761762

762763
Write-LogStep "Step 8: Configuring VS Code"
763764

764-
$vscodeDir = Join-Path $ScriptDir ".vscode"
765+
$vscodeDir = Join-Path $RepoRoot ".vscode"
765766
if (-not (Test-Path $vscodeDir)) { New-Item -ItemType Directory -Path $vscodeDir | Out-Null }
766767

767768
$extensionsFile = Join-Path $vscodeDir "extensions.json"
@@ -854,7 +855,7 @@ Write-Host "╚═════════════════════
854855
Write-Host ""
855856

856857
# Verify repo root
857-
if (-not (Test-Path (Join-Path $ScriptDir "src\backend\app.py"))) {
858+
if (-not (Test-Path (Join-Path $RepoRoot "src\backend\app.py"))) {
858859
Write-LogError "This script must be run from the repository root directory"
859860
exit 1
860861
}

infra/scripts/setup_local_dev.sh

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,10 @@ set -euo pipefail
2222
# ==============================================================================
2323

2424
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
25-
BACKEND_DIR="$SCRIPT_DIR/src/backend"
26-
MCP_DIR="$SCRIPT_DIR/src/mcp_server"
27-
FRONTEND_DIR="$SCRIPT_DIR/src/App"
25+
REPO_ROOT="$(cd "$SCRIPT_DIR/../.." && pwd)"
26+
BACKEND_DIR="$REPO_ROOT/src/backend"
27+
MCP_DIR="$REPO_ROOT/src/mcp_server"
28+
FRONTEND_DIR="$REPO_ROOT/src/App"
2829

2930
# ==============================================================================
3031
# Flags (set by parse_args)
@@ -316,7 +317,7 @@ fetch_configuration() {
316317
# PATH 2: Look for .azure/<env>/.env written by 'azd up'
317318
log_info "No --resource-group provided. Looking for existing config in .azure/ folder..."
318319

319-
local azd_dir="$SCRIPT_DIR/.azure"
320+
local azd_dir="$REPO_ROOT/.azure"
320321
local azd_env_file=""
321322
local detected_env_name=""
322323

@@ -773,7 +774,7 @@ setup_backend() {
773774
uv sync --python 3.12 --extra dev
774775

775776
log_success "Backend setup complete"
776-
cd "$SCRIPT_DIR"
777+
cd "$REPO_ROOT"
777778
}
778779

779780
# ==============================================================================
@@ -798,7 +799,7 @@ setup_mcp_server() {
798799
uv sync --python 3.12
799800

800801
log_success "MCP Server setup complete"
801-
cd "$SCRIPT_DIR"
802+
cd "$REPO_ROOT"
802803
}
803804

804805
# ==============================================================================
@@ -834,7 +835,7 @@ setup_frontend() {
834835
npm run build
835836

836837
log_success "Frontend setup complete"
837-
cd "$SCRIPT_DIR"
838+
cd "$REPO_ROOT"
838839
}
839840

840841
# ==============================================================================
@@ -846,7 +847,7 @@ setup_vscode() {
846847

847848
log_step "Step 8: Configuring VS Code"
848849

849-
local vscode_dir="$SCRIPT_DIR/.vscode"
850+
local vscode_dir="$REPO_ROOT/.vscode"
850851
mkdir -p "$vscode_dir"
851852

852853
local extensions_file="$vscode_dir/extensions.json"
@@ -943,7 +944,7 @@ echo ""
943944

944945
parse_args "$@"
945946

946-
if [[ ! -f "$SCRIPT_DIR/src/backend/app.py" ]]; then
947+
if [[ ! -f "$REPO_ROOT/src/backend/app.py" ]]; then
947948
log_error "This script must be run from the repository root directory"
948949
exit 1
949950
fi

0 commit comments

Comments
 (0)