feat(workflows): review uncommitted changes and add git safety rails (#684)
This commit is contained in:
@@ -65,6 +65,11 @@ steps:
|
||||
|
||||
{{task_prompt}}
|
||||
|
||||
GIT SAFETY (read before running any git command)
|
||||
- NEVER run `git checkout -- .`, `git checkout .`, `git reset --hard`, `git clean -fd`, or `git stash --include-untracked`. These wipe uncommitted work.
|
||||
- When reverting files touched by formatters/linters, ALWAYS pass explicit paths (e.g. `git checkout -- path/to/file path/to/dir/`). Never use `.` or unscoped globs.
|
||||
- Treat any uncommitted changes you did not make as intentional user work — leave them in place. Do not revert, stash, or overwrite them.
|
||||
|
||||
STEP 0: CREATE A TASK LIST
|
||||
Before anything else, create a task list tracking the substeps below (use your todo/task tracking tool if available). Mark each task in_progress when you begin it and completed when you finish. Do not skip ahead — each step feeds the next.
|
||||
|
||||
@@ -92,11 +97,11 @@ steps:
|
||||
- If a fix requires an architectural change (new DB table, new service layer, switching libraries): stop and ask.
|
||||
- After 3 failed fix attempts on the same issue: stop, question the approach, ask the user.
|
||||
|
||||
STEP 4: ENSURE EVERYTHING IS COMMITTED
|
||||
STEP 4: ENSURE YOUR OWN CHANGES ARE COMMITTED
|
||||
Before finishing this phase:
|
||||
- Run `git status` to confirm there are no uncommitted or untracked changes that belong to this task.
|
||||
- If anything is left, stage and commit it with a descriptive message.
|
||||
- The phase is only complete when `git status` shows a clean tree on the task branch.
|
||||
- Run `git status` to see what changed.
|
||||
- Stage and commit every file YOU created or modified for this task, using explicit paths (see GIT SAFETY). Use descriptive messages.
|
||||
- Any uncommitted or untracked changes you did not make are intentional user work — leave them as-is. Do not aim for an absolutely clean tree; aim for none of YOUR task-related edits to be uncommitted.
|
||||
events:
|
||||
on_enter:
|
||||
- type: auto_start_agent
|
||||
@@ -113,14 +118,26 @@ steps:
|
||||
|
||||
{{task_prompt}}
|
||||
|
||||
GIT SAFETY (read before running any git command)
|
||||
- NEVER run `git checkout -- .`, `git checkout .`, `git reset --hard`, `git clean -fd`, or `git stash --include-untracked`. These wipe uncommitted work.
|
||||
- When reverting files touched by formatters/linters, ALWAYS pass explicit paths (e.g. `git checkout -- path/to/file path/to/dir/`). Never use `.` or unscoped globs.
|
||||
- Treat any uncommitted changes you did not make as intentional user work — leave them in place. Do not revert, stash, or overwrite them.
|
||||
|
||||
STEP 0: CREATE A TASK LIST
|
||||
Before anything else, create a task list tracking the substeps below (use your todo/task tracking tool if available). Mark each task in_progress when you begin it and completed when you finish. Do not skip ahead — each step feeds the next.
|
||||
|
||||
STEP 1: DETERMINE WHAT TO REVIEW
|
||||
Determine the default branch (e.g. main, master) and diff against it:
|
||||
- Run: git remote show origin | grep 'HEAD branch' to find the default branch name
|
||||
- Run: git diff origin/<default_branch>...HEAD --name-only to get the list of changed files
|
||||
Read each changed file in full — understand the surrounding code, not just the diff.
|
||||
Gather BOTH committed and uncommitted changes on this branch — uncommitted edits and untracked files are still part of the task's work and must be reviewed. Do not commit or discard them yourself.
|
||||
|
||||
- Run: git status --short (see uncommitted modified + untracked files)
|
||||
- Run: git remote show origin | grep 'HEAD branch' (find the default branch name)
|
||||
- Run: git diff origin/<default_branch>...HEAD --name-only (committed changes on branch)
|
||||
- Run: git diff HEAD --name-only (uncommitted tracked changes)
|
||||
- Run: git ls-files --others --exclude-standard (untracked new files)
|
||||
|
||||
The review scope is the UNION of those lists. Read each file from the working tree — the working tree already contains the latest state including uncommitted edits. For per-file diffs against the default branch (including uncommitted changes), use: `git diff origin/<default_branch> -- <file>` (no three-dot).
|
||||
|
||||
If this still yields an empty set, report that there is nothing to review and stop — do not fabricate findings.
|
||||
|
||||
STEP 2: REVIEW THE CHANGES
|
||||
Review across these layers (skip layers that don't apply):
|
||||
@@ -155,8 +172,8 @@ steps:
|
||||
STEP 4: COMMIT ANY FIXES YOU MADE
|
||||
If you made direct fixes in STEP 3:
|
||||
- Run `git status` to see what changed.
|
||||
- Stage and commit the fixes with a descriptive message (e.g. `review: remove dead code` or `review: early returns in X`).
|
||||
- Do not leave the tree dirty — QA runs next and must see a clean state.
|
||||
- Stage only the files YOU edited, using explicit paths (see GIT SAFETY) — never `git add .`. Commit with a descriptive message (e.g. `review: remove dead code` or `review: early returns in X`).
|
||||
- Leave any other uncommitted or untracked files alone; they are the user's work and QA will exercise them from the working tree.
|
||||
events:
|
||||
on_enter:
|
||||
- type: reset_agent_context
|
||||
@@ -174,6 +191,11 @@ steps:
|
||||
|
||||
{{task_prompt}}
|
||||
|
||||
GIT SAFETY (read before running any git command)
|
||||
- NEVER run `git checkout -- .`, `git checkout .`, `git reset --hard`, `git clean -fd`, or `git stash --include-untracked`. These wipe uncommitted work.
|
||||
- When reverting files touched by formatters/linters, ALWAYS pass explicit paths (e.g. `git checkout -- path/to/file path/to/dir/`). Never use `.` or unscoped globs.
|
||||
- Treat any uncommitted changes you did not make as intentional user work — leave them in place. Do not revert, stash, or overwrite them.
|
||||
|
||||
STEP 0: CREATE A TASK LIST
|
||||
Before anything else, create a task list tracking the substeps below (use your todo/task tracking tool if available). Mark each task in_progress when you begin it and completed when you finish. Do not skip ahead — each step feeds the next.
|
||||
|
||||
@@ -219,12 +241,17 @@ steps:
|
||||
|
||||
{{task_prompt}}
|
||||
|
||||
GIT SAFETY (read before running any git command)
|
||||
- NEVER run `git checkout -- .`, `git checkout .`, `git reset --hard`, `git clean -fd`, or `git stash --include-untracked`. These wipe uncommitted work.
|
||||
- When reverting files touched by formatters/linters, ALWAYS pass explicit paths (e.g. `git checkout -- path/to/file path/to/dir/`). Never use `.` or unscoped globs.
|
||||
- Treat any uncommitted changes you did not make as intentional user work — leave them in place. Do not revert, stash, or overwrite them.
|
||||
|
||||
STEP 0: CREATE A TASK LIST
|
||||
Before anything else, create a task list tracking the substeps below (use your todo/task tracking tool if available). Mark each task in_progress when you begin it and completed when you finish. Do not skip ahead — each step feeds the next.
|
||||
|
||||
STEP 1: PREPARE
|
||||
- Run formatters and linters to ensure code is clean.
|
||||
- Stage and commit any remaining changes.
|
||||
- Run formatters and linters. If they touch files unrelated to your task, selectively restore them with `git checkout -- <specific-paths>` (see GIT SAFETY) — never `git checkout -- .`.
|
||||
- Stage and commit any remaining task-related changes using explicit paths — never `git add .`. Leave uncommitted or untracked files you did not create untouched; they are the user's work.
|
||||
- Push the branch to origin.
|
||||
|
||||
STEP 2: CHECK FOR PR TEMPLATE
|
||||
@@ -260,6 +287,11 @@ steps:
|
||||
|
||||
{{task_prompt}}
|
||||
|
||||
GIT SAFETY (read before running any git command)
|
||||
- NEVER run `git checkout -- .`, `git checkout .`, `git reset --hard`, `git clean -fd`, or `git stash --include-untracked`. These wipe uncommitted work.
|
||||
- When reverting files touched by formatters/linters, ALWAYS pass explicit paths (e.g. `git checkout -- path/to/file path/to/dir/`). Never use `.` or unscoped globs.
|
||||
- Treat any uncommitted changes you did not make as intentional user work — leave them in place. Do not revert, stash, or overwrite them.
|
||||
|
||||
STEP 0: CREATE A TASK LIST
|
||||
Before anything else, create a task list tracking the substeps below (use your todo/task tracking tool if available). Mark each task in_progress when you begin it and completed when you finish. Do not skip ahead — each step feeds the next.
|
||||
|
||||
|
||||
@@ -66,6 +66,11 @@ steps:
|
||||
|
||||
{{task_prompt}}
|
||||
|
||||
GIT SAFETY (read before running any git command)
|
||||
- NEVER run `git checkout -- .`, `git checkout .`, `git reset --hard`, `git clean -fd`, or `git stash --include-untracked`. These wipe uncommitted work.
|
||||
- When reverting files touched by formatters/linters, ALWAYS pass explicit paths (e.g. `git checkout -- path/to/file path/to/dir/`). Never use `.` or unscoped globs.
|
||||
- Treat any uncommitted changes you did not make as intentional user work — leave them in place. Do not revert, stash, or overwrite them.
|
||||
|
||||
STEP 0: CREATE A TASK LIST
|
||||
Before anything else, create a task list tracking the substeps below (use your todo/task tracking tool if available). Mark each task in_progress when you begin it and completed when you finish. Do not skip ahead — each step feeds the next.
|
||||
|
||||
@@ -92,11 +97,11 @@ steps:
|
||||
- If a fix requires an architectural change (new DB table, new service layer, switching libraries): stop and ask.
|
||||
- After 3 failed fix attempts on the same issue: stop, question the approach, ask the user.
|
||||
|
||||
STEP 4: ENSURE EVERYTHING IS COMMITTED
|
||||
STEP 4: ENSURE YOUR OWN CHANGES ARE COMMITTED
|
||||
Before finishing this phase:
|
||||
- Run `git status` to confirm there are no uncommitted or untracked changes that belong to this task.
|
||||
- If anything is left, stage and commit it with a descriptive message.
|
||||
- The phase is only complete when `git status` shows a clean tree on the task branch.
|
||||
- Run `git status` to see what changed.
|
||||
- Stage and commit every file YOU created or modified for this task, using explicit paths (see GIT SAFETY). Use descriptive messages.
|
||||
- Any uncommitted or untracked changes you did not make are intentional user work — leave them as-is. Do not aim for an absolutely clean tree; aim for none of YOUR task-related edits to be uncommitted.
|
||||
events:
|
||||
on_enter:
|
||||
- type: auto_start_agent
|
||||
|
||||
Reference in New Issue
Block a user