metacoding 1.5.1 → 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.
- package/CHANGELOG.md +45 -0
- package/README.md +108 -514
- package/lib/cli.d.ts.map +1 -1
- package/lib/cli.js +18 -19
- package/lib/cli.js.map +1 -1
- package/lib/commands/init.d.ts +8 -14
- package/lib/commands/init.d.ts.map +1 -1
- package/lib/commands/init.js +105 -387
- package/lib/commands/init.js.map +1 -1
- package/lib/commands/update.d.ts +9 -9
- package/lib/commands/update.d.ts.map +1 -1
- package/lib/commands/update.js +141 -320
- package/lib/commands/update.js.map +1 -1
- package/lib/services/backup.d.ts +1 -1
- package/lib/services/backup.d.ts.map +1 -1
- package/lib/services/backup.js +10 -6
- package/lib/services/backup.js.map +1 -1
- package/lib/services/filesystem.d.ts.map +1 -1
- package/lib/services/filesystem.js +11 -5
- package/lib/services/filesystem.js.map +1 -1
- package/lib/services/gitignore-manager.js +5 -5
- package/lib/services/gitignore-manager.js.map +1 -1
- package/lib/services/project-detector.d.ts +9 -8
- package/lib/services/project-detector.d.ts.map +1 -1
- package/lib/services/project-detector.js +79 -197
- package/lib/services/project-detector.js.map +1 -1
- package/lib/services/skill-manager.d.ts +23 -0
- package/lib/services/skill-manager.d.ts.map +1 -0
- package/lib/services/skill-manager.js +212 -0
- package/lib/services/skill-manager.js.map +1 -0
- package/lib/types/index.d.ts +5 -15
- package/lib/types/index.d.ts.map +1 -1
- package/package.json +9 -17
- package/skills/metacoding-workflow/SKILL.md +52 -0
- package/skills/metacoding-workflow/agents/openai.yaml +4 -0
- package/skills/metacoding-workflow/assets/templates/changelog-entry.md +6 -0
- package/skills/metacoding-workflow/assets/templates/project-context.md +18 -0
- package/skills/metacoding-workflow/assets/templates/repeated-task-checklist.md +8 -0
- package/skills/metacoding-workflow/assets/templates/task-entry.md +9 -0
- package/skills/metacoding-workflow/assets/templates/test-plan.md +8 -0
- package/skills/metacoding-workflow/references/javascript.md +7 -0
- package/skills/metacoding-workflow/references/node.md +7 -0
- package/skills/metacoding-workflow/references/platform-adaptation.md +37 -0
- package/skills/metacoding-workflow/references/python.md +7 -0
- package/skills/metacoding-workflow/references/react.md +7 -0
- package/skills/metacoding-workflow/references/repository-organization.md +84 -0
- package/skills/metacoding-workflow/references/typescript.md +7 -0
- package/skills/metacoding-workflow/references/workflow-rules.md +54 -0
- package/skills/vendor-templates/claude-agent.md.template +41 -0
- package/lib/services/assistant-adapter.d.ts +0 -18
- package/lib/services/assistant-adapter.d.ts.map +0 -1
- package/lib/services/assistant-adapter.js +0 -246
- package/lib/services/assistant-adapter.js.map +0 -1
- package/lib/services/cursor.d.ts +0 -47
- package/lib/services/cursor.d.ts.map +0 -1
- package/lib/services/cursor.js +0 -314
- package/lib/services/cursor.js.map +0 -1
- package/lib/services/template-manager.d.ts +0 -23
- package/lib/services/template-manager.d.ts.map +0 -1
- package/lib/services/template-manager.js +0 -374
- package/lib/services/template-manager.js.map +0 -1
- package/lib/services/vscode.d.ts +0 -10
- package/lib/services/vscode.d.ts.map +0 -1
- package/lib/services/vscode.js +0 -108
- package/lib/services/vscode.js.map +0 -1
- package/templates/assistants/AGENTS.md +0 -203
- package/templates/assistants/CLAUDE.md +0 -156
- package/templates/assistants/GEMINI.md +0 -193
- package/templates/general/code-review.instructions.md +0 -265
- package/templates/general/copilot-instructions.md +0 -427
- package/templates/general/docs-update.instructions.md +0 -275
- package/templates/general/release.instructions.md +0 -242
- package/templates/general/template.json +0 -9
- package/templates/general/test-runner.instructions.md +0 -188
- package/templates/javascript/javascript.coding.instructions.md +0 -500
- package/templates/javascript/javascript.docs.instructions.md +0 -563
- package/templates/javascript/javascript.testing.instructions.md +0 -686
- package/templates/javascript/template.json +0 -36
- package/templates/node/nodejs.coding.instructions.md +0 -249
- package/templates/node/nodejs.docs.instructions.md +0 -261
- package/templates/node/nodejs.testing.instructions.md +0 -373
- package/templates/node/template.json +0 -23
- package/templates/python/python.coding.instructions.md +0 -338
- package/templates/python/python.docs.instructions.md +0 -1178
- package/templates/python/python.testing.instructions.md +0 -1073
- package/templates/python/template.json +0 -75
- package/templates/react/react.coding.instructions.md +0 -694
- package/templates/react/react.docs.instructions.md +0 -451
- package/templates/react/react.testing.instructions.md +0 -192
- package/templates/react/template.json +0 -14
- package/templates/react/test-runner.instructions.md +0 -135
- package/templates/typescript/template.json +0 -16
- package/templates/typescript/typescript.coding.instructions.md +0 -368
- package/templates/typescript/typescript.docs.instructions.md +0 -760
- package/templates/typescript/typescript.testing.instructions.md +0 -739
|
@@ -1,338 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
description: 'Python-specific coding standards and best practices'
|
|
3
|
-
applyTo: '**/*.py'
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# Python Coding Standards and Best Practices
|
|
7
|
-
|
|
8
|
-
## Language and Framework Preferences
|
|
9
|
-
|
|
10
|
-
- **Primary Language:** Python 3.9+ for all Python projects
|
|
11
|
-
- **Code Style:** Follow PEP 8 with Black formatter for consistent formatting
|
|
12
|
-
- **Type Hints:** Use type hints for all function signatures and complex variables
|
|
13
|
-
- **Target Compatibility:** Python 3.9+ (use modern Python features appropriately)
|
|
14
|
-
|
|
15
|
-
## Code Quality Guidelines
|
|
16
|
-
|
|
17
|
-
- **Readability:** Follow "The Zen of Python" - explicit is better than implicit
|
|
18
|
-
- **Functions:** Keep functions focused, ideally under 30 lines for better readability
|
|
19
|
-
- **Magic Numbers:** Use named constants or configuration files instead of magic numbers
|
|
20
|
-
- **Error Handling:** Use specific exception types, avoid bare `except:` clauses
|
|
21
|
-
- **Memory Management:** Be mindful of memory usage, use generators for large datasets
|
|
22
|
-
- **Async Patterns:** Use `asyncio` for I/O-bound operations, avoid blocking operations
|
|
23
|
-
|
|
24
|
-
## Naming Conventions
|
|
25
|
-
|
|
26
|
-
- **Files:** Use snake_case for file names (e.g., `user_service.py`)
|
|
27
|
-
- **Classes:** PascalCase (e.g., `UserService`, `DatabaseConnection`)
|
|
28
|
-
- **Functions/Methods:** snake_case (e.g., `get_user_by_id`, `validate_input`)
|
|
29
|
-
- **Variables:** snake_case (e.g., `user_id`, `is_valid`)
|
|
30
|
-
- **Constants:** SCREAMING_SNAKE_CASE (e.g., `MAX_RETRY_ATTEMPTS`, `DEFAULT_TIMEOUT`)
|
|
31
|
-
- **Private Attributes:** Single underscore prefix (e.g., `_internal_method`)
|
|
32
|
-
- **Name Mangling:** Double underscore prefix only when necessary (e.g., `__private_attr`)
|
|
33
|
-
|
|
34
|
-
## Code Organization
|
|
35
|
-
|
|
36
|
-
- **Single Responsibility:** One class per file for complex classes, related utilities can be grouped
|
|
37
|
-
- **Imports:** Follow PEP 8 import order (standard library, third-party, local imports)
|
|
38
|
-
- **Module Structure:** Use `__init__.py` files for package initialization and clean imports
|
|
39
|
-
- **Entry Points:** Use `if __name__ == "__main__":` for script entry points
|
|
40
|
-
|
|
41
|
-
## Python-Specific Best Practices
|
|
42
|
-
|
|
43
|
-
### Type Hints and Documentation
|
|
44
|
-
|
|
45
|
-
```python
|
|
46
|
-
from typing import List, Dict, Optional, Union
|
|
47
|
-
from dataclasses import dataclass
|
|
48
|
-
|
|
49
|
-
def process_user_data(
|
|
50
|
-
users: List[Dict[str, Union[str, int]]],
|
|
51
|
-
active_only: bool = True
|
|
52
|
-
) -> List[str]:
|
|
53
|
-
"""Process user data and return list of usernames.
|
|
54
|
-
|
|
55
|
-
Args:
|
|
56
|
-
users: List of user dictionaries containing user information
|
|
57
|
-
active_only: If True, only include active users
|
|
58
|
-
|
|
59
|
-
Returns:
|
|
60
|
-
List of usernames matching the criteria
|
|
61
|
-
|
|
62
|
-
Raises:
|
|
63
|
-
ValueError: If user data format is invalid
|
|
64
|
-
"""
|
|
65
|
-
pass
|
|
66
|
-
```
|
|
67
|
-
|
|
68
|
-
### Error Handling Patterns
|
|
69
|
-
|
|
70
|
-
```python
|
|
71
|
-
# Good: Specific exception handling
|
|
72
|
-
try:
|
|
73
|
-
user = get_user_by_id(user_id)
|
|
74
|
-
except UserNotFoundError as e:
|
|
75
|
-
logger.warning(f"User {user_id} not found: {e}")
|
|
76
|
-
return None
|
|
77
|
-
except DatabaseConnectionError as e:
|
|
78
|
-
logger.error(f"Database connection failed: {e}")
|
|
79
|
-
raise
|
|
80
|
-
|
|
81
|
-
# Good: Use custom exceptions
|
|
82
|
-
class ValidationError(Exception):
|
|
83
|
-
"""Raised when data validation fails."""
|
|
84
|
-
pass
|
|
85
|
-
|
|
86
|
-
class UserNotFoundError(Exception):
|
|
87
|
-
"""Raised when requested user cannot be found."""
|
|
88
|
-
pass
|
|
89
|
-
```
|
|
90
|
-
|
|
91
|
-
### Resource Management
|
|
92
|
-
|
|
93
|
-
```python
|
|
94
|
-
# Good: Use context managers
|
|
95
|
-
with open('data.json', 'r') as file:
|
|
96
|
-
data = json.load(file)
|
|
97
|
-
|
|
98
|
-
# Good: Create custom context managers when needed
|
|
99
|
-
from contextlib import contextmanager
|
|
100
|
-
|
|
101
|
-
@contextmanager
|
|
102
|
-
def database_transaction():
|
|
103
|
-
conn = get_connection()
|
|
104
|
-
trans = conn.begin()
|
|
105
|
-
try:
|
|
106
|
-
yield conn
|
|
107
|
-
trans.commit()
|
|
108
|
-
except Exception:
|
|
109
|
-
trans.rollback()
|
|
110
|
-
raise
|
|
111
|
-
finally:
|
|
112
|
-
conn.close()
|
|
113
|
-
```
|
|
114
|
-
|
|
115
|
-
### Performance Considerations
|
|
116
|
-
|
|
117
|
-
```python
|
|
118
|
-
# Good: Use generators for large datasets
|
|
119
|
-
def process_large_file(filename: str):
|
|
120
|
-
with open(filename, 'r') as file:
|
|
121
|
-
for line in file:
|
|
122
|
-
yield process_line(line)
|
|
123
|
-
|
|
124
|
-
# Good: Use list comprehensions for simple transformations
|
|
125
|
-
active_users = [user for user in users if user.is_active]
|
|
126
|
-
|
|
127
|
-
# Good: Use appropriate data structures
|
|
128
|
-
from collections import defaultdict, deque
|
|
129
|
-
user_groups = defaultdict(list)
|
|
130
|
-
```
|
|
131
|
-
|
|
132
|
-
## Testing Standards
|
|
133
|
-
|
|
134
|
-
### Test Framework Preferences
|
|
135
|
-
|
|
136
|
-
- **Primary Framework:** pytest for all testing
|
|
137
|
-
- **Fixtures:** Use pytest fixtures for test data and setup
|
|
138
|
-
- **Parametrized Tests:** Use `pytest.mark.parametrize` for multiple test cases
|
|
139
|
-
- **Mocking:** Use `unittest.mock` or `pytest-mock` for mocking dependencies
|
|
140
|
-
|
|
141
|
-
### Test File Organization
|
|
142
|
-
|
|
143
|
-
```python
|
|
144
|
-
# tests/test_user_service.py
|
|
145
|
-
import pytest
|
|
146
|
-
from unittest.mock import Mock, patch
|
|
147
|
-
from src.services.user_service import UserService
|
|
148
|
-
from src.exceptions import UserNotFoundError
|
|
149
|
-
|
|
150
|
-
class TestUserService:
|
|
151
|
-
@pytest.fixture
|
|
152
|
-
def user_service(self):
|
|
153
|
-
return UserService(db_connection=Mock())
|
|
154
|
-
|
|
155
|
-
@pytest.mark.parametrize("user_id,expected", [
|
|
156
|
-
(1, True),
|
|
157
|
-
(999, False),
|
|
158
|
-
])
|
|
159
|
-
def test_user_exists(self, user_service, user_id, expected):
|
|
160
|
-
# Test implementation
|
|
161
|
-
pass
|
|
162
|
-
|
|
163
|
-
def test_get_user_not_found_raises_exception(self, user_service):
|
|
164
|
-
with pytest.raises(UserNotFoundError):
|
|
165
|
-
user_service.get_user_by_id(999)
|
|
166
|
-
```
|
|
167
|
-
|
|
168
|
-
## Dependency Management
|
|
169
|
-
|
|
170
|
-
### Package Management
|
|
171
|
-
|
|
172
|
-
- **Primary Tool:** Poetry for dependency management and packaging
|
|
173
|
-
- **Requirements:** Maintain both `pyproject.toml` and `requirements.txt`
|
|
174
|
-
- **Development Dependencies:** Separate dev dependencies (testing, linting, formatting)
|
|
175
|
-
- **Version Pinning:** Pin exact versions for applications, use ranges for libraries
|
|
176
|
-
|
|
177
|
-
### Virtual Environment Management
|
|
178
|
-
|
|
179
|
-
```bash
|
|
180
|
-
# Create and activate virtual environment
|
|
181
|
-
python -m venv venv
|
|
182
|
-
source venv/bin/activate # On Windows: venv\Scripts\activate
|
|
183
|
-
|
|
184
|
-
# Or use Poetry
|
|
185
|
-
poetry install
|
|
186
|
-
poetry shell
|
|
187
|
-
```
|
|
188
|
-
|
|
189
|
-
## Code Quality Tools
|
|
190
|
-
|
|
191
|
-
### Linting and Formatting
|
|
192
|
-
|
|
193
|
-
- **Black:** Code formatting with line length 88
|
|
194
|
-
- **isort:** Import sorting and organization
|
|
195
|
-
- **flake8:** Linting and style checking
|
|
196
|
-
- **mypy:** Static type checking
|
|
197
|
-
- **pylint:** Additional code analysis
|
|
198
|
-
|
|
199
|
-
### Configuration Examples
|
|
200
|
-
|
|
201
|
-
```toml
|
|
202
|
-
# pyproject.toml
|
|
203
|
-
[tool.black]
|
|
204
|
-
line-length = 88
|
|
205
|
-
target-version = ['py39']
|
|
206
|
-
|
|
207
|
-
[tool.isort]
|
|
208
|
-
profile = "black"
|
|
209
|
-
multi_line_output = 3
|
|
210
|
-
|
|
211
|
-
[tool.mypy]
|
|
212
|
-
python_version = "3.9"
|
|
213
|
-
strict = true
|
|
214
|
-
ignore_missing_imports = true
|
|
215
|
-
```
|
|
216
|
-
|
|
217
|
-
## Documentation Standards
|
|
218
|
-
|
|
219
|
-
### Docstring Format
|
|
220
|
-
|
|
221
|
-
Use Google-style docstrings:
|
|
222
|
-
|
|
223
|
-
```python
|
|
224
|
-
def calculate_user_score(
|
|
225
|
-
user_data: Dict[str, Any],
|
|
226
|
-
weights: Optional[Dict[str, float]] = None
|
|
227
|
-
) -> float:
|
|
228
|
-
"""Calculate a user's composite score based on various metrics.
|
|
229
|
-
|
|
230
|
-
This function computes a weighted score based on user activity,
|
|
231
|
-
engagement, and other factors.
|
|
232
|
-
|
|
233
|
-
Args:
|
|
234
|
-
user_data: Dictionary containing user metrics and information
|
|
235
|
-
weights: Optional custom weights for score calculation.
|
|
236
|
-
Defaults to standard weights if not provided.
|
|
237
|
-
|
|
238
|
-
Returns:
|
|
239
|
-
Calculated score as a float between 0.0 and 100.0
|
|
240
|
-
|
|
241
|
-
Raises:
|
|
242
|
-
ValueError: If user_data is missing required fields
|
|
243
|
-
TypeError: If weights contain non-numeric values
|
|
244
|
-
|
|
245
|
-
Example:
|
|
246
|
-
>>> user = {"activity": 85, "engagement": 92}
|
|
247
|
-
>>> calculate_user_score(user)
|
|
248
|
-
88.5
|
|
249
|
-
"""
|
|
250
|
-
pass
|
|
251
|
-
```
|
|
252
|
-
|
|
253
|
-
## Security Considerations
|
|
254
|
-
|
|
255
|
-
### Input Validation
|
|
256
|
-
|
|
257
|
-
```python
|
|
258
|
-
import re
|
|
259
|
-
from typing import Any
|
|
260
|
-
|
|
261
|
-
def validate_email(email: str) -> bool:
|
|
262
|
-
"""Validate email format using regex."""
|
|
263
|
-
pattern = r'^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$'
|
|
264
|
-
return bool(re.match(pattern, email))
|
|
265
|
-
|
|
266
|
-
def sanitize_user_input(user_input: str) -> str:
|
|
267
|
-
"""Sanitize user input to prevent injection attacks."""
|
|
268
|
-
# Remove potentially dangerous characters
|
|
269
|
-
safe_input = re.sub(r'[<>"\';]', '', user_input)
|
|
270
|
-
return safe_input.strip()
|
|
271
|
-
```
|
|
272
|
-
|
|
273
|
-
### Environment Configuration
|
|
274
|
-
|
|
275
|
-
```python
|
|
276
|
-
import os
|
|
277
|
-
from dataclasses import dataclass
|
|
278
|
-
|
|
279
|
-
@dataclass
|
|
280
|
-
class Config:
|
|
281
|
-
"""Application configuration from environment variables."""
|
|
282
|
-
database_url: str = os.getenv('DATABASE_URL', 'sqlite:///default.db')
|
|
283
|
-
secret_key: str = os.getenv('SECRET_KEY', 'dev-key-change-in-production')
|
|
284
|
-
debug: bool = os.getenv('DEBUG', 'False').lower() == 'true'
|
|
285
|
-
|
|
286
|
-
def __post_init__(self):
|
|
287
|
-
if self.secret_key == 'dev-key-change-in-production' and not self.debug:
|
|
288
|
-
raise ValueError("SECRET_KEY must be set in production")
|
|
289
|
-
```
|
|
290
|
-
|
|
291
|
-
## Common Anti-Patterns to Avoid
|
|
292
|
-
|
|
293
|
-
- **Mutable Default Arguments:** Use `None` and check inside function
|
|
294
|
-
- **Broad Exception Catching:** Avoid bare `except:` clauses
|
|
295
|
-
- **Global Variables:** Minimize global state, use dependency injection
|
|
296
|
-
- **String Concatenation in Loops:** Use `join()` for multiple strings
|
|
297
|
-
- **Not Using Context Managers:** Always use `with` for file operations
|
|
298
|
-
- **Ignoring PEP 8:** Follow Python style guidelines consistently
|
|
299
|
-
- **Missing Type Hints:** Add type hints for better code documentation
|
|
300
|
-
- **Circular Imports:** Structure modules to avoid circular dependencies
|
|
301
|
-
|
|
302
|
-
## Performance Optimization
|
|
303
|
-
|
|
304
|
-
### Memory Efficiency
|
|
305
|
-
|
|
306
|
-
```python
|
|
307
|
-
# Use generators for large datasets
|
|
308
|
-
def read_large_file(filename: str):
|
|
309
|
-
with open(filename, 'r') as file:
|
|
310
|
-
for line in file:
|
|
311
|
-
yield line.strip()
|
|
312
|
-
|
|
313
|
-
# Use __slots__ for classes with many instances
|
|
314
|
-
class Point:
|
|
315
|
-
__slots__ = ['x', 'y']
|
|
316
|
-
|
|
317
|
-
def __init__(self, x: float, y: float):
|
|
318
|
-
self.x = x
|
|
319
|
-
self.y = y
|
|
320
|
-
```
|
|
321
|
-
|
|
322
|
-
### Concurrency Patterns
|
|
323
|
-
|
|
324
|
-
```python
|
|
325
|
-
import asyncio
|
|
326
|
-
from concurrent.futures import ThreadPoolExecutor
|
|
327
|
-
|
|
328
|
-
async def process_data_async(data_list: List[str]) -> List[str]:
|
|
329
|
-
"""Process data asynchronously for I/O bound operations."""
|
|
330
|
-
tasks = [process_item_async(item) for item in data_list]
|
|
331
|
-
return await asyncio.gather(*tasks)
|
|
332
|
-
|
|
333
|
-
def process_cpu_intensive_data(data_list: List[str]) -> List[str]:
|
|
334
|
-
"""Use thread pool for CPU-intensive operations."""
|
|
335
|
-
with ThreadPoolExecutor(max_workers=4) as executor:
|
|
336
|
-
results = list(executor.map(cpu_intensive_process, data_list))
|
|
337
|
-
return results
|
|
338
|
-
```
|