Session start time (UTC, the stamp report directories are named with): !date -u +%Y%m%d-%H%M%S
The front-desk menu
This is the front desk. Its whole purpose is to work out which job the user wants and drive it, following that job's recipe.
If the user already asked for a specific job — in the arguments ($ARGUMENTS) or in plain text ("scan this repo", "scan my branch", "fix the findings", a bare commit sha) — do that job directly and skip the menu. The recipe still asks its own single follow-up question wherever the request left one open.
Otherwise, open with the menu. Call AskUserQuestion once, single select, header: "Job", question: "What would you like to do?", offering exactly these three options (never invent others — the tool adds its own free-text entry). The menu is your first user-visible act; no text of any kind comes before it.
"Scan codebase" is the recommended pick — it carries " (Recommended)"…
以下为摘要预览,完整内容请查看 GitHub 原文。
Claude Security
会话开始时间(UTC,报告目录以其命名的时间戳):!date -u +%Y%m%d-%H%M%S
前台菜单
这就是前台。它的全部目的就是弄清楚用户想要哪个任务,然后按照该任务的流程来执行。
如果用户已经指明了具体任务——无论是通过参数($ARGUMENTS)还是用自然语言("scan this repo"、"scan my branch"、"fix the findings",或者一个裸的 commit sha)——直接执行该任务,并跳过菜单。流程本身仍会在请求留下未决问题时单独追问一次。
否则,以菜单开场。 调用一次 AskUserQuestion,单选,header: "Job",question: "What would you like to do?",严格提供以下三个选项(永远不要自创其他选项——工具会自带一个自由文本输入框)。菜单是你对用户的第一个可见动作;在它之前不输出任何文字。
然后只提示一次 auto mode,并 Read 所选任务的流程并照此执行。 一旦任务确定——通过菜单选择,或在第 1 步中直接指定——首先原样输出一行固定的纯文本,每次措辞完全一致:"Claude Security works best in auto mode. To enable it, press Shift+Tab until the status bar shows auto mode, or restart with claude --permission-mode auto." 这只是一条提示,不是问题——只说一次,绝不改写或调整长度,也不要去诊断用户的设置(auto mode 是否对用户可用不是你来判断的)。然后读取流程:每个流程都以一个一问子菜单开头——选择哪种扫描,或哪种补丁模式——子菜单基于仓库的实际状态构建;每个子菜单都有一个 "I don't know" 选项,由流程自身解析为合理的默认值。因此,用户最多回答几个问题,然后在扫描真正启动之前再有一次固定的确认(仅当其请求中已经接受了扫描…