@0xkahi/llw 0.0.0-stage → 0.0.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,302 @@
1
+ # OKF Bundle Examples
2
+
3
+ Three complete, conformant bundles across different domains.
4
+
5
+ ---
6
+
7
+ ## 1. E-commerce Analytics
8
+
9
+ ```
10
+ ecommerce/
11
+ ├── index.md
12
+ ├── tables/
13
+ │ ├── index.md
14
+ │ ├── orders.md
15
+ │ └── customers.md
16
+ └── metrics/
17
+ ├── index.md
18
+ └── gross-revenue.md
19
+ ```
20
+
21
+ ### tables/orders.md
22
+
23
+ ```markdown
24
+ ---
25
+ type: BigQuery Table
26
+ title: Orders
27
+ description: One row per completed customer order across all channels.
28
+ resource: https://console.cloud.google.com/bigquery?p=acme&d=sales&t=orders
29
+ tags: [sales, orders, revenue]
30
+ timestamp: 2026-05-28T14:30:00Z
31
+ ---
32
+
33
+ # Schema
34
+
35
+ | Column | Type | Description |
36
+ |--------|------|-------------|
37
+ | `order_id` | STRING | Globally unique order identifier |
38
+ | `customer_id` | STRING | FK to [customers](./customers.md) |
39
+ | `total_usd` | NUMERIC | Order total in US dollars |
40
+ | `placed_at` | TIMESTAMP | When the customer submitted the order |
41
+ | `channel` | STRING | Acquisition channel (web, mobile, pos) |
42
+
43
+ # Joins
44
+
45
+ - Join with [customers](./customers.md) on `customer_id`
46
+ - Referenced by [gross revenue](/metrics/gross-revenue.md) metric
47
+
48
+ # Citations
49
+
50
+ [1] [BigQuery schema docs](https://cloud.google.com/bigquery/docs/schemas)
51
+ ```
52
+
53
+ ### tables/customers.md
54
+
55
+ ```markdown
56
+ ---
57
+ type: BigQuery Table
58
+ title: Customers
59
+ description: One row per registered customer with profile and lifetime data.
60
+ resource: https://console.cloud.google.com/bigquery?p=acme&d=sales&t=customers
61
+ tags: [sales, customers]
62
+ timestamp: 2026-05-28T14:30:00Z
63
+ ---
64
+
65
+ # Schema
66
+
67
+ | Column | Type | Description |
68
+ |--------|------|-------------|
69
+ | `customer_id` | STRING | Primary key |
70
+ | `email` | STRING | Customer email (hashed in prod) |
71
+ | `created_at` | TIMESTAMP | Registration date |
72
+ | `ltv_usd` | NUMERIC | Lifetime value in USD |
73
+
74
+ # Joins
75
+
76
+ - Referenced by [orders](./orders.md) on `customer_id`
77
+ ```
78
+
79
+ ### metrics/gross-revenue.md
80
+
81
+ ```markdown
82
+ ---
83
+ type: Metric
84
+ title: Gross Revenue
85
+ description: Total revenue before refunds and discounts.
86
+ tags: [revenue, finance, kpi]
87
+ timestamp: 2026-05-28T14:30:00Z
88
+ ---
89
+
90
+ # Definition
91
+
92
+ Sum of `total_usd` from [orders](/tables/orders.md) for a given period.
93
+ Does not subtract refunds — see Net Revenue for that.
94
+
95
+ # SQL
96
+
97
+ ```sql
98
+ SELECT DATE_TRUNC(placed_at, MONTH) as month,
99
+ SUM(total_usd) as gross_revenue
100
+ FROM `acme.sales.orders`
101
+ GROUP BY 1
102
+ ```
103
+
104
+ # Related
105
+
106
+ - Source table: [orders](/tables/orders.md)
107
+ - Counterpart: Net Revenue (gross minus refunds)
108
+ ```
109
+
110
+ ### index.md (root)
111
+
112
+ ```markdown
113
+ # E-commerce Analytics Bundle
114
+
115
+ - [Tables](./tables/) - Database tables powering the analytics stack
116
+ - [Metrics](./metrics/) - Business KPIs derived from tables
117
+ ```
118
+
119
+ ---
120
+
121
+ ## 2. SaaS Incident Playbooks
122
+
123
+ ```
124
+ incidents/
125
+ ├── index.md
126
+ ├── alerts/
127
+ │ ├── index.md
128
+ │ ├── api-latency-p99.md
129
+ │ └── db-connections.md
130
+ └── runbooks/
131
+ ├── index.md
132
+ └── escalate-incident.md
133
+ ```
134
+
135
+ ### alerts/api-latency-p99.md
136
+
137
+ ```markdown
138
+ ---
139
+ type: Alert
140
+ title: API Latency P99 > 2s
141
+ description: Fires when 99th percentile API latency exceeds 2 seconds for 5 minutes.
142
+ tags: [api, latency, critical]
143
+ severity: critical
144
+ timestamp: 2026-06-01T09:00:00Z
145
+ ---
146
+
147
+ # Trigger Condition
148
+
149
+ ```promql
150
+ histogram_quantile(0.99, rate(http_request_duration_seconds_bucket[5m])) > 2
151
+ ```
152
+
153
+ # Impact
154
+
155
+ Users experience timeouts. Downstream services may cascade-fail.
156
+
157
+ # Response
158
+
159
+ 1. Check [DB connections alert](./db-connections.md) — often the root cause
160
+ 2. Follow [escalation runbook](/runbooks/escalate-incident.md) if not resolved in 10 min
161
+ 3. Check deployment log for recent changes
162
+
163
+ # Citations
164
+
165
+ [1] [SLA definition](https://wiki.internal/sla/api-latency)
166
+ ```
167
+
168
+ ### runbooks/escalate-incident.md
169
+
170
+ ```markdown
171
+ ---
172
+ type: Runbook
173
+ title: Escalate Incident
174
+ description: Steps to escalate when on-call cannot resolve within SLA.
175
+ tags: [oncall, incident, escalation]
176
+ timestamp: 2026-06-01T09:00:00Z
177
+ ---
178
+
179
+ # When to Escalate
180
+
181
+ - Alert not resolved within 10 minutes
182
+ - Customer-facing impact confirmed
183
+ - Multiple alerts firing simultaneously
184
+
185
+ # Steps
186
+
187
+ 1. Post in #incidents Slack channel with alert link
188
+ 2. Page the secondary on-call (PagerDuty)
189
+ 3. If P1: page Engineering Manager
190
+ 4. Start incident document from template
191
+ 5. Update status page if customer-facing
192
+
193
+ # Contacts
194
+
195
+ | Role | Who | Method |
196
+ |------|-----|--------|
197
+ | Secondary on-call | Rotation | PagerDuty |
198
+ | Eng Manager | @manager | Slack DM |
199
+ | Infra lead | @infra-lead | Slack DM |
200
+ ```
201
+
202
+ ---
203
+
204
+ ## 3. API Documentation
205
+
206
+ ```
207
+ api/
208
+ ├── index.md
209
+ ├── auth/
210
+ │ ├── index.md
211
+ │ └── oauth2-flow.md
212
+ ├── endpoints/
213
+ │ ├── index.md
214
+ │ └── create-order.md
215
+ └── policies/
216
+ ├── index.md
217
+ └── rate-limits.md
218
+ ```
219
+
220
+ ### endpoints/create-order.md
221
+
222
+ ```markdown
223
+ ---
224
+ type: API Endpoint
225
+ title: Create Order
226
+ description: Creates a new order for an authenticated customer.
227
+ resource: https://api.acme.com/v2/orders
228
+ tags: [orders, write, v2]
229
+ method: POST
230
+ timestamp: 2026-05-20T10:00:00Z
231
+ ---
232
+
233
+ # POST /v2/orders
234
+
235
+ Creates a new order. Requires [OAuth2 authentication](/auth/oauth2-flow.md).
236
+
237
+ # Request
238
+
239
+ ```json
240
+ {
241
+ "customer_id": "cust_abc123",
242
+ "items": [{"sku": "WIDGET-01", "quantity": 2}],
243
+ "idempotency_key": "unique-request-id"
244
+ }
245
+ ```
246
+
247
+ # Response (201 Created)
248
+
249
+ ```json
250
+ {
251
+ "order_id": "ord_xyz789",
252
+ "status": "pending",
253
+ "total_usd": 49.98,
254
+ "created_at": "2026-05-20T10:30:00Z"
255
+ }
256
+ ```
257
+
258
+ # Errors
259
+
260
+ | Code | Meaning |
261
+ |------|---------|
262
+ | 400 | Invalid request body |
263
+ | 401 | Missing or invalid auth token |
264
+ | 409 | Duplicate idempotency_key |
265
+ | 429 | [Rate limit](/policies/rate-limits.md) exceeded |
266
+
267
+ # Rate Limits
268
+
269
+ Subject to [rate limiting](/policies/rate-limits.md). See `X-RateLimit-*` headers.
270
+ ```
271
+
272
+ ### policies/rate-limits.md
273
+
274
+ ```markdown
275
+ ---
276
+ type: Policy
277
+ title: Rate Limits
278
+ description: Per-plan rate limits for all API endpoints.
279
+ tags: [policy, rate-limit, api]
280
+ timestamp: 2026-05-20T10:00:00Z
281
+ ---
282
+
283
+ # Limits by Plan
284
+
285
+ | Plan | Requests/min | Burst |
286
+ |------|-------------|-------|
287
+ | Free | 60 | 10 |
288
+ | Pro | 600 | 100 |
289
+ | Enterprise | 6000 | 1000 |
290
+
291
+ # Response Headers
292
+
293
+ Every response includes:
294
+ - `X-RateLimit-Limit`: max requests per window
295
+ - `X-RateLimit-Remaining`: requests left in window
296
+ - `X-RateLimit-Reset`: Unix timestamp of window reset
297
+
298
+ # When Exceeded
299
+
300
+ Returns `429 Too Many Requests`. Retry after `X-RateLimit-Reset`.
301
+ Applies to all endpoints including [create order](/endpoints/create-order.md).
302
+ ```