CLI Reference
Basic Usage
bash
# Run with default config filenpx fs-guard
# Run with specific presetnpx fs-guard --preset nestjs
# List available presetsnpx fs-guard --listCommands
| Command | Description | Example |
|---|---|---|
| (no args) | Validate using config file | npx fs-guard |
| --preset <name> | Use a built-in preset | npx fs-guard --preset react-ts |
| --list | List all available presets | npx fs-guard --list |
| --help | Show help message | npx fs-guard --help |
| --version | Show version | npx fs-guard --version |
Exit Codes
FS Guard uses standard exit codes for CI integration:
| Code | Meaning | Description |
|---|---|---|
| 0 | Success | All validations passed |
| 1 | Failure | One or more validations failed |
| 2 | Error | Configuration error or runtime error |
CI Integration
Example GitHub Actions workflow:
bash
name: Validate Structure
on: [push, pull_request]
jobs: validate: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - uses: actions/setup-node@v3 with: node-version: 18 - run: npm install - run: npx fs-guardnpm Scripts
Add to package.json for convenience:
typescript
{ "scripts": { "validate:structure": "fs-guard", "validate:nestjs": "fs-guard --preset nestjs" }}Then run with npm:
bash
npm run validate:structure