@davidorex/pi-context 0.30.0 → 0.31.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.
- package/CHANGELOG.md +69 -0
- package/README.md +21 -6
- package/dist/block-api.d.ts +13 -0
- package/dist/block-api.d.ts.map +1 -1
- package/dist/block-api.js +1 -1
- package/dist/block-api.js.map +1 -1
- package/dist/content-hash.d.ts +13 -0
- package/dist/content-hash.d.ts.map +1 -1
- package/dist/content-hash.js +16 -0
- package/dist/content-hash.js.map +1 -1
- package/dist/context-dir.d.ts +12 -0
- package/dist/context-dir.d.ts.map +1 -1
- package/dist/context-dir.js +14 -0
- package/dist/context-dir.js.map +1 -1
- package/dist/context.d.ts +60 -0
- package/dist/context.d.ts.map +1 -1
- package/dist/context.js +44 -0
- package/dist/context.js.map +1 -1
- package/dist/index.d.ts +534 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1879 -20
- package/dist/index.js.map +1 -1
- package/dist/migration-registry-loader.d.ts +16 -0
- package/dist/migration-registry-loader.d.ts.map +1 -1
- package/dist/migration-registry-loader.js +33 -0
- package/dist/migration-registry-loader.js.map +1 -1
- package/dist/ops-registry.d.ts +16 -0
- package/dist/ops-registry.d.ts.map +1 -1
- package/dist/ops-registry.js +270 -8
- package/dist/ops-registry.js.map +1 -1
- package/dist/pending-blocked-store.d.ts +83 -0
- package/dist/pending-blocked-store.d.ts.map +1 -0
- package/dist/pending-blocked-store.js +93 -0
- package/dist/pending-blocked-store.js.map +1 -0
- package/dist/schema-merge.d.ts +26 -0
- package/dist/schema-merge.d.ts.map +1 -0
- package/dist/schema-merge.js +176 -0
- package/dist/schema-merge.js.map +1 -0
- package/package.json +2 -1
- package/samples/conception.json +50 -0
- package/samples/schemas/framework-gaps.schema.json +1 -1
- package/samples/schemas/issues.schema.json +2 -2
- package/samples/schemas/layer-plans.schema.json +2 -2
- package/samples/schemas/research.schema.json +1 -1
- package/samples/schemas/work-orders.schema.json +2 -2
- package/schemas/config.schema.json +25 -1
- package/schemas/pending-blocked.schema.json +190 -0
- package/skill-narrative.md +7 -5
- package/skills/pi-context/SKILL.md +90 -7
- package/skills/pi-context/references/bundled-resources.md +2 -1
|
@@ -211,6 +211,13 @@ Get derived context state — source metrics, block summaries, planning lifecycl
|
|
|
211
211
|
|
|
212
212
|
</tool>
|
|
213
213
|
|
|
214
|
+
<tool name="context-check-status">
|
|
215
|
+
Read-only installed-vs-catalog schema drift report — per installed schema the drift state, the baseline and catalog versions, and for behind schemas (catalog-ahead / both-diverged) the version delta (baseline -> catalog) or the content-only basis when the version string is unchanged. The front of the check-status -> update --dryRun -> update sequence; writes nothing.
|
|
216
|
+
|
|
217
|
+
*Report installed-vs-catalog schema drift + the version gap for behind schemas (read-only)*
|
|
218
|
+
|
|
219
|
+
</tool>
|
|
220
|
+
|
|
214
221
|
<tool name="context-validate">
|
|
215
222
|
Validate cross-block referential integrity — check that IDs referenced across blocks exist.
|
|
216
223
|
|
|
@@ -249,6 +256,16 @@ Enumerate installable sample block kinds (packaged view): per kind — title, de
|
|
|
249
256
|
| `kind` | string | no | Filter to one block_kind canonical_id (e.g. 'tasks') |
|
|
250
257
|
</tool>
|
|
251
258
|
|
|
259
|
+
<tool name="read-catalog-schema">
|
|
260
|
+
Fetch and print the verbatim catalog schema body (raw JSON Schema: properties/definitions/$id) for a named block kind — diffable locally against the installed `<substrate>/schemas/<name>.schema.json` without touching node_modules. Read-only; the projection-returning sibling is read-samples-catalog.
|
|
261
|
+
|
|
262
|
+
*Fetch and print the verbatim catalog schema body for a named block kind (raw JSON Schema, diffable locally)*
|
|
263
|
+
|
|
264
|
+
| Parameter | Type | Required | Description |
|
|
265
|
+
|-----------|------|----------|-------------|
|
|
266
|
+
| `kind` | string | yes | Catalog block_kind canonical_id (e.g. 'tasks') |
|
|
267
|
+
</tool>
|
|
268
|
+
|
|
252
269
|
<tool name="context-current-state">
|
|
253
270
|
Derive 'where are we + what's next' purely from the substrate — focus, in-flight tasks, ranked atomic-next actions (open framework-gaps then unblocked planned tasks), and blocked tasks. No writes; nothing hand-stored.
|
|
254
271
|
|
|
@@ -314,6 +331,27 @@ Create or replace a substrate block-kind JSON Schema. operation 'create' require
|
|
|
314
331
|
| `dryRun` | boolean | no | Meta-validate without writing |
|
|
315
332
|
</tool>
|
|
316
333
|
|
|
334
|
+
<tool name="resolve-conflict">
|
|
335
|
+
Commit the reconciliation of a schema merge conflict surfaced by update. Run this AFTER reconciling a both-diverged conflict update reported: it writes the reconciled schema body (meta-validated, atomic, operation 'replace') AND advances the merge base for that schema to the packaged catalog body. Advancing the base is the step a bare write-schema lacks — without it, update's 3-way merge re-derives the SAME conflict on every subsequent run because the base never moves off the original pre-conflict body. With the base advanced to the catalog, the next update sees the schema as locally-modified (base === catalog ≠ your body) and the deterministic merge takes your reconciled body (base === theirs → ours) — auto-merging with zero conflicts and preserving your resolution. If schema is omitted, the current on-disk schema is treated as already reconciled and only the base is advanced. The calling agent runs this; no subordinate resolver is spawned.
|
|
336
|
+
|
|
337
|
+
*Commit a reconciled schema conflict: write the resolved body + advance the merge base to the catalog so update stops re-reporting it (run after reconciling an update conflict)*
|
|
338
|
+
|
|
339
|
+
| Parameter | Type | Required | Description |
|
|
340
|
+
|-----------|------|----------|-------------|
|
|
341
|
+
| `schemaName` | string | yes | Schema name without extension (e.g., 'tasks') |
|
|
342
|
+
| `schema` | unknown | no | The reconciled schema body R (whole JSON Schema object, draft-07; accepts a JSON string). If omitted, the current on-disk schema is treated as already reconciled and only the merge base is advanced. |
|
|
343
|
+
</tool>
|
|
344
|
+
|
|
345
|
+
<tool name="resolve-blocked">
|
|
346
|
+
Commit the resolution of a blocked schema surfaced by update. Run AFTER fixing the block's items (or widening the local schema): when the block file carries git-style failure markers (written by update), strips the full-line marker sentinels first, then re-validates the corrected block against the pinned target schema from the pending-blocked record; on pass registers the migration chain, writes the target schema, advances the merge base to the target (so a subsequent update converges instead of re-blocking), and clears the pending entry; on fail reports the remaining per-item failures and writes nothing.
|
|
347
|
+
|
|
348
|
+
*Commit a blocked schema's resolution: strip any git-style failure markers, re-validate the corrected block against the pinned target, then write the target schema + advance the base + clear the pending record (run after fixing the items update reported blocked)*
|
|
349
|
+
|
|
350
|
+
| Parameter | Type | Required | Description |
|
|
351
|
+
|-----------|------|----------|-------------|
|
|
352
|
+
| `schemaName` | string | yes | Schema name with a pending-blocked entry (from update's blocked report) |
|
|
353
|
+
</tool>
|
|
354
|
+
|
|
317
355
|
<tool name="write-schema-migration">
|
|
318
356
|
Declare a schema version-bump migration into substrate (migrations.json). operation 'create' appends a new declaration; 'replace' overwrites an existing declaration matched by (schemaName, fromVersion); 'remove' drops a declaration. kind='identity' asserts the bump is shape-compatible (no data transform); kind='declarative-transform' carries a TransformSpec of rename/set/delete/coerce operations on dotted JSON paths. The loaded MigrationRegistry resolves the recorded edge at next read/write so block items declaring an older schema_version walk forward without process restart. Requires user authorization via interactive confirmation at the pi-dispatch auth-gate; on confirm, the verified terminal-operator identity is stamped as writer.
|
|
319
357
|
|
|
@@ -347,6 +385,36 @@ Adopt the canonical packaged conception (samples/conception.json) as this substr
|
|
|
347
385
|
|
|
348
386
|
</tool>
|
|
349
387
|
|
|
388
|
+
<tool name="context-install">
|
|
389
|
+
Install (materialize) the schemas and starter blocks declared in config.json's installed_schemas / installed_blocks from the package samples catalog. Default skip-if-exists (installed files never overwritten without --update); populated block data is always preserved (even with --update); empty or absent blocks get the catalog starter. Records the install baseline (config.installed_from: catalog source + per-schema fingerprint) for installed-vs-catalog drift detection (schemas only). A re-install on an unchanged substrate is idempotent.
|
|
390
|
+
|
|
391
|
+
*Install declared schemas + starter blocks from the samples catalog (skip-if-exists; --update re-syncs schemas + replaces empty blocks; records the config.installed_from baseline)*
|
|
392
|
+
|
|
393
|
+
| Parameter | Type | Required | Description |
|
|
394
|
+
|-----------|------|----------|-------------|
|
|
395
|
+
| `update` | boolean | no | When true, re-sync existing installed schemas (migration-aware) and replace empty blocks with the catalog starter; populated block data is never overwritten. When false (default), skip existing files. |
|
|
396
|
+
</tool>
|
|
397
|
+
|
|
398
|
+
<tool name="update">
|
|
399
|
+
Bring the installed substrate model (schemas) current with the packaged catalog. Per installed schema, consults the read-only drift check and routes by state: an already-current (in-sync) schema is a no-op; a schema the package shipped a newer version of (catalog-ahead) is re-synced through the migration-aware path; a schema edited locally (locally-modified / both-diverged) is reconciled by a deterministic 3-way merge of base (the as-installed body in the object store, keyed by the recorded baseline content_hash) × ours (the installed schema) × theirs (the catalog schema) — disjoint edits auto-merge so both the user's and the catalog's changes survive (required / enum / array-valued type nodes merge as sets), and a schema with irreconcilable per-path conflicts is left unmodified — the conflict set is returned in the op output (under conflicts) alongside a readable report, and the calling agent reconciles it then commits via resolve-conflict — which writes the reconciled body AND advances the merge base to the catalog so update stops re-reporting it (no subordinate resolver is spawned); undecidable / absent schemas (no-baseline / missing-catalog / missing-installed) are reported, not touched. Update also additively propagates catalog-new config-registry entries (relation_types / invariants / block_kinds / lenses) that are absent from the substrate config, preserving every user-authored entry and any locally-diverged body of an existing entry (additive-only — present entries are never overwritten). Update reports, under migrationsRegistered, the migration declarations a version-bump resync registers into migrations.json (each as schema / from / to). A blocked (refused) catalog-ahead schema additionally carries its diagnostic detail under blockedDetail (one entry per blocked schema): the refusal reason — no-migration-chain (no shipped chain reaches the catalog version) vs validation-failed (the forward-migrated items fail the catalog schema) — the installed -> catalog version pair, and for a validation failure the per-item failures naming the failing item id, field, and constraint. A live blocked resync also persists a pending-blocked record (pinning the target catalog schema + the chain reaching it) consumable by resolve-blocked, which commits the resolution once the block's items are fixed. Pass dryRun to preview the per-schema action plan; dryRun predicts the precise per-schema catalog-ahead outcome (resync / migrate / block / merge / conflict) by running the forward-migration + re-validation in memory, the per-blocked-schema diagnostic detail, the config-registry entries that would be added, AND the migration declarations that would be registered, writing nothing. When a catalog-ahead resync is blocked because the block's items fail the catalog schema (validation-failed), update inscribes git-style failure markers INTO the block file at the offending items (full-line `<<<<<<< BLOCKED …` / `>>>>>>> target: …` sentinels), pinning the pre-marker bytes so resolve-blocked can strip the markers and re-validate; the schema and migrations.json stay byte-unchanged. A dryRun preview writes no markers.
|
|
400
|
+
|
|
401
|
+
*Update the installed schema model from the catalog (3-way merges locally-modified schemas, preserving non-conflicting edits; conflicts → returned in the op output + a report for the calling agent to reconcile and commit via resolve-conflict; a blocked resync carries blockedDetail — reason, version pair, per-item failures — and persists a pending-blocked record (target catalog schema + the chain reaching it) resolved via resolve-blocked once the block's items are fixed; a validation-failed block is marked in place with git-style failure markers (recoverable; stripped + re-validated by resolve-blocked); --dry-run predicts the precise per-schema outcome — resync / migrate / block / merge / conflict — via in-memory forward-migration + re-validation, writing nothing)*
|
|
402
|
+
|
|
403
|
+
| Parameter | Type | Required | Description |
|
|
404
|
+
|-----------|------|----------|-------------|
|
|
405
|
+
| `dryRun` | boolean | no | Preview the per-schema action plan without writing anything. |
|
|
406
|
+
</tool>
|
|
407
|
+
|
|
408
|
+
<tool name="validate-block-items">
|
|
409
|
+
Validate a block's items against the catalog schema version — returns the per-item failures (item id, field, constraint) without writing. Resolves the block's catalog block_kind, loads the installed block, forward-migrates its items in memory through the shipped chain when the block lags the catalog version (a fresh registry; never warms the project's cache), and validates against the catalog schema body. Returns block / from (the block's declared version) / to (the catalog version) / valid / failures[] (each: itemId — the failing item's id when the instancePath resolves to one — instancePath, keyword, message). Read-only: never overwrites the schema, the block, or migrations.json. An unknown block or a missing installed block file throws.
|
|
410
|
+
|
|
411
|
+
*Validate a block's items against the catalog schema version — returns the per-item failures (item id, field, constraint) without writing*
|
|
412
|
+
|
|
413
|
+
| Parameter | Type | Required | Description |
|
|
414
|
+
|-----------|------|----------|-------------|
|
|
415
|
+
| `block` | string | yes | Block name (e.g. 'tasks') |
|
|
416
|
+
</tool>
|
|
417
|
+
|
|
350
418
|
<tool name="context-switch">
|
|
351
419
|
Flip the bootstrap pointer to a different substrate dir (parallel to git switch). Default: flip to an existing substrate at target_dir (requires config.json present). create_new=true: bootstrap a fresh substrate at target_dir AND flip in one operation. to_previous=true: flip back to the pointer's previous_contextDir (target_dir ignored).
|
|
352
420
|
|
|
@@ -479,6 +547,19 @@ Materialize the Edge[] for a named lens — synthetic edges from derived_from_fi
|
|
|
479
547
|
| `lensId` | string | yes | Lens id from config.lenses[].id |
|
|
480
548
|
</tool>
|
|
481
549
|
|
|
550
|
+
<tool name="context-lens-view">
|
|
551
|
+
Project a config-declared lens (config.lenses[]) as a binned item-view. Without --bin, a bin->count summary (always under the read cap). With --bin, that bin's items paged by --offset/--limit. Serves target, composition, and hand-curated lenses.
|
|
552
|
+
|
|
553
|
+
*Project a config-declared lens as a binned item-view — bin->count summary, or one bin's items paged*
|
|
554
|
+
|
|
555
|
+
| Parameter | Type | Required | Description |
|
|
556
|
+
|-----------|------|----------|-------------|
|
|
557
|
+
| `lensId` | string | yes | Lens id from config.lenses[].id |
|
|
558
|
+
| `bin` | string | no | Return this bin's items paged; omit for a bin->count summary |
|
|
559
|
+
| `offset` | integer | no | Per-bin page start index (default 0) |
|
|
560
|
+
| `limit` | integer | no | Per-bin page size (default 50) |
|
|
561
|
+
</tool>
|
|
562
|
+
|
|
482
563
|
<tool name="context-walk-descendants">
|
|
483
564
|
Walk closure-table descendants of a parent id under a given relation_type. Returns string[] of descendant ids (may be empty if no children or relations.json absent).
|
|
484
565
|
|
|
@@ -567,7 +648,7 @@ List every roadmap in <config.root>/roadmap.json with id, title, optional status
|
|
|
567
648
|
<command name="/context">
|
|
568
649
|
Context state management
|
|
569
650
|
|
|
570
|
-
Subcommands: `init`, `switch`, `list`, `archive`, `install`, `accept-all`, `view`, `lens-curate`, `roadmap-list`, `roadmap-view`, `roadmap-validate`, `status`, `add-work`, `validate`, `help`
|
|
651
|
+
Subcommands: `init`, `switch`, `list`, `archive`, `install`, `check-status`, `accept-all`, `view`, `lens-curate`, `roadmap-list`, `roadmap-view`, `roadmap-validate`, `status`, `add-work`, `validate`, `help`
|
|
571
652
|
</command>
|
|
572
653
|
|
|
573
654
|
</commands_reference>
|
|
@@ -577,7 +658,7 @@ Subcommands: `init`, `switch`, `list`, `archive`, `install`, `accept-all`, `view
|
|
|
577
658
|
</events>
|
|
578
659
|
|
|
579
660
|
<bundled_resources>
|
|
580
|
-
|
|
661
|
+
12 schemas, 34 samples bundled.
|
|
581
662
|
See references/bundled-resources.md for full inventory.
|
|
582
663
|
</bundled_resources>
|
|
583
664
|
|
|
@@ -715,13 +796,15 @@ Every block write validates against `<root>/schemas/<blockname>.schema.json`. If
|
|
|
715
796
|
</context_accept_all>
|
|
716
797
|
|
|
717
798
|
<context_install>
|
|
718
|
-
`/context install` reconciles the substrate against the `installed_schemas` and `installed_blocks` lists declared in `config.json`. For each declared name it copies the matching asset from the package-shipped samples catalog (`samples/schemas/` for schemas, `samples/blocks/` for starter blocks) into the substrate. Default behavior is skip-if-exists (preserves user edits)
|
|
799
|
+
`/context install` (reflected CLI op: `pi-context context-install [--update]`, `authGated`) reconciles the substrate against the `installed_schemas` and `installed_blocks` lists declared in `config.json`. The slash command and the CLI op run the same install engine — the op's `--update` maps to the same migration-aware overwrite the slash command's `--update` does. For each declared name it copies the matching asset from the package-shipped samples catalog (`samples/schemas/` for schemas, `samples/blocks/` for starter blocks) into the substrate. Default behavior is skip-if-exists (preserves user edits). Pass `--update` to re-sync installed SCHEMAS through the migration registry: a same-version body change (or a non-versioned schema) is a verbatim re-sync (reported `resynced`); a schema `version` bump forward-migrates the populated block's items through the shipped catalog migration chain and re-validates them against the new schema (reported `migrated`); a bump with no safe migration — no shipped chain reaching the catalog version, or items that would fail the new schema — is refused, leaving BOTH the installed schema file AND the block file byte-unchanged (reported `blocked`). Preview drift first with `/context check-status`. Populated block data is never overwritten — a block holding items is preserved (reported as `preserved`) regardless of `--update`, while empty or absent blocks receive the catalog starter. Sources missing from the catalog are reported as `notFound`. Empty install lists are not an error — the result is a clean no-op message instructing the user to edit `config.json`. Install also records an install baseline in `config.installed_from`: the catalog source (`catalog` = pi-context `name@version`, `catalog_version` = conception `schema_version`), a baseline timestamp, and a per-schema fingerprint (`assets[canonical_id]` = content hash + the schema's own version) of the installed SCHEMAS — the basis for installed-vs-catalog drift detection. The baseline covers schemas only (blocks are user data). A re-install on an unchanged substrate is idempotent: the existing baseline is preserved verbatim (timestamp included) so `config.json` stays byte-identical. `/context check-status` is a separate read-only command that previews drift between the installed schemas and the catalog: it compares each installed schema against its recorded baseline, the catalog's current schema, and the currently-installed file, and reports `in-sync` / `catalog-ahead` (the package shipped a newer schema) / `locally-modified` (the installed file was edited) / `both-diverged` / `no-baseline` / `missing-catalog` / `missing-installed`. For each schema behind the catalog (`catalog-ahead` / `both-diverged`) it additionally surfaces which schema is behind and by what version gap — `behind` plus a `version_delta` carrying the baseline → catalog version pair (a declared version bump) or a content-only basis when the catalog body moved with the version string unchanged. It writes nothing. The reflected CLI op is `pi-context context-check-status --json`.
|
|
719
800
|
|
|
720
|
-
The installable catalog IS the packaged conception (`samples/conception.json`): its `block_kinds` enumerate the available kinds, each carrying its schema (`samples/schemas/`) and starter block (`samples/blocks/`). The generated installable-catalog table below lists the authoritative names — declare any subset in `installed_*` and run `/context install`, or take the whole conception via `/context accept-all`.
|
|
801
|
+
The installable catalog IS the packaged conception (`samples/conception.json`): its `block_kinds` enumerate the available kinds, each carrying its schema (`samples/schemas/`) and starter block (`samples/blocks/`). The generated installable-catalog table below lists the authoritative names — declare any subset in `installed_*` and run `/context install`, or take the whole conception via `/context accept-all`. To inspect a catalog schema body itself, `pi-context read-catalog-schema --kind <canonical_id>` fetches and prints the verbatim bundled `*.schema.json` (the raw JSON Schema — `properties` / `definitions` / `$id`, distinct from the `read-samples-catalog` summary projection), so after `/context check-status` flags a schema behind the catalog you can diff that body locally against the installed `<substrate>/schemas/<name>.schema.json` without hunting through `node_modules`. It is read-only and package-intrinsic (reads the bundled catalog, mutates nothing).
|
|
721
802
|
</context_install>
|
|
722
803
|
|
|
723
804
|
<substrate_config>
|
|
724
|
-
`<substrate-dir>/config.json` is the substrate bootstrap. Its `root` field declares where every other block, schema, agent, and template lives — consumers resolve that dir via the `.pi-context.json` pointer plus `config.root`, never by assuming a fixed directory name. Its `substrate_id` field is the per-substrate root identity (pattern `sub-` followed by 16 hex), minted once and immutable on disk; it salts oid minting and identifies the substrate in the project-root registry. `naming` aliases canonical block ids to display names (used by `/context view` rendering). `hierarchy` declares legal closure-table edges (parent block → child block via relation_type). `lenses` declares named projections over a target block. `installed_schemas` / `installed_blocks` are the install manifest consumed by `/context install`.
|
|
805
|
+
`<substrate-dir>/config.json` is the substrate bootstrap. Its `root` field declares where every other block, schema, agent, and template lives — consumers resolve that dir via the `.pi-context.json` pointer plus `config.root`, never by assuming a fixed directory name. Its `substrate_id` field is the per-substrate root identity (pattern `sub-` followed by 16 hex), minted once and immutable on disk; it salts oid minting and identifies the substrate in the project-root registry. `naming` aliases canonical block ids to display names (used by `/context view` rendering). `hierarchy` declares legal closure-table edges (parent block → child block via relation_type). `lenses` declares named projections over a target block. `installed_schemas` / `installed_blocks` are the install manifest consumed by `/context install`. `installed_from` is the optional install baseline `/context install` records — the catalog source plus a per-schema content fingerprint of the installed schemas — for installed-vs-catalog drift detection.
|
|
806
|
+
|
|
807
|
+
A fresh substrate adopted via `/context accept-all` carries advisory (severity-`warning`) convention-articulation invariants: every decision, feature, and task should carry an `item_governed_by_convention` edge to a convention it follows, or an `item_acknowledges_missing_convention` edge to a missing-convention gap. `context-validate` reports an artifact that articulates neither as a warning (it does not error), so the advice surfaces without blocking writes; satisfy it by adding one of those two edges (`append-relation`) when filing or amending the artifact.
|
|
725
808
|
|
|
726
809
|
`config.json` and `relations.json` are exempt from `config.root` redirection — they always live at the substrate-dir root (the dir chosen at bootstrap, resolved via the `.pi-context.json` pointer, suggested `.context`) because they are the substrate that defines `root`. The substrate-dir root is whatever was chosen at bootstrap, not necessarily `.project`. All other state lives under `<config.root>/...` per `resolveContextDir(cwd)`. The package ships their schemas in `schemas/` (config.schema.json, relations.schema.json) and resolves them via three-tier search: project override > user override > package-shipped.
|
|
727
810
|
|
|
@@ -765,7 +848,7 @@ The lens-view algorithm: `edgesForLens(lens, items, authoredEdges)` returns synt
|
|
|
765
848
|
|
|
766
849
|
`validateContext(cwd)` (the `context-validate` tool) layers the registry/identity invariants over cross-block referential integrity: `substrate_id_unregistered` and `substrate_id_registry_mismatch` (the source-of-truth-drift guard on the active substrate), `edge_endpoint_dangling` and `edge_endpoint_unregistered` (a structured endpoint naming a registered-but-absent or unregistered substrate), and `nested_id_bearing_array` (a schema embedding an id-bearing array instead of using a membership edge). Config-declared `invariants[]` and registered lens-validators are checked in the same pass.
|
|
767
850
|
|
|
768
|
-
|
|
851
|
+
Three derived substrate tools complement validation: `context-edges-for-lens` returns the materialized `Edge[]` for a named lens (synthetic from `derived_from_field` or filtered authored edges); `context-lens-view` projects a config-declared lens as a binned item-view — a bin→count summary, or one bin's items paged by `offset`/`limit`; `context-walk-descendants` returns the transitive descendant id list from a parent under a given relation_type.
|
|
769
852
|
</substrate_validation>
|
|
770
853
|
|
|
771
854
|
<block_item_reads>
|
|
@@ -819,7 +902,7 @@ On `session_start`, checks npm registry for newer versions of `@davidorex/pi-pro
|
|
|
819
902
|
|
|
820
903
|
<success_criteria>
|
|
821
904
|
- `<substrate-dir>/`, `<substrate-dir>/schemas/`, and the `.pi-context.json` bootstrap pointer exist after `/context init <substrate-dir>` (init is skeleton-only: no `config.json`, no schemas, no blocks until accept-all + install). Phases are not a directory — they live as an in-block array under `phase.json` (plural `phases` key); there is no `phases/` dir.
|
|
822
|
-
- `installed_schemas` / `installed_blocks` declared in `config.json` are reified by `/context install`; `--update`
|
|
905
|
+
- `installed_schemas` / `installed_blocks` declared in `config.json` are reified by `/context install`; `--update` re-syncs installed schemas through the migration registry (forward-migrate block items on a version bump, or refuse and leave unchanged when items can't be safely migrated), but populated block data is never overwritten (preserved) — only empty or absent blocks receive the catalog starter
|
|
823
906
|
- Block writes validate against schemas — invalid data rejected with specific error
|
|
824
907
|
- `/context status` returns current derived state without errors
|
|
825
908
|
- `/context validate` returns no errors for well-formed cross-block references
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
# Bundled Resources
|
|
2
2
|
|
|
3
|
-
## schemas/ (
|
|
3
|
+
## schemas/ (12 files)
|
|
4
4
|
|
|
5
5
|
- `schemas/bootstrap.schema.json`
|
|
6
6
|
- `schemas/config.schema.json`
|
|
7
7
|
- `schemas/context-registry.schema.json`
|
|
8
8
|
- `schemas/layer.schema.json`
|
|
9
9
|
- `schemas/migrations.schema.json`
|
|
10
|
+
- `schemas/pending-blocked.schema.json`
|
|
10
11
|
- `schemas/priority.schema.json`
|
|
11
12
|
- `schemas/relations.schema.json`
|
|
12
13
|
- `schemas/severity.schema.json`
|