@davidorex/pi-context 0.31.0 → 0.33.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 +73 -0
- package/README.md +16 -14
- package/dist/block-api.d.ts +20 -33
- package/dist/block-api.d.ts.map +1 -1
- package/dist/block-api.js +154 -3
- package/dist/block-api.js.map +1 -1
- package/dist/content-hash.d.ts +9 -0
- package/dist/content-hash.d.ts.map +1 -1
- package/dist/content-hash.js +11 -0
- package/dist/content-hash.js.map +1 -1
- package/dist/context-sdk.d.ts +157 -39
- package/dist/context-sdk.d.ts.map +1 -1
- package/dist/context-sdk.js +896 -251
- package/dist/context-sdk.js.map +1 -1
- package/dist/context.d.ts +158 -5
- package/dist/context.d.ts.map +1 -1
- package/dist/context.js +75 -5
- package/dist/context.js.map +1 -1
- package/dist/index.d.ts +151 -19
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +590 -97
- package/dist/index.js.map +1 -1
- package/dist/lens-view.d.ts +0 -5
- package/dist/lens-view.d.ts.map +1 -1
- package/dist/lens-view.js +43 -1
- package/dist/lens-view.js.map +1 -1
- package/dist/migration-registry-loader.d.ts +20 -12
- package/dist/migration-registry-loader.d.ts.map +1 -1
- package/dist/migration-registry-loader.js +46 -17
- package/dist/migration-registry-loader.js.map +1 -1
- package/dist/migrations-store.d.ts +45 -18
- package/dist/migrations-store.d.ts.map +1 -1
- package/dist/migrations-store.js +56 -22
- package/dist/migrations-store.js.map +1 -1
- package/dist/ops-registry.d.ts +18 -0
- package/dist/ops-registry.d.ts.map +1 -1
- package/dist/ops-registry.js +474 -130
- package/dist/ops-registry.js.map +1 -1
- package/dist/promote-item.d.ts.map +1 -1
- package/dist/promote-item.js +41 -12
- package/dist/promote-item.js.map +1 -1
- package/dist/roadmap-plan.d.ts +121 -99
- package/dist/roadmap-plan.d.ts.map +1 -1
- package/dist/roadmap-plan.js +281 -345
- package/dist/roadmap-plan.js.map +1 -1
- package/dist/status-vocab.d.ts +12 -2
- package/dist/status-vocab.d.ts.map +1 -1
- package/dist/status-vocab.js +14 -1
- package/dist/status-vocab.js.map +1 -1
- package/package.json +2 -2
- package/samples/blocks/milestone.json +3 -0
- package/samples/blocks/session-notes.json +1 -0
- package/samples/conception.json +315 -15
- package/samples/migrations.json +8 -0
- package/samples/schemas/context-contracts.schema.json +4 -0
- package/samples/schemas/conventions.schema.json +4 -0
- package/samples/schemas/decisions.schema.json +4 -0
- package/samples/schemas/features.schema.json +4 -0
- package/samples/schemas/framework-gaps.schema.json +9 -0
- package/samples/schemas/issues.schema.json +28 -0
- package/samples/schemas/layer-plans.schema.json +4 -0
- package/samples/schemas/milestone.schema.json +79 -0
- package/samples/schemas/phase.schema.json +4 -0
- package/samples/schemas/rationale.schema.json +4 -0
- package/samples/schemas/requirements.schema.json +4 -0
- package/samples/schemas/research.schema.json +45 -2
- package/samples/schemas/session-notes.schema.json +89 -0
- package/samples/schemas/spec-reviews.schema.json +4 -0
- package/samples/schemas/story.schema.json +8 -0
- package/samples/schemas/tasks.schema.json +4 -0
- package/samples/schemas/verification.schema.json +4 -0
- package/samples/schemas/work-orders.schema.json +4 -0
- package/schemas/config.schema.json +90 -4
- package/schemas/migrations.schema.json +25 -0
- package/skill-narrative.md +8 -6
- package/skills/pi-context/SKILL.md +70 -63
- package/skills/pi-context/references/bundled-resources.md +5 -1
|
@@ -32,7 +32,13 @@
|
|
|
32
32
|
* primitive constructors String(v) / Number(v) / Boolean(v); for
|
|
33
33
|
* 'array' coercion uses [].concat(v) so a non-array value becomes a
|
|
34
34
|
* single-element array (and an existing array passes through
|
|
35
|
-
* unchanged); for 'object' coercion uses Object(v).
|
|
35
|
+
* unchanged); for 'object' coercion uses Object(v). 'map_each'
|
|
36
|
+
* addresses an ARRAY at the path (absent path / non-array value
|
|
37
|
+
* no-op) and maps its elements: table mode replaces each string
|
|
38
|
+
* element via a lookup (unmatched strings become
|
|
39
|
+
* { relation_type: <element>, item_endpoint: fallback ?? 'parent' };
|
|
40
|
+
* non-string elements pass through); set-on-each mode assigns
|
|
41
|
+
* field=value on every object element (non-objects skipped).
|
|
36
42
|
*
|
|
37
43
|
* Identity migrations are the pass-through case the operator declares when
|
|
38
44
|
* the bumped schema is shape-compatible with the prior version; the closure
|
|
@@ -103,8 +109,8 @@ export declare function getProjectMigrationRegistry(cwd: string): MigrationRegis
|
|
|
103
109
|
*
|
|
104
110
|
* The cwd form (`getProjectMigrationRegistry`) resolves `cwd → substrateDir`
|
|
105
111
|
* and delegates here, so when `substrateDir === resolveContextDir(cwd)` both
|
|
106
|
-
* forms hit the SAME entry. The migrations-store
|
|
107
|
-
*
|
|
112
|
+
* forms hit the SAME entry. The migrations-store write funnel
|
|
113
|
+
* (`writeMigrationsFileForDir`) invalidates on the same resolved-dir key and
|
|
108
114
|
* deletes the entry this builder populates — so a declare-then-read sequence
|
|
109
115
|
* (mutate migrations.json, then `writeBlockForDir` re-reads) rebuilds against
|
|
110
116
|
* the fresh declarations rather than serving a stale registry.
|
|
@@ -113,25 +119,27 @@ export declare function getProjectMigrationRegistryForDir(substrateDir: string):
|
|
|
113
119
|
/**
|
|
114
120
|
* Drop the cached MigrationRegistry for an explicit substrate directory (if
|
|
115
121
|
* any). Deletes `path.resolve(substrateDir)` — the SAME key the read forms
|
|
116
|
-
* populate, so an invalidation here is observed by the next read.
|
|
122
|
+
* populate, so an invalidation here is observed by the next read. Called by
|
|
123
|
+
* the migrations-store write funnel `writeMigrationsFileForDir` after each
|
|
124
|
+
* successful migrations.json write (the single invalidation site for the
|
|
125
|
+
* whole mutation surface).
|
|
117
126
|
*
|
|
118
127
|
* No-op when no entry is cached — invalidation is cheap and write-after-no-
|
|
119
128
|
* cache is a normal pre-warming state.
|
|
120
129
|
*/
|
|
121
130
|
export declare function invalidateMigrationRegistryForDir(substrateDir: string): void;
|
|
122
131
|
/**
|
|
123
|
-
* Drop the cached MigrationRegistry for `cwd` (if any)
|
|
124
|
-
*
|
|
125
|
-
*
|
|
132
|
+
* Drop the cached MigrationRegistry for `cwd` (if any) — the cwd convenience
|
|
133
|
+
* form for callers holding a project root rather than a resolved substrate
|
|
134
|
+
* dir. The canonical invalidation site is the migrations-store write funnel
|
|
135
|
+
* `writeMigrationsFileForDir`, which calls the ForDir form directly.
|
|
126
136
|
*
|
|
127
137
|
* Resolves `cwd → substrateDir` and delegates to the ForDir form so the
|
|
128
138
|
* deleted key MATCHES the resolved-substrate-dir key the read path uses (the
|
|
129
139
|
* Regression-B fix: pre-fix this deleted `path.resolve(cwd)`, a different key
|
|
130
|
-
* from the dir-keyed read entry, leaving the post-declaration read stale).
|
|
131
|
-
*
|
|
132
|
-
*
|
|
133
|
-
* safe; `tryResolveContextDir` guards the absent-pointer edge with a no-op
|
|
134
|
-
* rather than throwing during invalidation.
|
|
140
|
+
* from the dir-keyed read entry, leaving the post-declaration read stale).
|
|
141
|
+
* `tryResolveContextDir` guards the absent-pointer edge with a no-op rather
|
|
142
|
+
* than throwing during invalidation.
|
|
135
143
|
*/
|
|
136
144
|
export declare function invalidateMigrationRegistry(cwd: string): void;
|
|
137
145
|
//# sourceMappingURL=migration-registry-loader.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"migration-registry-loader.d.ts","sourceRoot":"","sources":["../src/migration-registry-loader.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"migration-registry-loader.d.ts","sourceRoot":"","sources":["../src/migration-registry-loader.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8CG;AAIH,OAAO,EAA4B,KAAK,aAAa,EAAoB,MAAM,uBAAuB,CAAC;AACvG,OAAO,KAAK,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AA6J7E;;;;;;;;;;;GAWG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,aAAa,GAAG,WAAW,CAsB/D;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,gCAAgC,CAAC,YAAY,EAAE,MAAM,GAAG,iBAAiB,CAcxF;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,2BAA2B,CAAC,YAAY,EAAE,MAAM,EAAE,KAAK,EAAE,aAAa,EAAE,GAAG,iBAAiB,CAgB3G;AAED,wBAAgB,0BAA0B,CAAC,GAAG,EAAE,MAAM,GAAG,iBAAiB,CAEzE;AAED;;;;;;;GAOG;AACH,wBAAgB,2BAA2B,CAAC,GAAG,EAAE,MAAM,GAAG,iBAAiB,CAE1E;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,iCAAiC,CAAC,YAAY,EAAE,MAAM,GAAG,iBAAiB,CAOzF;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,iCAAiC,CAAC,YAAY,EAAE,MAAM,GAAG,IAAI,CAE5E;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,2BAA2B,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAI7D"}
|
|
@@ -32,7 +32,13 @@
|
|
|
32
32
|
* primitive constructors String(v) / Number(v) / Boolean(v); for
|
|
33
33
|
* 'array' coercion uses [].concat(v) so a non-array value becomes a
|
|
34
34
|
* single-element array (and an existing array passes through
|
|
35
|
-
* unchanged); for 'object' coercion uses Object(v).
|
|
35
|
+
* unchanged); for 'object' coercion uses Object(v). 'map_each'
|
|
36
|
+
* addresses an ARRAY at the path (absent path / non-array value
|
|
37
|
+
* no-op) and maps its elements: table mode replaces each string
|
|
38
|
+
* element via a lookup (unmatched strings become
|
|
39
|
+
* { relation_type: <element>, item_endpoint: fallback ?? 'parent' };
|
|
40
|
+
* non-string elements pass through); set-on-each mode assigns
|
|
41
|
+
* field=value on every object element (non-objects skipped).
|
|
36
42
|
*
|
|
37
43
|
* Identity migrations are the pass-through case the operator declares when
|
|
38
44
|
* the bumped schema is shape-compatible with the prior version; the closure
|
|
@@ -48,14 +54,15 @@ import { createRegistry } from "./schema-migrations.js";
|
|
|
48
54
|
* RESOLVED SUBSTRATE DIR (`path.resolve(substrateDir)`) — not by cwd. The cwd
|
|
49
55
|
* and dir forms converge on this single key: the cwd forms first resolve
|
|
50
56
|
* `cwd → substrateDir` via the bootstrap pointer, then read/invalidate the
|
|
51
|
-
* dir-keyed entry.
|
|
52
|
-
* `
|
|
53
|
-
*
|
|
54
|
-
* without restarting the
|
|
57
|
+
* dir-keyed entry. Invalidation fires inside the migrations-store write
|
|
58
|
+
* funnel `writeMigrationsFileForDir` (which every migrations.json write —
|
|
59
|
+
* both forms, all mutation helpers — flows through), so every write leaves
|
|
60
|
+
* the next consumer reading the new declarations without restarting the
|
|
61
|
+
* process.
|
|
55
62
|
*
|
|
56
63
|
* Keying on the resolved dir (rather than cwd) is load-bearing for coherence:
|
|
57
64
|
* the block writers read the registry via `getProjectMigrationRegistryForDir`
|
|
58
|
-
* (dir-keyed);
|
|
65
|
+
* (dir-keyed); the write funnel invalidates on the same resolved dir. If the
|
|
59
66
|
* read key (resolved dir) and the invalidate key (raw cwd) diverged — which
|
|
60
67
|
* they do whenever cwd ≠ substrateDir, e.g. `<root>` vs `<root>/.project` —
|
|
61
68
|
* the post-declaration read would serve a stale pre-declaration registry. The
|
|
@@ -173,6 +180,26 @@ function applyOp(data, op) {
|
|
|
173
180
|
read.parent[read.key] = next;
|
|
174
181
|
return data;
|
|
175
182
|
}
|
|
183
|
+
case "map_each": {
|
|
184
|
+
const read = walkPath(data, op.path, false);
|
|
185
|
+
if (read.parent === null || !(read.key in read.parent))
|
|
186
|
+
return data;
|
|
187
|
+
const arr = read.parent[read.key];
|
|
188
|
+
if (!Array.isArray(arr))
|
|
189
|
+
return data;
|
|
190
|
+
if (op.table) {
|
|
191
|
+
read.parent[read.key] = arr.map((el) => typeof el === "string"
|
|
192
|
+
? (op.table[el] ?? { relation_type: el, item_endpoint: op.fallback ?? "parent" })
|
|
193
|
+
: el);
|
|
194
|
+
}
|
|
195
|
+
else if (op.field !== undefined) {
|
|
196
|
+
for (const el of arr) {
|
|
197
|
+
if (el && typeof el === "object")
|
|
198
|
+
el[op.field] = op.value;
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
return data;
|
|
202
|
+
}
|
|
176
203
|
}
|
|
177
204
|
}
|
|
178
205
|
/**
|
|
@@ -293,8 +320,8 @@ export function getProjectMigrationRegistry(cwd) {
|
|
|
293
320
|
*
|
|
294
321
|
* The cwd form (`getProjectMigrationRegistry`) resolves `cwd → substrateDir`
|
|
295
322
|
* and delegates here, so when `substrateDir === resolveContextDir(cwd)` both
|
|
296
|
-
* forms hit the SAME entry. The migrations-store
|
|
297
|
-
*
|
|
323
|
+
* forms hit the SAME entry. The migrations-store write funnel
|
|
324
|
+
* (`writeMigrationsFileForDir`) invalidates on the same resolved-dir key and
|
|
298
325
|
* deletes the entry this builder populates — so a declare-then-read sequence
|
|
299
326
|
* (mutate migrations.json, then `writeBlockForDir` re-reads) rebuilds against
|
|
300
327
|
* the fresh declarations rather than serving a stale registry.
|
|
@@ -311,7 +338,10 @@ export function getProjectMigrationRegistryForDir(substrateDir) {
|
|
|
311
338
|
/**
|
|
312
339
|
* Drop the cached MigrationRegistry for an explicit substrate directory (if
|
|
313
340
|
* any). Deletes `path.resolve(substrateDir)` — the SAME key the read forms
|
|
314
|
-
* populate, so an invalidation here is observed by the next read.
|
|
341
|
+
* populate, so an invalidation here is observed by the next read. Called by
|
|
342
|
+
* the migrations-store write funnel `writeMigrationsFileForDir` after each
|
|
343
|
+
* successful migrations.json write (the single invalidation site for the
|
|
344
|
+
* whole mutation surface).
|
|
315
345
|
*
|
|
316
346
|
* No-op when no entry is cached — invalidation is cheap and write-after-no-
|
|
317
347
|
* cache is a normal pre-warming state.
|
|
@@ -320,18 +350,17 @@ export function invalidateMigrationRegistryForDir(substrateDir) {
|
|
|
320
350
|
registryCache.delete(path.resolve(substrateDir));
|
|
321
351
|
}
|
|
322
352
|
/**
|
|
323
|
-
* Drop the cached MigrationRegistry for `cwd` (if any)
|
|
324
|
-
*
|
|
325
|
-
*
|
|
353
|
+
* Drop the cached MigrationRegistry for `cwd` (if any) — the cwd convenience
|
|
354
|
+
* form for callers holding a project root rather than a resolved substrate
|
|
355
|
+
* dir. The canonical invalidation site is the migrations-store write funnel
|
|
356
|
+
* `writeMigrationsFileForDir`, which calls the ForDir form directly.
|
|
326
357
|
*
|
|
327
358
|
* Resolves `cwd → substrateDir` and delegates to the ForDir form so the
|
|
328
359
|
* deleted key MATCHES the resolved-substrate-dir key the read path uses (the
|
|
329
360
|
* Regression-B fix: pre-fix this deleted `path.resolve(cwd)`, a different key
|
|
330
|
-
* from the dir-keyed read entry, leaving the post-declaration read stale).
|
|
331
|
-
*
|
|
332
|
-
*
|
|
333
|
-
* safe; `tryResolveContextDir` guards the absent-pointer edge with a no-op
|
|
334
|
-
* rather than throwing during invalidation.
|
|
361
|
+
* from the dir-keyed read entry, leaving the post-declaration read stale).
|
|
362
|
+
* `tryResolveContextDir` guards the absent-pointer edge with a no-op rather
|
|
363
|
+
* than throwing during invalidation.
|
|
335
364
|
*/
|
|
336
365
|
export function invalidateMigrationRegistry(cwd) {
|
|
337
366
|
const substrateDir = tryResolveContextDir(cwd);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"migration-registry-loader.js","sourceRoot":"","sources":["../src/migration-registry-loader.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"migration-registry-loader.js","sourceRoot":"","sources":["../src/migration-registry-loader.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8CG;AAEH,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAC3E,OAAO,EAAE,wBAAwB,EAAwC,MAAM,uBAAuB,CAAC;AAEvG,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAExD;;;;;;;;;;;;;;;;;;GAkBG;A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O,GAAG,CAAC;AACZ,CAAC;AAED;;;;;;;;;;GAUG;AACH,MAAM,UAAU,iCAAiC,CAAC,YAAoB;IACrE,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC,CAAC;AAClD,CAAC;AAED;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,2BAA2B,CAAC,GAAW;IACtD,MAAM,YAAY,GAAG,oBAAoB,CAAC,GAAG,CAAC,CAAC;IAC/C,IAAI,YAAY,KAAK,IAAI;QAAE,OAAO;IAClC,iCAAiC,CAAC,YAAY,CAAC,CAAC;AACjD,CAAC"}
|
|
@@ -21,8 +21,8 @@
|
|
|
21
21
|
* - removeMigrationDecl requires the pair to be PRESENT; a missing target
|
|
22
22
|
* throws.
|
|
23
23
|
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
24
|
+
* Every migrations.json write flows through `writeMigrationsFileForDir`,
|
|
25
|
+
* which invalidates the loader cache (migration-registry-loader.ts) so the
|
|
26
26
|
* next `getProjectMigrationRegistry(cwd)` consumer reads the fresh
|
|
27
27
|
* declarations without process restart. The store↔loader edge is mutually
|
|
28
28
|
* cyclic (loader reads from store; store writes invalidate loader cache);
|
|
@@ -57,6 +57,13 @@ export type TransformOp = {
|
|
|
57
57
|
op: "coerce";
|
|
58
58
|
path: string;
|
|
59
59
|
type: "string" | "number" | "boolean" | "array" | "object";
|
|
60
|
+
} | {
|
|
61
|
+
op: "map_each";
|
|
62
|
+
path: string;
|
|
63
|
+
table?: Record<string, Record<string, unknown>>;
|
|
64
|
+
fallback?: "parent" | "child";
|
|
65
|
+
field?: string;
|
|
66
|
+
value?: unknown;
|
|
60
67
|
};
|
|
61
68
|
export interface TransformSpec {
|
|
62
69
|
operations: TransformOp[];
|
|
@@ -91,8 +98,8 @@ export declare function loadMigrationsFile(cwd: string): MigrationsFile | null;
|
|
|
91
98
|
* block-api's writeTypedFile against the bundled migrations schema. `ctx` is
|
|
92
99
|
* accepted for call-site parity with the rest of the substrate write surface;
|
|
93
100
|
* the migrations schema declares no envelope author fields so stamping is a
|
|
94
|
-
* structural no-op today (the loader-cache invalidation
|
|
95
|
-
* is the side-effect that matters for read-after-write parity).
|
|
101
|
+
* structural no-op today (the loader-cache invalidation inside the ForDir
|
|
102
|
+
* funnel is the side-effect that matters for read-after-write parity).
|
|
96
103
|
*/
|
|
97
104
|
export declare function writeMigrationsFile(cwd: string, file: MigrationsFile, ctx?: DispatchContext): void;
|
|
98
105
|
/**
|
|
@@ -102,40 +109,60 @@ export declare function writeMigrationsFile(cwd: string, file: MigrationsFile, c
|
|
|
102
109
|
* dir directly (no `.pi-context.json` pointer resolution). The cwd form is a
|
|
103
110
|
* thin wrapper resolving the active dir; behaviour is byte-identical when called
|
|
104
111
|
* via cwd. Same attestation-parity no-op semantics as the cwd form (the
|
|
105
|
-
* migrations schema declares no envelope author fields).
|
|
106
|
-
*
|
|
107
|
-
*
|
|
112
|
+
* migrations schema declares no envelope author fields). Invalidates the loader
|
|
113
|
+
* cache for `substrateDir` after the write — this funnel is the single path
|
|
114
|
+
* every migrations.json write (both forms, all mutation helpers) flows through,
|
|
115
|
+
* so every write is cache-coherent: the next registry consumer rebuilds from
|
|
116
|
+
* the fresh declarations.
|
|
108
117
|
*/
|
|
109
118
|
export declare function writeMigrationsFileForDir(substrateDir: string, file: MigrationsFile, ctx?: DispatchContext): void;
|
|
110
119
|
/**
|
|
111
120
|
* Append a new MigrationDecl to the substrate. Op-correctness: the
|
|
112
121
|
* (schemaName, fromVersion) pair must be ABSENT on-disk; collision throws.
|
|
113
|
-
*
|
|
114
|
-
* next registry consumer reads the
|
|
122
|
+
* The write flows through the `writeMigrationsFileForDir` funnel, which
|
|
123
|
+
* invalidates the loader cache so the next registry consumer reads the
|
|
124
|
+
* fresh declaration.
|
|
115
125
|
*/
|
|
116
126
|
export declare function appendMigrationDecl(cwd: string, decl: MigrationDecl, ctx?: DispatchContext): void;
|
|
117
127
|
/**
|
|
118
128
|
* Dir-targeted twin of {@link appendMigrationDecl} (Cycle-1 `*ForDir` pattern).
|
|
119
129
|
* Append a new MigrationDecl to the substrate at `substrateDir`. Op-correctness:
|
|
120
130
|
* the (schemaName, fromVersion) pair must be ABSENT on-disk; collision throws.
|
|
121
|
-
*
|
|
122
|
-
* the
|
|
123
|
-
*
|
|
124
|
-
*
|
|
125
|
-
* invalidateMigrationRegistryForDir on the same dir).
|
|
131
|
+
* The write flows through the `writeMigrationsFileForDir` funnel, which
|
|
132
|
+
* invalidates the loader cache for `substrateDir` so the next registry consumer
|
|
133
|
+
* reads the fresh declaration. The cwd form is a thin wrapper resolving the
|
|
134
|
+
* active dir; behaviour is byte-identical when called via cwd.
|
|
126
135
|
*/
|
|
127
136
|
export declare function appendMigrationDeclForDir(substrateDir: string, decl: MigrationDecl, ctx?: DispatchContext): void;
|
|
128
137
|
/**
|
|
129
138
|
* Replace an existing MigrationDecl identified by (schemaName, fromVersion).
|
|
130
139
|
* Op-correctness: target must be PRESENT; missing target throws. The whole
|
|
131
|
-
* decl is replaced (no per-field merge).
|
|
132
|
-
*
|
|
140
|
+
* decl is replaced (no per-field merge). The write flows through the
|
|
141
|
+
* `writeMigrationsFileForDir` funnel, which invalidates the loader cache.
|
|
133
142
|
*/
|
|
134
143
|
export declare function replaceMigrationDecl(cwd: string, decl: MigrationDecl, ctx?: DispatchContext): void;
|
|
135
144
|
/**
|
|
136
145
|
* Remove an existing MigrationDecl identified by (schemaName, fromVersion).
|
|
137
|
-
* Op-correctness: target must be PRESENT; missing target throws.
|
|
138
|
-
* the
|
|
146
|
+
* Op-correctness: target must be PRESENT; missing target throws. The write
|
|
147
|
+
* flows through the `writeMigrationsFileForDir` funnel, which invalidates the
|
|
148
|
+
* loader cache.
|
|
139
149
|
*/
|
|
140
150
|
export declare function removeMigrationDecl(cwd: string, schemaName: string, fromVersion: string, ctx?: DispatchContext): void;
|
|
151
|
+
/**
|
|
152
|
+
* Ceremony seeding site (init / accept-all / install): copy the packaged
|
|
153
|
+
* catalog's `config`-schema MigrationDecl entries into the substrate's
|
|
154
|
+
* migrations.json so a catalog-born (or re-entered legacy) substrate carries
|
|
155
|
+
* the config migration chain BEFORE any config read walks it. Idempotent —
|
|
156
|
+
* a decl is appended only when its (schemaName, fromVersion) pair is absent
|
|
157
|
+
* on-disk; an existing entry is never replaced. Returns the appended edges
|
|
158
|
+
* (empty when everything was already present or the packaged catalog ships
|
|
159
|
+
* no migrations file). No-op on a nonexistent substrate dir — the seed heals
|
|
160
|
+
* substrates, it never materializes them (ceremonies that need the dir create
|
|
161
|
+
* it themselves before seeding).
|
|
162
|
+
*/
|
|
163
|
+
export declare function seedCatalogConfigMigrationDecls(substrateDir: string, ctx?: DispatchContext): Array<{
|
|
164
|
+
schema: string;
|
|
165
|
+
from: string;
|
|
166
|
+
to: string;
|
|
167
|
+
}>;
|
|
141
168
|
//# sourceMappingURL=migrations-store.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"migrations-store.d.ts","sourceRoot":"","sources":["../src/migrations-store.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AAOH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAc7D;;;;;GAKG;AACH,MAAM,MAAM,WAAW,GACpB;IAAE,EAAE,EAAE,QAAQ,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,EAAE,EAAE,MAAM,CAAA;CAAE,GAC1C;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,OAAO,CAAA;CAAE,GAC5C;IAAE,EAAE,EAAE,QAAQ,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAC9B;IAAE,EAAE,EAAE,QAAQ,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,QAAQ,GAAG,QAAQ,GAAG,SAAS,GAAG,OAAO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GAAG,CAAC,EAAE,eAAe,GAAG,IAAI,CAcrH;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,+BAA+B,CAC9C,YAAY,EAAE,MAAM,EACpB,GAAG,CAAC,EAAE,eAAe,GACnB,KAAK,CAAC;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,EAAE,EAAE,MAAM,CAAA;CAAE,CAAC,CAiBrD"}
|
package/dist/migrations-store.js
CHANGED
|
@@ -21,8 +21,8 @@
|
|
|
21
21
|
* - removeMigrationDecl requires the pair to be PRESENT; a missing target
|
|
22
22
|
* throws.
|
|
23
23
|
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
24
|
+
* Every migrations.json write flows through `writeMigrationsFileForDir`,
|
|
25
|
+
* which invalidates the loader cache (migration-registry-loader.ts) so the
|
|
26
26
|
* next `getProjectMigrationRegistry(cwd)` consumer reads the fresh
|
|
27
27
|
* declarations without process restart. The store↔loader edge is mutually
|
|
28
28
|
* cyclic (loader reads from store; store writes invalidate loader cache);
|
|
@@ -40,7 +40,7 @@ import path from "node:path";
|
|
|
40
40
|
import { fileURLToPath } from "node:url";
|
|
41
41
|
import { writeTypedFile } from "./block-api.js";
|
|
42
42
|
import { migrationsPath, migrationsPathForDir, resolveContextDir } from "./context-dir.js";
|
|
43
|
-
import {
|
|
43
|
+
import { invalidateMigrationRegistryForDir } from "./migration-registry-loader.js";
|
|
44
44
|
import { validateFromFile } from "./schema-validator.js";
|
|
45
45
|
/**
|
|
46
46
|
* Resolve the bundled migrations schema file. Mirrors the private
|
|
@@ -90,8 +90,8 @@ export function loadMigrationsFile(cwd) {
|
|
|
90
90
|
* block-api's writeTypedFile against the bundled migrations schema. `ctx` is
|
|
91
91
|
* accepted for call-site parity with the rest of the substrate write surface;
|
|
92
92
|
* the migrations schema declares no envelope author fields so stamping is a
|
|
93
|
-
* structural no-op today (the loader-cache invalidation
|
|
94
|
-
* is the side-effect that matters for read-after-write parity).
|
|
93
|
+
* structural no-op today (the loader-cache invalidation inside the ForDir
|
|
94
|
+
* funnel is the side-effect that matters for read-after-write parity).
|
|
95
95
|
*/
|
|
96
96
|
export function writeMigrationsFile(cwd, file, ctx) {
|
|
97
97
|
writeMigrationsFileForDir(resolveContextDir(cwd), file, ctx);
|
|
@@ -103,12 +103,15 @@ export function writeMigrationsFile(cwd, file, ctx) {
|
|
|
103
103
|
* dir directly (no `.pi-context.json` pointer resolution). The cwd form is a
|
|
104
104
|
* thin wrapper resolving the active dir; behaviour is byte-identical when called
|
|
105
105
|
* via cwd. Same attestation-parity no-op semantics as the cwd form (the
|
|
106
|
-
* migrations schema declares no envelope author fields).
|
|
107
|
-
*
|
|
108
|
-
*
|
|
106
|
+
* migrations schema declares no envelope author fields). Invalidates the loader
|
|
107
|
+
* cache for `substrateDir` after the write — this funnel is the single path
|
|
108
|
+
* every migrations.json write (both forms, all mutation helpers) flows through,
|
|
109
|
+
* so every write is cache-coherent: the next registry consumer rebuilds from
|
|
110
|
+
* the fresh declarations.
|
|
109
111
|
*/
|
|
110
112
|
export function writeMigrationsFileForDir(substrateDir, file, ctx) {
|
|
111
113
|
writeTypedFile(migrationsPathForDir(substrateDir), bundledMigrationsSchemaPath(), file, ctx, "migrations.json");
|
|
114
|
+
invalidateMigrationRegistryForDir(substrateDir);
|
|
112
115
|
}
|
|
113
116
|
/**
|
|
114
117
|
* Compose an initial empty migrations file shape — used by the append helper
|
|
@@ -137,8 +140,9 @@ function findMigrationIndex(file, schemaName, fromVersion) {
|
|
|
137
140
|
/**
|
|
138
141
|
* Append a new MigrationDecl to the substrate. Op-correctness: the
|
|
139
142
|
* (schemaName, fromVersion) pair must be ABSENT on-disk; collision throws.
|
|
140
|
-
*
|
|
141
|
-
* next registry consumer reads the
|
|
143
|
+
* The write flows through the `writeMigrationsFileForDir` funnel, which
|
|
144
|
+
* invalidates the loader cache so the next registry consumer reads the
|
|
145
|
+
* fresh declaration.
|
|
142
146
|
*/
|
|
143
147
|
export function appendMigrationDecl(cwd, decl, ctx) {
|
|
144
148
|
appendMigrationDeclForDir(resolveContextDir(cwd), decl, ctx);
|
|
@@ -147,11 +151,10 @@ export function appendMigrationDecl(cwd, decl, ctx) {
|
|
|
147
151
|
* Dir-targeted twin of {@link appendMigrationDecl} (Cycle-1 `*ForDir` pattern).
|
|
148
152
|
* Append a new MigrationDecl to the substrate at `substrateDir`. Op-correctness:
|
|
149
153
|
* the (schemaName, fromVersion) pair must be ABSENT on-disk; collision throws.
|
|
150
|
-
*
|
|
151
|
-
* the
|
|
152
|
-
*
|
|
153
|
-
*
|
|
154
|
-
* invalidateMigrationRegistryForDir on the same dir).
|
|
154
|
+
* The write flows through the `writeMigrationsFileForDir` funnel, which
|
|
155
|
+
* invalidates the loader cache for `substrateDir` so the next registry consumer
|
|
156
|
+
* reads the fresh declaration. The cwd form is a thin wrapper resolving the
|
|
157
|
+
* active dir; behaviour is byte-identical when called via cwd.
|
|
155
158
|
*/
|
|
156
159
|
export function appendMigrationDeclForDir(substrateDir, decl, ctx) {
|
|
157
160
|
const current = loadMigrationsFileForDir(substrateDir) ?? emptyMigrationsFile();
|
|
@@ -162,13 +165,12 @@ export function appendMigrationDeclForDir(substrateDir, decl, ctx) {
|
|
|
162
165
|
const next = clone(current);
|
|
163
166
|
next.migrations.push(decl);
|
|
164
167
|
writeMigrationsFileForDir(substrateDir, next, ctx);
|
|
165
|
-
invalidateMigrationRegistryForDir(substrateDir);
|
|
166
168
|
}
|
|
167
169
|
/**
|
|
168
170
|
* Replace an existing MigrationDecl identified by (schemaName, fromVersion).
|
|
169
171
|
* Op-correctness: target must be PRESENT; missing target throws. The whole
|
|
170
|
-
* decl is replaced (no per-field merge).
|
|
171
|
-
*
|
|
172
|
+
* decl is replaced (no per-field merge). The write flows through the
|
|
173
|
+
* `writeMigrationsFileForDir` funnel, which invalidates the loader cache.
|
|
172
174
|
*/
|
|
173
175
|
export function replaceMigrationDecl(cwd, decl, ctx) {
|
|
174
176
|
const current = loadMigrationsFile(cwd);
|
|
@@ -182,12 +184,12 @@ export function replaceMigrationDecl(cwd, decl, ctx) {
|
|
|
182
184
|
const next = clone(current);
|
|
183
185
|
next.migrations[idx] = decl;
|
|
184
186
|
writeMigrationsFile(cwd, next, ctx);
|
|
185
|
-
invalidateMigrationRegistry(cwd);
|
|
186
187
|
}
|
|
187
188
|
/**
|
|
188
189
|
* Remove an existing MigrationDecl identified by (schemaName, fromVersion).
|
|
189
|
-
* Op-correctness: target must be PRESENT; missing target throws.
|
|
190
|
-
* the
|
|
190
|
+
* Op-correctness: target must be PRESENT; missing target throws. The write
|
|
191
|
+
* flows through the `writeMigrationsFileForDir` funnel, which invalidates the
|
|
192
|
+
* loader cache.
|
|
191
193
|
*/
|
|
192
194
|
export function removeMigrationDecl(cwd, schemaName, fromVersion, ctx) {
|
|
193
195
|
const current = loadMigrationsFile(cwd);
|
|
@@ -201,6 +203,38 @@ export function removeMigrationDecl(cwd, schemaName, fromVersion, ctx) {
|
|
|
201
203
|
const next = clone(current);
|
|
202
204
|
next.migrations.splice(idx, 1);
|
|
203
205
|
writeMigrationsFile(cwd, next, ctx);
|
|
204
|
-
|
|
206
|
+
}
|
|
207
|
+
/**
|
|
208
|
+
* Ceremony seeding site (init / accept-all / install): copy the packaged
|
|
209
|
+
* catalog's `config`-schema MigrationDecl entries into the substrate's
|
|
210
|
+
* migrations.json so a catalog-born (or re-entered legacy) substrate carries
|
|
211
|
+
* the config migration chain BEFORE any config read walks it. Idempotent —
|
|
212
|
+
* a decl is appended only when its (schemaName, fromVersion) pair is absent
|
|
213
|
+
* on-disk; an existing entry is never replaced. Returns the appended edges
|
|
214
|
+
* (empty when everything was already present or the packaged catalog ships
|
|
215
|
+
* no migrations file). No-op on a nonexistent substrate dir — the seed heals
|
|
216
|
+
* substrates, it never materializes them (ceremonies that need the dir create
|
|
217
|
+
* it themselves before seeding).
|
|
218
|
+
*/
|
|
219
|
+
export function seedCatalogConfigMigrationDecls(substrateDir, ctx) {
|
|
220
|
+
if (!fs.existsSync(substrateDir))
|
|
221
|
+
return [];
|
|
222
|
+
const here = path.dirname(fileURLToPath(import.meta.url));
|
|
223
|
+
const catalogPath = path.resolve(here, "..", "samples", "migrations.json");
|
|
224
|
+
if (!fs.existsSync(catalogPath))
|
|
225
|
+
return [];
|
|
226
|
+
const data = JSON.parse(fs.readFileSync(catalogPath, "utf-8"));
|
|
227
|
+
validateFromFile(bundledMigrationsSchemaPath(), data, `migrations.json (${catalogPath})`);
|
|
228
|
+
const catalog = data;
|
|
229
|
+
const configDecls = catalog.migrations.filter((m) => m.schemaName === "config");
|
|
230
|
+
const existing = loadMigrationsFileForDir(substrateDir);
|
|
231
|
+
const appended = [];
|
|
232
|
+
for (const decl of configDecls) {
|
|
233
|
+
if (existing && findMigrationIndex(existing, decl.schemaName, decl.fromVersion) >= 0)
|
|
234
|
+
continue;
|
|
235
|
+
appendMigrationDeclForDir(substrateDir, decl, ctx);
|
|
236
|
+
appended.push({ schema: decl.schemaName, from: decl.fromVersion, to: decl.toVersion });
|
|
237
|
+
}
|
|
238
|
+
return appended;
|
|
205
239
|
}
|
|
206
240
|
//# sourceMappingURL=migrations-store.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"migrations-store.js","sourceRoot":"","sources":["../src/migrations-store.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AAEH,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,EAAE,cAAc,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAE3F,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"migrations-store.js","sourceRoot":"","sources":["../src/migrations-store.ts"],"names":[],"mappings":"AAAA;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I,CAAC,UAAU,EAAE,IAAI,EAAE,IAAI,CAAC,WAAW,EAAE,EAAE,EAAE,IAAI,CAAC,SAAS,EAAE,CAAC,CAAC;IACxF,CAAC;IACD,OAAO,QAAQ,CAAC;AACjB,CAAC"}
|
package/dist/ops-registry.d.ts
CHANGED
|
@@ -1,3 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Op-registry for pi-context — the canonical list of substrate operations,
|
|
3
|
+
* each described once as an OpDefinition and projected onto the in-pi tool
|
|
4
|
+
* surface by registerAll(). This is a behavior-preserving relocation of the
|
|
5
|
+
* 45 inline pi.registerTool({...}) calls that previously lived in the
|
|
6
|
+
* extension factory in index.ts: name/label/description/promptSnippet/
|
|
7
|
+
* parameters are copied verbatim, and each tool's execute body becomes the
|
|
8
|
+
* op's run(cwd, params) with the uniform result wrapper
|
|
9
|
+
* `{ details: undefined, content: [{ type: "text", text: X }] }` reduced to
|
|
10
|
+
* `return X` (registerAll re-applies the wrapper identically for every op).
|
|
11
|
+
*
|
|
12
|
+
* Phase 1 of the pi-context-cli arc (analysis/2026-06-03-pi-context-cli-design-ledger.md):
|
|
13
|
+
* the registry is the single source the auto-tracking CLI will reflect. The
|
|
14
|
+
* authGated / surface fields are carried for that downstream consumer; all
|
|
15
|
+
* current pi-context ops are surface:"use" and authGated is left unset in this
|
|
16
|
+
* phase (the auth-gate at the pi-agent-dispatch layer remains the enforcement
|
|
17
|
+
* point, unchanged by this relocation).
|
|
18
|
+
*/
|
|
1
19
|
import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
|
|
2
20
|
import { type TSchema } from "typebox";
|
|
3
21
|
import type { DispatchContext } from "./dispatch-context.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ops-registry.d.ts","sourceRoot":"","sources":["../src/ops-registry.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ops-registry.d.ts","sourceRoot":"","sources":["../src/ops-registry.ts"],"names":[],"mappings":"AAAA;;;;;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