{
  "master_instruction": "workflow/MASTER-INSTRUCTIONS.md",
  "rule": "MASTER-INSTRUCTIONS.md is the single source of truth. Other workflow files must not contain conflicting rules.",
  "must_read_first": [
    "workflow/MASTER-INSTRUCTIONS.md"
  ],
  "forbidden_parallel_instructions": true,
  "required_rules_covered_by_master": [
    "theme folder structure",
    "shared archive core only",
    "after every change, output an exact upload manifest with local file, server target path from webroot, reason, and required/optional status",
    "when a project is merged into the main archive, text/data corrections must be checked in both <project>/cdv-data-en.js and archive/cdv-data-en.js",
    "project name comes from user, not Piwigo working category names such as TEMP-store",
    "front/back pairing: Vorderseite visible, Rückseite reverse object",
    "single images when no front/back label exists",
    "captionEn must be real English",
    "open_original_rule: high-res browser view, no action.php?download= visible link, no save dialog",
    "count check: no previous IDs lost",
    "vsN-historicbits-clean.zip versioning",
    "homepage updates must preserve the existing index.html and only change the requested part; never rebuild homepage from another template"
  ],
  "open_original_rule": {
    "goal": "Open original must resolve to the highest available image/high-res source, not merely to pageUrl when a high-res target exists.",
    "required_fields": [
      "pageUrl",
      "image",
      "originalImage",
      "openOriginalUrl"
    ],
    "piwigo_openOriginalUrl": "Use a direct high-res image URL when available; otherwise use https://reinhard-krause.de/sammlung/action.php?download=&id=PIWIGO_ID&part=e as the explicit high-res source.",
    "forbidden": "Do not use pageUrl as Open original when openOriginalUrl/originalImage/image high-res exists.",
    "test": "After import, click Open original on a new item and verify it opens the high-res image/source, not a preview and not just the Piwigo page."
  },
  "reverse_logic": {
    "Vorderseite": "visible main record",
    "Rueckseite": "reverse object, not counted as separate visible record",
    "no_label": "single record",
    "conflict": "do not guess; ask user"
  },
  "english_rule": {
    "captionEn": "must be genuine English; no German sentence fragments"
  },
  "theme_folder_forbidden_files": [
    "cdv-app.js",
    "styles.css",
    "map.js",
    "map.css"
  ],
  "versioning": "Always increment versions sequentially. After VS49 comes VS50, then VS51. Never reuse or go back.",
  "never_reuse_old_piwigo_readout": true,
  "stop_ok_rule": {
    "mandatory": true,
    "summary": "Before creating any ZIP for an import, theme folder, merge, or website update, first show the planned steps and the import/pairing/merge checklist. Build the ZIP only after explicit user OK.",
    "required_user_confirmation": "OK, bauen.",
    "zip_before_ok": "forbidden"
  },
  "workflow_required_steps": [
    "read MASTER-INSTRUCTIONS.md",
    "classify task type",
    "show planned steps",
    "mark where user must give OK",
    "for Piwigo: read source fresh and show import/pairing list",
    "for merge: show merge list and changed files",
    "wait for explicit OK",
    "then build ZIP",
    "run structure/check report before final delivery",
    "final response must include exact upload targets and files that do not need re-upload"
  ],
  "upload_manifest_rule": {
    "mandatory": true,
    "format": [
      "local_file",
      "server_target_from_webroot",
      "reason",
      "status_required_or_optional"
    ],
    "server_target_examples": {
      "project_data": "/<project>/cdv-data-en.js",
      "central_archive_data": "/archive/cdv-data-en.js",
      "home_de": "/index.html",
      "home_js": "/app.js",
      "archive_core": "/shared/archive-core/archive-app.js",
      "workflow_master": "/workflow/MASTER-INSTRUCTIONS.md"
    },
    "must_also_state": "which large image/thumb folders do not need to be uploaded again"
  },
  "double_data_store_rule": {
    "mandatory": true,
    "applies_when": "project is already visible through the main archive/database",
    "project_file": "<project>/cdv-data-en.js",
    "central_file": "archive/cdv-data-en.js",
    "fields": [
      "title",
      "titleEn",
      "caption",
      "captionEn",
      "rawCaption",
      "dateLabel",
      "location",
      "author",
      "collections",
      "tags",
      "hidden"
    ],
    "failure_condition": "Fixing only the project file while archive/cdv-data-en.js still contains old text is incomplete."
  },
  "home_update_rule": {
    "mandatory": true,
    "basis": "Use the existing working index.html as the immutable basis. Do not build a new homepage from another template, online view, or project state.",
    "scope": "Only insert, change, or remove the specifically requested homepage section.",
    "do_not_change_without_explicit_request": [
      "Header",
      "Navigation",
      "Hero area",
      "Database button",
      "Timeline",
      "Search",
      "Year image rail",
      "existing intro texts",
      "existing sections",
      "existing tiles/cards",
      "Footer",
      "archive data",
      "project folders",
      "large image folders"
    ],
    "required_input_files": [
      "index.html",
      "index-en.html if present/affected",
      "styles.css if present/needed",
      "app.js if present/needed",
      "app-en.js if present/needed",
      "assets only as needed for homepage"
    ],
    "not_needed_for_home_update": [
      "archive/",
      "shared/",
      "thumbs/",
      "uploads/",
      "large collection folders",
      "database files"
    ],
    "required_steps": [
      "open existing index.html as basis",
      "recognize existing structure",
      "make only requested change",
      "do not create a new homepage structure",
      "do not redesign existing areas",
      "create preview/screenshot when requested",
      "deliver ZIP with only changed files"
    ],
    "result_zip_examples": [
      "index.html",
      "index-en.html",
      "styles.css",
      "assets/new-home-image.jpg",
      "UPLOAD-HINWEIS.txt"
    ],
    "hard_rule": "For homepage changes, never build a new homepage from another template. Preserve the existing homepage and only modify the requested part."
  }
}
