diff --git a/.mokogitea/manifest.xml b/.mokogitea/manifest.xml index 21b9bd1..4a2beb4 100644 --- a/.mokogitea/manifest.xml +++ b/.mokogitea/manifest.xml @@ -4,11 +4,15 @@ Auto-generated by cleanup script. See: https://git.mokoconsulting.tech/MokoConsulting/moko-platform/wiki/Home --> - + moko-platform MokoConsulting Enterprise automation, validation, sync, and governance engine for all Moko Consulting repositories + 09.01.00 GNU General Public License v3 diff --git a/cli/version_bump.php b/cli/version_bump.php index e9f1fff..661df0c 100644 --- a/cli/version_bump.php +++ b/cli/version_bump.php @@ -128,12 +128,34 @@ $new = sprintf('%02d.%02d.%02d', $major, $minor, $patch); // -- Update .mokogitea/manifest.xml (canonical target) -- if (file_exists($mokoManifest) && !empty($mokoContent)) { - $updated = preg_replace( - '|\d{2}\.\d{2}\.\d{2}|', - "{$new}", - $mokoContent, - 1 - ); + if (preg_match('|\d{2}\.\d{2}\.\d{2}|', $mokoContent)) { + // Replace existing version tag + $updated = preg_replace( + '|\d{2}\.\d{2}\.\d{2}|', + "{$new}", + $mokoContent, + 1 + ); + } else { + // Insert before (per schema order) or as last child of + if (strpos($mokoContent, '{$new}\$1", + $mokoContent, + 1 + ); + } elseif (strpos($mokoContent, '') !== false) { + $updated = preg_replace( + '|()|', + " {$new}\n \$1", + $mokoContent, + 1 + ); + } else { + $updated = $mokoContent; + } + } file_put_contents($mokoManifest, $updated); } diff --git a/cli/version_read.php b/cli/version_read.php index 78f24c5..c31a4f8 100644 --- a/cli/version_read.php +++ b/cli/version_read.php @@ -89,5 +89,29 @@ if ($version === null) { exit(1); } +// -- Backfill: if manifest.xml exists but lacks , insert it -- +if ($mokoVersion === null && file_exists($mokoManifest)) { + $content = file_get_contents($mokoManifest); + if (!preg_match('|\d{2}\.\d{2}\.\d{2}|', $content)) { + if (strpos($content, '{$version}\$1", + $content, + 1 + ); + } elseif (strpos($content, '') !== false) { + $content = preg_replace( + '|()|', + " {$version}\n \$1", + $content, + 1 + ); + } + file_put_contents($mokoManifest, $content); + fwrite(STDERR, "Backfilled manifest.xml with version {$version}\n"); + } +} + echo $version . "\n"; exit(0); diff --git a/definitions/manifest-schema.xsd b/definitions/manifest-schema.xsd index c8ca0c2..60e3d3c 100644 --- a/definitions/manifest-schema.xsd +++ b/definitions/manifest-schema.xsd @@ -3,7 +3,7 @@ Copyright (C) 2026 Moko Consulting SPDX-License-Identifier: GPL-3.0-or-later - MokoStandards Manifest Schema v1.0 + MokoStandards Manifest Schema v09.01.00 Defines the structure of .mokogitea/manifest.xml Validate: xmllint - -schema definitions/manifest-schema.xsd .mokogitea/manifest.xml @@ -11,7 +11,8 @@ + elementFormDefault="qualified" + version="09.01.00">