Quick pre-commit checks — lint:fix -> test:unit
Runs automated lint-fix and unit test checks before committing code changes.
/plugin marketplace add sd0xdev/sd0x-dev-flow/plugin install sd0x-dev-flow@sd0xdev-marketplaceRun quick pre-commit checks: lint:fix -> test:unit (no build step)
First, check if scripts/precommit-runner.js exists in the project root. If the file exists, run it:
node scripts/precommit-runner.js --mode fast --tail 60
If it succeeds, use its output and skip to the Output section.
If scripts/precommit-runner.js does not exist, skip Step 1 entirely and detect the project ecosystem to run steps manually.
Ecosystem detection (check project root for manifest files):
| Manifest | Ecosystem | Lint-fix | Test |
|---|---|---|---|
package.json | Node.js | {pm} lint:fix | {pm} test:unit or {pm} test |
pyproject.toml | Python | ruff check --fix . | pytest tests/unit/ |
Cargo.toml | Rust | cargo clippy --fix | cargo test |
go.mod | Go | golangci-lint run --fix | go test ./... |
build.gradle | Java | ./gradlew spotlessApply | ./gradlew test |
For Node.js projects, auto-detect package manager from lockfile (pnpm-lock.yaml → pnpm, yarn.lock → yarn, else npm).
Read package.json (or equivalent manifest) to check which scripts/tools exist, then run available steps in order:
| Step | package.json script | If missing |
|---|---|---|
| lint:fix | lint:fix | Skip with note (not all projects have it) |
| test:unit | test:unit, fallback to test | Skip with note |
After lint:fix completes, run git diff --name-only to capture auto-fixed files.
| Scenario | Behavior |
|---|---|
No lint:fix script | Skip, log "no lint:fix script — skipped" |
No test:unit or test script | Skip, log "no test script — skipped" |
No package.json | Report error, cannot run checks |
## Precommit (fast)
## Results
| Step | Status | Notes |
| --------- | ------ | ----- |
| lint:fix | ✅/❌/⏭️ | skipped if no script |
| test:unit | ✅/❌/⏭️ | skipped if no script |
## Changed Files (after lint:fix)
- <files or "(none)">
## Overall: ✅ PASS / ❌ FAIL
## Checklist
- [ ] All available checks pass
- [ ] git status reviewed