refactor(export): שם קובץ טיוטת-הביניים → טיוטה-טענות_הצדדים_{N} (הנחיית חיים)
במקום "טיוטת-ביניים-v{N}.docx" — שם מדבר יותר: "טיוטה-טענות_הצדדים_{N}.docx".
הפורמט הסופי ("טיוטה-v{N}") לא משתנה.
- docx_exporter._draft_naming: (prefix, sep) פר-מצב; interim=("טיוטה-טענות_הצדדים","_"),
final=("טיוטה","-v"). glob/parse משתמשים ב-rsplit(sep,1) — נכון גם כשה-prefix
עצמו מכיל "_".
- app.py _generation_output_ready + frontend pickLatestVersioned: matcher-prefix
מעודכן; regex-הגרסה עוגן-לסוף /[_v](\d+)$/ (ה-"_" שבתוך הprefix לא מבלבל).
- docstrings + legal-ceo.md + הערות מעודכנים לשם החדש. types.ts (auto-gen)
יתעדכן ב-api:types.
שינוי-נתון (שם-קובץ), לא layout — בגדר חריג-שער-העיצוב. tsc+eslint+py_compile
ירוקים. הערה: ייצור-השם רץ ב-MCP המקומי (host) → דורש reload; ה-matchers
בקונטיינר (Coolify).
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -399,8 +399,15 @@ _INTERIM_BLOCK_ORDER = [
|
||||
]
|
||||
|
||||
|
||||
def _draft_filename_prefix(mode: str) -> str:
|
||||
return "טיוטת-ביניים" if mode == "interim" else "טיוטה"
|
||||
def _draft_naming(mode: str) -> tuple[str, str]:
|
||||
"""(filename prefix, version separator) per export mode.
|
||||
|
||||
interim → ``טיוטה-טענות_הצדדים_{N}.docx`` (chair-requested naming);
|
||||
final → ``טיוטה-v{N}.docx``.
|
||||
"""
|
||||
if mode == "interim":
|
||||
return "טיוטה-טענות_הצדדים", "_"
|
||||
return "טיוטה", "-v"
|
||||
|
||||
|
||||
async def export_decision(
|
||||
@@ -485,16 +492,19 @@ async def export_decision(
|
||||
if not output_path:
|
||||
export_dir = config.find_case_dir(case["case_number"]) / "exports"
|
||||
export_dir.mkdir(parents=True, exist_ok=True)
|
||||
prefix = _draft_filename_prefix(mode)
|
||||
existing = sorted(export_dir.glob(f"{prefix}-v*.docx"))
|
||||
prefix, sep = _draft_naming(mode)
|
||||
existing = sorted(export_dir.glob(f"{prefix}{sep}*.docx"))
|
||||
next_ver = 1
|
||||
for p in existing:
|
||||
try:
|
||||
ver = int(p.stem.split("-v")[1])
|
||||
# Version is the trailing integer after the separator. Using
|
||||
# rsplit keeps this correct even when the prefix itself contains
|
||||
# the separator char (e.g. "טיוטה-טענות_הצדדים" with sep="_").
|
||||
ver = int(p.stem.rsplit(sep, 1)[1])
|
||||
next_ver = max(next_ver, ver + 1)
|
||||
except (IndexError, ValueError):
|
||||
pass
|
||||
output_path = str(export_dir / f"{prefix}-v{next_ver}.docx")
|
||||
output_path = str(export_dir / f"{prefix}{sep}{next_ver}.docx")
|
||||
|
||||
# Persist through the storage layer (INV-STG1). Under the filesystem
|
||||
# backend the bytes land at output_path exactly as before; a caller-
|
||||
|
||||
@@ -716,7 +716,7 @@ async def write_interim_draft(case_number: str, instructions: str = "") -> str:
|
||||
async def export_interim_draft(case_number: str, output_path: str = "") -> str:
|
||||
"""ייצוא טיוטת ביניים ל-DOCX — אותו עיצוב של טיוטה רגילה (David, RTL,
|
||||
bookmarks), אבל בסדר חדש: רקע → תכניות+היתרים → טענות → הליכים, ללא
|
||||
דיון/סיכום/חתימות. שם הקובץ: טיוטת-ביניים-v{N}.docx.
|
||||
דיון/סיכום/חתימות. שם הקובץ: טיוטה-טענות_הצדדים_{N}.docx.
|
||||
|
||||
Args:
|
||||
case_number: מספר תיק הערר
|
||||
|
||||
Reference in New Issue
Block a user