From 823772ff0b67fd0fe59cba3ccd35a4a8025a0572 Mon Sep 17 00:00:00 2001 From: Garry Tan Date: Thu, 19 Mar 2026 00:14:59 -0500 Subject: [PATCH] feat: use AskUserQuestion for dirty working tree (v0.7.4) (#200) * feat: use AskUserQuestion for dirty working tree check Replace hard exit 1 with interactive AskUserQuestion prompt offering commit/stash/abort options when /qa or /design-review detects a dirty working tree. * chore: bump version and changelog (v0.7.4) Co-Authored-By: Claude Opus 4.6 --------- Co-authored-by: Claude Opus 4.6 --- CHANGELOG.md | 6 ++++++ VERSION | 2 +- design-review/SKILL.md | 21 +++++++++++++++------ design-review/SKILL.md.tmpl | 21 +++++++++++++++------ qa/SKILL.md | 22 ++++++++++++++++------ qa/SKILL.md.tmpl | 22 ++++++++++++++++------ 6 files changed, 69 insertions(+), 25 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f84810f9..876fedbf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # Changelog +## [0.7.4] - 2026-03-18 + +### Changed + +- **`/qa` and `/design-review` now ask what to do with uncommitted changes** instead of refusing to start. When your working tree is dirty, you get an interactive prompt with three options: commit your changes, stash them, or abort. No more cryptic "ERROR: Working tree is dirty" followed by a wall of text. + ## [0.7.3] - 2026-03-18 ### Added diff --git a/VERSION b/VERSION index f38fc539..0a1ffad4 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.7.3 +0.7.4 diff --git a/design-review/SKILL.md b/design-review/SKILL.md index ed45f1ea..572a64f0 100644 --- a/design-review/SKILL.md +++ b/design-review/SKILL.md @@ -181,15 +181,24 @@ You are a senior product designer AND a frontend engineer. Review live sites wit Look for `DESIGN.md`, `design-system.md`, or similar in the repo root. If found, read it — all design decisions must be calibrated against it. Deviations from the project's stated design system are higher severity. If not found, use universal design principles and offer to create one from the inferred system. -**Require clean working tree before starting:** +**Check for clean working tree:** ```bash -if [ -n "$(git status --porcelain)" ]; then - echo "ERROR: Working tree is dirty. Commit or stash changes before running /design-review." - exit 1 -fi +git status --porcelain ``` +If the output is non-empty (working tree is dirty), **STOP** and use AskUserQuestion: + +"Your working tree has uncommitted changes. /design-review needs a clean tree so each design fix gets its own atomic commit." + +- A) Commit my changes — commit all current changes with a descriptive message, then start design review +- B) Stash my changes — stash, run design review, pop the stash after +- C) Abort — I'll clean up manually + +RECOMMENDATION: Choose A because uncommitted work should be preserved as a commit before design review adds its own fix commits. + +After the user chooses, execute their choice (commit or stash), then continue with setup. + **Find the browse binary:** ## SETUP (run this check BEFORE any browse command) @@ -879,7 +888,7 @@ If the repo has a `TODOS.md`: ## Additional Rules (design-review specific) -11. **Clean working tree required.** Refuse to start if `git status --porcelain` is non-empty. +11. **Clean working tree required.** If dirty, use AskUserQuestion to offer commit/stash/abort before proceeding. 12. **One commit per fix.** Never bundle multiple design fixes into one commit. 13. **Only modify tests when generating regression tests in Phase 8e.5.** Never modify CI configuration. Never modify existing tests — only create new test files. 14. **Revert on regression.** If a fix makes things worse, `git revert HEAD` immediately. diff --git a/design-review/SKILL.md.tmpl b/design-review/SKILL.md.tmpl index 24fe160c..7e157287 100644 --- a/design-review/SKILL.md.tmpl +++ b/design-review/SKILL.md.tmpl @@ -45,15 +45,24 @@ You are a senior product designer AND a frontend engineer. Review live sites wit Look for `DESIGN.md`, `design-system.md`, or similar in the repo root. If found, read it — all design decisions must be calibrated against it. Deviations from the project's stated design system are higher severity. If not found, use universal design principles and offer to create one from the inferred system. -**Require clean working tree before starting:** +**Check for clean working tree:** ```bash -if [ -n "$(git status --porcelain)" ]; then - echo "ERROR: Working tree is dirty. Commit or stash changes before running /design-review." - exit 1 -fi +git status --porcelain ``` +If the output is non-empty (working tree is dirty), **STOP** and use AskUserQuestion: + +"Your working tree has uncommitted changes. /design-review needs a clean tree so each design fix gets its own atomic commit." + +- A) Commit my changes — commit all current changes with a descriptive message, then start design review +- B) Stash my changes — stash, run design review, pop the stash after +- C) Abort — I'll clean up manually + +RECOMMENDATION: Choose A because uncommitted work should be preserved as a commit before design review adds its own fix commits. + +After the user chooses, execute their choice (commit or stash), then continue with setup. + **Find the browse binary:** {{BROWSE_SETUP}} @@ -245,7 +254,7 @@ If the repo has a `TODOS.md`: ## Additional Rules (design-review specific) -11. **Clean working tree required.** Refuse to start if `git status --porcelain` is non-empty. +11. **Clean working tree required.** If dirty, use AskUserQuestion to offer commit/stash/abort before proceeding. 12. **One commit per fix.** Never bundle multiple design fixes into one commit. 13. **Only modify tests when generating regression tests in Phase 8e.5.** Never modify CI configuration. Never modify existing tests — only create new test files. 14. **Revert on regression.** If a fix makes things worse, `git revert HEAD` immediately. diff --git a/qa/SKILL.md b/qa/SKILL.md index a8a730c3..8d0abe7d 100644 --- a/qa/SKILL.md +++ b/qa/SKILL.md @@ -202,14 +202,24 @@ You are a QA engineer AND a bug-fix engineer. Test web applications like a real **If no URL is given and you're on a feature branch:** Automatically enter **diff-aware mode** (see Modes below). This is the most common case — the user just shipped code on a branch and wants to verify it works. -**Require clean working tree before starting:** +**Check for clean working tree:** + ```bash -if [ -n "$(git status --porcelain)" ]; then - echo "ERROR: Working tree is dirty. Commit or stash changes before running /qa." - exit 1 -fi +git status --porcelain ``` +If the output is non-empty (working tree is dirty), **STOP** and use AskUserQuestion: + +"Your working tree has uncommitted changes. /qa needs a clean tree so each bug fix gets its own atomic commit." + +- A) Commit my changes — commit all current changes with a descriptive message, then start QA +- B) Stash my changes — stash, run QA, pop the stash after +- C) Abort — I'll clean up manually + +RECOMMENDATION: Choose A because uncommitted work should be preserved as a commit before QA adds its own fix commits. + +After the user chooses, execute their choice (commit or stash), then continue with setup. + **Find the browse binary:** ## SETUP (run this check BEFORE any browse command) @@ -894,7 +904,7 @@ If the repo has a `TODOS.md`: ## Additional Rules (qa-specific) -11. **Clean working tree required.** Refuse to start if `git status --porcelain` is non-empty. +11. **Clean working tree required.** If dirty, use AskUserQuestion to offer commit/stash/abort before proceeding. 12. **One commit per fix.** Never bundle multiple fixes into one commit. 13. **Only modify tests when generating regression tests in Phase 8e.5.** Never modify CI configuration. Never modify existing tests — only create new test files. 14. **Revert on regression.** If a fix makes things worse, `git revert HEAD` immediately. diff --git a/qa/SKILL.md.tmpl b/qa/SKILL.md.tmpl index 292f7140..eae79605 100644 --- a/qa/SKILL.md.tmpl +++ b/qa/SKILL.md.tmpl @@ -49,14 +49,24 @@ You are a QA engineer AND a bug-fix engineer. Test web applications like a real **If no URL is given and you're on a feature branch:** Automatically enter **diff-aware mode** (see Modes below). This is the most common case — the user just shipped code on a branch and wants to verify it works. -**Require clean working tree before starting:** +**Check for clean working tree:** + ```bash -if [ -n "$(git status --porcelain)" ]; then - echo "ERROR: Working tree is dirty. Commit or stash changes before running /qa." - exit 1 -fi +git status --porcelain ``` +If the output is non-empty (working tree is dirty), **STOP** and use AskUserQuestion: + +"Your working tree has uncommitted changes. /qa needs a clean tree so each bug fix gets its own atomic commit." + +- A) Commit my changes — commit all current changes with a descriptive message, then start QA +- B) Stash my changes — stash, run QA, pop the stash after +- C) Abort — I'll clean up manually + +RECOMMENDATION: Choose A because uncommitted work should be preserved as a commit before QA adds its own fix commits. + +After the user chooses, execute their choice (commit or stash), then continue with setup. + **Find the browse binary:** {{BROWSE_SETUP}} @@ -300,7 +310,7 @@ If the repo has a `TODOS.md`: ## Additional Rules (qa-specific) -11. **Clean working tree required.** Refuse to start if `git status --porcelain` is non-empty. +11. **Clean working tree required.** If dirty, use AskUserQuestion to offer commit/stash/abort before proceeding. 12. **One commit per fix.** Never bundle multiple fixes into one commit. 13. **Only modify tests when generating regression tests in Phase 8e.5.** Never modify CI configuration. Never modify existing tests — only create new test files. 14. **Revert on regression.** If a fix makes things worse, `git revert HEAD` immediately.