<!doctype html>
<html lang="zh-CN">
<head>
<meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1">
<title>斜杠命令查找练习</title>
<style>
body{font:16px system-ui,sans-serif;background:#edf3f8;color:#163149;margin:0;padding:20px}
main{max-width:680px;margin:auto}h1{font-size:1.45rem}input,button{font:inherit;padding:.4em}
input{width:min(21rem,90%);margin:.5em 0}li{margin:.3rem}button[aria-pressed=true]{color:white;background:#275884}
section{background:white;border-radius:9px;padding:12px;margin-top:12px}
</style>
</head>
<body>
<main>
<h1>斜杠命令查找练习</h1>
<p>输入命令前缀,或点击一项查看它的用途。此页面用于查询说明。</p>
<label for="query">命令前缀</label><br><input id="query" type="search" placeholder="/model">
<ul id="matches" aria-label="匹配命令"></ul>
<section aria-live="polite"><h2 id="selected">选择命令</h2><p id="description">先搜索一条命令。</p></section>
</main>
<script>
"use strict";
const entries = {
"/compact": "压缩历史。继续前复核任务的重要约束。",
"/status": "查看会话状态、上下文和当前运行参数。",
"/review": "选择 Git 基线或未提交改动,审查结果须复核。",
"/side": "开始临时侧边会话,主会话可继续。",
"/fork": "复制会话。在支持的入口可选择额外工作树。",
"/mcp": "查看当前可用的 MCP 服务或连接状态。",
"/reasoning": "桌面端在支持时选择模型允许的推理强度。",
"/model": "查看可用模型,终端可从选择器核对推理强度。",
"/feedback": "打开反馈流程,提交前检查附带的诊断内容。",
"/pet": "在支持的桌面端切换宠物。终端可查看 /pets。",
};
const input = document.getElementById("query");
const list = document.getElementById("matches");
const selected = document.getElementById("selected");
const description = document.getElementById("description");
function filter() {
const name = input.value.trim().toLowerCase();
const matches = Object.keys(entries).filter(command => command.startsWith(name));
list.replaceChildren();
selected.textContent = "选择命令";
description.textContent = matches.length ? "选择一项查看用途。" : "没有匹配的命令。";
for (const command of matches) {
const item = document.createElement("li");
const button = document.createElement("button");
button.type = "button";
button.textContent = command;
button.setAttribute("aria-pressed", "false");
button.addEventListener("click", () => {
selected.textContent = command;
description.textContent = entries[command];
for (const option of list.querySelectorAll("button")) {
option.setAttribute("aria-pressed", String(option === button));
}
});
item.append(button);
list.append(item);
}
}
input.addEventListener("input", filter);
filter();
</script>
</body>
</html>
本例需在 支持现代 DOM 的浏览器。本地预览在 Microsoft Edge 验证。 中运行,请复制源码、保存文件或下载工程包后在本地执行验证。
运行说明与环境独立工程
运行环境:支持现代 DOM 的浏览器。本地预览在 Microsoft Edge 验证。
入口文件:projects/codex-slash/slash-observation.html
本地运行步骤快速上手
- 点击上方“保存源码”保存为
slash-observation.html,或下载右侧课程工程包。 - 确认本地已准备 支持现代 DOM 的浏览器。本地预览在 Microsoft Edge 验证。。
- 按对应章节命令执行,结合正文核对实际输出。
附件与关联工程包下载
课程关联工程包(登记关联40章) · 含当前章节或实例 · mbskycom202612a90.zip
课程关联工程包(登记关联1章) · 含当前章节或实例 · mbskycom202612a120.zip