wtf

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

WTF

WTF

Single-pass situational awareness for the current git branch. Analyzes git state only -- no source file reads.
Write
,
Edit
,
Read
,
Glob
, and
Grep
are intentionally excluded from allowed-tools. This skill MUST NOT read or modify any files.
为当前git分支提供一次性情境感知。仅分析git状态——不读取源文件。
Write
Edit
Read
Glob
Grep
被有意排除在允许使用的工具之外。本技能绝对不能读取或修改任何文件。

Workflow

工作流程

Follow all 3 steps sequentially.
按顺序执行以下3个步骤。

Step 1: Detect Context

步骤1:检测上下文

  1. Parse the optional focus argument from everything after
    /wtf
    .
    • /wtf auth
      -> focus is "auth"
    • /wtf
      (bare) -> no focus, full analysis
  2. Run a single Bash call to detect the git context:
bash
CURRENT=$(git symbolic-ref --short HEAD 2>/dev/null || git rev-parse --short HEAD)
DETACHED=$?
if git rev-parse --verify main &>/dev/null; then TRUNK="main"
elif git rev-parse --verify master &>/dev/null; then TRUNK="master"
else TRUNK=""; fi
echo "CURRENT=$CURRENT"
echo "TRUNK=$TRUNK"
echo "DETACHED=$DETACHED"
  1. Route based on the result:
    • Not a git repo (commands fail) -> report "Not a git repository." and stop.
    • Detached HEAD -> report the hash, run
      git log --oneline -10
      around that point, summarize, and stop.
    • No trunk found (
      TRUNK
      is empty) -> use
      AskUserQuestion
      to ask the user for their trunk branch name, then continue.
    • On trunk (
      CURRENT == TRUNK
      ) -> go to Step 2B.
    • Feature branch (anything else) -> go to Step 2A.
  1. /wtf
    之后的所有内容中解析可选的焦点参数。
    • /wtf auth
      -> 焦点为“auth”
    • /wtf
      (无参数)-> 无焦点,进行完整分析
  2. 运行一次Bash调用以检测git上下文:
bash
CURRENT=$(git symbolic-ref --short HEAD 2>/dev/null || git rev-parse --short HEAD)
DETACHED=$?
if git rev-parse --verify main &>/dev/null; then TRUNK="main"
elif git rev-parse --verify master &>/dev/null; then TRUNK="master"
else TRUNK=""; fi
echo "CURRENT=$CURRENT"
echo "TRUNK=$TRUNK"
echo "DETACHED=$DETACHED"
  1. 根据结果进行分支处理:
    • 非git仓库(命令执行失败)-> 报告“这不是git仓库。”并停止。
    • 分离HEAD状态 -> 报告哈希值,运行
      git log --oneline -10
      查看该节点附近的提交,总结后停止。
    • 未找到主干分支
      TRUNK
      为空)-> 使用
      AskUserQuestion
      询问用户主干分支的名称,然后继续。
    • 当前在主干分支
      CURRENT == TRUNK
      )-> 进入步骤2B。
    • 功能分支(其他情况)-> 进入步骤2A。

Step 2A: Feature Branch

步骤2A:功能分支

Run a single Bash call to collect all data at once:
bash
MERGE_BASE=$(git merge-base HEAD $TRUNK)
echo "=== LOG ==="
git log --format="%h %s%n%w(0,4,4)%b" $MERGE_BASE..HEAD
echo "=== STAT ==="
git diff --stat $MERGE_BASE..HEAD
echo "=== SHORTSTAT ==="
git diff --shortstat $MERGE_BASE..HEAD
echo "=== MERGE_BASE ==="
echo $MERGE_BASE
If a focus argument was provided, add path filtering:
  • Append
    -- '*{focus}*'
    to the
    git log
    and
    git diff --stat
    commands
  • If no results match the focus, report "No changes matching '{focus}'" and stop.
Edge case -- no divergence: If
git log
returns nothing (merge base == HEAD), report "Branch exists but hasn't diverged from {trunk} yet." and stop.
Parse the output silently. Do NOT echo the raw git output. Proceed to Step 3A.
运行一次Bash调用一次性收集所有数据:
bash
MERGE_BASE=$(git merge-base HEAD $TRUNK)
echo "=== LOG ==="
git log --format="%h %s%n%w(0,4,4)%b" $MERGE_BASE..HEAD
echo "=== STAT ==="
git diff --stat $MERGE_BASE..HEAD
echo "=== SHORTSTAT ==="
git diff --shortstat $MERGE_BASE..HEAD
echo "=== MERGE_BASE ==="
echo $MERGE_BASE
如果提供了焦点参数,添加路径过滤:
  • git log
    git diff --stat
    命令后追加
    -- '*{focus}*'
  • 如果没有匹配焦点的结果,报告“没有找到匹配'{focus}'的变更”并停止。
边缘情况——无分歧: 如果
git log
无返回结果(合并基准与HEAD一致),报告“分支已存在,但尚未与{trunk}产生分歧。”并停止。
静默解析输出。不要回显原始git输出。继续执行步骤3A。

Step 2B: Trunk Branch

步骤2B:主干分支

Run a single Bash call:
bash
echo "=== RECENT ==="
git log --oneline --since="7 days ago" --format="%h %s (%an, %ar)"
echo "=== COUNT ==="
git rev-list --count --since="7 days ago" HEAD
Parse the output:
  • Filter out routine commits (dependency bumps, CI config, docs-only, formatting, merge commits).
  • Group remaining interesting commits by day.
  • Count filtered-out commits separately.
Edge case -- no recent activity: If count is 0, expand the window to 30 days and re-run. If still 0, report "Quiet repo -- no commits in the last 30 days." and stop.
Parse the output silently. Do NOT echo the raw git output. Proceed to Step 3B.
运行一次Bash调用:
bash
echo "=== RECENT ==="
git log --oneline --since="7 days ago" --format="%h %s (%an, %ar)"
echo "=== COUNT ==="
git rev-list --count --since="7 days ago" HEAD
解析输出:
  • 过滤掉常规提交(依赖更新、CI配置、仅文档变更、格式调整、合并提交)。
  • 将剩余的重要提交按天分组。
  • 单独统计被过滤掉的提交数量。
边缘情况——近期无活动: 如果数量为0,将时间窗口扩大到30天并重新运行。如果仍然为0,报告“仓库近期无活动——过去30天内没有提交。”并停止。
静默解析输出。不要回显原始git输出。继续执行步骤3B。

Step 3A: Present (Feature Branch)

步骤3A:展示(功能分支)

Output in this exact format:
markdown
undefined
严格按照以下格式输出:
markdown
undefined

WTF: {branch-name}

WTF: {分支名称}

Purpose: {one-sentence description of what this branch does, inferred from commit messages} Base: diverged from {trunk} at {merge-base-short} ({N} commits ahead) Scope: {files changed} files | +{insertions} -{deletions}
用途: {从提交信息推断出的该分支用途的一句话描述} 基准: 从{trunk}分支在{merge-base-short}节点分歧(超前{N}个提交) 范围: {变更文件数}个文件 | +{新增行数} -{删除行数}

Changes

变更内容

  • {2-5 bullets summarizing logical changes, grouped by concern}
  • {2-5个要点,按关注点分组总结逻辑变更}

Key Files

关键文件

FileChangeWhat
{path}+n/-n{one-line description}

Next:
  1. Show the full diff
  2. Deep-dive into a specific file
  3. /check
    something specific
undefined
文件变更说明
{路径}+n/-n一行描述

下一步可选操作:
  1. 查看完整差异
  2. 深入分析特定文件
  3. /check
    特定内容
undefined

Step 3B: Present (Trunk Branch)

步骤3B:展示(主干分支)

Output in this exact format:
markdown
undefined
严格按照以下格式输出:
markdown
undefined

WTF: {trunk-branch}

WTF: {主干分支名称}

{N} commits in the last 7 days.
过去7天内有{N}个提交。

Highlights

重点内容

{Day}
  • {hash} {summary} ({author})
{日期}
  • {哈希值} {提交摘要}({作者})

Filtered Out

已过滤内容

{N} routine commits omitted (deps, CI, docs).

What do you want to look at?
  1. A specific commit
  2. A different time range
  3. Changes by a specific author
  4. A specific area of the codebase
undefined
已忽略{N}个常规提交(依赖、CI、文档)。

你想查看什么内容?
  1. 特定提交
  2. 不同的时间范围
  3. 特定作者的变更
  4. 代码库的特定区域
undefined

Guidelines

指导原则

  • This skill is strictly read-only. Never suggest running a write operation.
  • No subagents. This skill is too simple for Task delegation.
  • Parse git output silently and present structured markdown. Never dump raw git output to the user.
  • Keep the total output concise. This is a quick orientation, not a full audit.
  • If focus argument is provided, scope everything to that filter. Report clearly when the filter has no matches.
  • For the Key Files table in feature branch output, limit to the 8 most-changed files. If there are more, add a summary row like "... and {N} more files".
  • 本技能严格为只读模式。绝不建议执行写入操作。
  • 不使用子代理。本技能过于简单,无需任务委托。
  • 静默解析git输出并展示结构化的markdown内容。绝不向用户输出原始git内容。
  • 保持整体输出简洁。这是快速概览,而非完整审计。
  • 如果提供了焦点参数,所有内容都限定在该过滤条件内。当过滤无匹配结果时,需清晰告知用户。
  • 在功能分支输出的“关键文件”表格中,最多展示8个变更最频繁的文件。如果更多,添加一行摘要如“... 以及{N}个其他文件”。