Quick Start
Using a Preset
The fastest way to get started is using one of the built-in presets. This requires no configuration file:
bash
# Validate a React TypeScript projectnpx fs-guard --preset react-ts
# Validate a NestJS projectnpx fs-guard --preset nestjs
# Validate a Next.js projectnpx fs-guard --preset nextjsCreating a Config File
For custom validation rules, create a configuration file in your project root:
typescript
// fs-guard.config.tsimport type { FsGuardConfig } from "@promise-inc/fs-guard";
export const config: FsGuardConfig = { rules: { "src": "*", "src/components": ["index.ts"], "src/utils": { required: true, pattern: "*.ts", maxDepth: 2, }, },};Running FS Guard
Run FS Guard to validate your project structure. It will automatically find and load your config file:
bash
npx fs-guardOutput Example
When validation fails, FS Guard shows clear error messages:
bash
❌ Validation failed with 2 violations:
src/components ✗ Missing required file: index.ts
src/utils/nested/very/deep ✗ Exceeds maximum depth of 2
Run 'fs-guard --help' for more options.Success Output
When all rules pass, you'll see a success message:
bash
✓ All structure validations passed!