metacoding 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 (65) hide show
  1. package/CHANGELOG.md +91 -0
  2. package/LICENSE +21 -0
  3. package/README.md +244 -0
  4. package/bin/metacoding.js +27 -0
  5. package/lib/cli.d.ts +2 -0
  6. package/lib/cli.d.ts.map +1 -0
  7. package/lib/cli.js +83 -0
  8. package/lib/cli.js.map +1 -0
  9. package/lib/commands/init.d.ts +15 -0
  10. package/lib/commands/init.d.ts.map +1 -0
  11. package/lib/commands/init.js +185 -0
  12. package/lib/commands/init.js.map +1 -0
  13. package/lib/commands/update.d.ts +5 -0
  14. package/lib/commands/update.d.ts.map +1 -0
  15. package/lib/commands/update.js +20 -0
  16. package/lib/commands/update.js.map +1 -0
  17. package/lib/commands/validate.d.ts +5 -0
  18. package/lib/commands/validate.d.ts.map +1 -0
  19. package/lib/commands/validate.js +20 -0
  20. package/lib/commands/validate.js.map +1 -0
  21. package/lib/services/filesystem.d.ts +13 -0
  22. package/lib/services/filesystem.d.ts.map +1 -0
  23. package/lib/services/filesystem.js +84 -0
  24. package/lib/services/filesystem.js.map +1 -0
  25. package/lib/services/project-detector.d.ts +12 -0
  26. package/lib/services/project-detector.d.ts.map +1 -0
  27. package/lib/services/project-detector.js +191 -0
  28. package/lib/services/project-detector.js.map +1 -0
  29. package/lib/services/template-manager.d.ts +15 -0
  30. package/lib/services/template-manager.d.ts.map +1 -0
  31. package/lib/services/template-manager.js +167 -0
  32. package/lib/services/template-manager.js.map +1 -0
  33. package/lib/services/vscode.d.ts +10 -0
  34. package/lib/services/vscode.d.ts.map +1 -0
  35. package/lib/services/vscode.js +108 -0
  36. package/lib/services/vscode.js.map +1 -0
  37. package/lib/types/index.d.ts +66 -0
  38. package/lib/types/index.d.ts.map +1 -0
  39. package/lib/types/index.js +3 -0
  40. package/lib/types/index.js.map +1 -0
  41. package/package.json +134 -0
  42. package/templates/general/files/code-review.instructions.md +111 -0
  43. package/templates/general/files/copilot-instructions.md.template +404 -0
  44. package/templates/general/files/docs-update.instructions.md +203 -0
  45. package/templates/general/files/release.instructions.md +72 -0
  46. package/templates/general/files/test-runner.instructions.md +107 -0
  47. package/templates/general/template.json +9 -0
  48. package/templates/node/files/code-review.instructions.md +222 -0
  49. package/templates/node/files/copilot-instructions.md.template +391 -0
  50. package/templates/node/files/docs-update.instructions.md +203 -0
  51. package/templates/node/files/release.instructions.md +72 -0
  52. package/templates/node/files/test-runner.instructions.md +108 -0
  53. package/templates/node/template.json +23 -0
  54. package/templates/python/files/code-review.instructions.md +215 -0
  55. package/templates/python/files/copilot-instructions.md.template +418 -0
  56. package/templates/python/files/docs-update.instructions.md +203 -0
  57. package/templates/python/files/release.instructions.md +72 -0
  58. package/templates/python/files/test-runner.instructions.md +108 -0
  59. package/templates/python/template.json +75 -0
  60. package/templates/react/files/code-review.instructions.md +160 -0
  61. package/templates/react/files/copilot-instructions.md.template +472 -0
  62. package/templates/react/files/docs-update.instructions.md +203 -0
  63. package/templates/react/files/release.instructions.md +72 -0
  64. package/templates/react/files/test-runner.instructions.md +108 -0
  65. package/templates/react/template.json +14 -0
@@ -0,0 +1,107 @@
1
+ ---
2
+ description: 'Instructions for running and maintaining tests'
3
+ applyTo: 'test/**/*.ts'
4
+ ---
5
+
6
+ # Test Execution Guidelines
7
+
8
+ ## Pre-Commit Testing
9
+
10
+ - Run all tests before committing changes: `npm test`
11
+ - Ensure tests pass in both development and CI environments
12
+ - Fix failing tests before proceeding with commits
13
+ - Run specific test suites for targeted changes when appropriate
14
+
15
+ ## Test Development Standards
16
+
17
+ - **New Features:** Ensure all new features have corresponding unit tests
18
+ - **Test Coverage:** Aim for high coverage of critical functionality paths
19
+ - **Test Documentation:** Follow table format in `test/test-documentation.md` for all test cases
20
+ - **Test Organization:** Group related tests in describe blocks with clear hierarchy
21
+
22
+ ## Test Case Documentation Format
23
+
24
+ All test cases must be documented using the standardized table format:
25
+
26
+ ```markdown
27
+ | Test Case ID | Description | Type | Status |
28
+ | :------------ | :------------------------------------------ | :--- | :-------- |
29
+ | AREA-TYPE-001 | Brief but descriptive test case description | Unit | Completed |
30
+ ```
31
+
32
+ ## Test Case Naming Conventions
33
+
34
+ ### Test Case ID Format: `[AREA]-[TYPE]-[NUMBER]`
35
+
36
+ **Area Prefixes (adapt to your project):**
37
+
38
+ - `CORE` - Core application logic tests
39
+ - `API` - API/Service layer tests
40
+ - `UI` - User interface component tests
41
+ - `DB` - Database/Data layer tests
42
+ - `AUTH` - Authentication/Authorization tests
43
+ - `UTIL` - Utility function tests
44
+ - `CONFIG` - Configuration management tests
45
+ - `DOC` - Documentation Quality tests
46
+ - `E2E` - End-to-End workflow tests
47
+ - `INT` - Integration tests
48
+
49
+ **Type Suffixes:**
50
+
51
+ - `UNIT` - Unit tests
52
+ - `INT` - Integration tests
53
+ - `E2E` - End-to-end tests
54
+
55
+ **Examples:**
56
+
57
+ - `CORE-UNIT-001` - First unit test for Core Logic
58
+ - `API-UNIT-001` - First unit test for API Layer
59
+ - `DB-INT-001` - First integration test for Database
60
+ - `E2E-WF-001` - First end-to-end workflow test
61
+
62
+ ### Test Method Naming
63
+
64
+ - Format: `methodName_scenario_expectedOutcome`
65
+ - Example: `getUserById_userExists_returnsUserObject`
66
+ - Use camelCase for all test method names
67
+
68
+ ## Test Data Management
69
+
70
+ - **Fixtures:** Update test fixtures when data structures change
71
+ - **Realistic Data:** Use realistic data in integration tests to catch real-world issues
72
+ - **Mock Strategy:** Mock external dependencies in unit tests for isolation
73
+ - **Test Database:** Use separate test database/environment for integration tests
74
+ - **Temporary File Cleanup:** Clean up all temporary test files, debug outputs, and mock data after test execution
75
+ - **Fixture Organization:** Move reusable test data to `/test/fixtures/` directory for proper organization
76
+
77
+ ## Test File Hygiene
78
+
79
+ - **No Orphaned Files:** Remove temporary test files created during debugging or development
80
+ - **Debug Output Cleanup:** Remove console.log statements and debug files before committing
81
+ - **Test Artifact Management:** Ensure test screenshots, logs, and reports are properly managed or cleaned up
82
+ - **Resource Management:** Properly dispose of file handles, database connections, and other test resources
83
+
84
+ ## Test Types and Patterns
85
+
86
+ - **Unit Tests:** Test individual functions, methods, and components in isolation
87
+ - **Integration Tests:** Test feature workflows and component interactions
88
+ - **End-to-End Tests:** Test complete user scenarios and workflows
89
+ - **Regression Tests:** Add tests for previously fixed bugs to prevent recurrence
90
+
91
+ ## Performance Testing
92
+
93
+ - **Test Execution Speed:** Keep unit tests fast (under 100ms each when possible)
94
+ - **Parallel Execution:** Structure tests to run safely in parallel
95
+ - **Resource Cleanup:** Ensure proper cleanup of test resources and temporary data
96
+ - **Memory Management:** Monitor and prevent memory leaks in long-running test suites
97
+
98
+ ## Test Maintenance
99
+
100
+ - **Regular Review:** Periodically review and refactor outdated tests
101
+ - **Documentation:** Document complex test scenarios and their purposes
102
+ - **Continuous Updates:** Update tests when requirements or APIs change
103
+ - **Test Quality:** Apply the same code quality standards to test code as production code
104
+ - **Update test-documentation.md:** Add new test cases to the appropriate table section
105
+ - **Status Tracking:** Update test status as development progresses
106
+ - **Table Format:** Maintain consistent table formatting and column alignment
107
+ - **ID Assignment:** Assign sequential IDs within each area (AREA-TYPE-001, AREA-TYPE-002, etc.)
@@ -0,0 +1,9 @@
1
+ {
2
+ "name": "general",
3
+ "description": "General purpose metacoding template for any project type",
4
+ "prompts": [],
5
+ "vscodeSettings": {
6
+ "github.copilot.chat.codeGeneration.useInstructionFiles": true,
7
+ "chat.promptFiles": true
8
+ }
9
+ }
@@ -0,0 +1,222 @@
1
+ ---
2
+ description: "Node.js backend code review checklist with API and security focus"
3
+ applyTo: "**"
4
+ ---
5
+
6
+ # Node.js Backend Code Review Focus Areas
7
+
8
+ ## Workflow and Process Review
9
+
10
+ ### Development Workflow Compliance
11
+ - **7-Step Workflow:** Is the mandatory development workflow being followed?
12
+ - **Test-Driven Development:** Are tests written before implementation?
13
+ - **Documentation Updates:** Are all documentation changes included?
14
+ - **Task Management:** Are tasks properly tracked and updated?
15
+ - **Quality Gates:** Are all quality checks passing before moving to next step?
16
+
17
+ ### Code Review Process
18
+ - **Workflow Enforcement:** Ensure the team follows the mandatory 7-step development process
19
+ - **Step Completion:** Verify each workflow step is completed before proceeding
20
+ - **Documentation Currency:** Confirm all documentation is up to date
21
+ - **Test Coverage:** Validate comprehensive test coverage exists
22
+ - **Commit Quality:** Check that commits follow conventional format and include all related files
23
+
24
+ ## Functionality Assessment
25
+ - **Requirements Compliance:** Does the code meet the specified requirements?
26
+ - **API Design:** Are endpoints well-designed and follow RESTful principles?
27
+ - **Business Logic:** Is the business logic correctly implemented and separated from HTTP concerns?
28
+ - **Edge Cases:** Are edge cases properly handled, especially for API inputs?
29
+ - **Error Scenarios:** How does the code behave with invalid inputs and network failures?
30
+ - **Integration Points:** Do integrations with databases and external services work correctly?
31
+
32
+ ## Node.js-Specific Code Quality
33
+
34
+ ### Architecture and Organization
35
+ - **Layer Separation:** Are controllers, services, and repositories properly separated?
36
+ - **Middleware Usage:** Are middleware functions used appropriately for cross-cutting concerns?
37
+ - **Route Organization:** Are routes well-organized and grouped logically?
38
+ - **Dependency Injection:** Are dependencies properly injected and testable?
39
+ - **Module Structure:** Are modules well-structured with clear exports and imports?
40
+
41
+ ### Async Programming
42
+ - **Async/Await Usage:** Are async operations using async/await instead of callbacks?
43
+ - **Promise Handling:** Are promises properly handled with appropriate error catching?
44
+ - **Event Loop:** Does the code avoid blocking the event loop with synchronous operations?
45
+ - **Parallel Operations:** Are independent async operations run in parallel when possible?
46
+
47
+ ### Error Handling
48
+ - **Centralized Error Handling:** Is there a centralized error handling middleware?
49
+ - **HTTP Status Codes:** Are appropriate HTTP status codes used for different error types?
50
+ - **Error Messages:** Are error messages informative but not exposing sensitive information?
51
+ - **Async Error Handling:** Are async operations properly wrapped in try-catch blocks?
52
+
53
+ ## API Development Review
54
+
55
+ ### Endpoint Design
56
+ - **RESTful Design:** Do endpoints follow REST principles?
57
+ - **HTTP Methods:** Are appropriate HTTP methods used (GET, POST, PUT, DELETE)?
58
+ - **URL Structure:** Are URLs well-structured and consistent?
59
+ - **Request/Response Format:** Are request and response formats consistent and well-documented?
60
+ - **API Versioning:** Is API versioning strategy implemented correctly?
61
+
62
+ ### Request Handling
63
+ - **Input Validation:** Are all inputs validated before processing?
64
+ - **Parameter Parsing:** Are query parameters and request bodies parsed correctly?
65
+ - **Content-Type Handling:** Are different content types handled appropriately?
66
+ - **File Uploads:** Are file uploads handled securely with proper validation?
67
+
68
+ ### Response Management
69
+ - **Response Formatting:** Are responses consistently formatted?
70
+ - **Status Codes:** Are HTTP status codes used correctly?
71
+ - **Headers:** Are appropriate headers set for caching, security, etc.?
72
+ - **Pagination:** Is pagination implemented for list endpoints?
73
+
74
+ ## Security Review
75
+
76
+ ### Authentication and Authorization
77
+ - **Authentication Implementation:** Is authentication properly implemented and secure?
78
+ - **Token Management:** Are JWTs or other tokens handled securely?
79
+ - **Session Management:** Is session management secure if used?
80
+ - **Role-Based Access:** Is role-based access control properly implemented?
81
+ - **Permission Checks:** Are permission checks in place for all protected endpoints?
82
+ - **Authorization Logic:** Are authorization checks appropriate and comprehensive?
83
+
84
+ ### Input Security
85
+ - **Input Validation:** Are all inputs properly validated and sanitized?
86
+ - **SQL Injection:** Are database queries protected against injection attacks?
87
+ - **XSS Protection:** Are outputs properly escaped to prevent XSS?
88
+ - **CSRF Protection:** Is CSRF protection implemented where needed?
89
+ - **Rate Limiting:** Is rate limiting implemented to prevent abuse?
90
+
91
+ ### Data Protection
92
+ - **Sensitive Data:** Is sensitive data properly encrypted or hashed?
93
+ - **Environment Variables:** Are secrets stored in environment variables?
94
+ - **Data Exposure:** Is sensitive data accidentally exposed in logs or responses?
95
+ - **CORS Configuration:** Is CORS properly configured for the application needs?
96
+
97
+ ## Database and Performance Review
98
+
99
+ ### Database Operations
100
+ - **Query Optimization:** Are database queries optimized with appropriate indexes?
101
+ - **N+1 Problem:** Are N+1 query problems avoided?
102
+ - **Connection Management:** Are database connections properly managed and closed?
103
+ - **Transaction Usage:** Are database transactions used appropriately?
104
+ - **Migration Scripts:** Are database migrations safe and reversible?
105
+
106
+ ### Performance Considerations
107
+ - **Caching Strategy:** Is caching implemented where appropriate?
108
+ - **Memory Usage:** Are there potential memory leaks or excessive memory usage?
109
+ - **CPU-Intensive Operations:** Are CPU-intensive operations offloaded appropriately?
110
+ - **Response Times:** Are response times reasonable for API endpoints?
111
+ - **Resource Cleanup:** Are resources (connections, file handles) properly cleaned up?
112
+
113
+ ## Testing and Testability
114
+
115
+ ### Test Coverage
116
+ - **Unit Tests:** Are there sufficient unit tests for services and utilities?
117
+ - **Integration Tests:** Are API endpoints covered by integration tests?
118
+ - **Test Quality:** Do tests cover both happy paths and error scenarios?
119
+ - **Mock Usage:** Are external dependencies properly mocked in tests?
120
+ - **Test Data:** Are test fixtures and factories used appropriately?
121
+
122
+ ### Testability
123
+ - **Dependency Injection:** Is code structured to allow easy dependency injection for testing?
124
+ - **Pure Functions:** Are business logic functions pure and easily testable?
125
+ - **Isolation:** Can components be tested in isolation?
126
+ - **Test Environment:** Are tests isolated from each other and external dependencies?
127
+
128
+ ## Temporary File Management and Cleanup
129
+
130
+ ### File and Resource Management
131
+ - **File Upload Cleanup:** Are temporary uploaded files cleaned up after processing?
132
+ - **Log File Rotation:** Are log files rotated and old logs cleaned up?
133
+ - **Cache Cleanup:** Are cached files and data cleaned up when no longer needed?
134
+ - **Process Resources:** Are process resources (PID files, sockets) cleaned up on shutdown?
135
+ - **Database Connections:** Are database connections properly closed?
136
+ - **Resource cleanup:** Ensure all resources are properly cleaned and disposed
137
+
138
+ ### Build and Development Artifacts
139
+ - **Build Directory Cleanup:** Are build artifacts (`dist/`, `build/`) excluded from version control?
140
+ - **Test Artifacts:** Are test coverage reports and temporary test files cleaned up?
141
+ - **Node Modules:** Is `node_modules/` properly excluded from version control?
142
+ - **Environment Files:** Are `.env` files with secrets excluded from version control?
143
+
144
+ ### Memory and Resource Leaks
145
+ - **Event Listener Cleanup:** Are event listeners properly removed to prevent memory leaks?
146
+ - **Timer Cleanup:** Are intervals and timeouts properly cleared?
147
+ - **Stream Cleanup:** Are file and network streams properly closed?
148
+ - **Worker Process Cleanup:** Are worker processes and child processes properly terminated?
149
+
150
+ ## Configuration and Deployment
151
+
152
+ ### Environment Management
153
+ - **Configuration:** Is configuration properly externalized using environment variables?
154
+ - **Secret Management:** Are secrets managed securely and not committed to version control?
155
+ - **Environment Separation:** Are different environments (dev, staging, prod) properly configured?
156
+ - **Default Values:** Are sensible default values provided for configuration?
157
+
158
+ ### Deployment Readiness
159
+ - **Health Checks:** Are health check endpoints implemented?
160
+ - **Graceful Shutdown:** Does the application handle shutdown signals gracefully?
161
+ - **Process Management:** Is the application ready for process managers (PM2, Docker)?
162
+ - **Monitoring:** Are appropriate metrics and logging in place?
163
+
164
+ ## Common Node.js Anti-Patterns to Flag
165
+
166
+ ### Performance Anti-Patterns
167
+ - **Blocking Operations:** Synchronous file I/O or CPU-intensive operations on main thread
168
+ - **Callback Hell:** Nested callbacks instead of async/await
169
+ - **Memory Leaks:** Unclosed connections, retained references, growing event listeners
170
+ - **Inefficient Algorithms:** O(n²) operations on large datasets
171
+
172
+ ### Security Anti-Patterns
173
+ - **Eval Usage:** Using `eval()` or similar dynamic code execution
174
+ - **Prototype Pollution:** Unsafe object property assignment
175
+ - **Path Traversal:** Unsanitized file paths allowing directory traversal
176
+ - **Regex DoS:** Vulnerable regular expressions that can cause DoS
177
+
178
+ ### Architecture Anti-Patterns
179
+ - **God Controllers:** Controllers handling too many responsibilities
180
+ - **Direct Database Access:** Controllers directly accessing database instead of using services
181
+ - **Circular Dependencies:** Modules that depend on each other circularly
182
+ - **Global State:** Relying on global variables for application state
183
+
184
+ ## Review Process Guidelines
185
+
186
+ ### Constructive Feedback
187
+ - **Security First:** Prioritize security issues over other concerns
188
+ - **Performance Impact:** Consider the performance implications of changes
189
+ - **Scalability:** Think about how the code will perform under load
190
+ - **Maintainability:** Ensure code is readable and maintainable
191
+ - **API Consistency:** Maintain consistency across API endpoints
192
+
193
+ ### Backend-Specific Considerations
194
+ - **Database Impact:** Consider the impact of changes on database performance
195
+ - **API Breaking Changes:** Flag any breaking changes to API contracts
196
+ - **Dependency Updates:** Review new dependencies for security and compatibility
197
+ - **Error Handling:** Ensure comprehensive error handling throughout the stack
198
+ - **Monitoring:** Ensure adequate logging and monitoring capabilities
199
+
200
+ ## Automated Checks to Verify
201
+
202
+ ### Code Quality
203
+ - **ESLint:** Code passes linting rules with no errors
204
+ - **TypeScript:** TypeScript compilation succeeds without errors
205
+ - **Prettier:** Code follows formatting standards
206
+ - **Tests:** All tests pass including unit, integration, and API tests
207
+
208
+ ### Security Scans
209
+ - **Dependency Vulnerabilities:** No known vulnerabilities in dependencies
210
+ - **Static Analysis:** Security static analysis passes (Snyk, etc.)
211
+ - **Secret Detection:** No secrets or credentials in code
212
+
213
+ ### Performance Checks
214
+ - **Build Performance:** Build completes in reasonable time
215
+ - **Bundle Size:** Bundle size is within acceptable limits
216
+ - **Memory Usage:** No obvious memory leaks in test runs
217
+ - **Load Testing:** API endpoints perform well under expected load
218
+
219
+ ### Documentation
220
+ - **API Documentation:** OpenAPI/Swagger documentation is up to date
221
+ - **README:** Installation and setup instructions are current
222
+ - **Changelog:** User-facing changes are documented