@davidorex/pi-context 0.29.0 → 0.30.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.
@@ -46,6 +46,62 @@ Append a closure-table relation (edge: parent, child, relation_type, optional or
46
46
  | `child` | string | yes | Canonical id of the child endpoint |
47
47
  | `relation_type` | string | yes | Registered relation_type canonical_id / hierarchy edge type / lens id |
48
48
  | `ordinal` | integer | no | Optional sibling-ordering within (parent, relation_type) |
49
+ | `dryRun` | boolean | no | Preview without writing relations.json |
50
+ </tool>
51
+
52
+ <tool name="remove-relation">
53
+ Remove the single closure-table relation (edge) matching parent+child+relation_type from relations.json. Matches on the SAME (parent, child, relation_type) dedup identity append-relation uses, so it is the symmetric inverse of append-relation (ordinal is NOT part of identity). An absent edge is an idempotent no-op. Reference integrity is NOT checked here — run context-validate after if the removal changes resolvability.
54
+
55
+ *Remove a relation/edge between two items (the inverse of append-relation)*
56
+
57
+ | Parameter | Type | Required | Description |
58
+ |-----------|------|----------|-------------|
59
+ | `parent` | string | yes | Canonical id (or lens bin name) of the parent endpoint |
60
+ | `child` | string | yes | Canonical id of the child endpoint |
61
+ | `relation_type` | string | yes | Registered relation_type canonical_id / hierarchy edge type / lens id |
62
+ | `dryRun` | boolean | no | Preview without writing relations.json |
63
+ </tool>
64
+
65
+ <tool name="replace-relation">
66
+ Atomically replace one closure-table relation with another in a SINGLE write (no half-state: the old edge and the new edge never coexist on disk). The old edge is matched on the (parent, child, relation_type) dedup identity; the new edge is written with its optional ordinal. If the old edge is absent the call is effectively an append of the new edge. Reference integrity is NOT checked here — run context-validate after.
67
+
68
+ *Atomically swap one relation/edge for another in a single write*
69
+
70
+ | Parameter | Type | Required | Description |
71
+ |-----------|------|----------|-------------|
72
+ | `old_parent` | string | yes | Parent endpoint selector of the edge to remove |
73
+ | `old_child` | string | yes | Child endpoint selector of the edge to remove |
74
+ | `old_relation_type` | string | yes | relation_type of the edge to remove |
75
+ | `parent` | string | yes | Parent endpoint selector of the replacement edge |
76
+ | `child` | string | yes | Child endpoint selector of the replacement edge |
77
+ | `relation_type` | string | yes | relation_type of the replacement edge |
78
+ | `ordinal` | integer | no | Optional sibling-ordering within (parent, relation_type) for the new edge |
79
+ | `dryRun` | boolean | no | Preview without writing relations.json |
80
+ </tool>
81
+
82
+ <tool name="append-relations">
83
+ Append MANY closure-table relations to relations.json in a single write. Each edge is an object { parent, child, relation_type, ordinal? }. Per-(parent, child, relation_type) duplicates are skipped (against on-disk edges AND earlier edges in the same batch). Returns appended/skipped counts. Reference integrity is NOT checked here — run context-validate after. Creates relations.json if absent.
84
+
85
+ *Create many relations/edges between items in one write*
86
+
87
+ | Parameter | Type | Required | Description |
88
+ |-----------|------|----------|-------------|
89
+ | `edges` | unknown | yes | JSON array of { parent, child, relation_type, ordinal? } selector objects (parent/child are id/lens-bin selectors) |
90
+ | `dryRun` | boolean | no | Preview without writing relations.json |
91
+ </tool>
92
+
93
+ <tool name="upsert-block-item">
94
+ Append-or-replace an item in a project block array by id: if an item with the same idField value exists it is REPLACED (full-shape replacement, not shallow-merge — use update-block-item for merge); otherwise the item is appended. Schema validation is automatic. idField defaults to 'id'.
95
+
96
+ *Append-or-replace a full block item by id (replacement, not merge)*
97
+
98
+ | Parameter | Type | Required | Description |
99
+ |-----------|------|----------|-------------|
100
+ | `block` | string | yes | Block name (e.g., 'issues', 'decisions') |
101
+ | `arrayKey` | string | yes | Array key in the block (e.g., 'issues', 'decisions') |
102
+ | `item` | unknown | yes | Full item object to upsert — must conform to block schema |
103
+ | `idField` | string | no | Field used as the upsert key (default 'id') |
104
+ | `dryRun` | boolean | no | Preview the upsert without writing |
49
105
  </tool>
50
106
 
51
107
  <tool name="promote-item">
@@ -319,7 +375,6 @@ Move a non-active substrate dir to archive/<dir>/. Refuses to archive the active
319
375
  | Parameter | Type | Required | Description |
320
376
  |-----------|------|----------|-------------|
321
377
  | `target_dir` | string | yes | Substrate dir name to archive (e.g. '.project'). Refused if it is the active substrate. |
322
- | `writer` | object | no | DispatchContext.writer — stamped by auth-gate on operator confirm. |
323
378
  </tool>
324
379
 
325
380
  <tool name="filter-block-items">