@neosianexus/quality 1.0.0-beta.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md ADDED
@@ -0,0 +1,551 @@
1
+ # @neosianexus/quality
2
+
3
+ [![npm version](https://img.shields.io/npm/v/@neosianexus/quality.svg)](https://www.npmjs.com/package/@neosianexus/quality)
4
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
5
+ [![Node.js](https://img.shields.io/badge/node-%3E%3D18.0.0-brightgreen.svg)](https://nodejs.org/)
6
+
7
+ > Ultra-strict Biome + TypeScript + Husky + Commitlint configuration for React/Next.js projects
8
+
9
+ A comprehensive, enterprise-grade configuration package that provides **ultra-strict code quality standards** for TypeScript/JavaScript projects. Zero-config setup with an interactive CLI.
10
+
11
+ ## Features
12
+
13
+ - **Ultra-strict Biome configuration** - 100+ linting rules with maximum strictness
14
+ - **TypeScript strict mode** - All strict flags enabled including `noUncheckedIndexedAccess`
15
+ - **Conventional Commits** - Commitlint integration with automatic validation
16
+ - **Git hooks** - Husky + lint-staged for pre-commit checks
17
+ - **Dead code detection** - Knip integration to find unused exports
18
+ - **VS Code configuration** - Optimized settings and recommended extensions
19
+ - **AI assistant ready** - CLAUDE.md generation for Claude Code integration
20
+ - **Multi-project support** - Next.js, React, and Node.js/TypeScript configurations
21
+ - **Package manager agnostic** - Works with npm, yarn, pnpm, and bun
22
+
23
+ ## Installation
24
+
25
+ ### Prerequisites
26
+
27
+ - Node.js >= 18.0.0
28
+ - Git (for Husky hooks)
29
+
30
+ ### Quick Install
31
+
32
+ ```bash
33
+ # Run directly with npx (recommended)
34
+ npx @neosianexus/quality
35
+
36
+ # Or install as a dev dependency
37
+ npm install --save-dev @neosianexus/quality
38
+ ```
39
+
40
+ ### Peer Dependencies
41
+
42
+ These are required and will be installed automatically:
43
+
44
+ ```bash
45
+ npm install --save-dev @biomejs/biome typescript
46
+ ```
47
+
48
+ ## Quick Start
49
+
50
+ ### Interactive Setup (Recommended)
51
+
52
+ ```bash
53
+ npx @neosianexus/quality
54
+ ```
55
+
56
+ The CLI will guide you through:
57
+
58
+ 1. **Project type detection** - Automatically detects Next.js, React, or Node.js
59
+ 2. **Package manager detection** - Detects bun, pnpm, yarn, or npm
60
+ 3. **Feature selection** - Choose which tools to enable:
61
+ - Conventional Commits (commitlint)
62
+ - Git hooks (Husky + lint-staged)
63
+ - VS Code configuration
64
+ - Dead code detection (Knip)
65
+ - CLAUDE.md for AI assistants
66
+
67
+ ### Non-Interactive Setup
68
+
69
+ ```bash
70
+ # Use all detected defaults
71
+ npx @neosianexus/quality init --yes
72
+
73
+ # Preview changes without writing
74
+ npx @neosianexus/quality init --dry-run
75
+ ```
76
+
77
+ ## CLI Commands
78
+
79
+ The CLI provides two main commands: `init` for initial setup and `upgrade` for updating existing configurations.
80
+
81
+ ### Running the CLI
82
+
83
+ ```bash
84
+ # Method 1: Run directly with npx (no installation required)
85
+ npx @neosianexus/quality
86
+
87
+ # Method 2: Run after installing the package
88
+ npx quality
89
+
90
+ # Method 3: If installed globally
91
+ quality
92
+ ```
93
+
94
+ > **Note**: Running `quality` without any subcommand automatically executes the `init` command.
95
+
96
+ ---
97
+
98
+ ### `quality init`
99
+
100
+ Initialize quality configuration in your project. This is the main command for setting up code quality tools.
101
+
102
+ ```bash
103
+ quality init [options]
104
+ ```
105
+
106
+ #### Options
107
+
108
+ | Option | Short | Description |
109
+ |--------|-------|-------------|
110
+ | `--yes` | `-y` | Skip all prompts and use detected defaults |
111
+ | `--force` | `-f` | Overwrite existing configuration files |
112
+ | `--commitlint` | `-c` | Enable Conventional Commits validation |
113
+ | `--skip-husky` | | Skip Husky and lint-staged setup |
114
+ | `--skip-vscode` | | Skip VS Code configuration |
115
+ | `--knip` | `-k` | Enable Knip for dead code detection |
116
+ | `--claude-md` | | Generate CLAUDE.md for AI assistants |
117
+ | `--skip-claude-md` | | Skip CLAUDE.md generation |
118
+ | `--dry-run` | `-d` | Preview changes without writing files |
119
+
120
+ #### Interactive Flow
121
+
122
+ When you run `quality init` without flags, you'll see an interactive wizard:
123
+
124
+ ```
125
+ ┌ @neosianexus/quality v1.0.0
126
+
127
+ ◇ Type de projet ?
128
+ │ ● Next.js (détecté)
129
+ │ ○ React
130
+ │ ○ Node.js / TypeScript
131
+
132
+ ◇ Gestionnaire de paquets ?
133
+ │ ● bun (détecté)
134
+ │ ○ pnpm
135
+ │ ○ yarn
136
+ │ ○ npm
137
+
138
+ ◇ Activer Conventional Commits (commitlint) ?
139
+ │ ● Oui / ○ Non
140
+
141
+ ◇ Configurer les hooks Git (Husky + lint-staged) ?
142
+ │ ● Oui / ○ Non
143
+
144
+ ◇ Ajouter la configuration VS Code ?
145
+ │ ● Oui / ○ Non
146
+
147
+ ◇ Ajouter Knip pour la détection du code mort ?
148
+ │ ● Oui / ○ Non
149
+
150
+ ◇ Générer CLAUDE.md pour l'assistant IA ?
151
+ │ ● Oui / ○ Non
152
+
153
+ ◆ Configuration en cours...
154
+ ```
155
+
156
+ #### Usage Examples
157
+
158
+ ```bash
159
+ # Interactive setup (recommended for first-time users)
160
+ npx @neosianexus/quality
161
+
162
+ # Quick setup with all defaults (CI/CD friendly)
163
+ npx @neosianexus/quality init --yes
164
+
165
+ # Setup with specific features
166
+ npx @neosianexus/quality init --commitlint --knip --claude-md
167
+
168
+ # Setup without git hooks (useful for monorepos)
169
+ npx @neosianexus/quality init --skip-husky
170
+
171
+ # Preview what would be created
172
+ npx @neosianexus/quality init --dry-run
173
+
174
+ # Force overwrite existing configs
175
+ npx @neosianexus/quality init --force
176
+
177
+ # Minimal setup: just Biome + TypeScript
178
+ npx @neosianexus/quality init --yes --skip-husky --skip-vscode
179
+ ```
180
+
181
+ #### What Happens During Init
182
+
183
+ 1. **Detection Phase**
184
+ - Reads `package.json` to detect project type (Next.js, React, or Node.js)
185
+ - Checks for lock files to detect package manager
186
+ - Verifies if Git is initialized
187
+
188
+ 2. **Configuration Generation**
189
+ - Creates `biome.json` extending the strict preset
190
+ - Creates `tsconfig.json` with path aliases (`@/*` → `src/*`)
191
+ - Optionally creates commitlint, Knip, VS Code configs
192
+
193
+ 3. **Dependency Installation**
194
+ - Installs required peer dependencies (`@biomejs/biome`, `typescript`)
195
+ - Installs optional dependencies based on selections (husky, lint-staged, commitlint, knip)
196
+
197
+ 4. **Git Hooks Setup** (if not skipped)
198
+ - Initializes Husky
199
+ - Creates `pre-commit` hook running lint-staged
200
+ - Creates `commit-msg` hook running commitlint (if enabled)
201
+
202
+ 5. **Package.json Updates**
203
+ - Adds quality scripts (`check`, `lint`, `format`, `typecheck`)
204
+ - Adds lint-staged configuration
205
+ - Adds `prepare` script for Husky
206
+
207
+ ---
208
+
209
+ ### `quality upgrade`
210
+
211
+ Upgrade existing configuration to the latest version with intelligent merging.
212
+
213
+ ```bash
214
+ quality upgrade [options]
215
+ ```
216
+
217
+ #### Options
218
+
219
+ | Option | Short | Description |
220
+ |--------|-------|-------------|
221
+ | `--yes` | `-y` | Skip confirmation prompts |
222
+ | `--force` | `-f` | Replace configs entirely instead of merging |
223
+ | `--no-backup` | | Don't create backup files before modifying |
224
+ | `--dry-run` | `-d` | Preview changes without writing files |
225
+
226
+ #### How Smart Merge Works
227
+
228
+ The upgrade command uses intelligent merging to preserve your customizations:
229
+
230
+ ```
231
+ Your Config + New Defaults = Merged Result
232
+ ─────────────────────────────────────────────────────────────────
233
+ { { {
234
+ "rules": { "rules": { "rules": {
235
+ "myRule": "off" ←── "newRule": "error" "myRule": "off", ← preserved
236
+ } "myRule": "error" "newRule": "error" ← added
237
+ } } }
238
+ }
239
+ ```
240
+
241
+ - **Your custom rules are preserved** - If you disabled a rule, it stays disabled
242
+ - **New rules are added** - Latest recommended rules are merged in
243
+ - **Arrays are replaced, not concatenated** - Avoids duplicate entries
244
+
245
+ #### Usage Examples
246
+
247
+ ```bash
248
+ # Interactive upgrade with confirmation
249
+ npx @neosianexus/quality upgrade
250
+
251
+ # Automatic upgrade (CI/CD friendly)
252
+ npx @neosianexus/quality upgrade --yes
253
+
254
+ # Preview changes before applying
255
+ npx @neosianexus/quality upgrade --dry-run
256
+
257
+ # Full replacement (discard customizations)
258
+ npx @neosianexus/quality upgrade --force
259
+
260
+ # Upgrade without creating backups
261
+ npx @neosianexus/quality upgrade --yes --no-backup
262
+ ```
263
+
264
+ #### Upgrade Output Example
265
+
266
+ ```
267
+ ┌ @neosianexus/quality upgrade
268
+
269
+ ◇ Analyse des fichiers de configuration...
270
+
271
+ │ biome.json
272
+ │ + linter.rules.nursery.noSecrets: "error"
273
+ │ + linter.rules.nursery.useImportRestrictions: "error"
274
+ │ ~ formatter.lineWidth: 80 → 100
275
+
276
+ │ tsconfig.json
277
+ │ + compilerOptions.noUncheckedSideEffectImports: true
278
+
279
+ ◇ Appliquer ces modifications ?
280
+ │ ● Oui / ○ Non
281
+
282
+ ◆ Sauvegarde créée: biome.backup.2026-02-01T14-30-45.json
283
+ ◆ Configuration mise à jour avec succès !
284
+ ```
285
+
286
+ ---
287
+
288
+ ### CLI Architecture
289
+
290
+ The CLI is built with the [citty](https://github.com/unjs/citty) framework and follows this structure:
291
+
292
+ ```
293
+ quality [command] [options]
294
+
295
+ ├── (no command) → runs "init" by default
296
+
297
+ ├── init
298
+ │ ├── Interactive prompts (via @clack/prompts)
299
+ │ ├── Project detection
300
+ │ ├── Config generation
301
+ │ ├── Dependency installation
302
+ │ └── Git hooks setup
303
+
304
+ └── upgrade
305
+ ├── Config analysis
306
+ ├── Smart merge (via deepmerge)
307
+ ├── Backup creation
308
+ └── File updates
309
+ ```
310
+
311
+ ## What Gets Created
312
+
313
+ ### Configuration Files
314
+
315
+ | File | Description |
316
+ |------|-------------|
317
+ | `biome.json` | Ultra-strict linting and formatting rules |
318
+ | `tsconfig.json` | TypeScript configuration with path aliases |
319
+ | `commitlint.config.js` | Conventional Commits validation (optional) |
320
+ | `.vscode/settings.json` | VS Code editor settings (optional) |
321
+ | `.vscode/extensions.json` | Recommended extensions (optional) |
322
+ | `knip.json` | Dead code detection config (optional) |
323
+ | `.husky/pre-commit` | Git pre-commit hook |
324
+ | `.husky/commit-msg` | Git commit message hook (optional) |
325
+ | `CLAUDE.md` | AI assistant instructions (optional) |
326
+ | `src/types/css.d.ts` | CSS module type declarations (React/Next.js) |
327
+
328
+ ### Package.json Updates
329
+
330
+ The following scripts are added to your `package.json`:
331
+
332
+ ```json
333
+ {
334
+ "scripts": {
335
+ "check": "biome check .",
336
+ "check:fix": "biome check --write --unsafe .",
337
+ "lint": "biome lint .",
338
+ "lint:fix": "biome lint --write --unsafe .",
339
+ "format": "biome format --write .",
340
+ "typecheck": "tsc --noEmit",
341
+ "knip": "knip",
342
+ "prepare": "husky"
343
+ }
344
+ }
345
+ ```
346
+
347
+ ## Project Types
348
+
349
+ The CLI auto-detects your project type and applies the appropriate configuration:
350
+
351
+ ### Next.js
352
+
353
+ - TypeScript: Extends `@neosianexus/quality/tsconfig.nextjs`
354
+ - Biome: Allows default exports for pages/routes
355
+ - Knip: Configured for App Router entry points
356
+
357
+ ### React
358
+
359
+ - TypeScript: Extends `@neosianexus/quality/tsconfig.react`
360
+ - Biome: Named exports only (no default exports)
361
+ - Knip: Configured for typical React entry points
362
+
363
+ ### Node.js / TypeScript
364
+
365
+ - TypeScript: Extends `@neosianexus/quality/tsconfig.base`
366
+ - Biome: Full strictness, no default exports
367
+ - Knip: Minimal configuration
368
+
369
+ ## Package Managers
370
+
371
+ Auto-detected from lock files in this priority order:
372
+
373
+ | Package Manager | Lock File |
374
+ |----------------|-----------|
375
+ | bun | `bun.lockb` or `bun.lock` |
376
+ | pnpm | `pnpm-lock.yaml` |
377
+ | yarn | `yarn.lock` |
378
+ | npm | `package-lock.json` |
379
+
380
+ ## Extending Configurations
381
+
382
+ You can import and extend the provided configurations directly:
383
+
384
+ ### Biome
385
+
386
+ ```json
387
+ {
388
+ "extends": ["@neosianexus/quality"]
389
+ }
390
+ ```
391
+
392
+ ### TypeScript
393
+
394
+ ```json
395
+ {
396
+ "extends": "@neosianexus/quality/tsconfig.base"
397
+ }
398
+ ```
399
+
400
+ Available TypeScript configurations:
401
+ - `@neosianexus/quality/tsconfig.base` - Base strict configuration
402
+ - `@neosianexus/quality/tsconfig.react` - React with JSX support
403
+ - `@neosianexus/quality/tsconfig.nextjs` - Next.js optimized
404
+
405
+ ### Commitlint
406
+
407
+ ```javascript
408
+ // commitlint.config.js
409
+ import config from "@neosianexus/quality/commitlint";
410
+ export default config;
411
+ ```
412
+
413
+ ### Knip
414
+
415
+ ```json
416
+ {
417
+ "extends": ["@neosianexus/quality/knip"]
418
+ }
419
+ ```
420
+
421
+ ## Configuration Details
422
+
423
+ ### Biome Rules
424
+
425
+ The Biome configuration includes 100+ rules with maximum strictness:
426
+
427
+ - **Formatting**: Tabs (2-space width), double quotes, semicolons always, 100-char line width
428
+ - **Accessibility**: All a11y rules set to `error`
429
+ - **Complexity**: Max cognitive complexity of 15
430
+ - **Security**: All security rules enabled
431
+ - **Import organization**: Auto-sorted imports enabled
432
+
433
+ ### TypeScript Strict Mode
434
+
435
+ All strict flags are enabled:
436
+
437
+ ```json
438
+ {
439
+ "strict": true,
440
+ "noImplicitAny": true,
441
+ "exactOptionalPropertyTypes": true,
442
+ "noUncheckedIndexedAccess": true,
443
+ "noImplicitReturns": true,
444
+ "verbatimModuleSyntax": true
445
+ }
446
+ ```
447
+
448
+ ### Conventional Commits
449
+
450
+ When enabled, commit messages must follow this format:
451
+
452
+ ```
453
+ type(scope): description
454
+
455
+ [optional body]
456
+
457
+ [optional footer]
458
+ ```
459
+
460
+ Allowed types: `feat`, `fix`, `docs`, `style`, `refactor`, `perf`, `test`, `build`, `ci`, `chore`, `revert`
461
+
462
+ ## Development
463
+
464
+ ### Setup
465
+
466
+ ```bash
467
+ git clone https://github.com/neosianexus/quality.git
468
+ cd quality
469
+ bun install
470
+ ```
471
+
472
+ ### Scripts
473
+
474
+ | Script | Description |
475
+ |--------|-------------|
476
+ | `bun run build` | Build the CLI |
477
+ | `bun run validate` | Run lint + typecheck + knip |
478
+ | `bun run check` | Lint and format check |
479
+ | `bun run check:fix` | Auto-fix lint/format issues |
480
+ | `bun run typecheck` | TypeScript type checking |
481
+ | `bun run knip` | Find unused code |
482
+ | `bun run dev` | Run CLI directly from TypeScript |
483
+
484
+ ### Architecture
485
+
486
+ ```
487
+ quality/
488
+ ├── bin/
489
+ │ ├── cli.ts # CLI entry point (citty framework)
490
+ │ ├── commands/
491
+ │ │ ├── init.ts # Init command implementation
492
+ │ │ └── upgrade.ts # Upgrade command implementation
493
+ │ └── utils/
494
+ │ ├── constants.ts # Package metadata and types
495
+ │ ├── detect.ts # Project/PM detection logic
496
+ │ ├── exec.ts # Shell command execution
497
+ │ ├── fs.ts # File system utilities
498
+ │ └── generators.ts # Config file generators
499
+ ├── vscode/ # VS Code configuration templates
500
+ ├── biome.json # Exported Biome config
501
+ ├── tsconfig.*.json # Exported TypeScript configs
502
+ ├── commitlint.config.js # Exported Commitlint config
503
+ └── knip.config.json # Exported Knip config
504
+ ```
505
+
506
+ ## Troubleshooting
507
+
508
+ ### Common Issues
509
+
510
+ **Biome not found**
511
+
512
+ ```bash
513
+ npm install --save-dev @biomejs/biome
514
+ ```
515
+
516
+ **TypeScript not found**
517
+
518
+ ```bash
519
+ npm install --save-dev typescript
520
+ ```
521
+
522
+ **Husky hooks not running**
523
+
524
+ ```bash
525
+ npx husky install
526
+ ```
527
+
528
+ **Permission denied on hooks**
529
+
530
+ ```bash
531
+ chmod +x .husky/pre-commit .husky/commit-msg
532
+ ```
533
+
534
+ ## Contributing
535
+
536
+ Contributions are welcome! Please read our contributing guidelines and submit pull requests to the `main` branch.
537
+
538
+ 1. Fork the repository
539
+ 2. Create your feature branch (`git checkout -b feat/amazing-feature`)
540
+ 3. Commit your changes (`git commit -m 'feat: add amazing feature'`)
541
+ 4. Push to the branch (`git push origin feat/amazing-feature`)
542
+ 5. Open a Pull Request
543
+
544
+ ## Support
545
+
546
+ - [GitHub Issues](https://github.com/neosianexus/quality/issues) - Bug reports and feature requests
547
+ - [GitHub Sponsors](https://github.com/sponsors/neosianexus) - Support the project
548
+
549
+ ## License
550
+
551
+ [MIT](LICENSE) - Made with care by [neosianexus](https://github.com/neosianexus)