mirror of
https://github.com/Nikolay-Shirokov/cc-1c-skills.git
synced 2026-08-07 12:10:21 +03:00
feat(validate): auto-resolve directory paths, fix SKILL.md placeholders
Scripts now accept directory paths (e.g. Forms/ИмяФормы) and auto-resolve to the target XML file. Silent fallbacks handle missing Ext/ level and descriptor-to-file resolution. SKILL.md: concrete placeholders, unified quotes, auto-resolve notes, role-validate MaxErrors in params. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.6
parent
422e397381
commit
b2a2534b5a
@@ -12,6 +12,27 @@ param(
|
||||
$ErrorActionPreference = "Stop"
|
||||
[Console]::OutputEncoding = [System.Text.Encoding]::UTF8
|
||||
|
||||
# --- Resolve path ---
|
||||
# A: Directory → Ext/Form.xml
|
||||
if (Test-Path $FormPath -PathType Container) {
|
||||
$FormPath = Join-Path (Join-Path $FormPath "Ext") "Form.xml"
|
||||
}
|
||||
# B1: Missing Ext/ (e.g. Forms/Форма/Form.xml → Forms/Форма/Ext/Form.xml)
|
||||
if (-not (Test-Path $FormPath)) {
|
||||
$fn = [System.IO.Path]::GetFileName($FormPath)
|
||||
if ($fn -eq "Form.xml") {
|
||||
$c = Join-Path (Join-Path (Split-Path $FormPath) "Ext") $fn
|
||||
if (Test-Path $c) { $FormPath = $c }
|
||||
}
|
||||
}
|
||||
# B2: Descriptor (Forms/Форма.xml → Forms/Форма/Ext/Form.xml)
|
||||
if (-not (Test-Path $FormPath) -and $FormPath.EndsWith(".xml")) {
|
||||
$stem = [System.IO.Path]::GetFileNameWithoutExtension($FormPath)
|
||||
$dir = Split-Path $FormPath
|
||||
$c = Join-Path (Join-Path (Join-Path $dir $stem) "Ext") "Form.xml"
|
||||
if (Test-Path $c) { $FormPath = $c }
|
||||
}
|
||||
|
||||
# --- Load XML ---
|
||||
|
||||
if (-not (Test-Path $FormPath)) {
|
||||
|
||||
@@ -31,6 +31,27 @@ def main():
|
||||
detailed = args.Detailed
|
||||
max_errors = args.MaxErrors
|
||||
|
||||
if not os.path.isabs(form_path):
|
||||
form_path = os.path.join(os.getcwd(), form_path)
|
||||
|
||||
# A: Directory → Ext/Form.xml
|
||||
if os.path.isdir(form_path):
|
||||
form_path = os.path.join(form_path, 'Ext', 'Form.xml')
|
||||
# B1: Missing Ext/ (e.g. Forms/Форма/Form.xml → Forms/Форма/Ext/Form.xml)
|
||||
if not os.path.exists(form_path):
|
||||
fn = os.path.basename(form_path)
|
||||
if fn == 'Form.xml':
|
||||
c = os.path.join(os.path.dirname(form_path), 'Ext', fn)
|
||||
if os.path.exists(c):
|
||||
form_path = c
|
||||
# B2: Descriptor (Forms/Форма.xml → Forms/Форма/Ext/Form.xml)
|
||||
if not os.path.exists(form_path) and form_path.endswith('.xml'):
|
||||
stem = os.path.splitext(os.path.basename(form_path))[0]
|
||||
parent = os.path.dirname(form_path)
|
||||
c = os.path.join(parent, stem, 'Ext', 'Form.xml')
|
||||
if os.path.exists(c):
|
||||
form_path = c
|
||||
|
||||
if not os.path.isfile(form_path):
|
||||
print(f"File not found: {form_path}", file=sys.stderr)
|
||||
sys.exit(1)
|
||||
|
||||
Reference in New Issue
Block a user