Tools
Tools: Elegantly Generate Type-Safe App Launch Links with Protocol Launcher
2026-02-24
0 views
admin
What Is Protocol Launcher? ## Key Features ## 🛡️ Strong Type Safety ## 🌿 Aggressive Tree Shaking ## 🔐 Security and Compatibility ## Broad Application Support ## Getting Started ## 1. Install ## 2. Usage Examples ## Conclusion 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: Now it’s time to solve this elegantly with 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. 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. 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. Protocol Launcher already supports the tools developers use most often, and the list is still growing: Use your preferred package manager: Suppose we want to open a file in VS Code: Or open a repository in GitHub Desktop: 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 Templates let you quickly answer FAQs or store snippets for re-use. Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink. Hide child comments as well For further actions, you may consider blocking this person and/or reporting abuse CODE_BLOCK:
// ❌ Before: error-prone, hard to maintain, no type hints
const url = "vscode://file/" + filePath + ":" + line // and you still have to handle encodeURIComponent yourself Enter fullscreen mode Exit fullscreen mode CODE_BLOCK:
// ❌ Before: error-prone, hard to maintain, no type hints
const url = "vscode://file/" + filePath + ":" + line // and you still have to handle encodeURIComponent yourself CODE_BLOCK:
// ❌ Before: error-prone, hard to maintain, no type hints
const url = "vscode://file/" + filePath + ":" + line // and you still have to handle encodeURIComponent yourself CODE_BLOCK:
// ✅ Recommended: import only what you need for minimal bundle size
import { openFile } from 'protocol-launcher/vscode' Enter fullscreen mode Exit fullscreen mode CODE_BLOCK:
// ✅ Recommended: import only what you need for minimal bundle size
import { openFile } from 'protocol-launcher/vscode' CODE_BLOCK:
// ✅ Recommended: import only what you need for minimal bundle size
import { openFile } from 'protocol-launcher/vscode' COMMAND_BLOCK:
npm install protocol-launcher
# or
pnpm add protocol-launcher Enter fullscreen mode Exit fullscreen mode COMMAND_BLOCK:
npm install protocol-launcher
# or
pnpm add protocol-launcher COMMAND_BLOCK:
npm install protocol-launcher
# or
pnpm add protocol-launcher CODE_BLOCK:
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) Enter fullscreen mode Exit fullscreen mode CODE_BLOCK:
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) CODE_BLOCK:
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) CODE_BLOCK:
import { openRepo } from 'protocol-launcher/github-desktop' const link = openRepo({ owner: 'zhensherlock', repo: 'protocol-launcher', branch: 'main',
}) Enter fullscreen mode Exit fullscreen mode CODE_BLOCK:
import { openRepo } from 'protocol-launcher/github-desktop' const link = openRepo({ owner: 'zhensherlock', repo: 'protocol-launcher', branch: 'main',
}) CODE_BLOCK:
import { openRepo } from 'protocol-launcher/github-desktop' const link = openRepo({ owner: 'zhensherlock', repo: 'protocol-launcher', branch: 'main',
}) - 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_modules clean. - Editors / IDEs: VS Code, Cursor, Xcode, IntelliJ IDEA, WebStorm, PyCharm, GoLand, PhpStorm, RustRover
- AI tools: Cherry Studio
- Collaboration & utilities: GitHub Desktop, Telegram, Thunder (Xunlei)
how-totutorialguidedev.toainodegitgithub