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,108 @@
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 (Node.js/Backend specific):**
37
+
38
+ - `API` - REST API endpoint tests
39
+ - `SRV` - Service layer tests
40
+ - `DB` - Database/ORM tests
41
+ - `MW` - Middleware tests
42
+ - `AUTH` - Authentication/Authorization tests
43
+ - `ROUTE` - Route handler tests
44
+ - `UTIL` - Utility function tests
45
+ - `CONFIG` - Configuration management tests
46
+ - `DOC` - Documentation Quality tests
47
+ - `E2E` - End-to-End workflow tests
48
+ - `INT` - Integration tests
49
+
50
+ **Type Suffixes:**
51
+
52
+ - `UNIT` - Unit tests
53
+ - `INT` - Integration tests
54
+ - `E2E` - End-to-end tests
55
+
56
+ **Examples:**
57
+
58
+ - `API-UNIT-001` - First unit test for API Endpoints
59
+ - `SRV-UNIT-001` - First unit test for Service Layer
60
+ - `DB-INT-001` - First integration test for Database Layer
61
+ - `E2E-WF-001` - First end-to-end workflow test
62
+
63
+ ### Test Method Naming
64
+
65
+ - Format: `methodName_scenario_expectedOutcome`
66
+ - Example: `getUserById_userExists_returnsUserObject`
67
+ - Use camelCase for all test method names
68
+
69
+ ## Test Data Management
70
+
71
+ - **Fixtures:** Update test fixtures when data structures change
72
+ - **Realistic Data:** Use realistic data in integration tests to catch real-world issues
73
+ - **Mock Strategy:** Mock external dependencies in unit tests for isolation
74
+ - **Test Database:** Use separate test database/environment for integration tests
75
+ - **Temporary File Cleanup:** Clean up all temporary test files, debug outputs, and mock data after test execution
76
+ - **Fixture Organization:** Move reusable test data to `/test/fixtures/` directory for proper organization
77
+
78
+ ## Test File Hygiene
79
+
80
+ - **No Orphaned Files:** Remove temporary test files created during debugging or development
81
+ - **Debug Output Cleanup:** Remove console.log statements and debug files before committing
82
+ - **Test Artifact Management:** Ensure test screenshots, logs, and reports are properly managed or cleaned up
83
+ - **Resource Management:** Properly dispose of file handles, database connections, and other test resources
84
+
85
+ ## Test Types and Patterns
86
+
87
+ - **Unit Tests:** Test individual functions, methods, and components in isolation
88
+ - **Integration Tests:** Test feature workflows and component interactions
89
+ - **End-to-End Tests:** Test complete user scenarios and workflows
90
+ - **Regression Tests:** Add tests for previously fixed bugs to prevent recurrence
91
+
92
+ ## Performance Testing
93
+
94
+ - **Test Execution Speed:** Keep unit tests fast (under 100ms each when possible)
95
+ - **Parallel Execution:** Structure tests to run safely in parallel
96
+ - **Resource Cleanup:** Ensure proper cleanup of test resources and temporary data
97
+ - **Memory Management:** Monitor and prevent memory leaks in long-running test suites
98
+
99
+ ## Test Maintenance
100
+
101
+ - **Regular Review:** Periodically review and refactor outdated tests
102
+ - **Documentation:** Document complex test scenarios and their purposes
103
+ - **Continuous Updates:** Update tests when requirements or APIs change
104
+ - **Test Quality:** Apply the same code quality standards to test code as production code
105
+ - **Update test-documentation.md:** Add new test cases to the appropriate table section
106
+ - **Status Tracking:** Update test status as development progresses
107
+ - **Table Format:** Maintain consistent table formatting and column alignment
108
+ - **ID Assignment:** Assign sequential IDs within each area (AREA-TYPE-001, AREA-TYPE-002, etc.)
@@ -0,0 +1,23 @@
1
+ {
2
+ "name": "node",
3
+ "description": "Node.js backend development template with API patterns, testing frameworks, and security best practices",
4
+ "prompts": [],
5
+ "vscodeSettings": {
6
+ "github.copilot.chat.codeGeneration.useInstructionFiles": true,
7
+ "chat.promptFiles": true,
8
+ "editor.formatOnSave": true,
9
+ "editor.codeActionsOnSave": {
10
+ "source.organizeImports": true,
11
+ "source.fixAll.eslint": true
12
+ },
13
+ "typescript.preferences.inlayHints.parameterNames.enabled": "all",
14
+ "typescript.preferences.inlayHints.variableTypes.enabled": true,
15
+ "files.exclude": {
16
+ "**/node_modules": true,
17
+ "**/dist": true,
18
+ "**/build": true,
19
+ "**/.nyc_output": true,
20
+ "**/coverage": true
21
+ }
22
+ }
23
+ }
@@ -0,0 +1,215 @@
1
+ ---
2
+ description: 'Python backend code review checklist with Django/Flask/FastAPI focus'
3
+ applyTo: '**/*.py'
4
+ ---
5
+
6
+ # Python Backend Code Review Focus Areas
7
+
8
+ ## Python Language and Framework Assessment
9
+
10
+ ### Code Quality and Pythonic Patterns
11
+
12
+ - **PEP 8 Compliance:** Does the code follow Python style guidelines?
13
+ - **Type Hints:** Are type hints used appropriately for function parameters and returns?
14
+ - **Docstrings:** Are docstrings present for classes, functions, and modules?
15
+ - **Python Idioms:** Does the code use Pythonic patterns (list comprehensions, context managers, etc.)?
16
+ - **Import Organization:** Are imports organized properly (standard library, third-party, local)?
17
+ - **Virtual Environment:** Is the project using virtual environments correctly?
18
+
19
+ ### Django-Specific Review Points
20
+
21
+ - **Model Design:** Are models properly structured with appropriate fields and relationships?
22
+ - **Migration Safety:** Are database migrations safe and reversible?
23
+ - **View Logic:** Are views handling only HTTP logic, delegating business logic to services?
24
+ - **Template Security:** Are templates using proper escaping and CSRF protection?
25
+ - **Admin Configuration:** Is Django admin configured securely and efficiently?
26
+ - **Settings Management:** Are settings properly organized by environment?
27
+
28
+ ### Flask/FastAPI-Specific Review Points
29
+
30
+ - **Application Factory:** Is the application using the factory pattern correctly?
31
+ - **Blueprint Organization:** Are blueprints used for modular code organization?
32
+ - **Request Handling:** Are request validation and serialization handled properly?
33
+ - **Error Handling:** Are custom error handlers implemented for different HTTP errors?
34
+ - **Configuration Management:** Is configuration handled securely across environments?
35
+ - **Extension Integration:** Are Flask extensions or FastAPI dependencies configured correctly?
36
+
37
+ ## Security Review for Python Applications
38
+
39
+ ### Authentication and Authorization
40
+
41
+ - **Password Security:** Are passwords hashed using secure algorithms (bcrypt, scrypt)?
42
+ - **Session Management:** Are sessions handled securely with proper timeouts?
43
+ - **JWT Implementation:** Are JWT tokens implemented with proper signing and validation?
44
+ - **Permission Classes:** Are Django permission classes or Flask decorators used correctly?
45
+ - **CSRF Protection:** Is CSRF protection enabled for state-changing operations?
46
+ - **CORS Configuration:** Are CORS settings configured appropriately for the application?
47
+
48
+ ### Input Validation and Data Security
49
+
50
+ - **Form Validation:** Are Django forms or serializers validating all inputs?
51
+ - **SQL Injection Prevention:** Is the ORM used properly to prevent SQL injection?
52
+ - **XSS Prevention:** Are user inputs properly escaped in templates?
53
+ - **File Upload Security:** Are file uploads validated and stored securely?
54
+ - **Environment Variables:** Are secrets stored in environment variables, not code?
55
+ - **Database Security:** Are database connections and queries secure?
56
+
57
+ ## Performance and Scalability Review
58
+
59
+ ### Database Optimization
60
+
61
+ - **Query Efficiency:** Are database queries optimized (select_related, prefetch_related)?
62
+ - **N+1 Query Prevention:** Are N+1 queries identified and resolved?
63
+ - **Database Indexing:** Are appropriate database indexes defined?
64
+ - **Migration Performance:** Do migrations handle large datasets efficiently?
65
+ - **Connection Pooling:** Is database connection pooling configured properly?
66
+ - **Raw SQL Usage:** Is raw SQL avoided where ORM can be used safely?
67
+
68
+ ### Caching and Performance
69
+
70
+ - **Caching Strategy:** Are appropriate caching mechanisms implemented (Redis, Memcached)?
71
+ - **View Caching:** Are expensive views cached appropriately?
72
+ - **Static Files:** Are static files served efficiently?
73
+ - **Async Implementation:** Are async views used where I/O operations are performed?
74
+ - **Background Tasks:** Are long-running operations moved to background tasks (Celery)?
75
+ - **Pagination:** Is pagination implemented for large datasets?
76
+
77
+ ## Testing and Quality Assurance
78
+
79
+ ### Test Coverage and Quality
80
+
81
+ - **Test Types:** Are unit, integration, and functional tests present?
82
+ - **Test Organization:** Are tests organized by functionality and easy to understand?
83
+ - **Factory Usage:** Are test factories (factory_boy) used for test data creation?
84
+ - **Mock Usage:** Are external dependencies properly mocked in tests?
85
+ - **Database Testing:** Are database operations tested with test databases?
86
+ - **API Testing:** Are API endpoints tested with proper assertions?
87
+
88
+ ### Testing Frameworks and Tools
89
+
90
+ - **pytest Configuration:** Is pytest configured correctly with appropriate plugins?
91
+ - **Coverage Reporting:** Is test coverage measured and reported?
92
+ - **Test Fixtures:** Are test fixtures used appropriately for setup and teardown?
93
+ - **Parameterized Tests:** Are parameterized tests used for multiple test scenarios?
94
+ - **Integration Testing:** Are third-party integrations tested appropriately?
95
+ - **Performance Testing:** Are performance-critical paths tested for scalability?
96
+
97
+ ## Error Handling and Logging
98
+
99
+ ### Exception Handling
100
+
101
+ - **Specific Exceptions:** Are specific exception types caught rather than bare except clauses?
102
+ - **Error Response Format:** Are API error responses consistent and informative?
103
+ - **Graceful Degradation:** Does the application handle failures gracefully?
104
+ - **Custom Exceptions:** Are custom exception classes defined for domain-specific errors?
105
+ - **Error Recovery:** Are there appropriate recovery mechanisms for transient errors?
106
+ - **User-Friendly Messages:** Are error messages helpful for both developers and users?
107
+
108
+ ### Logging and Monitoring
109
+
110
+ - **Logging Configuration:** Is logging configured appropriately for different environments?
111
+ - **Log Levels:** Are appropriate log levels used (DEBUG, INFO, WARNING, ERROR)?
112
+ - **Structured Logging:** Is structured logging used for easier parsing and analysis?
113
+ - **Sensitive Data:** Are sensitive data excluded from logs?
114
+ - **Performance Logging:** Are performance metrics logged for monitoring?
115
+ - **Error Tracking:** Is error tracking configured (Sentry, Rollbar)?
116
+
117
+ ## Deployment and Environment Configuration
118
+
119
+ ### Environment Management
120
+
121
+ - **Environment Variables:** Are all configuration values externalized to environment variables?
122
+ - **Settings Organization:** Are settings organized by environment (dev, staging, production)?
123
+ - **Secret Management:** Are secrets managed securely and not committed to version control?
124
+ - **Docker Configuration:** Are Docker configurations optimized for Python applications?
125
+ - **Dependency Management:** Are dependencies pinned to specific versions in requirements.txt?
126
+ - **Environment Isolation:** Are different environments properly isolated?
127
+
128
+ ### Production Readiness
129
+
130
+ - **WSGI/ASGI Configuration:** Is the WSGI/ASGI server configured correctly for production?
131
+ - **Static File Serving:** Are static files configured for production serving?
132
+ - **Database Configuration:** Is the database configured for production workloads?
133
+ - **Monitoring Setup:** Are monitoring and alerting configured for production?
134
+ - **Backup Strategy:** Is a backup strategy implemented for data protection?
135
+ - **Health Checks:** Are health check endpoints implemented for load balancers?
136
+
137
+ ## Temporary File Management and Cleanup
138
+
139
+ ### Python Artifact cleanup
140
+
141
+ - **Bytecode Files:** Are `__pycache__` directories and `.pyc` files cleaned up?
142
+ - **Build Artifacts:** Are `build/`, `dist/`, and `*.egg-info/` directories managed?
143
+ - **Test Artifacts:** Are test coverage files and pytest cache cleaned up?
144
+ - **Log File Rotation:** Are application logs rotated and old logs cleaned up?
145
+ - **Media File cleanup:** Are temporary uploaded files cleaned up appropriately?
146
+ - **Virtual Environment cleanup:** Are old virtual environments removed when not needed?
147
+
148
+ ### Cleanup Automation
149
+
150
+ - **Scheduled cleanup:** Are cleanup tasks scheduled appropriately?
151
+ - **Disk Space Monitoring:** Is disk space monitored to prevent storage issues?
152
+ - **Temporary File Management:** Are temporary files created and cleaned up properly?
153
+ - **Session cleanup:** Are expired sessions cleaned up from the database?
154
+ - **Cache Expiration:** Are cache entries expired and cleaned up appropriately?
155
+ - **Log Retention:** Are log retention policies implemented and enforced?
156
+
157
+ ## Workflow and Process Review
158
+
159
+ ### Development Workflow Compliance
160
+
161
+ - **7-Step Workflow:** Does the implementation follow the mandatory 7-step development workflow?
162
+ - **Test-Driven Development:** Were tests written before implementation (TDD approach)?
163
+ - **Documentation Updates:** Is all documentation current and accurate?
164
+ - **Task Management:** Are tasks properly tracked and status updated?
165
+ - **Code Review Process:** Has the code been properly reviewed before merging?
166
+ - **Version Control:** Are commits atomic and well-documented?
167
+
168
+ ### Quality Gates and Standards
169
+
170
+ - **Coding Standards:** Does the code follow established Python and framework-specific standards?
171
+ - **Security Standards:** Are security best practices followed throughout?
172
+ - **Performance Standards:** Does the code meet performance requirements?
173
+ - **Testing Standards:** Is test coverage adequate and tests meaningful?
174
+ - **Documentation Standards:** Is documentation comprehensive and up-to-date?
175
+ - **Deployment Standards:** Is the code ready for production deployment?
176
+
177
+ ## Framework-Specific Anti-Patterns
178
+
179
+ ### Django Anti-Patterns to Flag
180
+
181
+ - **Fat Models:** Models with too much business logic
182
+ - **Fat Views:** Views handling business logic instead of delegating
183
+ - **Circular Imports:** Apps importing from each other inappropriately
184
+ - **Direct DB Access:** Bypassing Django ORM without good reason
185
+ - **Missing Migrations:** Schema changes without corresponding migrations
186
+ - **Hardcoded URLs:** Using hardcoded URLs instead of reverse() or url names
187
+
188
+ ### Flask/FastAPI Anti-Patterns to Flag
189
+
190
+ - **Global State:** Using global variables for application state
191
+ - **No Application Factory:** Not using factory pattern for app creation
192
+ - **Missing Error Handling:** No custom error handlers for different scenarios
193
+ - **Blocking Operations:** Synchronous operations in async contexts
194
+ - **No Request Validation:** Missing input validation and serialization
195
+ - **Poor Configuration:** Configuration mixed with application code
196
+
197
+ ## Review Process Guidelines
198
+
199
+ ### Constructive Python-Specific Feedback
200
+
201
+ - **Framework Best Practices:** Suggest framework-specific improvements
202
+ - **Python Idioms:** Recommend more Pythonic approaches
203
+ - **Security Improvements:** Flag security vulnerabilities specific to Python/Django/Flask
204
+ - **Performance Optimizations:** Suggest Python-specific performance improvements
205
+ - **Testing Improvements:** Recommend better testing strategies for Python applications
206
+ - **Documentation:** Ensure Python docstring conventions are followed
207
+
208
+ ### Review Checklist
209
+
210
+ - **Code Quality:** Pythonic, PEP 8 compliant, well-documented
211
+ - **Security:** Input validation, authentication, authorization, SQL injection prevention
212
+ - **Performance:** Database optimization, caching, async where appropriate
213
+ - **Testing:** Comprehensive test coverage with appropriate testing strategies
214
+ - **Deployment:** Production-ready configuration and environment management
215
+ - **cleanup:** Proper temporary file and resource management