command

preflight

Arguments: $ARGUMENTS --- Run all pre-commit checks in order. One command instead of remembering the sequence.

$ curl -fsSL https://skills.reveni.dev/install.sh | bash

Arguments: $ARGUMENTS


Purpose

Run all pre-commit checks in order. One command instead of remembering the sequence.


Silent Execution


Flow

Show the plan once:

====================================
PREFLIGHT
[ ] 1. Format
[ ] 2. Lint
[ ] 3. Translation check
[ ] 4. New component test check
[ ] 5. Test
[ ] 6. Version bump
====================================

Then run each step:

1. Format

yarn format

2. Lint

yarn linter

3. Translation check

Verify that every translation key used in changed files exists in the translation file.

  1. Get changed .js and .jsx files (hooks and components can both use t()):

    git diff --name-only --diff-filter=d origin/main -- '*.js' '*.jsx'
    
  2. For each changed file, search for t('...') and t("...") calls and extract the key strings.

  3. For each extracted key, check if it exists in src/i18n/translations/en.json.

  4. Report:

    • If all keys found: ▶ Step 3: Translations... OK (N keys verified)
    • If any key is missing: show the list of missing keys with file:line references. Stop.
    • If no files changed or no t() calls found: ▶ Step 3: Translations... OK (no keys to check)

4. New component test check

Verify that every new component file has a corresponding test file.

  1. Get newly added .jsx files (excluding test files):

    git diff --name-only --diff-filter=A origin/main -- '*.jsx' | grep -v '\.test\.' | grep -v 'index\.' | grep -v 'styles'
    
  2. For each new .jsx file, check if a corresponding .test.jsx or .test.js file exists in the same directory.

  3. Report:

    • If all new components have tests: ▶ Step 4: New component tests... OK (N new components, all tested)
    • If any new component is missing a test: show the list of untested components. Stop.
    • If no new .jsx files: ▶ Step 4: New component tests... OK (no new components)

5. Test

Identify changed files:

git diff --name-only origin/main -- '*.js' '*.jsx' '*.ts' '*.tsx'

Build the test file list from changed files:

  1. If the changed file is already a test file (*.test.js, *.test.jsx), include it directly.
  2. If the changed file is a source file (X.js or X.jsx), look for X.test.js or X.test.jsx in the same directory.
  3. Skip files that never have tests: styles.js, constants.js, index.js.

Run only the discovered test files:

yarn test:agent <test files>

If no test files found for the changed files, run the full suite:

yarn test:agent

6. Version bump

git diff origin/main -- package.json

Check if the version field was changed.


Report

====================================
PREFLIGHT — PASSED ✓
====================================
Format:       OK
Lint:         OK
Translations: OK (8 keys verified)
New tests:    OK (no new components)
Tests:        OK (12 passed)
Version:      5.330.0 → 5.331.0 (minor)

Files: 20 changed across 2 modules (configuration, returns)
Commits: 2 (feat: added subreasons, refactor: extract SortableList...)

Ready to commit.
====================================

If any step failed:

====================================
PREFLIGHT — FAILED ✗
====================================
Format:       OK
Lint:         FAILED — 2 errors
  src/hooks/useFoo.js:12 — 'unused' is defined but never used
  src/components/Bar.jsx:5 — Missing import for useState

Fix the errors and run /preflight again.
====================================

Report Summary Section

At the end of a successful report, always include a summary of the branch changes:

  1. Count changed files and detect modules:

    git diff --name-only origin/main -- '*.js' '*.jsx' '*.ts' '*.tsx'
    

    Group by top-level src/ directory to identify modules.

  2. Show commit history:

    git log --oneline origin/main..HEAD
    
  3. Format as:

    Files: N changed across M modules (module1, module2)
    Commits: K (first commit subject, second commit subject...)