refactor: extract check-todos, add-phase, update to thin orchestrators

Pattern: Command → workflow → gsd-tools
Token savings: ~150 chars per command

Ported from: get-shit-done-v2@213392b
This commit is contained in:
TÂCHES
2026-02-07 11:08:27 -06:00
parent 01ae939c01
commit 8f26bfa478
6 changed files with 616 additions and 577 deletions

View File

@@ -11,197 +11,29 @@ allowed-tools:
<objective>
Add a new integer phase to the end of the current milestone in the roadmap.
This command appends sequential phases to the current milestone's phase list, automatically calculating the next phase number based on existing phases.
Purpose: Add planned work discovered during execution that belongs at the end of current milestone.
Routes to the add-phase workflow which handles:
- Phase number calculation (next sequential integer)
- Directory creation with slug generation
- Roadmap structure updates
- STATE.md roadmap evolution tracking
</objective>
<execution_context>
@.planning/ROADMAP.md
@.planning/STATE.md
@~/.claude/get-shit-done/workflows/add-phase.md
</execution_context>
<process>
**Follow the add-phase workflow** from `@~/.claude/get-shit-done/workflows/add-phase.md`.
<step name="parse_arguments">
Parse the command arguments:
- All arguments become the phase description
- Example: `/gsd:add-phase Add authentication` → description = "Add authentication"
- Example: `/gsd:add-phase Fix critical performance issues` → description = "Fix critical performance issues"
If no arguments provided:
```
ERROR: Phase description required
Usage: /gsd:add-phase <description>
Example: /gsd:add-phase Add authentication system
```
Exit.
</step>
<step name="load_roadmap">
Load the roadmap file:
```bash
if [ -f .planning/ROADMAP.md ]; then
ROADMAP=".planning/ROADMAP.md"
else
echo "ERROR: No roadmap found (.planning/ROADMAP.md)"
exit 1
fi
```
Read roadmap content for parsing.
</step>
<step name="find_current_milestone">
Parse the roadmap to find the current milestone section:
1. Locate the "## Current Milestone:" heading
2. Extract milestone name and version
3. Identify all phases under this milestone (before next "---" separator or next milestone heading)
4. Parse existing phase numbers (including decimals if present)
Example structure:
```
## Current Milestone: v1.0 Foundation
### Phase 4: Focused Command System
### Phase 5: Path Routing & Validation
### Phase 6: Documentation & Distribution
```
</step>
<step name="calculate_next_phase">
Find the highest integer phase number in the current milestone:
1. Extract all phase numbers from phase headings (### Phase N:)
2. Filter to integer phases only (ignore decimals like 4.1, 4.2)
3. Find the maximum integer value
4. Add 1 to get the next phase number
Example: If phases are 4, 5, 5.1, 6 → next is 7
Format as two-digit: `printf "%02d" $next_phase`
</step>
<step name="generate_slug">
Convert the phase description to a kebab-case slug:
```bash
# Example transformation:
# "Add authentication" → "add-authentication"
# "Fix critical performance issues" → "fix-critical-performance-issues"
slug=$(echo "$description" | tr '[:upper:]' '[:lower:]' | sed 's/[^a-z0-9]/-/g' | sed 's/--*/-/g' | sed 's/^-//;s/-$//')
```
Phase directory name: `{two-digit-phase}-{slug}`
Example: `07-add-authentication`
</step>
<step name="create_phase_directory">
Create the phase directory structure:
```bash
phase_dir=".planning/phases/${phase_num}-${slug}"
mkdir -p "$phase_dir"
```
Confirm: "Created directory: $phase_dir"
</step>
<step name="update_roadmap">
Add the new phase entry to the roadmap:
1. Find the insertion point (after last phase in current milestone, before "---" separator)
2. Insert new phase heading:
```
### Phase {N}: {Description}
**Goal:** [To be planned]
**Depends on:** Phase {N-1}
**Plans:** 0 plans
Plans:
- [ ] TBD (run /gsd:plan-phase {N} to break down)
**Details:**
[To be added during planning]
```
3. Write updated roadmap back to file
Preserve all other content exactly (formatting, spacing, other phases).
</step>
<step name="update_project_state">
Update STATE.md to reflect the new phase:
1. Read `.planning/STATE.md`
2. Under "## Current Position" → "**Next Phase:**" add reference to new phase
3. Under "## Accumulated Context" → "### Roadmap Evolution" add entry:
```
- Phase {N} added: {description}
```
If "Roadmap Evolution" section doesn't exist, create it.
</step>
<step name="completion">
Present completion summary:
```
Phase {N} added to current milestone:
- Description: {description}
- Directory: .planning/phases/{phase-num}-{slug}/
- Status: Not planned yet
Roadmap updated: {roadmap-path}
Project state updated: .planning/STATE.md
---
## ▶ Next Up
**Phase {N}: {description}**
`/gsd:plan-phase {N}`
<sub>`/clear` first → fresh context window</sub>
---
**Also available:**
- `/gsd:add-phase <description>` — add another phase
- Review roadmap
---
```
</step>
The workflow handles all logic including:
1. Argument parsing and validation
2. Roadmap existence checking
3. Current milestone identification
4. Next phase number calculation (ignoring decimals)
5. Slug generation from description
6. Phase directory creation
7. Roadmap entry insertion
8. STATE.md updates
</process>
<anti_patterns>
- Don't modify phases outside current milestone
- Don't renumber existing phases
- Don't use decimal numbering (that's /gsd:insert-phase)
- Don't create plans yet (that's /gsd:plan-phase)
- Don't commit changes (user decides when to commit)
</anti_patterns>
<success_criteria>
Phase addition is complete when:
- [ ] Phase directory created: `.planning/phases/{NN}-{slug}/`
- [ ] Roadmap updated with new phase entry
- [ ] STATE.md updated with roadmap evolution note
- [ ] New phase appears at end of current milestone
- [ ] Next phase number calculated correctly (ignoring decimals)
- [ ] User informed of next steps
</success_criteria>

View File

@@ -6,223 +6,36 @@ allowed-tools:
- Read
- Write
- Bash
- Glob
- AskUserQuestion
---
<objective>
List all pending todos, allow selection, load full context for the selected todo, and route to appropriate action.
Enables reviewing captured ideas and deciding what to work on next.
Routes to the check-todos workflow which handles:
- Todo counting and listing with area filtering
- Interactive selection with full context loading
- Roadmap correlation checking
- Action routing (work now, add to phase, brainstorm, create phase)
- STATE.md updates and git commits
</objective>
<context>
<execution_context>
@.planning/STATE.md
@.planning/ROADMAP.md
</context>
@~/.claude/get-shit-done/workflows/check-todos.md
</execution_context>
<process>
**Follow the check-todos workflow** from `@~/.claude/get-shit-done/workflows/check-todos.md`.
<step name="check_exist">
```bash
TODO_COUNT=$(ls .planning/todos/pending/*.md 2>/dev/null | wc -l | tr -d ' ')
echo "Pending todos: $TODO_COUNT"
```
If count is 0:
```
No pending todos.
Todos are captured during work sessions with /gsd:add-todo.
---
Would you like to:
1. Continue with current phase (/gsd:progress)
2. Add a todo now (/gsd:add-todo)
```
Exit.
</step>
<step name="parse_filter">
Check for area filter in arguments:
- `/gsd:check-todos` → show all
- `/gsd:check-todos api` → filter to area:api only
</step>
<step name="list_todos">
```bash
for file in .planning/todos/pending/*.md; do
created=$(grep "^created:" "$file" | cut -d' ' -f2)
title=$(grep "^title:" "$file" | cut -d':' -f2- | xargs)
area=$(grep "^area:" "$file" | cut -d' ' -f2)
echo "$created|$title|$area|$file"
done | sort
```
Apply area filter if specified. Display as numbered list:
```
Pending Todos:
1. Add auth token refresh (api, 2d ago)
2. Fix modal z-index issue (ui, 1d ago)
3. Refactor database connection pool (database, 5h ago)
---
Reply with a number to view details, or:
- `/gsd:check-todos [area]` to filter by area
- `q` to exit
```
Format age as relative time.
</step>
<step name="handle_selection">
Wait for user to reply with a number.
If valid: load selected todo, proceed.
If invalid: "Invalid selection. Reply with a number (1-[N]) or `q` to exit."
</step>
<step name="load_context">
Read the todo file completely. Display:
```
## [title]
**Area:** [area]
**Created:** [date] ([relative time] ago)
**Files:** [list or "None"]
### Problem
[problem section content]
### Solution
[solution section content]
```
If `files` field has entries, read and briefly summarize each.
</step>
<step name="check_roadmap">
```bash
ls .planning/ROADMAP.md 2>/dev/null && echo "Roadmap exists"
```
If roadmap exists:
1. Check if todo's area matches an upcoming phase
2. Check if todo's files overlap with a phase's scope
3. Note any match for action options
</step>
<step name="offer_actions">
**If todo maps to a roadmap phase:**
Use AskUserQuestion:
- header: "Action"
- question: "This todo relates to Phase [N]: [name]. What would you like to do?"
- options:
- "Work on it now" — move to done, start working
- "Add to phase plan" — include when planning Phase [N]
- "Brainstorm approach" — think through before deciding
- "Put it back" — return to list
**If no roadmap match:**
Use AskUserQuestion:
- header: "Action"
- question: "What would you like to do with this todo?"
- options:
- "Work on it now" — move to done, start working
- "Create a phase" — /gsd:add-phase with this scope
- "Brainstorm approach" — think through before deciding
- "Put it back" — return to list
</step>
<step name="execute_action">
**Work on it now:**
```bash
mv ".planning/todos/pending/[filename]" ".planning/todos/done/"
```
Update STATE.md todo count. Present problem/solution context. Begin work or ask how to proceed.
**Add to phase plan:**
Note todo reference in phase planning notes. Keep in pending. Return to list or exit.
**Create a phase:**
Display: `/gsd:add-phase [description from todo]`
Keep in pending. User runs command in fresh context.
**Brainstorm approach:**
Keep in pending. Start discussion about problem and approaches.
**Put it back:**
Return to list_todos step.
</step>
<step name="update_state">
After any action that changes todo count:
```bash
ls .planning/todos/pending/*.md 2>/dev/null | wc -l
```
Update STATE.md "### Pending Todos" section if exists.
</step>
<step name="git_commit">
If todo was moved to done/, commit the change:
**Check planning config:**
```bash
COMMIT_PLANNING_DOCS=$(cat .planning/config.json 2>/dev/null | grep -o '"commit_docs"[[:space:]]*:[[:space:]]*[^,}]*' | grep -o 'true\|false' || echo "true")
git check-ignore -q .planning 2>/dev/null && COMMIT_PLANNING_DOCS=false
```
**If `COMMIT_PLANNING_DOCS=false`:** Skip git operations, log "Todo moved (not committed - commit_docs: false)"
**If `COMMIT_PLANNING_DOCS=true` (default):**
```bash
git add .planning/todos/done/[filename]
git rm --cached .planning/todos/pending/[filename] 2>/dev/null || true
[ -f .planning/STATE.md ] && git add .planning/STATE.md
git commit -m "$(cat <<'EOF'
docs: start work on todo - [title]
Moved to done/, beginning implementation.
EOF
)"
```
Confirm: "Committed: docs: start work on todo - [title]"
</step>
The workflow handles all logic including:
1. Todo existence checking
2. Area filtering
3. Interactive listing and selection
4. Full context loading with file summaries
5. Roadmap correlation checking
6. Action offering and execution
7. STATE.md updates
8. Git commits
</process>
<output>
- Moved todo to `.planning/todos/done/` (if "Work on it now")
- Updated `.planning/STATE.md` (if todo count changed)
</output>
<anti_patterns>
- Don't delete todos — move to done/ when work begins
- Don't start work without moving to done/ first
- Don't create plans from this command — route to /gsd:plan-phase or /gsd:add-phase
</anti_patterns>
<success_criteria>
- [ ] All pending todos listed with title, area, age
- [ ] Area filter applied if specified
- [ ] Selected todo's full context loaded
- [ ] Roadmap context checked for phase match
- [ ] Appropriate actions offered
- [ ] Selected action executed
- [ ] STATE.md updated if todo count changed
- [ ] Changes committed to git (if todo moved to done/)
</success_criteria>

View File

@@ -1,200 +1,37 @@
---
name: gsd:update
description: Update GSD to latest version with changelog display
allowed-tools:
- Bash
- AskUserQuestion
---
<objective>
Check for GSD updates, install if available, and display what changed.
Provides a better update experience than raw `npx get-shit-done-cc` by showing version diff and changelog entries.
Routes to the update workflow which handles:
- Version detection (local vs global installation)
- npm version checking
- Changelog fetching and display
- User confirmation with clean install warning
- Update execution and cache clearing
- Restart reminder
</objective>
<execution_context>
@~/.claude/get-shit-done/workflows/update.md
</execution_context>
<process>
**Follow the update workflow** from `@~/.claude/get-shit-done/workflows/update.md`.
<step name="get_installed_version">
Detect whether GSD is installed locally or globally by checking both locations:
```bash
# Check local first (takes priority)
if [ -f "./.claude/get-shit-done/VERSION" ]; then
cat "./.claude/get-shit-done/VERSION"
echo "LOCAL"
elif [ -f ~/.claude/get-shit-done/VERSION ]; then
cat ~/.claude/get-shit-done/VERSION
echo "GLOBAL"
else
echo "UNKNOWN"
fi
```
Parse output:
- If last line is "LOCAL": installed version is first line, use `--local` flag for update
- If last line is "GLOBAL": installed version is first line, use `--global` flag for update
- If "UNKNOWN": proceed to install step (treat as version 0.0.0)
**If VERSION file missing:**
```
## GSD Update
**Installed version:** Unknown
Your installation doesn't include version tracking.
Running fresh install...
```
Proceed to install step (treat as version 0.0.0 for comparison).
</step>
<step name="check_latest_version">
Check npm for latest version:
```bash
npm view get-shit-done-cc version 2>/dev/null
```
**If npm check fails:**
```
Couldn't check for updates (offline or npm unavailable).
To update manually: `npx get-shit-done-cc --global`
```
STOP here if npm unavailable.
</step>
<step name="compare_versions">
Compare installed vs latest:
**If installed == latest:**
```
## GSD Update
**Installed:** X.Y.Z
**Latest:** X.Y.Z
You're already on the latest version.
```
STOP here if already up to date.
**If installed > latest:**
```
## GSD Update
**Installed:** X.Y.Z
**Latest:** A.B.C
You're ahead of the latest release (development version?).
```
STOP here if ahead.
</step>
<step name="show_changes_and_confirm">
**If update available**, fetch and show what's new BEFORE updating:
1. Fetch changelog (same as fetch_changelog step)
2. Extract entries between installed and latest versions
3. Display preview and ask for confirmation:
```
## GSD Update Available
**Installed:** 1.5.10
**Latest:** 1.5.15
### What's New
────────────────────────────────────────────────────────────
## [1.5.15] - 2026-01-20
### Added
- Feature X
## [1.5.14] - 2026-01-18
### Fixed
- Bug fix Y
────────────────────────────────────────────────────────────
⚠️ **Note:** The installer performs a clean install of GSD folders:
- `commands/gsd/` will be wiped and replaced
- `get-shit-done/` will be wiped and replaced
- `agents/gsd-*` files will be replaced
(Paths are relative to your install location: `~/.claude/` for global, `./.claude/` for local)
Your custom files in other locations are preserved:
- Custom commands not in `commands/gsd/` ✓
- Custom agents not prefixed with `gsd-` ✓
- Custom hooks ✓
- Your CLAUDE.md files ✓
If you've modified any GSD files directly, back them up first.
```
Use AskUserQuestion:
- Question: "Proceed with update?"
- Options:
- "Yes, update now"
- "No, cancel"
**If user cancels:** STOP here.
</step>
<step name="run_update">
Run the update using the install type detected in step 1:
**If LOCAL install:**
```bash
npx get-shit-done-cc --local
```
**If GLOBAL install (or unknown):**
```bash
npx get-shit-done-cc --global
```
Capture output. If install fails, show error and STOP.
Clear the update cache so statusline indicator disappears:
**If LOCAL install:**
```bash
rm -f ./.claude/cache/gsd-update-check.json
```
**If GLOBAL install:**
```bash
rm -f ~/.claude/cache/gsd-update-check.json
```
</step>
<step name="display_result">
Format completion message (changelog was already shown in confirmation step):
```
╔═══════════════════════════════════════════════════════════╗
║ GSD Updated: v1.5.10 → v1.5.15 ║
╚═══════════════════════════════════════════════════════════╝
⚠️ Restart Claude Code to pick up the new commands.
[View full changelog](https://github.com/glittercowboy/get-shit-done/blob/main/CHANGELOG.md)
```
</step>
The workflow handles all logic including:
1. Installed version detection (local/global)
2. Latest version checking via npm
3. Version comparison
4. Changelog fetching and extraction
5. Clean install warning display
6. User confirmation
7. Update execution
8. Cache clearing
</process>
<success_criteria>
- [ ] Installed version read correctly
- [ ] Latest version checked via npm
- [ ] Update skipped if already current
- [ ] Changelog fetched and displayed BEFORE update
- [ ] Clean install warning shown
- [ ] User confirmation obtained
- [ ] Update executed successfully
- [ ] Restart reminder shown
</success_criteria>

View File

@@ -0,0 +1,178 @@
<purpose>
Add a new integer phase to the end of the current milestone in the roadmap. Automatically calculates next phase number, creates phase directory, and updates roadmap structure.
</purpose>
<required_reading>
Read all files referenced by the invoking prompt's execution_context before starting.
</required_reading>
<process>
<step name="parse_arguments">
Parse the command arguments:
- All arguments become the phase description
- Example: `/gsd:add-phase Add authentication` → description = "Add authentication"
- Example: `/gsd:add-phase Fix critical performance issues` → description = "Fix critical performance issues"
If no arguments provided:
```
ERROR: Phase description required
Usage: /gsd:add-phase <description>
Example: /gsd:add-phase Add authentication system
```
Exit.
</step>
<step name="load_roadmap">
Load the roadmap file:
```bash
node ~/.claude/get-shit-done/bin/gsd-tools.js verify-path-exists .planning/ROADMAP.md --raw
```
If false:
```
ERROR: No roadmap found (.planning/ROADMAP.md)
Run /gsd:new-project to initialize.
```
Exit.
Read roadmap content for parsing.
</step>
<step name="find_current_milestone">
Parse the roadmap to find the current milestone section:
1. Locate the "## Current Milestone:" heading
2. Extract milestone name and version
3. Identify all phases under this milestone (before next "---" separator or next milestone heading)
4. Parse existing phase numbers (including decimals if present)
Example structure:
```
## Current Milestone: v1.0 Foundation
### Phase 4: Focused Command System
### Phase 5: Path Routing & Validation
### Phase 6: Documentation & Distribution
```
</step>
<step name="calculate_next_phase">
Find the highest integer phase number in the current milestone:
1. Extract all phase numbers from phase headings (### Phase N:)
2. Filter to integer phases only (ignore decimals like 4.1, 4.2)
3. Find the maximum integer value
4. Add 1 to get the next phase number
Example: If phases are 4, 5, 5.1, 6 → next is 7
Format as two-digit: `printf "%02d" $next_phase`
</step>
<step name="generate_slug">
Convert the phase description to a kebab-case slug:
```bash
slug=$(node ~/.claude/get-shit-done/bin/gsd-tools.js generate-slug "$description" --raw)
```
Phase directory name: `{two-digit-phase}-{slug}`
Example: `07-add-authentication`
</step>
<step name="create_phase_directory">
Create the phase directory structure:
```bash
phase_dir=".planning/phases/${phase_num}-${slug}"
mkdir -p "$phase_dir"
```
Confirm: "Created directory: $phase_dir"
</step>
<step name="update_roadmap">
Add the new phase entry to the roadmap:
1. Find the insertion point (after last phase in current milestone, before "---" separator)
2. Insert new phase heading:
```
### Phase {N}: {Description}
**Goal:** [To be planned]
**Depends on:** Phase {N-1}
**Plans:** 0 plans
Plans:
- [ ] TBD (run /gsd:plan-phase {N} to break down)
**Details:**
[To be added during planning]
```
3. Write updated roadmap back to file
Preserve all other content exactly (formatting, spacing, other phases).
</step>
<step name="update_project_state">
Update STATE.md to reflect the new phase:
1. Read `.planning/STATE.md`
2. Under "## Current Position" → "**Next Phase:**" add reference to new phase
3. Under "## Accumulated Context" → "### Roadmap Evolution" add entry:
```
- Phase {N} added: {description}
```
If "Roadmap Evolution" section doesn't exist, create it.
</step>
<step name="completion">
Present completion summary:
```
Phase {N} added to current milestone:
- Description: {description}
- Directory: .planning/phases/{phase-num}-{slug}/
- Status: Not planned yet
Roadmap updated: .planning/ROADMAP.md
Project state updated: .planning/STATE.md
---
## ▶ Next Up
**Phase {N}: {description}**
`/gsd:plan-phase {N}`
<sub>`/clear` first → fresh context window</sub>
---
**Also available:**
- `/gsd:add-phase <description>` — add another phase
- Review roadmap
---
```
</step>
</process>
<success_criteria>
- [ ] Phase directory created: `.planning/phases/{NN}-{slug}/`
- [ ] Roadmap updated with new phase entry
- [ ] STATE.md updated with roadmap evolution note
- [ ] New phase appears at end of current milestone
- [ ] Next phase number calculated correctly (ignoring decimals)
- [ ] User informed of next steps
</success_criteria>

View File

@@ -0,0 +1,182 @@
<purpose>
List all pending todos, allow selection, load full context for the selected todo, and route to appropriate action.
</purpose>
<required_reading>
Read all files referenced by the invoking prompt's execution_context before starting.
</required_reading>
<process>
<step name="check_exist">
```bash
TODO_COUNT=$(node ~/.claude/get-shit-done/bin/gsd-tools.js list-todos --raw)
echo "Pending todos: $TODO_COUNT"
```
If count is 0:
```
No pending todos.
Todos are captured during work sessions with /gsd:add-todo.
---
Would you like to:
1. Continue with current phase (/gsd:progress)
2. Add a todo now (/gsd:add-todo)
```
Exit.
</step>
<step name="parse_filter">
Check for area filter in arguments:
- `/gsd:check-todos` → show all
- `/gsd:check-todos api` → filter to area:api only
</step>
<step name="list_todos">
```bash
# Get todos JSON
node ~/.claude/get-shit-done/bin/gsd-tools.js list-todos [area]
```
Parse JSON output and display as numbered list:
```
Pending Todos:
1. Add auth token refresh (api, 2d ago)
2. Fix modal z-index issue (ui, 1d ago)
3. Refactor database connection pool (database, 5h ago)
---
Reply with a number to view details, or:
- `/gsd:check-todos [area]` to filter by area
- `q` to exit
```
Format age as relative time from created timestamp.
</step>
<step name="handle_selection">
Wait for user to reply with a number.
If valid: load selected todo, proceed.
If invalid: "Invalid selection. Reply with a number (1-[N]) or `q` to exit."
</step>
<step name="load_context">
Read the todo file completely. Display:
```
## [title]
**Area:** [area]
**Created:** [date] ([relative time] ago)
**Files:** [list or "None"]
### Problem
[problem section content]
### Solution
[solution section content]
```
If `files` field has entries, read and briefly summarize each.
</step>
<step name="check_roadmap">
```bash
node ~/.claude/get-shit-done/bin/gsd-tools.js verify-path-exists .planning/ROADMAP.md --raw
```
If roadmap exists:
1. Check if todo's area matches an upcoming phase
2. Check if todo's files overlap with a phase's scope
3. Note any match for action options
</step>
<step name="offer_actions">
**If todo maps to a roadmap phase:**
Use AskUserQuestion:
- header: "Action"
- question: "This todo relates to Phase [N]: [name]. What would you like to do?"
- options:
- "Work on it now" — move to done, start working
- "Add to phase plan" — include when planning Phase [N]
- "Brainstorm approach" — think through before deciding
- "Put it back" — return to list
**If no roadmap match:**
Use AskUserQuestion:
- header: "Action"
- question: "What would you like to do with this todo?"
- options:
- "Work on it now" — move to done, start working
- "Create a phase" — /gsd:add-phase with this scope
- "Brainstorm approach" — think through before deciding
- "Put it back" — return to list
</step>
<step name="execute_action">
**Work on it now:**
```bash
mv ".planning/todos/pending/[filename]" ".planning/todos/done/"
```
Update STATE.md todo count. Present problem/solution context. Begin work or ask how to proceed.
**Add to phase plan:**
Note todo reference in phase planning notes. Keep in pending. Return to list or exit.
**Create a phase:**
Display: `/gsd:add-phase [description from todo]`
Keep in pending. User runs command in fresh context.
**Brainstorm approach:**
Keep in pending. Start discussion about problem and approaches.
**Put it back:**
Return to list_todos step.
</step>
<step name="update_state">
After any action that changes todo count:
```bash
node ~/.claude/get-shit-done/bin/gsd-tools.js list-todos --raw
```
Update STATE.md "### Pending Todos" section if exists.
</step>
<step name="git_commit">
If todo was moved to done/, commit the change:
```bash
git rm --cached .planning/todos/pending/[filename] 2>/dev/null || true
node ~/.claude/get-shit-done/bin/gsd-tools.js commit "docs: start work on todo - [title]" --files .planning/todos/done/[filename] .planning/STATE.md
```
Tool respects `commit_docs` config and gitignore automatically.
Confirm: "Committed: docs: start work on todo - [title]"
</step>
</process>
<success_criteria>
- [ ] All pending todos listed with title, area, age
- [ ] Area filter applied if specified
- [ ] Selected todo's full context loaded
- [ ] Roadmap context checked for phase match
- [ ] Appropriate actions offered
- [ ] Selected action executed
- [ ] STATE.md updated if todo count changed
- [ ] Changes committed to git (if todo moved to done/)
</success_criteria>

View File

@@ -0,0 +1,197 @@
<purpose>
Check for GSD updates via npm, display changelog for versions between installed and latest, obtain user confirmation, and execute clean installation with cache clearing.
</purpose>
<required_reading>
Read all files referenced by the invoking prompt's execution_context before starting.
</required_reading>
<process>
<step name="get_installed_version">
Detect whether GSD is installed locally or globally by checking both locations:
```bash
# Check local first (takes priority)
if [ -f "./.claude/get-shit-done/VERSION" ]; then
cat "./.claude/get-shit-done/VERSION"
echo "LOCAL"
elif [ -f ~/.claude/get-shit-done/VERSION ]; then
cat ~/.claude/get-shit-done/VERSION
echo "GLOBAL"
else
echo "UNKNOWN"
fi
```
Parse output:
- If last line is "LOCAL": installed version is first line, use `--local` flag for update
- If last line is "GLOBAL": installed version is first line, use `--global` flag for update
- If "UNKNOWN": proceed to install step (treat as version 0.0.0)
**If VERSION file missing:**
```
## GSD Update
**Installed version:** Unknown
Your installation doesn't include version tracking.
Running fresh install...
```
Proceed to install step (treat as version 0.0.0 for comparison).
</step>
<step name="check_latest_version">
Check npm for latest version:
```bash
npm view get-shit-done-cc version 2>/dev/null
```
**If npm check fails:**
```
Couldn't check for updates (offline or npm unavailable).
To update manually: `npx get-shit-done-cc --global`
```
Exit.
</step>
<step name="compare_versions">
Compare installed vs latest:
**If installed == latest:**
```
## GSD Update
**Installed:** X.Y.Z
**Latest:** X.Y.Z
You're already on the latest version.
```
Exit.
**If installed > latest:**
```
## GSD Update
**Installed:** X.Y.Z
**Latest:** A.B.C
You're ahead of the latest release (development version?).
```
Exit.
</step>
<step name="show_changes_and_confirm">
**If update available**, fetch and show what's new BEFORE updating:
1. Fetch changelog from GitHub raw URL
2. Extract entries between installed and latest versions
3. Display preview and ask for confirmation:
```
## GSD Update Available
**Installed:** 1.5.10
**Latest:** 1.5.15
### What's New
────────────────────────────────────────────────────────────
## [1.5.15] - 2026-01-20
### Added
- Feature X
## [1.5.14] - 2026-01-18
### Fixed
- Bug fix Y
────────────────────────────────────────────────────────────
⚠️ **Note:** The installer performs a clean install of GSD folders:
- `commands/gsd/` will be wiped and replaced
- `get-shit-done/` will be wiped and replaced
- `agents/gsd-*` files will be replaced
(Paths are relative to your install location: `~/.claude/` for global, `./.claude/` for local)
Your custom files in other locations are preserved:
- Custom commands not in `commands/gsd/` ✓
- Custom agents not prefixed with `gsd-` ✓
- Custom hooks ✓
- Your CLAUDE.md files ✓
If you've modified any GSD files directly, back them up first.
```
Use AskUserQuestion:
- Question: "Proceed with update?"
- Options:
- "Yes, update now"
- "No, cancel"
**If user cancels:** Exit.
</step>
<step name="run_update">
Run the update using the install type detected in step 1:
**If LOCAL install:**
```bash
npx get-shit-done-cc --local
```
**If GLOBAL install (or unknown):**
```bash
npx get-shit-done-cc --global
```
Capture output. If install fails, show error and exit.
Clear the update cache so statusline indicator disappears:
**If LOCAL install:**
```bash
rm -f ./.claude/cache/gsd-update-check.json
```
**If GLOBAL install:**
```bash
rm -f ~/.claude/cache/gsd-update-check.json
```
</step>
<step name="display_result">
Format completion message (changelog was already shown in confirmation step):
```
╔═══════════════════════════════════════════════════════════╗
║ GSD Updated: v1.5.10 → v1.5.15 ║
╚═══════════════════════════════════════════════════════════╝
⚠️ Restart Claude Code to pick up the new commands.
[View full changelog](https://github.com/glittercowboy/get-shit-done/blob/main/CHANGELOG.md)
```
</step>
</process>
<success_criteria>
- [ ] Installed version read correctly
- [ ] Latest version checked via npm
- [ ] Update skipped if already current
- [ ] Changelog fetched and displayed BEFORE update
- [ ] Clean install warning shown
- [ ] User confirmation obtained
- [ ] Update executed successfully
- [ ] Restart reminder shown
</success_criteria>