fix: split repoRoot into apiRoot + standardsRoot

- Definitions load from MokoStandards-API (repoRoot = API repo)
- Template files load from MokoStandards (standardsRoot = sibling dir)
- Set MOKOSTANDARDS_ROOT env var to override template source location

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Jonathan Miller
2026-04-16 19:18:44 -05:00
parent 5ddd507f7b
commit 12382e30cc
+6 -3
View File
@@ -167,7 +167,10 @@ class RepositorySynchronizer
$this->logger->logInfo("Starting synchronization for {$org}/{$repo}");
// Resolve repo root (two levels up from this file: Enterprise/ → lib/ → api/ → root)
$repoRoot = dirname(dirname(dirname(__DIR__)));
// API repo root (definitions, sync code)
$repoRoot = dirname(dirname(__DIR__));
// MokoStandards repo root (templates, configs)
$standardsRoot = getenv('MOKOSTANDARDS_ROOT') ?: dirname($repoRoot) . '/MokoStandards';
// Detect platform from repo metadata
$repoInfo = $this->adapter->getRepo($org, $repo);
@@ -212,7 +215,7 @@ class RepositorySynchronizer
}
// Create PR with file updates driven by the definition
$result = $this->createSyncPR($org, $repo, $platform, $filesToSync, $repoRoot, $force);
$result = $this->createSyncPR($org, $repo, $platform, $filesToSync, $standardsRoot, $force);
$prNumber = $result['number'] ?? null;
$summary = $result['summary'] ?? [];
@@ -280,7 +283,7 @@ class RepositorySynchronizer
$defaultBranch = $repoInfo['default_branch'] ?? 'main';
// Resolve repo root relative to this file's location
$repoRoot = dirname(dirname(dirname(__DIR__)));
$repoRoot = dirname(dirname(__DIR__));
$baseDefPath = "{$repoRoot}/definitions/default/{$platform}.tf";
if (!file_exists($baseDefPath)) {
$baseDefPath = "{$repoRoot}/definitions/default/default-repository.tf";