metacoding 1.5.0 → 2.0.1

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 (95) hide show
  1. package/CHANGELOG.md +59 -0
  2. package/README.md +108 -514
  3. package/lib/cli.d.ts.map +1 -1
  4. package/lib/cli.js +18 -19
  5. package/lib/cli.js.map +1 -1
  6. package/lib/commands/init.d.ts +8 -14
  7. package/lib/commands/init.d.ts.map +1 -1
  8. package/lib/commands/init.js +105 -387
  9. package/lib/commands/init.js.map +1 -1
  10. package/lib/commands/update.d.ts +9 -9
  11. package/lib/commands/update.d.ts.map +1 -1
  12. package/lib/commands/update.js +141 -320
  13. package/lib/commands/update.js.map +1 -1
  14. package/lib/services/backup.d.ts +1 -1
  15. package/lib/services/backup.d.ts.map +1 -1
  16. package/lib/services/backup.js +10 -6
  17. package/lib/services/backup.js.map +1 -1
  18. package/lib/services/filesystem.d.ts.map +1 -1
  19. package/lib/services/filesystem.js +11 -5
  20. package/lib/services/filesystem.js.map +1 -1
  21. package/lib/services/gitignore-manager.js +5 -5
  22. package/lib/services/gitignore-manager.js.map +1 -1
  23. package/lib/services/project-detector.d.ts +9 -8
  24. package/lib/services/project-detector.d.ts.map +1 -1
  25. package/lib/services/project-detector.js +79 -197
  26. package/lib/services/project-detector.js.map +1 -1
  27. package/lib/services/skill-manager.d.ts +23 -0
  28. package/lib/services/skill-manager.d.ts.map +1 -0
  29. package/lib/services/skill-manager.js +212 -0
  30. package/lib/services/skill-manager.js.map +1 -0
  31. package/lib/types/index.d.ts +5 -15
  32. package/lib/types/index.d.ts.map +1 -1
  33. package/package.json +9 -17
  34. package/skills/metacoding-workflow/SKILL.md +52 -0
  35. package/skills/metacoding-workflow/agents/openai.yaml +4 -0
  36. package/skills/metacoding-workflow/assets/templates/changelog-entry.md +6 -0
  37. package/skills/metacoding-workflow/assets/templates/project-context.md +18 -0
  38. package/skills/metacoding-workflow/assets/templates/repeated-task-checklist.md +8 -0
  39. package/skills/metacoding-workflow/assets/templates/task-entry.md +9 -0
  40. package/skills/metacoding-workflow/assets/templates/test-plan.md +8 -0
  41. package/skills/metacoding-workflow/references/javascript.md +7 -0
  42. package/skills/metacoding-workflow/references/node.md +7 -0
  43. package/skills/metacoding-workflow/references/platform-adaptation.md +37 -0
  44. package/skills/metacoding-workflow/references/python.md +7 -0
  45. package/skills/metacoding-workflow/references/react.md +7 -0
  46. package/skills/metacoding-workflow/references/repository-organization.md +84 -0
  47. package/skills/metacoding-workflow/references/typescript.md +7 -0
  48. package/skills/metacoding-workflow/references/workflow-rules.md +54 -0
  49. package/skills/vendor-templates/claude-agent.md.template +41 -0
  50. package/lib/services/assistant-adapter.d.ts +0 -18
  51. package/lib/services/assistant-adapter.d.ts.map +0 -1
  52. package/lib/services/assistant-adapter.js +0 -246
  53. package/lib/services/assistant-adapter.js.map +0 -1
  54. package/lib/services/cursor.d.ts +0 -47
  55. package/lib/services/cursor.d.ts.map +0 -1
  56. package/lib/services/cursor.js +0 -314
  57. package/lib/services/cursor.js.map +0 -1
  58. package/lib/services/template-manager.d.ts +0 -23
  59. package/lib/services/template-manager.d.ts.map +0 -1
  60. package/lib/services/template-manager.js +0 -374
  61. package/lib/services/template-manager.js.map +0 -1
  62. package/lib/services/vscode.d.ts +0 -10
  63. package/lib/services/vscode.d.ts.map +0 -1
  64. package/lib/services/vscode.js +0 -108
  65. package/lib/services/vscode.js.map +0 -1
  66. package/templates/assistants/AGENTS.md +0 -203
  67. package/templates/assistants/CLAUDE.md +0 -156
  68. package/templates/assistants/GEMINI.md +0 -193
  69. package/templates/general/code-review.instructions.md +0 -265
  70. package/templates/general/copilot-instructions.md +0 -427
  71. package/templates/general/docs-update.instructions.md +0 -275
  72. package/templates/general/release.instructions.md +0 -242
  73. package/templates/general/template.json +0 -9
  74. package/templates/general/test-runner.instructions.md +0 -188
  75. package/templates/javascript/javascript.coding.instructions.md +0 -500
  76. package/templates/javascript/javascript.docs.instructions.md +0 -563
  77. package/templates/javascript/javascript.testing.instructions.md +0 -686
  78. package/templates/javascript/template.json +0 -36
  79. package/templates/node/nodejs.coding.instructions.md +0 -249
  80. package/templates/node/nodejs.docs.instructions.md +0 -261
  81. package/templates/node/nodejs.testing.instructions.md +0 -373
  82. package/templates/node/template.json +0 -23
  83. package/templates/python/python.coding.instructions.md +0 -338
  84. package/templates/python/python.docs.instructions.md +0 -1178
  85. package/templates/python/python.testing.instructions.md +0 -1073
  86. package/templates/python/template.json +0 -75
  87. package/templates/react/react.coding.instructions.md +0 -694
  88. package/templates/react/react.docs.instructions.md +0 -451
  89. package/templates/react/react.testing.instructions.md +0 -192
  90. package/templates/react/template.json +0 -14
  91. package/templates/react/test-runner.instructions.md +0 -135
  92. package/templates/typescript/template.json +0 -16
  93. package/templates/typescript/typescript.coding.instructions.md +0 -368
  94. package/templates/typescript/typescript.docs.instructions.md +0 -760
  95. package/templates/typescript/typescript.testing.instructions.md +0 -739
@@ -1,373 +0,0 @@
1
- ---
2
- description: 'Node.js backend testing strategies and frameworks'
3
- applyTo: 'test/**/*.{ts,js}'
4
- ---
5
-
6
- # Node.js Backend Testing Guidelines
7
-
8
- ## Test Case Naming Conventions
9
-
10
- ### Test Case ID Format: `[AREA]-[TYPE]-[NUMBER]`
11
-
12
- **Node.js/Backend Area Prefixes:**
13
-
14
- - `API` - REST API endpoint tests
15
- - `SRV` - Service layer tests
16
- - `DB` - Database/ORM tests
17
- - `AUTH` - Authentication/Authorization tests
18
- - `UTIL` - Backend utility function tests
19
- - `CONFIG` - Configuration management tests
20
- - `MIDDLEWARE` - Express middleware tests
21
- - `QUEUE` - Message queue/job processing tests
22
- - `CACHE` - Caching layer tests
23
- - `VALIDATION` - Input validation tests
24
-
25
- **Type Suffixes:**
26
-
27
- - `UNIT` - Unit tests (isolated component testing)
28
- - `INT` - Integration tests (component interaction testing)
29
- - `E2E` - End-to-end tests (full API workflow testing)
30
-
31
- **Examples:**
32
-
33
- - `API-UNIT-001` - First unit test for API endpoint
34
- - `SRV-UNIT-001` - First unit test for Service layer
35
- - `DB-INT-001` - First integration test for Database layer
36
- - `AUTH-E2E-001` - First end-to-end authentication test
37
-
38
- ## Testing Strategy Overview
39
-
40
- ### Testing Pyramid for Node.js Backend
41
-
42
- - **Unit Tests (70%):** Test individual functions and modules in isolation
43
- - **Integration Tests (20%):** Test interactions between components
44
- - **End-to-End Tests (10%):** Test complete user workflows through APIs
45
- - **Contract Tests:** Verify API contracts and external service interactions
46
-
47
- ### Test Framework Selection
48
-
49
- - **Primary Framework:** Jest for unit and integration testing
50
- - **API Testing:** Supertest for HTTP endpoint testing
51
- - **Database Testing:** Test containers or in-memory databases
52
- - **Mocking:** Jest mocks for external dependencies
53
- - **Load Testing:** Artillery or k6 for performance testing
54
-
55
- ## Unit Testing Best Practices
56
-
57
- ### Test Structure and Organization
58
-
59
- - **Test File Naming:** Use `.test.ts` or `.spec.ts` suffix
60
- - **Test Grouping:** Group related tests using `describe` blocks
61
- - **Test Isolation:** Each test should be independent and idempotent
62
- - **Test Data:** Use factories or builders for test data creation
63
- - **Test Cleanup:** Clean up resources after each test
64
-
65
- ```typescript
66
- // Example test structure
67
- describe('UserService', () => {
68
- let userService: UserService;
69
- let mockRepository: jest.Mocked<UserRepository>;
70
-
71
- beforeEach(() => {
72
- mockRepository = createMockRepository();
73
- userService = new UserService(mockRepository);
74
- });
75
-
76
- describe('createUser', () => {
77
- it('should create a user with valid data', async () => {
78
- // Arrange
79
- const userData = UserFactory.build();
80
- mockRepository.save.mockResolvedValue(userData);
81
-
82
- // Act
83
- const result = await userService.createUser(userData);
84
-
85
- // Assert
86
- expect(result).toEqual(userData);
87
- expect(mockRepository.save).toHaveBeenCalledWith(userData);
88
- });
89
-
90
- it('should throw ValidationError for invalid email', async () => {
91
- // Arrange
92
- const invalidUserData = UserFactory.build({ email: 'invalid-email' });
93
-
94
- // Act & Assert
95
- await expect(userService.createUser(invalidUserData)).rejects.toThrow(
96
- ValidationError
97
- );
98
- });
99
- });
100
- });
101
- ```
102
-
103
- ### Mocking Strategies
104
-
105
- - **External Dependencies:** Mock all external services and databases
106
- - **File System Operations:** Mock file system interactions
107
- - **Time-Dependent Code:** Mock dates and timers
108
- - **Environment Variables:** Mock configuration and environment
109
- - **HTTP Requests:** Mock external API calls
110
-
111
- ```typescript
112
- // Example mocking patterns
113
- jest.mock('fs-extra');
114
- jest.mock('../services/email-service');
115
-
116
- const mockFs = fs as jest.Mocked<typeof fs>;
117
- const mockEmailService = EmailService as jest.MockedClass<typeof EmailService>;
118
-
119
- describe('FileProcessor', () => {
120
- beforeEach(() => {
121
- jest.clearAllMocks();
122
- mockFs.readFile.mockResolvedValue('file content');
123
- });
124
- });
125
- ```
126
-
127
- ## Integration Testing
128
-
129
- ### Database Testing
130
-
131
- - **Test Database:** Use separate test database or test containers
132
- - **Transaction Rollback:** Rollback transactions after each test
133
- - **Seed Data:** Create consistent test data sets
134
- - **Migration Testing:** Test database migrations
135
- - **Performance Testing:** Test query performance
136
-
137
- ```typescript
138
- // Example database integration test
139
- describe('UserRepository Integration', () => {
140
- let repository: UserRepository;
141
- let connection: Connection;
142
-
143
- beforeAll(async () => {
144
- connection = await createTestConnection();
145
- repository = new UserRepository(connection);
146
- });
147
-
148
- afterAll(async () => {
149
- await connection.close();
150
- });
151
-
152
- beforeEach(async () => {
153
- await connection.synchronize(true); // Reset database
154
- });
155
-
156
- it('should save and retrieve user correctly', async () => {
157
- // Arrange
158
- const userData = UserFactory.build();
159
-
160
- // Act
161
- const savedUser = await repository.save(userData);
162
- const retrievedUser = await repository.findById(savedUser.id);
163
-
164
- // Assert
165
- expect(retrievedUser).toEqual(savedUser);
166
- });
167
- });
168
- ```
169
-
170
- ### API Endpoint Testing
171
-
172
- - **HTTP Testing:** Use Supertest for endpoint testing
173
- - **Authentication Testing:** Test auth middleware and permissions
174
- - **Validation Testing:** Test request validation and error responses
175
- - **Response Format:** Verify response structure and data types
176
- - **Status Code Testing:** Test all possible HTTP status codes
177
-
178
- ```typescript
179
- // Example API endpoint test
180
- describe('POST /api/v1/users', () => {
181
- let app: Application;
182
-
183
- beforeAll(() => {
184
- app = createTestApp();
185
- });
186
-
187
- it('should create user with valid data', async () => {
188
- // Arrange
189
- const userData = UserFactory.build();
190
-
191
- // Act
192
- const response = await request(app)
193
- .post('/api/v1/users')
194
- .send(userData)
195
- .expect(201);
196
-
197
- // Assert
198
- expect(response.body.success).toBe(true);
199
- expect(response.body.data.email).toBe(userData.email);
200
- });
201
-
202
- it('should return 400 for invalid email', async () => {
203
- // Arrange
204
- const invalidData = UserFactory.build({ email: 'invalid' });
205
-
206
- // Act
207
- const response = await request(app)
208
- .post('/api/v1/users')
209
- .send(invalidData)
210
- .expect(400);
211
-
212
- // Assert
213
- expect(response.body.success).toBe(false);
214
- expect(response.body.error.code).toBe('VALIDATION_ERROR');
215
- });
216
- });
217
- ```
218
-
219
- ## End-to-End Testing
220
-
221
- ### Full Workflow Testing
222
-
223
- - **User Scenarios:** Test complete user journeys
224
- - **Multi-Service Testing:** Test interactions between services
225
- - **Real Database:** Use real database for E2E tests
226
- - **External Services:** Use real or staging external services
227
- - **Browser Testing:** Test web interfaces if applicable
228
-
229
- ### Authentication and Authorization Testing
230
-
231
- - **Login Flows:** Test complete authentication flows
232
- - **Token Management:** Test token generation and validation
233
- - **Permission Testing:** Test role-based access control
234
- - **Session Management:** Test session creation and cleanup
235
- - **Security Testing:** Test for common security vulnerabilities
236
-
237
- ## Performance Testing
238
-
239
- ### Load Testing Strategies
240
-
241
- - **Baseline Performance:** Establish performance baselines
242
- - **Stress Testing:** Test system limits and breaking points
243
- - **Spike Testing:** Test sudden load increases
244
- - **Volume Testing:** Test with large amounts of data
245
- - **Endurance Testing:** Test sustained load over time
246
-
247
- ```javascript
248
- // Example Artillery load test configuration
249
- config:
250
- target: 'http://localhost:3000'
251
- phases:
252
- - duration: 60
253
- arrivalRate: 10
254
- - duration: 120
255
- arrivalRate: 50
256
- - duration: 60
257
- arrivalRate: 10
258
-
259
- scenarios:
260
- - name: 'User Creation Flow'
261
- weight: 70
262
- flow:
263
- - post:
264
- url: '/api/v1/users'
265
- json:
266
- email: '{{ $randomEmail() }}'
267
- name: '{{ $randomString() }}'
268
- - think: 1
269
-
270
- - name: 'User Retrieval'
271
- weight: 30
272
- flow:
273
- - get:
274
- url: '/api/v1/users/{{ userId }}'
275
- ```
276
-
277
- ### Database Performance Testing
278
-
279
- - **Query Performance:** Test slow query detection
280
- - **Connection Pool Testing:** Test connection pool limits
281
- - **Transaction Performance:** Test transaction overhead
282
- - **Index Effectiveness:** Test query optimization
283
- - **Data Volume Testing:** Test with production-like data volumes
284
-
285
- ## Test Data Management
286
-
287
- ### Test Factories and Builders
288
-
289
- - **Data Factories:** Create consistent test data
290
- - **Builder Pattern:** Flexible test data creation
291
- - **Realistic Data:** Use realistic but not real user data
292
- - **Data Relationships:** Handle related entity creation
293
- - **Data Cleanup:** Ensure test data doesn't leak between tests
294
-
295
- ```typescript
296
- // Example test factory
297
- export class UserFactory {
298
- static build(overrides: Partial<User> = {}): User {
299
- return {
300
- id: faker.string.uuid(),
301
- email: faker.internet.email(),
302
- name: faker.person.fullName(),
303
- createdAt: new Date(),
304
- updatedAt: new Date(),
305
- ...overrides,
306
- };
307
- }
308
-
309
- static buildMany(count: number, overrides?: Partial<User>): User[] {
310
- return Array.from({ length: count }, () => this.build(overrides));
311
- }
312
- }
313
- ```
314
-
315
- ### Database Seeding and Fixtures
316
-
317
- - **Seed Scripts:** Create consistent database states
318
- - **Fixture Management:** Manage test fixture lifecycle
319
- - **Data Isolation:** Prevent test data interference
320
- - **Cleanup Strategies:** Efficient test cleanup procedures
321
- - **Snapshot Testing:** Use database snapshots for complex scenarios
322
-
323
- ## Security Testing
324
-
325
- ### Authentication Testing
326
-
327
- - **Token Validation:** Test JWT token validation
328
- - **Password Security:** Test password hashing and validation
329
- - **Brute Force Protection:** Test rate limiting and account lockout
330
- - **Session Security:** Test session hijacking prevention
331
- - **Multi-Factor Authentication:** Test MFA implementation
332
-
333
- ### Authorization Testing
334
-
335
- - **Role-Based Access:** Test different user roles and permissions
336
- - **Resource Access:** Test access to protected resources
337
- - **Privilege Escalation:** Test prevention of privilege escalation
338
- - **Cross-Tenant Access:** Test multi-tenant isolation
339
- - **API Security:** Test API authentication and authorization
340
-
341
- ### Vulnerability Testing
342
-
343
- - **Input Validation:** Test for injection attacks
344
- - **Cross-Site Scripting:** Test XSS prevention
345
- - **Cross-Site Request Forgery:** Test CSRF protection
346
- - **Dependency Scanning:** Test for vulnerable dependencies
347
- - **Security Headers:** Test security header implementation
348
-
349
- ## Test Environment Management
350
-
351
- ### Environment Isolation
352
-
353
- - **Test Containers:** Use Docker containers for isolation
354
- - **Environment Variables:** Manage test-specific configuration
355
- - **Service Mocking:** Mock external services appropriately
356
- - **Database Isolation:** Separate test databases
357
- - **Network Isolation:** Isolate test network traffic
358
-
359
- ### Continuous Integration Testing
360
-
361
- - **Pipeline Integration:** Run tests in CI/CD pipelines
362
- - **Parallel Testing:** Run tests in parallel for speed
363
- - **Test Reporting:** Generate comprehensive test reports
364
- - **Coverage Reporting:** Track and report test coverage
365
- - **Failure Analysis:** Analyze and debug test failures
366
-
367
- ### Test Monitoring and Metrics
368
-
369
- - **Test Performance:** Monitor test execution time
370
- - **Flaky Test Detection:** Identify and fix unreliable tests
371
- - **Coverage Trends:** Track test coverage over time
372
- - **Test Maintenance:** Regularly review and update tests
373
- - **Quality Gates:** Enforce quality standards through testing
@@ -1,23 +0,0 @@
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
- }