feat: version_read.php uses .mokogitea/manifest.xml as canonical version source
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
Universal: Cascade Main → Dev / Cascade main → branches (push) Failing after 2s
Generic: Repo Health / Site Health (push) Has been skipped
Generic: Repo Health / Access control (push) Successful in 2s
Platform: moko-platform CI / Gate 1: Code Quality (push) Successful in 53s

Authored-by: Moko Consulting
This commit is contained in:
2026-05-26 19:26:45 +00:00
parent 335fcd0382
commit c5e4b41100
+24 -5
View File
@@ -9,7 +9,7 @@
* INGROUP: moko-platform
* REPO: https://git.mokoconsulting.tech/MokoConsulting/moko-platform
* PATH: /cli/version_read.php
* BRIEF: Read version from README.md or manifest XML — outputs the higher of the two
* BRIEF: Read version — manifest.xml is canonical, falls back to README.md and Joomla XML
*/
declare(strict_types=1);
@@ -23,7 +23,26 @@ foreach ($argv as $i => $arg) {
$root = realpath($path) ?: $path;
// ── Read from README.md ──────────────────────────────────────────────────────
// -- 1. Read from .mokogitea/manifest.xml (canonical source) --
$mokoVersion = null;
$mokoManifest = "{$root}/.mokogitea/manifest.xml";
if (file_exists($mokoManifest)) {
$xml = @simplexml_load_file($mokoManifest);
if ($xml !== false) {
$v = (string)($xml->identity->version ?? '');
if (preg_match('/^\d{2}\.\d{2}\.\d{2}$/', $v)) {
$mokoVersion = $v;
}
}
}
// If manifest.xml has a version, that is authoritative
if ($mokoVersion !== null) {
echo $mokoVersion . "\n";
exit(0);
}
// -- 2. Fallback: README.md --
$readmeVersion = null;
$readme = "{$root}/README.md";
if (file_exists($readme)) {
@@ -33,7 +52,7 @@ if (file_exists($readme)) {
}
}
// ── Read from Joomla manifest XML ────────────────────────────────────────────
// -- 3. Fallback: Joomla manifest XML --
$manifestVersion = null;
$manifestFiles = array_merge(
glob("{$root}/src/pkg_*.xml") ?: [],
@@ -55,7 +74,7 @@ foreach ($manifestFiles as $xmlFile) {
}
}
// ── Output the higher version ────────────────────────────────────────────────
// -- Output the higher version --
$version = null;
if ($readmeVersion !== null && $manifestVersion !== null) {
$version = version_compare($manifestVersion, $readmeVersion, '>') ? $manifestVersion : $readmeVersion;
@@ -66,7 +85,7 @@ if ($readmeVersion !== null && $manifestVersion !== null) {
}
if ($version === null) {
fwrite(STDERR, "No version found in README.md or manifest XML\n");
fwrite(STDERR, "No version found in manifest.xml, README.md, or Joomla XML\n");
exit(1);
}