@tenantegroup/ai-rules-mcp 1.0.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 (67) hide show
  1. package/INSTALLATION.md +52 -0
  2. package/README.md +57 -0
  3. package/USAGE.md +46 -0
  4. package/package.json +57 -0
  5. package/rules/cloudflare/api-services.md +80 -0
  6. package/rules/cloudflare/cicd-deployment.md +56 -0
  7. package/rules/cloudflare/database-orm.md +28 -0
  8. package/rules/cloudflare/edge-parity.md +24 -0
  9. package/rules/cloudflare/kv-usage.md +31 -0
  10. package/rules/cloudflare/logging-observability.md +66 -0
  11. package/rules/cloudflare/performance.md +44 -0
  12. package/rules/cloudflare/realtime-background.md +58 -0
  13. package/rules/cloudflare/security.md +162 -0
  14. package/rules/cloudflare/seeding.md +27 -0
  15. package/rules/cloudflare/workflows.md +593 -0
  16. package/rules/dotnet/api.md +26 -0
  17. package/rules/dotnet/architecture.md +27 -0
  18. package/rules/dotnet/cli.md +26 -0
  19. package/rules/dotnet/configuration.md +26 -0
  20. package/rules/dotnet/logging.md +25 -0
  21. package/rules/dotnet/maui.md +26 -0
  22. package/rules/dotnet/mvvm.md +26 -0
  23. package/rules/dotnet/packaging.md +24 -0
  24. package/rules/dotnet/project-structure.md +26 -0
  25. package/rules/dotnet/sqlite.md +29 -0
  26. package/rules/dotnet/testing.md +24 -0
  27. package/rules/flutter/api.md +29 -0
  28. package/rules/flutter/architecture.md +34 -0
  29. package/rules/flutter/auth.md +27 -0
  30. package/rules/flutter/configuration.md +24 -0
  31. package/rules/flutter/database.md +30 -0
  32. package/rules/flutter/logging.md +27 -0
  33. package/rules/flutter/navigation.md +28 -0
  34. package/rules/flutter/offline-sync.md +26 -0
  35. package/rules/flutter/platform.md +30 -0
  36. package/rules/flutter/project-structure.md +32 -0
  37. package/rules/flutter/riverpod.md +32 -0
  38. package/rules/flutter/testing.md +31 -0
  39. package/rules/nuxt/architecture-principles.md +31 -0
  40. package/rules/nuxt/authentication.md +35 -0
  41. package/rules/nuxt/code-quality.md +71 -0
  42. package/rules/nuxt/configuration.md +31 -0
  43. package/rules/nuxt/core-directives.md +12 -0
  44. package/rules/nuxt/project-initialization.md +53 -0
  45. package/rules/nuxt/project-structure.md +44 -0
  46. package/rules/nuxt/testing.md +48 -0
  47. package/src/index.js +757 -0
  48. package/templates/cloudflare/compile-context.js +43 -0
  49. package/templates/cloudflare/hooks/post-checkout +5 -0
  50. package/templates/cloudflare/hooks/pre-commit +14 -0
  51. package/templates/cloudflare/install-hooks.js +34 -0
  52. package/templates/cloudflare/validate-code.js +57 -0
  53. package/templates/dotnet/compile-context.js +43 -0
  54. package/templates/dotnet/hooks/post-checkout +5 -0
  55. package/templates/dotnet/hooks/pre-commit +14 -0
  56. package/templates/dotnet/install-hooks.js +34 -0
  57. package/templates/dotnet/validate-code.js +84 -0
  58. package/templates/flutter/compile-context.js +43 -0
  59. package/templates/flutter/hooks/post-checkout +5 -0
  60. package/templates/flutter/hooks/pre-commit +14 -0
  61. package/templates/flutter/install-hooks.js +34 -0
  62. package/templates/flutter/validate-code.js +64 -0
  63. package/templates/nuxt/compile-context.js +43 -0
  64. package/templates/nuxt/hooks/post-checkout +5 -0
  65. package/templates/nuxt/hooks/pre-commit +14 -0
  66. package/templates/nuxt/install-hooks.js +34 -0
  67. package/templates/nuxt/validate-code.js +57 -0
@@ -0,0 +1,71 @@
1
+ # Code Quality Standards
2
+
3
+ ## TypeScript Requirements
4
+ - Enable strict mode in `tsconfig.json`
5
+ - Never use `any` type without justification
6
+ - Define interfaces for all data structures
7
+ - Use type inference where appropriate
8
+ - Export types for reuse across services
9
+
10
+ ## Code Organization
11
+ - Keep functions small and focused (single responsibility)
12
+ - Extract complex logic into named helper functions
13
+ - Group related functionality in services
14
+ - Avoid deep nesting (max 3 levels recommended)
15
+ - Use early returns to reduce nesting
16
+
17
+ ## Naming Conventions
18
+ - Use camelCase for variables and functions
19
+ - Use PascalCase for classes and types
20
+ - Use UPPER_CASE for constants
21
+ - Use descriptive names (avoid abbreviations)
22
+ - Prefix boolean variables with `is`, `has`, or `should`
23
+
24
+ ## Comments and Documentation
25
+ - Write self-documenting code when possible
26
+ - Comment only when code intent is not obvious
27
+ - Document complex business logic
28
+ - Explain "why" not "what" in comments
29
+ - Keep comments up-to-date with code changes
30
+
31
+ ## Error Handling
32
+ - Use typed error classes when appropriate
33
+ - Never swallow errors silently
34
+ - Log errors with appropriate context
35
+ - Return meaningful error messages to clients (without exposing internals)
36
+ - Handle async errors with try-catch or proper promise chains
37
+
38
+ ## Dependency Management
39
+ - Keep dependencies minimal
40
+ - Regularly update dependencies
41
+ - Review dependency security advisories
42
+ - Avoid adding dependencies for simple functionality
43
+ - Prefer Cloudflare-compatible packages
44
+
45
+ ## Code Reusability
46
+ - Extract shared logic into `/server/utils/`
47
+ - Create reusable services for common operations
48
+ - Define shared types in dedicated type files
49
+ - Avoid code duplication (DRY principle)
50
+ - Balance reusability with simplicity
51
+
52
+ ## Git Practices
53
+ - Write clear, descriptive commit messages
54
+ - Make small, focused commits
55
+ - Reference issues in commit messages when applicable
56
+ - Keep branches short-lived
57
+ - Squash commits when appropriate before merging
58
+
59
+ ## Pull Request Standards
60
+ - Include clear description of changes
61
+ - Link related issues
62
+ - Request review from appropriate team members
63
+ - Respond to review comments promptly
64
+ - Ensure CI passes before requesting review
65
+
66
+ ## Refactoring Guidelines
67
+ - Refactor incrementally, not in large batches
68
+ - Maintain test coverage during refactoring
69
+ - Run tests after each refactor step
70
+ - Document significant architectural changes
71
+ - Keep refactoring PRs separate from feature PRs when possible
@@ -0,0 +1,31 @@
1
+ # Configuration Standards
2
+
3
+ ## nuxt.config.ts
4
+ - Set Nitro preset to `cloudflare`
5
+ - Enable strict TypeScript mode
6
+ - Use runtime config for all secrets
7
+ - Never hardcode sensitive values
8
+
9
+ ## wrangler.toml
10
+ - Name D1 binding as `DB`
11
+ - Create separate environment blocks for dev, staging, and production
12
+ - Never include hardcoded secrets
13
+ - Declare all resource bindings explicitly (D1, KV, R2, Queues, Durable Objects)
14
+ - Specify compatibility date
15
+
16
+ ## drizzle.config.ts
17
+ - Define schema in `/server/db/schema.ts`
18
+ - Output migrations to `/drizzle` directory
19
+ - Set driver to `d1`
20
+ - Reference `wrangler.toml` for database credentials
21
+
22
+ ## Environment Variables
23
+ - Commit only `.env.example` to repository
24
+ - Store secrets in Cloudflare and GitHub Secrets
25
+ - Use different secrets per environment (dev, staging, production)
26
+ - Never commit actual `.env`, `.env.staging`, or `.env.production` files
27
+ - Never hardcode credentials in source code
28
+
29
+ ## File Commit Policy
30
+ - Commit all configuration files (nuxt.config.ts, wrangler.toml, drizzle.config.ts)
31
+ - Never commit files containing secrets
@@ -0,0 +1,12 @@
1
+ # ABSOLUTE CONSTRAINTS
2
+
3
+ 1. **Edge Parity:** You MUST design all code for the Cloudflare Workers runtime.
4
+ - Use Web Standard APIs (Fetch, Web Crypto).
5
+ - NEVER use Node.js core modules (`fs`, `path`, `process`).
6
+ - NEVER access `process.env` directly; use Nitro env bindings or `useRuntimeConfig()`.
7
+ 2. **Database (D1 & Drizzle):**
8
+ - Central schema file is `/server/db/schema.ts`.
9
+ - All queries MUST use Drizzle ORM. No raw SQL.
10
+ - Never use KV as primary relational storage.
11
+ 3. **Local Dev:** Assume `wrangler dev` is the source of truth for local parity, not `nuxt dev` alone.
12
+ 4. **Validation Requirement:** You MUST run `node .ai/scripts/validate-code.js` after writing any code to ensure edge compatibility.
@@ -0,0 +1,53 @@
1
+ # Project Initialization
2
+
3
+ ## Template Repository Policy
4
+ - Every new project begins from the official template repository
5
+ - No project starts from scratch
6
+ - Template includes pre-configured Nuxt + Cloudflare + Drizzle setup
7
+
8
+ ## New Project Checklist
9
+ Complete these steps in order for every new project:
10
+ - [ ] Initialize Nuxt project from template
11
+ - [ ] Add Cloudflare preset to Nitro config
12
+ - [ ] Install Drizzle ORM and drizzle-kit
13
+ - [ ] Configure Wrangler with separate environments (dev, staging, production)
14
+ - [ ] Create D1 databases for each environment
15
+ - [ ] Define initial database schema in `/server/db/schema.ts`
16
+ - [ ] Generate first migration using `drizzle-kit generate`
17
+ - [ ] Run migration using `drizzle-kit migrate`
18
+ - [ ] Create seed file at `/server/db/seed.ts` (if needed)
19
+ - [ ] Implement authentication based on project type
20
+ - [ ] Create first service in `/server/services/`
21
+ - [ ] Create first API route in `/server/api/`
22
+ - [ ] Add first test in `/tests/`
23
+ - [ ] Setup GitHub Actions workflow for CI/CD
24
+ - [ ] Deploy to staging and verify
25
+ - [ ] Deploy to production
26
+
27
+ ## Initial Configuration Files
28
+ Create and configure:
29
+ - `nuxt.config.ts` with Cloudflare preset and strict TypeScript
30
+ - `wrangler.toml` with environment blocks and bindings
31
+ - `drizzle.config.ts` with schema and migration paths
32
+ - `.env.example` with required environment variables (commit this only)
33
+ - `.gitignore` including `.env`, `.env.staging`, `.env.production`
34
+ - `README.md` with project setup and deployment instructions
35
+
36
+ ## First Feature Development
37
+ After initialization, implement this order:
38
+ 1. Define database schema for first domain
39
+ 2. Generate and run migration
40
+ 3. Create service with database queries
41
+ 4. Add unit tests for service
42
+ 5. Create API endpoint using service
43
+ 6. Add authentication middleware if needed
44
+ 7. Test locally with `wrangler dev`
45
+ 8. Deploy to staging
46
+
47
+ ## Documentation Requirements
48
+ Every project must include:
49
+ - README with setup instructions
50
+ - Environment variable documentation
51
+ - Database schema overview
52
+ - Authentication flow documentation
53
+ - Deployment process documentation
@@ -0,0 +1,44 @@
1
+ # Project Structure
2
+
3
+ ## Standard Directory Layout
4
+ Organize all projects using this structure:
5
+ ```
6
+ root/
7
+ app/ # UI layer
8
+ server/
9
+ api/ # REST endpoints
10
+ services/ # Business logic
11
+ db/ # Database layer
12
+ middleware/ # Auth, logging, request handling
13
+ utils/ # Shared utilities
14
+ tests/ # Test files
15
+ drizzle/ # Migration files
16
+ .github/workflows/ # CI/CD pipelines
17
+ nuxt.config.ts
18
+ drizzle.config.ts
19
+ wrangler.toml
20
+ README.md
21
+ ```
22
+
23
+ ## Structural Rules
24
+ - Place no business logic in API handlers
25
+ - Make no direct database calls in API files
26
+ - Use middleware for authentication and authorization
27
+ - Ensure services are testable without Nuxt runtime
28
+ - Keep API routes thin and focused on request/response handling
29
+
30
+ ## API Organization
31
+ For API-only services, organize routes by version:
32
+ ```
33
+ server/
34
+ api/
35
+ v1/
36
+ users.get.ts
37
+ users.post.ts
38
+ tasks.get.ts
39
+ ```
40
+
41
+ ## Service Organization
42
+ - Group services by domain or feature area
43
+ - Inject database instances into service constructors
44
+ - Keep services independent of framework-specific context
@@ -0,0 +1,48 @@
1
+ # Testing Requirements
2
+
3
+ ## Testing is Mandatory
4
+ Implement tests from day one. No exceptions.
5
+
6
+ ## Minimum Testing Requirements
7
+ Every project must have:
8
+ - Unit tests for all service methods
9
+ - Authentication middleware tests
10
+ - At least one database integration test per critical domain
11
+
12
+ ## Testing Pyramid (Early Stage)
13
+ Distribute tests as:
14
+ - 70% Service unit tests
15
+ - 20% Middleware/authentication tests
16
+ - 10% Database integration tests
17
+
18
+ ## Tooling
19
+ - Use Vitest as test runner
20
+ - Use Node test environment
21
+ - Mock only at external boundaries
22
+
23
+ ## Service Testing
24
+ - Inject database instances into services for easy mocking
25
+ - Test business rules independently of framework context
26
+ - Keep tests fast (unit suite should run in under 1 second)
27
+ - Mock at boundaries, never inside business rules
28
+
29
+ ## Middleware Testing
30
+ Test authentication and authorization:
31
+ - Missing token returns 401
32
+ - Invalid token returns 401
33
+ - Valid token allows request to proceed
34
+ - Roles are correctly enforced
35
+
36
+ ## Database Integration Testing
37
+ - Use local D1 binding for tests
38
+ - Run migrations before test execution
39
+ - Use isolated test database
40
+ - Reset database state between test runs
41
+ - Test at least one full CRUD cycle per domain
42
+
43
+ ## Test Principles
44
+ - Test business logic, not frameworks
45
+ - Ensure services are testable without Nuxt runtime
46
+ - Keep tests fast and focused
47
+ - Avoid testing framework internals
48
+ - Mock only external boundaries (database, APIs)