Files
legal-ai/scripts/deploy-track-changes.sh
Chaim 726498126d
All checks were successful
Build & Deploy / build-and-deploy (push) Successful in 1m29s
Add Track Changes architecture for draft revisions (CMP + CMPA)
Fixes critical bug in 1033-25: user-uploaded עריכה-*.docx files were
orphaned on disk while exports kept rebuilding from stale DB blocks.

New architecture:
- User-uploaded DOCX becomes the source of truth (cases.active_draft_path)
- System edits via XML surgery with real Word <w:ins>/<w:del> revisions
- User can Accept/Reject each change from within Word

Components:
- docx_reviser.py: XML surgery for Track Changes (15 tests)
- docx_retrofit.py: retroactive bookmark injection with Hebrew marker
  detection + heading heuristic (9 tests)
- docx_exporter.py: emits bookmarks around each of the 12 blocks
- 3 new MCP tools: apply_user_edit, list_bookmarks, revise_draft
- 4 new/updated endpoints: upload (auto-registers active draft),
  /exports/revise, /exports/bookmarks, /exports/{filename}/retrofit,
  /active-draft
- DB migration: cases.active_draft_path column
- UI: correct banner using real v-numbers, "מקור האמת" badge,
  detailed upload toast with bookmarks_added/missing_blocks
- agents: legal-exporter (3 export modes), legal-ceo (stage G for
  revision handling), legal-writer (revision mode)

Multi-tenancy:
- Works for both CMP (1xxx cases) and CMPA (8xxx/9xxx cases)
- New revise-draft skill added to both companies
- deploy-track-changes.sh syncs skills CMP ↔ CMPA
- retrofit_case.py: one-off retrofit of existing files

Tests: 34 passing (15 reviser + 9 retrofit + 4 exporter bookmarks + 6 e2e)

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-16 18:49:30 +00:00

87 lines
2.6 KiB
Bash
Executable File
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/bin/bash
# deploy-track-changes.sh — פריסת ארכיטקטורת Track Changes לשתי חברות (CMP + CMPA)
#
# מה זה עושה:
# 1. מוודא ש-skills קיימים ומסונכרנים בשתי החברות
# 2. git commit + push (אם יש שינויים)
# 3. הודעה להפעלת Coolify deploy
#
# שימוש:
# scripts/deploy-track-changes.sh
set -euo pipefail
REPO_ROOT="$(cd "$(dirname "$0")/.." && pwd)"
CMP_DIR="/home/chaim/.paperclip/instances/default/skills/42a7acd0-30c5-4cbd-ac97-7424f65df294"
CMPA_DIR="/home/chaim/.paperclip/instances/default/skills/8639e837-4c9d-47fa-a76b-95788d651896"
COOLIFY_UUID="gyjo0mtw2c42ej3xxvbz8zio"
echo "▶ שלב 1: סנכרון skills בין CMP ל-CMPA"
SKILLS=(legal-docx attach-precedents review-analysis writer-readiness
appendix-expert-intern bidi-table-rtl revise-draft)
mkdir -p "$CMPA_DIR"
for skill in "${SKILLS[@]}"; do
if [ ! -d "$CMP_DIR/$skill" ]; then
echo " ⚠ skill לא קיים ב-CMP: $skill — דילוג"
continue
fi
if [ -d "$CMPA_DIR/$skill" ]; then
# Update only — don't delete any CMPA-specific files
rsync -av --update "$CMP_DIR/$skill/" "$CMPA_DIR/$skill/" > /dev/null
echo "$skill (עודכן ב-CMPA)"
else
cp -r "$CMP_DIR/$skill" "$CMPA_DIR/$skill"
echo "$skill (הועתק ל-CMPA)"
fi
done
echo ""
echo "▶ שלב 2: בדיקת פיתוח אחרונה"
cd "$REPO_ROOT"
# Run mcp-server tests
if [ -f mcp-server/.venv/bin/pytest ]; then
echo " מריץ pytest..."
(cd mcp-server && .venv/bin/pytest tests/ -q 2>&1 | tail -5) || {
echo " ✗ בדיקות נכשלו — עצירה"
exit 1
}
echo " ✓ כל הבדיקות עברו"
fi
# Run TypeScript check
if [ -d web-ui/node_modules ]; then
echo " מריץ tsc..."
(cd web-ui && npx tsc --noEmit 2>&1 | head -10) || {
echo " ✗ שגיאות TypeScript — עצירה"
exit 1
}
echo " ✓ TypeScript נקי"
fi
echo ""
echo "▶ שלב 3: סטטוס git"
if [ -n "$(git status --porcelain)" ]; then
echo " יש שינויים ב-git — לא מבצע commit אוטומטי (ריצו ידנית)"
git status --short
echo ""
echo " הפקודה להרצה:"
echo " git add -A"
echo " git commit -m \"Add Track Changes support for draft revisions (CMP + CMPA)\""
echo " git push origin main"
else
echo " ✓ אין שינויים לא שמורים"
fi
echo ""
echo "▶ שלב 4: Coolify deploy"
echo " לאחר push, הריצו:"
echo " mcp__coolify__deploy עם UUID=$COOLIFY_UUID"
echo " או דרך UI: https://coolify.nautilus.marcusgroup.org"
echo ""
echo "✓ הסקריפט הסתיים"