Skip to content

Commit 8034cf1

Browse files
Restore Windows NSIS installer with PATH support, fix CLI help
- Restore build/windows/installer.nsi with optional PATH integration so 'rawrequest mcp', 'rawrequest service', and 'rawrequest run' work from any terminal after install - Add NSIS build steps back to release workflow - Add missing 'rawrequest service' command to CLI help text (fixes CI smoke check: 'CLI help missing service command') Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 3a94f3a commit 8034cf1

3 files changed

Lines changed: 224 additions & 0 deletions

File tree

.github/workflows/release.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,20 @@ jobs:
159159
}
160160
Compress-Archive -Path "dist/portable/*" -DestinationPath "dist/releases/RawRequest-$VERSION-windows-portable.zip"
161161
162+
- name: Install NSIS
163+
shell: powershell
164+
run: |
165+
choco install nsis -y
166+
167+
- name: Create Windows Installer
168+
shell: powershell
169+
run: |
170+
$VERSION = "${{ steps.version.outputs.version }}"
171+
New-Item -ItemType Directory -Force -Path "dist\releases\installer-staging"
172+
Copy-Item "build\bin\RawRequest.exe" "dist\releases\installer-staging\"
173+
Copy-Item "dist\portable\rawrequest-updater.exe" "dist\releases\installer-staging\"
174+
& 'C:\Program Files (x86)\NSIS\makensis.exe' /DVERSION=$VERSION "build\windows\installer.nsi"
175+
162176
- name: Upload Windows artifact
163177
uses: actions/upload-artifact@v4
164178
with:

build/windows/installer.nsi

Lines changed: 202 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,202 @@
1+
; RawRequest Windows Installer
2+
; Built with NSIS (Nullsoft Scriptable Install System)
3+
4+
!include "MUI2.nsh"
5+
!include "FileFunc.nsh"
6+
7+
; --------------------------------
8+
; General Configuration
9+
; --------------------------------
10+
11+
!define PRODUCT_NAME "RawRequest"
12+
!define PRODUCT_PUBLISHER "portablesheep"
13+
!define PRODUCT_WEB_SITE "https://github.com/portablesheep/RawRequest"
14+
!define PRODUCT_UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}"
15+
!define PRODUCT_UNINST_ROOT_KEY "HKLM"
16+
17+
; Version will be passed in via command line: makensis -DVERSION=1.0.0 installer.nsi
18+
!ifndef VERSION
19+
!define VERSION "1.0.0"
20+
!endif
21+
22+
; Paths can be overridden via command line: makensis -DSTAGING_DIR=path\to\staging
23+
; Default paths are relative to repo root (where makensis is invoked from)
24+
!ifndef STAGING_DIR
25+
!define STAGING_DIR "dist\releases\installer-staging"
26+
!endif
27+
28+
!ifndef OUT_DIR
29+
!define OUT_DIR "dist\releases"
30+
!endif
31+
32+
Name "${PRODUCT_NAME} ${VERSION}"
33+
OutFile "${OUT_DIR}\${PRODUCT_NAME}-${VERSION}-windows-setup.exe"
34+
InstallDir "$PROGRAMFILES64\${PRODUCT_NAME}"
35+
InstallDirRegKey HKLM "${PRODUCT_UNINST_KEY}" "InstallLocation"
36+
ShowInstDetails show
37+
ShowUnInstDetails show
38+
RequestExecutionLevel admin
39+
40+
; --------------------------------
41+
; Variables
42+
; --------------------------------
43+
44+
Var AddToPath
45+
46+
; --------------------------------
47+
; Modern UI Configuration
48+
; --------------------------------
49+
50+
!define MUI_ABORTWARNING
51+
; Icon paths are relative to the .nsi file location
52+
!define MUI_ICON "icon.ico"
53+
!define MUI_UNICON "icon.ico"
54+
55+
; Welcome page
56+
!insertmacro MUI_PAGE_WELCOME
57+
58+
; Directory page
59+
!insertmacro MUI_PAGE_DIRECTORY
60+
61+
; Components page (for PATH option)
62+
!insertmacro MUI_PAGE_COMPONENTS
63+
64+
; Instfiles page
65+
!insertmacro MUI_PAGE_INSTFILES
66+
67+
; Finish page
68+
!define MUI_FINISHPAGE_RUN "$INSTDIR\${PRODUCT_NAME}.exe"
69+
!define MUI_FINISHPAGE_RUN_TEXT "Launch ${PRODUCT_NAME}"
70+
!insertmacro MUI_PAGE_FINISH
71+
72+
; Uninstaller pages
73+
!insertmacro MUI_UNPAGE_CONFIRM
74+
!insertmacro MUI_UNPAGE_INSTFILES
75+
76+
; Language
77+
!insertmacro MUI_LANGUAGE "English"
78+
79+
; --------------------------------
80+
; Installer Sections
81+
; --------------------------------
82+
83+
Section "RawRequest (required)" SEC_MAIN
84+
SectionIn RO
85+
SetOutPath "$INSTDIR"
86+
SetOverwrite on
87+
88+
; Main application
89+
File "${STAGING_DIR}\${PRODUCT_NAME}.exe"
90+
91+
; Updater helper (required for auto-updates)
92+
File "${STAGING_DIR}\rawrequest-updater.exe"
93+
94+
; CLI alias (lowercase for terminal usage)
95+
CopyFiles /SILENT "$INSTDIR\${PRODUCT_NAME}.exe" "$INSTDIR\rawrequest.exe"
96+
97+
; Service launcher command
98+
FileOpen $0 "$INSTDIR\rawrequest-service.cmd" w
99+
FileWrite $0 '@echo off$\r$\n"$INSTDIR\rawrequest.exe" service %*$\r$\n'
100+
FileClose $0
101+
102+
; Create shortcuts
103+
CreateDirectory "$SMPROGRAMS\${PRODUCT_NAME}"
104+
CreateShortCut "$SMPROGRAMS\${PRODUCT_NAME}\${PRODUCT_NAME}.lnk" "$INSTDIR\${PRODUCT_NAME}.exe"
105+
CreateShortCut "$SMPROGRAMS\${PRODUCT_NAME}\Uninstall.lnk" "$INSTDIR\uninstall.exe"
106+
CreateShortCut "$DESKTOP\${PRODUCT_NAME}.lnk" "$INSTDIR\${PRODUCT_NAME}.exe"
107+
108+
; Write uninstaller
109+
WriteUninstaller "$INSTDIR\uninstall.exe"
110+
111+
; Write registry keys for Add/Remove Programs
112+
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayName" "${PRODUCT_NAME}"
113+
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayVersion" "${VERSION}"
114+
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "Publisher" "${PRODUCT_PUBLISHER}"
115+
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "URLInfoAbout" "${PRODUCT_WEB_SITE}"
116+
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "InstallLocation" "$INSTDIR"
117+
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "UninstallString" "$INSTDIR\uninstall.exe"
118+
WriteRegDWORD ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "NoModify" 1
119+
WriteRegDWORD ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "NoRepair" 1
120+
121+
; Get installed size
122+
${GetSize} "$INSTDIR" "/S=0K" $0 $1 $2
123+
IntFmt $0 "0x%08X" $0
124+
WriteRegDWORD ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "EstimatedSize" "$0"
125+
SectionEnd
126+
127+
Section "Add to PATH (enables rawrequest CLI & MCP)" SEC_PATH
128+
; Record that PATH was modified so uninstaller can remove it
129+
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "AddedToPath" "1"
130+
131+
; Read current system PATH
132+
ReadRegStr $0 HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" "Path"
133+
134+
; Check if already present
135+
${WordFind} "$0" "$INSTDIR" "E+1{" $1
136+
IfErrors 0 path_already_set
137+
; Append install dir to system PATH
138+
WriteRegExpandStr HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" "Path" "$0;$INSTDIR"
139+
; Broadcast WM_SETTINGCHANGE so running shells pick up the change
140+
SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} 0 "STR:Environment" /TIMEOUT=5000
141+
path_already_set:
142+
SectionEnd
143+
144+
; Section descriptions
145+
!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
146+
!insertmacro MUI_DESCRIPTION_TEXT ${SEC_MAIN} "Install RawRequest application and auto-updater."
147+
!insertmacro MUI_DESCRIPTION_TEXT ${SEC_PATH} "Add RawRequest to the system PATH so you can use 'rawrequest mcp', 'rawrequest service', and 'rawrequest run' from any terminal."
148+
!insertmacro MUI_FUNCTION_DESCRIPTION_END
149+
150+
; --------------------------------
151+
; Uninstaller Section
152+
; --------------------------------
153+
154+
Section "Uninstall"
155+
; Kill running instance if any
156+
nsExec::ExecToLog 'taskkill /f /im ${PRODUCT_NAME}.exe'
157+
158+
; Remove files
159+
Delete "$INSTDIR\${PRODUCT_NAME}.exe"
160+
Delete "$INSTDIR\rawrequest.exe"
161+
Delete "$INSTDIR\rawrequest-updater.exe"
162+
Delete "$INSTDIR\rawrequest-service.cmd"
163+
Delete "$INSTDIR\uninstall.exe"
164+
165+
; Remove shortcuts
166+
Delete "$SMPROGRAMS\${PRODUCT_NAME}\${PRODUCT_NAME}.lnk"
167+
Delete "$SMPROGRAMS\${PRODUCT_NAME}\Uninstall.lnk"
168+
Delete "$DESKTOP\${PRODUCT_NAME}.lnk"
169+
RMDir "$SMPROGRAMS\${PRODUCT_NAME}"
170+
171+
; Remove from PATH if we added it
172+
ReadRegStr $0 ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "AddedToPath"
173+
StrCmp $0 "1" 0 skip_path_removal
174+
ReadRegStr $1 HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" "Path"
175+
; Remove our entry (;$INSTDIR or $INSTDIR; patterns)
176+
${WordReplace} "$1" ";$INSTDIR" "" "+" $2
177+
${WordReplace} "$2" "$INSTDIR;" "" "+" $2
178+
${WordReplace} "$2" "$INSTDIR" "" "+" $2
179+
WriteRegExpandStr HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" "Path" "$2"
180+
SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} 0 "STR:Environment" /TIMEOUT=5000
181+
skip_path_removal:
182+
183+
; Remove install directory (only if empty)
184+
RMDir "$INSTDIR"
185+
186+
; Remove registry keys
187+
DeleteRegKey ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}"
188+
189+
SetAutoClose true
190+
SectionEnd
191+
192+
; --------------------------------
193+
; Version Information
194+
; --------------------------------
195+
196+
VIProductVersion "${VERSION}.0"
197+
VIAddVersionKey "ProductName" "${PRODUCT_NAME}"
198+
VIAddVersionKey "CompanyName" "${PRODUCT_PUBLISHER}"
199+
VIAddVersionKey "LegalCopyright" "© ${PRODUCT_PUBLISHER}"
200+
VIAddVersionKey "FileDescription" "${PRODUCT_NAME} Installer"
201+
VIAddVersionKey "FileVersion" "${VERSION}"
202+
VIAddVersionKey "ProductVersion" "${VERSION}"

internal/cli/cli.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,7 @@ Usage:
243243
rawrequest list <file> List all named requests in a file
244244
rawrequest envs <file> List environments defined in a file
245245
rawrequest mcp [options] Start MCP server for AI assistant integration
246+
rawrequest service [options] Start local HTTP backend service
246247
rawrequest version Show version
247248
rawrequest help Show this help
248249
@@ -269,6 +270,9 @@ Load Test Options:
269270
-o, --output <format> Output: full|json|quiet (default: full)
270271
--service <url> Service URL (default: auto-start on 127.0.0.1:7345)
271272
273+
Service Options:
274+
--addr <host:port> Address to bind (default: 127.0.0.1:7345)
275+
272276
MCP Options:
273277
-e, --env <env> Default environment for requests
274278
-w, --workspace <dir> Workspace root for .http file discovery (default: .)
@@ -311,6 +315,10 @@ Examples:
311315
rawrequest mcp
312316
rawrequest mcp --env dev
313317
318+
# Start HTTP backend service
319+
rawrequest service
320+
rawrequest service --addr 0.0.0.0:8080
321+
314322
`, version)
315323
}
316324

0 commit comments

Comments
 (0)