Skip to content
Development
Command

/commit

Create well-organized commits with automatic code cleanup and documentation updates.

From plugin
jat
24836 skills36 commands
Install
$ npx -y skills add joewinke/jat --agent claude-code

How it fires

How this command gets triggered: by you, by Claude, or both.

  • Fires itselfClaude auto-loads it when your prompt matches the work.
  • You can call itInvoke it directly when you want it.
  • Slash command/commit

Context preview

What this command does when you run it.

Create well-organized commits with automatic code cleanup and documentation updates.

Command definition

commit.md
author: Developer

Create well-organized commits with automatic code cleanup and documentation updates.

Git Commit

**Purpose:** Intelligently commit changes with proper organization, cleanup, and documentation.

**Usage:**

  • `/jat/commit` or `/jat/commit session` - Commit only your session work (filters out others' changes)
  • `/jat/commit all` - Commit everything in source control (clean slate)
  • `/jat/commit --generate` or `/jat/commit session --generate` - Session commit with LLM-generated message draft
  • `/jat/commit all --generate` - All-changes commit with LLM-generated message draft

---

Mode: Session (Default)

**Use when:**

  • Multiple developers working, source control has mixed changes
  • You want to commit only what YOU worked on
  • There are unrelated edits from other agents/developers to ignore

**What it does:** 1. Identifies changes from YOUR session (filters out others) 2. Groups into logical commits by feature/fix 3. Reviews and cleans up code 4. Updates documentation 5. Creates commits via git-commit-assistant

---

Mode: All

**Use when:**

  • You're the only one working (or you want everything)
  • Source control is messy and you want clean slate
  • You know ALL changes are intentional

**What it does:** 1. Reviews ALL changes in working directory 2. Groups into logical commits by feature/fix 3. Reviews and cleans up code 4. Updates documentation 5. Creates commits via git-commit-assistant

---

Option: --generate (LLM-Assisted Message)

When `--generate` is included in `$ARGUMENTS`, auto-generate a commit message draft using local inference before committing. Works with both `session` and `all` modes.

**Flow:** 1. Collect staged diff + recent commit log + task context 2. Try local LLM (gemma4:latest) via `http://localhost:3333/api/local-llm/generate-commit-message` 3. Fall back to Claude (you, the AI) if local fails or diff exceeds ~40,000 chars (~12K tokens) 4. Present draft to user for review via `AskUserQuestion` before committing

**Commit format:** `<type>(<task-id>): <one imperative sentence>`

  • Type: `feat`, `fix`, `task`, `bug`, `chore`, `docs`, `refactor`, `test`
  • task-id: from active task context (e.g. `jat-jl2ud.7`)

---

Execution Steps

PRE-STEP: LLM-Assisted Message Generation (--generate flag only)

**Only run this section if `--generate` appears in `$ARGUMENTS`.**

1. **Collect context:**

   git diff --staged
   git log --oneline -5

2. **Get task context:**

   # Check in-progress tasks for current project
   jt list --status in_progress --json 2>/dev/null | jq -r '.[] | "\(.id): \(.title)"' | head -3

Note the task ID and title if found (e.g., `jat-jl2ud.7: Add --generate option`). If multiple tasks are in progress, use the one most likely related to the staged diff (check file paths in diff vs task titles).

3. **Estimate diff size and try local LLM:**

Count characters in the staged diff. If **< 40,000 chars**, call the local LLM:

   DIFF=$(git diff --staged)
   LOG=$(git log --oneline -5)
   TASK_ID="<task-id if found, else empty string>"
   DIFF_LEN=${#DIFF}

   if [ "$DIFF_LEN" -lt 40000 ]; then
     # Use jq to safely encode fields — prompt is built server-side by generateCommitMessage()
     BODY=$(jq -cn \
       --arg diff "$DIFF" \
       --arg commits "$LOG" \
       --arg taskId "$TASK_ID" \
       '{diff: $diff, recentCommits: $commits, taskId: $taskId, style: "conventional", feature: "jat-commit-generate"}')

     RESPONSE=$(curl -s -X POST "http://localhost:3333/api/local-llm/generate-commit-message" \
       -H "Content-Type: application/json" \
       -d "$BODY" \
       --max-time 35 2>/dev/null)

     DRAFT=$(echo "$RESPONSE" | jq -r '.message // empty' 2>/dev/null)
   fi

Use `$DRAFT` as the candidate commit message if non-empty.

4. **Fall back to AI-generated message** (if diff >= 40,000 chars OR curl fails OR `.text` is empty):

  • Analyze the staged diff yourself
  • Generate a commit message following the same format: `<type>(<task-id>): <imperative sentence>`
  • This fallback is you (Claude) — no external call needed

5. **Present draft to user via `AskUserQuestion`:** Display: `Generated commit message: "<draft>"`

Options:

  • **Use this message** — proceed to commit with the draft as-is
  • **Edit message** — user types a revised message; use that instead
  • **Write manually** — discard draft, continue with normal git-commit-assistant flow

6. **If "Use this message" or "Edit message":** commit all staged changes directly:

   git commit -m "<approved or edited message>

   Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>"

Then skip Part 2's "Create commit via git-commit-assistant" step — the commit is already done. Proceed to Part 3 (repeat if more changes) and Part 4 (final verification).

> **Shared-index note:** this is a multi-agent checkout — every agent shares one `.git/index`. The pre-commit gate serializes commits via `flock` so concurrent commits don't collide. To also guarantee no sibling commits while your files sit staged, don't leave changes staged for long, and wrap stage + commit atomically when others are active: `flock "$(git rev-parse --git-dir)/jat-commit.lock" env JAT_COMMIT_LOCK=held sh -c 'git add <paths> && git commit -m "..."'`. See AGENTS.md "Commit Messages".

7. **If "Write manually":** discard the draft and continue with the standard flow below.

---

PART 1: Understand Scope

1. **Check git status:**

   git status
   git diff

2. **Determine scope based on parameter:**

  • **If `$1` is empty or "session"**: Filter to session work only
  • Check file reservations for context
  • Look for JAT task ID if in agent workflow
  • Identify files YOU modified (not other developers)
  • **If `$1` is "all"**: Include everything
  • All modified files
  • All staged files
  • All untracked files (that should be committed)

3. **Analyz

Read more
Ships withjat

Agents ship, suggest, repeat. You supervise — or they run on their own. JAT is the complete, self-contained environment for agentic development. Task management, agent orchestration, code editor, git integration, terminal access—all unified in a single IDE.

Get the whole plugin