@@ -0,0 +1,37 @@
1+---
2+name: commit-all
3+description: Format, lint, and commit all changes with a generated message
4+---
5+
6+Run the following steps to clean and commit the code:
7+
8+1. **Detect Available Code Quality Tools**:
9+ - Examine the current project to identify available formatting and linting commands:
10+ - Check for `package.json`, `Makefile`, `pyproject.toml`, `Cargo.toml`, or other project configuration files
11+ - Look for common script names like `format`, `lint`, `check`, or similar
12+ - Identify the appropriate command runner (npm, bun, pnpm, make, cargo, poetry, etc.)
13+ - If no code quality tools are found, skip to step 3 (staging changes).
14+
15+2. **Run Code Quality Tools** (if available):
16+ - Execute the detected formatting command first (if available)
17+ - Then execute the detected linting command (if available)
18+ - If any command fails, stop immediately and report the issues.
19+ - If no commands are configured, skip this step gracefully.
20+
21+3. **Stage Changes**:
22+ - Run `git add .` to stage all modified and untracked files.
23+
24+4. **Generate Commit**:
25+ - Analyze the staged changes (using `git diff --cached` if necessary to understand the context).
26+ - Draft a concise, descriptive commit message following the **Conventional Commits** specification (e.g., `feat: add search`, `fix: handle null url`).
27+ - Create the commit using `git commit -m "..."`.
28+
29+5. **Handle Pre-commit Hook Failures**:
30+ - If the commit fails due to pre-commit hooks (e.g., lint checks, formatting checks, tests):
31+ - Report the error output clearly to the user
32+ - Ask the user how they would like to proceed (e.g., fix the issues automatically, skip hooks, or abort)
33+ - Report all other errors or unexpected output to the user and ask for next steps.
34+
35+6. **Report**:
36+ - Output the result of the commit operation, including which tools were run (if any).
37+ - If pre-commit hooks failed and were fixed, report what issues were resolved.