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).

CheckRequirementError Code
package.json existsProject root must contain a package.jsonMISSING_PACKAGE_JSON
name field presentpackage.json must have a "name" fieldINVALID_PACKAGE_JSON
Git repository.git directory must existMISSING_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:

CheckConditionStatus
Biome + ESLintBoth @biomejs/biome and eslint in dependencieswarn
Biome + PrettierBoth @biomejs/biome and prettier in dependencieswarn
Legacy ESLint config.eslintrc.* file existswarn
No conflictsNone of the abovepass

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

ToolDependencyCommand Checked
Biome@biomejs/biomebiome --version
ESLinteslinteslint --version
TypeScripttypescripttsc --version
Commitlint@commitlint/clicommitlint --version
Knipknipknip --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.