From 7f8f09a3acd9a5e7e4552f7508bde58c12c33ef1 Mon Sep 17 00:00:00 2001 From: Shahovalov MIkhail Date: Thu, 9 Apr 2026 08:47:39 +0300 Subject: [PATCH] =?UTF-8?q?=D0=98=D1=81=D0=BF=D1=80=D0=B0=D0=B2=D0=BB?= =?UTF-8?q?=D0=B5=D0=BD=20set-version:=20=D0=BE=D0=B1=D0=BD=D0=BE=D0=B2?= =?UTF-8?q?=D0=BB=D0=B5=D0=BD=D0=B8=D0=B5=20=D1=82=D0=BE=D0=BB=D1=8C=D0=BA?= =?UTF-8?q?=D0=BE=20ModuleInfo.Version64=20=D0=B8=20=D1=81=D1=83=D0=B6?= =?UTF-8?q?=D0=B5=D0=BD=D1=8B=20=D0=BF=D1=80=D0=B0=D0=B2=D0=B8=D0=BB=D0=B0?= =?UTF-8?q?=20=D0=B2=20AGENTS?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- AGENTS.md | 2 +- scripts/set-version.ps1 | 10 +++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/AGENTS.md b/AGENTS.md index 96cf80f..2742ab8 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -39,7 +39,7 @@ - CI triggers: tag `v*` and manual dispatch; not every push to `main`. ## Version/Release Rules (MUST) -- Source of truth for release version: `ModuleInfo/Version64` in `meta.lsx`. +- Read release version only from `save/region/node[@id="ModuleSettings"]/children/node[@id="ModuleInfo"]/attribute[@id="Version64"]` via explicit XML parsing. - `PublishVersion` must not be changed during release preparation. - Release tag must match the source-of-truth version. - Decision logic before tagging: diff --git a/scripts/set-version.ps1 b/scripts/set-version.ps1 index b30ccd1..2387f5b 100644 --- a/scripts/set-version.ps1 +++ b/scripts/set-version.ps1 @@ -36,8 +36,16 @@ if (-not (Test-Path -LiteralPath $resolvedMetaPath)) { $resolvedVersion64 = Convert-VersionTagToVersion64 -Tag $VersionTag $metaContent = Get-Content -LiteralPath $resolvedMetaPath -Raw +[xml]$metaXml = $metaContent -$moduleInfoVersionPattern = '(?s)(.*?)' +# Explicitly target ModuleInfo/Version64 via XML path to avoid touching Dependencies/PublishVersion. +$moduleInfoVersionNode = $metaXml.SelectSingleNode('/save/region/node/children/node[@id="ModuleInfo"]/attribute[@id="Version64" and @type="int64"]') +if ($null -eq $moduleInfoVersionNode) { + throw "ModuleInfo/Version64 attribute was not found in '$resolvedMetaPath'." +} + +# Replace only the Version64 attribute that appears inside ModuleInfo before its block. +$moduleInfoVersionPattern = '(?s)(\s*(?:(?!).)*?)' if ($metaContent -notmatch $moduleInfoVersionPattern) { throw "ModuleInfo/Version64 attribute was not found in '$resolvedMetaPath'." }