@nazty_labs/common-ground 0.5.1

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.
Files changed (62) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +64 -0
  3. package/SETUP.md +219 -0
  4. package/dist/access.d.ts +172 -0
  5. package/dist/access.js +175 -0
  6. package/dist/cli.d.ts +2 -0
  7. package/dist/cli.js +198 -0
  8. package/dist/commands.d.ts +189 -0
  9. package/dist/commands.js +202 -0
  10. package/dist/discovery.d.ts +73 -0
  11. package/dist/discovery.js +417 -0
  12. package/dist/errors.d.ts +15 -0
  13. package/dist/errors.js +22 -0
  14. package/dist/export.d.ts +14 -0
  15. package/dist/export.js +86 -0
  16. package/dist/guidance.d.ts +11 -0
  17. package/dist/guidance.js +75 -0
  18. package/dist/hooks.d.ts +4 -0
  19. package/dist/hooks.js +141 -0
  20. package/dist/init.d.ts +304 -0
  21. package/dist/init.js +150 -0
  22. package/dist/maintenance.d.ts +126 -0
  23. package/dist/maintenance.js +23 -0
  24. package/dist/matching.d.ts +17 -0
  25. package/dist/matching.js +32 -0
  26. package/dist/model.d.ts +974 -0
  27. package/dist/model.js +21 -0
  28. package/dist/navigation.d.ts +164 -0
  29. package/dist/navigation.js +164 -0
  30. package/dist/operations.d.ts +10 -0
  31. package/dist/operations.js +130 -0
  32. package/dist/paging.d.ts +5 -0
  33. package/dist/paging.js +32 -0
  34. package/dist/retrieval.d.ts +146 -0
  35. package/dist/retrieval.js +150 -0
  36. package/dist/review-files.d.ts +3 -0
  37. package/dist/review-files.js +106 -0
  38. package/dist/review.d.ts +86 -0
  39. package/dist/review.js +124 -0
  40. package/dist/server.d.ts +8 -0
  41. package/dist/server.js +105 -0
  42. package/dist/source-search.d.ts +63 -0
  43. package/dist/source-search.js +245 -0
  44. package/dist/store.d.ts +452 -0
  45. package/dist/store.js +718 -0
  46. package/dist/version.d.ts +1 -0
  47. package/dist/version.js +2 -0
  48. package/dist/workflow.d.ts +450 -0
  49. package/dist/workflow.js +317 -0
  50. package/docs/architecture.md +65 -0
  51. package/docs/audit-0.4.0.md +42 -0
  52. package/docs/demo.md +42 -0
  53. package/docs/discovery.md +70 -0
  54. package/docs/knowledge-policy.md +51 -0
  55. package/docs/pillar-contract.md +98 -0
  56. package/docs/quiet-workflow.md +98 -0
  57. package/docs/releases.md +157 -0
  58. package/package.json +52 -0
  59. package/schemas/admission.schema.json +75 -0
  60. package/schemas/knowledge.schema.json +192 -0
  61. package/schemas/patch.schema.json +220 -0
  62. package/schemas/update.schema.json +218 -0
@@ -0,0 +1,452 @@
1
+ import { type RegistryRecord, type ChapterRecord, type Definition, type UpdateRequest } from './model.js';
2
+ export declare const same: (a: unknown, b: unknown) => boolean;
3
+ export declare class Store {
4
+ root: string;
5
+ constructor(root: string);
6
+ file(name: string): string;
7
+ safe(relative: string, allowMissing?: boolean): Promise<string>;
8
+ chapters(registry: RegistryRecord): {
9
+ key: string;
10
+ pillar: {
11
+ id: string;
12
+ title: string;
13
+ scope: string;
14
+ excludes: string;
15
+ chapters: {
16
+ id: string;
17
+ title: string;
18
+ scope: string;
19
+ excludes: string;
20
+ paths: string[];
21
+ revision: number;
22
+ facts: {
23
+ id: string;
24
+ statement: string;
25
+ evidence: {
26
+ path: string;
27
+ quote: string;
28
+ }[];
29
+ sourceScope: string[];
30
+ dependsOn: string[];
31
+ }[];
32
+ sources: Record<string, string>;
33
+ dependencyFingerprints: Record<string, string>;
34
+ }[];
35
+ };
36
+ chapter: {
37
+ id: string;
38
+ title: string;
39
+ scope: string;
40
+ excludes: string;
41
+ paths: string[];
42
+ revision: number;
43
+ facts: {
44
+ id: string;
45
+ statement: string;
46
+ evidence: {
47
+ path: string;
48
+ quote: string;
49
+ }[];
50
+ sourceScope: string[];
51
+ dependsOn: string[];
52
+ }[];
53
+ sources: Record<string, string>;
54
+ dependencyFingerprints: Record<string, string>;
55
+ };
56
+ }[];
57
+ chapter(registry: RegistryRecord, key: string): ChapterRecord;
58
+ validateRegistry(value: unknown): RegistryRecord;
59
+ read(): Promise<RegistryRecord>;
60
+ persist(registry: RegistryRecord): Promise<void>;
61
+ atomic(name: string, value: unknown): Promise<void>;
62
+ lock<T>(fn: () => Promise<T>): Promise<T>;
63
+ walk(scopes?: string[], limit?: number): Promise<{
64
+ files: string[];
65
+ truncated: boolean;
66
+ }>;
67
+ sourceHash(relative: string): Promise<string>;
68
+ snapshot(pillar: Pick<ChapterRecord, 'paths' | 'facts'>, cache?: Map<string, Promise<string>>): Promise<Record<string, string>>;
69
+ validateFacts(pillar: Pick<ChapterRecord, 'paths' | 'facts'>): Promise<void>;
70
+ facts(registry: RegistryRecord): {
71
+ key: string;
72
+ chapterId: string;
73
+ chapter: {
74
+ id: string;
75
+ title: string;
76
+ scope: string;
77
+ excludes: string;
78
+ paths: string[];
79
+ revision: number;
80
+ facts: {
81
+ id: string;
82
+ statement: string;
83
+ evidence: {
84
+ path: string;
85
+ quote: string;
86
+ }[];
87
+ sourceScope: string[];
88
+ dependsOn: string[];
89
+ }[];
90
+ sources: Record<string, string>;
91
+ dependencyFingerprints: Record<string, string>;
92
+ };
93
+ fact: {
94
+ id: string;
95
+ statement: string;
96
+ evidence: {
97
+ path: string;
98
+ quote: string;
99
+ }[];
100
+ sourceScope: string[];
101
+ dependsOn: string[];
102
+ };
103
+ }[];
104
+ fact(registry: RegistryRecord, key: string): {
105
+ key: string;
106
+ chapterId: string;
107
+ chapter: {
108
+ id: string;
109
+ title: string;
110
+ scope: string;
111
+ excludes: string;
112
+ paths: string[];
113
+ revision: number;
114
+ facts: {
115
+ id: string;
116
+ statement: string;
117
+ evidence: {
118
+ path: string;
119
+ quote: string;
120
+ }[];
121
+ sourceScope: string[];
122
+ dependsOn: string[];
123
+ }[];
124
+ sources: Record<string, string>;
125
+ dependencyFingerprints: Record<string, string>;
126
+ };
127
+ fact: {
128
+ id: string;
129
+ statement: string;
130
+ evidence: {
131
+ path: string;
132
+ quote: string;
133
+ }[];
134
+ sourceScope: string[];
135
+ dependsOn: string[];
136
+ };
137
+ };
138
+ impact(registry: RegistryRecord, key: string, factIds?: string[]): string[];
139
+ related(registry: RegistryRecord, key: string, factIds?: string[]): string[];
140
+ upstreamFacts(registry: RegistryRecord, key: string, index?: Map<string, {
141
+ key: string;
142
+ chapterId: string;
143
+ chapter: {
144
+ id: string;
145
+ title: string;
146
+ scope: string;
147
+ excludes: string;
148
+ paths: string[];
149
+ revision: number;
150
+ facts: {
151
+ id: string;
152
+ statement: string;
153
+ evidence: {
154
+ path: string;
155
+ quote: string;
156
+ }[];
157
+ sourceScope: string[];
158
+ dependsOn: string[];
159
+ }[];
160
+ sources: Record<string, string>;
161
+ dependencyFingerprints: Record<string, string>;
162
+ };
163
+ fact: {
164
+ id: string;
165
+ statement: string;
166
+ evidence: {
167
+ path: string;
168
+ quote: string;
169
+ }[];
170
+ sourceScope: string[];
171
+ dependsOn: string[];
172
+ };
173
+ }>): string[];
174
+ dependencyFingerprints(registry: RegistryRecord, key: string): {
175
+ [k: string]: string;
176
+ };
177
+ context(registry: RegistryRecord, keys: string[], cache?: Map<string, Promise<string>>): Promise<Record<string, unknown>>;
178
+ status(key: string, registry?: RegistryRecord, cache?: Map<string, Promise<string>>): Promise<{
179
+ chapterId: string;
180
+ revision: number;
181
+ status: string;
182
+ locallyReviewed: boolean;
183
+ changedPaths: string[];
184
+ dependencyDrift: boolean;
185
+ error?: undefined;
186
+ } | {
187
+ chapterId: string;
188
+ revision: number;
189
+ status: string;
190
+ error: any;
191
+ locallyReviewed?: undefined;
192
+ changedPaths?: undefined;
193
+ dependencyDrift?: undefined;
194
+ }>;
195
+ migrate(): Promise<{
196
+ migrated: boolean;
197
+ pillars?: undefined;
198
+ backup?: undefined;
199
+ } | {
200
+ migrated: boolean;
201
+ pillars: number;
202
+ backup: string;
203
+ }>;
204
+ approveDefinitions(definitions: Definition[], standaloneReason?: string): Promise<{
205
+ schemaVersion: 2;
206
+ pillars: {
207
+ id: string;
208
+ title: string;
209
+ scope: string;
210
+ excludes: string;
211
+ chapters: {
212
+ id: string;
213
+ title: string;
214
+ scope: string;
215
+ excludes: string;
216
+ paths: string[];
217
+ revision: number;
218
+ facts: {
219
+ id: string;
220
+ statement: string;
221
+ evidence: {
222
+ path: string;
223
+ quote: string;
224
+ }[];
225
+ sourceScope: string[];
226
+ dependsOn: string[];
227
+ }[];
228
+ sources: Record<string, string>;
229
+ dependencyFingerprints: Record<string, string>;
230
+ }[];
231
+ }[];
232
+ }>;
233
+ addChapters(pillarId: string, definitions: unknown[]): Promise<{
234
+ id: string;
235
+ title: string;
236
+ scope: string;
237
+ excludes: string;
238
+ chapters: {
239
+ id: string;
240
+ title: string;
241
+ scope: string;
242
+ excludes: string;
243
+ paths: string[];
244
+ revision: number;
245
+ facts: {
246
+ id: string;
247
+ statement: string;
248
+ evidence: {
249
+ path: string;
250
+ quote: string;
251
+ }[];
252
+ sourceScope: string[];
253
+ dependsOn: string[];
254
+ }[];
255
+ sources: Record<string, string>;
256
+ dependencyFingerprints: Record<string, string>;
257
+ }[];
258
+ }>;
259
+ /** Validate an entire initial map or empty-chapter batch before one shared write. */
260
+ bootstrap(definitions: Definition[] | undefined, batches: {
261
+ chapterId: string;
262
+ facts: unknown[];
263
+ }[], dryRun: boolean, expected?: string): Promise<{
264
+ dryRun: boolean;
265
+ validation: string;
266
+ preflight: string;
267
+ approvalRequired: boolean | {
268
+ boundaries: boolean;
269
+ facts: boolean;
270
+ };
271
+ approved: {
272
+ boundaries: boolean;
273
+ facts: boolean;
274
+ content: string;
275
+ declarationOnly: boolean;
276
+ humanReviewVerified: boolean;
277
+ } | undefined;
278
+ chapters: string[];
279
+ factCount: number;
280
+ sourceFileCounts: Record<string, number>;
281
+ outputPath: string;
282
+ next: string;
283
+ }>;
284
+ seed(key: string, facts: unknown): Promise<{
285
+ id: string;
286
+ title: string;
287
+ scope: string;
288
+ excludes: string;
289
+ paths: string[];
290
+ revision: number;
291
+ facts: {
292
+ id: string;
293
+ statement: string;
294
+ evidence: {
295
+ path: string;
296
+ quote: string;
297
+ }[];
298
+ sourceScope: string[];
299
+ dependsOn: string[];
300
+ }[];
301
+ sources: Record<string, string>;
302
+ dependencyFingerprints: Record<string, string>;
303
+ }>;
304
+ admit(key: string, additions: unknown): Promise<{
305
+ id: string;
306
+ title: string;
307
+ scope: string;
308
+ excludes: string;
309
+ paths: string[];
310
+ revision: number;
311
+ facts: {
312
+ id: string;
313
+ statement: string;
314
+ evidence: {
315
+ path: string;
316
+ quote: string;
317
+ }[];
318
+ sourceScope: string[];
319
+ dependsOn: string[];
320
+ }[];
321
+ sources: Record<string, string>;
322
+ dependencyFingerprints: Record<string, string>;
323
+ }>;
324
+ reviewPlan(key: string, factIds?: string[]): Promise<{
325
+ chapterId: string;
326
+ factIds: string[] | undefined;
327
+ policy: string;
328
+ affectedFacts: string[];
329
+ chapters: {
330
+ chapterId: string;
331
+ title: string;
332
+ revision: number;
333
+ factCount: number;
334
+ freshness: {
335
+ chapterId: string;
336
+ revision: number;
337
+ status: string;
338
+ locallyReviewed: boolean;
339
+ changedPaths: string[];
340
+ dependencyDrift: boolean;
341
+ error?: undefined;
342
+ } | {
343
+ chapterId: string;
344
+ revision: number;
345
+ status: string;
346
+ error: any;
347
+ locallyReviewed?: undefined;
348
+ changedPaths?: undefined;
349
+ dependencyDrift?: undefined;
350
+ };
351
+ }[];
352
+ }>;
353
+ resolveTarget(registry: RegistryRecord, target: string): string[];
354
+ requestTidy(target: string | string[], expectedRegistry?: RegistryRecord): Promise<{
355
+ tidyId: null;
356
+ instruction: string;
357
+ requiredChapters?: undefined;
358
+ } | {
359
+ tidyId: `${string}-${string}-${string}-${string}-${string}`;
360
+ requiredChapters: string[];
361
+ instruction: string;
362
+ }>;
363
+ tidyScope(id: string, registry: RegistryRecord): Promise<string[]>;
364
+ reviewFiles(registry: RegistryRecord, keys: string[], touchedPaths: string[], candidate?: {
365
+ schemaVersion: 2;
366
+ pillars: {
367
+ id: string;
368
+ title: string;
369
+ scope: string;
370
+ excludes: string;
371
+ chapters: {
372
+ id: string;
373
+ title: string;
374
+ scope: string;
375
+ excludes: string;
376
+ paths: string[];
377
+ revision: number;
378
+ facts: {
379
+ id: string;
380
+ statement: string;
381
+ evidence: {
382
+ path: string;
383
+ quote: string;
384
+ }[];
385
+ sourceScope: string[];
386
+ dependsOn: string[];
387
+ }[];
388
+ sources: Record<string, string>;
389
+ dependencyFingerprints: Record<string, string>;
390
+ }[];
391
+ }[];
392
+ }): Promise<{
393
+ sourceFiles: string[];
394
+ documentFiles: string[];
395
+ }>;
396
+ fileSnapshots(files: string[]): Promise<Record<string, string>>;
397
+ evaluate(input: UpdateRequest, registry: RegistryRecord): Promise<{
398
+ request: {
399
+ chapterId: string;
400
+ touchedPaths: string[];
401
+ reviews: {
402
+ facts: {
403
+ id: string;
404
+ statement: string;
405
+ evidence: {
406
+ path: string;
407
+ quote: string;
408
+ }[];
409
+ sourceScope: string[];
410
+ dependsOn: string[];
411
+ }[];
412
+ reason: string;
413
+ chapterId: string;
414
+ expectedRevision: number;
415
+ invalidatedFactIds: string[];
416
+ reviewedFactIds: string[];
417
+ maintenance?: {
418
+ factId: string;
419
+ action: "correct" | "merge" | "remove" | "tighten";
420
+ reason: string;
421
+ replacement?: string | undefined;
422
+ }[] | undefined;
423
+ }[];
424
+ verification: {
425
+ sourceFiles: string[];
426
+ documentFiles: string[];
427
+ };
428
+ factIds?: string[] | undefined;
429
+ tidyId?: string | undefined;
430
+ };
431
+ required: string[];
432
+ snapshots: Record<string, Record<string, string>>;
433
+ reviewSnapshots: Record<string, string>;
434
+ changed: string[];
435
+ }>;
436
+ markReviewed(registry: RegistryRecord, keys: string[], snapshots: Record<string, Record<string, string>>): Promise<void>;
437
+ prepare(input: UpdateRequest): Promise<{
438
+ noop: true;
439
+ proposalId?: undefined;
440
+ changedChapters?: undefined;
441
+ reviewedChapters?: undefined;
442
+ } | {
443
+ noop: false;
444
+ proposalId: `${string}-${string}-${string}-${string}-${string}`;
445
+ changedChapters: string[];
446
+ reviewedChapters: string[];
447
+ }>;
448
+ commit(id: string): Promise<{
449
+ changedChapters: string[];
450
+ reviewedChapters: string[];
451
+ }>;
452
+ }