clawsights

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Clawsights — Upload Your Claude Code Stats

Clawsights — 上传你的Claude Code统计数据

Before starting, create a task list with these items so the user can see progress:
  1. Get GitHub identity
  2. Generate insights report
  3. Read and preview report
  4. Confirm upload preferences
  5. Upload to Clawsights
  6. Show results
Mark each task as in_progress when you start it and completed when done. Follow these steps exactly:
开始之前,创建一个包含以下项的任务列表,以便用户可以查看进度:
  1. 获取GitHub身份信息
  2. 生成洞察报告
  3. 读取并预览报告
  4. 确认上传偏好设置
  5. 上传至Clawsights
  6. 展示结果
开始执行每个任务时标记为“进行中”,完成后标记为“已完成”。请严格按照以下步骤操作:

Step 1: Get GitHub Identity

步骤1:获取GitHub身份信息

Tell the user: "I'll grab your GitHub identity so Clawsights can create your profile at clawsights.dev/{handle}."
Run these commands to get the user's GitHub handle and auth token:
bash
gh api user --jq '.login'
bash
gh auth token
If
gh
is not installed or the user is not logged in, tell them:
Store the handle and token for later use. Do not show the token to the user.
告知用户:“我将获取你的GitHub身份信息,以便Clawsights在clawsights.dev/{handle}为你创建个人资料。”
运行以下命令获取用户的GitHub用户名和认证令牌:
bash
gh api user --jq '.login'
bash
gh auth token
如果未安装
gh
或用户未登录,请告知他们:
保存用户名和令牌以备后用,不要向用户展示令牌。

Step 2: Run /insights

步骤2:运行/insights

Run the
/insights
skill to generate a fresh report. Wait for it to complete fully.
运行
/insights
技能以生成一份全新的报告,等待其完全完成。

Step 3: Read the Report

步骤3:读取报告

Read the file at
~/.claude/usage-data/report.html
.
Also extract the subtitle line for the preview. It looks like:
<p class="subtitle">38,539 messages across 4769 sessions | 2025-12-19 to 2026-02-09</p>
读取位于
~/.claude/usage-data/report.html
的文件。
同时提取副标题行用于预览,格式如下:
<p class="subtitle">38,539 messages across 4769 sessions | 2025-12-19 to 2026-02-09</p>

Step 4: Show Preview and Ask About Narratives

步骤4:展示预览并询问叙事内容相关问题

Display a preview of what will appear on their profile. Extract these from the report HTML and show them:
=== Clawsights Upload Preview ===
GitHub: @{handle}
Date range: {date_from} to {date_to}

Messages:      {totalMessages}
Sessions:      {totalSessions}
Lines Changed: +{linesAdded} / -{linesRemoved}
Days Active:   {daysActive}
Msgs/Day:      {msgsPerDay}
Files Touched: {filesTouched}
Top Languages: {top 3 languages from the chart}

How You Use Claude Code:
  {first 3 lines of the usage narrative, followed by "..."}

Impressive Things You Did:
  {first 3 win titles, followed by "..."}

This will be publicly visible at clawsights.dev/{handle}
Omit any section that has no data. Then use the AskUserQuestion tool to ask TWO questions:
Question 1: "Include narrative sections on your public profile?"
  • Options:
    • "Yes" — Include "How You Use Claude Code" and "Impressive Things You Did" sections on your profile
    • "No" — Only show quantitative stats (messages, lines, languages, etc.)
Question 2: "Ready to upload?"
  • Options:
    • "Upload" — Upload stats to clawsights.dev
    • "Cancel" — Don't upload anything
If they choose Cancel, stop here.
Store whether they chose to include narratives as
include_narratives
(true/false).
展示将出现在个人资料中的预览内容,从报告HTML中提取以下信息并展示:
=== Clawsights上传预览 ===
GitHub: @{handle}
日期范围: {date_from} 至 {date_to}

消息总数:      {totalMessages}
会话总数:      {totalSessions}
代码行数变更: +{linesAdded} / -{linesRemoved}
活跃天数:   {daysActive}
日均消息数:      {msgsPerDay}
涉及文件数: {filesTouched}
Top编程语言: {图表中的前3种语言}

你的Claude Code使用方式:
  {使用叙事的前3行内容,后跟“...”}

你完成的亮眼成果:
  {前3个成果标题,后跟“...”}

此内容将在clawsights.dev/{handle}公开可见
省略任何无数据的部分。然后使用AskUserQuestion工具询问两个问题:
问题1: "是否在公开个人资料中包含叙事部分?"
  • 选项:
    • "是" — 在个人资料中包含“你的Claude Code使用方式”和“你完成的亮眼成果”部分
    • "否" — 仅展示量化统计数据(消息数、代码行数、编程语言等)
问题2: "是否准备好上传?"
  • 选项:
    • "上传" — 将统计数据上传至clawsights.dev
    • "取消" — 不进行任何上传
如果用户选择取消,在此处停止操作。
将用户是否选择包含叙事内容保存为
include_narratives
(true/false)。

Step 5: Upload

步骤5:上传

First, determine the upload URL. Run this command and use the output as the base URL:
bash
echo ${CLAWSIGHTS_URL:-https://clawsights.dev}
Then make a POST request using that base URL:
bash
curl -s -X POST BASE_URL/api/upload \
  -H "Content-Type: application/json" \
  -d "{\"github_token\": \"TOKEN_HERE\", \"report_html\": $(cat ~/.claude/usage-data/report.html | jq -Rs .), \"include_narratives\": BOOLEAN_HERE}"
Replace
BASE_URL
with the output from the echo command above. Replace
TOKEN_HERE
with the actual token from Step 1. Replace
BOOLEAN_HERE
with
true
or
false
based on the user's choice in Step 4.
首先确定上传URL,运行以下命令并将输出作为基础URL:
bash
echo ${CLAWSIGHTS_URL:-https://clawsights.dev}
然后使用该基础URL发起POST请求:
bash
curl -s -X POST BASE_URL/api/upload \
  -H "Content-Type: application/json" \
  -d "{\"github_token\": \"TOKEN_HERE\", \"report_html\": $(cat ~/.claude/usage-data/report.html | jq -Rs .), \"include_narratives\": BOOLEAN_HERE}"
BASE_URL
替换为上述echo命令的输出。 将
TOKEN_HERE
替换为步骤1中获取的实际令牌。 将
BOOLEAN_HERE
替换为用户在步骤4中选择的
true
false

Step 6: Show Result

步骤6:展示结果

Parse the JSON response and display:
Uploaded! View your profile: https://clawsights.dev/{handle}

Your percentiles:
  Messages: top {X}%
  Sessions: top {X}%
  Velocity: top {X}%
  Scale: top {X}%
  Multi-clauding: top {X}%
If the upload fails, show the error message from the response.
解析JSON响应并展示:
上传完成!查看你的个人资料: https://clawsights.dev/{handle}

你的百分位排名:
  消息数: 前 {X}%
  会话数: 前 {X}%
  处理速度: 前 {X}%
  规模: 前 {X}%
  多Claude协作: 前 {X}%
如果上传失败,展示响应中的错误信息。