Files
msd-core/get-shit-done/workflows/stats.md
Tom Boucher aaba233f83 fix(#170): migrate workflow fallback hints to @opengsd package (#204)
* fix(#170): update workflow fallback install hint package

* chore(#170): add changeset for workflow fallback hint migration

* fix(#170): mark workflow-hint test as structural text contract
2026-05-24 14:16:30 -04:00

2.7 KiB

Display comprehensive project statistics including phases, plans, requirements, git metrics, and timeline.

<required_reading> Read all files referenced by the invoking prompt's execution_context before starting. </required_reading>

Gather project statistics:
# SDK resolution: prefer local gsd-tools.cjs, fall back to global gsd-sdk (#3668)
GSD_TOOLS="${RUNTIME_DIR:-$(git rev-parse --show-toplevel 2>/dev/null || pwd)}/get-shit-done/bin/gsd-tools.cjs"
if [ -f "$GSD_TOOLS" ]; then
  GSD_SDK="node $GSD_TOOLS"
elif command -v gsd-sdk >/dev/null 2>&1; then
  GSD_SDK="gsd-sdk"
else
  echo "ERROR: gsd-sdk not found on PATH and $GSD_TOOLS does not exist." >&2
  echo "Run: npx -y @opengsd/get-shit-done-redux@latest --claude --local" >&2
  exit 1
fi
STATS=$($GSD_SDK query stats.json)
if [[ "$STATS" == @file:* ]]; then STATS=$(cat "${STATS#@file:}"); fi

Extract fields from JSON: milestone_version, milestone_name, phases, phases_completed, phases_total, total_plans, total_summaries, percent, plan_percent, requirements_total, requirements_complete, git_commits, git_first_commit_date, last_activity.

Present to the user with this format:
# 📊 Project Statistics — {milestone_version} {milestone_name}

## Progress
[████████░░] X/Y phases (Z%)

## Plans
X/Y plans complete (Z%)

## Phases
| Phase | Name | Plans | Completed | Status |
|-------|------|-------|-----------|--------|
| ...   | ...  | ...   | ...       | ...    |

## Requirements
✅ X/Y requirements complete

## Git
- **Commits:** N
- **Started:** YYYY-MM-DD
- **Last activity:** YYYY-MM-DD

## Timeline
- **Project age:** N days

If no .planning/ directory exists, inform the user to run /gsd:new-project first.

**MVP phase summary.** Read all phases via `gsd-sdk query roadmap.analyze` (Phase 1's `cmdRoadmapAnalyze` surfaces a `mode` field per phase). Count phases by mode:
ANALYZE=$($GSD_SDK query roadmap.analyze)
if [[ "$ANALYZE" == @file:* ]]; then ANALYZE=$(cat "${ANALYZE#@file:}"); fi
MVP_COUNT=$(echo "$ANALYZE" | jq '[.phases[] | select(.mode == "mvp")] | length')
TOTAL_COUNT=$(echo "$ANALYZE" | jq '.phases | length')

Emit a summary line in the stats output:

Phases: ${TOTAL_COUNT} total | ${MVP_COUNT} MVP | $((TOTAL_COUNT - MVP_COUNT)) standard

If MVP_COUNT == 0, the project has no MVP-mode phases — omit the line (no clutter for non-MVP projects).

<success_criteria>

  • Statistics gathered from project state
  • Results formatted clearly
  • Displayed to user </success_criteria>