# /github - CI-Validated Git Commit & Push

**EXECUTE IMMEDIATELY**: Run CI checks, then commit and push to GitHub.

## Arguments

$ARGUMENTS - Optional commit message. If empty, auto-generate based on changes.

## Instructions

Execute these steps NOW (working directory: `mawidi-site`):

### Step 1: Pre-flight Checks

Run `git status` and `git diff --stat` to see what changed.

### Step 2: CI Pipeline Checks (Run in parallel where possible)

Run these checks that mirror the GitHub Actions CI pipeline:

```bash
cd mawidi-site

# 1. Lint Check
npm run lint

# 2. TypeScript Check
npx tsc --noEmit

# 3. Build Check
npm run build
```

**IMPORTANT**: If ANY check fails, STOP and report the errors. Do NOT proceed to commit.

### Step 3: Commit & Push (Only if all checks pass)

1. Stage all changes: `git add -A`
2. If $ARGUMENTS is provided, use it as commit message. Otherwise, generate based on changes.
3. Commit with format:

   ```
   <type>: <description>

   🤖 Generated with [Claude Code](https://claude.com/claude-code)

   Co-Authored-By: Claude <noreply@anthropic.com>
   ```

4. Push to origin: `git push origin HEAD`

### Step 4: Report Results

Report:

- All CI checks passed
- Commit hash
- Branch name
- Files changed count

## Commit Types

- `feat`: New feature
- `fix`: Bug fix
- `docs`: Documentation
- `style`: Formatting
- `refactor`: Code restructuring
- `test`: Adding tests
- `chore`: Maintenance

## Skip CI Checks (Emergency Only)

If user passes `--force` or `--skip-ci` in $ARGUMENTS, skip CI checks but warn them.

## CI Jobs Reference (from .github/workflows/ci.yml)

- Lint: `npm run lint`
- TypeScript: `npx tsc --noEmit`
- Unit Tests: `npm run test:unit` (requires DB - skip locally)
- E2E Tests: `npm run test:e2e` (requires server - skip locally)
- Build: `npm run build`
- Schema: `npx prisma validate` (requires DB)
