specstory-project-stats

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

SpecStory Project Stats

SpecStory 项目统计数据

Fetches project statistics from SpecStory's cloud platform, showing contributor counts, session activity, and other project metrics.
从SpecStory的云平台获取项目统计数据,显示贡献者数量、会话活动及其他项目指标。

How It Works

工作原理

  1. Identifies the project via
    .specstory/.project.json
    , git remote, or folder name
  2. Calls the SpecStory Cloud API
  3. Returns project statistics in JSON format
  4. Presents the data in a readable summary
  1. 识别项目,通过
    .specstory/.project.json
    、git远程仓库或文件夹名称
  2. 调用SpecStory Cloud API
  3. 返回JSON格式的项目统计数据
  4. 展示易读的摘要信息

Prerequisites

前提条件

  • Project must be synced to SpecStory Cloud
  • Node.js must be available to run the script
  • 项目必须同步到SpecStory Cloud
  • 必须有Node.js环境来运行脚本

Usage

使用方法

Slash Command

斜杠命令

User saysAction
/specstory-project-stats
Fetch stats for current project
/specstory-project-stats
Same as above (no arguments needed)
用户指令操作
/specstory-project-stats
获取当前项目的统计数据
/specstory-project-stats
同上(无需参数)

Direct Script Usage

直接运行脚本

bash
undefined
bash
undefined

Fetch stats for current project

获取当前项目的统计数据

node skills/specstory-project-stats/scripts/get-stats.js
node skills/specstory-project-stats/scripts/get-stats.js

With custom API endpoint (for development)

使用自定义API端点(用于开发)

SPECSTORY_API_URL=http://localhost:5173 node skills/specstory-project-stats/scripts/get-stats.js
undefined
SPECSTORY_API_URL=http://localhost:5173 node skills/specstory-project-stats/scripts/get-stats.js
undefined

Output

输出

The script outputs JSON with project statistics:
json
{
  "project_id": "specstoryai/agent-skills",
  "sessions": {
    "total": 156,
    "last_30_days": 47,
    "last_7_days": 12
  },
  "contributors": {
    "total": 5,
    "active_last_30_days": 3
  },
  "activity": {
    "first_session": "2025-10-15",
    "last_session": "2026-01-28",
    "avg_sessions_per_week": 8.2
  }
}
脚本输出包含项目统计数据的JSON格式内容:
json
{
  "project_id": "specstoryai/agent-skills",
  "sessions": {
    "total": 156,
    "last_30_days": 47,
    "last_7_days": 12
  },
  "contributors": {
    "total": 5,
    "active_last_30_days": 3
  },
  "activity": {
    "first_session": "2025-10-15",
    "last_session": "2026-01-28",
    "avg_sessions_per_week": 8.2
  }
}

Project ID Resolution

项目ID解析

The script determines project ID in this order:
  1. .specstory/.project.json
    - Uses
    git_id
    or
    workspace_id
    field
  2. Git remote - Extracts repo name from
    origin
    remote URL
  3. Folder name - Falls back to current directory name
脚本按以下顺序确定项目ID:
  1. .specstory/.project.json
    - 使用
    git_id
    workspace_id
    字段
  2. Git远程仓库 - 从
    origin
    远程URL中提取仓库名称
  3. 文件夹名称 - 退而求其次使用当前目录名称

Error Handling

错误处理

ErrorMeaningAction
404Project not foundProject needs to sync to SpecStory Cloud first
401UnauthorizedAPI endpoint may require authentication
Network errorCan't reach APICheck internet connection
错误含义操作
404项目未找到项目需要先同步到SpecStory Cloud
401未授权API端点可能需要身份验证
网络错误无法连接API检查网络连接

Present Results to User

向用户展示结果

After fetching stats, present them in a friendly format:
获取统计数据后,以友好格式展示:

Example Response (success)

示例响应(成功)

Here are the stats for **specstoryai/agent-skills**:

**Sessions**
- Total: 156 sessions captured
- Last 30 days: 47 sessions
- Last 7 days: 12 sessions

**Contributors**
- Total: 5 contributors
- Active recently: 3

**Activity**
- First session: October 15, 2025
- Most recent: January 28, 2026
- Average: ~8 sessions per week

Your project has been actively using AI-assisted coding!
以下是**specstoryai/agent-skills**的统计数据:

**会话统计**
- 总计:已捕获156次会话
- 近30天:47次会话
- 近7天:12次会话

**贡献者统计**
- 总计:5位贡献者
- 近期活跃:3位

**活动情况**
- 首次会话:2025年10月15日
- 最近会话:2026年1月28日
- 平均值:每周约8次会话

你的项目一直在积极使用AI辅助编码!

Example Response (404 error)

示例响应(404错误)

This project doesn't exist on SpecStory Cloud yet.

To get started:
1. Make sure you have SpecStory installed
2. Run `specstory sync` to push your local sessions to the cloud
3. Try this command again

Need help? Check the docs at https://docs.specstory.com
该项目尚未在SpecStory Cloud上存在。

开始使用步骤:
1. 确保你已安装SpecStory
2. 运行`specstory sync`将本地会话推送到云端
3. 再次尝试此命令

需要帮助?查看文档:https://docs.specstory.com

Environment Variables

环境变量

VariableDefaultDescription
SPECSTORY_API_URL
https://cloud.specstory.com
API endpoint
变量默认值描述
SPECSTORY_API_URL
https://cloud.specstory.com
API端点地址

Notes

注意事项

  • Statistics are fetched from SpecStory Cloud, not local history
  • Project must have synced sessions to show meaningful stats
  • The API is public and doesn't require authentication for basic stats
  • 统计数据从SpecStory Cloud获取,而非本地历史记录
  • 项目必须已同步会话才能显示有意义的统计数据
  • 该API是公开的,基础统计数据无需身份验证