@chrisdudek/yg 4.1.0 → 4.2.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.
@@ -6,34 +6,19 @@
6
6
  # graph — every node declares a type, and every type must be defined here.
7
7
  #
8
8
  # Changes to this file affect the entire graph and should be confirmed with the user.
9
- # All properties except description are optional — absence means no enforcement.
10
- # When a constraint is absent, anything is allowed. When present, only listed
11
- # values are permitted.
12
9
 
13
10
  node_types:
14
11
  <type-id>:
15
12
  description: <string> # required — what this type is for, when to use it
16
13
 
17
- aspects: [<aspect-id>] # optional — aspects automatically applied to every node
18
- # of this type (channel 3 in aspect resolution).
19
- # These also cascade to children of nodes of this type
20
- # (channel 4). Use for invariants that ALL nodes of
21
- # this type must satisfy.
14
+ aspects: # optional — aspects automatically applied to every
15
+ # node of this type (channel 3). Two forms per entry:
16
+ - simple-aspect # bare string unconditional
17
+ - id: conditional-aspect # object form with per-site applicability filter
18
+ when: <predicate> # see graph-schemas/yg-aspect.yaml for grammar
19
+ # These also cascade to children (channel 4).
22
20
 
23
21
  parents: [<type-id>] # optional — allowed parent node types in the hierarchy.
24
- # If omitted, this type can appear under any parent.
25
- # If specified, nesting under an unlisted parent type
26
- # triggers a parent-type-forbidden error.
27
22
 
28
23
  relations: # optional — allowed relation targets by relation type.
29
- # If a relation type is listed, only the specified
30
- # target types are allowed. Unlisted relation types
31
- # are unrestricted. If omitted entirely, all relations
32
- # are allowed.
33
- <relation-type>: [<type-id>] # Relation types:
34
- # calls — runtime invocation
35
- # uses — compile-time dependency
36
- # extends — inheritance / specialization
37
- # implements — interface contract
38
- # emits — publishes events (must pair with listens)
39
- # listens — subscribes to events (must pair with emits)
24
+ <relation-type>: [<type-id>] # calls | uses | extends | implements | emits | listens
@@ -14,7 +14,42 @@ name: CrossCuttingRequirementName # required — display name
14
14
  description: "Short description" # optional but recommended — shown in yg aspects output
15
15
  # and context packages, helps agents discover relevant aspects
16
16
 
17
- # implies: [other-aspect] # optional — other aspect identifiers included automatically
18
- # when this aspect is effective on a node. Recursive expansion
19
- # (A implies B implies C = all three effective). Must be acyclic
20
- # — CLI detects and rejects cycles.
17
+ # implies: # optional — other aspects included automatically when this
18
+ # # aspect is effective on a node. Two forms:
19
+ # - simple-aspect-id # bare string implied unconditionally (when outer aspect passes)
20
+ # - id: conditional-aspect-id # object form imply only when `when` passes on the node
21
+ # when: <predicate> # see `when` section below for grammar
22
+ # Chains expand recursively. Cycles are forbidden — CLI detects.
23
+
24
+ # when: <predicate> # optional — applicability filter. If the predicate evaluates
25
+ # to false on a node, this aspect is not effective on that node
26
+ # regardless of which channel attached it. Combines with
27
+ # attach-site `when` declarations via AND.
28
+ #
29
+ # Grammar:
30
+ # when:
31
+ # all_of: [<clause>, ...] # AND
32
+ # any_of: [<clause>, ...] # OR
33
+ # not: <clause> # negation
34
+ # <atomic> # top-level atomics imply all_of
35
+ #
36
+ # Atomic clauses:
37
+ # relations:
38
+ # <relation-type>: # calls | uses | extends | implements | emits | listens
39
+ # target_type: <type-id> # match target node's declared type
40
+ # target: <node-path> # match exact node path (relative to model/)
41
+ # consumes_port: <port> # match a port consumed on this relation
42
+ # descendants: # same as relations but evaluated against any descendant in model/
43
+ # relations: {...}
44
+ # type: <type-id>
45
+ # has_port: <port-name>
46
+ # node:
47
+ # type: <type-id>
48
+ # has_port: <port-name>
49
+ # has_mapping: true | false
50
+ #
51
+ # Example:
52
+ # when:
53
+ # any_of:
54
+ # - relations: { calls: { target_type: service-client } }
55
+ # - descendants: { relations: { calls: { target_type: service-client } } }
@@ -17,6 +17,7 @@ nodes: # required, non-empty — participant nodes (alias
17
17
  - payments/payment-service # each participant (and its descendants) must satisfy
18
18
  - inventory/inventory-service # any flow-level aspects declared below
19
19
 
20
- # aspects: [requires-saga] # optional — aspect identifiers propagated to ALL participants
21
- # (channel 5 in aspect resolution). Use for requirements that
22
- # apply to every node in this process but not globally.
20
+ aspects: # optional — aspects propagate to all flow participants (channel 5)
21
+ - simple-aspect # bare string
22
+ - id: conditional-aspect # object form with per-site applicability filter
23
+ when: <predicate> # see graph-schemas/yg-aspect.yaml for grammar
@@ -9,14 +9,20 @@ type: service # required — must match a type defined in yg-arc
9
9
  description: "What this node does" # optional but recommended — shown in context output,
10
10
  # helps agents understand purpose without reading code
11
11
 
12
- aspects: # optional — aspect identifiers applied directly to this node
13
- - aspect-id # must match a directory name under aspects/
14
- # these aspects also cascade to all child nodes
12
+ aspects: # optional — aspect identifiers applied directly to this node.
13
+ # Two forms per entry:
14
+ - simple-aspect # bare string always effective once attached (channel 1)
15
+ - id: conditional-aspect # object form — attach with per-site applicability filter
16
+ when: <predicate> # see graph-schemas/yg-aspect.yaml for grammar
17
+ # Aspects cascade to all child nodes.
15
18
 
16
19
  ports: # optional — named entry points with required aspects
17
20
  port-name: # consumers of this node reference ports via consumes
18
21
  description: "What this port provides" # required
19
- aspects: [aspect-id] # required — aspects that consumers must satisfy (channel 6)
22
+ aspects: # required — aspects consumers must satisfy (channel 6)
23
+ - simple-aspect # bare string form
24
+ - id: conditional-aspect
25
+ when: <predicate> # object form with per-attach applicability filter
20
26
 
21
27
  relations: # optional — outgoing dependencies to other nodes
22
28
  - target: other/module-path # required — node path relative to model/
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@chrisdudek/yg",
3
- "version": "4.1.0",
3
+ "version": "4.2.0",
4
4
  "description": "Continuous architecture enforcement for AI-assisted development. Aspects, review, enforcement.",
5
5
  "type": "module",
6
6
  "bin": {