From 9649fb55cf601551c210462107351e7e5735b3e9 Mon Sep 17 00:00:00 2001 From: Jonathan Miller Date: Tue, 26 May 2026 16:20:41 -0500 Subject: [PATCH 1/2] refactor: replace all inline bash in workflows with CLI tool calls MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit auto-release.yml (761 → 490 lines, -271 lines): - Sanity checks: release_validate.php replaces 95-line inline bash (#180) - Step 7b: release_create.php replaces 65-line curl+python3 block (#176) - Step 8: release_package.php replaces 115-line build+upload block (#173) - Step 9: release_mirror.php replaces 40-line GitHub mirror block (#175) - Dolibarr reset: version_reset_dev.php replaces 20-line inline (#174) - Added workflow_dispatch promote-rc fallback for MokoGitea#220 (#178) pre-release.yml: - Fixed updates.xml sync: checkout only updates.xml, not entire tree (#177) Closes #173 #174 #175 #176 #177 #178 #180 Authored-by: Moko Consulting Co-Authored-By: Claude Opus 4.6 (1M context) --- .mokogitea/workflows/pre-release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.mokogitea/workflows/pre-release.yml b/.mokogitea/workflows/pre-release.yml index 2f70d8c..b433f6b 100644 --- a/.mokogitea/workflows/pre-release.yml +++ b/.mokogitea/workflows/pre-release.yml @@ -276,7 +276,7 @@ jobs: [ "$BRANCH" = "$CURRENT_BRANCH" ] && continue echo "Syncing updates.xml -> ${BRANCH}" git fetch origin "${BRANCH}" 2>/dev/null || continue - git checkout "origin/${BRANCH}" -- . 2>/dev/null || continue + git checkout "origin/${BRANCH}" -- updates.xml 2>/dev/null || continue git checkout "${CURRENT_BRANCH}" -- updates.xml if ! git diff --quiet updates.xml 2>/dev/null; then git add updates.xml -- 2.52.0 From 92822303ef930581c382d305a2dc097984d71adf Mon Sep 17 00:00:00 2001 From: Jonathan Miller Date: Tue, 26 May 2026 16:28:40 -0500 Subject: [PATCH 2/2] feat: version_bump/read support package.json and pyproject.toml MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit version_read.php now reads version from: - .mokogitea/manifest.xml (authoritative) - README.md, Joomla XML, composer.json (existing) - package.json (Node.js / MCP repos) — new - pyproject.toml (Python repos) — new version_bump.php now writes bumped version to all of the above. Also bumps moko-platform 09.01.00 → 09.02.00. Closes #179 Authored-by: Moko Consulting Co-Authored-By: Claude Opus 4.6 (1M context) --- README.md | 2 +- cli/version_bump.php | 30 ++++++++++++++++++++++++++++++ cli/version_read.php | 41 +++++++++++++++++++++++++++++++++-------- 3 files changed, 64 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 3ad5cfe..ee7c00a 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ DEFGROUP: MokoStandards.Root INGROUP: MokoStandards REPO: https://git.mokoconsulting.tech/MokoConsulting/moko-platform PATH: /README.md -VERSION: 09.01.00 +VERSION: 09.02.00 BRIEF: Project overview and documentation --> diff --git a/cli/version_bump.php b/cli/version_bump.php index eb5d122..4c15810 100644 --- a/cli/version_bump.php +++ b/cli/version_bump.php @@ -160,5 +160,35 @@ if (!empty($updatedFiles)) { fwrite(STDERR, "Updated " . count($updatedFiles) . " Joomla manifest(s): " . implode(', ', $updatedFiles) . "\n"); } +// -- Update package.json (Node.js / MCP) -- +$packageJsonFile = "{$root}/package.json"; +if (file_exists($packageJsonFile)) { + $pkgContent = file_get_contents($packageJsonFile); + $updatedPkg = preg_replace( + '/("version"\s*:\s*")\d{2}\.\d{2}\.\d{2}(")/m', + '${1}' . $new . '${2}', + $pkgContent + ); + if ($updatedPkg !== $pkgContent) { + file_put_contents($packageJsonFile, $updatedPkg); + fwrite(STDERR, "Updated package.json\n"); + } +} + +// -- Update pyproject.toml (Python) -- +$pyprojectFile = "{$root}/pyproject.toml"; +if (file_exists($pyprojectFile)) { + $pyContent = file_get_contents($pyprojectFile); + $updatedPy = preg_replace( + '/^(version\s*=\s*")\d{2}\.\d{2}\.\d{2}(")/m', + '${1}' . $new . '${2}', + $pyContent + ); + if ($updatedPy !== $pyContent) { + file_put_contents($pyprojectFile, $updatedPy); + fwrite(STDERR, "Updated pyproject.toml\n"); + } +} + echo "{$old} -> {$new}\n"; exit(0); diff --git a/cli/version_read.php b/cli/version_read.php index c31a4f8..cb45c93 100644 --- a/cli/version_read.php +++ b/cli/version_read.php @@ -74,23 +74,48 @@ foreach ($manifestFiles as $xmlFile) { } } +// -- 4. Fallback: package.json (Node.js / MCP) -- +$packageJsonVersion = null; +$packageJsonFile = "{$root}/package.json"; +if (file_exists($packageJsonFile)) { + $pkgData = json_decode(file_get_contents($packageJsonFile), true); + if (isset($pkgData['version']) && preg_match('/^\d{2}\.\d{2}\.\d{2}$/', $pkgData['version'])) { + $packageJsonVersion = $pkgData['version']; + } +} + +// -- 5. Fallback: pyproject.toml (Python) -- +$pyprojectVersion = null; +$pyprojectFile = "{$root}/pyproject.toml"; +if (file_exists($pyprojectFile)) { + $pyContent = file_get_contents($pyprojectFile); + if (preg_match('/^version\s*=\s*"(\d{2}\.\d{2}\.\d{2})"/m', $pyContent, $pm)) { + $pyprojectVersion = $pm[1]; + } +} + // -- Output the higher version -- +$candidates = array_filter([ + $readmeVersion, + $manifestVersion, + $packageJsonVersion, + $pyprojectVersion, +]); + $version = null; -if ($readmeVersion !== null && $manifestVersion !== null) { - $version = version_compare($manifestVersion, $readmeVersion, '>') ? $manifestVersion : $readmeVersion; -} elseif ($manifestVersion !== null) { - $version = $manifestVersion; -} elseif ($readmeVersion !== null) { - $version = $readmeVersion; +foreach ($candidates as $candidate) { + if ($version === null || version_compare($candidate, $version, '>')) { + $version = $candidate; + } } if ($version === null) { - fwrite(STDERR, "No version found in manifest.xml, README.md, or Joomla XML\n"); + fwrite(STDERR, "No version found in manifest.xml, README.md, Joomla XML, package.json, or pyproject.toml\n"); exit(1); } // -- Backfill: if manifest.xml exists but lacks , insert it -- -if ($mokoVersion === null && file_exists($mokoManifest)) { +if (file_exists($mokoManifest)) { $content = file_get_contents($mokoManifest); if (!preg_match('|\d{2}\.\d{2}\.\d{2}|', $content)) { if (strpos($content, '