@c4a/context-cli 0.7.15 → 0.7.16

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 (45) hide show
  1. package/browser/diagrams.js +2826 -0
  2. package/cli.js +1267 -845
  3. package/indexers/bundles/context-code-indexer/LICENSE.third-party +25 -0
  4. package/indexers/bundles/context-code-indexer/references/diagram-behavior-examples.md +647 -0
  5. package/indexers/bundles/context-code-indexer/references/diagram-topology-examples.md +387 -0
  6. package/indexers/bundles/context-code-indexer/references/diagrams.md +347 -0
  7. package/indexers/bundles/context-markdown-indexer/LICENSE.third-party +25 -0
  8. package/indexers/bundles/context-markdown-indexer/references/diagram-behavior-examples.md +647 -0
  9. package/indexers/bundles/context-markdown-indexer/references/diagram-topology-examples.md +387 -0
  10. package/indexers/bundles/context-markdown-indexer/references/diagrams.md +347 -0
  11. package/indexers/bundles/context-note-indexer/LICENSE.third-party +25 -0
  12. package/indexers/bundles/context-note-indexer/references/diagram-behavior-examples.md +647 -0
  13. package/indexers/bundles/context-note-indexer/references/diagram-topology-examples.md +387 -0
  14. package/indexers/bundles/context-note-indexer/references/diagrams.md +347 -0
  15. package/indexers/bundles/context-sessions-indexer/LICENSE.third-party +25 -0
  16. package/indexers/bundles/context-sessions-indexer/references/diagram-behavior-examples.md +647 -0
  17. package/indexers/bundles/context-sessions-indexer/references/diagram-topology-examples.md +387 -0
  18. package/indexers/bundles/context-sessions-indexer/references/diagrams.md +347 -0
  19. package/indexers/contracts/profile-contract.json +245 -245
  20. package/indexers/release-manifest.json +57 -9
  21. package/package.json +13 -12
  22. package/parserEntryWorker.js +24 -0
  23. package/plugins/VERSION +1 -1
  24. package/plugins/claude/.claude-plugin/plugin.json +1 -1
  25. package/plugins/codex/.codex-plugin/plugin.json +2 -2
  26. package/plugins/cursor/.cursor-plugin/plugin.json +1 -1
  27. package/plugins/skills/context-code-indexer/LICENSE.third-party +25 -0
  28. package/plugins/skills/context-code-indexer/references/diagram-behavior-examples.md +647 -0
  29. package/plugins/skills/context-code-indexer/references/diagram-topology-examples.md +387 -0
  30. package/plugins/skills/context-code-indexer/references/diagrams.md +347 -0
  31. package/plugins/skills/context-markdown-indexer/LICENSE.third-party +25 -0
  32. package/plugins/skills/context-markdown-indexer/references/diagram-behavior-examples.md +647 -0
  33. package/plugins/skills/context-markdown-indexer/references/diagram-topology-examples.md +387 -0
  34. package/plugins/skills/context-markdown-indexer/references/diagrams.md +347 -0
  35. package/plugins/skills/context-note-indexer/LICENSE.third-party +25 -0
  36. package/plugins/skills/context-note-indexer/references/diagram-behavior-examples.md +647 -0
  37. package/plugins/skills/context-note-indexer/references/diagram-topology-examples.md +387 -0
  38. package/plugins/skills/context-note-indexer/references/diagrams.md +347 -0
  39. package/plugins/skills/context-sessions-indexer/LICENSE.third-party +25 -0
  40. package/plugins/skills/context-sessions-indexer/references/diagram-behavior-examples.md +647 -0
  41. package/plugins/skills/context-sessions-indexer/references/diagram-topology-examples.md +387 -0
  42. package/plugins/skills/context-sessions-indexer/references/diagrams.md +347 -0
  43. package/providers/context/manifest.json +5 -5
  44. package/providers/context/provider.yaml +1 -1
  45. package/providers/context/resources/manuals/guides/package-outputs.md +36 -2
@@ -0,0 +1,387 @@
1
+ # Architecture and dataflow examples
2
+
3
+ Read only the case selected by [the scenario guide](diagrams.md). These examples are synthetic upstream teaching material, not evidence for a user's system. Mermaid preserves explicit nodes and relationships; adjacent tables and verbatim cards retain details that do not belong inside a node. Color, routing and compiler observations are illustrative; Mermaid may produce different geometry. No example establishes behavior absent from an authorized source.
4
+
5
+ ## Sample Web App
6
+
7
+ Example: web-app.architecture.json.
8
+
9
+ ```mermaid
10
+ flowchart LR
11
+ subgraph g0["AWS Region: us-west-2"]
12
+ subgraph g1["sg-api :443/:8000"]
13
+ n_lb["Load Balancer"]
14
+ n_api["API Server"]
15
+ end
16
+ n_cdn["CloudFront"]
17
+ n_cache["Redis"]
18
+ n_db["PostgreSQL"]
19
+ n_s3["S3"]
20
+ n_queue["SQS"]
21
+ n_worker["Worker"]
22
+ end
23
+ n_users["Users"]
24
+ n_auth["Auth Provider"]
25
+ n_users -->|"HTTPS"| n_cdn
26
+ n_auth -->|"verify JWT"| n_api
27
+ n_cdn --> n_lb
28
+ n_cdn -.->|"static"| n_s3
29
+ n_lb --> n_api
30
+ n_api -->|"read-through"| n_cache
31
+ n_api -->|"SQL"| n_db
32
+ n_api -.->|"enqueue"| n_queue
33
+ n_queue --> n_worker
34
+ ```
35
+
36
+ **All participants and semantic details**
37
+
38
+ | ID | Label | Detail | Type | Tag | Group |
39
+ | --- | --- | --- | --- | --- | --- |
40
+ | users | Users | Browser / Mobile | external | | |
41
+ | auth | Auth Provider | OAuth 2.0 | security | JWT + PKCE | |
42
+ | cdn | CloudFront | CDN | cloud | | |
43
+ | lb | Load Balancer | HTTPS :443 | cloud | | |
44
+ | api | API Server | FastAPI :8000 | backend | | |
45
+ | cache | Redis | cache :6379 | database | | |
46
+ | db | PostgreSQL | primary :5432 | database | | |
47
+ | s3 | S3 | static assets | cloud | OAI protected | |
48
+ | queue | SQS | job queue | messagebus | | |
49
+ | worker | Worker | async jobs | backend | | |
50
+
51
+ **Relationship semantics**
52
+
53
+ | From → to | Label | Kind | Classification / role |
54
+ | --- | --- | --- | --- |
55
+ | users → cdn | HTTPS | emphasis | |
56
+ | auth → api | verify JWT | security | |
57
+ | cdn → lb | | default | |
58
+ | cdn → s3 | static | dashed | |
59
+ | lb → api | | default | |
60
+ | api → cache | read-through | default | |
61
+ | api → db | SQL | default | |
62
+ | api → queue | enqueue | dashed | |
63
+ | queue → worker | | default | |
64
+
65
+ Boundary **AWS Region: us-west-2** (region): cdn, lb, api, cache, db, s3, queue, worker.
66
+
67
+ Boundary **sg-api :443/:8000** (security-group): lb, api.
68
+
69
+ **Primary request path** (users, cdn, lb, api, db): Follow the primary customer request from the edge to durable state.
70
+
71
+ **Identity and cache** (auth, api, cache): Isolate authentication and the read-through cache beside the request path.
72
+
73
+ **Static and async work** (cdn, s3, api, queue, worker): See the two secondary paths without adding noise to the main request.
74
+
75
+ **Edge**
76
+
77
+ - CloudFront CDN fronts all traffic
78
+ - S3 serves static assets via OAI
79
+
80
+ **Application**
81
+
82
+ - FastAPI behind an HTTPS load balancer
83
+ - Redis read-through cache
84
+ - Async work drained from SQS by a worker
85
+
86
+ **Security**
87
+
88
+ - OAuth 2.0 with JWT + PKCE
89
+ - API + LB isolated in a security group
90
+
91
+ ## Production Deployment Ownership
92
+
93
+ Example: production-deployment.architecture.json.
94
+
95
+ ```mermaid
96
+ flowchart LR
97
+ subgraph g0["AWS us-east-1 / production"]
98
+ subgraph g1["private application network"]
99
+ n_api_a["API Pods / AZ-a"]
100
+ n_api_b["API Pods / AZ-b"]
101
+ n_redis["Redis"]
102
+ n_postgres["PostgreSQL"]
103
+ n_events["Event Bus"]
104
+ n_worker["Workers"]
105
+ end
106
+ n_edge["Global Edge"]
107
+ n_gateway["API Gateway"]
108
+ n_audit["Audit Archive"]
109
+ end
110
+ subgraph g2["AWS eu-west-1 / disaster recovery"]
111
+ subgraph g3["DR private subnet"]
112
+ n_replica["DR Replica"]
113
+ end
114
+ end
115
+ n_clients["Customers"]
116
+ n_observability["Observability"]
117
+ n_clients -->|"HTTPS"| n_edge
118
+ n_edge -->|"mTLS"| n_gateway
119
+ n_gateway -->|"VPC route"| n_api_a
120
+ n_gateway -->|"VPC route"| n_api_b
121
+ n_api_a -->|"cache"| n_redis
122
+ n_api_b -->|"SQL"| n_postgres
123
+ n_api_a -.->|"publish"| n_events
124
+ n_api_b -.-> n_events
125
+ n_events --> n_worker
126
+ n_postgres -->|"cross-region WAL"| n_replica
127
+ n_worker -.->|"evidence"| n_audit
128
+ n_worker -.->|"OTLP"| n_observability
129
+ ```
130
+
131
+ **All participants and semantic details**
132
+
133
+ | ID | Label | Detail | Type | Tag | Group |
134
+ | --- | --- | --- | --- | --- | --- |
135
+ | clients | Customers | web + mobile | external | | |
136
+ | edge | Global Edge | CDN + WAF | cloud | edge team | |
137
+ | gateway | API Gateway | public :443 | security | platform | |
138
+ | api_a | API Pods / AZ-a | private subnet | backend | app team | |
139
+ | api_b | API Pods / AZ-b | private subnet | backend | app team | |
140
+ | redis | Redis | multi-AZ cache | database | platform | |
141
+ | postgres | PostgreSQL | primary / encrypted | database | data team | |
142
+ | events | Event Bus | orders.v1 | messagebus | platform | |
143
+ | worker | Workers | private workload | backend | app team | |
144
+ | replica | DR Replica | eu-west-1 | database | data team | |
145
+ | audit | Audit Archive | immutable objects | cloud | security | |
146
+ | observability | Observability | metrics + traces | external | SRE | |
147
+
148
+ **Relationship semantics**
149
+
150
+ | From → to | Label | Kind | Classification / role |
151
+ | --- | --- | --- | --- |
152
+ | clients → edge | HTTPS | emphasis | |
153
+ | edge → gateway | mTLS | security | |
154
+ | gateway → api_a | VPC route | emphasis | |
155
+ | gateway → api_b | VPC route | emphasis | |
156
+ | api_a → redis | cache | default | |
157
+ | api_b → postgres | SQL | default | |
158
+ | api_a → events | publish | dashed | |
159
+ | api_b → events | | dashed | |
160
+ | events → worker | | emphasis | |
161
+ | postgres → replica | cross-region WAL | security | |
162
+ | worker → audit | evidence | dashed | |
163
+ | worker → observability | OTLP | dashed | |
164
+
165
+ Boundary **AWS us-east-1 / production** (region): edge, gateway, api_a, api_b, redis, postgres, events, worker, audit.
166
+
167
+ Boundary **private application network** (security-group): api_a, api_b, redis, postgres, events, worker.
168
+
169
+ Boundary **AWS eu-west-1 / disaster recovery** (region): replica.
170
+
171
+ Boundary **DR private subnet** (security-group): replica.
172
+
173
+ **Request crosses the edge** (clients, edge, gateway, api_a, api_b): Follow public traffic into the private application network.
174
+
175
+ **State and ownership** (api_a, api_b, redis, postgres, replica): Separate stateless platform workloads from data-team-owned state.
176
+
177
+ **Async and operations** (api_b, events, worker, audit, observability): See the asynchronous work and the evidence it emits.
178
+
179
+ **Runtime Ownership**
180
+
181
+ - Platform owns the edge, gateway, cache, and event bus
182
+ - Application teams own API pods and workers
183
+ - Data owns primary and disaster-recovery state
184
+
185
+ **Named Crossings**
186
+
187
+ - Public HTTPS terminates at the managed edge
188
+ - mTLS crosses into the application network
189
+ - Cross-region WAL is explicit and encrypted
190
+
191
+ **Operational Evidence**
192
+
193
+ - Workers emit traces to SRE-owned observability
194
+ - Audit evidence lands in immutable storage
195
+ - Unknown placement should remain marked, never invented
196
+
197
+ ## Product Analytics Data Flow
198
+
199
+ Example: product-analytics.dataflow.json.
200
+
201
+ ```mermaid
202
+ flowchart LR
203
+ subgraph g0["Sources"]
204
+ n_web["Web App"]
205
+ n_mobile["Mobile"]
206
+ end
207
+ subgraph g1["Ingest"]
208
+ n_edge["Edge API"]
209
+ end
210
+ subgraph g2["Process"]
211
+ n_consent["Consent Gate"]
212
+ n_stream["Event Stream"]
213
+ end
214
+ subgraph g3["Store"]
215
+ n_pii["PII Vault"]
216
+ n_warehouse["Warehouse"]
217
+ n_features["Feature Store"]
218
+ end
219
+ subgraph g4["Consume"]
220
+ n_dashboard["Dashboards"]
221
+ n_model["ML Model"]
222
+ end
223
+ n_web -->|"clickstream"| n_edge
224
+ n_mobile -->|"app events"| n_edge
225
+ n_edge -->|"identity + consent"| n_consent
226
+ n_edge -->|"accepted events"| n_stream
227
+ n_consent -->|"identity map"| n_pii
228
+ n_stream -->|"normalized facts"| n_warehouse
229
+ n_warehouse -.->|"daily aggregates"| n_features
230
+ n_warehouse -->|"metrics SQL"| n_dashboard
231
+ n_features -.->|"feature vectors"| n_model
232
+ n_pii -->|"restricted join"| n_dashboard
233
+ ```
234
+
235
+ **All participants and semantic details**
236
+
237
+ | ID | Label | Detail | Type | Tag | Group |
238
+ | --- | --- | --- | --- | --- | --- |
239
+ | web | Web App | browser SDK | frontend | events | Sources |
240
+ | mobile | Mobile | iOS / Android | frontend | events | Sources |
241
+ | edge | Edge API | collector | cloud | TLS | Ingest |
242
+ | consent | Consent Gate | policy filter | security | PII guard | Process |
243
+ | stream | Event Stream | Kafka topic | messagebus | ordered | Process |
244
+ | pii | PII Vault | encrypted | security | restricted | Store |
245
+ | warehouse | Warehouse | analytics tables | database | curated | Store |
246
+ | features | Feature Store | daily batch | database | derived | Store |
247
+ | dashboard | Dashboards | product metrics | backend | SQL | Consume |
248
+ | model | ML Model | ranking job | backend | features | Consume |
249
+
250
+ **Relationship semantics**
251
+
252
+ | From → to | Label | Kind | Classification / role |
253
+ | --- | --- | --- | --- |
254
+ | web → edge | clickstream | emphasis | user events |
255
+ | mobile → edge | app events | default | device events |
256
+ | edge → consent | identity + consent | security | PII touch |
257
+ | edge → stream | accepted events | emphasis | append-only |
258
+ | consent → pii | identity map | security | encrypted PII |
259
+ | stream → warehouse | normalized facts | emphasis | non-PII |
260
+ | warehouse → features | daily aggregates | dashed | batch |
261
+ | warehouse → dashboard | metrics SQL | default | read-only |
262
+ | features → model | feature vectors | dashed | derived |
263
+ | pii → dashboard | restricted join | security | approved only |
264
+
265
+ **Collection path** (web, mobile, edge, stream): Follow product events from clients into the ordered event stream.
266
+
267
+ **Consent and PII** (edge, consent, pii): Isolate the policy gate and restricted identity store.
268
+
269
+ **Curated consumers** (stream, warehouse, dashboard, features, model): See curated facts, dashboards, and the derived feature path.
270
+
271
+ **Primary Data Path**
272
+
273
+ - Events move left to right through source, ingest, process, store, and consume stages
274
+ - The hot path stays visually clear even with secondary batch flows
275
+ - Labels name data assets instead of generic API verbs
276
+
277
+ **Sensitive Boundary**
278
+
279
+ - Consent and PII paths are styled as security flows
280
+ - PII lands in a restricted vault, separate from the analytics warehouse
281
+ - Restricted joins are visible without implying default access
282
+
283
+ **Derived Consumers**
284
+
285
+ - Dashboards read curated facts from the warehouse
286
+ - Feature vectors are derived by batch from analytics tables
287
+ - Consumption paths stay distinct from collection and consent handling
288
+
289
+ ## Order Event-stream Topology
290
+
291
+ Example: event-stream.dataflow.json.
292
+
293
+ ```mermaid
294
+ flowchart LR
295
+ subgraph g0["Producers"]
296
+ n_checkout["Checkout API"]
297
+ n_billing["Billing API"]
298
+ end
299
+ subgraph g1["Transit"]
300
+ n_orders["orders.v1"]
301
+ n_payments["payments.v2"]
302
+ end
303
+ subgraph g2["Processors"]
304
+ n_validate["Order Validate"]
305
+ n_enrich["Payment Enrich"]
306
+ end
307
+ subgraph g3["State + recovery"]
308
+ n_state["Order State"]
309
+ n_dlq["events.dlq"]
310
+ end
311
+ subgraph g4["Consumers"]
312
+ n_fulfillment["Fulfillment"]
313
+ n_analytics["Analytics"]
314
+ n_replay["Replay Tool"]
315
+ n_ops["On-call"]
316
+ end
317
+ n_checkout -->|"OrderPlaced"| n_orders
318
+ n_billing -->|"PaymentCaptured"| n_payments
319
+ n_orders -->|"ordered orders"| n_validate
320
+ n_payments -->|"payment facts"| n_enrich
321
+ n_validate -->|"valid order"| n_state
322
+ n_enrich -->|"enriched payment"| n_state
323
+ n_state -->|"ready orders"| n_fulfillment
324
+ n_state -->|"order facts"| n_analytics
325
+ n_validate -->|"invalid event"| n_dlq
326
+ n_enrich -->|"poison event"| n_dlq
327
+ n_dlq -->|"failure sample"| n_ops
328
+ n_dlq -.->|"approved replay"| n_replay
329
+ ```
330
+
331
+ **All participants and semantic details**
332
+
333
+ | ID | Label | Detail | Type | Tag | Group |
334
+ | --- | --- | --- | --- | --- | --- |
335
+ | checkout | Checkout API | order producer | frontend | team commerce | Producers |
336
+ | billing | Billing API | payment producer | backend | team money | Producers |
337
+ | orders | orders.v1 | 12 partitions | messagebus | key: order_id | Transit |
338
+ | payments | payments.v2 | 8 partitions | messagebus | key: order_id | Transit |
339
+ | validate | Order Validate | group fulfillment | backend | ordered | Processors |
340
+ | enrich | Payment Enrich | group analytics | backend | at-least-once | Processors |
341
+ | state | Order State | materialized view | database | idempotent | State + recovery |
342
+ | dlq | events.dlq | poison events | messagebus | 7-day retention | State + recovery |
343
+ | fulfillment | Fulfillment | shipping workflow | backend | consumer | Consumers |
344
+ | analytics | Analytics | streaming facts | database | consumer | Consumers |
345
+ | replay | Replay Tool | approved batch | security | operator gate | Consumers |
346
+ | ops | On-call | DLQ owner | external | SRE | Consumers |
347
+
348
+ **Relationship semantics**
349
+
350
+ | From → to | Label | Kind | Classification / role |
351
+ | --- | --- | --- | --- |
352
+ | checkout → orders | OrderPlaced | emphasis | schema v1 |
353
+ | billing → payments | PaymentCaptured | emphasis | schema v2 |
354
+ | orders → validate | ordered orders | emphasis | consumer group |
355
+ | payments → enrich | payment facts | emphasis | at-least-once |
356
+ | validate → state | valid order | emphasis | idempotent |
357
+ | enrich → state | enriched payment | default | idempotent |
358
+ | state → fulfillment | ready orders | emphasis | read model |
359
+ | state → analytics | order facts | default | non-PII |
360
+ | validate → dlq | invalid event | security | dead letter |
361
+ | enrich → dlq | poison event | security | dead letter |
362
+ | dlq → ops | failure sample | security | restricted |
363
+ | dlq → replay | approved replay | dashed | audited batch |
364
+
365
+ **Order event transit** (checkout, orders, validate, state, fulfillment): Follow an order from producer through ordered processing to fulfillment.
366
+
367
+ **Payment event transit** (billing, payments, enrich, state, analytics): Track payment facts into the shared materialized state and analytics.
368
+
369
+ **Failure and replay** (validate, enrich, dlq, replay, ops): Isolate dead letters, operator review, and controlled replay ownership.
370
+
371
+ **Transit Contract**
372
+
373
+ - Every event and topic is named
374
+ - Partition keys preserve per-order ordering
375
+ - Consumer groups expose processing ownership
376
+
377
+ **State + Delivery**
378
+
379
+ - Processors write an idempotent materialized view
380
+ - Fulfillment and analytics consume distinct assets
381
+ - At-least-once delivery never implies duplicate business effects
382
+
383
+ **Failure Ownership**
384
+
385
+ - Poison events land in a retained dead-letter topic
386
+ - On-call inspects samples before replay
387
+ - Replay is gated, batched, and auditable