Overview
Therev-dep config init command creates a new .rev-dep.config.jsonc configuration file in the current directory with sensible default settings. The command automatically detects whether you’re working in a monorepo or single-package project and generates appropriate rules.
Syntax
Behavior
The command behavior depends on your project structure:- Monorepo root: Creates a root rule plus a rule for each discovered workspace package
- Monorepo workspace package: Creates config with a single rule for the current package only
- Regular projects: Creates config with a single rule for the root directory
Flags
Working directory where the config file will be created
Display help information for the init command
Examples
Create config in current directory
Create config in specific directory
Output
The command creates a.rev-dep.config.jsonc file with:
- configVersion: Current configuration schema version (1.6)
- $schema: JSON schema URL for IDE autocompletion
- rules: Array of rule configurations based on your project structure
Default Checks Enabled
For each rule, the following checks are enabled by default:circularImportsDetection: Detects circular dependenciesunresolvedImportsDetection: Finds unresolved import statements
Default Checks Disabled
The following checks are disabled by default (you can enable them as needed):orphanFilesDetectionunusedNodeModulesDetectionmissingNodeModulesDetectionunusedExportsDetectiondevDepsUsageOnProdDetectionrestrictedImportsDetection
Error Handling
The command will fail if:- A config file already exists in the directory
- The directory is not writable
- JSON marshaling fails
Next Steps
After creating the config file:- Review and adjust the generated rules to match your project structure
- Enable additional checks as needed for your use case
- Configure entry points (prodEntryPoints and devEntryPoints)
- Run
rev-dep config runto execute all configured checks
Feed the config file JSON schema to an LLM to get help with advanced configuration options.
Related Commands
- rev-dep config run - Execute all checks defined in the config file
