npx claudepluginhub sd0xdev/sd0x-dev-flow --plugin sd0x-dev-flowWant just this command?
Add to a custom plugin, then install with one command.
Run pre-commit checks: **lint:fix -> build -> test**
Task
Run pre-commit checks: lint:fix -> build -> test
Step 1: Check for runner script
Use Glob to check if .claude/scripts/precommit-runner.js exists in the project root.
- Found → run:
node .claude/scripts/precommit-runner.js --mode full --tail 80- If runner succeeds, use its output and skip to the Output section.
- If runner fails, treat as a real precommit failure (do not silently fallback).
- NOT found → Auto-install attempt:
-
Node.js gate: Use Glob to check if
package.jsonexists in the project root. If nopackage.json→ skip auto-install, fall through to Step 2. -
Locate plugin scripts: 3-level Glob fallback (short-circuit on first match):
Glob: ~/.claude/plugins/**/sd0x-dev-flow/scripts/precommit-runner.jsGlob: ${REPO_ROOT}/node_modules/sd0x-dev-flow/scripts/precommit-runner.js- Plugin-relative: try reading
@scripts/precommit-runner.jsto confirm accessibility
-
Plugin not found → fall through to Step 2 (ecosystem fallback).
-
Plugin found → log
> auto-installing missing runner...then copy usingnode -e(stays within existingBash(node:*)permission):-
mkdir -p .claude/scripts/lib -
Copy
precommit-runner.jsandlib/utils.jsfrom plugin source to.claude/scripts/ -
Conflict handling per file:
Scenario Action Target missing Copy Target exists, content identical Skip (already installed) Target exists, content differs Skip + warn (no overwrite without --force)
-
-
Run newly installed runner:
node .claude/scripts/precommit-runner.js --mode full --tail 80- If any required file had conflict (runner or lib/utils.js not installed) → fall through to Step 2.
- If runner fails → treat as a real precommit failure (do not silently fallback).
-
Step 2: Fallback (no runner script)
If the runner was not found in Step 1, detect the project ecosystem to run steps manually.
Ecosystem detection (check project root for manifest files):
| Manifest | Ecosystem | Lint-fix | Build | Test |
|---|---|---|---|---|
package.json | Node.js | {pm} lint:fix | {pm} build | {pm} test:ci / test / test:fast / test:unit |
pyproject.toml | Python | ruff check --fix . | — | pytest tests/unit/ |
Cargo.toml | Rust | cargo clippy --fix | cargo build | cargo test |
go.mod | Go | golangci-lint run --fix | go build ./... | go test ./... |
build.gradle | Java (Gradle) | ./gradlew spotlessApply | ./gradlew build | ./gradlew test |
build.gradle.kts | Java (Gradle KTS) | ./gradlew spotlessApply | ./gradlew build | ./gradlew test |
pom.xml | Java (Maven) | mvn spotless:apply | mvn compile | mvn test |
Gemfile | Ruby | bundle exec rubocop -a | — | bundle exec rspec |
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 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) |
| build | build | Skip with note |
| test | test:ci, fallback to test, then test:fast, then test:unit | Skip with note |
Run each available step sequentially. Report all results even if a step fails.
After lint:fix completes, run git diff --name-only to capture auto-fixed files.
Graceful Skip Rules
| Scenario | Behavior |
|---|---|
No lint:fix script | Skip, log "no lint:fix script — skipped" |
No build script | Skip, log "no build script — skipped" |
| No test script in preference chain | Skip, log "no test script — skipped" |
No package.json | Report error, cannot run checks |
Output
## Precommit (full)
## Results
| Step | Status | Notes |
| --------- | ------ | ----- |
| lint:fix | ✅/❌/⏭️ | skipped if no script |
| build | ✅/❌/⏭️ | skipped if no script |
| test | ✅/❌/⏭️ | skipped if no script |
## Changed Files (after lint:fix)
- <files or "(none)">
## Overall: ✅ PASS / ❌ FAIL
## Checklist
- [ ] All available checks pass
- [ ] git status reviewed