Commit changes repo worker

From J-Pster/Psters_AI_Workflow · View interactive version

Commit changes repo worker is an AI agent skill from the GitHub repository J-Pster/Psters_AI_Workflow. Per-repo commit worker. Analyzes ALL changed files independently, groups them by ticket, and makes MULTIPLE focused commits — one per logical group. Spawned in parallel by /pwf-commit-changes (one instance per repo). Never create branches or push.

How to use this skill

Skill file

Commit Changes Repo Worker

A focused, self-contained worker that handles one repository end-to-end:

inspect files → classify each file by ticket → group → make multiple targeted commits → report.

Spawned as a generalPurpose subagent (model: fast) from the /pwf-commit-changes command.

All instances run in parallel (one per repo).


Inputs (provided in the parent prompt)

| Variable | Description |

|---|---|

| REPO_PATH | Absolute path to the git repository |

| REPO_NAME | Short repo name (e.g. frontend, backend) |

| TICKET_LIST | Newline-separated list of TICKET-XXX: title entries |


Step 1 — Discover Changed Files

Run:

git -C <REPO_PATH> status --short

Parse the output to get a list of all changed/untracked files (any status: M, A, D, ??, R, etc.).

If the list is empty → skip to Step 5 (nothing_to_commit).


Step 2 — Analyze Each File Independently

For every file identified in Step 1, fetch its individual diff:

# For tracked/modified/staged files:
git -C <REPO_PATH> diff HEAD -- "<file>"

# If the above returns nothing (e.g. newly staged or untracked):
git -C <REPO_PATH> diff --cached -- "<file>"

For each file, determine:

Matching heuristics:

Build a map: file → TICKET-XXX (or NONE)


Step 3 — Group Files by Ticket

Group all files by their assigned ticket:

Group 1: TICKET-727 → [src/app/features/tasks/components/task-detail/task-detail.component.html]
Group 2: TICKET-726 → [src/app/shared/components/text-input/text-input.component.scss, ...]
Group 3: NONE    → [src/database/migrations/1234567-SomeMigration.ts]

Rules:


Step 4 — Make One Commit Per Group

For each group, in order (ticket groups first, NONE groups last):

4a — Build the commit message

Format: [TICKET-XXXX] <emoji> <type>(<scope>): <subject>

Commit type + emoji reference:

| Emoji | Type | When |

|---|---|---|

| 🚀 | feat | new user-visible feature |

| 🐛 | fix | bug fix |

| ♻️ | refactor | code restructuring, no behaviour change |

| 🎨 | style | SCSS/CSS/formatting only |

| ⚡ | perf | performance improvement |

| ✅ | test | tests only |

| 📝 | docs | documentation |

| 🔧 | chore | maintenance, config, tooling, dependencies |

| 🔒 | security | security fix |

| 🚧 | wip | incomplete / in-progress work |

Rules:

4b — Stage only the files in this group

git -C <REPO_PATH> add -- <file1> <file2> ...

For deleted files and renamed files, git add handles them correctly with --.

4c — Commit

git -C <REPO_PATH> commit -m "$(cat <<'EOF'
<commit_message>
EOF
)"

Repeat Steps 4a–4c for every group before moving to the next.


Step 5 — Report

Reply with exactly this JSON and nothing else:

{
  "repo": "<REPO_NAME>",
  "status": "committed | failed | nothing_to_commit",
  "commits": [
    {
      "ticket": "TICKET-XXX or NONE",
      "message": "[TICKET-727] 🐛 fix(tasks): move back-to-table button to right side",
      "files": ["path/to/file1.ts", "path/to/file2.html"],
      "result": "ok | failed",
      "error": null
    },
    {
      "ticket": "TICKET-726",
      "message": "[TICKET-726] 🐛 fix(text-input): allow clicking inside widget",
      "files": ["path/to/text-input.component.scss"],
      "result": "ok | failed",
      "error": null
    }
  ],
  "error": "<top-level error or null>"
}

Constraints

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.