metacoding 1.2.1 → 1.3.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.
@@ -0,0 +1,532 @@
1
+ ---
2
+ description: 'JavaScript documentation standards for browser and Node.js environments'
3
+ applyTo: '**/*.md'
4
+ ---
5
+
6
+ # JavaScript Documentation Guidelines
7
+
8
+ ## Documentation Architecture Principles
9
+
10
+ This project enforces a strict distinction between different types of documentation to ensure clarity, maintainability, and appropriate use of status indicators across all JavaScript project types.
11
+
12
+ ### System Documentation (Evergreen, Factual)
13
+
14
+ **Purpose:** Describes the current state of the system, architecture, and implemented features.
15
+ **Files:** README.md, architecture.md, api-design.md, system-documentation.md, code documentation
16
+ **Language:** Present tense, factual, descriptive
17
+ **Status Indicators:** ❌ **NEVER use status emojis or temporal language**
18
+ **Content Focus:** What exists now, how it works, what it does
19
+ **Examples:**
20
+
21
+ - ✅ Correct: "The authentication module uses JWT tokens"
22
+ - ❌ Incorrect: "🚧 Authentication module (in progress)"
23
+ - ✅ Correct: "The API client supports the following endpoints:"
24
+ - ❌ Incorrect: "📋 Planned API endpoints:"
25
+
26
+ ### Project Management Documentation (Temporal, Status-Oriented)
27
+
28
+ **Purpose:** Tracks work progress, planning, and execution status.
29
+ **Files:** project-task-list.md, sprint-planning.md, backlog.md
30
+ **Language:** Status-oriented, temporal references allowed
31
+ **Status Indicators:** ✅ **Required - use emojis and progress indicators**
32
+ **Content Focus:** What needs to be done, work progress, planning
33
+ **Examples:**
34
+
35
+ - ✅ Correct: "🚧 In Progress - Authentication module implementation"
36
+ - ✅ Correct: "✅ Completed - JWT token validation"
37
+ - ✅ Correct: "📋 Backlog - Add OAuth integration"
38
+
39
+ ### User Documentation (Instructional, Current)
40
+
41
+ **Purpose:** Helps users understand how to use the system.
42
+ **Files:** Installation guides, usage examples, tutorials
43
+ **Language:** Imperative, instructional, present tense
44
+ **Status Indicators:** ⚠️ **Use sparingly** - only for actual user-facing feature status
45
+ **Content Focus:** How to use, what users can do, step-by-step guidance
46
+
47
+ ## Documentation Quality Standards
48
+
49
+ - **Clarity:** Write clear, concise explanations appropriate for JavaScript developers
50
+ - **Completeness:** Ensure documentation covers all necessary aspects of JavaScript projects
51
+ - **Accuracy:** Verify all information is current and correct
52
+ - **Consistency:** Maintain consistent tone and formatting across all documentation
53
+ - **Accessibility:** Use clear language and proper formatting for accessibility
54
+ - **Architecture Compliance:** Follow the system vs project documentation distinction
55
+
56
+ ## Task ID Naming Convention for JavaScript Projects
57
+
58
+ Follow the standardized task naming format for all project management documentation:
59
+
60
+ #### Required Task Format
61
+
62
+ ```markdown
63
+ - [ ] **[AREA]-TASK-001: Task title** - ❌ **NOT STARTED**
64
+ - Detailed task description and requirements
65
+ - Implementation steps and acceptance criteria
66
+ ```
67
+
68
+ #### JavaScript-Specific Area Prefixes
69
+
70
+ **Frontend/Browser Areas:**
71
+
72
+ - `DOM` - DOM manipulation and browser API tasks
73
+ - `UI` - User interface component tasks
74
+ - `EVENT` - Event handling and interaction tasks
75
+ - `API_CLIENT` - API client and HTTP request tasks
76
+ - `UTIL` - Utility function tasks
77
+
78
+ **Node.js/Server Areas:**
79
+
80
+ - `SERVER` - Server-side application tasks
81
+ - `CLI` - Command-line interface tasks
82
+ - `MODULE` - Module and package development tasks
83
+ - `CONFIG` - Configuration management tasks
84
+
85
+ **Universal Areas:**
86
+
87
+ - `CORE` - Core application logic tasks
88
+ - `PKG` - Package/library functionality tasks
89
+ - `DOC` - Documentation tasks
90
+ - `TEST` - Testing infrastructure tasks
91
+
92
+ **Examples:**
93
+
94
+ - `DOM-TASK-001: Implement form validation`
95
+ - `API_CLIENT-TASK-002: Add authentication headers`
96
+ - `SERVER-TASK-003: Create user authentication middleware`
97
+ - `CLI-TASK-004: Add command-line argument parsing`
98
+
99
+ ## README.md Standards for JavaScript Projects
100
+
101
+ **⚠️ README.md is system documentation - NO status indicators or temporal language allowed**
102
+
103
+ ### JavaScript Project README Template
104
+
105
+ ````markdown
106
+ # Project Name
107
+
108
+ Brief description of what the project does and its main purpose.
109
+
110
+ ## Features
111
+
112
+ - Feature 1: Description of implemented functionality
113
+ - Feature 2: Description of implemented functionality
114
+ - Feature 3: Description of implemented functionality
115
+
116
+ ## Installation
117
+
118
+ ### Prerequisites
119
+
120
+ - Node.js 18+ (for Node.js projects)
121
+ - Modern browser supporting ES2020+ (for browser projects)
122
+
123
+ ### Install Dependencies
124
+
125
+ ```bash
126
+ npm install
127
+ ```
128
+ ````
129
+
130
+ ### Development Setup
131
+
132
+ ```bash
133
+ npm run dev
134
+ ```
135
+
136
+ ### Build for Production
137
+
138
+ ```bash
139
+ npm run build
140
+ ```
141
+
142
+ ## Usage
143
+
144
+ ### Basic Example
145
+
146
+ ```javascript
147
+ import { ExampleClass } from './src/example.js';
148
+
149
+ const example = new ExampleClass();
150
+ const result = example.processData(inputData);
151
+ console.log(result);
152
+ ```
153
+
154
+ ### API Reference
155
+
156
+ #### ExampleClass
157
+
158
+ Main class for handling data processing.
159
+
160
+ **Constructor**
161
+
162
+ - `new ExampleClass(options)` - Creates new instance with optional configuration
163
+
164
+ **Methods**
165
+
166
+ - `processData(data)` - Processes input data and returns result
167
+ - `validateInput(input)` - Validates input data format
168
+
169
+ ## Configuration
170
+
171
+ Configuration options for the application:
172
+
173
+ ```javascript
174
+ const config = {
175
+ apiUrl: 'https://api.example.com',
176
+ timeout: 5000,
177
+ retries: 3,
178
+ };
179
+ ```
180
+
181
+ ## Testing
182
+
183
+ Run the test suite:
184
+
185
+ ```bash
186
+ npm test
187
+ ```
188
+
189
+ Run tests in watch mode:
190
+
191
+ ```bash
192
+ npm run test:watch
193
+ ```
194
+
195
+ Generate coverage report:
196
+
197
+ ```bash
198
+ npm run test:coverage
199
+ ```
200
+
201
+ ## Contributing
202
+
203
+ 1. Fork the repository
204
+ 2. Create a feature branch
205
+ 3. Make your changes
206
+ 4. Add tests for new functionality
207
+ 5. Run the test suite
208
+ 6. Submit a pull request
209
+
210
+ ## License
211
+
212
+ MIT License - see LICENSE file for details
213
+
214
+ ````
215
+
216
+ ### Documentation Best Practices
217
+
218
+ - **Present Tense:** Describe what the project does, not what it will do
219
+ - **Working Examples:** All code examples should be tested and functional
220
+ - **Clear Instructions:** Installation and usage instructions should be step-by-step
221
+ - **API Documentation:** Document all public functions and classes
222
+ - **No Status Language:** Never use "planned", "upcoming", "in progress"
223
+
224
+ ## Code Documentation Standards
225
+
226
+ ### JSDoc Documentation
227
+
228
+ JavaScript projects should use JSDoc for code documentation:
229
+
230
+ ```javascript
231
+ /**
232
+ * Calculates the total price including tax
233
+ * @param {number} basePrice - The base price before tax
234
+ * @param {number} taxRate - The tax rate as a decimal (e.g., 0.08 for 8%)
235
+ * @returns {number} The total price including tax
236
+ * @throws {Error} When basePrice or taxRate is negative
237
+ * @example
238
+ * const total = calculateTotalPrice(100, 0.08); // Returns 108
239
+ * @since 1.0.0
240
+ */
241
+ function calculateTotalPrice(basePrice, taxRate) {
242
+ if (basePrice < 0 || taxRate < 0) {
243
+ throw new Error('Price and tax rate must be non-negative');
244
+ }
245
+ return basePrice * (1 + taxRate);
246
+ }
247
+
248
+ /**
249
+ * User service for managing user data
250
+ * @class
251
+ * @example
252
+ * const userService = new UserService(database);
253
+ * const user = await userService.getUserById('123');
254
+ */
255
+ class UserService {
256
+ /**
257
+ * Creates a new UserService instance
258
+ * @param {Object} database - Database connection instance
259
+ * @param {Object} [options={}] - Optional configuration
260
+ * @param {number} [options.timeout=5000] - Request timeout in milliseconds
261
+ */
262
+ constructor(database, options = {}) {
263
+ this.db = database;
264
+ this.timeout = options.timeout || 5000;
265
+ }
266
+
267
+ /**
268
+ * Retrieves a user by ID
269
+ * @async
270
+ * @param {string} userId - The unique user identifier
271
+ * @returns {Promise<Object|null>} User object or null if not found
272
+ * @throws {Error} When database operation fails
273
+ * @example
274
+ * const user = await userService.getUserById('user123');
275
+ * if (user) {
276
+ * console.log(user.name);
277
+ * }
278
+ */
279
+ async getUserById(userId) {
280
+ try {
281
+ return await this.db.users.findById(userId);
282
+ } catch (error) {
283
+ console.error(`Failed to fetch user ${userId}:`, error);
284
+ throw error;
285
+ }
286
+ }
287
+ }
288
+ ````
289
+
290
+ ### Module Documentation
291
+
292
+ ```javascript
293
+ /**
294
+ * @fileoverview Utility functions for data processing and validation
295
+ * @module utils/dataProcessor
296
+ * @requires lodash
297
+ * @author Your Name <your.email@example.com>
298
+ * @version 1.2.0
299
+ */
300
+
301
+ import _ from 'lodash';
302
+
303
+ /**
304
+ * Configuration object for data processing
305
+ * @typedef {Object} ProcessingConfig
306
+ * @property {boolean} strict - Enable strict validation
307
+ * @property {number} maxItems - Maximum number of items to process
308
+ * @property {string[]} allowedFields - Array of allowed field names
309
+ */
310
+
311
+ /**
312
+ * User data object
313
+ * @typedef {Object} UserData
314
+ * @property {string} id - Unique user identifier
315
+ * @property {string} name - User's full name
316
+ * @property {string} email - User's email address
317
+ * @property {boolean} active - Whether user account is active
318
+ * @property {Date} createdAt - Account creation date
319
+ */
320
+
321
+ /**
322
+ * Processes and validates user data
323
+ * @param {UserData[]} users - Array of user objects to process
324
+ * @param {ProcessingConfig} config - Processing configuration
325
+ * @returns {UserData[]} Processed and validated user data
326
+ * @throws {ValidationError} When validation fails in strict mode
327
+ */
328
+ export function processUserData(users, config) {
329
+ // Implementation details...
330
+ }
331
+ ```
332
+
333
+ ## Test Documentation Standards
334
+
335
+ Follow the standardized table format for all test case documentation:
336
+
337
+ ### Required Table Format for JavaScript Projects
338
+
339
+ ```markdown
340
+ | Test Case ID | Description | Type | Status |
341
+ | :----------------- | :----------------------------------------- | :--- | :---------- |
342
+ | DOM-UNIT-001 | Test DOM element creation and manipulation | Unit | Completed |
343
+ | UI-UNIT-002 | Test component state management | Unit | Completed |
344
+ | API_CLIENT-INT-001 | Test HTTP client error handling | Int | In Progress |
345
+ | EVENT-E2E-001 | Test complete user interaction workflow | E2E | Not Started |
346
+ ```
347
+
348
+ ### Test Case ID Conventions for JavaScript
349
+
350
+ - **Format:** `[AREA]-[TYPE]-[NUMBER]`
351
+ - **Area Prefixes:** DOM, UI, EVENT, API_CLIENT, UTIL, CORE, MODULE, SERVER, CLI, PKG
352
+ - **Type Suffixes:** UNIT, INT, E2E
353
+ - **Sequential Numbering:** 001, 002, 003, etc.
354
+
355
+ ## API Documentation
356
+
357
+ ### RESTful API Documentation
358
+
359
+ ```javascript
360
+ /**
361
+ * @api {get} /api/users/:id Get User
362
+ * @apiName GetUser
363
+ * @apiGroup User
364
+ * @apiVersion 1.0.0
365
+ *
366
+ * @apiParam {String} id User's unique ID
367
+ *
368
+ * @apiSuccess {String} id User ID
369
+ * @apiSuccess {String} name User name
370
+ * @apiSuccess {String} email User email
371
+ * @apiSuccess {Boolean} active User status
372
+ *
373
+ * @apiSuccessExample {json} Success-Response:
374
+ * HTTP/1.1 200 OK
375
+ * {
376
+ * "id": "123",
377
+ * "name": "John Doe",
378
+ * "email": "john@example.com",
379
+ * "active": true
380
+ * }
381
+ *
382
+ * @apiError UserNotFound The id of the User was not found
383
+ *
384
+ * @apiErrorExample {json} Error-Response:
385
+ * HTTP/1.1 404 Not Found
386
+ * {
387
+ * "error": "UserNotFound",
388
+ * "message": "User with id 123 not found"
389
+ * }
390
+ */
391
+ ```
392
+
393
+ ### Client Library Documentation
394
+
395
+ ```javascript
396
+ /**
397
+ * JavaScript SDK for Example API
398
+ * @example
399
+ * import { ExampleAPI } from '@example/api-client';
400
+ *
401
+ * const api = new ExampleAPI({
402
+ * apiKey: 'your-api-key',
403
+ * baseUrl: 'https://api.example.com'
404
+ * });
405
+ *
406
+ * const users = await api.users.list();
407
+ * const user = await api.users.get('user123');
408
+ */
409
+ class ExampleAPI {
410
+ /**
411
+ * Initialize API client
412
+ * @param {Object} config - Configuration object
413
+ * @param {string} config.apiKey - API authentication key
414
+ * @param {string} [config.baseUrl='https://api.example.com'] - Base API URL
415
+ * @param {number} [config.timeout=5000] - Request timeout in milliseconds
416
+ */
417
+ constructor(config) {
418
+ // Implementation...
419
+ }
420
+ }
421
+ ```
422
+
423
+ ## Package Documentation
424
+
425
+ ### package.json Documentation
426
+
427
+ ```json
428
+ {
429
+ "name": "example-package",
430
+ "version": "1.0.0",
431
+ "description": "A comprehensive example JavaScript package",
432
+ "main": "dist/index.js",
433
+ "module": "dist/index.esm.js",
434
+ "types": "dist/index.d.ts",
435
+ "files": ["dist", "README.md", "LICENSE"],
436
+ "scripts": {
437
+ "build": "rollup -c",
438
+ "dev": "rollup -c -w",
439
+ "test": "jest",
440
+ "test:watch": "jest --watch",
441
+ "test:coverage": "jest --coverage",
442
+ "lint": "eslint src/**/*.js",
443
+ "lint:fix": "eslint src/**/*.js --fix",
444
+ "docs": "jsdoc src -d docs",
445
+ "prepare": "npm run build"
446
+ },
447
+ "keywords": ["javascript", "library", "example"],
448
+ "author": "Your Name <your.email@example.com>",
449
+ "license": "MIT",
450
+ "repository": {
451
+ "type": "git",
452
+ "url": "https://github.com/username/example-package.git"
453
+ },
454
+ "bugs": {
455
+ "url": "https://github.com/username/example-package/issues"
456
+ },
457
+ "homepage": "https://github.com/username/example-package#readme"
458
+ }
459
+ ```
460
+
461
+ ## Build and Deployment Documentation
462
+
463
+ ### Webpack Configuration Documentation
464
+
465
+ ```javascript
466
+ /**
467
+ * Webpack configuration for production builds
468
+ * @type {import('webpack').Configuration}
469
+ */
470
+ const config = {
471
+ entry: './src/index.js',
472
+ output: {
473
+ path: path.resolve(__dirname, 'dist'),
474
+ filename: 'bundle.js',
475
+ library: 'ExampleLibrary',
476
+ libraryTarget: 'umd',
477
+ },
478
+ // Additional configuration...
479
+ };
480
+
481
+ export default config;
482
+ ```
483
+
484
+ ### Deployment Documentation
485
+
486
+ ````markdown
487
+ ## Deployment
488
+
489
+ ### Environment Variables
490
+
491
+ - `NODE_ENV` - Environment mode (development, production, test)
492
+ - `API_URL` - Base URL for API endpoints
493
+ - `PORT` - Server port (default: 3000)
494
+ - `DATABASE_URL` - Database connection string
495
+
496
+ ### Build Process
497
+
498
+ 1. Install dependencies: `npm ci`
499
+ 2. Run tests: `npm test`
500
+ 3. Build production bundle: `npm run build`
501
+ 4. Start production server: `npm start`
502
+
503
+ ### Docker Deployment
504
+
505
+ ```dockerfile
506
+ FROM node:18-alpine
507
+ WORKDIR /app
508
+ COPY package*.json ./
509
+ RUN npm ci --only=production
510
+ COPY . .
511
+ RUN npm run build
512
+ EXPOSE 3000
513
+ CMD ["npm", "start"]
514
+ ```
515
+ ````
516
+
517
+ ## Maintenance Schedule
518
+
519
+ - **Regular Review:** Schedule monthly documentation review cycles
520
+ - **Release Updates:** Update documentation as part of release process
521
+ - **Issue Tracking:** Track documentation issues and improvements in project backlog
522
+ - **Community Feedback:** Incorporate user feedback on documentation clarity
523
+ - **Automated Checks:** Use automated tools to check for broken links and outdated content
524
+
525
+ ## Accessibility Guidelines
526
+
527
+ - **Clear Language:** Use clear, simple language for international JavaScript developers
528
+ - **Code Examples:** Provide complete, runnable code examples
529
+ - **Technical Terms:** Define JavaScript-specific terms when first introduced
530
+ - **Consistent Terminology:** Use consistent terminology throughout all documentation
531
+ - **Screen Reader Compatibility:** Ensure proper heading hierarchy and alt text for diagrams
532
+ - **High Contrast:** Use sufficient color contrast for code syntax highlighting