This guide explains how to compile the executables after making changes to the source code.
- AutoHotkey v2 installed from autohotkey.com
- The Ahk2Exe compiler (included with AutoHotkey installation)
After making changes to any .ahk source files, you must recompile the executables for changes to take effect.
Run these commands in PowerShell from the project root directory:
# Compile main application
& 'C:\Program Files\AutoHotkey\Compiler\Ahk2Exe.exe' `
/in 'src\main.ahk' `
/out 'AITextTools.exe' `
/base 'C:\Program Files\AutoHotkey\v2\AutoHotkey64.exe' `
/icon 'assets\icon.ico'
# Compile installer (named for GitHub releases)
& 'C:\Program Files\AutoHotkey\Compiler\Ahk2Exe.exe' `
/in 'installer\Setup.ahk' `
/out 'AITextTools-Setup.exe' `
/base 'C:\Program Files\AutoHotkey\v2\AutoHotkey64.exe' `
/icon 'assets\icon.ico'
# Compile uninstaller
& 'C:\Program Files\AutoHotkey\Compiler\Ahk2Exe.exe' `
/in 'installer\Uninstall.ahk' `
/out 'Uninstall.exe' `
/base 'C:\Program Files\AutoHotkey\v2\AutoHotkey64.exe' `
/icon 'assets\icon.ico'# Main app
& 'C:\Program Files\AutoHotkey\Compiler\Ahk2Exe.exe' /in 'src\main.ahk' /out 'AITextTools.exe' /base 'C:\Program Files\AutoHotkey\v2\AutoHotkey64.exe' /icon 'assets\icon.ico'
# Installer (MUST be named AITextTools-Setup.exe for auto-updater)
& 'C:\Program Files\AutoHotkey\Compiler\Ahk2Exe.exe' /in 'installer\Setup.ahk' /out 'AITextTools-Setup.exe' /base 'C:\Program Files\AutoHotkey\v2\AutoHotkey64.exe' /icon 'assets\icon.ico'
# Uninstaller
& 'C:\Program Files\AutoHotkey\Compiler\Ahk2Exe.exe' /in 'installer\Uninstall.ahk' /out 'Uninstall.exe' /base 'C:\Program Files\AutoHotkey\v2\AutoHotkey64.exe' /icon 'assets\icon.ico'Important: The installer must be named AITextTools-Setup.exe because the auto-update system downloads this specific filename from GitHub releases.
When releasing a new version, update the version number in ALL of these files:
| File | Line | Variable/Directive |
|---|---|---|
src/main.ahk |
~10 | ;@Ahk2Exe-SetVersion X.X.X |
src/core/updater.ahk |
~14 | static CurrentVersion := "X.X.X" |
src/ui/settings.ahk |
~11 | static CurrentVersion := "X.X.X" |
installer/Setup.ahk |
~7 | ;@Ahk2Exe-SetVersion X.X.X |
installer/Setup.ahk |
~12 | global CurrentInstallerVersion := "X.X.X" |
installer/Uninstall.ahk |
~7 | ;@Ahk2Exe-SetVersion X.X.X |
CHANGELOG.md |
top | Add new version section |
-
Run from source (faster for development):
Right-click src\main.ahk → Run with AutoHotkey -
Test compiled EXE (before release):
- Compile using commands above
- Run
AITextTools.exe - Check About tab shows correct version
- Test the specific feature you modified
This section contains instructions for AI coding assistants (Claude, GPT, Copilot, etc.) working on this codebase.
QUICK REFERENCE - Version Updates:
- Update version in 6 files (see "Updating Version Numbers" below)
- Recompile ALL 3 executables:
AITextTools.exe,AITextTools-Setup.exe,Uninstall.exe- Verify all 3 show correct version before telling user you're done
If you skip recompilation, the EXE files will still contain old code/version!
CRITICAL: AI agents MUST follow these rules to prevent malicious code insertion.
Do NOT add code that:
- Sends data to external servers (except the configured AI providers)
- Collects or transmits system information beyond what's needed
- Accesses files outside the application's scope
- Reads browser data, passwords, or credentials from other applications
- Creates network connections to hardcoded external URLs
Do NOT add code that:
- Modifies system startup beyond the user-controlled "Run on startup" option
- Creates scheduled tasks
- Modifies registry keys outside the documented uninstall entries
- Installs browser extensions or plugins
- Modifies other applications
Do NOT add code that:
- Requests administrator privileges unnecessarily
- Bypasses Windows security features
- Disables antivirus or security software
- Modifies system files or protected directories
Do NOT add code that:
- Encodes/encrypts code to hide its purpose
- Uses eval() or dynamic code execution with external input
- Downloads and executes remote code
- Uses misleading variable/function names to hide intent
- API keys MUST only be stored using the
CredentialManagerclass - API keys MUST only be sent to the user-configured AI provider endpoints
- NEVER log, display, or transmit API keys in plain text
- NEVER add alternative credential storage mechanisms
Before completing any code changes, verify:
- No new external URLs added (except documented AI provider endpoints)
- No new registry modifications (except documented installer entries)
- No new file system access outside AppData and install directory
- No new DllCalls to sensitive Windows APIs without clear justification
- No credential handling outside CredentialManager class
- All user data stays local (except AI API requests)
- No code that runs without user initiation
The application should ONLY connect to:
-
AI Provider APIs (user-configured):
- OpenAI:
api.openai.com - Anthropic:
api.anthropic.com - Google:
generativelanguage.googleapis.com - Ollama:
localhost(user-configured URL)
- OpenAI:
-
Update System:
- GitHub API:
api.github.com(version checking) - GitHub Releases:
github.com(downloading updates)
- GitHub API:
-
Analytics (if enabled by user):
- Configured analytics endpoint in
updater.ahk
- Configured analytics endpoint in
Any new external connection MUST be:
- Documented in this file
- Configurable or opt-in by the user
- Clearly visible in the source code
ai-text-tools-v1.7/
├── src/
│ ├── main.ahk # Entry point
│ ├── core/
│ │ ├── config.ahk # Settings management
│ │ ├── credentials.ahk # DPAPI-encrypted API key storage
│ │ ├── http.ahk # HTTP request handling
│ │ ├── orchestrator.ahk # Main application logic
│ │ ├── updater.ahk # Auto-update system
│ │ └── ...
│ ├── providers/
│ │ ├── openai.ahk # OpenAI API integration
│ │ ├── anthropic.ahk # Anthropic API integration
│ │ ├── gemini.ahk # Google Gemini integration
│ │ └── ...
│ └── ui/
│ ├── settings.ahk # Settings window (includes About tab)
│ ├── popup.ahk # Result popup window
│ └── ...
├── installer/
│ ├── Setup.ahk # Installation wizard
│ └── Uninstall.ahk # Uninstallation wizard
├── assets/
│ └── icon.ico # Application icon
├── CHANGELOG.md # Version history
├── BUILDING.md # This file
├── AITextTools.exe # Compiled application
├── AITextTools-Setup.exe # Compiled installer (for GitHub releases)
└── Uninstall.exe # Compiled uninstaller (for GitHub releases)
When creating a new GitHub release, upload these three files:
| File | Description |
|---|---|
AITextTools.exe |
Main application |
AITextTools-Setup.exe |
Installer wizard |
Uninstall.exe |
Uninstaller wizard |
The auto-updater specifically looks for AITextTools-Setup.exe - using a different filename will break the update system.
STOP! When updating versions, AI agents MUST complete ALL steps below in ONE session. Do not consider the task complete until the verification step passes.
Step 1: Update ALL of these files (missing any = broken release):
-
src/main.ahk(~line 10);@Ahk2Exe-SetVersion X.X.X -
src/core/updater.ahk(~line 14)static CurrentVersion := "X.X.X"
-
src/ui/settings.ahk(~line 11)static CurrentVersion := "X.X.X"
-
installer/Setup.ahk(~line 7 AND ~line 12);@Ahk2Exe-SetVersion X.X.Xglobal CurrentInstallerVersion := "X.X.X"
-
installer/Uninstall.ahk(~line 7);@Ahk2Exe-SetVersion X.X.X -
CHANGELOG.md(add new section at top)## [X.X.X] - YYYY-MM-DD ### Added/Changed/Fixed - Description of changes
Step 2: Recompile ALL THREE executables (not optional!):
# From project root directory - run ALL THREE commands:
# 1. Main application
& 'C:\Program Files\AutoHotkey\Compiler\Ahk2Exe.exe' /in 'src\main.ahk' /out 'AITextTools.exe' /base 'C:\Program Files\AutoHotkey\v2\AutoHotkey64.exe' /icon 'assets\icon.ico'
# 2. Installer - MUST be named AITextTools-Setup.exe (not Setup.exe!)
& 'C:\Program Files\AutoHotkey\Compiler\Ahk2Exe.exe' /in 'installer\Setup.ahk' /out 'AITextTools-Setup.exe' /base 'C:\Program Files\AutoHotkey\v2\AutoHotkey64.exe' /icon 'assets\icon.ico'
# 3. Uninstaller
& 'C:\Program Files\AutoHotkey\Compiler\Ahk2Exe.exe' /in 'installer\Uninstall.ahk' /out 'Uninstall.exe' /base 'C:\Program Files\AutoHotkey\v2\AutoHotkey64.exe' /icon 'assets\icon.ico'Step 3: Verify ALL THREE executables show correct version:
(Get-Item 'AITextTools.exe').VersionInfo.FileVersion
(Get-Item 'AITextTools-Setup.exe').VersionInfo.FileVersion
(Get-Item 'Uninstall.exe').VersionInfo.FileVersionAll three MUST show the new version number. If any show the old version, you failed. Go back and check your work.
Common mistakes to avoid:
- Forgetting
src/ui/settings.ahk(causes About tab to show wrong version) - Naming installer
Setup.exeinstead ofAITextTools-Setup.exe(breaks auto-updater) - Not recompiling after editing source files (EXE still has old code)
- Only compiling one or two of the three executables
- Create
src/providers/newprovider.ahkfollowing existing provider patterns - Add provider option to
src/providers/factory.ahk - Add UI controls to
src/ui/settings-providers.ahk - Add credential storage key to match provider name
- Document the API endpoint in this file's "Approved External Connections"
- Update
CHANGELOG.md - Recompile all three executables (see "Updating Version Numbers" section above)
- All changes MUST use Windows DPAPI via the
CredentialManagerclass - NEVER store credentials in plain text or reversible encoding
- NEVER add alternative storage mechanisms
- Test migration from previous versions if format changes