Skip to content

Commit d33c395

Browse files
author
SqlRush
committed
Add native status slash command
1 parent 3c7cc8f commit d33c395

5 files changed

Lines changed: 62 additions & 0 deletions

File tree

docs/cc-100-roadmap.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ M4 补充:tool executor 会围绕 `PreToolUse`、`PostToolUse`、`PermissionDe
3737

3838
M4/M11 补充:bridge-safe 内置本地命令 `/summary``/release-notes``/files` 已注册并接入 no-query runner 路径;`/summary` 输出本地会话/历史摘要,`/files` 只读列出当前工作目录第一层条目,`/release-notes` 报告当前 Go runtime 未打包 release notes。完整 local-jsx UI surface 和其它本地命令 parity 仍未完成。
3939

40+
M11 补充:`/native status|show` 已接入 no-query 本地路径,复用 `/status show native` 的 session native manifest 审计输出,报告平台、capability、clipboard adapter、file index 和 clipboard state,不请求模型且不调用外部 adapter。
41+
4042
M10 补充:plugin command/agent 的 allowed tool frontmatter 解析现在只在顶层逗号或空白处分隔,保留括号、方括号和引号内的逗号/空白,避免 `Bash(git commit -m "x,y")` 这类 tool pattern 被误拆。
4143

4244
M8 补充:CLI `plugin marketplace list` 现在可列出 settings 中已配置的 marketplace;`--json` 输出按名称排序的 source/repo/url/path/package/installLocation 结构,普通文本输出与无配置提示也已覆盖。CLI `plugin marketplace add [--scope user|project|local] [--type ...] <name> <source>` 和 `plugin marketplace remove [--scope user|project|local] <name>` 现在复用 `internal/config` settings 文件写入 helper,可按目标 scope 写入/删除 `extraKnownMarketplaces`,并在写入前复用 marketplace source validation,且 `installLocation` 会校验为 `user|project|local`。CLI `plugin marketplace update [name]` 现在可按全部或指定 marketplace 触发现有 URL/git/github/npm/settings cache 加载刷新路径,命名 update 会用轻量 settings 读取避免启动时提前刷新全部 marketplace。运行时插件发现现在会合并项目链 `.claude/plugins` 和用户级 `${CLAUDE_CONFIG_DIR}/plugins`,项目同名插件优先。CLI `plugin install --scope project|user|local <plugin>` 与 headless `/plugin install [--scope project|user|local] <plugin>` 现在复用 `internal/plugins` 共享安装 API,把 marketplace 插件复制到目标 scope 的 `plugins/<safe-name>`,未显式传 scope 时会尊重 marketplace `installLocation` 默认值,并保留冲突检测、重复安装识别和 symlink/non-regular file 拒绝。CLI `plugin update --scope project|user|local|all <plugin>` 与 headless `/plugin update [--scope project|user|local|all] [plugin]` 现在复用 `internal/plugins` 共享更新 API,把目标 scope 已安装同名插件替换为最新 marketplace 副本,未显式传 scope 的命名更新同样会尊重 marketplace `installLocation`。CLI `plugin enable|disable [--scope user|project|local] <plugin>` 与 `plugin disable --all --scope ...` 现在复用 `internal/config` settings 文件写入 helper,按目标 scope 更新 `enabledPlugins` 并覆盖基本参数冲突。

docs/claude-code-go-rewrite-plan.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -895,6 +895,7 @@ test/parity/ # golden tests against TS/official behavior
895895
- 本轮补充:新增 `advanced` settings gate 地基,覆盖 bridge/LSP/telemetry/Chrome/voice/computer-use/native integrations 的独立 bool 开关解析、settings merge、headless `/config show advanced` 和 `/config search` 审计;`advanced.telemetry=true` 时会在 session 目录写入安全摘要 JSONL 诊断事件,记录事件类型、session/model、tool/progress keys、token/compact/error 摘要,不写入用户/助手正文或工具结果内容,并已有安全 JSONL 读取、类型/模型过滤、汇总统计、deterministic trace/span id、JSON summary export、可配置 `telemetryExport` 本地 JSONL exporter / HTTP backend POST、endpoint 脱敏 status,以及 headless `/status show telemetry` trace/span/exporter 审计地基;`advanced.lsp=true` 时才向模型暴露只读 `LSPDiagnostics` 工具,用于读取 session-scoped diagnostics snapshot,并支持 file/severity/limit 过滤,底层已能解析 LSP `textDocument/publishDiagnostics` params/notification payload、按文件替换 snapshot、按 LSP 空 diagnostics 语义清空旧文件诊断;同时会写出 session-scoped LSP manager status,按默认或显式 server definitions 解析 workspace/root marker/file extension 命中情况,将已匹配但未启动的 server 标为 `not_started`,并可通过 headless `/status show lsp` 审计 diagnostics 与 manager runtime state;LSP Content-Length framed JSON-RPC reader/writer 与 diagnostics stream processor 已能持续消费 `textDocument/publishDiagnostics` notification、捕获 initialize response capabilities 并更新 session snapshot;LSP server process lifecycle API 已可启动配置命令、消费 stdout framed diagnostics stream,并把 `running`/`exited`/`failed`、PID 和时间戳写回 manager status;LSP client handshake send path 已可向 server stdin 写入 `initialize`、`initialized` 和 `textDocument/didOpen` framed JSON-RPC,支持 root/client/document metadata 和 file URI/language 默认推断;conversation runner 在 `advanced.lsp=true` 且显式或默认 server definitions 命中 workspace 时,会自动启动可执行命令存在的 LSP server、发送 handshake/startup documents、对缺失命令保持可审计 `not_started` reason,并复用 session diagnostics/manager status 生命周期;`advanced.bridge=true` 时会写出 session-scoped bridge manifest 和 direct connect state,列出 bridge-safe slash/local command 元数据,启动 loopback-only direct HTTP/WebSocket endpoint,提供 `/health`、`/manifest`、`/resolve`、`/execute` 和 `/ws` JSON 通道,`/ws` 支持 `hello`/`health`/`manifest`/`resolve`/`execute`/`remote_trigger` action 与 protocol version/capability 握手,执行前强制 bridge-safe 白名单并默认不回传展开后的 prompt 正文,支持可选 bearer/`X-Bridge-Token` token guard,并可通过 headless `/status show bridge` 审计 manifest、HTTP URL、WebSocket URL 和 token-required 状态;`advanced.nativeIntegrations=true` 时会写出 session-scoped native capability manifest、native file index、native clipboard state 和 system/tmux/OSC52 clipboard adapter 检测结果,只记录路径/大小/mtime 等文件元数据、跳过常见 runtime/vendor 目录,clipboard status 不展示文本内容,并已有 ANSI color diff rendering runtime、system/tmux 外部剪贴板命令读写执行 API 和显式 `/native clipboard read|write` 用户路径,可通过 headless `/status show native` 审计 index/clipboard 路径、数量与 adapter 命令计划;任一 `advanced.chrome`/`advanced.voice`/`advanced.computerUse=true` 时会写出 session-scoped integrations manifest 和独立 runtime state file,将 Chrome/voice/computer-use 的 enabled 与 `runtime_state=ready` 分开记录,并记录 browser/native-host、audio-capture、screen-capture/input-control adapter 探测结果;`advanced.chrome=true` 时还会写出 session-scoped Chrome native host manifest 与 wrapper artifact,并已有 `--chrome-native-host` fast path、Chrome native messaging length-prefixed JSON frame 编解码和 ping/status/hello/capabilities/session/runtime 响应,以及显式 `/native chrome status|install` 用户路径,可将 manifest/wrapper 安装到 macOS/Linux Chrome/Chromium/Edge NativeMessagingHosts 目录,并在 Windows 通过 HKCU NativeMessagingHosts 注册表项注册 manifest;`advanced.voice=true` 时会写出 session-scoped voice capture plan artifact,记录选中的 audio-capture adapter、16kHz/mono/pcm_s16le/streaming 参数,并已有受 duration/max-bytes 限制的 voice capture command runner API、可配置 `CLAUDE_VOICE_TRANSCRIBE_COMMAND` 的 STT command runner,以及显式 `/native voice status|show|capture|transcribe` 用户路径;`advanced.computerUse=true` 时会写出 session-scoped computer-use driver plan artifact,记录 screen-capture/input-control adapter、png 截图格式和 screen_pixels 坐标系,并已有 screen capture stdout 捕获、显式 `/native computer status|show|screenshot` 与 `/native computer move|click|type|key` 用户路径,以及 xdotool、macOS osascript、Windows PowerShell 输入执行 API,可通过 headless `/status show integrations` 审计 runtime state 路径与 adapter/manifest/voice/computer-use plan 命令计划;未启用时仍不注册或泄露 gated 工具 schema。实际 Chrome 扩展 UI/事件通道、voice 实时/服务端 STT 体验、computer-use Wayland/权限边界与更深交互接入等平台增强仍未完成。
896896

897897
- 本轮补充:`/native clipboard status|show` 现在走 no-query 本地状态路径,只展示 session clipboard 文件路径、item 数、更新时间和 adapter 可用性/命令,不读取、不写入、不展示剪贴板文本内容;`/native clipboard` usage 同步暴露 status 子命令。
898+
- 本轮补充:`/native status|show` 现在复用 `/status show native` 的 no-query 状态路径,可直接审计 session native manifest、平台、capability 数、clipboard adapter、file index 和 clipboard state,不请求模型也不调用外部 clipboard adapter。
898899

899900
- 本轮补充:bridge-safe 内置本地命令 `/summary``/release-notes``/files` 现在已注册并接入 no-query runner 路径;`/summary` 输出确定性的会话/历史消息计数、工具使用计数、估算 token 和最近用户/助手预览,`/files` 只读列出当前工作目录第一层条目而不读取文件内容,`/release-notes` 明确报告当前 Go runtime 未打包 release notes。完整 local-jsx UI surface 和其它本地命令 parity 仍需继续补。
900901

docs/first-second-parity-audit.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ Anthropic API 和 conversation:
8383
- `/config <section>` now shares the same section-alias normalization as `/config show <section>` for non-mutating direct section invocations such as `/config env`, `/config permissions`, and `/config integrations`, while preserving existing mutating forms such as `/config model <name>` and `/config output-style <name>`.
8484
- `/memory list`, `/memory files`, and `/memory ls` now take the no-query local file-list path used by `/memory show`, while `/memory status` continues to report the session/relevant-memory summary.
8585
- `/native clipboard status|show` now takes a no-query local status path that reports the session clipboard state and adapter availability without reading, writing, or displaying clipboard text.
86+
- `/native status|show` now takes the same no-query local status path as `/status show native`, reporting the session native manifest, platform, capability counts, clipboard adapter availability, file index, and clipboard state without invoking external adapters or the model.
8687
- `/native voice status|show` and `/native computer status|show` now take no-query local status paths that report the session plan path, adapter availability, selected commands, and voice/computer-use runtime parameters without starting capture or input actions.
8788
- `/mcp refresh` and `/mcp reload` now take a no-query local refresh path that checks settings-file changes, refreshes plugin MCP server app-state, and reports configured/plugin MCP server counts instead of falling into the unsupported-subcommand branch.
8889
- `/mcp <server-name>` now takes the no-query local server-detail path used by `/mcp show <server-name>` when the name matches a configured settings or plugin MCP server, while unknown one-word subcommands still report unsupported.

internal/conversation/run.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1579,6 +1579,8 @@ func (r Runner) formatNativeCommandSummary(ctx context.Context, raw string) stri
15791579
return nativeCommandUsage()
15801580
}
15811581
switch strings.ToLower(args[0]) {
1582+
case "status", "show":
1583+
return r.formatStatusNative()
15821584
case "clipboard":
15831585
return r.formatNativeClipboardCommand(ctx, strings.TrimSpace(dropLeadingFields(raw, 1)))
15841586
case "chrome":

internal/conversation/run_test.go

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3377,6 +3377,62 @@ func TestRunnerNativeClipboardStatusCommandWithoutQuery(t *testing.T) {
33773377
}
33783378
}
33793379

3380+
func TestRunnerNativeStatusCommandWithoutQuery(t *testing.T) {
3381+
client := &fakeClient{}
3382+
dir := t.TempDir()
3383+
sessionID := contracts.ID("sess_native_status")
3384+
sessionPath := filepath.Join(dir, "session.jsonl")
3385+
manifestPath := nativepkg.SessionManifestPath(sessionPath, sessionID)
3386+
if err := nativepkg.WriteManifest(manifestPath, nativepkg.Manifest{
3387+
SessionID: sessionID,
3388+
GOOS: "testos",
3389+
GOARCH: "testarch",
3390+
Terminal: "xterm-256color",
3391+
ClipboardAdapters: []nativepkg.ClipboardAdapter{
3392+
{Name: "osc52", Kind: nativepkg.ClipboardAdapterKindTerminal, Available: true},
3393+
},
3394+
Capabilities: []nativepkg.Capability{
3395+
{Name: "native_clipboard", Available: false},
3396+
{Name: "osc52_clipboard", Available: true},
3397+
},
3398+
}); err != nil {
3399+
t.Fatal(err)
3400+
}
3401+
runner := Runner{
3402+
Client: client,
3403+
Model: "sonnet",
3404+
SessionID: sessionID,
3405+
SessionPath: sessionPath,
3406+
WorkingDirectory: dir,
3407+
}
3408+
for _, prompt := range []string{"/native status", "/native show"} {
3409+
result, err := runner.RunTurn(context.Background(), nil, messages.UserText(prompt))
3410+
if err != nil {
3411+
t.Fatal(err)
3412+
}
3413+
if len(client.requests) != 0 {
3414+
t.Fatalf("%s queried model, requests = %d", prompt, len(client.requests))
3415+
}
3416+
text := result.Messages[len(result.Messages)-1].Content[0].Text
3417+
for _, want := range []string{
3418+
"Status native integrations",
3419+
"Enabled: disabled",
3420+
"Manifest path: " + manifestPath,
3421+
"Platform: testos/testarch",
3422+
"Capabilities: 2",
3423+
"Available capabilities: 1",
3424+
"Clipboard adapters: 1",
3425+
"Terminal: xterm-256color",
3426+
"- native_clipboard: unavailable",
3427+
"- osc52_clipboard: available",
3428+
} {
3429+
if !strings.Contains(text, want) {
3430+
t.Fatalf("%s status missing %q: %q", prompt, want, text)
3431+
}
3432+
}
3433+
}
3434+
}
3435+
33803436
func TestRunnerExecutesNativeChromeInstallCommandWithoutQuery(t *testing.T) {
33813437
client := &fakeClient{}
33823438
dir := t.TempDir()

0 commit comments

Comments
 (0)