@davidorex/pi-context 0.28.1 → 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">
@@ -201,9 +257,9 @@ Derive 'where are we + what's next' purely from the substrate — focus, in-flig
201
257
  </tool>
202
258
 
203
259
  <tool name="context-bootstrap-state">
204
- Derive the substrate bootstrap state for the cwd, purely from the filesystem: 'no-pointer' | 'no-config' | 'not-installed' | 'ready', plus the resolved contextDir and any declared-but-unmaterialized installed assets. Unlike every other tool, this NEVER throws on an un-bootstrapped substrate — it returns 'no-pointer' so you can detect a fresh substrate and tell the user to run /context init <substrate-dir> → /context accept-all → /context install (bootstrap requires user authorization via interactive confirmation). No writes.
260
+ Derive the substrate bootstrap state for the cwd, purely from the filesystem: 'no-pointer' | 'no-config' | 'skeleton' | 'not-installed' | 'ready', plus the resolved contextDir and any declared-but-unmaterialized installed assets. Bootstrap (/context init or /context switch -c <new-dir>) now writes a minimal schema-valid config empty of vocabulary, so a freshly-bootstrapped substrate lands at 'skeleton' — onward via /context accept-all (adopt the packaged catalog, then /context install) OR amend-config / edit (build a custom vocabulary). Unlike every other tool, this NEVER throws on an un-bootstrapped substrate — it returns 'no-pointer' so you can detect a fresh substrate and tell the user to run /context init <substrate-dir> → /context accept-all → /context install (bootstrap requires user authorization via interactive confirmation). No writes.
205
261
 
206
- *Derive substrate bootstrap state — no-pointer | no-config | not-installed | ready (never throws pre-bootstrap)*
262
+ *Derive substrate bootstrap state — no-pointer | no-config | skeleton | not-installed | ready (never throws pre-bootstrap)*
207
263
 
208
264
  </tool>
209
265
 
@@ -275,9 +331,9 @@ Declare a schema version-bump migration into substrate (migrations.json). operat
275
331
  </tool>
276
332
 
277
333
  <tool name="context-init">
278
- Initialize the substrate dir (bootstrap pointer + dirs only; run accept-all + install to populate).
334
+ Initialize the substrate dir: bootstrap pointer + dirs + a minimal schema-valid SKELETON config empty of vocabulary. Lands at the 'skeleton' bootstrap state — onward via accept-all (adopt the packaged catalog, then install) OR amend-config / edit (build a custom vocabulary).
279
335
 
280
- *Initialize the substrate dir (bootstrap pointer + dirs only; run accept-all + install to populate)*
336
+ *Initialize the substrate dir (bootstrap pointer + dirs + skeleton config; onward via accept-all OR amend-config/edit)*
281
337
 
282
338
  | Parameter | Type | Required | Description |
283
339
  |-----------|------|----------|-------------|
@@ -285,7 +341,7 @@ Initialize the substrate dir (bootstrap pointer + dirs only; run accept-all + in
285
341
  </tool>
286
342
 
287
343
  <tool name="context-accept-all">
288
- Adopt the canonical packaged conception (samples/conception.json) as this substrate's config.json (accept-all). Writes config only — run install after. Idempotent: never overwrites an existing config.
344
+ Adopt the canonical packaged conception (samples/conception.json) as this substrate's config.json (accept-all). Writes config only — run install after. Skeleton-aware: overwrites a SKELETON config (the empty-of-vocabulary config init / switch -c writes) but never a POPULATED one.
289
345
 
290
346
  *Adopt the canonical conception as config (accept-all)*
291
347
 
@@ -299,7 +355,7 @@ Flip the bootstrap pointer to a different substrate dir (parallel to git switch)
299
355
  | Parameter | Type | Required | Description |
300
356
  |-----------|------|----------|-------------|
301
357
  | `target_dir` | string | yes | Substrate dir name to switch to (e.g. '.context'). Required for default + create_new modes; ignored for to_previous mode. |
302
- | `create_new` | boolean | no | When true, bootstrap target_dir as a fresh substrate AND flip the pointer in one operation (parallel to 'git switch -c <branch>'). Default false (flip to existing substrate; fails if target_dir lacks config.json). |
358
+ | `create_new` | boolean | no | When true, bootstrap target_dir as a fresh substrate (dirs + a minimal schema-valid SKELETON config empty of vocabulary — onward via accept-all OR amend/edit) AND flip the pointer in one operation (parallel to 'git switch -c <branch>'). Default false (flip to existing substrate; fails if target_dir lacks config.json). |
303
359
  | `to_previous` | boolean | no | When true, flip the pointer back to its previous_contextDir (parallel to 'git switch -'). Requires the pointer to carry a previous_contextDir (a prior switch must have populated it). When true, target_dir is ignored. |
304
360
  | `writer` | object | no | DispatchContext.writer — stamped by auth-gate on operator confirm; in-body trusts the stamped value. |
305
361
  </tool>
@@ -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">