@canivel/ralph 0.2.0 → 0.2.3

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 (39) hide show
  1. package/.agents/ralph/PROMPT_build.md +126 -126
  2. package/.agents/ralph/agents.sh +17 -15
  3. package/.agents/ralph/config.sh +25 -25
  4. package/.agents/ralph/log-activity.sh +15 -15
  5. package/.agents/ralph/loop.sh +1027 -1001
  6. package/.agents/ralph/references/CONTEXT_ENGINEERING.md +126 -126
  7. package/.agents/ralph/references/GUARDRAILS.md +174 -174
  8. package/AGENTS.md +20 -20
  9. package/README.md +270 -266
  10. package/bin/ralph +766 -765
  11. package/diagram.svg +55 -55
  12. package/examples/commands.md +46 -46
  13. package/package.json +39 -39
  14. package/skills/commit/SKILL.md +219 -219
  15. package/skills/commit/references/commit_examples.md +292 -292
  16. package/skills/dev-browser/SKILL.md +211 -211
  17. package/skills/dev-browser/bun.lock +443 -443
  18. package/skills/dev-browser/package-lock.json +2988 -2988
  19. package/skills/dev-browser/package.json +31 -31
  20. package/skills/dev-browser/references/scraping.md +155 -155
  21. package/skills/dev-browser/scripts/start-relay.ts +32 -32
  22. package/skills/dev-browser/scripts/start-server.ts +117 -117
  23. package/skills/dev-browser/server.sh +24 -24
  24. package/skills/dev-browser/src/client.ts +474 -474
  25. package/skills/dev-browser/src/index.ts +287 -287
  26. package/skills/dev-browser/src/relay.ts +731 -731
  27. package/skills/dev-browser/src/snapshot/__tests__/snapshot.test.ts +223 -223
  28. package/skills/dev-browser/src/snapshot/browser-script.ts +877 -877
  29. package/skills/dev-browser/src/snapshot/index.ts +14 -14
  30. package/skills/dev-browser/src/snapshot/inject.ts +13 -13
  31. package/skills/dev-browser/src/types.ts +34 -34
  32. package/skills/dev-browser/tsconfig.json +36 -36
  33. package/skills/dev-browser/vitest.config.ts +12 -12
  34. package/skills/prd/SKILL.md +235 -235
  35. package/tests/agent-loops.mjs +79 -79
  36. package/tests/agent-ping.mjs +39 -39
  37. package/tests/audit.md +56 -56
  38. package/tests/cli-smoke.mjs +47 -47
  39. package/tests/real-agents.mjs +127 -127
@@ -1,292 +1,292 @@
1
- # Commit Examples by Type
2
-
3
- Extended examples for each commit type with body content.
4
-
5
- ## feat - New Features
6
-
7
- ```
8
- feat(validation): add URLValidator with domain whitelist
9
-
10
- Implement URLValidator class supporting:
11
- - Domain whitelist enforcement (youtube.com, youtu.be, m.youtube.com)
12
- - Dangerous scheme blocking (javascript, data, file)
13
- - URL parsing with embedded credentials handling
14
- - Port number validation (1-65535)
15
-
16
- Addresses Requirement 31: Input validation
17
- Part of Task 5.1: Input Validation Utilities
18
- ```
19
-
20
- ```
21
- feat(api): add video metadata endpoint
22
-
23
- New GET /api/v1/videos/{id}/metadata endpoint:
24
- - Returns title, duration, formats, thumbnails
25
- - Supports format filtering via query params
26
- - Implements caching with 5-minute TTL
27
-
28
- Part of Task 6.2: API Endpoints
29
- ```
30
-
31
- ## fix - Bug Fixes
32
-
33
- ```
34
- fix(auth): use hmac.compare_digest for secure key comparison
35
-
36
- Replace direct string equality with hmac.compare_digest to prevent
37
- timing attacks on API key validation. Ensures constant-time comparison
38
- regardless of key length or content.
39
-
40
- Addresses security best practice for sensitive data comparison
41
- ```
42
-
43
- ```
44
- fix(download): handle network timeout during video fetch
45
-
46
- Add retry logic with exponential backoff for network failures:
47
- - Max 3 attempts with delays [2, 4, 8] seconds
48
- - Classify retriable errors (5xx, timeout, connection)
49
- - Log each retry attempt with remaining count
50
-
51
- Fixes issue where downloads would fail silently on flaky connections
52
- ```
53
-
54
- ## refactor - Code Improvements
55
-
56
- ```
57
- refactor(template): consolidate filename sanitization logic
58
-
59
- Extract common sanitization patterns into helper methods:
60
- - Path traversal prevention (.., /, absolute paths)
61
- - Special character removal (control chars, null bytes)
62
- - Windows reserved name handling (CON, PRN, LPT1-9, etc)
63
-
64
- Improves code maintainability and reduces duplication
65
- ```
66
-
67
- ```
68
- refactor(providers): extract common yt-dlp options builder
69
-
70
- Move duplicated option building from get_info/download to
71
- _build_base_options helper. Reduces code duplication and ensures
72
- consistent option handling across all provider methods.
73
-
74
- No behavior change, pure refactoring
75
- ```
76
-
77
- ## test - Test Changes
78
-
79
- ```
80
- test(security): add 102 path traversal prevention tests
81
-
82
- Comprehensive test coverage for TemplateProcessor including:
83
- - Basic path traversal attempts (.., /)
84
- - URL-encoded variants (%2e%2e, %2f)
85
- - Unicode/UTF-8 bypass attempts
86
- - Windows edge cases (backslashes, drive letters)
87
-
88
- Part of Task 5.4: Security Test Suite
89
- ```
90
-
91
- ```
92
- test(validation): add parametrized URL validation tests
93
-
94
- Add 25 test cases covering:
95
- - Valid YouTube URL formats (watch, shorts, embed, youtu.be)
96
- - Invalid domains (vimeo, dailymotion)
97
- - Malformed URLs (no scheme, wrong port)
98
- - Edge cases (trailing slashes, query params)
99
-
100
- Coverage for URLValidator: 98%
101
- ```
102
-
103
- ## perf - Performance
104
-
105
- ```
106
- perf(cache): implement LRU eviction for metadata cache
107
-
108
- Replace dict-based cache with LRU implementation:
109
- - Max 1000 entries with automatic eviction
110
- - 40% memory reduction under high load
111
- - Sub-millisecond lookup times maintained
112
-
113
- Addresses memory growth issue in long-running instances
114
- ```
115
-
116
- ## security - Security Fixes
117
-
118
- ```
119
- security(cookie): validate cookie file integrity before use
120
-
121
- Add SHA256 checksum verification for cookie files:
122
- - Compute hash on first load, store in memory
123
- - Verify hash before each use
124
- - Reject modified files with clear error message
125
-
126
- Prevents use of tampered cookie files
127
- Addresses Requirement 33: Security validation
128
- ```
129
-
130
- ## ci - CI/CD Changes
131
-
132
- ```
133
- ci(github): add security scanning to PR workflow
134
-
135
- Enable Bandit security scanner in GitHub Actions:
136
- - Run on all Python files
137
- - Fail on HIGH/CRITICAL findings
138
- - Cache virtualenv for faster runs
139
-
140
- Part of Task 15.3: Basic security validation
141
- ```
142
-
143
- ## docs - Documentation
144
-
145
- ```
146
- docs(api): add OpenAPI description for download endpoint
147
-
148
- Document /api/v1/download endpoint:
149
- - Request body schema with format options
150
- - Response codes (200, 400, 401, 404, 500)
151
- - Example requests and responses
152
-
153
- Improves API documentation for consumers
154
- ```
155
-
156
- ## chore - Maintenance
157
-
158
- ```
159
- chore(deps): update yt-dlp to 2024.12.06
160
-
161
- Update yt-dlp from 2024.11.15 to 2024.12.06:
162
- - Fixes YouTube throttling detection
163
- - Adds support for new Instagram format
164
- - Improves error messages for geo-blocked content
165
-
166
- No breaking changes expected
167
- ```
168
-
169
- ## style - Formatting
170
-
171
- ```
172
- style(providers): apply black formatting to youtube.py
173
-
174
- Apply black formatter with 88 char line length.
175
- No functional changes, formatting only.
176
- ```
177
-
178
- ## Merge Commit Examples
179
-
180
- ### Feature Branch to Develop
181
-
182
- ```
183
- Merge pull request #5 from fvadicamo/feature/input-validation-security
184
-
185
- feat(security): implement input validation and security (Task 5)
186
-
187
- Merges comprehensive security implementation (Task 5) into develop:
188
- - Input validation utilities (URLValidator, FormatValidator, ParameterValidator)
189
- - Secure template processor with path traversal prevention
190
- - API key authentication middleware with multi-key support
191
- - 473 tests with 93% coverage
192
-
193
- Task 5.1: Input Validation Utilities
194
- - URLValidator: Domain whitelist (youtube.com, youtu.be), dangerous scheme blocking
195
- - FormatValidator: yt-dlp format ID validation with regex and selectors
196
- - ParameterValidator: Audio quality/format and language code validation
197
-
198
- Task 5.2: Template Processor
199
- - Path traversal prevention (.., /, absolute paths, URL encoding)
200
- - Filename sanitization (illegal chars, control chars, null bytes)
201
- - Windows reserved names handling (CON, PRN, AUX, NUL, COM1-9, LPT1-9)
202
- - Collision handling with numeric suffix, max length 200 chars
203
-
204
- Task 5.3: API Key Authentication
205
- - APIKeyAuth class with multi-key support
206
- - Excluded paths for health/doc endpoints
207
- - Secure hashing for logging (SHA256 first 8 chars)
208
- - FastAPI dependency injection integration
209
-
210
- Task 5.4: Security Tests
211
- - 102 path traversal prevention tests with edge cases
212
- - URL validation tests with malicious inputs
213
- - API key authentication and credential tests
214
- - Sensitive data redaction verification
215
-
216
- Requirements Covered:
217
- - Req 7: Output template processing with security
218
- - Req 9: API key authentication
219
- - Req 31: Input validation
220
- - Req 33: Security (secure comparison, log redaction)
221
-
222
- Test Coverage:
223
- - All 473 tests passing
224
- - Coverage: 93% (exceeds 80% minimum)
225
- - Pre-commit checks: all passing
226
- ```
227
-
228
- ### Develop to Main (Release)
229
-
230
- ```
231
- Merge pull request #10 from fvadicamo/develop
232
-
233
- release: v0.1.0 - MVP with YouTube provider
234
-
235
- First stable release with core functionality:
236
- - YouTube video info, formats, download, audio extraction
237
- - Cookie-based authentication for age-restricted content
238
- - API key authentication
239
- - Input validation and security hardening
240
- - 500+ tests with 92% coverage
241
-
242
- Breaking Changes: None (initial release)
243
-
244
- Features:
245
- - GET /api/v1/info - Video metadata
246
- - GET /api/v1/formats - Available formats
247
- - POST /api/v1/download - Video/audio download
248
- - Cookie file support for authenticated requests
249
-
250
- Documentation:
251
- - API documentation at /docs (Swagger UI)
252
- - OpenAPI spec at /openapi.json
253
- ```
254
-
255
- ## Commits with Trailers
256
-
257
- ### Single Issue
258
- ```
259
- fix(validation): prevent XSS in user input
260
-
261
- Escape HTML entities before rendering.
262
-
263
- Fixes #78
264
- ```
265
-
266
- ### Multiple Issues + Co-author
267
- ```
268
- fix(auth): resolve session and token issues
269
-
270
- - Fix session expiry not triggering logout
271
- - Fix token refresh race condition
272
-
273
- Fixes #101
274
- Fixes #103
275
- Co-authored-by: Bob <bob@example.com>
276
- ```
277
-
278
- ## Breaking Changes
279
-
280
- ### With ! Notation
281
- ```
282
- feat(api)!: migrate to v2 endpoints
283
-
284
- BREAKING CHANGE: /api/v1/* endpoints removed. Update base URL to /api/v2/.
285
- ```
286
-
287
- ### Config Breaking Change
288
- ```
289
- chore(config)!: rename environment variables
290
-
291
- BREAKING CHANGE: DATABASE_URL -> APP_DATABASE_URL, API_KEY -> APP_API_KEY
292
- ```
1
+ # Commit Examples by Type
2
+
3
+ Extended examples for each commit type with body content.
4
+
5
+ ## feat - New Features
6
+
7
+ ```
8
+ feat(validation): add URLValidator with domain whitelist
9
+
10
+ Implement URLValidator class supporting:
11
+ - Domain whitelist enforcement (youtube.com, youtu.be, m.youtube.com)
12
+ - Dangerous scheme blocking (javascript, data, file)
13
+ - URL parsing with embedded credentials handling
14
+ - Port number validation (1-65535)
15
+
16
+ Addresses Requirement 31: Input validation
17
+ Part of Task 5.1: Input Validation Utilities
18
+ ```
19
+
20
+ ```
21
+ feat(api): add video metadata endpoint
22
+
23
+ New GET /api/v1/videos/{id}/metadata endpoint:
24
+ - Returns title, duration, formats, thumbnails
25
+ - Supports format filtering via query params
26
+ - Implements caching with 5-minute TTL
27
+
28
+ Part of Task 6.2: API Endpoints
29
+ ```
30
+
31
+ ## fix - Bug Fixes
32
+
33
+ ```
34
+ fix(auth): use hmac.compare_digest for secure key comparison
35
+
36
+ Replace direct string equality with hmac.compare_digest to prevent
37
+ timing attacks on API key validation. Ensures constant-time comparison
38
+ regardless of key length or content.
39
+
40
+ Addresses security best practice for sensitive data comparison
41
+ ```
42
+
43
+ ```
44
+ fix(download): handle network timeout during video fetch
45
+
46
+ Add retry logic with exponential backoff for network failures:
47
+ - Max 3 attempts with delays [2, 4, 8] seconds
48
+ - Classify retriable errors (5xx, timeout, connection)
49
+ - Log each retry attempt with remaining count
50
+
51
+ Fixes issue where downloads would fail silently on flaky connections
52
+ ```
53
+
54
+ ## refactor - Code Improvements
55
+
56
+ ```
57
+ refactor(template): consolidate filename sanitization logic
58
+
59
+ Extract common sanitization patterns into helper methods:
60
+ - Path traversal prevention (.., /, absolute paths)
61
+ - Special character removal (control chars, null bytes)
62
+ - Windows reserved name handling (CON, PRN, LPT1-9, etc)
63
+
64
+ Improves code maintainability and reduces duplication
65
+ ```
66
+
67
+ ```
68
+ refactor(providers): extract common yt-dlp options builder
69
+
70
+ Move duplicated option building from get_info/download to
71
+ _build_base_options helper. Reduces code duplication and ensures
72
+ consistent option handling across all provider methods.
73
+
74
+ No behavior change, pure refactoring
75
+ ```
76
+
77
+ ## test - Test Changes
78
+
79
+ ```
80
+ test(security): add 102 path traversal prevention tests
81
+
82
+ Comprehensive test coverage for TemplateProcessor including:
83
+ - Basic path traversal attempts (.., /)
84
+ - URL-encoded variants (%2e%2e, %2f)
85
+ - Unicode/UTF-8 bypass attempts
86
+ - Windows edge cases (backslashes, drive letters)
87
+
88
+ Part of Task 5.4: Security Test Suite
89
+ ```
90
+
91
+ ```
92
+ test(validation): add parametrized URL validation tests
93
+
94
+ Add 25 test cases covering:
95
+ - Valid YouTube URL formats (watch, shorts, embed, youtu.be)
96
+ - Invalid domains (vimeo, dailymotion)
97
+ - Malformed URLs (no scheme, wrong port)
98
+ - Edge cases (trailing slashes, query params)
99
+
100
+ Coverage for URLValidator: 98%
101
+ ```
102
+
103
+ ## perf - Performance
104
+
105
+ ```
106
+ perf(cache): implement LRU eviction for metadata cache
107
+
108
+ Replace dict-based cache with LRU implementation:
109
+ - Max 1000 entries with automatic eviction
110
+ - 40% memory reduction under high load
111
+ - Sub-millisecond lookup times maintained
112
+
113
+ Addresses memory growth issue in long-running instances
114
+ ```
115
+
116
+ ## security - Security Fixes
117
+
118
+ ```
119
+ security(cookie): validate cookie file integrity before use
120
+
121
+ Add SHA256 checksum verification for cookie files:
122
+ - Compute hash on first load, store in memory
123
+ - Verify hash before each use
124
+ - Reject modified files with clear error message
125
+
126
+ Prevents use of tampered cookie files
127
+ Addresses Requirement 33: Security validation
128
+ ```
129
+
130
+ ## ci - CI/CD Changes
131
+
132
+ ```
133
+ ci(github): add security scanning to PR workflow
134
+
135
+ Enable Bandit security scanner in GitHub Actions:
136
+ - Run on all Python files
137
+ - Fail on HIGH/CRITICAL findings
138
+ - Cache virtualenv for faster runs
139
+
140
+ Part of Task 15.3: Basic security validation
141
+ ```
142
+
143
+ ## docs - Documentation
144
+
145
+ ```
146
+ docs(api): add OpenAPI description for download endpoint
147
+
148
+ Document /api/v1/download endpoint:
149
+ - Request body schema with format options
150
+ - Response codes (200, 400, 401, 404, 500)
151
+ - Example requests and responses
152
+
153
+ Improves API documentation for consumers
154
+ ```
155
+
156
+ ## chore - Maintenance
157
+
158
+ ```
159
+ chore(deps): update yt-dlp to 2024.12.06
160
+
161
+ Update yt-dlp from 2024.11.15 to 2024.12.06:
162
+ - Fixes YouTube throttling detection
163
+ - Adds support for new Instagram format
164
+ - Improves error messages for geo-blocked content
165
+
166
+ No breaking changes expected
167
+ ```
168
+
169
+ ## style - Formatting
170
+
171
+ ```
172
+ style(providers): apply black formatting to youtube.py
173
+
174
+ Apply black formatter with 88 char line length.
175
+ No functional changes, formatting only.
176
+ ```
177
+
178
+ ## Merge Commit Examples
179
+
180
+ ### Feature Branch to Develop
181
+
182
+ ```
183
+ Merge pull request #5 from fvadicamo/feature/input-validation-security
184
+
185
+ feat(security): implement input validation and security (Task 5)
186
+
187
+ Merges comprehensive security implementation (Task 5) into develop:
188
+ - Input validation utilities (URLValidator, FormatValidator, ParameterValidator)
189
+ - Secure template processor with path traversal prevention
190
+ - API key authentication middleware with multi-key support
191
+ - 473 tests with 93% coverage
192
+
193
+ Task 5.1: Input Validation Utilities
194
+ - URLValidator: Domain whitelist (youtube.com, youtu.be), dangerous scheme blocking
195
+ - FormatValidator: yt-dlp format ID validation with regex and selectors
196
+ - ParameterValidator: Audio quality/format and language code validation
197
+
198
+ Task 5.2: Template Processor
199
+ - Path traversal prevention (.., /, absolute paths, URL encoding)
200
+ - Filename sanitization (illegal chars, control chars, null bytes)
201
+ - Windows reserved names handling (CON, PRN, AUX, NUL, COM1-9, LPT1-9)
202
+ - Collision handling with numeric suffix, max length 200 chars
203
+
204
+ Task 5.3: API Key Authentication
205
+ - APIKeyAuth class with multi-key support
206
+ - Excluded paths for health/doc endpoints
207
+ - Secure hashing for logging (SHA256 first 8 chars)
208
+ - FastAPI dependency injection integration
209
+
210
+ Task 5.4: Security Tests
211
+ - 102 path traversal prevention tests with edge cases
212
+ - URL validation tests with malicious inputs
213
+ - API key authentication and credential tests
214
+ - Sensitive data redaction verification
215
+
216
+ Requirements Covered:
217
+ - Req 7: Output template processing with security
218
+ - Req 9: API key authentication
219
+ - Req 31: Input validation
220
+ - Req 33: Security (secure comparison, log redaction)
221
+
222
+ Test Coverage:
223
+ - All 473 tests passing
224
+ - Coverage: 93% (exceeds 80% minimum)
225
+ - Pre-commit checks: all passing
226
+ ```
227
+
228
+ ### Develop to Main (Release)
229
+
230
+ ```
231
+ Merge pull request #10 from fvadicamo/develop
232
+
233
+ release: v0.1.0 - MVP with YouTube provider
234
+
235
+ First stable release with core functionality:
236
+ - YouTube video info, formats, download, audio extraction
237
+ - Cookie-based authentication for age-restricted content
238
+ - API key authentication
239
+ - Input validation and security hardening
240
+ - 500+ tests with 92% coverage
241
+
242
+ Breaking Changes: None (initial release)
243
+
244
+ Features:
245
+ - GET /api/v1/info - Video metadata
246
+ - GET /api/v1/formats - Available formats
247
+ - POST /api/v1/download - Video/audio download
248
+ - Cookie file support for authenticated requests
249
+
250
+ Documentation:
251
+ - API documentation at /docs (Swagger UI)
252
+ - OpenAPI spec at /openapi.json
253
+ ```
254
+
255
+ ## Commits with Trailers
256
+
257
+ ### Single Issue
258
+ ```
259
+ fix(validation): prevent XSS in user input
260
+
261
+ Escape HTML entities before rendering.
262
+
263
+ Fixes #78
264
+ ```
265
+
266
+ ### Multiple Issues + Co-author
267
+ ```
268
+ fix(auth): resolve session and token issues
269
+
270
+ - Fix session expiry not triggering logout
271
+ - Fix token refresh race condition
272
+
273
+ Fixes #101
274
+ Fixes #103
275
+ Co-authored-by: Bob <bob@example.com>
276
+ ```
277
+
278
+ ## Breaking Changes
279
+
280
+ ### With ! Notation
281
+ ```
282
+ feat(api)!: migrate to v2 endpoints
283
+
284
+ BREAKING CHANGE: /api/v1/* endpoints removed. Update base URL to /api/v2/.
285
+ ```
286
+
287
+ ### Config Breaking Change
288
+ ```
289
+ chore(config)!: rename environment variables
290
+
291
+ BREAKING CHANGE: DATABASE_URL -> APP_DATABASE_URL, API_KEY -> APP_API_KEY
292
+ ```