diff --git a/.claude/skills/meta-compile/scripts/meta-compile.ps1 b/.claude/skills/meta-compile/scripts/meta-compile.ps1 index 6aa415f7f..882af8783 100644 --- a/.claude/skills/meta-compile/scripts/meta-compile.ps1 +++ b/.claude/skills/meta-compile/scripts/meta-compile.ps1 @@ -1,4 +1,4 @@ -# meta-compile v1.102 — Compile 1C metadata object from JSON +# meta-compile v1.103 — Compile 1C metadata object from JSON # Source: https://github.com/Nikolay-Shirokov/cc-1c-skills [CmdletBinding(PositionalBinding=$false)] param( @@ -1080,8 +1080,10 @@ function Emit-FillValue { # --- 5. Attribute shorthand parser --- function Build-TypeStr { - param($obj) - $t = if ($obj.valueType) { "$($obj.valueType)" } elseif ($obj.type) { "$($obj.type)" } else { "" } + # ValueTypeOnly — для корневого определения объекта: там ключ type означает ВИД объекта + # (Constant, Catalog, …), а не тип значения, и подхватывать его нельзя. + param($obj, [switch]$ValueTypeOnly) + $t = if ($obj.valueType) { "$($obj.valueType)" } elseif (-not $ValueTypeOnly -and $obj.type) { "$($obj.type)" } else { "" } if ($t -and -not $t.Contains('(')) { if ($t -eq "String" -and $obj.length) { $t = "String($($obj.length))" @@ -2771,8 +2773,8 @@ function Emit-ConstantProperties { if ($def.comment) { X "$i$(Esc-XmlText $def.comment)" } else { X "$i" } # Type — valueType (пустой явный '' → , реквизит без типа; отсутствие → String дефолт). - $valueType = Build-TypeStr $def - $typeEmpty = ($null -ne $def.valueType -and "$($def.valueType)".Trim() -eq '') -or ($null -ne $def.type -and "$($def.type)".Trim() -eq '') + $valueType = Build-TypeStr $def -ValueTypeOnly + $typeEmpty = ($null -ne $def.valueType -and "$($def.valueType)".Trim() -eq '') if ($typeEmpty) { X "$i" } else { if (-not $valueType) { $valueType = "String" }; Emit-ValueType $i $valueType } diff --git a/.claude/skills/meta-compile/scripts/meta-compile.py b/.claude/skills/meta-compile/scripts/meta-compile.py index aba43c83b..e26599c47 100644 --- a/.claude/skills/meta-compile/scripts/meta-compile.py +++ b/.claude/skills/meta-compile/scripts/meta-compile.py @@ -1,5 +1,5 @@ #!/usr/bin/env python3 -# meta-compile v1.102 — Compile 1C metadata object from JSON +# meta-compile v1.103 — Compile 1C metadata object from JSON # Source: https://github.com/Nikolay-Shirokov/cc-1c-skills import argparse @@ -1194,8 +1194,10 @@ def emit_fill_value(indent, type_str, spec, has_spec, type_empty=False): # 5. Attribute shorthand parser # --------------------------------------------------------------------------- -def build_type_str(obj): - t = str(obj.get('valueType') or obj.get('type') or '') +def build_type_str(obj, value_type_only=False): + # value_type_only — для корневого определения объекта: там ключ type означает ВИД объекта + # (Constant, Catalog, …), а не тип значения, и подхватывать его нельзя. + t = str(obj.get('valueType') or ('' if value_type_only else obj.get('type')) or '') if t and '(' not in t: if t == 'String' and obj.get('length'): t = f"String({obj['length']})" @@ -2869,9 +2871,8 @@ def emit_constant_properties(indent): else: X(f'{i}') # Type — valueType (явный '' → , реквизит без типа; отсутствие → String дефолт). - value_type = build_type_str(defn) - type_empty = (defn.get('valueType') is not None and str(defn.get('valueType')).strip() == '') or \ - (defn.get('type') is not None and str(defn.get('type')).strip() == '') + value_type = build_type_str(defn, value_type_only=True) + type_empty = defn.get('valueType') is not None and str(defn.get('valueType')).strip() == '' if type_empty: X(f'{i}') else: diff --git a/tests/skills/cases/meta-compile/constant-no-valuetype.json b/tests/skills/cases/meta-compile/constant-no-valuetype.json new file mode 100644 index 000000000..e07e9ed66 --- /dev/null +++ b/tests/skills/cases/meta-compile/constant-no-valuetype.json @@ -0,0 +1,17 @@ +{ + "name": "Константа без valueType — тип значения Строка(10), а не вид объекта", + "input": { + "type": "Constant", + "name": "ПризнакРаботы" + }, + "validatePath": "Constants/ПризнакРаботы", + "expect": { + "files": ["Constants/ПризнакРаботы.xml"], + "fileContains": [ + { "file": "Constants/ПризнакРаботы.xml", "text": ["xs:string", "10"] } + ], + "fileNotContains": [ + { "file": "Constants/ПризнакРаботы.xml", "text": "Constant" } + ] + } +} diff --git a/tests/skills/cases/meta-compile/snapshots/constant-no-valuetype/Configuration.xml b/tests/skills/cases/meta-compile/snapshots/constant-no-valuetype/Configuration.xml new file mode 100644 index 000000000..211c65ddc --- /dev/null +++ b/tests/skills/cases/meta-compile/snapshots/constant-no-valuetype/Configuration.xml @@ -0,0 +1,252 @@ + + + + + + UUID-002 + UUID-003 + + + UUID-004 + UUID-005 + + + UUID-006 + UUID-007 + + + UUID-008 + UUID-009 + + + UUID-010 + UUID-011 + + + UUID-012 + UUID-013 + + + UUID-014 + UUID-015 + + + + TestConfig + + + ru + TestConfig + + + + + Version8_3_24 + ManagedApplication + + PlatformApplication + + Russian + + + + + false + false + false + + + + + + + + + + + + + + + + + + + + + + Biometrics + true + + + Location + false + + + BackgroundLocation + false + + + BluetoothPrinters + false + + + WiFiPrinters + false + + + Contacts + false + + + Calendars + false + + + PushNotifications + false + + + LocalNotifications + false + + + InAppPurchases + false + + + PersonalComputerFileExchange + false + + + Ads + false + + + NumberDialing + false + + + CallProcessing + false + + + CallLog + false + + + AutoSendSMS + false + + + ReceiveSMS + false + + + SMSLog + false + + + Camera + false + + + Microphone + false + + + MusicLibrary + false + + + PictureAndVideoLibraries + false + + + AudioPlaybackAndVibration + false + + + BackgroundAudioPlaybackAndVibration + false + + + InstallPackages + false + + + OSBackup + true + + + ApplicationUsageStatistics + false + + + BarcodeScanning + false + + + BackgroundAudioRecording + false + + + AllFilesAccess + false + + + Videoconferences + false + + + NFC + false + + + DocumentScanning + false + + + SpeechToText + false + + + Geofences + false + + + IncomingShareRequests + false + + + AllIncomingShareRequestsTypesProcessing + false + + + + + + Normal + + + Language.Русский + + + + + + Managed + NotAutoFree + DontUse + DontUse + TaxiEnableVersion8_2 + DontUse + Version8_3_24 + + + + Русский + ПризнакРаботы + + + \ No newline at end of file diff --git a/tests/skills/cases/meta-compile/snapshots/constant-no-valuetype/Constants/ПризнакРаботы.xml b/tests/skills/cases/meta-compile/snapshots/constant-no-valuetype/Constants/ПризнакРаботы.xml new file mode 100644 index 000000000..88597ae0e --- /dev/null +++ b/tests/skills/cases/meta-compile/snapshots/constant-no-valuetype/Constants/ПризнакРаботы.xml @@ -0,0 +1,62 @@ + + + + + + UUID-002 + UUID-003 + + + UUID-004 + UUID-005 + + + UUID-006 + UUID-007 + + + + ПризнакРаботы + + + ru + Признак работы + + + + + xs:string + + 10 + Variable + + + true + + + + false + + + + false + + false + false + + + DontCheck + Items + + + Auto + + + Auto + Managed + DontUse + false + false + + + \ No newline at end of file diff --git a/tests/skills/cases/meta-compile/snapshots/constant-no-valuetype/Constants/ПризнакРаботы/Ext/ManagerModule.bsl b/tests/skills/cases/meta-compile/snapshots/constant-no-valuetype/Constants/ПризнакРаботы/Ext/ManagerModule.bsl new file mode 100644 index 000000000..e69de29bb diff --git a/tests/skills/cases/meta-compile/snapshots/constant-no-valuetype/Constants/ПризнакРаботы/Ext/ValueManagerModule.bsl b/tests/skills/cases/meta-compile/snapshots/constant-no-valuetype/Constants/ПризнакРаботы/Ext/ValueManagerModule.bsl new file mode 100644 index 000000000..e69de29bb diff --git a/tests/skills/cases/meta-compile/snapshots/constant-no-valuetype/Ext/ClientApplicationInterface.xml b/tests/skills/cases/meta-compile/snapshots/constant-no-valuetype/Ext/ClientApplicationInterface.xml new file mode 100644 index 000000000..3c1161b2d --- /dev/null +++ b/tests/skills/cases/meta-compile/snapshots/constant-no-valuetype/Ext/ClientApplicationInterface.xml @@ -0,0 +1,18 @@ + + + + + UUID-002 + + + + + UUID-004 + + + + + + + + \ No newline at end of file diff --git a/tests/skills/cases/meta-compile/snapshots/constant-no-valuetype/Languages/Русский.xml b/tests/skills/cases/meta-compile/snapshots/constant-no-valuetype/Languages/Русский.xml new file mode 100644 index 000000000..37c60d786 --- /dev/null +++ b/tests/skills/cases/meta-compile/snapshots/constant-no-valuetype/Languages/Русский.xml @@ -0,0 +1,16 @@ + + + + + Русский + + + ru + Русский + + + + ru + + + \ No newline at end of file