Skip to content

Preflight & Diagnostics

Before any conformance changes are applied, xtarterize runs a series of validation checks. After changes, it can also diagnose potential issues with your project’s tooling setup.

Every command that modifies or inspects your project (init, sync, diff, check, add, list) runs preflight checks first via runPreflight(cwd).

Check Requirement Error Code
package.json exists Project root must contain a package.json MISSING_PACKAGE_JSON
name field present package.json must have a "name" field INVALID_PACKAGE_JSON
Git repository .git directory must exist MISSING_GIT

If preflight checks fail, the CLI exits with code 1 and displays all errors with hints:

✖ Preflight checks failed
✗ No package.json found
Run xtarterize init from the root of a JS/TS project.
✗ No .git directory found
Initialize a git repository with "git init" before running xtarterize.

The check command with --verbose flag runs additional diagnostics to surface potential issues:

Detects incompatible or redundant tooling configurations:

Check Condition Status
Biome + ESLint Both @biomejs/biome and eslint in dependencies warn
Biome + Prettier Both @biomejs/biome and prettier in dependencies warn
Legacy ESLint config .eslintrc.* file exists warn
No conflicts None of the above pass

Verifies that tools listed in package.json dependencies/devDependencies are actually installed in node_modules:

Tool Dependency Command Checked
Biome @biomejs/biome biome --version
ESLint eslint eslint --version
TypeScript typescript tsc --version
Commitlint @commitlint/cli commitlint --version
Knip knip knip --version
Diagnostics
✔ Biome installation — Biome is installed
~ ESLint installation — ESLint is in package.json but not installed (run install)
~ Conflicting tools — Both Biome and ESLint are configured. Consider using one as primary.
import { runPreflight } from '@xtarterize/core'
const result = await runPreflight('/path/to/project')
if (!result.valid) {
for (const error of result.errors) {
console.log(error.code) // 'MISSING_PACKAGE_JSON'
console.log(error.message) // 'No package.json found'
console.log(error.hint) // 'Run xtarterize init from...'
}
}
import { runConflictChecks } from '@xtarterize/core'
const checks = await runConflictChecks('/path/to/project')
for (const check of checks) {
console.log(check.name) // 'Conflicting tools'
console.log(check.status) // 'warn' | 'pass' | 'fail'
console.log(check.message) // 'Both Biome and ESLint are configured...'
}
import { runToolInstallationChecks } from '@xtarterize/core'
const checks = await runToolInstallationChecks('/path/to/project')
for (const check of checks) {
console.log(check.name) // 'Biome installation'
console.log(check.status) // 'pass' | 'warn' | 'fail'
console.log(check.message) // 'Biome is installed'
}

In CI environments (CI=true or CI=1), the --quiet flag is automatically enabled for all commands, suppressing interactive prompts and verbose output.