Skip to content

fix: add Windows desktop shortcut installer option#503

Merged
Astro-Han merged 8 commits intodevfrom
codex/i500-windows-shortcut
May 8, 2026
Merged

fix: add Windows desktop shortcut installer option#503
Astro-Han merged 8 commits intodevfrom
codex/i500-windows-shortcut

Conversation

@Astro-Han
Copy link
Copy Markdown
Owner

@Astro-Han Astro-Han commented May 8, 2026

Summary

Adds a Windows NSIS installer checkbox for creating a desktop shortcut, with English and Chinese labels.

Keeps Start Menu shortcut creation enabled, disables electron-builder's automatic desktop shortcut, and moves desktop shortcut ownership into the installer script so auto-updates do not mutate it.

Updates the release checklist to require Windows desktop and Start Menu shortcut evidence.

Why

Windows installers were not creating a desktop shortcut. Users also need an explicit installer choice so reinstalling can intentionally create or skip the desktop shortcut without auto-update changing their desktop.

Related Issue

Addresses #500

Human Review Status

Pending. A human should make the final merge decision after reviewing the final diff and verification evidence.

Review Focus

Windows NSIS installer behavior:

  • checkbox default and English/Chinese copy
  • Just me vs All users desktop shortcut scope
  • auto-update skipping desktop shortcut changes
  • uninstall cleanup limited to standard installer-created desktop shortcuts

Risk Notes

Windows installer behavior changed. I verified NSIS compilation on macOS by building the Windows installer, but a real Windows machine still needs to install the generated .exe and verify actual desktop and Start Menu behavior before closing #500.

How To Verify

bun install --frozen-lockfile: completed successfully
Focused desktop packaging tests: 32 passed, 0 failed
Release typecheck: tsgo -p tsconfig.release.json completed successfully
git diff --check origin/dev...HEAD: no whitespace errors
Desktop build: bun run build completed successfully; generated models snapshot side effect was reverted
Windows installer build: OPENCODE_CHANNEL=prod npx electron-builder --win --x64 --publish never --config electron-builder.config.ts completed successfully and produced pawwork-win-x64-2026.5.7.exe plus blockmap
xhigh plan review: no P0/P1 after revisions
xhigh code review: no P0/P1 after scope fix

Screenshots or Recordings

Not captured locally. This is a Windows installer dialog change; real Windows installer verification is called out in the release checklist.

Checklist

  • Human review status is stated above as pending, approved, or not required
  • I linked the related issue, or stated why there is no issue
  • This PR has type, primary area, and priority labels, or I requested maintainer labeling
  • I described the review focus and any meaningful risks
  • I listed the relevant verification steps and the key result for each
  • I did not introduce unrelated refactors, dependencies, generated files, or file changes beyond the stated scope
  • I manually checked visible UI or copy changes when needed, with screenshots or recordings
  • I considered macOS and Windows impact for platform, packaging, updater, signing, paths, shell, or permissions changes
  • I called out docs, release notes, dependencies, permissions, credentials, deletion behavior, generated content, or local file changes when relevant
  • I reviewed the final diff for unrelated changes and suspicious dependency changes
  • I am targeting dev, and my PR title and commit messages use Conventional Commits in English

Summary by CodeRabbit

  • New Features

    • Optional desktop-shortcut checkbox during Windows setup; Start Menu shortcut created by default; installer handles install-scope and language-aware shortcut naming and cleanup.
  • Documentation

    • Added a Windows installer verification subsection to the release checklist detailing required test scenarios and evidence to capture.
  • Tests

    • Added/expanded tests validating Windows installer shortcut behavior, language cases, scope switching, reinstall/update/uninstall flows, and checklist presence.

@Astro-Han Astro-Han added bug Something isn't working windows Windows-specific P2 Medium priority platform Electron shell, OS integration, packaging, updater, signing, paths, and permissions labels May 8, 2026
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 8, 2026

Review Change Stack
No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: dc80f7d0-de03-4794-aeba-25cc573ada65

📥 Commits

Reviewing files that changed from the base of the PR and between 051babc and 5d08f68.

📒 Files selected for processing (4)
  • .github/RELEASE_CHECKLIST.md
  • packages/desktop-electron/electron-builder-nsis-shortcut.test.ts
  • packages/desktop-electron/resources/installer.nsh
  • packages/desktop-electron/scripts/release-workflow-contract.test.ts
🚧 Files skipped from review as they are similar to previous changes (3)
  • .github/RELEASE_CHECKLIST.md
  • packages/desktop-electron/resources/installer.nsh
  • packages/desktop-electron/electron-builder-nsis-shortcut.test.ts

📝 Walkthrough

Walkthrough

Adds a Windows installer desktop-shortcut opt-in flow in NSIS (custom page, macros, install/uninstall handlers), updates Electron Builder NSIS options to disable default desktop shortcut and include the NSIS script with en_US/zh_CN, and adds tests plus release-checklist verification for the new behavior.

Changes

Windows Desktop Shortcut Installer Control

Layer / File(s) Summary
NSIS Installer Script Implementation
packages/desktop-electron/resources/installer.nsh
Defines NSIS includes, macros and functions for language-aware standard shortcut naming, removal across install scopes (including elevated deletion), shell-context restoration, a custom install page with a desktop-shortcut checkbox, and custom uninstall handling.
Electron Builder Configuration
packages/desktop-electron/electron-builder.config.ts
Sets createDesktopShortcut: false, createStartMenuShortcut: true, includes resources/installer.nsh, and sets installerLanguages to ["en_US","zh_CN"].
App-update Config Test
packages/desktop-electron/electron-builder-app-update.test.ts
Adds a test asserting the prod build config exposes NSIS settings: one-click disabled, directory change allowed, desktop shortcut omitted, Start Menu present, included NSIS script, and installer languages.
NSIS Script Behavior Validation
packages/desktop-electron/electron-builder-nsis-shortcut.test.ts
Adds Bun-based string-content tests that validate checkbox labels (EN/CN), language-aware shortcut naming and $LANGUAGE usage, auto-update gating, exclusion of custom-renamed shortcuts, a true custom NSIS page with create/leave callbacks, channel-specific shortcut naming/deletion, uninstall cleanup gated on checkbox and scope, and elevated cleanup for scope switching.
Release Checklist & Workflow Tests
.github/RELEASE_CHECKLIST.md, packages/desktop-electron/scripts/release-workflow-contract.test.ts
Adds Windows installer shortcut verification matrix to the release checklist and a test that asserts the checklist contains required verification items and evidence tokens.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related issues

Possibly related PRs

  • Astro-Han/pawwork#123: Extended .github/RELEASE_CHECKLIST.md with new Windows installer verification section and corresponding test assertions for release workflow validation.

Suggested labels

desktop

Poem

🐰 I hopped through NSIS lines with cheer,

Checked boxes in both tongue and ear,
Shortcuts moved with scopes made right,
Start Menu shines when desktop's light,
PawWork set up tidy — hoppity bright!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: adding a Windows desktop shortcut installer option, which is the primary focus of the PR.
Description check ✅ Passed The description comprehensively covers the template requirements including Summary, Why, Related Issue, Human Review Status, Review Focus, Risk Notes, How To Verify, and Checklist completion with most items addressed.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/i500-windows-shortcut

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request implements custom Windows installer shortcut logic for the PawWork application, including language-aware shortcut names and a custom installer page for desktop shortcut selection. The changes involve updates to the NSIS configuration, a new NSH script, and comprehensive tests for installer logic and release documentation. Feedback identifies opportunities to improve the installer UI by using a descriptive page caption and to simplify the NSH script by removing redundant macro calls and manual file deletions.

Comment thread packages/desktop-electron/resources/installer.nsh Outdated
Comment thread packages/desktop-electron/resources/installer.nsh Outdated
Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request implements custom Windows installer shortcut logic using NSIS scripts to support localized shortcut names in English and Chinese. The changes include updates to the release checklist, configuration adjustments in electron-builder.config.ts, and new tests to verify shortcut behavior during installation and updates. Review feedback highlights opportunities to extend localization and cleanup logic to include Beta and Dev channels, and identifies redundant macro calls and manual file deletions in the installer.nsh script.

Comment thread packages/desktop-electron/resources/installer.nsh
Comment thread packages/desktop-electron/resources/installer.nsh
Comment thread packages/desktop-electron/resources/installer.nsh Outdated
@Astro-Han
Copy link
Copy Markdown
Owner Author

P1 update-path concern rejected after checking the concrete electron-builder/electron-updater code in this repo version.

Evidence:

  • electron-updater Windows NsisUpdater.doInstall() starts update installers with const args = ["--updated"].
  • electron-builder installUtil.nsh also appends --updated when the installer drives the old uninstaller during reinstall/update.
  • ${isUpdated} is a wrapper around StdUtils::TestParameter, so it is also checking command-line parameters. In this custom include position it previously failed NSIS compilation, while the explicit ${GetParameters} + ${GetOptions} "--updated" form compiles and verifies successfully.

So the premise that update execution lacks --updated is not true for the code used by this PR. The P1 is not accepted. The non-blocking review notes were addressed in 99935eb364: localized caption, Beta/Dev Chinese standard shortcut names, shared cleanup, and an expanded Windows verification matrix.

@Astro-Han
Copy link
Copy Markdown
Owner Author

Accepted the scope-switch P1 and fixed it in 6342435.

What changed:

  • Checked installs now remove standard installer-owned desktop shortcut names from both shell scopes: current user desktop and public/all-users desktop.
  • The installer then restores the selected install scope before creating the new standard shortcut, so the final shortcut lands only in the selected scope.
  • Unchecked reinstall and --updated paths still skip desktop shortcut mutation.
  • Cleanup remains limited to standard installer-owned names, so custom renamed shortcuts stay out of scope.

Verification:

  • bun --cwd packages/desktop-electron test electron-builder-nsis-shortcut.test.ts
  • git diff --check
  • Earlier for this same fix before commit: focused Windows shortcut/update/checklist tests passed, bun run typecheck:release passed, and the Windows NSIS installer build passed.

@Astro-Han
Copy link
Copy Markdown
Owner Author

Accepted the new scope/permission P1 and fixed it in 5d08f68.

What changed:

  • Kept the normal checked-install cleanup across current-user and public/all-users desktop scopes.
  • Added a narrow elevated cleanup path for the specific risky case: previous all-users install exists, the new install mode is Just me, desktop shortcut is checked, and the installer is not already admin. This removes the standard Public Desktop shortcuts without restarting the whole installer as all-users.
  • Kept unchecked reinstall and --updated paths out of desktop shortcut mutation.
  • Also fixed the P2 language-migration gap: standard cleanup now removes all known standard aliases for the current channel, e.g. PawWork / 爪印, PawWork Beta / 爪印 Beta, PawWork Dev / 爪印 Dev.

Verification:

  • bun --cwd packages/desktop-electron test electron-builder-nsis-shortcut.test.ts
  • bun --cwd packages/desktop-electron test electron-builder-app-update.test.ts electron-builder-nsis-shortcut.test.ts scripts/release-workflow-contract.test.ts
  • bun run typecheck:release
  • OPENCODE_CHANNEL=prod npx electron-builder --win --x64 --publish never --config electron-builder.config.ts
  • git diff --check

Still needs real Windows verification before closing #500, especially All users -> Just me with the UAC prompt accepted.

@Astro-Han Astro-Han merged commit e00780c into dev May 8, 2026
22 checks passed
@Astro-Han Astro-Han deleted the codex/i500-windows-shortcut branch May 8, 2026 06:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working P2 Medium priority platform Electron shell, OS integration, packaging, updater, signing, paths, and permissions windows Windows-specific

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant