@archinsight/cli 3.0.0-snapshot.6 → 3.0.0-snapshot.7

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 (2) hide show
  1. package/build/index.js +229 -76
  2. package/package.json +1 -1
package/build/index.js CHANGED
@@ -37848,7 +37848,7 @@ var QueryParser = class {
37848
37848
  };
37849
37849
 
37850
37850
  // src/version.ts
37851
- var version = "3.0.0-snapshot.6";
37851
+ var version = "3.0.0-snapshot.7";
37852
37852
 
37853
37853
  // src/index.ts
37854
37854
  var hiddenStructureTypes = /* @__PURE__ */ new Set(["List", "Nothing", "Text", "text"]);
@@ -38732,13 +38732,18 @@ If \`archinsight\` is not available, ask the user to install or expose
38732
38732
  2. Preserve indentation and the project's existing naming style.
38733
38733
  3. Model architecture from the outside inward: context, external actors/systems,
38734
38734
  systems, containers/services, components, and deployment details.
38735
- 4. When the task touches infrastructure, runtime placement, regions, or
38736
- deployment, decide per system whether pragmatic mixed C2 or clean
38737
- C4/deployment is appropriate.
38738
- 5. Prefer small, focused files connected by \`context\`, \`import\`, and \`extend\`.
38739
- 6. Keep definition/framework files separate from model files that declare
38735
+ 4. Do not ask about deployment depth until the task touches infrastructure,
38736
+ runtime placement, regions, brokers, gateways, storage, or deployment.
38737
+ 5. At that point, decide per system whether pragmatic mixed C2 or clean
38738
+ C4/deployment is appropriate. If modeling clean C4: attach placement/storage
38739
+ to elements, attach path infrastructure that needs \`$to\` to wires, and make
38740
+ pub/sub dependencies consumer-owned.
38741
+ 6. If a diagram becomes noisy, adjust scope/query before changing a correct
38742
+ graph model.
38743
+ 7. Prefer small, focused files connected by \`context\`, \`import\`, and \`extend\`.
38744
+ 8. Keep definition/framework files separate from model files that declare
38740
38745
  \`context <id>\`.
38741
- 7. Validate every Insight change with \`archinsight link . --format text\`.
38746
+ 9. Validate every Insight change with \`archinsight link . --format text\`.
38742
38747
 
38743
38748
  ## References
38744
38749
 
@@ -38838,16 +38843,21 @@ If \`archinsight\` is not available, ask the user to install or expose
38838
38843
  2. Preserve indentation and the project's existing naming style.
38839
38844
  3. Model architecture from the outside inward: context, external actors/systems,
38840
38845
  systems, containers/services, components, and deployment details.
38841
- 4. When the task touches infrastructure, runtime placement, regions, or
38842
- deployment, decide per system whether pragmatic mixed C2 or clean
38843
- C4/deployment is appropriate.
38844
- 5. Prefer small, focused files connected by \`context\`, \`import\`, and \`extend\`.
38845
- 6. Keep definition/framework files separate from model files that declare
38846
+ 4. Do not ask about deployment depth until the task touches infrastructure,
38847
+ runtime placement, regions, brokers, gateways, storage, or deployment.
38848
+ 5. At that point, decide per system whether pragmatic mixed C2 or clean
38849
+ C4/deployment is appropriate. If modeling clean C4: attach placement/storage
38850
+ to elements, attach path infrastructure that needs \`$to\` to wires, and make
38851
+ pub/sub dependencies consumer-owned.
38852
+ 6. If a diagram becomes noisy, adjust scope/query before changing a correct
38853
+ graph model.
38854
+ 7. Prefer small, focused files connected by \`context\`, \`import\`, and \`extend\`.
38855
+ 8. Keep definition/framework files separate from model files that declare
38846
38856
  \`context <id>\`.
38847
- 7. Use \`archinsight structure . --format text\` before broad edits when the
38857
+ 9. Use \`archinsight structure . --format text\` before broad edits when the
38848
38858
  project shape is unclear.
38849
- 8. Validate every Insight change with \`archinsight link . --format text\`.
38850
- 9. If validation fails, fix the first real syntax/type/linking error before
38859
+ 10. Validate every Insight change with \`archinsight link . --format text\`.
38860
+ 11. If validation fails, fix the first real syntax/type/linking error before
38851
38861
  adding more model content.
38852
38862
 
38853
38863
  ## References
@@ -38949,17 +38959,22 @@ install or expose \`@archinsight/cli\` before changing \`.ai\` files.
38949
38959
  2. Preserve indentation and the project's existing naming style.
38950
38960
  3. Model architecture from the outside inward: context, external actors/systems,
38951
38961
  systems, containers/services, components, and deployment details.
38952
- 4. When the task touches infrastructure, runtime placement, regions, or
38953
- deployment, decide per system whether pragmatic mixed C2 or clean
38954
- C4/deployment is appropriate.
38955
- 5. Prefer small, focused files connected by \`context\`, \`import\`, and \`extend\`.
38956
- 6. Keep definition/framework files separate from model files that declare
38962
+ 4. Do not ask about deployment depth until the task touches infrastructure,
38963
+ runtime placement, regions, brokers, gateways, storage, or deployment.
38964
+ 5. At that point, decide per system whether pragmatic mixed C2 or clean
38965
+ C4/deployment is appropriate. If modeling clean C4: attach placement/storage
38966
+ to elements, attach path infrastructure that needs \`$to\` to wires, and make
38967
+ pub/sub dependencies consumer-owned.
38968
+ 6. If a diagram becomes noisy, adjust scope/query before changing a correct
38969
+ graph model.
38970
+ 7. Prefer small, focused files connected by \`context\`, \`import\`, and \`extend\`.
38971
+ 8. Keep definition/framework files separate from model files that declare
38957
38972
  \`context <id>\`.
38958
- 7. Use \`archinsight structure . --format text\` to inspect the current model
38973
+ 9. Use \`archinsight structure . --format text\` to inspect the current model
38959
38974
  before broad edits when the CLI is available.
38960
- 8. Validate every Insight change with \`archinsight link . --format text\` when
38975
+ 10. Validate every Insight change with \`archinsight link . --format text\` when
38961
38976
  shell access is available; otherwise ask the user to run validation.
38962
- 9. If validation fails, fix the first real syntax/type/linking error before
38977
+ 11. If validation fails, fix the first real syntax/type/linking error before
38963
38978
  adding more model content.
38964
38979
 
38965
38980
  ## Communication
@@ -39155,6 +39170,15 @@ extra attribute.
39155
39170
  Use \`~>\` for asynchronous relationships. Model one async wire per meaningful
39156
39171
  topic or event flow between real producer and consumer elements.
39157
39172
 
39173
+ For pub/sub, make the dependency consumer-owned:
39174
+
39175
+ - The producer/source declares the event topic as part of its contract, but does
39176
+ not maintain a manual list of subscribers.
39177
+ - The consumer declares \`~> producer\` with \`via = <topic>\`, because the
39178
+ consumer depends on the producer's event contract.
39179
+ - To answer "who depends on this event?", query the graph for incoming async
39180
+ dependencies instead of editing a subscriber list on the producer.
39181
+
39158
39182
  Do not invent a broker node just to make the diagram look familiar. If the
39159
39183
  chosen style is clean C4 and the broker is deployment infrastructure, model it
39160
39184
  in deployment/C4. If the chosen style is pragmatic mixed C2, a broker-like node
@@ -39305,10 +39329,10 @@ links:
39305
39329
  technology = HTTPS, JSON
39306
39330
  call = POST /checkout
39307
39331
  description = Places an order
39308
- ~> analytics
39332
+ ~> order_events
39309
39333
  technology = Kafka
39310
39334
  via = orders.created
39311
- description = Publishes order events
39335
+ description = Consumes order events
39312
39336
  \`\`\`
39313
39337
 
39314
39338
  \`call\` is singular and belongs to synchronous \`->\` links. \`via\` belongs to
@@ -39358,22 +39382,79 @@ Use \`extend type\` / \`extend presentation\` when patching existing vocabulary.
39358
39382
  Repeating \`define presentation X\` for an existing presentation is a diagnostic
39359
39383
  in current Archinsight.
39360
39384
 
39385
+ ## Comments and Notes
39386
+
39387
+ Use \`#\` for ordinary comments when you want to leave guidance for humans or
39388
+ agents without changing the model:
39389
+
39390
+ \`\`\`insight
39391
+ # This file owns the checkout bounded context.
39392
+ context checkout
39393
+
39394
+ system checkout_platform
39395
+ # Keep logical services here; deployment inventory belongs in C4 files.
39396
+ name = Checkout Platform
39397
+ \`\`\`
39398
+
39399
+ A \`#\` after an element or relationship line is an inline note. Notes are
39400
+ stored in the linked graph and can be rendered as note nodes near the element or
39401
+ edge:
39402
+
39403
+ \`\`\`insight
39404
+ context checkout
39405
+
39406
+ system checkout_platform
39407
+ name = Checkout Platform
39408
+
39409
+ container api # Public API owned by the checkout team
39410
+ name = Checkout API
39411
+ links:
39412
+ -> payment_gateway # PCI-sensitive request path
39413
+ technology = HTTPS
39414
+ call = POST /payments
39415
+
39416
+ external system payment_gateway
39417
+ name = Payment gateway
39418
+ \`\`\`
39419
+
39420
+ Use comments for authoring hints that should stay invisible in diagrams. Use
39421
+ notes for architecture remarks that should travel with the model and help
39422
+ readers understand a specific element or relationship.
39423
+
39361
39424
  ## Annotations
39362
39425
 
39363
- Annotations decorate the next declaration or link:
39426
+ Annotations decorate the next declaration or relationship. Put each annotation
39427
+ on its own line immediately before the target:
39364
39428
 
39365
39429
  \`\`\`insight
39366
- @planned
39367
- external system warehouse
39368
- name = Warehouse
39430
+ context fulfillment
39369
39431
 
39370
- links:
39371
- @deprecated
39372
- ~> legacy_erp
39432
+ system fulfillment_platform
39433
+ name = Fulfillment Platform
39434
+
39435
+ @planned
39436
+ container fulfillment_adapter
39437
+ name = Fulfillment adapter
39438
+ links:
39439
+ @deprecated(replace after ERP migration)
39440
+ ~> legacy_erp # scheduled for removal
39441
+
39442
+ external system legacy_erp
39443
+ name = Legacy ERP
39373
39444
  \`\`\`
39374
39445
 
39375
- Use presentation definitions for durable visual styling. Avoid adding new
39376
- Graphviz attributes directly unless the project already uses that convention.
39446
+ Available annotations:
39447
+
39448
+ - \`@planned\` marks an element or relationship as planned or not fully
39449
+ implemented yet. The default Graphviz renderer highlights it in green.
39450
+ - \`@deprecated\` marks an element or relationship as legacy or scheduled for
39451
+ removal. Add optional text in parentheses when the replacement or reason is
39452
+ useful. The default Graphviz renderer highlights it in red.
39453
+
39454
+ Annotations can be stacked and are preserved on projected relationships, so a
39455
+ C4 projection can still show that the original logical relationship was planned
39456
+ or deprecated. Annotations cannot decorate assignments; use a comment above the
39457
+ assignment when you only need a local authoring hint.
39377
39458
 
39378
39459
  ## Presentation Syntax
39379
39460
 
@@ -39694,11 +39775,13 @@ at context level. Prefer capability language over endpoint trivia.
39694
39775
  Use \`~>\` for meaningful asynchronous context flows:
39695
39776
 
39696
39777
  \`\`\`insight
39697
- links:
39698
- ~> analytics_platform
39699
- technology = Kafka
39700
- via = order.completed
39701
- description = Publishes completed order events
39778
+ external system analytics_platform
39779
+ name = Analytics Platform
39780
+ links:
39781
+ ~> storefront
39782
+ technology = Kafka
39783
+ via = order.completed
39784
+ description = Consumes completed order events from Storefront
39702
39785
  \`\`\`
39703
39786
 
39704
39787
  ## What Not To Put In C1
@@ -39886,18 +39969,28 @@ Import the real declaration when it is shared.
39886
39969
 
39887
39970
  ## Async and Eventing Pattern
39888
39971
 
39889
- Use \`~>\` for meaningful asynchronous relationships:
39972
+ Use \`~>\` for meaningful asynchronous dependencies. For pub/sub, declare the
39973
+ wire on the consumer, pointing at the producer/source whose topic contract it
39974
+ depends on:
39890
39975
 
39891
39976
  \`\`\`insight
39892
- service checkout_api
39893
- name = Checkout API
39977
+ external system analytics_platform
39978
+ name = Analytics Platform
39979
+ technology = Kafka consumer
39894
39980
  links:
39895
- ~> analytics_platform
39981
+ ~> checkout_api
39896
39982
  technology = Kafka
39897
39983
  via = checkout.completed
39898
- description = Publishes completed checkout events
39984
+ description = Consumes completed checkout events
39985
+
39986
+ service checkout_api
39987
+ name = Checkout API
39988
+ description = Publishes checkout.completed as an event contract
39899
39989
  \`\`\`
39900
39990
 
39991
+ Do not list consumers under the producer just to answer "who listens to this
39992
+ topic?" That answer belongs in a query over incoming async dependencies.
39993
+
39901
39994
  Do not add a broker node just to make an event diagram look familiar. In clean
39902
39995
  C2, a broker is usually deployment/C4 infrastructure unless the project defines
39903
39996
  it as a runtime system or service in the selected view. In pragmatic mixed C2,
@@ -40108,10 +40201,6 @@ extend service inventory_api
40108
40201
  links:
40109
40202
  -> inventory_policy
40110
40203
  -> reservation_repository
40111
- ~> inventory_events
40112
- technology = Kafka
40113
- via = inventory.reserved
40114
- description = Publishes successful reservation events
40115
40204
 
40116
40205
  component inventory_policy
40117
40206
  name = Inventory policy
@@ -40123,15 +40212,21 @@ extend service inventory_api
40123
40212
  technology = SQL
40124
40213
  responsibility = Stores reservation state and idempotency keys
40125
40214
 
40126
- component inventory_events
40127
- name = Inventory events
40128
- technology = Kafka producer
40129
- responsibility = Publishes inventory domain events for downstream systems
40215
+ component stock_projection
40216
+ name = Stock projection
40217
+ technology = Kafka consumer
40218
+ responsibility = Maintains a stock read model from reservation events
40219
+ links:
40220
+ ~> reservation_service
40221
+ technology = Kafka
40222
+ via = inventory.reserved
40223
+ description = Consumes successful reservation events
40130
40224
  \`\`\`
40131
40225
 
40132
40226
  Use \`->\` for synchronous calls and \`~>\` for asynchronous flows. Use singular
40133
40227
  \`call\` for the synchronous operation and \`via\` for the asynchronous topic,
40134
- queue, or channel.
40228
+ queue, or channel. For pub/sub, put the async link on the consumer and point it
40229
+ at the producer/source whose event contract it consumes.
40135
40230
 
40136
40231
  ## Imported Boundary Pattern
40137
40232
 
@@ -40210,9 +40305,9 @@ Use async details for events:
40210
40305
 
40211
40306
  \`\`\`insight
40212
40307
  links:
40213
- ~> inventory_events
40308
+ ~> reservation_service
40214
40309
  via = inventory.reserved
40215
- description = Publishes reservation completion
40310
+ description = Consumes reservation completion events
40216
40311
  \`\`\`
40217
40312
 
40218
40313
  Do not add a broker as a component unless the broker is actually part of the
@@ -40258,8 +40353,10 @@ projection rules.
40258
40353
  - Before You Use C4
40259
40354
  - Mental Model
40260
40355
  - C4 Workflow
40356
+ - C4 Decision Checklist
40261
40357
  - Environment Inventory
40262
40358
  - Why Infrastructure Is Per Environment
40359
+ - Graph Model vs Diagram Scope
40263
40360
  - Attaching Deployment To C1-C3 Elements
40264
40361
  - usesProfile, environmentsFrom, runsOn, and uses
40265
40362
  - Deployment Archetypes
@@ -40373,6 +40470,23 @@ environment prod
40373
40470
  8. Validate with \`archinsight link . --format text\`.
40374
40471
  9. Render with \`archinsight render . -c <context-id> -s <c4-file.ai> -v c4 -f svg -o c4.svg\`.
40375
40472
 
40473
+ ## C4 Decision Checklist
40474
+
40475
+ Use this before adding a \`deployment:\` block:
40476
+
40477
+ - Placement/grouping? Put \`runsOn compute\` on the deployed element.
40478
+ - Stateful or sidecar-like dependency? Put \`uses storage\`, \`uses observability\`,
40479
+ or similar element-level infrastructure on the deployed element.
40480
+ - Traffic path to a target? Put \`uses network\`, \`uses publicGateway\`, or any
40481
+ infrastructure whose projection mentions \`$to\` on the relationship under
40482
+ \`links:\`, not on the container/service.
40483
+ - Pub/sub path? Make the async wire consumer-owned: the consumer declares
40484
+ \`~> producer\` with \`via = <topic>\`, then attach \`uses broker\` to that wire
40485
+ when modeling clean C4 broker infrastructure.
40486
+ - Picture too noisy? Keep the graph model correct and change source scope or
40487
+ write a custom query. Fan-in to a shared node is normal graph reality, not a
40488
+ modeling error by itself.
40489
+
40376
40490
  ## Environment Inventory
40377
40491
 
40378
40492
  Define infrastructure vocabulary in a definition file:
@@ -40445,6 +40559,12 @@ environment prod
40445
40559
  specific \`prod\` environment. Another environment can fill the same slots with
40446
40560
  different concrete infrastructure.
40447
40561
 
40562
+ Object ids are still unique within a context, even when the instances live in
40563
+ different environment slots. When the exact id is not important, use anonymous
40564
+ \`_\` instances inside each environment. When you need stable ids, make them
40565
+ environment-specific, such as \`envoy_prod\` and \`envoy_staging\`, instead of
40566
+ reusing \`envoy_public\` in several environments.
40567
+
40448
40568
  ## Why Infrastructure Is Per Environment
40449
40569
 
40450
40570
  Infrastructure must be per environment because deployment is many-to-many:
@@ -40461,6 +40581,14 @@ If infrastructure were modeled as global nodes, the model could not say:
40461
40581
  "Checkout API runs on EKS in production, Cloud Run in staging, and uses a
40462
40582
  different database in each environment" without duplicating logical services.
40463
40583
 
40584
+ ## Graph Model vs Diagram Scope
40585
+
40586
+ The linked model is a graph; a diagram is only one scoped query over that graph.
40587
+ Fan-in to one broker, gateway, load balancer, or producer is often the correct
40588
+ physical model. If the picture explodes, do not rewrite the model just to make
40589
+ the image tidy. Narrow the selected source file, add a custom \`.aiq\` query,
40590
+ group differently, or aggregate the view.
40591
+
40464
40592
  ## Attaching Deployment To C1-C3 Elements
40465
40593
 
40466
40594
  \`deployment\` is available on systems, containers/services, components, and
@@ -40866,7 +40994,13 @@ logical service projects into both environments without duplicating
40866
40994
  slots for them.
40867
40995
  - Creating \`infrastructureComponent\` nodes at context level when they should
40868
40996
  live in an \`environment\` inventory slot.
40997
+ - Reusing the same concrete infrastructure id in several environments. Use
40998
+ anonymous \`_\` instances or environment-specific ids.
40869
40999
  - Using \`usesProfile\` on a wire when only \`environmentsFrom\` is intended.
41000
+ - Attaching \`uses publicGateway\`, \`uses network\`, or another \`$to\`-based
41001
+ path projection to a container/service. Move it to the specific wire.
41002
+ - Modeling pub/sub as a producer-owned subscriber list. Consumers should declare
41003
+ \`~> producer\` with \`via = <topic>\`; use queries to list consumers.
40870
41004
  - Forgetting \`--source <c4-file.ai>\` when rendering C4.
40871
41005
  - Expecting \`runsOn\` to draw traffic; use \`project:\` rules and \`uses\` for
40872
41006
  traffic/path projections.
@@ -41798,6 +41932,24 @@ Write or adjust a \`.aiq\` query when:
41798
41932
  Do not compensate for a view filter by duplicating model elements. First inspect
41799
41933
  the built-in query and decide whether the model or the query owns the behavior.
41800
41934
 
41935
+ ## Graph Is Not The Picture
41936
+
41937
+ The linked model can have correct fan-in to one broker, gateway, load balancer,
41938
+ producer, or shared runtime node. A crowded diagram means the current view is too
41939
+ broad or not aggregated enough; it does not automatically mean the model is
41940
+ wrong.
41941
+
41942
+ When the graph is right but the picture is noisy:
41943
+
41944
+ - narrow \`-s <source.ai>\` to the file that owns the view;
41945
+ - copy the nearest \`examples/builtin-views/*.aiq\` query;
41946
+ - filter to the layer, flow, or relationship class the user asked for;
41947
+ - change \`GROUP BY\` to cluster by parent, runtime placement, or another useful
41948
+ attribute.
41949
+
41950
+ Do not duplicate infrastructure or invert dependencies only to make one render
41951
+ look cleaner.
41952
+
41801
41953
  ## Diagnose A Missing Element
41802
41954
 
41803
41955
  1. Validate the model:
@@ -42121,6 +42273,11 @@ external system payment_provider
42121
42273
  external system analytics_platform
42122
42274
  name = Analytics Platform
42123
42275
  technology = Kafka consumer
42276
+ links:
42277
+ ~> checkout_api
42278
+ technology = Kafka
42279
+ via = checkout.completed
42280
+ description = Consumes completed checkout events
42124
42281
 
42125
42282
  system storefront
42126
42283
  name = Storefront
@@ -42151,12 +42308,6 @@ system storefront
42151
42308
  name = Checkout API
42152
42309
  technology = Kotlin, PostgreSQL
42153
42310
  description = Prices carts, creates orders, and coordinates payment
42154
- links:
42155
- ~> analytics_platform
42156
- technology = Kafka
42157
- via = checkout.completed
42158
- description = Publishes completed checkout events
42159
-
42160
42311
  component checkout_controller
42161
42312
  name = Checkout controller
42162
42313
  technology = REST controller
@@ -42173,10 +42324,6 @@ system storefront
42173
42324
  call = authorize(paymentCommand)
42174
42325
  description = Requests payment authorization
42175
42326
  -> order_repository
42176
- ~> checkout_events
42177
- technology = Kafka
42178
- via = checkout.completed
42179
- description = Publishes completed checkout events
42180
42327
 
42181
42328
  component payment_gateway
42182
42329
  name = Payment gateway
@@ -42193,10 +42340,15 @@ system storefront
42193
42340
  technology = SQL
42194
42341
  responsibility = Stores order state and checkout audit records
42195
42342
 
42196
- component checkout_events
42197
- name = Checkout events
42198
- technology = Kafka producer
42199
- responsibility = Publishes checkout lifecycle events for downstream consumers
42343
+ component checkout_projection
42344
+ name = Checkout projection
42345
+ technology = Kafka consumer
42346
+ responsibility = Maintains an internal checkout read model from events
42347
+ links:
42348
+ ~> checkout_service
42349
+ technology = Kafka
42350
+ via = checkout.completed
42351
+ description = Consumes checkout completion events
42200
42352
  `;
42201
42353
  }
42202
42354
  function genericC4DeploymentFrameworkExample() {
@@ -42394,13 +42546,6 @@ system storefront
42394
42546
  usesProfile regional_service
42395
42547
  uses storage
42396
42548
  links:
42397
- ~> order_worker
42398
- technology = Kafka
42399
- via = orders.events
42400
- deployment:
42401
- environmentsFrom regional_service
42402
- uses broker
42403
-
42404
42549
  -> payment_provider
42405
42550
  technology = HTTPS
42406
42551
  call = POST /payments/authorizations
@@ -42411,6 +42556,14 @@ system storefront
42411
42556
  description = Processes order events asynchronously
42412
42557
  deployment:
42413
42558
  usesProfile regional_service
42559
+ links:
42560
+ ~> checkout_api
42561
+ technology = Kafka
42562
+ via = orders.events
42563
+ description = Consumes order events emitted by Checkout API
42564
+ deployment:
42565
+ environmentsFrom regional_service
42566
+ uses broker
42414
42567
  `;
42415
42568
  }
42416
42569
  function genericC2QueryExample() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@archinsight/cli",
3
- "version": "3.0.0-snapshot.6",
3
+ "version": "3.0.0-snapshot.7",
4
4
  "license": "Apache-2.0",
5
5
  "type": "module",
6
6
  "repository": {