---
description: Commit all workspace changes in logical order with intelligent messages
date: 2025-02-12
---

# Commit Workspace

Scans all repositories for pending changes and commits them in logical order with intelligent commit messages.

// turbo
~/commit-workspace.sh

## What it does:

1. **Scans** all repos for changes (reads from `repos.txt`):

See `repos.txt` for the canonical list of all workspace repositories.

2. **Analyzes** changed files to determine:
   - Commit scope (auth, ci, docs, feat, chore, etc.)
   - Appropriate commit message
   - Logical grouping

3. **Commits** in dependency order:
   - Always commits common platform first
   - Then other repos

4. Does **NOT** push — use `/repo_sync-repos` or `git push` separately

## Commit Message Logic:

The script analyzes file types to generate appropriate messages:

| File Pattern              | Commit Message Example                               |
| ------------------------- | ---------------------------------------------------- |
| auth/middleware/jwt files | `feat(auth): update authentication and middleware`   |
| .github/workflows/        | `ci: update CI/CD configuration`                     |
| Dockerfile + package.json | `feat: update Dockerfile for pnpm workspace support` |
| package.json, lock files  | `chore: update dependencies`                         |
| \*.md files               | `docs: update documentation`                         |
| \*.py, requirements.txt   | `feat(python): update Python modules`                |
| test/, _spec_             | `test: add/update tests`                             |
| .env, config files        | `chore: update configuration`                        |
| Other files               | `chore: update project files`                        |

## Usage:

```bash
# Run from anywhere
~/commit-workspace.sh

# Or via Windsurf
/commit-workspace
```

## Example Output:

```
📋 Scanning workspace for changes...

📁 learning_ai_common_plat:
  - 2 staged
  - 1 modified

📁 learning_voice_ai_agent:
  - 3 untracked

Found changes in 2 repo(s)

🚀 Committing in dependency order...

📝 Committing learning_ai_common_plat...
  Message: feat(auth): update authentication and middleware
  ✅ Committed

📝 Committing learning_voice_ai_agent...
  Message: docs: update documentation
  ✅ Committed

✨ All changes committed locally!
💡 Use /repo_sync-repos or git push to push to remote
```

## Features:

- ✅ No prompts - fully automated
- ✅ Intelligent commit messages
- ✅ Logical dependency order
- ✅ Stages all changes automatically
- ✅ Local commits only (no push)
- ✅ Clean, colored output

## Safety:

- Always shows what will be committed
- Uses conventional commit format
- Commits in correct order to avoid issues
- Preserves all changes

## When to Use:

- After making changes across multiple repos
- Before switching contexts/tasks
- At the end of a development session
- When preparing for releases

## Notes:

- Script location: `~/commit-workspace.sh`
- Requires git access to all repos
- Works with any branch (but assumes main is primary)
- Will skip repos with no changes
