As developers, we often need to use URL schemes (deep links) to interact with local applications: opening VS Code from a web page and jumping to a specific line in one click, triggering a Git client to clone a repository via the CLI, or configuring IDEs inside automation scripts.
Before Protocol Launcher, this usually meant suffering through manually concatenated strings:
// ❌ Before: error-prone, hard to maintain, no type hints
const url = "vscode://file/" + filePath + ":" + line // and you still have to handle encodeURIComponent yourself
Now it’s time to solve this elegantly with Protocol Launcher.
What Is Protocol Launcher?
Protocol Launcher is a lightweight TypeScript library designed to generate safe, valid “quick launch” URLs for various applications. It standardizes how deep links are constructed and delivers an excellent developer experience.
Key Features
🛡️ Strong Type Safety
Built on TypeScript, Protocol Launcher provides strict parameter typings for every supported application. You no longer need to worry about misspelled parameters or invalid values. IDE IntelliSense guides you through configuration with code completion.
🌿 Aggressive Tree Shaking
Worried that pulling in an extra library will bloat your bundle? Protocol Launcher is modular and fully supports tree shaking. If you only need VS Code support, only the VS Code-related code gets bundled.
// ✅ Recommended: import only what you need for minimal bundle size
import { openFile } from 'protocol-launcher/vscode'
🔐 Security and Compatibility
- Automatic encoding: Built-in safe encoding logic automatically handles special characters in URLs and mitigates injection risks.
- Unicode support: Fully supports Chinese paths and filenames, so you never need to worry about garbled text again.
-
Zero runtime dependencies: The library has no external runtime dependencies, keeping your
node_modulesclean.
Broad Application Support
Protocol Launcher already supports the tools developers use most often, and the list is still growing:
- Editors / IDEs: VS Code, Cursor, Xcode, IntelliJ IDEA, WebStorm, PyCharm, GoLand, PhpStorm, RustRover
- AI tools: Cherry Studio
- Collaboration & utilities: GitHub Desktop, Telegram, Thunder (Xunlei)
Getting Started
1. Install
Use your preferred package manager:
npm install protocol-launcher
# or
pnpm add protocol-launcher
2. Usage Examples
Suppose we want to open a file in VS Code:
import { openFile } from 'protocol-launcher/vscode'
const link = openFile({
path: '/Users/dev/project/src/app.ts',
line: 42,
column: 10,
})
// The generated link is safe and well-formed, ready for window.open or terminal usage
console.log(link)
Or open a repository in GitHub Desktop:
import { openRepo } from 'protocol-launcher/github-desktop'
const link = openRepo({
owner: 'zhensherlock',
repo: 'protocol-launcher',
branch: 'main',
})
Conclusion
Protocol Launcher takes the “generate app links” detail and pushes it to the extreme. It is simple, reliable, and efficient. If you are building web pages, CLI tools, or desktop apps that need to integrate with local applications, Protocol Launcher is an ideal choice.
🔗 Try it now: Documentation | GitHub
Top comments (0)