fix(cli): auto-detect org/repo in updates_xml_build from manifest and git remote
Platform: moko-platform CI / Gate 2: Unit Tests (8.1) (push) Blocked by required conditions
Platform: moko-platform CI / Gate 2: Unit Tests (8.2) (push) Blocked by required conditions
Platform: moko-platform CI / Gate 2: Unit Tests (8.3) (push) Blocked by required conditions
Platform: moko-platform CI / Gate 3: Self-Health Check (push) Blocked by required conditions
Platform: moko-platform CI / Gate 4: Governance (push) Blocked by required conditions
Platform: moko-platform CI / Gate 5: Template Integrity (push) Blocked by required conditions
Platform: moko-platform CI / CI Summary (push) Blocked by required conditions
Generic: Repo Health / Release configuration (push) Blocked by required conditions
Generic: Repo Health / Scripts governance (push) Blocked by required conditions
Generic: Repo Health / Repository health (push) Blocked by required conditions
Generic: Repo Health / Site Health (push) Has been skipped
Generic: Repo Health / Access control (push) Successful in 1s
Platform: moko-platform CI / Gate 1: Code Quality (push) Failing after 1m3s

When --org/--repo are not provided and env vars are unset, the tool now
reads <org> and <name> from .mokogitea/manifest.xml, with a final
fallback to parsing the git remote URL. Fixes broken URLs with empty
org/repo segments in generated updates.xml.

Authored-by: Moko Consulting
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Jonathan Miller
2026-05-31 08:02:31 -05:00
parent c4aaf5bd2c
commit 7f1307bf05
+29
View File
@@ -103,6 +103,35 @@ if (file_exists($mokoManifest)) {
// <display-name> is the human-friendly name for releases and updates.xml
$detectedDisplayName = (string)($mokoXml->identity->{"display-name"} ?? '');
$detectedPackageType = (string)($mokoXml->build->{"package-type"} ?? '');
// Auto-detect org from manifest if not provided via CLI/env
if (empty($org)) {
$manifestOrg = (string)($mokoXml->identity->org ?? '');
if ($manifestOrg !== '') {
$org = $manifestOrg;
}
}
// Auto-detect repo from manifest <name> if not provided via CLI/env
if (empty($repo)) {
$manifestName = (string)($mokoXml->identity->name ?? '');
if ($manifestName !== '') {
$repo = $manifestName;
}
}
}
}
// -- Fallback: detect org/repo from git remote --------------------------------
if (empty($org) || empty($repo)) {
$remoteUrl = trim(shell_exec("git -C " . escapeshellarg($root) . " remote get-url origin 2>/dev/null") ?? '');
// Match patterns: https://host/org/repo.git or git@host:org/repo.git
if (preg_match('#[/:]([^/:]+)/([^/]+?)(?:\.git)?$#', $remoteUrl, $m)) {
if (empty($org)) {
$org = $m[1];
}
if (empty($repo)) {
$repo = $m[2];
}
}
}