diff --git a/.claude/skills/db-create/scripts/db-create.ps1 b/.claude/skills/db-create/scripts/db-create.ps1 index 71d9ea9b..6d846d92 100644 --- a/.claude/skills/db-create/scripts/db-create.ps1 +++ b/.claude/skills/db-create/scripts/db-create.ps1 @@ -1,4 +1,4 @@ -# db-create v1.0 — Create 1C information base +# db-create v1.1 — Create 1C information base # Source: https://github.com/Nikolay-Shirokov/cc-1c-skills <# .SYNOPSIS @@ -67,15 +67,40 @@ $OutputEncoding = [System.Text.Encoding]::UTF8 [Console]::OutputEncoding = [System.Text.Encoding]::UTF8 # --- Resolve V8Path --- +function Find-ProjectV8Path { + $dir = (Get-Location).Path + while ($dir) { + $pf = Join-Path $dir ".v8-project.json" + if (Test-Path $pf) { + try { + $j = Get-Content $pf -Raw -Encoding UTF8 | ConvertFrom-Json + if ($j.v8path) { return [string]$j.v8path } + } catch {} + return $null + } + $parent = Split-Path $dir -Parent + if (-not $parent -or $parent -eq $dir) { break } + $dir = $parent + } + return $null +} + if (-not $V8Path) { - $found = Get-ChildItem "C:\Program Files\1cv8\*\bin\1cv8.exe" -ErrorAction SilentlyContinue | Sort-Object FullName -Descending | Select-Object -First 1 + $V8Path = Find-ProjectV8Path +} +if (-not $V8Path) { + $found = Get-ChildItem @("C:\Program Files\1cv8\*\bin\1cv8.exe", "C:\Program Files (x86)\1cv8\*\bin\1cv8.exe") -ErrorAction SilentlyContinue | + Sort-Object { try { [version]$_.Directory.Parent.Name } catch { [version]"0.0" } } -Descending | + Select-Object -First 1 if ($found) { $V8Path = $found.FullName + Write-Host "Auto-selected platform $($found.Directory.Parent.Name): $V8Path" -ForegroundColor Yellow } else { Write-Host "Error: 1cv8.exe not found. Specify -V8Path" -ForegroundColor Red exit 1 } -} elseif (Test-Path $V8Path -PathType Container) { +} +if (Test-Path $V8Path -PathType Container) { $V8Path = Join-Path $V8Path "1cv8.exe" } diff --git a/.claude/skills/db-create/scripts/db-create.py b/.claude/skills/db-create/scripts/db-create.py index 34f63ed8..8424eb28 100644 --- a/.claude/skills/db-create/scripts/db-create.py +++ b/.claude/skills/db-create/scripts/db-create.py @@ -1,29 +1,64 @@ #!/usr/bin/env python3 -# db-create v1.0 — Create 1C information base +# db-create v1.1 — Create 1C information base # Source: https://github.com/Nikolay-Shirokov/cc-1c-skills import argparse import glob +import json import os import random +import re import shutil import subprocess import sys import tempfile +def _find_project_v8path(): + """Walk up from CWD to find .v8-project.json and read its v8path.""" + d = os.getcwd() + while True: + pf = os.path.join(d, ".v8-project.json") + if os.path.isfile(pf): + try: + with open(pf, encoding="utf-8-sig") as f: + data = json.load(f) + v = data.get("v8path") + if v: + return v + except Exception: + pass + return None + parent = os.path.dirname(d) + if parent == d: + return None + d = parent + + +def _version_key(p): + """Numeric sort key from version dir name (.../1cv8//bin/1cv8.exe).""" + ver = os.path.basename(os.path.dirname(os.path.dirname(p))) + return [int(x) for x in re.findall(r"\d+", ver)] + + def resolve_v8path(v8path): """Resolve path to 1cv8.exe.""" if not v8path: - found = sorted(glob.glob(r"C:\Program Files\1cv8\*\bin\1cv8.exe")) - if found: - return found[-1] + v8path = _find_project_v8path() + if not v8path: + candidates = ( + glob.glob(r"C:\Program Files\1cv8\*\bin\1cv8.exe") + + glob.glob(r"C:\Program Files (x86)\1cv8\*\bin\1cv8.exe") + ) + if candidates: + v8path = max(candidates, key=_version_key) + ver = os.path.basename(os.path.dirname(os.path.dirname(v8path))) + print(f"Auto-selected platform {ver}: {v8path}") else: print("Error: 1cv8.exe not found. Specify -V8Path", file=sys.stderr) sys.exit(1) - elif os.path.isdir(v8path): + if os.path.isdir(v8path): v8path = os.path.join(v8path, "1cv8.exe") - if not os.path.isfile(v8path): print(f"Error: 1cv8.exe not found at {v8path}", file=sys.stderr) sys.exit(1) diff --git a/.claude/skills/db-dump-cf/scripts/db-dump-cf.ps1 b/.claude/skills/db-dump-cf/scripts/db-dump-cf.ps1 index 45f3090c..23ac9f41 100644 --- a/.claude/skills/db-dump-cf/scripts/db-dump-cf.ps1 +++ b/.claude/skills/db-dump-cf/scripts/db-dump-cf.ps1 @@ -1,4 +1,4 @@ -# db-dump-cf v1.0 — Dump 1C configuration to CF file +# db-dump-cf v1.1 — Dump 1C configuration to CF file # Source: https://github.com/Nikolay-Shirokov/cc-1c-skills <# .SYNOPSIS @@ -76,15 +76,40 @@ $OutputEncoding = [System.Text.Encoding]::UTF8 [Console]::OutputEncoding = [System.Text.Encoding]::UTF8 # --- Resolve V8Path --- +function Find-ProjectV8Path { + $dir = (Get-Location).Path + while ($dir) { + $pf = Join-Path $dir ".v8-project.json" + if (Test-Path $pf) { + try { + $j = Get-Content $pf -Raw -Encoding UTF8 | ConvertFrom-Json + if ($j.v8path) { return [string]$j.v8path } + } catch {} + return $null + } + $parent = Split-Path $dir -Parent + if (-not $parent -or $parent -eq $dir) { break } + $dir = $parent + } + return $null +} + if (-not $V8Path) { - $found = Get-ChildItem "C:\Program Files\1cv8\*\bin\1cv8.exe" -ErrorAction SilentlyContinue | Sort-Object FullName -Descending | Select-Object -First 1 + $V8Path = Find-ProjectV8Path +} +if (-not $V8Path) { + $found = Get-ChildItem @("C:\Program Files\1cv8\*\bin\1cv8.exe", "C:\Program Files (x86)\1cv8\*\bin\1cv8.exe") -ErrorAction SilentlyContinue | + Sort-Object { try { [version]$_.Directory.Parent.Name } catch { [version]"0.0" } } -Descending | + Select-Object -First 1 if ($found) { $V8Path = $found.FullName + Write-Host "Auto-selected platform $($found.Directory.Parent.Name): $V8Path" -ForegroundColor Yellow } else { Write-Host "Error: 1cv8.exe not found. Specify -V8Path" -ForegroundColor Red exit 1 } -} elseif (Test-Path $V8Path -PathType Container) { +} +if (Test-Path $V8Path -PathType Container) { $V8Path = Join-Path $V8Path "1cv8.exe" } diff --git a/.claude/skills/db-dump-cf/scripts/db-dump-cf.py b/.claude/skills/db-dump-cf/scripts/db-dump-cf.py index 4471a751..5668e614 100644 --- a/.claude/skills/db-dump-cf/scripts/db-dump-cf.py +++ b/.claude/skills/db-dump-cf/scripts/db-dump-cf.py @@ -1,29 +1,64 @@ #!/usr/bin/env python3 -# db-dump-cf v1.0 — Dump 1C configuration to CF file +# db-dump-cf v1.1 — Dump 1C configuration to CF file # Source: https://github.com/Nikolay-Shirokov/cc-1c-skills import argparse import glob +import json import os import random +import re import shutil import subprocess import sys import tempfile +def _find_project_v8path(): + """Walk up from CWD to find .v8-project.json and read its v8path.""" + d = os.getcwd() + while True: + pf = os.path.join(d, ".v8-project.json") + if os.path.isfile(pf): + try: + with open(pf, encoding="utf-8-sig") as f: + data = json.load(f) + v = data.get("v8path") + if v: + return v + except Exception: + pass + return None + parent = os.path.dirname(d) + if parent == d: + return None + d = parent + + +def _version_key(p): + """Numeric sort key from version dir name (.../1cv8//bin/1cv8.exe).""" + ver = os.path.basename(os.path.dirname(os.path.dirname(p))) + return [int(x) for x in re.findall(r"\d+", ver)] + + def resolve_v8path(v8path): """Resolve path to 1cv8.exe.""" if not v8path: - found = sorted(glob.glob(r"C:\Program Files\1cv8\*\bin\1cv8.exe")) - if found: - return found[-1] + v8path = _find_project_v8path() + if not v8path: + candidates = ( + glob.glob(r"C:\Program Files\1cv8\*\bin\1cv8.exe") + + glob.glob(r"C:\Program Files (x86)\1cv8\*\bin\1cv8.exe") + ) + if candidates: + v8path = max(candidates, key=_version_key) + ver = os.path.basename(os.path.dirname(os.path.dirname(v8path))) + print(f"Auto-selected platform {ver}: {v8path}") else: print("Error: 1cv8.exe not found. Specify -V8Path", file=sys.stderr) sys.exit(1) - elif os.path.isdir(v8path): + if os.path.isdir(v8path): v8path = os.path.join(v8path, "1cv8.exe") - if not os.path.isfile(v8path): print(f"Error: 1cv8.exe not found at {v8path}", file=sys.stderr) sys.exit(1) diff --git a/.claude/skills/db-dump-dt/scripts/db-dump-dt.ps1 b/.claude/skills/db-dump-dt/scripts/db-dump-dt.ps1 index d6170081..63ff1193 100644 --- a/.claude/skills/db-dump-dt/scripts/db-dump-dt.ps1 +++ b/.claude/skills/db-dump-dt/scripts/db-dump-dt.ps1 @@ -1,4 +1,4 @@ -# db-dump-dt v1.0 — Dump 1C information base to DT file +# db-dump-dt v1.1 — Dump 1C information base to DT file # Source: https://github.com/Nikolay-Shirokov/cc-1c-skills <# .SYNOPSIS @@ -60,15 +60,40 @@ $OutputEncoding = [System.Text.Encoding]::UTF8 [Console]::OutputEncoding = [System.Text.Encoding]::UTF8 # --- Resolve V8Path --- +function Find-ProjectV8Path { + $dir = (Get-Location).Path + while ($dir) { + $pf = Join-Path $dir ".v8-project.json" + if (Test-Path $pf) { + try { + $j = Get-Content $pf -Raw -Encoding UTF8 | ConvertFrom-Json + if ($j.v8path) { return [string]$j.v8path } + } catch {} + return $null + } + $parent = Split-Path $dir -Parent + if (-not $parent -or $parent -eq $dir) { break } + $dir = $parent + } + return $null +} + if (-not $V8Path) { - $found = Get-ChildItem "C:\Program Files\1cv8\*\bin\1cv8.exe" -ErrorAction SilentlyContinue | Sort-Object FullName -Descending | Select-Object -First 1 + $V8Path = Find-ProjectV8Path +} +if (-not $V8Path) { + $found = Get-ChildItem @("C:\Program Files\1cv8\*\bin\1cv8.exe", "C:\Program Files (x86)\1cv8\*\bin\1cv8.exe") -ErrorAction SilentlyContinue | + Sort-Object { try { [version]$_.Directory.Parent.Name } catch { [version]"0.0" } } -Descending | + Select-Object -First 1 if ($found) { $V8Path = $found.FullName + Write-Host "Auto-selected platform $($found.Directory.Parent.Name): $V8Path" -ForegroundColor Yellow } else { Write-Host "Error: 1cv8.exe not found. Specify -V8Path" -ForegroundColor Red exit 1 } -} elseif (Test-Path $V8Path -PathType Container) { +} +if (Test-Path $V8Path -PathType Container) { $V8Path = Join-Path $V8Path "1cv8.exe" } diff --git a/.claude/skills/db-dump-dt/scripts/db-dump-dt.py b/.claude/skills/db-dump-dt/scripts/db-dump-dt.py index feb3e27b..684aa9fc 100644 --- a/.claude/skills/db-dump-dt/scripts/db-dump-dt.py +++ b/.claude/skills/db-dump-dt/scripts/db-dump-dt.py @@ -1,29 +1,64 @@ #!/usr/bin/env python3 -# db-dump-dt v1.0 — Dump 1C information base to DT file +# db-dump-dt v1.1 — Dump 1C information base to DT file # Source: https://github.com/Nikolay-Shirokov/cc-1c-skills import argparse import glob +import json import os import random +import re import shutil import subprocess import sys import tempfile +def _find_project_v8path(): + """Walk up from CWD to find .v8-project.json and read its v8path.""" + d = os.getcwd() + while True: + pf = os.path.join(d, ".v8-project.json") + if os.path.isfile(pf): + try: + with open(pf, encoding="utf-8-sig") as f: + data = json.load(f) + v = data.get("v8path") + if v: + return v + except Exception: + pass + return None + parent = os.path.dirname(d) + if parent == d: + return None + d = parent + + +def _version_key(p): + """Numeric sort key from version dir name (.../1cv8//bin/1cv8.exe).""" + ver = os.path.basename(os.path.dirname(os.path.dirname(p))) + return [int(x) for x in re.findall(r"\d+", ver)] + + def resolve_v8path(v8path): """Resolve path to 1cv8.exe.""" if not v8path: - found = sorted(glob.glob(r"C:\Program Files\1cv8\*\bin\1cv8.exe")) - if found: - return found[-1] + v8path = _find_project_v8path() + if not v8path: + candidates = ( + glob.glob(r"C:\Program Files\1cv8\*\bin\1cv8.exe") + + glob.glob(r"C:\Program Files (x86)\1cv8\*\bin\1cv8.exe") + ) + if candidates: + v8path = max(candidates, key=_version_key) + ver = os.path.basename(os.path.dirname(os.path.dirname(v8path))) + print(f"Auto-selected platform {ver}: {v8path}") else: print("Error: 1cv8.exe not found. Specify -V8Path", file=sys.stderr) sys.exit(1) - elif os.path.isdir(v8path): + if os.path.isdir(v8path): v8path = os.path.join(v8path, "1cv8.exe") - if not os.path.isfile(v8path): print(f"Error: 1cv8.exe not found at {v8path}", file=sys.stderr) sys.exit(1) diff --git a/.claude/skills/db-dump-xml/scripts/db-dump-xml.ps1 b/.claude/skills/db-dump-xml/scripts/db-dump-xml.ps1 index 8bc46360..ffc472d5 100644 --- a/.claude/skills/db-dump-xml/scripts/db-dump-xml.ps1 +++ b/.claude/skills/db-dump-xml/scripts/db-dump-xml.ps1 @@ -1,5 +1,5 @@ -# db-dump-xml v1.0 — Dump 1C configuration to XML files -# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills +# db-dump-xml v1.1 — Dump 1C configuration to XML files +# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills <# .SYNOPSIS Выгрузка конфигурации 1С в XML-файлы @@ -99,15 +99,40 @@ $OutputEncoding = [System.Text.Encoding]::UTF8 [Console]::OutputEncoding = [System.Text.Encoding]::UTF8 # --- Resolve V8Path --- +function Find-ProjectV8Path { + $dir = (Get-Location).Path + while ($dir) { + $pf = Join-Path $dir ".v8-project.json" + if (Test-Path $pf) { + try { + $j = Get-Content $pf -Raw -Encoding UTF8 | ConvertFrom-Json + if ($j.v8path) { return [string]$j.v8path } + } catch {} + return $null + } + $parent = Split-Path $dir -Parent + if (-not $parent -or $parent -eq $dir) { break } + $dir = $parent + } + return $null +} + if (-not $V8Path) { - $found = Get-ChildItem "C:\Program Files\1cv8\*\bin\1cv8.exe" -ErrorAction SilentlyContinue | Sort-Object FullName -Descending | Select-Object -First 1 + $V8Path = Find-ProjectV8Path +} +if (-not $V8Path) { + $found = Get-ChildItem @("C:\Program Files\1cv8\*\bin\1cv8.exe", "C:\Program Files (x86)\1cv8\*\bin\1cv8.exe") -ErrorAction SilentlyContinue | + Sort-Object { try { [version]$_.Directory.Parent.Name } catch { [version]"0.0" } } -Descending | + Select-Object -First 1 if ($found) { $V8Path = $found.FullName + Write-Host "Auto-selected platform $($found.Directory.Parent.Name): $V8Path" -ForegroundColor Yellow } else { Write-Host "Error: 1cv8.exe not found. Specify -V8Path" -ForegroundColor Red exit 1 } -} elseif (Test-Path $V8Path -PathType Container) { +} +if (Test-Path $V8Path -PathType Container) { $V8Path = Join-Path $V8Path "1cv8.exe" } diff --git a/.claude/skills/db-dump-xml/scripts/db-dump-xml.py b/.claude/skills/db-dump-xml/scripts/db-dump-xml.py index 656153b6..c8de84a5 100644 --- a/.claude/skills/db-dump-xml/scripts/db-dump-xml.py +++ b/.claude/skills/db-dump-xml/scripts/db-dump-xml.py @@ -1,34 +1,67 @@ #!/usr/bin/env python3 -# db-dump-xml v1.0 — Dump 1C configuration to XML files +# db-dump-xml v1.1 — Dump 1C configuration to XML files # Source: https://github.com/Nikolay-Shirokov/cc-1c-skills import argparse import glob +import json import os import random +import re import shutil import subprocess import sys import tempfile +def _find_project_v8path(): + """Walk up from CWD to find .v8-project.json and read its v8path.""" + d = os.getcwd() + while True: + pf = os.path.join(d, ".v8-project.json") + if os.path.isfile(pf): + try: + with open(pf, encoding="utf-8-sig") as f: + data = json.load(f) + v = data.get("v8path") + if v: + return v + except Exception: + pass + return None + parent = os.path.dirname(d) + if parent == d: + return None + d = parent + + +def _version_key(p): + """Numeric sort key from version dir name (.../1cv8//bin/1cv8.exe).""" + ver = os.path.basename(os.path.dirname(os.path.dirname(p))) + return [int(x) for x in re.findall(r"\d+", ver)] + + def resolve_v8path(v8path): """Resolve path to 1cv8.exe.""" if not v8path: - candidates = glob.glob(r"C:\Program Files\1cv8\*\bin\1cv8.exe") + v8path = _find_project_v8path() + if not v8path: + candidates = ( + glob.glob(r"C:\Program Files\1cv8\*\bin\1cv8.exe") + + glob.glob(r"C:\Program Files (x86)\1cv8\*\bin\1cv8.exe") + ) if candidates: - candidates.sort() - return candidates[-1] + v8path = max(candidates, key=_version_key) + ver = os.path.basename(os.path.dirname(os.path.dirname(v8path))) + print(f"Auto-selected platform {ver}: {v8path}") else: print("Error: 1cv8.exe not found. Specify -V8Path", file=sys.stderr) sys.exit(1) - elif os.path.isdir(v8path): + if os.path.isdir(v8path): v8path = os.path.join(v8path, "1cv8.exe") - if not os.path.isfile(v8path): print(f"Error: 1cv8.exe not found at {v8path}", file=sys.stderr) sys.exit(1) - return v8path diff --git a/.claude/skills/db-load-cf/scripts/db-load-cf.ps1 b/.claude/skills/db-load-cf/scripts/db-load-cf.ps1 index af516923..5766214a 100644 --- a/.claude/skills/db-load-cf/scripts/db-load-cf.ps1 +++ b/.claude/skills/db-load-cf/scripts/db-load-cf.ps1 @@ -1,4 +1,4 @@ -# db-load-cf v1.0 — Load 1C configuration from CF file +# db-load-cf v1.1 — Load 1C configuration from CF file # Source: https://github.com/Nikolay-Shirokov/cc-1c-skills <# .SYNOPSIS @@ -76,15 +76,40 @@ $OutputEncoding = [System.Text.Encoding]::UTF8 [Console]::OutputEncoding = [System.Text.Encoding]::UTF8 # --- Resolve V8Path --- +function Find-ProjectV8Path { + $dir = (Get-Location).Path + while ($dir) { + $pf = Join-Path $dir ".v8-project.json" + if (Test-Path $pf) { + try { + $j = Get-Content $pf -Raw -Encoding UTF8 | ConvertFrom-Json + if ($j.v8path) { return [string]$j.v8path } + } catch {} + return $null + } + $parent = Split-Path $dir -Parent + if (-not $parent -or $parent -eq $dir) { break } + $dir = $parent + } + return $null +} + if (-not $V8Path) { - $found = Get-ChildItem "C:\Program Files\1cv8\*\bin\1cv8.exe" -ErrorAction SilentlyContinue | Sort-Object FullName -Descending | Select-Object -First 1 + $V8Path = Find-ProjectV8Path +} +if (-not $V8Path) { + $found = Get-ChildItem @("C:\Program Files\1cv8\*\bin\1cv8.exe", "C:\Program Files (x86)\1cv8\*\bin\1cv8.exe") -ErrorAction SilentlyContinue | + Sort-Object { try { [version]$_.Directory.Parent.Name } catch { [version]"0.0" } } -Descending | + Select-Object -First 1 if ($found) { $V8Path = $found.FullName + Write-Host "Auto-selected platform $($found.Directory.Parent.Name): $V8Path" -ForegroundColor Yellow } else { Write-Host "Error: 1cv8.exe not found. Specify -V8Path" -ForegroundColor Red exit 1 } -} elseif (Test-Path $V8Path -PathType Container) { +} +if (Test-Path $V8Path -PathType Container) { $V8Path = Join-Path $V8Path "1cv8.exe" } diff --git a/.claude/skills/db-load-cf/scripts/db-load-cf.py b/.claude/skills/db-load-cf/scripts/db-load-cf.py index 991b11fc..e00a7c8d 100644 --- a/.claude/skills/db-load-cf/scripts/db-load-cf.py +++ b/.claude/skills/db-load-cf/scripts/db-load-cf.py @@ -1,29 +1,64 @@ #!/usr/bin/env python3 -# db-load-cf v1.0 — Load 1C configuration from CF file +# db-load-cf v1.1 — Load 1C configuration from CF file # Source: https://github.com/Nikolay-Shirokov/cc-1c-skills import argparse import glob +import json import os import random +import re import shutil import subprocess import sys import tempfile +def _find_project_v8path(): + """Walk up from CWD to find .v8-project.json and read its v8path.""" + d = os.getcwd() + while True: + pf = os.path.join(d, ".v8-project.json") + if os.path.isfile(pf): + try: + with open(pf, encoding="utf-8-sig") as f: + data = json.load(f) + v = data.get("v8path") + if v: + return v + except Exception: + pass + return None + parent = os.path.dirname(d) + if parent == d: + return None + d = parent + + +def _version_key(p): + """Numeric sort key from version dir name (.../1cv8//bin/1cv8.exe).""" + ver = os.path.basename(os.path.dirname(os.path.dirname(p))) + return [int(x) for x in re.findall(r"\d+", ver)] + + def resolve_v8path(v8path): """Resolve path to 1cv8.exe.""" if not v8path: - found = sorted(glob.glob(r"C:\Program Files\1cv8\*\bin\1cv8.exe")) - if found: - return found[-1] + v8path = _find_project_v8path() + if not v8path: + candidates = ( + glob.glob(r"C:\Program Files\1cv8\*\bin\1cv8.exe") + + glob.glob(r"C:\Program Files (x86)\1cv8\*\bin\1cv8.exe") + ) + if candidates: + v8path = max(candidates, key=_version_key) + ver = os.path.basename(os.path.dirname(os.path.dirname(v8path))) + print(f"Auto-selected platform {ver}: {v8path}") else: print("Error: 1cv8.exe not found. Specify -V8Path", file=sys.stderr) sys.exit(1) - elif os.path.isdir(v8path): + if os.path.isdir(v8path): v8path = os.path.join(v8path, "1cv8.exe") - if not os.path.isfile(v8path): print(f"Error: 1cv8.exe not found at {v8path}", file=sys.stderr) sys.exit(1) diff --git a/.claude/skills/db-load-dt/scripts/db-load-dt.ps1 b/.claude/skills/db-load-dt/scripts/db-load-dt.ps1 index 1484d9ff..aa5108fb 100644 --- a/.claude/skills/db-load-dt/scripts/db-load-dt.ps1 +++ b/.claude/skills/db-load-dt/scripts/db-load-dt.ps1 @@ -1,4 +1,4 @@ -# db-load-dt v1.0 — Load 1C information base from DT file +# db-load-dt v1.1 — Load 1C information base from DT file # Source: https://github.com/Nikolay-Shirokov/cc-1c-skills <# .SYNOPSIS @@ -73,15 +73,40 @@ $OutputEncoding = [System.Text.Encoding]::UTF8 [Console]::OutputEncoding = [System.Text.Encoding]::UTF8 # --- Resolve V8Path --- +function Find-ProjectV8Path { + $dir = (Get-Location).Path + while ($dir) { + $pf = Join-Path $dir ".v8-project.json" + if (Test-Path $pf) { + try { + $j = Get-Content $pf -Raw -Encoding UTF8 | ConvertFrom-Json + if ($j.v8path) { return [string]$j.v8path } + } catch {} + return $null + } + $parent = Split-Path $dir -Parent + if (-not $parent -or $parent -eq $dir) { break } + $dir = $parent + } + return $null +} + if (-not $V8Path) { - $found = Get-ChildItem "C:\Program Files\1cv8\*\bin\1cv8.exe" -ErrorAction SilentlyContinue | Sort-Object FullName -Descending | Select-Object -First 1 + $V8Path = Find-ProjectV8Path +} +if (-not $V8Path) { + $found = Get-ChildItem @("C:\Program Files\1cv8\*\bin\1cv8.exe", "C:\Program Files (x86)\1cv8\*\bin\1cv8.exe") -ErrorAction SilentlyContinue | + Sort-Object { try { [version]$_.Directory.Parent.Name } catch { [version]"0.0" } } -Descending | + Select-Object -First 1 if ($found) { $V8Path = $found.FullName + Write-Host "Auto-selected platform $($found.Directory.Parent.Name): $V8Path" -ForegroundColor Yellow } else { Write-Host "Error: 1cv8.exe not found. Specify -V8Path" -ForegroundColor Red exit 1 } -} elseif (Test-Path $V8Path -PathType Container) { +} +if (Test-Path $V8Path -PathType Container) { $V8Path = Join-Path $V8Path "1cv8.exe" } diff --git a/.claude/skills/db-load-dt/scripts/db-load-dt.py b/.claude/skills/db-load-dt/scripts/db-load-dt.py index e7ec0b74..2c5ff391 100644 --- a/.claude/skills/db-load-dt/scripts/db-load-dt.py +++ b/.claude/skills/db-load-dt/scripts/db-load-dt.py @@ -1,29 +1,64 @@ #!/usr/bin/env python3 -# db-load-dt v1.0 — Load 1C information base from DT file +# db-load-dt v1.1 — Load 1C information base from DT file # Source: https://github.com/Nikolay-Shirokov/cc-1c-skills import argparse import glob +import json import os import random +import re import shutil import subprocess import sys import tempfile +def _find_project_v8path(): + """Walk up from CWD to find .v8-project.json and read its v8path.""" + d = os.getcwd() + while True: + pf = os.path.join(d, ".v8-project.json") + if os.path.isfile(pf): + try: + with open(pf, encoding="utf-8-sig") as f: + data = json.load(f) + v = data.get("v8path") + if v: + return v + except Exception: + pass + return None + parent = os.path.dirname(d) + if parent == d: + return None + d = parent + + +def _version_key(p): + """Numeric sort key from version dir name (.../1cv8//bin/1cv8.exe).""" + ver = os.path.basename(os.path.dirname(os.path.dirname(p))) + return [int(x) for x in re.findall(r"\d+", ver)] + + def resolve_v8path(v8path): """Resolve path to 1cv8.exe.""" if not v8path: - found = sorted(glob.glob(r"C:\Program Files\1cv8\*\bin\1cv8.exe")) - if found: - return found[-1] + v8path = _find_project_v8path() + if not v8path: + candidates = ( + glob.glob(r"C:\Program Files\1cv8\*\bin\1cv8.exe") + + glob.glob(r"C:\Program Files (x86)\1cv8\*\bin\1cv8.exe") + ) + if candidates: + v8path = max(candidates, key=_version_key) + ver = os.path.basename(os.path.dirname(os.path.dirname(v8path))) + print(f"Auto-selected platform {ver}: {v8path}") else: print("Error: 1cv8.exe not found. Specify -V8Path", file=sys.stderr) sys.exit(1) - elif os.path.isdir(v8path): + if os.path.isdir(v8path): v8path = os.path.join(v8path, "1cv8.exe") - if not os.path.isfile(v8path): print(f"Error: 1cv8.exe not found at {v8path}", file=sys.stderr) sys.exit(1) diff --git a/.claude/skills/db-load-git/scripts/db-load-git.ps1 b/.claude/skills/db-load-git/scripts/db-load-git.ps1 index 724aa228..96767f23 100644 --- a/.claude/skills/db-load-git/scripts/db-load-git.ps1 +++ b/.claude/skills/db-load-git/scripts/db-load-git.ps1 @@ -1,4 +1,4 @@ -# db-load-git v1.4 — Load Git changes into 1C database +# db-load-git v1.5 — Load Git changes into 1C database # Source: https://github.com/Nikolay-Shirokov/cc-1c-skills <# .SYNOPSIS @@ -120,15 +120,40 @@ function Get-ObjectXmlFromSubFile { # --- Resolve V8Path (skip if DryRun) --- if (-not $DryRun) { + function Find-ProjectV8Path { + $dir = (Get-Location).Path + while ($dir) { + $pf = Join-Path $dir ".v8-project.json" + if (Test-Path $pf) { + try { + $j = Get-Content $pf -Raw -Encoding UTF8 | ConvertFrom-Json + if ($j.v8path) { return [string]$j.v8path } + } catch {} + return $null + } + $parent = Split-Path $dir -Parent + if (-not $parent -or $parent -eq $dir) { break } + $dir = $parent + } + return $null + } + if (-not $V8Path) { - $found = Get-ChildItem "C:\Program Files\1cv8\*\bin\1cv8.exe" -ErrorAction SilentlyContinue | Sort-Object FullName -Descending | Select-Object -First 1 + $V8Path = Find-ProjectV8Path + } + if (-not $V8Path) { + $found = Get-ChildItem @("C:\Program Files\1cv8\*\bin\1cv8.exe", "C:\Program Files (x86)\1cv8\*\bin\1cv8.exe") -ErrorAction SilentlyContinue | + Sort-Object { try { [version]$_.Directory.Parent.Name } catch { [version]"0.0" } } -Descending | + Select-Object -First 1 if ($found) { $V8Path = $found.FullName + Write-Host "Auto-selected platform $($found.Directory.Parent.Name): $V8Path" -ForegroundColor Yellow } else { Write-Host "Error: 1cv8.exe not found. Specify -V8Path" -ForegroundColor Red exit 1 } - } elseif (Test-Path $V8Path -PathType Container) { + } + if (Test-Path $V8Path -PathType Container) { $V8Path = Join-Path $V8Path "1cv8.exe" } diff --git a/.claude/skills/db-load-git/scripts/db-load-git.py b/.claude/skills/db-load-git/scripts/db-load-git.py index d741e3ae..c51444e9 100644 --- a/.claude/skills/db-load-git/scripts/db-load-git.py +++ b/.claude/skills/db-load-git/scripts/db-load-git.py @@ -1,9 +1,10 @@ #!/usr/bin/env python3 -# db-load-git v1.4 — Load Git changes into 1C database +# db-load-git v1.5 — Load Git changes into 1C database # Source: https://github.com/Nikolay-Shirokov/cc-1c-skills import argparse import glob +import json import os import random import re @@ -13,23 +14,54 @@ import sys import tempfile +def _find_project_v8path(): + """Walk up from CWD to find .v8-project.json and read its v8path.""" + d = os.getcwd() + while True: + pf = os.path.join(d, ".v8-project.json") + if os.path.isfile(pf): + try: + with open(pf, encoding="utf-8-sig") as f: + data = json.load(f) + v = data.get("v8path") + if v: + return v + except Exception: + pass + return None + parent = os.path.dirname(d) + if parent == d: + return None + d = parent + + +def _version_key(p): + """Numeric sort key from version dir name (.../1cv8//bin/1cv8.exe).""" + ver = os.path.basename(os.path.dirname(os.path.dirname(p))) + return [int(x) for x in re.findall(r"\d+", ver)] + + def resolve_v8path(v8path): """Resolve path to 1cv8.exe.""" if not v8path: - candidates = glob.glob(r"C:\Program Files\1cv8\*\bin\1cv8.exe") + v8path = _find_project_v8path() + if not v8path: + candidates = ( + glob.glob(r"C:\Program Files\1cv8\*\bin\1cv8.exe") + + glob.glob(r"C:\Program Files (x86)\1cv8\*\bin\1cv8.exe") + ) if candidates: - candidates.sort() - return candidates[-1] + v8path = max(candidates, key=_version_key) + ver = os.path.basename(os.path.dirname(os.path.dirname(v8path))) + print(f"Auto-selected platform {ver}: {v8path}") else: print("Error: 1cv8.exe not found. Specify -V8Path", file=sys.stderr) sys.exit(1) - elif os.path.isdir(v8path): + if os.path.isdir(v8path): v8path = os.path.join(v8path, "1cv8.exe") - if not os.path.isfile(v8path): print(f"Error: 1cv8.exe not found at {v8path}", file=sys.stderr) sys.exit(1) - return v8path diff --git a/.claude/skills/db-load-xml/scripts/db-load-xml.ps1 b/.claude/skills/db-load-xml/scripts/db-load-xml.ps1 index c8e46e13..c79945f2 100644 --- a/.claude/skills/db-load-xml/scripts/db-load-xml.ps1 +++ b/.claude/skills/db-load-xml/scripts/db-load-xml.ps1 @@ -1,4 +1,4 @@ -# db-load-xml v1.4 — Load 1C configuration from XML files +# db-load-xml v1.5 — Load 1C configuration from XML files # Source: https://github.com/Nikolay-Shirokov/cc-1c-skills <# .SYNOPSIS @@ -108,15 +108,40 @@ $OutputEncoding = [System.Text.Encoding]::UTF8 [Console]::OutputEncoding = [System.Text.Encoding]::UTF8 # --- Resolve V8Path --- +function Find-ProjectV8Path { + $dir = (Get-Location).Path + while ($dir) { + $pf = Join-Path $dir ".v8-project.json" + if (Test-Path $pf) { + try { + $j = Get-Content $pf -Raw -Encoding UTF8 | ConvertFrom-Json + if ($j.v8path) { return [string]$j.v8path } + } catch {} + return $null + } + $parent = Split-Path $dir -Parent + if (-not $parent -or $parent -eq $dir) { break } + $dir = $parent + } + return $null +} + if (-not $V8Path) { - $found = Get-ChildItem "C:\Program Files\1cv8\*\bin\1cv8.exe" -ErrorAction SilentlyContinue | Sort-Object FullName -Descending | Select-Object -First 1 + $V8Path = Find-ProjectV8Path +} +if (-not $V8Path) { + $found = Get-ChildItem @("C:\Program Files\1cv8\*\bin\1cv8.exe", "C:\Program Files (x86)\1cv8\*\bin\1cv8.exe") -ErrorAction SilentlyContinue | + Sort-Object { try { [version]$_.Directory.Parent.Name } catch { [version]"0.0" } } -Descending | + Select-Object -First 1 if ($found) { $V8Path = $found.FullName + Write-Host "Auto-selected platform $($found.Directory.Parent.Name): $V8Path" -ForegroundColor Yellow } else { Write-Host "Error: 1cv8.exe not found. Specify -V8Path" -ForegroundColor Red exit 1 } -} elseif (Test-Path $V8Path -PathType Container) { +} +if (Test-Path $V8Path -PathType Container) { $V8Path = Join-Path $V8Path "1cv8.exe" } diff --git a/.claude/skills/db-load-xml/scripts/db-load-xml.py b/.claude/skills/db-load-xml/scripts/db-load-xml.py index 432a1cb3..dca6a724 100644 --- a/.claude/skills/db-load-xml/scripts/db-load-xml.py +++ b/.claude/skills/db-load-xml/scripts/db-load-xml.py @@ -1,9 +1,10 @@ #!/usr/bin/env python3 -# db-load-xml v1.4 — Load 1C configuration from XML files +# db-load-xml v1.5 — Load 1C configuration from XML files # Source: https://github.com/Nikolay-Shirokov/cc-1c-skills import argparse import glob +import json import os import random import re @@ -13,23 +14,54 @@ import sys import tempfile +def _find_project_v8path(): + """Walk up from CWD to find .v8-project.json and read its v8path.""" + d = os.getcwd() + while True: + pf = os.path.join(d, ".v8-project.json") + if os.path.isfile(pf): + try: + with open(pf, encoding="utf-8-sig") as f: + data = json.load(f) + v = data.get("v8path") + if v: + return v + except Exception: + pass + return None + parent = os.path.dirname(d) + if parent == d: + return None + d = parent + + +def _version_key(p): + """Numeric sort key from version dir name (.../1cv8//bin/1cv8.exe).""" + ver = os.path.basename(os.path.dirname(os.path.dirname(p))) + return [int(x) for x in re.findall(r"\d+", ver)] + + def resolve_v8path(v8path): """Resolve path to 1cv8.exe.""" if not v8path: - candidates = glob.glob(r"C:\Program Files\1cv8\*\bin\1cv8.exe") + v8path = _find_project_v8path() + if not v8path: + candidates = ( + glob.glob(r"C:\Program Files\1cv8\*\bin\1cv8.exe") + + glob.glob(r"C:\Program Files (x86)\1cv8\*\bin\1cv8.exe") + ) if candidates: - candidates.sort() - return candidates[-1] + v8path = max(candidates, key=_version_key) + ver = os.path.basename(os.path.dirname(os.path.dirname(v8path))) + print(f"Auto-selected platform {ver}: {v8path}") else: print("Error: 1cv8.exe not found. Specify -V8Path", file=sys.stderr) sys.exit(1) - elif os.path.isdir(v8path): + if os.path.isdir(v8path): v8path = os.path.join(v8path, "1cv8.exe") - if not os.path.isfile(v8path): print(f"Error: 1cv8.exe not found at {v8path}", file=sys.stderr) sys.exit(1) - return v8path diff --git a/.claude/skills/db-run/scripts/db-run.ps1 b/.claude/skills/db-run/scripts/db-run.ps1 index 946291e0..dfb9a95b 100644 --- a/.claude/skills/db-run/scripts/db-run.ps1 +++ b/.claude/skills/db-run/scripts/db-run.ps1 @@ -1,4 +1,4 @@ -# db-run v1.0 — Launch 1C:Enterprise +# db-run v1.1 — Launch 1C:Enterprise # Source: https://github.com/Nikolay-Shirokov/cc-1c-skills <# .SYNOPSIS @@ -79,15 +79,40 @@ $OutputEncoding = [System.Text.Encoding]::UTF8 [Console]::OutputEncoding = [System.Text.Encoding]::UTF8 # --- Resolve V8Path --- +function Find-ProjectV8Path { + $dir = (Get-Location).Path + while ($dir) { + $pf = Join-Path $dir ".v8-project.json" + if (Test-Path $pf) { + try { + $j = Get-Content $pf -Raw -Encoding UTF8 | ConvertFrom-Json + if ($j.v8path) { return [string]$j.v8path } + } catch {} + return $null + } + $parent = Split-Path $dir -Parent + if (-not $parent -or $parent -eq $dir) { break } + $dir = $parent + } + return $null +} + if (-not $V8Path) { - $found = Get-ChildItem "C:\Program Files\1cv8\*\bin\1cv8.exe" -ErrorAction SilentlyContinue | Sort-Object FullName -Descending | Select-Object -First 1 + $V8Path = Find-ProjectV8Path +} +if (-not $V8Path) { + $found = Get-ChildItem @("C:\Program Files\1cv8\*\bin\1cv8.exe", "C:\Program Files (x86)\1cv8\*\bin\1cv8.exe") -ErrorAction SilentlyContinue | + Sort-Object { try { [version]$_.Directory.Parent.Name } catch { [version]"0.0" } } -Descending | + Select-Object -First 1 if ($found) { $V8Path = $found.FullName + Write-Host "Auto-selected platform $($found.Directory.Parent.Name): $V8Path" -ForegroundColor Yellow } else { Write-Host "Error: 1cv8.exe not found. Specify -V8Path" -ForegroundColor Red exit 1 } -} elseif (Test-Path $V8Path -PathType Container) { +} +if (Test-Path $V8Path -PathType Container) { $V8Path = Join-Path $V8Path "1cv8.exe" } diff --git a/.claude/skills/db-run/scripts/db-run.py b/.claude/skills/db-run/scripts/db-run.py index b19807a8..fda5bc11 100644 --- a/.claude/skills/db-run/scripts/db-run.py +++ b/.claude/skills/db-run/scripts/db-run.py @@ -1,26 +1,61 @@ #!/usr/bin/env python3 -# db-run v1.0 — Launch 1C:Enterprise +# db-run v1.1 — Launch 1C:Enterprise # Source: https://github.com/Nikolay-Shirokov/cc-1c-skills import argparse import glob +import json import os +import re import subprocess import sys +def _find_project_v8path(): + """Walk up from CWD to find .v8-project.json and read its v8path.""" + d = os.getcwd() + while True: + pf = os.path.join(d, ".v8-project.json") + if os.path.isfile(pf): + try: + with open(pf, encoding="utf-8-sig") as f: + data = json.load(f) + v = data.get("v8path") + if v: + return v + except Exception: + pass + return None + parent = os.path.dirname(d) + if parent == d: + return None + d = parent + + +def _version_key(p): + """Numeric sort key from version dir name (.../1cv8//bin/1cv8.exe).""" + ver = os.path.basename(os.path.dirname(os.path.dirname(p))) + return [int(x) for x in re.findall(r"\d+", ver)] + + def resolve_v8path(v8path): """Resolve path to 1cv8.exe.""" if not v8path: - found = sorted(glob.glob(r"C:\Program Files\1cv8\*\bin\1cv8.exe")) - if found: - return found[-1] + v8path = _find_project_v8path() + if not v8path: + candidates = ( + glob.glob(r"C:\Program Files\1cv8\*\bin\1cv8.exe") + + glob.glob(r"C:\Program Files (x86)\1cv8\*\bin\1cv8.exe") + ) + if candidates: + v8path = max(candidates, key=_version_key) + ver = os.path.basename(os.path.dirname(os.path.dirname(v8path))) + print(f"Auto-selected platform {ver}: {v8path}") else: print("Error: 1cv8.exe not found. Specify -V8Path", file=sys.stderr) sys.exit(1) - elif os.path.isdir(v8path): + if os.path.isdir(v8path): v8path = os.path.join(v8path, "1cv8.exe") - if not os.path.isfile(v8path): print(f"Error: 1cv8.exe not found at {v8path}", file=sys.stderr) sys.exit(1) diff --git a/.claude/skills/db-update/scripts/db-update.ps1 b/.claude/skills/db-update/scripts/db-update.ps1 index fb83b73f..3279a33b 100644 --- a/.claude/skills/db-update/scripts/db-update.ps1 +++ b/.claude/skills/db-update/scripts/db-update.ps1 @@ -1,4 +1,4 @@ -# db-update v1.0 — Update 1C database configuration +# db-update v1.1 — Update 1C database configuration # Source: https://github.com/Nikolay-Shirokov/cc-1c-skills <# .SYNOPSIS @@ -89,15 +89,40 @@ $OutputEncoding = [System.Text.Encoding]::UTF8 [Console]::OutputEncoding = [System.Text.Encoding]::UTF8 # --- Resolve V8Path --- +function Find-ProjectV8Path { + $dir = (Get-Location).Path + while ($dir) { + $pf = Join-Path $dir ".v8-project.json" + if (Test-Path $pf) { + try { + $j = Get-Content $pf -Raw -Encoding UTF8 | ConvertFrom-Json + if ($j.v8path) { return [string]$j.v8path } + } catch {} + return $null + } + $parent = Split-Path $dir -Parent + if (-not $parent -or $parent -eq $dir) { break } + $dir = $parent + } + return $null +} + if (-not $V8Path) { - $found = Get-ChildItem "C:\Program Files\1cv8\*\bin\1cv8.exe" -ErrorAction SilentlyContinue | Sort-Object FullName -Descending | Select-Object -First 1 + $V8Path = Find-ProjectV8Path +} +if (-not $V8Path) { + $found = Get-ChildItem @("C:\Program Files\1cv8\*\bin\1cv8.exe", "C:\Program Files (x86)\1cv8\*\bin\1cv8.exe") -ErrorAction SilentlyContinue | + Sort-Object { try { [version]$_.Directory.Parent.Name } catch { [version]"0.0" } } -Descending | + Select-Object -First 1 if ($found) { $V8Path = $found.FullName + Write-Host "Auto-selected platform $($found.Directory.Parent.Name): $V8Path" -ForegroundColor Yellow } else { Write-Host "Error: 1cv8.exe not found. Specify -V8Path" -ForegroundColor Red exit 1 } -} elseif (Test-Path $V8Path -PathType Container) { +} +if (Test-Path $V8Path -PathType Container) { $V8Path = Join-Path $V8Path "1cv8.exe" } diff --git a/.claude/skills/db-update/scripts/db-update.py b/.claude/skills/db-update/scripts/db-update.py index c6257d6c..3e66dad6 100644 --- a/.claude/skills/db-update/scripts/db-update.py +++ b/.claude/skills/db-update/scripts/db-update.py @@ -1,29 +1,64 @@ #!/usr/bin/env python3 -# db-update v1.0 — Update 1C database configuration +# db-update v1.1 — Update 1C database configuration # Source: https://github.com/Nikolay-Shirokov/cc-1c-skills import argparse import glob +import json import os import random +import re import shutil import subprocess import sys import tempfile +def _find_project_v8path(): + """Walk up from CWD to find .v8-project.json and read its v8path.""" + d = os.getcwd() + while True: + pf = os.path.join(d, ".v8-project.json") + if os.path.isfile(pf): + try: + with open(pf, encoding="utf-8-sig") as f: + data = json.load(f) + v = data.get("v8path") + if v: + return v + except Exception: + pass + return None + parent = os.path.dirname(d) + if parent == d: + return None + d = parent + + +def _version_key(p): + """Numeric sort key from version dir name (.../1cv8//bin/1cv8.exe).""" + ver = os.path.basename(os.path.dirname(os.path.dirname(p))) + return [int(x) for x in re.findall(r"\d+", ver)] + + def resolve_v8path(v8path): """Resolve path to 1cv8.exe.""" if not v8path: - found = sorted(glob.glob(r"C:\Program Files\1cv8\*\bin\1cv8.exe")) - if found: - return found[-1] + v8path = _find_project_v8path() + if not v8path: + candidates = ( + glob.glob(r"C:\Program Files\1cv8\*\bin\1cv8.exe") + + glob.glob(r"C:\Program Files (x86)\1cv8\*\bin\1cv8.exe") + ) + if candidates: + v8path = max(candidates, key=_version_key) + ver = os.path.basename(os.path.dirname(os.path.dirname(v8path))) + print(f"Auto-selected platform {ver}: {v8path}") else: print("Error: 1cv8.exe not found. Specify -V8Path", file=sys.stderr) sys.exit(1) - elif os.path.isdir(v8path): + if os.path.isdir(v8path): v8path = os.path.join(v8path, "1cv8.exe") - if not os.path.isfile(v8path): print(f"Error: 1cv8.exe not found at {v8path}", file=sys.stderr) sys.exit(1)