Automation
Launch sessions from links
Launch sessions from links 这一页讲的,就是 Launch sessions from links 这件事在 Claude Code 里到底怎么用。
页面信息
这页不是官方原文,而是顺着官方文档结构做的中文解释版。命令、参数、配置名这些硬东西尽量保留,解释部分则尽量讲成人能照着做的话。
如果你碰到特别敏感的配置、权限或企业环境差异,最好顺手点上面的“查看原始文档”再核一遍。
这一页先讲明白
这页主要讲 Launch sessions from links:Open a Claude Code terminal session from a URL. Embed claude-cli:// links in runbooks, alerts, and dashboards so a click opens Claude Code in the right repo with the right prompt.
你可以把它当成"Automation"这块里专门管这一摊事的说明书。
你可以把"Launch sessions from links"理解成 Automation 这一栏里的一把专门工具。这页不是让你背书,而是教你什么时候该把这把工具拿出来。
原文这页大多会按 How it works、What a launched session shows、Build a link、Choose between cwd and repo 这些环节往下讲。
翻成人话,大概就是:What a launched session shows
第一,先别一上来全开全配。先按最小一步试通,确认没跑偏,再继续往下加。
第二,命令、配置名、参数名这些硬东西尽量保留原样。人话解释是帮你听懂,不是帮你改关键字。
第三,照着原文这几个环节挨个过:How it works -> What a launched session shows -> Build a link -> Choose between cwd and repo。像下地先看水路、再试机器、再正式开干,一步一步最稳。
原页关键片段:Build a link 1
先看下面这块原始片段,等会儿再回头看解释会顺得多。
claude-cli://open 原页关键片段:Build a link 2
先看下面这块原始片段,等会儿再回头看解释会顺得多。
claude-cli://open?repo=acme/payments&q=Investigate%20the%20failed%20deploy%20of%20payments-api.%0ACheck%20recent%20commits%20to%20main%20and%20the%20last%20successful%20build. 原页关键片段:Build a link 3
先看下面这块原始片段,等会儿再回头看解释会顺得多。
Investigate the failed deploy of payments-api.
Check recent commits to main and the last successful build. 原页关键片段:Embed a link in a runbook
先别急着往下翻,下面这条命令跑完,心里才有底。
## High 5xx rate on web-gateway
1. Acknowledge the page in PagerDuty.
2. [Open Claude Code in the gateway repo](claude-cli://open?repo=acme/web-gateway&q=5xx%20rate%20is%20elevated%20on%20web-gateway.%20Check%20recent%20deploys%2C%20error%20logs%20from%20the%20last%2030%20minutes%2C%20and%20open%20incidents%20in%20Linear.)
3. Post initial findings in #incident. 原页关键片段:Open a link from the shell 1
真到动手的时候了,下面这条直接敲一遍,看它回什么。
open "claude-cli://open?repo=acme/payments&q=review%20open%20PRs" 原页关键片段:Open a link from the shell 2
真到动手的时候了,下面这条直接敲一遍,看它回什么。
xdg-open "claude-cli://open?repo=acme/payments&q=review%20open%20PRs" 原页关键片段:Open a link from the shell 3
真到动手的时候了,下面这条直接敲一遍,看它回什么。
Start-Process "claude-cli://open?repo=acme/payments&q=review%20open%20PRs" Documentation Index
这里不是让你背"Documentation Index"这个词,而是让你看它真干活时怎么使。
这里还牵扯作用域,意思就是这条规则到底管当前项目、你个人,还是只管这一趟会话。
How it works
这里讲底层是怎么运转的。你把它看明白,后面遇到异常时就知道该往哪儿查。
这里还牵扯作用域,意思就是这条规则到底管当前项目、你个人,还是只管这一趟会话。
What a launched session shows
这一块主要是在说"What a launched session shows"真到手上该怎么用,哪里最容易踩坑。
这里还牵扯作用域,意思就是这条规则到底管当前项目、你个人,还是只管这一趟会话。
Build a link
看到这里,就把"Build a link"当成一件真要上手的活来看。
这里还牵扯作用域,意思就是这条规则到底管当前项目、你个人,还是只管这一趟会话。
Build a link 1
先看下面这块原始片段,等会儿再回头看解释会顺得多。
claude-cli://open Build a link 2
先看下面这块原始片段,等会儿再回头看解释会顺得多。
claude-cli://open?repo=acme/payments&q=Investigate%20the%20failed%20deploy%20of%20payments-api.%0ACheck%20recent%20commits%20to%20main%20and%20the%20last%20successful%20build. Build a link 3
先看下面这块原始片段,等会儿再回头看解释会顺得多。
Investigate the failed deploy of payments-api.
Check recent commits to main and the last successful build. Choose between cwd and repo
这段主要是让你挑,不是让你全要。
这里还牵扯作用域,意思就是这条规则到底管当前项目、你个人,还是只管这一趟会话。
Examples
别把这段只当成标题看,它其实是在给"Examples"划边界。
Embed a link in a runbook
这一段主要是在把"Embed a link in a runbook"讲实,不是只摆个标题给你看。
看这段时要特别盯工具和权限边界,别为了省事一把全开。
Embed a link in a runbook
先别急着往下翻,下面这条命令跑完,心里才有底。
## High 5xx rate on web-gateway
1. Acknowledge the page in PagerDuty.
2. [Open Claude Code in the gateway repo](claude-cli://open?repo=acme/web-gateway&q=5xx%20rate%20is%20elevated%20on%20web-gateway.%20Check%20recent%20deploys%2C%20error%20logs%20from%20the%20last%2030%20minutes%2C%20and%20open%20incidents%20in%20Linear.)
3. Post initial findings in #incident. Open a link from the shell
这里不是让你背"Open a link from the shell"这个词,而是让你看它真干活时怎么使。
Open a link from the shell 1
真到动手的时候了,下面这条直接敲一遍,看它回什么。
open "claude-cli://open?repo=acme/payments&q=review%20open%20PRs" Open a link from the shell 2
真到动手的时候了,下面这条直接敲一遍,看它回什么。
xdg-open "claude-cli://open?repo=acme/payments&q=review%20open%20PRs" Open a link from the shell 3
真到动手的时候了,下面这条直接敲一遍,看它回什么。
Start-Process "claude-cli://open?repo=acme/payments&q=review%20open%20PRs" Open a link from the shell 4
真到动手的时候了,下面这条直接敲一遍,看它回什么。
start "" "claude-cli://open?repo=acme/payments&q=review%20open%20PRs" Registration and supported platforms
这一段主要是在把"Registration and supported platforms"讲实,不是只摆个标题给你看。
这里还牵扯作用域,意思就是这条规则到底管当前项目、你个人,还是只管这一趟会话。
Open a VS Code tab instead of a terminal
这段看着像个标题,其实是在说"Open a VS Code tab instead of a terminal"管到哪儿。
看这段时要特别盯工具和权限边界,别为了省事一把全开。
Troubleshooting
这里讲的是怎么找毛病,先查明白哪一步出错,再决定怎么修。
Clicking the link does nothing
这一段不只是挂个标题,它是在说明"Clicking the link does nothing"这一块到底负责什么。
这里还牵扯作用域,意思就是这条规则到底管当前项目、你个人,还是只管这一趟会话。
The link renders as plain text instead of being clickable
看到这里,就把"The link renders as plain text instead of being clickable"当成一件真要上手的活来看。
看这段时要特别盯工具和权限边界,别为了省事一把全开。
The session opens in my home directory instead of the repo
这一段不只是挂个标题,它是在说明"The session opens in my home directory instead of the repo"这一块到底负责什么。
看这段时要特别盯工具和权限边界,别为了省事一把全开。
The link opens the wrong terminal
这里不是让你背"The link opens the wrong terminal"这个词,而是让你看它真干活时怎么使。
如果你看到环境变量或 settings.json,意思通常都是:这不是会话里临时喊一声就行,而是要把开关真正写进环境或配置。
Learn more
这一块主要是在说"Learn more"真到手上该怎么用,哪里最容易踩坑。
这里还牵扯作用域,意思就是这条规则到底管当前项目、你个人,还是只管这一趟会话。
照着做一遍
如果你不想来回翻,就先照这几步顺着做。
每做完一步就看一下结果,再决定要不要继续往下。
第 1 步:Build a link 1
先看下面这块原始片段,等会儿再回头看解释会顺得多。
claude-cli://open 第 2 步:Build a link 2
先看下面这块原始片段,等会儿再回头看解释会顺得多。
claude-cli://open?repo=acme/payments&q=Investigate%20the%20failed%20deploy%20of%20payments-api.%0ACheck%20recent%20commits%20to%20main%20and%20the%20last%20successful%20build. 第 3 步:Build a link 3
先看下面这块原始片段,等会儿再回头看解释会顺得多。
Investigate the failed deploy of payments-api.
Check recent commits to main and the last successful build. 第 4 步:Embed a link in a runbook
先别急着往下翻,下面这条命令跑完,心里才有底。
## High 5xx rate on web-gateway
1. Acknowledge the page in PagerDuty.
2. [Open Claude Code in the gateway repo](claude-cli://open?repo=acme/web-gateway&q=5xx%20rate%20is%20elevated%20on%20web-gateway.%20Check%20recent%20deploys%2C%20error%20logs%20from%20the%20last%2030%20minutes%2C%20and%20open%20incidents%20in%20Linear.)
3. Post initial findings in #incident. 一眼看懂这一页
先把这页到底在讲什么看明白,再去碰具体命令和配置,最不容易绕晕。
Launch sessions from links
|
v
这是 Automation 里的一摊要紧活
|
v
先弄懂,再下手 文末提醒
这站会按官方 docs 的导航和内容变化继续重生成,原站加页、删页、改页时,这里会跟着更新。
人话解释会尽量顺着原页往下讲,但命令、参数名、配置名这些硬东西还是保留原样,免得你抄过去跑不起来。