Skip to content

Add desktop shortcut creation for Tingly Box#1005

Open
0x0079 wants to merge 5 commits into
mainfrom
claude/add-startup-shortcut-L2Thy
Open

Add desktop shortcut creation for Tingly Box#1005
0x0079 wants to merge 5 commits into
mainfrom
claude/add-startup-shortcut-L2Thy

Conversation

@0x0079

@0x0079 0x0079 commented May 20, 2026

Copy link
Copy Markdown
Collaborator

Summary

Adds a shortcut command that creates desktop and Start Menu shortcuts for launching Tingly Box, eliminating the need for users to remember and type startup commands. The implementation includes platform-specific shortcut creation for Windows (.lnk), macOS (.command), and Linux (.desktop), with automatic detection of the launch method (binary, npx, or npx-bundle).

Key Changes

  • New shortcut command (internal/command/shortcut.go):

    • Creates desktop and/or Start Menu shortcuts across Windows, macOS, and Linux
    • Supports three launch targets: direct binary execution, npx, or npx-bundle
    • Auto-detection mode that prefers recorded launch source, falls back to npx cache detection, then binary
    • Platform-specific implementations:
      • Windows: PowerShell script generating .lnk files via WScript.Shell COM
      • macOS: Shell script files (.command) executable from Finder
      • Linux: freedesktop .desktop entry files
    • Proper shell quoting for POSIX and PowerShell contexts
  • Launch source persistence:

    • Added LaunchSource field to global config (internal/server/config/config.go)
    • Added GetLaunchSource() and SetLaunchSource() methods to config and AppConfig
    • PersistLaunchSource() function records how the binary was invoked for future shortcut generation
  • Global --source flag (cli/tingly-box/main.go):

    • New CLI flag to specify/record launch method (binary, npx, npx-bundle)
    • Automatically persisted to config for shortcut auto-detection
  • NPX wrapper updates:

    • Both build/npx/tingly-box/bin.js and build/npx/tingly-box-bundle/bin.js now prepend --source flag to all invocations
    • Ensures npx-launched binaries record their launch method
  • Comprehensive test coverage (internal/command/shortcut_test.go):

    • Tests for launch argument generation, desktop entry/script content
    • Tests for all three launch modes and auto-detection logic
    • Tests for npx cache detection and filename generation
    • Tests for shell and PowerShell quoting functions

Implementation Details

  • The shortcut command respects --no-desktop and --no-menu flags to allow selective shortcut creation
  • Custom shortcut names are supported via --name flag
  • NPX-based shortcuts wrap commands in login shells to ensure node/npx are on PATH
  • Windows shortcuts use ComSpec environment variable with fallback to cmd.exe
  • Linux shortcuts only create desktop shortcuts if the Desktop directory exists
  • All file operations include proper error handling and permission setting (0o755 for executables)

https://claude.ai/code/session_012yPdw9AGArrZBosAPa3M4i

claude added 4 commits June 8, 2026 06:49
Adds `tingly-box shortcut` which generates a double-click launcher on
Windows (.lnk via WScript.Shell), macOS (.command) and Linux (.desktop)
that runs `restart --daemon` and opens the web UI, so users no longer
need to remember and type the startup command.

https://claude.ai/code/session_012yPdw9AGArrZBosAPa3M4i
The shortcut can now target npx (npx -y tingly-box@latest restart
--daemon) instead of the local binary, surviving npx-cache cleanup and
auto-updating. --source defaults to auto, detecting whether the running
binary lives in the npx cache. npx launches are wrapped in a login shell
(or cmd /c on Windows) so GUI double-clicks pick up node on PATH.

https://claude.ai/code/session_012yPdw9AGArrZBosAPa3M4i
Adds a --source flag to start/restart/open that records how tingly-box
was launched (binary, npx, npx-bundle) in config, and teaches the npx
wrappers to report their source. The shortcut command gains an
npx-bundle target and, in auto mode, generates a launcher matching the
recorded launch source so npx/bundle users get an npx-based shortcut.

https://claude.ai/code/session_012yPdw9AGArrZBosAPa3M4i
Promotes --source from the start/restart/open subcommands to a global
flag so the npx wrappers can prepend it to every invocation (not just the
no-arg default), meaning any npx run records its launch source. The
shortcut command's generation selector is renamed to --target to avoid a
flag-name collision. Launch source is persisted centrally in main.

https://claude.ai/code/session_012yPdw9AGArrZBosAPa3M4i
@0x0079 0x0079 force-pushed the claude/add-startup-shortcut-L2Thy branch from 7abbcae to ae8b955 Compare June 8, 2026 06:54
…kage

The shortcut generation logic (launch resolution, npx detection, platform
shortcut creation) is now in its own package with no CLI dependency, so a
future HTTP handler can reuse it. internal/command/shortcut.go keeps only
the Kong CLI shell and PersistLaunchSource (a CLI-boundary concern).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants