@mytechtoday/augment-extensions 1.2.2 → 1.3.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/LICENSE +22 -22
- package/augment-extensions/domain-rules/software-architecture/README.md +143 -143
- package/augment-extensions/domain-rules/software-architecture/examples/banking-layered.md +961 -961
- package/augment-extensions/domain-rules/software-architecture/examples/ecommerce-microservices.md +990 -990
- package/augment-extensions/domain-rules/software-architecture/examples/iot-eventdriven.md +882 -882
- package/augment-extensions/domain-rules/software-architecture/examples/monolith-to-microservices-migration.md +703 -703
- package/augment-extensions/domain-rules/software-architecture/examples/serverless-imageprocessing.md +957 -957
- package/augment-extensions/domain-rules/software-architecture/examples/trading-eventdriven.md +747 -747
- package/augment-extensions/domain-rules/software-architecture/module.json +119 -119
- package/augment-extensions/domain-rules/software-architecture/rules/challenges-solutions.md +763 -763
- package/augment-extensions/domain-rules/software-architecture/rules/definitions-terminology.md +409 -409
- package/augment-extensions/domain-rules/software-architecture/rules/design-principles.md +684 -684
- package/augment-extensions/domain-rules/software-architecture/rules/evaluation-testing.md +1381 -1381
- package/augment-extensions/domain-rules/software-architecture/rules/event-driven-architecture.md +616 -616
- package/augment-extensions/domain-rules/software-architecture/rules/fundamentals.md +306 -306
- package/augment-extensions/domain-rules/software-architecture/rules/industry-architectures.md +554 -554
- package/augment-extensions/domain-rules/software-architecture/rules/layered-architecture.md +776 -776
- package/augment-extensions/domain-rules/software-architecture/rules/microservices-architecture.md +503 -503
- package/augment-extensions/domain-rules/software-architecture/rules/modeling-documentation.md +1199 -1199
- package/augment-extensions/domain-rules/software-architecture/rules/monolithic-architecture.md +351 -351
- package/augment-extensions/domain-rules/software-architecture/rules/principles.md +556 -556
- package/augment-extensions/domain-rules/software-architecture/rules/quality-attributes.md +797 -797
- package/augment-extensions/domain-rules/software-architecture/rules/scalability-performance.md +1345 -1345
- package/augment-extensions/domain-rules/software-architecture/rules/security-architecture.md +1039 -1039
- package/augment-extensions/domain-rules/software-architecture/rules/serverless-architecture.md +711 -711
- package/augment-extensions/domain-rules/software-architecture/rules/skills-development.md +568 -568
- package/augment-extensions/domain-rules/software-architecture/rules/tools-methodologies.md +961 -961
- package/augment-extensions/visual-design/CHANGELOG.md +132 -0
- package/augment-extensions/visual-design/README.md +255 -0
- package/augment-extensions/visual-design/__tests__/README.md +119 -0
- package/augment-extensions/visual-design/__tests__/style-selector.test.ts +172 -0
- package/augment-extensions/visual-design/__tests__/vendor-styles.test.ts +214 -0
- package/augment-extensions/visual-design/domains/other/ai-prompt-helper.ts +157 -0
- package/augment-extensions/visual-design/domains/other/dotnet-application.ts +156 -0
- package/augment-extensions/visual-design/domains/other/linux-platform.ts +156 -0
- package/augment-extensions/visual-design/domains/other/mobile-application.ts +157 -0
- package/augment-extensions/visual-design/domains/other/motion-picture.ts +156 -0
- package/augment-extensions/visual-design/domains/other/os-application.ts +156 -0
- package/augment-extensions/visual-design/domains/other/print-campaigns.ts +158 -0
- package/augment-extensions/visual-design/domains/other/web-app.ts +157 -0
- package/augment-extensions/visual-design/domains/other/website.ts +161 -0
- package/augment-extensions/visual-design/domains/other/windows-platform.ts +156 -0
- package/augment-extensions/visual-design/domains/web-page-styles/amazon-cloudscape.ts +506 -0
- package/augment-extensions/visual-design/domains/web-page-styles/google-modern.ts +615 -0
- package/augment-extensions/visual-design/domains/web-page-styles/microsoft-fluent.ts +531 -0
- package/augment-extensions/visual-design/examples/README.md +97 -0
- package/augment-extensions/visual-design/examples/ai-prompt-generation.md +233 -0
- package/augment-extensions/visual-design/examples/basic-usage.md +216 -0
- package/augment-extensions/visual-design/examples/domain-workflows.md +257 -0
- package/augment-extensions/visual-design/examples/vendor-comparison.md +247 -0
- package/augment-extensions/visual-design/module.json +78 -0
- package/augment-extensions/visual-design/style-selector.ts +177 -0
- package/augment-extensions/visual-design/types.ts +302 -0
- package/augment-extensions/visual-design/visual-design-core.ts +469 -0
- package/augment-extensions/workflows/adr-support/README.md +227 -0
- package/augment-extensions/workflows/adr-support/__tests__/adr-validator.test.ts +203 -0
- package/augment-extensions/workflows/adr-support/adr-validator.ts +162 -0
- package/augment-extensions/workflows/adr-support/examples/complete-lifecycle-example.md +449 -0
- package/augment-extensions/workflows/adr-support/examples/integration-example.md +580 -0
- package/augment-extensions/workflows/adr-support/examples/superseding-example.md +436 -0
- package/augment-extensions/workflows/adr-support/module.json +112 -0
- package/augment-extensions/workflows/adr-support/rules/adr-creation.md +372 -0
- package/augment-extensions/workflows/adr-support/rules/beads-integration.md +443 -0
- package/augment-extensions/workflows/adr-support/rules/conflict-detection.md +486 -0
- package/augment-extensions/workflows/adr-support/rules/decision-detection.md +362 -0
- package/augment-extensions/workflows/adr-support/rules/lifecycle-management.md +427 -0
- package/augment-extensions/workflows/adr-support/rules/openspec-integration.md +465 -0
- package/augment-extensions/workflows/adr-support/rules/template-selection.md +405 -0
- package/augment-extensions/workflows/adr-support/rules/validation-rules.md +543 -0
- package/augment-extensions/workflows/adr-support/schemas/adr-config.json +191 -0
- package/augment-extensions/workflows/adr-support/schemas/adr-metadata.json +172 -0
- package/augment-extensions/workflows/adr-support/templates/business-case.md +235 -0
- package/augment-extensions/workflows/adr-support/templates/madr-elaborate.md +197 -0
- package/augment-extensions/workflows/adr-support/templates/madr-simple.md +68 -0
- package/augment-extensions/workflows/adr-support/templates/nygard.md +84 -0
- package/augment-extensions/writing-standards/screenplay/rules/file-organization.md +213 -213
- package/augment-extensions/writing-standards/screenplay/utils/__tests__/file-organization.test.ts +169 -169
- package/augment-extensions/writing-standards/screenplay/utils/file-organization.ts +165 -165
- package/cli/dist/utils/auto-sync.js +19 -19
- package/package.json +5 -3
- package/augment-extensions/workflows/openspec/README.md +0 -96
- package/augment-extensions/workflows/openspec/examples/complete-change-example.md +0 -244
- package/augment-extensions/workflows/openspec/module.json +0 -54
- package/augment-extensions/workflows/openspec/rules/best-practices.md +0 -272
- package/augment-extensions/workflows/openspec/rules/manual-setup.md +0 -231
- package/augment-extensions/workflows/openspec/rules/spec-format.md +0 -236
- package/augment-extensions/workflows/openspec/rules/workflow.md +0 -214
|
@@ -0,0 +1,580 @@
|
|
|
1
|
+
# ADR Integration Example
|
|
2
|
+
|
|
3
|
+
This example demonstrates how Architecture Decision Records (ADRs) integrate with OpenSpec and Beads through the coordination manifest.
|
|
4
|
+
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
This example shows a complete workflow where:
|
|
8
|
+
- An architectural decision is made (ADR)
|
|
9
|
+
- Specifications are created (OpenSpec)
|
|
10
|
+
- Implementation tasks are tracked (Beads)
|
|
11
|
+
- Everything is coordinated through the manifest
|
|
12
|
+
|
|
13
|
+
**Scenario:** Implementing API rate limiting
|
|
14
|
+
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
## Step 1: Create the ADR
|
|
18
|
+
|
|
19
|
+
**File:** `adr/0055-implement-api-rate-limiting.md`
|
|
20
|
+
|
|
21
|
+
```markdown
|
|
22
|
+
# ADR-0055: Implement API Rate Limiting
|
|
23
|
+
|
|
24
|
+
**Status:** Approved
|
|
25
|
+
|
|
26
|
+
**Date:** 2026-02-05
|
|
27
|
+
|
|
28
|
+
**Deciders:** Tech Lead, API Team, Security Team
|
|
29
|
+
|
|
30
|
+
**Technical Story:** Related to OpenSpec spec: api/rate-limiting
|
|
31
|
+
|
|
32
|
+
---
|
|
33
|
+
|
|
34
|
+
## Context
|
|
35
|
+
|
|
36
|
+
Our public API is experiencing abuse:
|
|
37
|
+
- Single client making 10,000+ requests/minute
|
|
38
|
+
- API costs increased 300% in last month
|
|
39
|
+
- Legitimate users experiencing degraded performance
|
|
40
|
+
- No current rate limiting mechanism
|
|
41
|
+
|
|
42
|
+
### Forces
|
|
43
|
+
|
|
44
|
+
- Need to protect API from abuse
|
|
45
|
+
- Must not impact legitimate users
|
|
46
|
+
- Should be configurable per client
|
|
47
|
+
- Need monitoring and alerting
|
|
48
|
+
- Must handle distributed system (3 API servers)
|
|
49
|
+
|
|
50
|
+
---
|
|
51
|
+
|
|
52
|
+
## Decision
|
|
53
|
+
|
|
54
|
+
We will implement token bucket rate limiting using Redis.
|
|
55
|
+
|
|
56
|
+
### Rationale
|
|
57
|
+
|
|
58
|
+
1. **Token Bucket Algorithm**: Allows bursts while enforcing average rate
|
|
59
|
+
2. **Redis**: Centralized state across distributed API servers
|
|
60
|
+
3. **Configurable**: Per-client limits via database configuration
|
|
61
|
+
4. **Industry Standard**: Well-understood pattern with good libraries
|
|
62
|
+
|
|
63
|
+
---
|
|
64
|
+
|
|
65
|
+
## Consequences
|
|
66
|
+
|
|
67
|
+
### Positive
|
|
68
|
+
|
|
69
|
+
- Protects API from abuse
|
|
70
|
+
- Fair resource allocation
|
|
71
|
+
- Configurable per client tier (free/pro/enterprise)
|
|
72
|
+
- Real-time monitoring possible
|
|
73
|
+
- Graceful degradation
|
|
74
|
+
|
|
75
|
+
### Negative
|
|
76
|
+
|
|
77
|
+
- Additional Redis dependency
|
|
78
|
+
- Slight latency increase (2-5ms per request)
|
|
79
|
+
- Need to handle Redis failures
|
|
80
|
+
- Client education required
|
|
81
|
+
|
|
82
|
+
### Neutral
|
|
83
|
+
|
|
84
|
+
- Need to implement client tier management
|
|
85
|
+
- Monitoring dashboard required
|
|
86
|
+
- Documentation updates needed
|
|
87
|
+
|
|
88
|
+
---
|
|
89
|
+
|
|
90
|
+
## Related Decisions
|
|
91
|
+
|
|
92
|
+
- Related to: [ADR-0012](0012-use-redis-for-caching.md)
|
|
93
|
+
- Related to: [ADR-0033](0033-api-authentication.md)
|
|
94
|
+
|
|
95
|
+
---
|
|
96
|
+
|
|
97
|
+
## Notes
|
|
98
|
+
|
|
99
|
+
### Implementation Notes
|
|
100
|
+
|
|
101
|
+
- Use `express-rate-limit` with Redis store
|
|
102
|
+
- Default limits: 100 req/min (free), 1000 req/min (pro), 10000 req/min (enterprise)
|
|
103
|
+
- Return 429 status with Retry-After header
|
|
104
|
+
- Implement sliding window counter for accuracy
|
|
105
|
+
|
|
106
|
+
### References
|
|
107
|
+
|
|
108
|
+
- [Token Bucket Algorithm](https://en.wikipedia.org/wiki/Token_bucket)
|
|
109
|
+
- [RFC 6585 - HTTP 429 Status Code](https://tools.ietf.org/html/rfc6585)
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
---
|
|
113
|
+
|
|
114
|
+
## Step 2: Create OpenSpec Specification
|
|
115
|
+
|
|
116
|
+
**File:** `openspec/specs/api/rate-limiting.md`
|
|
117
|
+
|
|
118
|
+
```markdown
|
|
119
|
+
# API Rate Limiting Specification
|
|
120
|
+
|
|
121
|
+
**Status:** Active
|
|
122
|
+
|
|
123
|
+
**Version:** 1.0.0
|
|
124
|
+
|
|
125
|
+
**Related ADR:** [ADR-0055: Implement API Rate Limiting](../../../adr/0055-implement-api-rate-limiting.md)
|
|
126
|
+
|
|
127
|
+
---
|
|
128
|
+
|
|
129
|
+
## Overview
|
|
130
|
+
|
|
131
|
+
This specification defines the rate limiting behavior for all public API endpoints.
|
|
132
|
+
|
|
133
|
+
## Rate Limit Tiers
|
|
134
|
+
|
|
135
|
+
### Free Tier
|
|
136
|
+
- **Limit:** 100 requests per minute
|
|
137
|
+
- **Burst:** 120 requests
|
|
138
|
+
- **Window:** Sliding 60 seconds
|
|
139
|
+
|
|
140
|
+
### Pro Tier
|
|
141
|
+
- **Limit:** 1,000 requests per minute
|
|
142
|
+
- **Burst:** 1,200 requests
|
|
143
|
+
- **Window:** Sliding 60 seconds
|
|
144
|
+
|
|
145
|
+
### Enterprise Tier
|
|
146
|
+
- **Limit:** 10,000 requests per minute
|
|
147
|
+
- **Burst:** 12,000 requests
|
|
148
|
+
- **Window:** Sliding 60 seconds
|
|
149
|
+
|
|
150
|
+
## HTTP Headers
|
|
151
|
+
|
|
152
|
+
### Request Headers
|
|
153
|
+
- `X-RateLimit-Limit`: Maximum requests per window
|
|
154
|
+
- `X-RateLimit-Remaining`: Remaining requests in current window
|
|
155
|
+
- `X-RateLimit-Reset`: Unix timestamp when window resets
|
|
156
|
+
|
|
157
|
+
### Response Headers (429 Too Many Requests)
|
|
158
|
+
- `Retry-After`: Seconds until rate limit resets
|
|
159
|
+
- `X-RateLimit-Limit`: Maximum requests per window
|
|
160
|
+
- `X-RateLimit-Remaining`: 0
|
|
161
|
+
- `X-RateLimit-Reset`: Unix timestamp when window resets
|
|
162
|
+
|
|
163
|
+
## Error Response Format
|
|
164
|
+
|
|
165
|
+
```json
|
|
166
|
+
{
|
|
167
|
+
"error": {
|
|
168
|
+
"code": "RATE_LIMIT_EXCEEDED",
|
|
169
|
+
"message": "Rate limit exceeded. Please retry after 45 seconds.",
|
|
170
|
+
"details": {
|
|
171
|
+
"limit": 100,
|
|
172
|
+
"window": "60s",
|
|
173
|
+
"retryAfter": 45
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
## Implementation Requirements
|
|
180
|
+
|
|
181
|
+
1. **Redis Storage**: Use Redis for distributed rate limit state
|
|
182
|
+
2. **Token Bucket**: Implement token bucket algorithm
|
|
183
|
+
3. **Graceful Degradation**: If Redis unavailable, allow requests (fail open)
|
|
184
|
+
4. **Monitoring**: Track rate limit hits per client
|
|
185
|
+
5. **Configuration**: Store client tiers in database
|
|
186
|
+
|
|
187
|
+
## Affected Endpoints
|
|
188
|
+
|
|
189
|
+
- All `/api/v1/*` endpoints
|
|
190
|
+
- Excludes: `/api/v1/health`, `/api/v1/status`
|
|
191
|
+
|
|
192
|
+
---
|
|
193
|
+
|
|
194
|
+
## See Also
|
|
195
|
+
|
|
196
|
+
- [ADR-0055: Implement API Rate Limiting](../../../adr/0055-implement-api-rate-limiting.md)
|
|
197
|
+
- [API Authentication Spec](./authentication.md)
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
---
|
|
201
|
+
|
|
202
|
+
## Step 3: Create Beads Tasks
|
|
203
|
+
|
|
204
|
+
Create implementation tasks:
|
|
205
|
+
|
|
206
|
+
```bash
|
|
207
|
+
# Create epic
|
|
208
|
+
bd create "Implement API rate limiting" \
|
|
209
|
+
--type epic \
|
|
210
|
+
--priority 1 \
|
|
211
|
+
--labels "adr-0055,api,security"
|
|
212
|
+
|
|
213
|
+
# Create subtasks
|
|
214
|
+
bd create "Set up Redis rate limit store" \
|
|
215
|
+
--parent bd-rl00 \
|
|
216
|
+
--priority 1 \
|
|
217
|
+
--labels "adr-0055,infrastructure"
|
|
218
|
+
|
|
219
|
+
bd create "Implement rate limit middleware" \
|
|
220
|
+
--parent bd-rl00 \
|
|
221
|
+
--priority 1 \
|
|
222
|
+
--labels "adr-0055,implementation"
|
|
223
|
+
|
|
224
|
+
bd create "Add client tier management" \
|
|
225
|
+
--parent bd-rl00 \
|
|
226
|
+
--priority 1 \
|
|
227
|
+
--labels "adr-0055,implementation"
|
|
228
|
+
|
|
229
|
+
bd create "Create monitoring dashboard" \
|
|
230
|
+
--parent bd-rl00 \
|
|
231
|
+
--priority 2 \
|
|
232
|
+
--labels "adr-0055,monitoring"
|
|
233
|
+
|
|
234
|
+
bd create "Update API documentation" \
|
|
235
|
+
--parent bd-rl00 \
|
|
236
|
+
--priority 2 \
|
|
237
|
+
--labels "adr-0055,documentation"
|
|
238
|
+
|
|
239
|
+
bd create "Write integration tests" \
|
|
240
|
+
--parent bd-rl00 \
|
|
241
|
+
--priority 1 \
|
|
242
|
+
--labels "adr-0055,testing"
|
|
243
|
+
|
|
244
|
+
# Link epic to ADR
|
|
245
|
+
bd comment bd-rl00 "Implementing ADR-0055: API Rate Limiting (adr/0055-implement-api-rate-limiting.md)"
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
---
|
|
249
|
+
|
|
250
|
+
## Step 4: Update Coordination Manifest
|
|
251
|
+
|
|
252
|
+
**File:** `.augment/coordination.json`
|
|
253
|
+
|
|
254
|
+
```json
|
|
255
|
+
{
|
|
256
|
+
"adrs": {
|
|
257
|
+
"adr-0055": {
|
|
258
|
+
"file": "adr/0055-implement-api-rate-limiting.md",
|
|
259
|
+
"title": "Implement API Rate Limiting",
|
|
260
|
+
"status": "approved",
|
|
261
|
+
"date": "2026-02-05",
|
|
262
|
+
"deciders": ["Tech Lead", "API Team", "Security Team"],
|
|
263
|
+
"relatedSpecs": ["api/rate-limiting"],
|
|
264
|
+
"relatedTasks": ["bd-rl00", "bd-rl01", "bd-rl02", "bd-rl03", "bd-rl04", "bd-rl05", "bd-rl06"],
|
|
265
|
+
"implementationProgress": "in_progress",
|
|
266
|
+
"tags": ["api", "security", "redis", "rate-limiting"]
|
|
267
|
+
}
|
|
268
|
+
},
|
|
269
|
+
"specs": {
|
|
270
|
+
"api/rate-limiting": {
|
|
271
|
+
"file": "openspec/specs/api/rate-limiting.md",
|
|
272
|
+
"status": "active",
|
|
273
|
+
"version": "1.0.0",
|
|
274
|
+
"relatedADRs": ["adr-0055"],
|
|
275
|
+
"relatedTasks": ["bd-rl00", "bd-rl01", "bd-rl02", "bd-rl03"],
|
|
276
|
+
"affectedFiles": [
|
|
277
|
+
"src/middleware/rateLimiter.ts",
|
|
278
|
+
"src/config/rateLimits.ts",
|
|
279
|
+
"src/services/redis.ts",
|
|
280
|
+
"src/models/ClientTier.ts"
|
|
281
|
+
]
|
|
282
|
+
}
|
|
283
|
+
},
|
|
284
|
+
"tasks": {
|
|
285
|
+
"bd-rl00": {
|
|
286
|
+
"title": "Implement API rate limiting",
|
|
287
|
+
"status": "in_progress",
|
|
288
|
+
"type": "epic",
|
|
289
|
+
"relatedADRs": ["adr-0055"],
|
|
290
|
+
"relatedSpecs": ["api/rate-limiting"],
|
|
291
|
+
"subtasks": ["bd-rl01", "bd-rl02", "bd-rl03", "bd-rl04", "bd-rl05", "bd-rl06"]
|
|
292
|
+
},
|
|
293
|
+
"bd-rl01": {
|
|
294
|
+
"title": "Set up Redis rate limit store",
|
|
295
|
+
"status": "closed",
|
|
296
|
+
"relatedADRs": ["adr-0055"],
|
|
297
|
+
"relatedSpecs": ["api/rate-limiting"],
|
|
298
|
+
"affectedFiles": ["src/services/redis.ts", "src/config/redis.ts"]
|
|
299
|
+
},
|
|
300
|
+
"bd-rl02": {
|
|
301
|
+
"title": "Implement rate limit middleware",
|
|
302
|
+
"status": "in_progress",
|
|
303
|
+
"relatedADRs": ["adr-0055"],
|
|
304
|
+
"relatedSpecs": ["api/rate-limiting"],
|
|
305
|
+
"affectedFiles": ["src/middleware/rateLimiter.ts"],
|
|
306
|
+
"blockedBy": ["bd-rl01"]
|
|
307
|
+
},
|
|
308
|
+
"bd-rl03": {
|
|
309
|
+
"title": "Add client tier management",
|
|
310
|
+
"status": "in_progress",
|
|
311
|
+
"relatedADRs": ["adr-0055"],
|
|
312
|
+
"relatedSpecs": ["api/rate-limiting"],
|
|
313
|
+
"affectedFiles": ["src/models/ClientTier.ts", "src/controllers/clientTier.ts"]
|
|
314
|
+
},
|
|
315
|
+
"bd-rl04": {
|
|
316
|
+
"title": "Create monitoring dashboard",
|
|
317
|
+
"status": "open",
|
|
318
|
+
"relatedADRs": ["adr-0055"],
|
|
319
|
+
"affectedFiles": ["src/dashboards/rateLimiting.ts"]
|
|
320
|
+
},
|
|
321
|
+
"bd-rl05": {
|
|
322
|
+
"title": "Update API documentation",
|
|
323
|
+
"status": "open",
|
|
324
|
+
"relatedADRs": ["adr-0055"],
|
|
325
|
+
"relatedSpecs": ["api/rate-limiting"],
|
|
326
|
+
"affectedFiles": ["docs/api/rate-limiting.md"]
|
|
327
|
+
},
|
|
328
|
+
"bd-rl06": {
|
|
329
|
+
"title": "Write integration tests",
|
|
330
|
+
"status": "open",
|
|
331
|
+
"relatedADRs": ["adr-0055"],
|
|
332
|
+
"relatedSpecs": ["api/rate-limiting"],
|
|
333
|
+
"affectedFiles": ["tests/integration/rateLimiting.test.ts"],
|
|
334
|
+
"blockedBy": ["bd-rl02"]
|
|
335
|
+
}
|
|
336
|
+
},
|
|
337
|
+
"files": {
|
|
338
|
+
"src/middleware/rateLimiter.ts": {
|
|
339
|
+
"relatedSpecs": ["api/rate-limiting"],
|
|
340
|
+
"relatedADRs": ["adr-0055"],
|
|
341
|
+
"relatedTasks": ["bd-rl02"]
|
|
342
|
+
},
|
|
343
|
+
"src/config/rateLimits.ts": {
|
|
344
|
+
"relatedSpecs": ["api/rate-limiting"],
|
|
345
|
+
"relatedADRs": ["adr-0055"],
|
|
346
|
+
"relatedTasks": ["bd-rl02"]
|
|
347
|
+
},
|
|
348
|
+
"src/services/redis.ts": {
|
|
349
|
+
"relatedSpecs": ["api/rate-limiting"],
|
|
350
|
+
"relatedADRs": ["adr-0055", "adr-0012"],
|
|
351
|
+
"relatedTasks": ["bd-rl01"]
|
|
352
|
+
},
|
|
353
|
+
"src/models/ClientTier.ts": {
|
|
354
|
+
"relatedSpecs": ["api/rate-limiting"],
|
|
355
|
+
"relatedADRs": ["adr-0055"],
|
|
356
|
+
"relatedTasks": ["bd-rl03"]
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
```
|
|
361
|
+
|
|
362
|
+
---
|
|
363
|
+
|
|
364
|
+
## Step 5: Implementation Workflow
|
|
365
|
+
|
|
366
|
+
### Phase 1: Infrastructure Setup (bd-rl01)
|
|
367
|
+
|
|
368
|
+
**Task:** Set up Redis rate limit store
|
|
369
|
+
|
|
370
|
+
**Files Created:**
|
|
371
|
+
- `src/services/redis.ts`
|
|
372
|
+
- `src/config/redis.ts`
|
|
373
|
+
|
|
374
|
+
**Update Coordination Manifest:**
|
|
375
|
+
```bash
|
|
376
|
+
# Mark task as complete
|
|
377
|
+
bd close bd-rl01 "Redis rate limit store configured with connection pooling"
|
|
378
|
+
|
|
379
|
+
# Manifest automatically updated:
|
|
380
|
+
# - bd-rl01.status = "closed"
|
|
381
|
+
# - bd-rl02 becomes unblocked
|
|
382
|
+
```
|
|
383
|
+
|
|
384
|
+
### Phase 2: Middleware Implementation (bd-rl02)
|
|
385
|
+
|
|
386
|
+
**Task:** Implement rate limit middleware
|
|
387
|
+
|
|
388
|
+
**Files Created:**
|
|
389
|
+
- `src/middleware/rateLimiter.ts`
|
|
390
|
+
- `src/config/rateLimits.ts`
|
|
391
|
+
|
|
392
|
+
**Update Coordination Manifest:**
|
|
393
|
+
```bash
|
|
394
|
+
# Update task status
|
|
395
|
+
bd status bd-rl02 in_progress
|
|
396
|
+
|
|
397
|
+
# Add implementation comment
|
|
398
|
+
bd comment bd-rl02 "Implemented token bucket algorithm with Redis backend. Added graceful degradation for Redis failures."
|
|
399
|
+
|
|
400
|
+
# Mark complete
|
|
401
|
+
bd close bd-rl02 "Rate limit middleware implemented and tested"
|
|
402
|
+
```
|
|
403
|
+
|
|
404
|
+
### Phase 3: Client Tier Management (bd-rl03)
|
|
405
|
+
|
|
406
|
+
**Task:** Add client tier management
|
|
407
|
+
|
|
408
|
+
**Files Created:**
|
|
409
|
+
- `src/models/ClientTier.ts`
|
|
410
|
+
- `src/controllers/clientTier.ts`
|
|
411
|
+
- `src/routes/clientTier.ts`
|
|
412
|
+
|
|
413
|
+
**Update Coordination Manifest:**
|
|
414
|
+
```bash
|
|
415
|
+
bd close bd-rl03 "Client tier CRUD operations implemented with database migrations"
|
|
416
|
+
```
|
|
417
|
+
|
|
418
|
+
### Phase 4: Monitoring (bd-rl04)
|
|
419
|
+
|
|
420
|
+
**Task:** Create monitoring dashboard
|
|
421
|
+
|
|
422
|
+
**Files Created:**
|
|
423
|
+
- `src/dashboards/rateLimiting.ts`
|
|
424
|
+
|
|
425
|
+
**Update Coordination Manifest:**
|
|
426
|
+
```bash
|
|
427
|
+
bd close bd-rl04 "Grafana dashboard created showing rate limit hits, client distribution, and Redis performance"
|
|
428
|
+
```
|
|
429
|
+
|
|
430
|
+
### Phase 5: Documentation (bd-rl05)
|
|
431
|
+
|
|
432
|
+
**Task:** Update API documentation
|
|
433
|
+
|
|
434
|
+
**Files Updated:**
|
|
435
|
+
- `docs/api/rate-limiting.md`
|
|
436
|
+
- `docs/api/errors.md`
|
|
437
|
+
- `README.md`
|
|
438
|
+
|
|
439
|
+
**Update Coordination Manifest:**
|
|
440
|
+
```bash
|
|
441
|
+
bd close bd-rl05 "API documentation updated with rate limit headers, error codes, and client tier information"
|
|
442
|
+
```
|
|
443
|
+
|
|
444
|
+
### Phase 6: Testing (bd-rl06)
|
|
445
|
+
|
|
446
|
+
**Task:** Write integration tests
|
|
447
|
+
|
|
448
|
+
**Files Created:**
|
|
449
|
+
- `tests/integration/rateLimiting.test.ts`
|
|
450
|
+
|
|
451
|
+
**Update Coordination Manifest:**
|
|
452
|
+
```bash
|
|
453
|
+
bd close bd-rl06 "Integration tests written covering all tiers, burst handling, and Redis failure scenarios. 24 tests passing."
|
|
454
|
+
```
|
|
455
|
+
|
|
456
|
+
---
|
|
457
|
+
|
|
458
|
+
## Step 6: Update ADR Status
|
|
459
|
+
|
|
460
|
+
Once all tasks are complete, update the ADR status:
|
|
461
|
+
|
|
462
|
+
**File:** `adr/0055-implement-api-rate-limiting.md`
|
|
463
|
+
|
|
464
|
+
```diff
|
|
465
|
+
- **Status:** Approved
|
|
466
|
+
+ **Status:** Implemented
|
|
467
|
+
|
|
468
|
+
+ **Implemented Date:** 2026-02-20
|
|
469
|
+
```
|
|
470
|
+
|
|
471
|
+
Add implementation notes:
|
|
472
|
+
|
|
473
|
+
```markdown
|
|
474
|
+
---
|
|
475
|
+
|
|
476
|
+
## Implementation
|
|
477
|
+
|
|
478
|
+
**Date:** 2026-02-20
|
|
479
|
+
|
|
480
|
+
**Implementation Tasks:** bd-rl00 (epic with 6 subtasks)
|
|
481
|
+
|
|
482
|
+
**Actual Implementation:**
|
|
483
|
+
- Redis rate limit store with connection pooling
|
|
484
|
+
- Token bucket algorithm with sliding window
|
|
485
|
+
- Graceful degradation (fail open) for Redis failures
|
|
486
|
+
- Client tier management with database migrations
|
|
487
|
+
- Grafana monitoring dashboard
|
|
488
|
+
- Comprehensive integration tests (24 tests)
|
|
489
|
+
|
|
490
|
+
**Deviations from Plan:**
|
|
491
|
+
- Added graceful degradation (not in original plan)
|
|
492
|
+
- Used sliding window instead of fixed window for better accuracy
|
|
493
|
+
- Added Grafana dashboard instead of custom dashboard
|
|
494
|
+
|
|
495
|
+
**Lessons Learned:**
|
|
496
|
+
- Redis connection pooling critical for performance
|
|
497
|
+
- Graceful degradation essential for reliability
|
|
498
|
+
- Client education more important than anticipated
|
|
499
|
+
- Monitoring dashboard invaluable for debugging
|
|
500
|
+
```
|
|
501
|
+
|
|
502
|
+
**Update Coordination Manifest:**
|
|
503
|
+
```json
|
|
504
|
+
{
|
|
505
|
+
"adrs": {
|
|
506
|
+
"adr-0055": {
|
|
507
|
+
"status": "implemented",
|
|
508
|
+
"implementedDate": "2026-02-20",
|
|
509
|
+
"implementationProgress": "complete"
|
|
510
|
+
}
|
|
511
|
+
}
|
|
512
|
+
}
|
|
513
|
+
```
|
|
514
|
+
|
|
515
|
+
---
|
|
516
|
+
|
|
517
|
+
## Integration Benefits
|
|
518
|
+
|
|
519
|
+
### Traceability
|
|
520
|
+
|
|
521
|
+
1. **ADR → Spec**: Decision rationale linked to technical specification
|
|
522
|
+
2. **Spec → Tasks**: Specification broken down into actionable tasks
|
|
523
|
+
3. **Tasks → Files**: Implementation tracked at file level
|
|
524
|
+
4. **Files → ADR**: Code linked back to architectural decision
|
|
525
|
+
|
|
526
|
+
### Coordination
|
|
527
|
+
|
|
528
|
+
- **Single Source of Truth**: Coordination manifest ties everything together
|
|
529
|
+
- **Status Tracking**: Real-time view of implementation progress
|
|
530
|
+
- **Impact Analysis**: Easily see what's affected by a decision
|
|
531
|
+
- **Historical Context**: Understand why code exists
|
|
532
|
+
|
|
533
|
+
### Workflow
|
|
534
|
+
|
|
535
|
+
```
|
|
536
|
+
Decision Made → ADR Created → Spec Written → Tasks Created → Implementation → ADR Updated
|
|
537
|
+
↓ ↓ ↓ ↓ ↓ ↓
|
|
538
|
+
Context Rationale Requirements Breakdown Code Validation
|
|
539
|
+
```
|
|
540
|
+
|
|
541
|
+
---
|
|
542
|
+
|
|
543
|
+
## Coordination Manifest Queries
|
|
544
|
+
|
|
545
|
+
### Find all tasks for an ADR
|
|
546
|
+
|
|
547
|
+
```bash
|
|
548
|
+
# Using jq
|
|
549
|
+
cat .augment/coordination.json | jq '.tasks | to_entries[] | select(.value.relatedADRs[]? == "adr-0055")'
|
|
550
|
+
```
|
|
551
|
+
|
|
552
|
+
### Find all specs related to an ADR
|
|
553
|
+
|
|
554
|
+
```bash
|
|
555
|
+
cat .augment/coordination.json | jq '.specs | to_entries[] | select(.value.relatedADRs[]? == "adr-0055")'
|
|
556
|
+
```
|
|
557
|
+
|
|
558
|
+
### Find all files affected by an ADR
|
|
559
|
+
|
|
560
|
+
```bash
|
|
561
|
+
cat .augment/coordination.json | jq '.files | to_entries[] | select(.value.relatedADRs[]? == "adr-0055")'
|
|
562
|
+
```
|
|
563
|
+
|
|
564
|
+
### Check implementation progress
|
|
565
|
+
|
|
566
|
+
```bash
|
|
567
|
+
cat .augment/coordination.json | jq '.adrs["adr-0055"].implementationProgress'
|
|
568
|
+
```
|
|
569
|
+
|
|
570
|
+
---
|
|
571
|
+
|
|
572
|
+
## See Also
|
|
573
|
+
|
|
574
|
+
- [Complete Lifecycle Example](./complete-lifecycle-example.md)
|
|
575
|
+
- [Superseding Example](./superseding-example.md)
|
|
576
|
+
- [OpenSpec Integration Rules](../rules/openspec-integration.md)
|
|
577
|
+
- [Beads Integration Rules](../rules/beads-integration.md)
|
|
578
|
+
- [Coordination System](../../../../.augment-guidelines/system-integration/coordination-system.md)
|
|
579
|
+
|
|
580
|
+
|