Skip to content

Commit 82957bc

Browse files
IamRamgarhiaclaude
andcommitted
Folder cleanup: delete redundant installers, inline first-run setup in AdForge launchers
What users see in the root went from 4 confusing files (install.bat, install.sh, AdForge.bat, AdForge.command) down to 2 obvious ones: AdForge.bat and AdForge.command. One file to double-click. That's it. How it works now - AdForge.bat (Windows) and AdForge.command (Mac/Linux) handle the full first-run experience inline: 1. Sanity-check Node is installed 2. npm install if node_modules is missing 3. Write default .env.local (PORT=3005, ADFORGE_SYNC_PORT=3006) if it doesn't exist — users change ports later from the launcher's Settings card, no editor required 4. Drop a Desktop shortcut on first run (only if not already there) 5. Hand off to the sidecar / start.sh - Second run onwards: skips every setup step that's already done, jumps straight to opening the launcher. What was deleted - install.bat — its npm install + port-prompt + desktop-shortcut logic now lives inside AdForge.bat - install.sh — same, inlined into AdForge.command - The interactive port-picker was the one feature lost. Users now start on the default 3005 and change it in the launcher's Settings card (which already supports it). README updates - "Manual · Windows · 3 double-clicks" → "Manual · Windows · 2 double-clicks" (download, then click AdForge.bat once — done). - Removed the install.bat / install.sh row from the Start/Stop reference table. - "Pick your own port" section rewritten — change from launcher Settings, no install rerun needed. - File tree updated. One-line online installers (scripts/install/install.{ps1,sh}) are unaffected — they're never user-facing in the folder anyway, just fetched via raw GitHub URL from the iwr|iex / curl|bash one-liner. Verified: typecheck + 43 tests + build all pass. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 17ee66b commit 82957bc

5 files changed

Lines changed: 111 additions & 275 deletions

File tree

AdForge.bat

Lines changed: 38 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,46 @@ if errorlevel 1 (
4141
exit /b 1
4242
)
4343

44-
REM --- Make sure node_modules + data dir exist ---
44+
REM --- First-run setup is inlined here (no separate install.bat anymore) ---
45+
46+
REM 1. npm install if node_modules is missing
4547
if not exist node_modules (
46-
echo node_modules missing. Running install.bat first...
47-
call install.bat
48-
if errorlevel 1 exit /b 1
48+
echo.
49+
echo ==================================================
50+
echo First run · installing dependencies
51+
echo ==================================================
52+
echo This takes 1-3 minutes. You will only see this once.
53+
echo.
54+
call npm install --no-audit --no-fund
55+
if errorlevel 1 (
56+
echo.
57+
echo [ERROR] npm install failed. Read the error above and try again.
58+
echo.
59+
pause
60+
exit /b 1
61+
)
62+
)
63+
64+
REM 2. Write default .env.local if it doesn't exist (user can change ports later
65+
REM from the launcher's Settings card without re-running anything)
66+
if not exist .env.local (
67+
> .env.local echo # AdForge configuration ^(default ports - change in launcher Settings if needed^)
68+
>> .env.local echo PORT=3005
69+
>> .env.local echo ADFORGE_SYNC_PORT=3006
4970
)
71+
72+
REM 3. Create Desktop shortcut on first run (only if it isn't already there)
73+
powershell -NoProfile -Command ^
74+
"$d = [Environment]::GetFolderPath('Desktop');" ^
75+
"$lnk = Join-Path $d 'AdForge.lnk';" ^
76+
"if (-not (Test-Path $lnk)) {" ^
77+
" $t = Join-Path '%CD%' 'AdForge.bat';" ^
78+
" $s = (New-Object -ComObject WScript.Shell).CreateShortcut($lnk);" ^
79+
" $s.TargetPath = $t; $s.WorkingDirectory = '%CD%';" ^
80+
" $s.Description = 'Launch AdForge'; $s.WindowStyle = 7; $s.Save();" ^
81+
" Write-Host ' -> Created Desktop shortcut: ' $lnk" ^
82+
"}" 2>nul
83+
5084
if not exist data mkdir data
5185

5286
REM --- Spawn the sidecar detached, hidden, with the right env var ---

AdForge.command

Lines changed: 63 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,72 @@
11
#!/usr/bin/env bash
22
# AdForge desktop launcher (macOS / Linux).
33
#
4-
# Double-click this file in Finder / your file manager to launch the AdForge
5-
# launcher control panel in your default browser. macOS opens .command files
6-
# in Terminal automatically; on Linux, mark it executable (it already is) and
4+
# Double-click this file in Finder / your file manager. macOS opens .command
5+
# files in Terminal automatically; on Linux, mark it executable and either
76
# associate it with your terminal or just run it from the file manager.
87
#
9-
# This is the Mac/Linux equivalent of AdForge.hta on Windows. Browsers on
10-
# these platforms can't spawn processes from a local HTML file (sandbox), so
11-
# a shell script with a clear filename serves the same purpose: one click,
12-
# server up, browser opens.
8+
# First run does setup automatically: npm install, write default .env.local,
9+
# create a Desktop shortcut. Subsequent runs just open the launcher.
1310

1411
set -e
1512
cd "$(dirname "$0")"
13+
14+
# 1. Sanity: Node installed?
15+
if ! command -v node >/dev/null 2>&1; then
16+
echo
17+
echo "[ERROR] Node.js is not installed."
18+
echo " Install Node 20+ from https://nodejs.org/en/download then run AdForge again."
19+
echo
20+
read -p "Press enter to exit…" _
21+
exit 1
22+
fi
23+
24+
# 2. npm install on first run
25+
if [ ! -d node_modules ]; then
26+
echo
27+
echo "=================================================="
28+
echo " First run · installing dependencies"
29+
echo "=================================================="
30+
echo " This takes 1-3 minutes. You will only see this once."
31+
echo
32+
npm install --no-audit --no-fund
33+
fi
34+
35+
# 3. Default .env.local (ports can be changed later in the launcher's Settings card)
36+
if [ ! -f .env.local ]; then
37+
cat > .env.local <<EOF
38+
# AdForge configuration (default ports - change in launcher Settings if needed)
39+
PORT=3005
40+
ADFORGE_SYNC_PORT=3006
41+
EOF
42+
fi
43+
44+
# 4. Desktop shortcut on first run (only if missing)
45+
if [ -d "$HOME/Desktop" ]; then
46+
if [ "$(uname)" = "Darwin" ]; then
47+
if [ ! -e "$HOME/Desktop/AdForge.command" ]; then
48+
cp -f AdForge.command "$HOME/Desktop/AdForge.command" 2>/dev/null && \
49+
chmod +x "$HOME/Desktop/AdForge.command" 2>/dev/null && \
50+
echo " -> Created Desktop shortcut: ~/Desktop/AdForge.command"
51+
fi
52+
else
53+
if [ ! -e "$HOME/Desktop/AdForge.desktop" ]; then
54+
cat > "$HOME/Desktop/AdForge.desktop" <<DESK
55+
[Desktop Entry]
56+
Type=Application
57+
Name=AdForge
58+
Comment=Local AI ad operations cockpit
59+
Exec=bash $(pwd)/AdForge.command
60+
Terminal=true
61+
Categories=Office;Development;
62+
DESK
63+
chmod +x "$HOME/Desktop/AdForge.desktop" 2>/dev/null
64+
echo " -> Created Desktop shortcut: ~/Desktop/AdForge.desktop"
65+
fi
66+
fi
67+
fi
68+
69+
mkdir -p data
70+
71+
# 5. Hand off to the launcher sidecar (visible log, Ctrl+C exits)
1672
exec bash scripts/start.sh

README.md

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -72,21 +72,18 @@ curl -fsSL https://raw.githubusercontent.com/IamRamgarhia/AdForge-/main/scripts/
7272

7373
That single command: installs Node + git if missing (Windows uses winget), clones the repo into `~/AdForge`, runs `npm install`, asks for a port, then opens the launcher control panel in your browser. Click **▶ Start AdForge** and you're live.
7474

75-
### Manual · Windows · 3 double-clicks
75+
### Manual · Windows · 2 double-clicks
7676
1. **Download** this repo (green "Code" button → "Download ZIP" → extract)
77-
2. **Double-click `install.bat`** · waits for dependencies, asks for a port, creates an **AdForge** shortcut on your Desktop
78-
3. **Double-click the new `AdForge` icon on your Desktop** *(or `AdForge.bat` in the folder)* · your default browser opens to the AdForge launcher
77+
2. **Double-click `AdForge.bat`** — that's it. First run installs Node dependencies, writes a default `.env.local`, drops an `AdForge` shortcut on your Desktop, then opens the launcher. From the second run onwards it's a single click → browser opens to the launcher.
7978

80-
The launcher is a control panel: hit **▶ Start AdForge**, watch the progress bar, then click **↗ Open AdForge** when it's up. From the launcher you can also stop, restart, change ports, and open three different local URLs.
79+
The launcher is a control panel: hit **▶ Start AdForge**, watch the progress bar, then click **↗ Open AdForge** when it's up. From the launcher you can stop, restart, change ports, see update notices, and open three different local URLs.
8180

8281
To shut everything down: close the launcher tab and run `scripts\stop.bat` (or just close the hidden sidecar via Task Manager).
8382

84-
### Manual · Mac / Linux · 3 commands
83+
### Manual · Mac / Linux · 2 commands
8584
```bash
86-
git clone https://github.com/IamRamgarhia/AdForge-.git adforge
87-
cd adforge
88-
bash install.sh # one-time setup · creates ~/Desktop/AdForge shortcut
89-
bash AdForge.command # or double-click AdForge on your Desktop
85+
git clone https://github.com/IamRamgarhia/AdForge.git adforge && cd adforge
86+
bash AdForge.command # first run installs + creates Desktop shortcut · subsequent runs just launch
9087
# bash scripts/stop.sh # to force-stop later
9188
```
9289

@@ -99,7 +96,7 @@ npm run start:all # web app + local-sync sidecar together
9996
> First launch walks you through a 5-step wizard: welcome → tour → pick AI provider → paste key → optional first brand. No accounts. No env vars. No database.
10097
10198
### Pick your own port
102-
`install.bat` / `install.sh` ask which port you want and save it to `.env.local`. Defaults to **3005**. Pick anything 1024–65535 (avoid 80 unless you want admin rights).
99+
The default is **3005** for the web app and **3006** for the sidecar. Change either from the launcher's **Settings** card any time — no editor needed. Pick anything 1024–65535 (avoid 80 unless you want admin rights).
103100

104101
### Want a prettier URL?
105102
- **Zero setup:** open `http://adforge.localhost:3005/` instead of `http://localhost:3005/`. Works in Chrome / Firefox / Safari / Edge today — all modern browsers auto-resolve `*.localhost` to 127.0.0.1.
@@ -307,9 +304,8 @@ adforge/
307304
308305
├── data/ Your snapshot lives here (gitignored)
309306
├── AdForge.bat / AdForge.command Click-to-launch (Desktop shortcut points here)
310-
├── install.bat / install.sh Manual installer (after you clone/unzip)
311-
├── scripts/install/install.ps1 One-line online bootstrap (Windows · PowerShell)
312-
├── scripts/install/install.sh One-line online bootstrap (Mac / Linux / WSL)
307+
├── scripts/install/install.ps1 One-line online bootstrap (Windows · PowerShell · iwr | iex)
308+
├── scripts/install/install.sh One-line online bootstrap (Mac / Linux / WSL · curl | bash)
313309
├── scripts/start.bat / start.sh Manual sidecar runner (advanced)
314310
├── scripts/stop.bat / stop.sh Force shutdown
315311
└── package.json
@@ -337,8 +333,7 @@ Production build: 56 statically prerendered routes · 87 KB shared JS · 130-160
337333

338334
| Action | Windows | Mac / Linux | Cross-platform |
339335
|---|---|---|---|
340-
| Install (one-time) | double-click `install.bat` | `bash install.sh` | `npm install` |
341-
| **Launch** | double-click `AdForge` on Desktop *(or `AdForge.bat`)* | double-click `AdForge` on Desktop *(or `bash AdForge.command`)* ||
336+
| Install + Launch | double-click `AdForge.bat` — first run installs, every run after just launches | `bash AdForge.command` (same: first run sets up, after that it just launches) | `npm install && npm run start:all` |
342337
| Force-stop everything | `scripts\stop.bat` | `bash scripts/stop.sh` | Ctrl+C in the sidecar window |
343338
| Manual sidecar (visible log) | `scripts\start.bat` | `bash scripts/start.sh` | `npm run start:all` |
344339
| Web only | `npm run dev` | `npm run dev` | `npm run dev` |

install.bat

Lines changed: 0 additions & 125 deletions
This file was deleted.

0 commit comments

Comments
 (0)