Xialei AutoFix 0.3 — public beta (released 1 December 2026)

For system administrators on Windows (including domain/office networks), macOS and Linux. Describe an issue in plain words ("websites will not load", "printer stuck", "disk full"). AutoFix matches it to a known fix, runs a read-only diagnosis, shows the exact command it would run, and changes nothing until you type YES. After a fix it re-checks the problem. Each step is logged.

SUPPORTED ISSUES
  dns      Websites will not load / DNS errors   flush DNS cache
  network  No internet / cloud connection        Windows: release/renew IP + flush DNS · macOS: renew DHCP on the active interface · Linux: restart NetworkManager networking
  disk     Disk is full / low storage            delete YOUR temp files older than 7 days
  time     Clock is wrong / certificate errors   resync system time
  print    Printer queue is stuck                Windows: restart spooler · macOS/Linux: cancel your queued jobs
  firewall Firewall is off                       turn the firewall on (Linux: firewalld or ufw)

AUTOMATIC INSTALL AND FULL CHECK
When you open a launcher (or run autofix.py with no options), AutoFix:
  1. installs itself to .xialei-autofix/app in your user folder and adds an "autofix" command
     (Windows: %LOCALAPPDATA%\Microsoft\WindowsApps\autofix.cmd · macOS/Linux: ~/.local/bin/autofix)
  2. runs a read-only security check of this computer and its network connection:
     firewall, disk encryption (BitLocker/FileVault/LUKS), system updates, malware protection (Windows),
     User Account Control and old SMBv1 sharing (Windows), Gatekeeper, System Integrity Protection and
     automatic login (Mac), SSH root/password login and password-file protection (Linux),
     ports open to the whole network, open Wi-Fi, secure-connection certificates and proxy
  3. checks DNS, internet connection, disk space and firewall, and offers a fix for each problem (YES each time)
The security report is saved as .xialei-autofix/security-report-<date>.txt. Other findings include advice; AutoFix does not change them.
It checks THIS computer and its connection only. It does not scan other devices on your network.
Run as administrator / with sudo for the most complete results. Installing is skipped under sudo.
  --security-check           security check only
  --install                  install only

REQUIREMENTS
Python 3.8 or newer. No extra packages. Keep the three .py files together.

WINDOWS (including office networks)
Double-click "Start AutoFix.bat". It also works when the kit sits on a network share (\\server\share). For network, time and printer fixes, right-click the .bat and choose "Run as administrator". Corporate proxy settings and the Windows certificate store are used automatically.

MAC
Open "Start AutoFix.command". DNS, network and time fixes need administrator rights: in Terminal run  sudo python3 autofix.py

LINUX
Run  sh start-autofix.sh  (add sudo for DNS and time fixes). The network fix needs NetworkManager (nmcli). Proxy settings come from the https_proxy variable.

REMOTE SAFETY
The network and firewall fixes can interrupt remote connections. AutoFix refuses them inside SSH or Remote Desktop sessions so you do not lock yourself out. Run it at the console.

LINK A CLOUD AI SERVICE (optional)
When a description does not match any keyword, a linked AI service can choose the right fix. It can only pick one of the six fixes above; it never supplies commands. The link is tested before it is saved.
  python3 autofix.py --link-api https://api.openai.com/v1 --model gpt-4o-mini
  (the key is typed hidden, or read from the AUTOFIX_API_KEY variable; any OpenAI-compatible service works, including a local Ollama at http://127.0.0.1:11434/v1)
  python3 autofix.py --status      show the link and proxy
  python3 autofix.py --verify      test the link again
  python3 autofix.py --unlink      remove the link and key
  --offline                        never contact the AI service
Only the description is sent, and only when keywords do not match. The key is stored unencrypted in your user folder (.xialei-autofix/config.json, readable only by you on macOS/Linux). Use a restricted key.

CONNECT AN AI ASSISTANT WITH MCP (optional)
AutoFix can act as an MCP server so an MCP-capable AI assistant (for example Claude Desktop or an IDE agent) can list issues, match requests, run diagnoses and the security check and, if you allow it, apply fixes. Add this to the assistant's MCP configuration:
  { "mcpServers": { "xialei-autofix": { "command": "python3", "args": ["/full/path/to/autofix.py", "--mcp"] } } }
  On Windows use "py" as the command and a path such as "C:\\Tools\\autofix-setup\\autofix.py".
Diagnosis only by default. To let the assistant apply fixes, add "--allow-fixes" to args. Administrator and remote-session checks still apply. The link is recorded in the log when the assistant connects.

USEFUL OPTIONS
  --list                     list supported issues
  --dry-run "disk full"      diagnose only, change nothing
  --issue dns                skip the description step

LOG
.xialei-autofix/autofix-log.txt in your user folder. It records matched issues, diagnoses, commands, exit codes and cloud links (never your key). Nothing is uploaded.

SAFETY
- AutoFix never elevates itself.
- Commands are fixed in the script. Your description, AI replies and MCP requests only choose an issue; they are never executed.
- Review the .py files before running them on machines you administer. Test on one machine first.

LIMITS
Beta. Tested on Linux, including the install, the security check (with simulated firewall and port tools), the cloud link with a stand-in service and an MCP session. The Windows and Mac security checks are written for those systems but have not been run on them. Not yet verified on real Windows or macOS machines, with a real cloud AI provider or with a specific AI assistant. It fixes common causes only; if the re-check still fails, investigate further. Not a background or monitoring service.

中文说明
适用于 Windows（包括公司域网络）、macOS 和 Linux 的系统管理员。用简单的话描述问题，AutoFix 先只读诊断，显示准确命令，输入 YES 后才执行，并在修复后复查。
Windows：双击 "Start AutoFix.bat"，可从网络共享目录运行；网络、时间和打印修复需“以管理员身份运行”。自动使用公司代理和 Windows 证书库。
Mac：打开 "Start AutoFix.command"；DNS、网络和时间修复需 sudo。Linux：运行 sh start-autofix.sh；网络修复需要 NetworkManager。
自动安装与全面检查：打开启动器后，AutoFix 会自动安装到用户目录并添加 autofix 命令，然后只读检查本机安全和网络连接（防火墙、磁盘加密、系统更新、恶意软件防护、账户设置、对外开放的端口、开放 Wi-Fi、安全连接证书和代理），并检查 DNS、网络、磁盘和防火墙问题，每项修复都需输入 YES。报告保存为 .xialei-autofix/security-report-日期.txt。只检查本机，不扫描网络中的其他设备。
远程安全：在 SSH 或远程桌面会话中会拒绝网络和防火墙修复，避免断开连接。
连接云端 AI（可选）：python3 autofix.py --link-api 地址 --model 模型名。保存前会先测试连接。AI 只能从六种修复中选择，不能提供命令。--offline 可完全离线。
MCP（可选）：在 AI 助手的 MCP 配置中添加 autofix.py --mcp。默认只诊断；加上 --allow-fixes 才允许 AI 助手执行修复，管理员权限和远程会话检查仍然有效。
日志保存在用户目录 .xialei-autofix/autofix-log.txt，不记录密钥，不上传数据。测试版，请先在一台电脑上试用。
