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 project
npx fs-guard --preset react-ts
# Validate a NestJS project
npx fs-guard --preset nestjs
# Validate a Next.js project
npx fs-guard --preset nextjs

Creating a Config File

For custom validation rules, create a configuration file in your project root:

typescript
// fs-guard.config.ts
import 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-guard

Output 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!