mirror of
https://github.com/Nikolay-Shirokov/cc-1c-skills.git
synced 2026-08-07 20:20:20 +03:00
feat: role-compile OutputDir accepts config root (like meta-compile)
- OutputDir now accepts config root dir — creates Roles/ subdirectory - Back-compat: if OutputDir ends with "Roles", uses it as-is - Configuration.xml lookup adjusted accordingly - Updated SKILL.md, PS1, PY scripts (v1.3) - Updated test cases and snapshots for new Roles/ path Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.6
parent
bc6bc01047
commit
0d116863ec
@@ -1,4 +1,4 @@
|
||||
# role-compile v1.2 — Compile 1C role from JSON
|
||||
# role-compile v1.3 — Compile 1C role from JSON
|
||||
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
|
||||
param(
|
||||
[Parameter(Mandatory)]
|
||||
@@ -615,14 +615,25 @@ $outDir = if ([System.IO.Path]::IsPathRooted($OutputDir)) {
|
||||
Join-Path (Get-Location) $OutputDir
|
||||
}
|
||||
|
||||
# Metadata: OutputDir/RoleName.xml
|
||||
$metadataPath = Join-Path $outDir "$roleName.xml"
|
||||
if (-not (Test-Path $outDir)) {
|
||||
New-Item -ItemType Directory -Path $outDir -Force | Out-Null
|
||||
# Determine Roles dir and config root
|
||||
# Back-compat: if OutputDir leaf is "Roles", use as-is; otherwise treat as config root
|
||||
$leaf = Split-Path $outDir -Leaf
|
||||
if ($leaf -eq "Roles") {
|
||||
$rolesDir = $outDir
|
||||
$configDir = Split-Path $outDir -Parent
|
||||
} else {
|
||||
$rolesDir = Join-Path $outDir "Roles"
|
||||
$configDir = $outDir
|
||||
}
|
||||
|
||||
# Rights: OutputDir/RoleName/Ext/Rights.xml
|
||||
$roleSubDir = Join-Path $outDir $roleName
|
||||
# Metadata: Roles/RoleName.xml
|
||||
$metadataPath = Join-Path $rolesDir "$roleName.xml"
|
||||
if (-not (Test-Path $rolesDir)) {
|
||||
New-Item -ItemType Directory -Path $rolesDir -Force | Out-Null
|
||||
}
|
||||
|
||||
# Rights: Roles/RoleName/Ext/Rights.xml
|
||||
$roleSubDir = Join-Path $rolesDir $roleName
|
||||
$extDir = Join-Path $roleSubDir "Ext"
|
||||
$rightsPath = Join-Path $extDir "Rights.xml"
|
||||
if (-not (Test-Path $extDir)) {
|
||||
@@ -635,7 +646,6 @@ $enc = New-Object System.Text.UTF8Encoding($true)
|
||||
|
||||
# --- 12. Register in Configuration.xml ---
|
||||
|
||||
$configDir = Split-Path $outDir -Parent
|
||||
$configXmlPath = Join-Path $configDir "Configuration.xml"
|
||||
$regResult = $null
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env python3
|
||||
# role-compile v1.2 — Compile 1C role from JSON
|
||||
# role-compile v1.3 — Compile 1C role from JSON
|
||||
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
|
||||
import argparse
|
||||
import json
|
||||
@@ -563,12 +563,22 @@ def main():
|
||||
if not os.path.isabs(out_dir):
|
||||
out_dir = os.path.join(os.getcwd(), out_dir)
|
||||
|
||||
# Metadata: OutputDir/RoleName.xml
|
||||
metadata_path = os.path.join(out_dir, f'{role_name}.xml')
|
||||
os.makedirs(out_dir, exist_ok=True)
|
||||
# Determine Roles dir and config root
|
||||
# Back-compat: if OutputDir leaf is "Roles", use as-is; otherwise treat as config root
|
||||
leaf = os.path.basename(out_dir.rstrip(os.sep).rstrip('/'))
|
||||
if leaf == 'Roles':
|
||||
roles_dir = out_dir
|
||||
config_dir = os.path.dirname(out_dir)
|
||||
else:
|
||||
roles_dir = os.path.join(out_dir, 'Roles')
|
||||
config_dir = out_dir
|
||||
|
||||
# Rights: OutputDir/RoleName/Ext/Rights.xml
|
||||
role_sub_dir = os.path.join(out_dir, role_name)
|
||||
# Metadata: Roles/RoleName.xml
|
||||
metadata_path = os.path.join(roles_dir, f'{role_name}.xml')
|
||||
os.makedirs(roles_dir, exist_ok=True)
|
||||
|
||||
# Rights: Roles/RoleName/Ext/Rights.xml
|
||||
role_sub_dir = os.path.join(roles_dir, role_name)
|
||||
ext_dir = os.path.join(role_sub_dir, 'Ext')
|
||||
rights_path = os.path.join(ext_dir, 'Rights.xml')
|
||||
os.makedirs(ext_dir, exist_ok=True)
|
||||
@@ -577,7 +587,6 @@ def main():
|
||||
write_utf8_bom(rights_path, rights_xml)
|
||||
|
||||
# --- 7. Register in Configuration.xml ---
|
||||
config_dir = os.path.dirname(out_dir)
|
||||
config_xml_path = os.path.join(config_dir, 'Configuration.xml')
|
||||
reg_result = None
|
||||
|
||||
|
||||
Reference in New Issue
Block a user