Pre-Submission Preflight Check
Run each check in order. Report results clearly and help fix any issues found.
Check 0: Working Tree Status
git fetch origin main
git status
git diff --stat origin/main...HEAD
git log --format="%h %s%n%b" origin/main..HEAD
Fetch first — every check below diffs against origin/main, so a stale local copy of it would give wrong commit/diff counts here and a wrong changed-package scope in Check 2–4.
Evaluate:
- Uncommitted changes? — Ask the contributor: commit now or stash?
- No commits ahead of main? — The branch has nothing to validate. Ask if they're on the right branch.
- Commits missing an issue reference? — Flag commits whose body has no
linuxfoundation/lfx-cdp-insights-ops#<number>reference. - Commits missing
--signoff? — Flag any commits withoutSigned-off-by:lines.
Resolve any issues before proceeding.
Check 1: Detect Changed Workspaces
git diff --name-only origin/main...HEAD
Note whether backend/, services/**, frontend/, pnpm-lock.yaml, and/or pnpm-workspace.yaml have changed files — used only to decide which of Checks 2–4 apply.
Check 2–4: Lint, Format, TypeScript
Backend + services — one command covers lint (root pnpm lint / oxlint), format-check (root pnpm format-check / oxfmt), and tsc-check (tsc -b from the repo root):
./scripts/cli lint-changed
Run this whenever backend/, services/**, pnpm-lock.yaml, pnpm-workspace.yaml, docs, workflows, or other oxfmt-owned files have changed. Skip only for frontend-only changes.
The three checks run in order (lint → format-check → tsc-check) and stop at the first failure — same fail-fast behavior as the CI job. If lint fails, format/tsc did not run yet; fix and re-run to see the next check, same as watching CI re-run per push.
Fix any errors it reports before proceeding:
- Lint errors — unused imports, missing types, rule violations
- Format violations — fix with
pnpm formatfrom the repo root thengit add -p - TypeScript errors — fix all before proceeding
Frontend — no dependency-graph tooling exists for it yet; run manually if frontend/ has changed files:
cd frontend && pnpm run lint
Frontend has no format-check or tsc-check script — skip both.
Check 5: Protected Files Check
git diff --name-only origin/main...HEAD
Flag any changes to these protected files — they should NOT be modified without code owner approval:
services/libs/data-access-layer/**— shared DAL, high blast radiusservices/libs/common/**— shared utilities, affects all servicesbackend/src/database/migrations/**— append-only Flyway migrationsscripts/cli,scripts/scaffold.yaml,scripts/scaffold.insights.yaml.husky/*,commitlint.config.js.github/workflows/**,.github/actions/**tsconfig*.json,.oxlintrc*,.oxfmtrc*,.eslintrc*,.prettierrc*pnpm-lock.yaml,package.json,*/package.jsonAGENTS.md,.claude/settings.json
If protected files appear in the diff, warn the contributor and ask them to revert or get code owner approval.
Check 6: Commit Verification
git log --format="%h %s%n%b" origin/main..HEAD
- All changes committed? — If not, remind them to commit.
- Commit messages follow conventions? —
type: descriptionsubject with aRefs linuxfoundation/lfx-cdp-insights-ops#<number>body, percommit-workflow.md. --signoffon all commits? — Every commit must haveSigned-off-by:.- PR title valid? — Conventional Commits format, lowercase description, no trailing period (validated by CI at
.github/workflows/pr-title-lint.yml).
Check 7: Change Summary
git diff --stat origin/main...HEAD
List:
- New files created — with their purpose
- Modified files — with what changed
- API changes — any new or modified routes in
backend/src/api/ - Migration changes — any new Flyway migrations
Results Report
Present a clear report:
PREFLIGHT RESULTS
─────────────────────────────────────────────────
✓ Working tree — Clean, N commits ahead of main
✓ Lint — backend: OK | frontend: OK | services/...: OK
✓ Format check — backend: OK
✓ TypeScript — backend: OK
✓ Protected files — None modified
✓ Commits — Conventions followed, signed off, issue referenced
─────────────────────────────────────────────────
READY FOR PR
Or if there are issues:
PREFLIGHT RESULTS
─────────────────────────────────────────────────
✓ Working tree — Clean, N commits ahead of main
✗ Lint — backend: 3 errors (see above)
✓ Format check — backend: OK
✗ TypeScript — backend: 1 error (see above)
✓ Protected files — None modified
✗ Commits — Missing Signed-off-by on 2 commits (run /dco)
─────────────────────────────────────────────────
ISSUES FOUND — Fix before submitting
If All Checks Pass
Suggest creating the PR:
"All preflight checks passed! Ready to create a PR. Would you like me to create it with
gh pr create?"