@hatem427/code-guard-ci 3.0.0 → 3.1.0

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.
Files changed (102) hide show
  1. package/config/fastify.config.ts +326 -0
  2. package/config/hono.config.ts +331 -0
  3. package/config/nestjs.config.ts +500 -0
  4. package/config/node.config.ts +425 -0
  5. package/config/python.config.ts +512 -0
  6. package/dist/config/fastify.config.d.ts +17 -0
  7. package/dist/config/fastify.config.d.ts.map +1 -0
  8. package/dist/config/fastify.config.js +279 -0
  9. package/dist/config/fastify.config.js.map +1 -0
  10. package/dist/config/hono.config.d.ts +17 -0
  11. package/dist/config/hono.config.d.ts.map +1 -0
  12. package/dist/config/hono.config.js +287 -0
  13. package/dist/config/hono.config.js.map +1 -0
  14. package/dist/config/nestjs.config.d.ts +17 -0
  15. package/dist/config/nestjs.config.d.ts.map +1 -0
  16. package/dist/config/nestjs.config.js +440 -0
  17. package/dist/config/nestjs.config.js.map +1 -0
  18. package/dist/config/node.config.d.ts +17 -0
  19. package/dist/config/node.config.d.ts.map +1 -0
  20. package/dist/config/node.config.js +363 -0
  21. package/dist/config/node.config.js.map +1 -0
  22. package/dist/config/python.config.d.ts +15 -0
  23. package/dist/config/python.config.d.ts.map +1 -0
  24. package/dist/config/python.config.js +475 -0
  25. package/dist/config/python.config.js.map +1 -0
  26. package/dist/scripts/auto-fix.d.ts +5 -0
  27. package/dist/scripts/auto-fix.d.ts.map +1 -1
  28. package/dist/scripts/auto-fix.js +5 -0
  29. package/dist/scripts/auto-fix.js.map +1 -1
  30. package/dist/scripts/cli.js +2 -2
  31. package/dist/scripts/cli.js.map +1 -1
  32. package/dist/scripts/config-generators/ai-config-generator.d.ts.map +1 -1
  33. package/dist/scripts/config-generators/ai-config-generator.js +6 -0
  34. package/dist/scripts/config-generators/ai-config-generator.js.map +1 -1
  35. package/dist/scripts/config-generators/eslint-generator.d.ts.map +1 -1
  36. package/dist/scripts/config-generators/eslint-generator.js +108 -0
  37. package/dist/scripts/config-generators/eslint-generator.js.map +1 -1
  38. package/dist/scripts/config-generators/frameworks/fastify.d.ts +6 -0
  39. package/dist/scripts/config-generators/frameworks/fastify.d.ts.map +1 -0
  40. package/dist/scripts/config-generators/frameworks/fastify.js +68 -0
  41. package/dist/scripts/config-generators/frameworks/fastify.js.map +1 -0
  42. package/dist/scripts/config-generators/frameworks/hono.d.ts +6 -0
  43. package/dist/scripts/config-generators/frameworks/hono.d.ts.map +1 -0
  44. package/dist/scripts/config-generators/frameworks/hono.js +63 -0
  45. package/dist/scripts/config-generators/frameworks/hono.js.map +1 -0
  46. package/dist/scripts/config-generators/frameworks/index.d.ts +3 -0
  47. package/dist/scripts/config-generators/frameworks/index.d.ts.map +1 -1
  48. package/dist/scripts/config-generators/frameworks/index.js +7 -1
  49. package/dist/scripts/config-generators/frameworks/index.js.map +1 -1
  50. package/dist/scripts/config-generators/frameworks/nestjs.d.ts +6 -0
  51. package/dist/scripts/config-generators/frameworks/nestjs.d.ts.map +1 -0
  52. package/dist/scripts/config-generators/frameworks/nestjs.js +83 -0
  53. package/dist/scripts/config-generators/frameworks/nestjs.js.map +1 -0
  54. package/dist/scripts/config-generators/frameworks/node.d.ts +2 -2
  55. package/dist/scripts/config-generators/frameworks/node.d.ts.map +1 -1
  56. package/dist/scripts/config-generators/frameworks/node.js +56 -11
  57. package/dist/scripts/config-generators/frameworks/node.js.map +1 -1
  58. package/dist/scripts/config-generators/typescript-generator.d.ts.map +1 -1
  59. package/dist/scripts/config-generators/typescript-generator.js +33 -0
  60. package/dist/scripts/config-generators/typescript-generator.js.map +1 -1
  61. package/dist/scripts/config-generators/vscode-generator.d.ts.map +1 -1
  62. package/dist/scripts/config-generators/vscode-generator.js +73 -0
  63. package/dist/scripts/config-generators/vscode-generator.js.map +1 -1
  64. package/dist/scripts/generate-pr-checklist.d.ts +5 -0
  65. package/dist/scripts/generate-pr-checklist.d.ts.map +1 -1
  66. package/dist/scripts/generate-pr-checklist.js +6 -1
  67. package/dist/scripts/generate-pr-checklist.js.map +1 -1
  68. package/dist/scripts/postinstall.js +38 -0
  69. package/dist/scripts/postinstall.js.map +1 -1
  70. package/dist/scripts/precommit-check.d.ts +13 -0
  71. package/dist/scripts/precommit-check.d.ts.map +1 -1
  72. package/dist/scripts/precommit-check.js +288 -5
  73. package/dist/scripts/precommit-check.js.map +1 -1
  74. package/dist/scripts/utils/naming-validator.d.ts.map +1 -1
  75. package/dist/scripts/utils/naming-validator.js +96 -2
  76. package/dist/scripts/utils/naming-validator.js.map +1 -1
  77. package/dist/scripts/utils/project-detector.d.ts +12 -9
  78. package/dist/scripts/utils/project-detector.d.ts.map +1 -1
  79. package/dist/scripts/utils/project-detector.js +63 -11
  80. package/dist/scripts/utils/project-detector.js.map +1 -1
  81. package/dist/scripts/utils/structure-validator.d.ts.map +1 -1
  82. package/dist/scripts/utils/structure-validator.js +50 -0
  83. package/dist/scripts/utils/structure-validator.js.map +1 -1
  84. package/package.json +10 -3
  85. package/scripts/auto-fix.ts +5 -0
  86. package/scripts/cli.ts +2 -2
  87. package/scripts/config-generators/ai-config-generator.ts +9 -0
  88. package/scripts/config-generators/eslint-generator.ts +110 -0
  89. package/scripts/config-generators/frameworks/fastify.ts +65 -0
  90. package/scripts/config-generators/frameworks/hono.ts +60 -0
  91. package/scripts/config-generators/frameworks/index.ts +3 -0
  92. package/scripts/config-generators/frameworks/nestjs.ts +80 -0
  93. package/scripts/config-generators/frameworks/node.ts +57 -11
  94. package/scripts/config-generators/typescript-generator.ts +36 -0
  95. package/scripts/config-generators/vscode-generator.ts +84 -0
  96. package/scripts/generate-pr-checklist.ts +6 -1
  97. package/scripts/postinstall.ts +38 -0
  98. package/scripts/precommit-check.ts +334 -6
  99. package/scripts/utils/naming-validator.ts +104 -2
  100. package/scripts/utils/project-detector.ts +78 -11
  101. package/scripts/utils/structure-validator.ts +54 -0
  102. package/templates/feature-doc-backend.md +114 -0
@@ -0,0 +1,60 @@
1
+ /**
2
+ * hono.ts — Hono Backend Guidelines
3
+ * Generated guidelines for Hono projects.
4
+ */
5
+
6
+ export function honoGuidelines(): string {
7
+ return `## Hono Backend Guidelines
8
+
9
+ ### Philosophy & Architecture
10
+ - Hono is edge-first and runtime-agnostic (Cloudflare Workers, Deno, Bun, Node.js)
11
+ - Keep the app instance lean — compose routes using \`Hono\` sub-apps mounted via \`app.route('/prefix', subApp)\`
12
+ - Organise by feature: each domain has its own file exporting a \`Hono\` instance
13
+
14
+ ### Routing
15
+ - Use typed route handlers with Hono's TypeScript generics — \`app.get<'/users/:id', ...>(...)\`
16
+ - Group related routes into sub-apps: \`const users = new Hono()\` then \`app.route('/users', users)\`
17
+ - Use \`c.req.param()\`, \`c.req.query()\`, \`c.req.json()\` for typed access to request data
18
+ - Return responses via \`c.json(data, status)\` — never use raw \`Response\` objects unless necessary
19
+
20
+ ### Validation
21
+ - Use Zod + \`@hono/zod-validator\` middleware for request validation
22
+ - Apply the validator as a route middleware: \`app.post('/users', zValidator('json', schema), handler)\`
23
+ - Define schemas close to the route — collocate request and response types
24
+
25
+ ### Middleware
26
+ - Create middleware as \`const myMiddleware = createMiddleware(async (c, next) => { ... })\`
27
+ - Apply globally with \`app.use('*', middleware)\` or per-route with \`app.use('/api/*', middleware)\`
28
+ - Use built-in middleware: \`hono/cors\`, \`hono/logger\`, \`hono/etag\`, \`hono/compress\`
29
+ - Pass data between middleware and handlers using \`c.set()\` and \`c.get()\` with typed variables
30
+
31
+ ### Context & Variables
32
+ - Use \`createFactory\` and typed \`Variables\` to safely share request-scoped data between middleware
33
+ - Avoid global mutable state — everything goes through the context \`c\`
34
+
35
+ ### Error Handling
36
+ - Use \`app.onError((err, c) => c.json({ message: err.message }, 500))\` for global error handling
37
+ - Use \`app.notFound(c => c.json({ message: 'Not Found' }, 404))\` for 404s
38
+ - Throw \`HTTPException\` from middleware/handlers for expected errors: \`throw new HTTPException(401, { message: 'Unauthorized' })\`
39
+
40
+ ### Environment & Configuration
41
+ - Access environment variables via \`c.env\` (Cloudflare Workers) or process.env (Node.js/Bun)
42
+ - Use \`@hono/env\` or Zod to validate env vars at startup
43
+ - Never scatter \`process.env\` reads across route files — centralise config access
44
+
45
+ ### Edge Runtime Best Practices
46
+ - Avoid Node.js-specific built-ins (\`fs\`, \`path\`, \`crypto\` — use Web Crypto API instead)
47
+ - Keep responses stateless — no in-memory caches (use KV, D1, Redis)
48
+ - Use streaming responses for large payloads: \`c.stream()\` or \`c.streamText()\`
49
+
50
+ ### Testing
51
+ - Use Hono's \`app.request()\` helper for in-process testing — no server needed
52
+ - Test each sub-app independently by creating isolated instances
53
+ - Validate both success responses and error cases (400, 401, 404, 500)
54
+
55
+ ### Security
56
+ - Always add CORS middleware narrowed to allowed origins
57
+ - Use \`hono/secure-headers\` to add security headers
58
+ - Rate-limit via a Cloudflare WAF rule or \`@hono/rate-limiter\`
59
+ - Validate all user input with Zod before processing`;
60
+ }
@@ -14,4 +14,7 @@ export { vueGuidelines } from './vue';
14
14
  export { nuxtGuidelines } from './nuxt';
15
15
  export { svelteGuidelines } from './svelte';
16
16
  export { nodeGuidelines } from './node';
17
+ export { nestjsGuidelines } from './nestjs';
18
+ export { fastifyGuidelines } from './fastify';
19
+ export { honoGuidelines } from './hono';
17
20
  export { generalGuidelines } from './general';
@@ -0,0 +1,80 @@
1
+ /**
2
+ * nestjs.ts — NestJS Backend Guidelines
3
+ * Generated guidelines for NestJS projects.
4
+ */
5
+
6
+ export function nestjsGuidelines(): string {
7
+ return `## NestJS Backend Guidelines
8
+
9
+ ### Architecture & Modules
10
+ - Organize code into **feature modules** — each domain (user, auth, product) gets its own module file
11
+ - Use the module boundary to encapsulate: module → controller → service → repository
12
+ - Never import services from another module directly — use that module's exports instead
13
+ - Shared utilities (guards, pipes, interceptors) go in a \`common/\` or \`shared/\` module
14
+
15
+ ### Controllers
16
+ - Controllers handle HTTP concerns ONLY — route binding, request parsing, response shaping
17
+ - Never put business logic in a controller — delegate everything to the service layer
18
+ - Use NestJS built-in decorators: \`@Get()\`, \`@Post()\`, \`@Body()\`, \`@Param()\`, \`@Query()\`
19
+ - Always define the return type of controller methods explicitly
20
+ - Use \`@ApiTags()\` and \`@ApiOperation()\` for Swagger documentation
21
+
22
+ ### Services & Business Logic
23
+ - Services contain ALL business logic — keep them framework-agnostic where possible
24
+ - Injected via constructor DI — never instantiate services manually with \`new\`
25
+ - Mark services \`@Injectable()\` and register them in the module's \`providers\` array
26
+ - One service per aggregate/domain concept — avoid god services
27
+
28
+ ### DTOs & Validation
29
+ - ALWAYS define DTOs (Data Transfer Objects) for request bodies — never use raw \`any\` or plain objects
30
+ - Use \`class-validator\` decorators on DTOs: \`@IsString()\`, \`@IsEmail()\`, \`@IsNotEmpty()\`
31
+ - Apply \`ValidationPipe\` globally: \`app.useGlobalPipes(new ValidationPipe({ whitelist: true, forbidNonWhitelisted: true }))\`
32
+ - Use \`@Type()\` from \`class-transformer\` for nested object transformation
33
+ - Separate request DTOs from response DTOs — never expose internal entity fields directly
34
+
35
+ ### Guards & Authorization
36
+ - Use Guards for authentication and authorization — apply via \`@UseGuards()\` decorator
37
+ - Implement \`CanActivate\` interface for custom guards
38
+ - Apply guards at the controller or handler level — prefer global guards for auth, handler-level for roles
39
+ - Use custom \`@Roles()\` decorator + \`RolesGuard\` pattern for RBAC
40
+
41
+ ### Pipes
42
+ - Use Pipes for input transformation and validation: \`ParseIntPipe\`, \`ParseUUIDPipe\`, \`ValidationPipe\`
43
+ - Create custom pipes for complex transformations — implement \`PipeTransform\` interface
44
+ - Apply pipes at the parameter level for targeted transformation
45
+
46
+ ### Interceptors
47
+ - Use Interceptors for cross-cutting concerns: logging, caching, response transformation
48
+ - Implement \`NestInterceptor\` interface using RxJS \`Observable\`
49
+ - Apply globally for response wrapping (e.g., \`{ data: ..., statusCode: ... }\` envelope) or per-route
50
+
51
+ ### Exception Filters
52
+ - Use NestJS built-in \`HttpException\` subclasses for expected errors: \`NotFoundException\`, \`BadRequestException\`, \`ForbiddenException\`
53
+ - Create custom exception filters by implementing \`ExceptionFilter\` for domain-specific error shaping
54
+ - Apply \`@Catch()\` decorator to target specific exception types
55
+ - Never return raw error stack traces in production responses
56
+
57
+ ### Configuration
58
+ - Use \`@nestjs/config\` with \`ConfigModule.forRoot()\` for environment variables
59
+ - Access config via \`ConfigService\` — NEVER use \`process.env\` directly in services or controllers
60
+ - Validate env variables at startup with a Joi or Zod schema passed to \`validationSchema\`
61
+ - Store sensitive values in \`.env\` — never commit secrets to source control
62
+
63
+ ### Database & Repositories
64
+ - Use TypeORM or Prisma — avoid raw SQL strings in services
65
+ - Define repository abstraction (Repository pattern) — inject via \`@InjectRepository()\`
66
+ - Transactions: use QueryRunner for multi-step write operations
67
+ - Enable \`synchronize: false\` in production — always use migrations
68
+
69
+ ### Testing
70
+ - Unit test services and guards in isolation — mock the repository layer
71
+ - Integration test controllers with \`supertest\` via \`Test.createTestingModule()\`
72
+ - At minimum: test happy path + validation errors + unauthorized access
73
+ - Name test files \`*.spec.ts\` co-located with source files
74
+
75
+ ### Security
76
+ - Enable CORS explicitly: \`app.enableCors({ origin: allowedOrigins })\`
77
+ - Use \`helmet\` middleware: \`app.use(helmet())\`
78
+ - Use \`ThrottlerModule\` for rate limiting
79
+ - Sanitize all user inputs through DTOs + ValidationPipe whitelist`;
80
+ }
@@ -1,16 +1,62 @@
1
1
  /**
2
- * node.ts — Node.js Backend Guidelines
3
- * Generated guidelines for Node.js projects.
2
+ * node.ts — Express / Node.js Backend Guidelines
3
+ * Generated guidelines for Express and generic Node.js backend projects.
4
4
  */
5
5
 
6
6
  export function nodeGuidelines(): string {
7
- return `## Node.js Backend Guidelines
8
- - Use async/await — avoid callback patterns
9
- - Always handle errors with try/catch
10
- - Validate request inputs before processing
11
- - Use environment variables for configuration
12
- - Use middleware for cross-cutting concerns
13
- - Log errors with structured logging
14
- - Use connection pooling for database connections
15
- - Implement graceful shutdown handling`;
7
+ return `## Express / Node.js Backend Guidelines
8
+
9
+ ### Architecture
10
+ - Structure the project in layers: routes → controllers → services → data access
11
+ - Never put business logic in route handlers — keep handlers thin (parse request, call service, send response)
12
+ - Group routes by domain in separate router files: \`users.router.ts\`, \`auth.router.ts\`
13
+ - Apply a barrel file (\`routes/index.ts\`) to mount all routers into the main app
14
+
15
+ ### Async & Error Handling
16
+ - Use async/await throughout — avoid callbacks and raw Promises without \`.catch()\`
17
+ - Wrap async route handlers with an error-catching wrapper or use \`express-async-errors\`
18
+ - Always define a global error-handling middleware with 4 parameters: \`(err, req, res, next)\`
19
+ - Use typed custom error classes (extending \`Error\`) with a \`statusCode\` property
20
+ - Never expose stack traces in production responses
21
+
22
+ ### Middleware
23
+ - Apply middleware with a clear separation of concerns: auth, validation, logging, error handling
24
+ - Use \`helmet()\` for secure HTTP headers
25
+ - Use \`cors()\` with an explicit allowlist — never \`cors()\` with no options
26
+ - Apply \`express.json()\` and \`express.urlencoded()\` for body parsing
27
+ - Use \`morgan\` or a structured logger (Pino, Winston) — never \`console.log\` in production
28
+ - Rate limit public endpoints with \`express-rate-limit\`
29
+
30
+ ### Input Validation
31
+ - ALWAYS validate request inputs before processing — use Zod, Joi, or \`express-validator\`
32
+ - Validate \`req.body\`, \`req.params\`, and \`req.query\` separately
33
+ - Return 400 with a clear error message on validation failure
34
+
35
+ ### Security
36
+ - Never trust user input — validate and sanitize everything
37
+ - Use parameterized queries for all database operations — never interpolate user input into SQL
38
+ - Hash passwords with \`bcrypt\` (cost factor ≥ 12) — never store plaintext
39
+ - Store secrets in environment variables — validate at startup (fail fast)
40
+ - Enable \`trust proxy\` correctly when behind a reverse proxy (nginx, Cloudflare)
41
+
42
+ ### Configuration
43
+ - Use \`dotenv\` + a config module to centralise all \`process.env\` access
44
+ - Validate required env vars at startup — crash immediately if any are missing
45
+ - Never access \`process.env\` directly in route files or services
46
+
47
+ ### Database
48
+ - Use connection pooling — never create a new DB connection per request
49
+ - Use an ORM (Prisma, TypeORM) or query builder (Knex) — avoid raw SQL strings with interpolation
50
+ - Implement graceful shutdown: drain the connection pool before \`process.exit()\`
51
+
52
+ ### Graceful Shutdown
53
+ - Listen for \`SIGTERM\` and \`SIGINT\` signals
54
+ - Stop accepting new connections via \`server.close()\`, then close DB connections, then exit
55
+ - Use a timeout (e.g., 10 s) to force-exit if shutdown hangs
56
+
57
+ ### Testing
58
+ - Unit test service layer in isolation with mocked repositories
59
+ - Integration test routes with \`supertest\` — test happy path + validation errors + auth failures
60
+ - Co-locate tests with source: \`users.service.spec.ts\` next to \`users.service.ts\``;
16
61
  }
62
+
@@ -121,6 +121,42 @@ function buildTsConfig(project: DetectionResult): Record<string, any> {
121
121
  delete base.compilerOptions.lib;
122
122
  base.compilerOptions.lib = ['ES2022'];
123
123
  break;
124
+
125
+ case 'nestjs':
126
+ base.compilerOptions.target = 'ES2021';
127
+ base.compilerOptions.module = 'commonjs';
128
+ base.compilerOptions.moduleResolution = 'node';
129
+ base.compilerOptions.outDir = './dist';
130
+ base.compilerOptions.rootDir = './src';
131
+ base.compilerOptions.experimentalDecorators = true;
132
+ base.compilerOptions.emitDecoratorMetadata = true;
133
+ base.compilerOptions.allowSyntheticDefaultImports = true;
134
+ delete base.compilerOptions.lib;
135
+ base.compilerOptions.lib = ['ES2021'];
136
+ // NestJS doesn't want verbatimModuleSyntax (conflicts with metadata emission)
137
+ delete base.compilerOptions.verbatimModuleSyntax;
138
+ base.include = ['src/**/*.ts'];
139
+ break;
140
+
141
+ case 'fastify':
142
+ base.compilerOptions.module = 'NodeNext';
143
+ base.compilerOptions.moduleResolution = 'NodeNext';
144
+ base.compilerOptions.outDir = './dist';
145
+ base.compilerOptions.rootDir = './src';
146
+ delete base.compilerOptions.lib;
147
+ base.compilerOptions.lib = ['ES2022'];
148
+ base.include = ['src/**/*.ts'];
149
+ break;
150
+
151
+ case 'hono':
152
+ base.compilerOptions.module = 'ESNext';
153
+ base.compilerOptions.moduleResolution = 'bundler';
154
+ base.compilerOptions.outDir = './dist';
155
+ base.compilerOptions.rootDir = './src';
156
+ delete base.compilerOptions.lib;
157
+ base.compilerOptions.lib = ['ES2022'];
158
+ base.include = ['src/**/*.ts'];
159
+ break;
124
160
  }
125
161
 
126
162
  return base;
@@ -326,6 +326,39 @@ function buildTasks(project: DetectionResult): Record<string, any> {
326
326
  presentation: { reveal: 'always', panel: 'dedicated' },
327
327
  });
328
328
  break;
329
+
330
+ case 'nestjs':
331
+ tasks.push({
332
+ label: 'Dev Server (NestJS)',
333
+ type: 'shell',
334
+ command: `${runCmd} start:dev`,
335
+ isBackground: true,
336
+ problemMatcher: [],
337
+ presentation: { reveal: 'always', panel: 'dedicated' },
338
+ });
339
+ break;
340
+
341
+ case 'fastify':
342
+ tasks.push({
343
+ label: 'Dev Server (Fastify)',
344
+ type: 'shell',
345
+ command: `${runCmd} dev`,
346
+ isBackground: true,
347
+ problemMatcher: [],
348
+ presentation: { reveal: 'always', panel: 'dedicated' },
349
+ });
350
+ break;
351
+
352
+ case 'hono':
353
+ tasks.push({
354
+ label: 'Dev Server (Hono)',
355
+ type: 'shell',
356
+ command: `${runCmd} dev`,
357
+ isBackground: true,
358
+ problemMatcher: [],
359
+ presentation: { reveal: 'always', panel: 'dedicated' },
360
+ });
361
+ break;
329
362
  }
330
363
 
331
364
  // Code Guardian task
@@ -477,6 +510,57 @@ function buildLaunch(project: DetectionResult): Record<string, any> {
477
510
  );
478
511
  break;
479
512
 
513
+ case 'nestjs':
514
+ configurations.push(
515
+ {
516
+ name: 'NestJS: Debug',
517
+ type: 'node',
518
+ request: 'launch',
519
+ runtimeExecutable: '${workspaceFolder}/node_modules/.bin/ts-node',
520
+ args: ['${workspaceFolder}/src/main.ts'],
521
+ sourceMaps: true,
522
+ envFile: '${workspaceFolder}/.env',
523
+ cwd: '${workspaceFolder}',
524
+ skipFiles: ['<node_internals>/**'],
525
+ outFiles: ['${workspaceFolder}/dist/**/*.js'],
526
+ },
527
+ {
528
+ name: 'NestJS: Attach (--inspect)',
529
+ type: 'node',
530
+ request: 'attach',
531
+ port: 9229,
532
+ skipFiles: ['<node_internals>/**'],
533
+ restart: true,
534
+ },
535
+ );
536
+ break;
537
+
538
+ case 'fastify':
539
+ case 'hono':
540
+ configurations.push(
541
+ {
542
+ name: `${project.label}: Debug`,
543
+ type: 'node',
544
+ request: 'launch',
545
+ runtimeExecutable: '${workspaceFolder}/node_modules/.bin/ts-node',
546
+ args: ['${workspaceFolder}/src/index.ts'],
547
+ sourceMaps: true,
548
+ envFile: '${workspaceFolder}/.env',
549
+ cwd: '${workspaceFolder}',
550
+ skipFiles: ['<node_internals>/**'],
551
+ outFiles: ['${workspaceFolder}/dist/**/*.js'],
552
+ },
553
+ {
554
+ name: `${project.label}: Attach (--inspect)`,
555
+ type: 'node',
556
+ request: 'attach',
557
+ port: 9229,
558
+ skipFiles: ['<node_internals>/**'],
559
+ restart: true,
560
+ },
561
+ );
562
+ break;
563
+
480
564
  default:
481
565
  configurations.push(
482
566
  {
@@ -29,6 +29,11 @@ import * as logger from './utils/logger';
29
29
  import '../config/angular.config';
30
30
  import '../config/react.config';
31
31
  import '../config/nextjs.config';
32
+ import '../config/nestjs.config';
33
+ import '../config/node.config';
34
+ import '../config/fastify.config';
35
+ import '../config/hono.config';
36
+ import '../config/python.config';
32
37
 
33
38
  // ── Types ───────────────────────────────────────────────────────────────────
34
39
 
@@ -53,7 +58,7 @@ function parseArgs(): ChecklistOptions {
53
58
 
54
59
  switch (key) {
55
60
  case 'project':
56
- if (['angular', 'react', 'nextjs'].includes(value)) {
61
+ if (['angular', 'react', 'nextjs', 'nestjs', 'node', 'fastify', 'hono'].includes(value)) {
57
62
  opts.project = value as ProjectType;
58
63
  }
59
64
  break;
@@ -31,6 +31,44 @@ console.log(`
31
31
 
32
32
  git commit -m "test"
33
33
 
34
+ ──────────────────────────────────────────────────────────────
35
+
36
+ 🔐 Security Scanning — Required Tools (one-time install)
37
+
38
+ Code Guardian runs 3 layers of security checks on every commit:
39
+
40
+ Layer 1: npm audit ✅ built-in — no install needed
41
+ Layer 2: retire.js ✅ built-in — auto-installed via npx
42
+ Layer 3: Syft + Grype ⚠️ requires a one-time system install
43
+
44
+ Install Grype (CVE scanner):
45
+
46
+ Linux / macOS:
47
+ curl -sSfL https://raw.githubusercontent.com/anchore/grype/main/install.sh \\
48
+ | sh -s -- -b /usr/local/bin
49
+
50
+ macOS (Homebrew):
51
+ brew install anchore/grype/grype
52
+
53
+ Install Syft (SBOM generator — optional but recommended):
54
+
55
+ Linux / macOS:
56
+ curl -sSfL https://raw.githubusercontent.com/anchore/syft/main/install.sh \\
57
+ | sh -s -- -b /usr/local/bin
58
+
59
+ macOS (Homebrew):
60
+ brew install anchore/syft/syft
61
+
62
+ Verify installation:
63
+ grype version
64
+ syft version
65
+
66
+ ℹ️ If Grype/Syft are not installed, Layer 3 is skipped with a
67
+ warning — it will NOT block your commits until installed.
68
+ Layers 1 and 2 always run automatically.
69
+
70
+ ──────────────────────────────────────────────────────────────
71
+
34
72
  📖 Documentation:
35
73
  https://github.com/hatem427/code-guard-ci
36
74