Auto Commit

Auto-classify all unstaged changes by topic and create multiple commits, one per group.

nomoory 8 updated 3mo ago
Claude CodeGeneric
View source ↗
Auto-classify all unstaged changes by topic and create **multiple commits**, one per group.

## Core Principles

- **Process all unstaged changes** (including unclassified files)
- **Commit group by group sequentially** (one at a time)
- **Continue until all changes are committed**

## Procedure

### 1. Check Changes

**1-1. Current workspace status**
```bash
git status --short
  • Check only unstaged changes in the current workspace
  • Include deleted (D), modified (M), and added (A, ??) files

2. Topic-Based Grouping Rules (priority order)

Group 1: Directory structure changes (Priority 1)

  • Pattern: src/ paths, root directory restructuring
  • Commit type: refactor

Group 2: Config file updates (Priority 2)

  • Pattern: tsconfig.json, package.json, *.config.*, .env*, .gitignore, lock files
  • Commit type: config

Group 3: Import path refactoring (Priority 3)

  • Pattern: .ts, .tsx files with import path changes
  • Commit type: refactor

Group 4: Documentation changes (Priority 4)

  • Pattern: docs/, *.md, *.mdx (excluding config files)
  • Commit type: docs

Group 5: Feature additions (Priority 5)

  • Pattern: New files added
  • Commit type: feat

Group 6: Bug fixes (Priority 6)

  • Keywords: File content contains fix, bug, error
  • Commit type: fix

Group 7: Style changes (Priority 7)

  • Pattern: *.css, *.scss, *.less
  • Commit type: style

Group 8: Other changes (Priority 8 - catch-all)

  • All files not matching above groups
  • Commit type: chore

3. File Grouping Logic

For each file:

  1. Try pattern matching in priority order (Group 1 through 8)
  2. For keyword-based groups, check file content
  3. Assign to the first matching group
  4. If no group matches, assign to Group 8 (always committed)

Important: Every file must be assigned to exactly one group.

4. Commit Message Format

Conventional Commits format:

<type>: <subject>

<body>

Changed files:
  - [status] filepath1
  - [status] filepath2
  ... and N more files
  • Subject: 50 characters or fewer
  • Body: 72 character line wrap recommended
  • File list: Show up to 10, then "... and N more files"
  • Status: [deleted], [added], [modified]

5. Commit Execution (loop)

Commit each group sequentially:

  1. Start from Group 1
  2. git add all files in the group
  3. Generate commit message and run git commit
  4. Verify commit succeeded
  5. Move to next group
  6. Repeat until all groups are committed
  • UTF-8 encoding
  • Escape special characters (quotes, backslashes, etc.)
  • Show results after each group commit, then proceed to next

6. Results Report

  • Number of successful commits: "N group commits completed"
  • Show commit hash and file count per group
  • Final check: Run git status to confirm all unstaged changes are handled
  • Warn if any changes remain

Guidelines

  • Only processes unstaged changes
  • Unclassified files are automatically included in Group 8
  • Review changes before committing recommended
  • For large change sets, consider running in batches

Maintain Auto Commit?

Let people know it's listed here — add the badge (live metrics, light/dark aware) or a plain link to your README or docs.

[Auto Commit on getagentictools](https://getagentictools.com/loops/nomoory-auto-commit?ref=badge)