SkyveilSync
===========

SkyveilSync is optional. It copies each Skyveil debug report (/sv debug,
then Save and reload, or the one saved at logout) from Skyveil's
SavedVariables file into a folder named "Skyveil Reports", one .txt file per
report.

What it does and does not do:
- It only reads WTF\Account\<account>\SavedVariables\Skyveil.lua (Skyveil)
  and SkyveilRetail.lua (Skyveil Retail), in each game folder it finds under
  your WoW folder (for example _classic_ or _retail_). It never writes to
  those files or to anything else in your WoW folder.
- A sync makes no network calls and opens no socket. It holds no passwords
  or keys. It needs nothing installed beyond what your computer already has.
- Each report is written once. The file name is the report's first line
  (SKYVEIL DEBUG v<version> <date and time>) and a short content hash. A
  report already copied is not copied again, even if you delete its file.
- Skyveil Retail's reports come from
  _retail_\WTF\Account\<account>\SavedVariables\SkyveilRetail.lua and go
  into the same "Skyveil Reports" folder; their file names start with
  "Retail ", so they never share a name with a Skyveil report.
- A report that was still being written when it was read is skipped and
  picked up on the next check.
- After a check that copied new reports, the newest Skyveil report is also
  copied to SKYVEIL_LATEST.txt and the newest Skyveil Retail report to
  SKYVEIL_LATEST_RETAIL.txt (newest by the date and time in the first line).
  Each is written to a .tmp file first and then renamed, so Drive never
  uploads half a file. Open SKYVEIL_LATEST.txt for the report you just made.

Run it (it checks every 30 seconds until you close the window):
- Windows:  right-click SkyveilSync.ps1, Run with PowerShell. Or:
    powershell -ExecutionPolicy Bypass -File SkyveilSync.ps1
  Options: -WowPath "D:\Games\World of Warcraft"  -OutPath "<folder>"  -Once
  Default output: Documents\Skyveil Reports
- macOS / Linux:  sh skyveil-sync.sh
  Options: --wow "/path/to/World of Warcraft"  --out "<folder>"  --once
  Default output: ~/Documents/Skyveil Reports

Setup (one step):
1. In Google Drive for Desktop, open Preferences, choose "Add folder" under
   My Computer, and add the "Skyveil Reports" folder for backup.
   Drive does the upload of the reports, SKYVEIL_LATEST.txt,
   SKYVEIL_LATEST_RETAIL.txt and SKYVEIL_LATEST_HINT.txt. SkyveilSync itself
   never uploads anything; a sync never connects to anything.

Optional: a hint from a model on your own computer (one-shot)
- Only when you run it with -LocalLlmHint (Windows) or --local-llm-hint
  (macOS / Linux) and a URL. It reads SKYVEIL_LATEST.txt (or
  SKYVEIL_LATEST_RETAIL.txt with -Retail / --retail, or when that one is
  newer), sends only the report's first line, its state line and its Lua
  errors, once, to the model, writes the answer to SKYVEIL_LATEST_HINT.txt
  and exits. It never runs during a sync, and there is no mode that keeps
  sending.
- The URL must be on this computer: http://127.0.0.1, http://localhost or
  http://[::1], an optional port, then /api/generate (Ollama) or
  /v1/chat/completions (llama.cpp). Anything else is refused: another host,
  a user name in the URL, look-alike names such as localhost.example or
  "localhost." with a trailing dot, https or other schemes. Redirects are
  never followed.
    powershell -ExecutionPolicy Bypass -File SkyveilSync.ps1 -LocalLlmHint http://127.0.0.1:11434/api/generate
    sh skyveil-sync.sh --local-llm-hint http://[::1]:8080/v1/chat/completions
  -Model / --model picks the model name (llama3.2 for Ollama by default).
  macOS / Linux need curl for this step.

Every send site in this release, and nothing else: (a) this one-shot hint,
only when you run it; (b) the website help bar's Tier 2 bridge to Ollama or
llama.cpp on your computer, only when you turn it on and press Ask; (c) the
browser's built-in model, only when you turn it on; (d) the addon's /who,
decline, Guild Command and Layers sends described in its README. No cloud
service is called.
