patram 0.6.2 → 0.8.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.
Files changed (55) hide show
  1. package/lib/build-graph-identity.d.ts +40 -0
  2. package/lib/build-graph.d.ts +11 -0
  3. package/lib/build-graph.types.d.ts +24 -0
  4. package/lib/claim-helpers.d.ts +20 -0
  5. package/lib/cli-help-metadata.js +48 -9
  6. package/lib/command-output.js +1 -0
  7. package/lib/document-node-identity.d.ts +47 -0
  8. package/lib/inspect-reverse-references.js +184 -0
  9. package/lib/layout-incoming-references.js +105 -0
  10. package/lib/layout-incoming-summary-lines.js +21 -0
  11. package/lib/list-source-files.d.ts +29 -0
  12. package/lib/load-patram-config.d.ts +384 -0
  13. package/lib/load-patram-config.types.d.ts +45 -0
  14. package/lib/load-project-graph.d.ts +35 -0
  15. package/lib/output-view.types.d.ts +88 -0
  16. package/lib/output-view.types.ts +19 -2
  17. package/lib/overlay-graph.d.ts +43 -0
  18. package/lib/overlay-graph.js +191 -0
  19. package/lib/parse-claims.d.ts +40 -0
  20. package/lib/parse-claims.types.d.ts +31 -0
  21. package/lib/parse-cli-arguments-helpers.js +11 -4
  22. package/lib/parse-cli-arguments.types.ts +8 -2
  23. package/lib/parse-jsdoc-blocks.d.ts +15 -0
  24. package/lib/parse-jsdoc-claims.d.ts +9 -0
  25. package/lib/parse-jsdoc-prose.d.ts +28 -0
  26. package/lib/parse-markdown-claims.d.ts +14 -0
  27. package/lib/parse-markdown-directives.d.ts +34 -0
  28. package/lib/parse-where-clause.d.ts +75 -0
  29. package/lib/parse-where-clause.js +157 -37
  30. package/lib/parse-where-clause.types.d.ts +63 -0
  31. package/lib/parse-yaml-claims.d.ts +38 -0
  32. package/lib/patram-cli.js +66 -1
  33. package/lib/patram-config.d.ts +106 -0
  34. package/lib/patram-config.types.d.ts +14 -0
  35. package/lib/patram.d.ts +73 -0
  36. package/lib/patram.js +3 -0
  37. package/lib/query-graph.d.ts +68 -0
  38. package/lib/query-graph.js +27 -24
  39. package/lib/query-inspection.d.ts +86 -0
  40. package/lib/render-cli-help.js +1 -1
  41. package/lib/render-json-output.js +91 -62
  42. package/lib/render-output-view.js +58 -3
  43. package/lib/render-plain-output.js +46 -3
  44. package/lib/render-rich-output.js +50 -5
  45. package/lib/resolve-patram-graph-config.d.ts +9 -0
  46. package/lib/reverse-reference-test-helpers.js +76 -0
  47. package/lib/show-document.js +44 -6
  48. package/lib/source-file-defaults.d.ts +5 -0
  49. package/lib/tagged-fenced-block-error.d.ts +10 -0
  50. package/lib/tagged-fenced-block-markdown.d.ts +47 -0
  51. package/lib/tagged-fenced-block-metadata.d.ts +26 -0
  52. package/lib/tagged-fenced-block-parser.d.ts +61 -0
  53. package/lib/tagged-fenced-blocks.d.ts +39 -0
  54. package/lib/tagged-fenced-blocks.types.d.ts +32 -0
  55. package/package.json +13 -2
@@ -0,0 +1,384 @@
1
+ /**
2
+ * @typedef {object} LoadPatramConfigResult
3
+ * @property {PatramRepoConfig | null} config
4
+ * @property {string} config_path
5
+ * @property {PatramDiagnostic[]} diagnostics
6
+ */
7
+ /**
8
+ * Load and validate the repo Patram config.
9
+ *
10
+ * @param {string} [project_directory]
11
+ * @returns {Promise<LoadPatramConfigResult>}
12
+ */
13
+ export function loadPatramConfig(project_directory?: string): Promise<LoadPatramConfigResult>;
14
+ export type LoadPatramConfigResult = {
15
+ config: PatramRepoConfig | null;
16
+ config_path: string;
17
+ diagnostics: PatramDiagnostic[];
18
+ };
19
+ export type PatramDiagnostic = {
20
+ code: string;
21
+ column: number;
22
+ level: "error";
23
+ line: number;
24
+ message: string;
25
+ path: string;
26
+ };
27
+ export type StoredQueryConfig = z.output<typeof stored_query_schema>;
28
+ export type DerivedSummaryScalar = z.output<typeof derived_summary_scalar_schema>;
29
+ export type DerivedSummaryCountConfig = z.output<typeof derived_summary_count_schema>;
30
+ export type DerivedSummarySelectCaseConfig = z.output<typeof derived_summary_select_case_schema>;
31
+ export type DerivedSummaryFieldConfig = z.output<typeof derived_summary_field_schema>;
32
+ export type DerivedSummaryConfig = z.output<typeof derived_summary_schema>;
33
+ export type FieldDisplayConfig = z.output<typeof field_display_schema>;
34
+ export type FieldQueryConfig = z.output<typeof field_query_schema>;
35
+ export type MetadataFieldConfig = z.output<typeof metadata_field_schema>;
36
+ export type ClassFieldRuleConfig = z.output<typeof class_field_rule_schema>;
37
+ export type ClassSchemaConfig = z.output<typeof class_schema_schema>;
38
+ export type RepoClassConfig = z.output<typeof repo_class_definition_schema>;
39
+ export type PathClassConfig = z.output<typeof path_class_schema>;
40
+ export type PatramRepoConfig = z.output<typeof patram_repo_config_schema>;
41
+ import { z } from 'zod';
42
+ /**
43
+ * @typedef {object} PatramDiagnostic
44
+ * @property {string} code
45
+ * @property {number} column
46
+ * @property {'error'} level
47
+ * @property {number} line
48
+ * @property {string} message
49
+ * @property {string} path
50
+ */
51
+ /**
52
+ * @typedef {z.output<typeof stored_query_schema>} StoredQueryConfig
53
+ */
54
+ declare const stored_query_schema: z.ZodObject<{
55
+ where: z.ZodString;
56
+ }, z.core.$strict>;
57
+ /**
58
+ * @typedef {z.output<typeof derived_summary_scalar_schema>} DerivedSummaryScalar
59
+ */
60
+ declare const derived_summary_scalar_schema: z.ZodUnion<readonly [z.ZodBoolean, z.ZodNumber, z.ZodString, z.ZodNull]>;
61
+ /**
62
+ * @typedef {z.output<typeof derived_summary_count_schema>} DerivedSummaryCountConfig
63
+ */
64
+ declare const derived_summary_count_schema: z.ZodObject<{
65
+ traversal: z.ZodString;
66
+ where: z.ZodString;
67
+ }, z.core.$strict>;
68
+ /**
69
+ * @typedef {z.output<typeof derived_summary_select_case_schema>} DerivedSummarySelectCaseConfig
70
+ */
71
+ declare const derived_summary_select_case_schema: z.ZodObject<{
72
+ value: z.ZodUnion<readonly [z.ZodBoolean, z.ZodNumber, z.ZodString, z.ZodNull]>;
73
+ when: z.ZodString;
74
+ }, z.core.$strict>;
75
+ declare const derived_summary_field_schema: z.ZodUnion<readonly [z.ZodObject<{
76
+ count: z.ZodObject<{
77
+ traversal: z.ZodString;
78
+ where: z.ZodString;
79
+ }, z.core.$strict>;
80
+ name: z.ZodString;
81
+ }, z.core.$strict>, z.ZodObject<{
82
+ default: z.ZodUnion<readonly [z.ZodBoolean, z.ZodNumber, z.ZodString, z.ZodNull]>;
83
+ name: z.ZodString;
84
+ select: z.ZodArray<z.ZodObject<{
85
+ value: z.ZodUnion<readonly [z.ZodBoolean, z.ZodNumber, z.ZodString, z.ZodNull]>;
86
+ when: z.ZodString;
87
+ }, z.core.$strict>>;
88
+ }, z.core.$strict>]>;
89
+ /**
90
+ * @typedef {z.output<typeof derived_summary_schema>} DerivedSummaryConfig
91
+ */
92
+ declare const derived_summary_schema: z.ZodObject<{
93
+ classes: z.ZodArray<z.ZodString>;
94
+ fields: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
95
+ count: z.ZodObject<{
96
+ traversal: z.ZodString;
97
+ where: z.ZodString;
98
+ }, z.core.$strict>;
99
+ name: z.ZodString;
100
+ }, z.core.$strict>, z.ZodObject<{
101
+ default: z.ZodUnion<readonly [z.ZodBoolean, z.ZodNumber, z.ZodString, z.ZodNull]>;
102
+ name: z.ZodString;
103
+ select: z.ZodArray<z.ZodObject<{
104
+ value: z.ZodUnion<readonly [z.ZodBoolean, z.ZodNumber, z.ZodString, z.ZodNull]>;
105
+ when: z.ZodString;
106
+ }, z.core.$strict>>;
107
+ }, z.core.$strict>]>>;
108
+ }, z.core.$strict>;
109
+ /**
110
+ * @typedef {z.output<typeof field_display_schema>} FieldDisplayConfig
111
+ */
112
+ declare const field_display_schema: z.ZodObject<{
113
+ hidden: z.ZodOptional<z.ZodBoolean>;
114
+ order: z.ZodOptional<z.ZodNumber>;
115
+ }, z.core.$strict>;
116
+ /**
117
+ * @typedef {z.output<typeof field_query_schema>} FieldQueryConfig
118
+ */
119
+ declare const field_query_schema: z.ZodObject<{
120
+ contains: z.ZodOptional<z.ZodBoolean>;
121
+ prefix: z.ZodOptional<z.ZodBoolean>;
122
+ }, z.core.$strict>;
123
+ /**
124
+ * @typedef {z.output<typeof metadata_field_schema>} MetadataFieldConfig
125
+ */
126
+ declare const metadata_field_schema: z.ZodDiscriminatedUnion<[z.ZodObject<{
127
+ query: z.ZodOptional<z.ZodObject<{
128
+ contains: z.ZodOptional<z.ZodBoolean>;
129
+ prefix: z.ZodOptional<z.ZodBoolean>;
130
+ }, z.core.$strict>>;
131
+ type: z.ZodLiteral<"string">;
132
+ display: z.ZodOptional<z.ZodObject<{
133
+ hidden: z.ZodOptional<z.ZodBoolean>;
134
+ order: z.ZodOptional<z.ZodNumber>;
135
+ }, z.core.$strict>>;
136
+ multiple: z.ZodOptional<z.ZodBoolean>;
137
+ path_class: z.ZodOptional<z.ZodString>;
138
+ }, z.core.$strict>, z.ZodObject<{
139
+ type: z.ZodLiteral<"integer">;
140
+ display: z.ZodOptional<z.ZodObject<{
141
+ hidden: z.ZodOptional<z.ZodBoolean>;
142
+ order: z.ZodOptional<z.ZodNumber>;
143
+ }, z.core.$strict>>;
144
+ multiple: z.ZodOptional<z.ZodBoolean>;
145
+ path_class: z.ZodOptional<z.ZodString>;
146
+ }, z.core.$strict>, z.ZodObject<{
147
+ type: z.ZodLiteral<"enum">;
148
+ values: z.ZodArray<z.ZodString>;
149
+ display: z.ZodOptional<z.ZodObject<{
150
+ hidden: z.ZodOptional<z.ZodBoolean>;
151
+ order: z.ZodOptional<z.ZodNumber>;
152
+ }, z.core.$strict>>;
153
+ multiple: z.ZodOptional<z.ZodBoolean>;
154
+ path_class: z.ZodOptional<z.ZodString>;
155
+ }, z.core.$strict>, z.ZodObject<{
156
+ type: z.ZodLiteral<"path">;
157
+ display: z.ZodOptional<z.ZodObject<{
158
+ hidden: z.ZodOptional<z.ZodBoolean>;
159
+ order: z.ZodOptional<z.ZodNumber>;
160
+ }, z.core.$strict>>;
161
+ multiple: z.ZodOptional<z.ZodBoolean>;
162
+ path_class: z.ZodOptional<z.ZodString>;
163
+ }, z.core.$strict>, z.ZodObject<{
164
+ type: z.ZodLiteral<"glob">;
165
+ display: z.ZodOptional<z.ZodObject<{
166
+ hidden: z.ZodOptional<z.ZodBoolean>;
167
+ order: z.ZodOptional<z.ZodNumber>;
168
+ }, z.core.$strict>>;
169
+ multiple: z.ZodOptional<z.ZodBoolean>;
170
+ path_class: z.ZodOptional<z.ZodString>;
171
+ }, z.core.$strict>, z.ZodObject<{
172
+ type: z.ZodLiteral<"date">;
173
+ display: z.ZodOptional<z.ZodObject<{
174
+ hidden: z.ZodOptional<z.ZodBoolean>;
175
+ order: z.ZodOptional<z.ZodNumber>;
176
+ }, z.core.$strict>>;
177
+ multiple: z.ZodOptional<z.ZodBoolean>;
178
+ path_class: z.ZodOptional<z.ZodString>;
179
+ }, z.core.$strict>, z.ZodObject<{
180
+ type: z.ZodLiteral<"date_time">;
181
+ display: z.ZodOptional<z.ZodObject<{
182
+ hidden: z.ZodOptional<z.ZodBoolean>;
183
+ order: z.ZodOptional<z.ZodNumber>;
184
+ }, z.core.$strict>>;
185
+ multiple: z.ZodOptional<z.ZodBoolean>;
186
+ path_class: z.ZodOptional<z.ZodString>;
187
+ }, z.core.$strict>], "type">;
188
+ /**
189
+ * @typedef {z.output<typeof class_field_rule_schema>} ClassFieldRuleConfig
190
+ */
191
+ declare const class_field_rule_schema: z.ZodObject<{
192
+ markdown_styles: z.ZodOptional<z.ZodArray<z.ZodString>>;
193
+ presence: z.ZodEnum<{
194
+ optional: "optional";
195
+ required: "required";
196
+ forbidden: "forbidden";
197
+ }>;
198
+ }, z.core.$strict>;
199
+ /**
200
+ * @typedef {z.output<typeof class_schema_schema>} ClassSchemaConfig
201
+ */
202
+ declare const class_schema_schema: z.ZodObject<{
203
+ document_path_class: z.ZodOptional<z.ZodString>;
204
+ fields: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<{
205
+ markdown_styles: z.ZodOptional<z.ZodArray<z.ZodString>>;
206
+ presence: z.ZodEnum<{
207
+ optional: "optional";
208
+ required: "required";
209
+ forbidden: "forbidden";
210
+ }>;
211
+ }, z.core.$strict>>>;
212
+ markdown_styles: z.ZodOptional<z.ZodArray<z.ZodString>>;
213
+ mixed_styles: z.ZodOptional<z.ZodString>;
214
+ unknown_fields: z.ZodOptional<z.ZodEnum<{
215
+ error: "error";
216
+ ignore: "ignore";
217
+ }>>;
218
+ }, z.core.$strict>;
219
+ /**
220
+ * @typedef {z.output<typeof repo_class_definition_schema>} RepoClassConfig
221
+ */
222
+ declare const repo_class_definition_schema: z.ZodObject<{
223
+ builtin: z.ZodOptional<z.ZodBoolean>;
224
+ label: z.ZodOptional<z.ZodString>;
225
+ schema: z.ZodOptional<z.ZodObject<{
226
+ document_path_class: z.ZodOptional<z.ZodString>;
227
+ fields: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<{
228
+ markdown_styles: z.ZodOptional<z.ZodArray<z.ZodString>>;
229
+ presence: z.ZodEnum<{
230
+ optional: "optional";
231
+ required: "required";
232
+ forbidden: "forbidden";
233
+ }>;
234
+ }, z.core.$strict>>>;
235
+ markdown_styles: z.ZodOptional<z.ZodArray<z.ZodString>>;
236
+ mixed_styles: z.ZodOptional<z.ZodString>;
237
+ unknown_fields: z.ZodOptional<z.ZodEnum<{
238
+ error: "error";
239
+ ignore: "ignore";
240
+ }>>;
241
+ }, z.core.$strict>>;
242
+ }, z.core.$strict>;
243
+ /**
244
+ * @typedef {z.output<typeof path_class_schema>} PathClassConfig
245
+ */
246
+ declare const path_class_schema: z.ZodObject<{
247
+ prefixes: z.ZodArray<z.ZodString>;
248
+ }, z.core.$strict>;
249
+ /**
250
+ * @typedef {z.output<typeof patram_repo_config_schema>} PatramRepoConfig
251
+ */
252
+ declare const patram_repo_config_schema: z.ZodObject<{
253
+ classes: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
254
+ builtin: z.ZodOptional<z.ZodBoolean>;
255
+ label: z.ZodOptional<z.ZodString>;
256
+ schema: z.ZodOptional<z.ZodObject<{
257
+ document_path_class: z.ZodOptional<z.ZodString>;
258
+ fields: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<{
259
+ markdown_styles: z.ZodOptional<z.ZodArray<z.ZodString>>;
260
+ presence: z.ZodEnum<{
261
+ optional: "optional";
262
+ required: "required";
263
+ forbidden: "forbidden";
264
+ }>;
265
+ }, z.core.$strict>>>;
266
+ markdown_styles: z.ZodOptional<z.ZodArray<z.ZodString>>;
267
+ mixed_styles: z.ZodOptional<z.ZodString>;
268
+ unknown_fields: z.ZodOptional<z.ZodEnum<{
269
+ error: "error";
270
+ ignore: "ignore";
271
+ }>>;
272
+ }, z.core.$strict>>;
273
+ }, z.core.$strict>>>;
274
+ derived_summaries: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
275
+ classes: z.ZodArray<z.ZodString>;
276
+ fields: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
277
+ count: z.ZodObject<{
278
+ traversal: z.ZodString;
279
+ where: z.ZodString;
280
+ }, z.core.$strict>;
281
+ name: z.ZodString;
282
+ }, z.core.$strict>, z.ZodObject<{
283
+ default: z.ZodUnion<readonly [z.ZodBoolean, z.ZodNumber, z.ZodString, z.ZodNull]>;
284
+ name: z.ZodString;
285
+ select: z.ZodArray<z.ZodObject<{
286
+ value: z.ZodUnion<readonly [z.ZodBoolean, z.ZodNumber, z.ZodString, z.ZodNull]>;
287
+ when: z.ZodString;
288
+ }, z.core.$strict>>;
289
+ }, z.core.$strict>]>>;
290
+ }, z.core.$strict>>>;
291
+ fields: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodDiscriminatedUnion<[z.ZodObject<{
292
+ query: z.ZodOptional<z.ZodObject<{
293
+ contains: z.ZodOptional<z.ZodBoolean>;
294
+ prefix: z.ZodOptional<z.ZodBoolean>;
295
+ }, z.core.$strict>>;
296
+ type: z.ZodLiteral<"string">;
297
+ display: z.ZodOptional<z.ZodObject<{
298
+ hidden: z.ZodOptional<z.ZodBoolean>;
299
+ order: z.ZodOptional<z.ZodNumber>;
300
+ }, z.core.$strict>>;
301
+ multiple: z.ZodOptional<z.ZodBoolean>;
302
+ path_class: z.ZodOptional<z.ZodString>;
303
+ }, z.core.$strict>, z.ZodObject<{
304
+ type: z.ZodLiteral<"integer">;
305
+ display: z.ZodOptional<z.ZodObject<{
306
+ hidden: z.ZodOptional<z.ZodBoolean>;
307
+ order: z.ZodOptional<z.ZodNumber>;
308
+ }, z.core.$strict>>;
309
+ multiple: z.ZodOptional<z.ZodBoolean>;
310
+ path_class: z.ZodOptional<z.ZodString>;
311
+ }, z.core.$strict>, z.ZodObject<{
312
+ type: z.ZodLiteral<"enum">;
313
+ values: z.ZodArray<z.ZodString>;
314
+ display: z.ZodOptional<z.ZodObject<{
315
+ hidden: z.ZodOptional<z.ZodBoolean>;
316
+ order: z.ZodOptional<z.ZodNumber>;
317
+ }, z.core.$strict>>;
318
+ multiple: z.ZodOptional<z.ZodBoolean>;
319
+ path_class: z.ZodOptional<z.ZodString>;
320
+ }, z.core.$strict>, z.ZodObject<{
321
+ type: z.ZodLiteral<"path">;
322
+ display: z.ZodOptional<z.ZodObject<{
323
+ hidden: z.ZodOptional<z.ZodBoolean>;
324
+ order: z.ZodOptional<z.ZodNumber>;
325
+ }, z.core.$strict>>;
326
+ multiple: z.ZodOptional<z.ZodBoolean>;
327
+ path_class: z.ZodOptional<z.ZodString>;
328
+ }, z.core.$strict>, z.ZodObject<{
329
+ type: z.ZodLiteral<"glob">;
330
+ display: z.ZodOptional<z.ZodObject<{
331
+ hidden: z.ZodOptional<z.ZodBoolean>;
332
+ order: z.ZodOptional<z.ZodNumber>;
333
+ }, z.core.$strict>>;
334
+ multiple: z.ZodOptional<z.ZodBoolean>;
335
+ path_class: z.ZodOptional<z.ZodString>;
336
+ }, z.core.$strict>, z.ZodObject<{
337
+ type: z.ZodLiteral<"date">;
338
+ display: z.ZodOptional<z.ZodObject<{
339
+ hidden: z.ZodOptional<z.ZodBoolean>;
340
+ order: z.ZodOptional<z.ZodNumber>;
341
+ }, z.core.$strict>>;
342
+ multiple: z.ZodOptional<z.ZodBoolean>;
343
+ path_class: z.ZodOptional<z.ZodString>;
344
+ }, z.core.$strict>, z.ZodObject<{
345
+ type: z.ZodLiteral<"date_time">;
346
+ display: z.ZodOptional<z.ZodObject<{
347
+ hidden: z.ZodOptional<z.ZodBoolean>;
348
+ order: z.ZodOptional<z.ZodNumber>;
349
+ }, z.core.$strict>>;
350
+ multiple: z.ZodOptional<z.ZodBoolean>;
351
+ path_class: z.ZodOptional<z.ZodString>;
352
+ }, z.core.$strict>], "type">>>;
353
+ include: z.ZodDefault<z.ZodArray<z.ZodString>>;
354
+ mappings: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
355
+ emit: z.ZodOptional<z.ZodObject<{
356
+ relation: z.ZodString;
357
+ target: z.ZodEnum<{
358
+ path: "path";
359
+ value: "value";
360
+ }>;
361
+ target_class: z.ZodString;
362
+ }, z.core.$strict>>;
363
+ node: z.ZodOptional<z.ZodObject<{
364
+ class: z.ZodString;
365
+ field: z.ZodString;
366
+ key: z.ZodOptional<z.ZodEnum<{
367
+ path: "path";
368
+ value: "value";
369
+ }>>;
370
+ }, z.core.$strict>>;
371
+ }, z.core.$strict>>>;
372
+ path_classes: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
373
+ prefixes: z.ZodArray<z.ZodString>;
374
+ }, z.core.$strict>>>;
375
+ queries: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<{
376
+ where: z.ZodString;
377
+ }, z.core.$strict>>>;
378
+ relations: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
379
+ builtin: z.ZodOptional<z.ZodBoolean>;
380
+ from: z.ZodArray<z.ZodString>;
381
+ to: z.ZodArray<z.ZodString>;
382
+ }, z.core.$strict>>>;
383
+ }, z.core.$strict>;
384
+ export {};
@@ -0,0 +1,45 @@
1
+ export type StoredQueryConfig = import('./load-patram-config.js').StoredQueryConfig;
2
+ export type FieldDisplayConfig = import('./load-patram-config.js').FieldDisplayConfig;
3
+ export type FieldQueryConfig = import('./load-patram-config.js').FieldQueryConfig;
4
+ export type FieldValueTypeName = import('./load-patram-config.js').MetadataFieldConfig['type'];
5
+ export type MetadataFieldConfig = import('./load-patram-config.js').MetadataFieldConfig;
6
+ export type StringFieldConfig = Extract<MetadataFieldConfig, {
7
+ type: 'string';
8
+ }>;
9
+ export type IntegerFieldConfig = Extract<MetadataFieldConfig, {
10
+ type: 'integer';
11
+ }>;
12
+ export type EnumFieldConfig = Extract<MetadataFieldConfig, {
13
+ type: 'enum';
14
+ }>;
15
+ export type PathFieldConfig = Extract<MetadataFieldConfig, {
16
+ type: 'path';
17
+ }>;
18
+ export type GlobFieldConfig = Extract<MetadataFieldConfig, {
19
+ type: 'glob';
20
+ }>;
21
+ export type DateFieldConfig = Extract<MetadataFieldConfig, {
22
+ type: 'date';
23
+ }>;
24
+ export type DateTimeFieldConfig = Extract<MetadataFieldConfig, {
25
+ type: 'date_time';
26
+ }>;
27
+ export type ClassFieldRuleConfig = import('./load-patram-config.js').ClassFieldRuleConfig;
28
+ export type DirectiveTypeConfig = MetadataFieldConfig;
29
+ export type MetadataDirectiveRuleConfig = ClassFieldRuleConfig;
30
+ export type ClassSchemaConfig = import('./load-patram-config.js').ClassSchemaConfig;
31
+ export type MetadataSchemaConfig = ClassSchemaConfig;
32
+ export type PathClassConfig = import('./load-patram-config.js').PathClassConfig;
33
+ export type DerivedSummaryScalar = import('./load-patram-config.js').DerivedSummaryScalar;
34
+ export type DerivedSummarySelectCaseConfig = import('./load-patram-config.js').DerivedSummarySelectCaseConfig;
35
+ export type DerivedSummaryFieldConfig = import('./load-patram-config.js').DerivedSummaryFieldConfig;
36
+ export type DerivedSummaryCountFieldConfig = Extract<DerivedSummaryFieldConfig, {
37
+ count: unknown;
38
+ }>;
39
+ export type DerivedSummarySelectFieldConfig = Extract<DerivedSummaryFieldConfig, {
40
+ select: unknown;
41
+ }>;
42
+ export type DerivedSummaryConfig = import('./load-patram-config.js').DerivedSummaryConfig;
43
+ export type PatramRepoConfig = import('./load-patram-config.js').PatramRepoConfig;
44
+ export type PatramDiagnostic = import('./load-patram-config.js').PatramDiagnostic;
45
+ export type LoadPatramConfigResult = import('./load-patram-config.js').LoadPatramConfigResult;
@@ -0,0 +1,35 @@
1
+ /**
2
+ * Project graph loading pipeline.
3
+ *
4
+ * Loads config, scans source files, parses claims, and materializes the graph
5
+ * used by CLI commands.
6
+ *
7
+ * Kind: graph
8
+ * Status: active
9
+ * Uses Term: ../docs/reference/terms/claim.md
10
+ * Uses Term: ../docs/reference/terms/graph.md
11
+ * Uses Term: ../docs/reference/terms/mapping.md
12
+ * Tracked in: ../docs/plans/v0/source-anchor-dogfooding.md
13
+ * Decided by: ../docs/decisions/dogfood-query-graph-v0.md
14
+ * @patram
15
+ * @see {@link ./parse-claims.js}
16
+ * @see {@link ./build-graph.js}
17
+ */
18
+ /**
19
+ * Load config, source files, claims, and the materialized graph for one
20
+ * project directory.
21
+ *
22
+ * @param {string} project_directory
23
+ * @returns {Promise<{ claims: PatramClaim[], config: PatramRepoConfig, diagnostics: PatramDiagnostic[], graph: BuildGraphResult, source_file_paths: string[] }>}
24
+ */
25
+ export function loadProjectGraph(project_directory: string): Promise<{
26
+ claims: PatramClaim[];
27
+ config: PatramRepoConfig;
28
+ diagnostics: PatramDiagnostic[];
29
+ graph: BuildGraphResult;
30
+ source_file_paths: string[];
31
+ }>;
32
+ import type { PatramClaim } from './parse-claims.types.ts';
33
+ import type { PatramRepoConfig } from './load-patram-config.types.ts';
34
+ import type { PatramDiagnostic } from './load-patram-config.types.ts';
35
+ import type { BuildGraphResult } from './build-graph.types.ts';
@@ -0,0 +1,88 @@
1
+ export type OutputDerivedValue = boolean | number | string | null;
2
+ export interface OutputDerivedField {
3
+ name: string;
4
+ value: OutputDerivedValue;
5
+ }
6
+ export interface OutputDerivedSummary {
7
+ fields: OutputDerivedField[];
8
+ name: string;
9
+ }
10
+ export interface OutputMetadataField {
11
+ name: string;
12
+ value: string | string[];
13
+ }
14
+ export interface OutputViewSummary {
15
+ count: number;
16
+ kind: 'incoming_reference_list' | 'resolved_link_list' | 'result_list' | 'stored_query_list';
17
+ }
18
+ export interface QueryOutputViewSummary extends OutputViewSummary {
19
+ kind: 'result_list';
20
+ limit: number;
21
+ offset: number;
22
+ total_count: number;
23
+ }
24
+ export interface OutputNodeItem {
25
+ derived_summary?: OutputDerivedSummary;
26
+ fields: Record<string, string | string[]>;
27
+ id: string;
28
+ kind: 'node';
29
+ node_kind: string;
30
+ path?: string;
31
+ title: string;
32
+ visible_fields: OutputMetadataField[];
33
+ }
34
+ export interface OutputStoredQueryItem {
35
+ kind: 'stored_query';
36
+ name: string;
37
+ where: string;
38
+ }
39
+ export interface OutputResolvedLinkTarget {
40
+ derived_summary?: OutputDerivedSummary;
41
+ fields: Record<string, string | string[]>;
42
+ id: string;
43
+ kind: string;
44
+ path?: string;
45
+ title: string;
46
+ visible_fields: OutputMetadataField[];
47
+ }
48
+ export interface OutputResolvedLinkItem {
49
+ kind: 'resolved_link';
50
+ label: string;
51
+ reference: number;
52
+ target: OutputResolvedLinkTarget;
53
+ }
54
+ export interface QueryOutputView {
55
+ command: 'query';
56
+ hints: string[];
57
+ items: OutputNodeItem[];
58
+ summary: QueryOutputViewSummary;
59
+ }
60
+ export interface QueriesOutputView {
61
+ command: 'queries';
62
+ hints: string[];
63
+ items: OutputStoredQueryItem[];
64
+ summary: OutputViewSummary;
65
+ }
66
+ export interface ShowOutputView {
67
+ command: 'show';
68
+ document?: OutputNodeItem;
69
+ hints: string[];
70
+ incoming_summary: Record<string, number>;
71
+ items: OutputResolvedLinkItem[];
72
+ path: string;
73
+ rendered_source: string;
74
+ source: string;
75
+ summary: OutputViewSummary;
76
+ }
77
+ export interface RefsOutputView {
78
+ command: 'refs';
79
+ hints: string[];
80
+ incoming: Record<string, OutputNodeItem[]>;
81
+ node: OutputNodeItem;
82
+ summary: OutputViewSummary;
83
+ }
84
+ export type OutputView = QueryOutputView | QueriesOutputView | RefsOutputView | ShowOutputView;
85
+ export interface ResolvedOutputMode {
86
+ color_enabled: boolean;
87
+ renderer_name: 'json' | 'plain' | 'rich';
88
+ }
@@ -19,7 +19,11 @@ export interface OutputMetadataField {
19
19
 
20
20
  export interface OutputViewSummary {
21
21
  count: number;
22
- kind: 'resolved_link_list' | 'result_list' | 'stored_query_list';
22
+ kind:
23
+ | 'incoming_reference_list'
24
+ | 'resolved_link_list'
25
+ | 'result_list'
26
+ | 'stored_query_list';
23
27
  }
24
28
 
25
29
  export interface QueryOutputViewSummary extends OutputViewSummary {
@@ -81,6 +85,7 @@ export interface ShowOutputView {
81
85
  command: 'show';
82
86
  document?: OutputNodeItem;
83
87
  hints: string[];
88
+ incoming_summary: Record<string, number>;
84
89
  items: OutputResolvedLinkItem[];
85
90
  path: string;
86
91
  rendered_source: string;
@@ -88,7 +93,19 @@ export interface ShowOutputView {
88
93
  summary: OutputViewSummary;
89
94
  }
90
95
 
91
- export type OutputView = QueryOutputView | QueriesOutputView | ShowOutputView;
96
+ export interface RefsOutputView {
97
+ command: 'refs';
98
+ hints: string[];
99
+ incoming: Record<string, OutputNodeItem[]>;
100
+ node: OutputNodeItem;
101
+ summary: OutputViewSummary;
102
+ }
103
+
104
+ export type OutputView =
105
+ | QueryOutputView
106
+ | QueriesOutputView
107
+ | RefsOutputView
108
+ | ShowOutputView;
92
109
 
93
110
  export interface ResolvedOutputMode {
94
111
  color_enabled: boolean;
@@ -0,0 +1,43 @@
1
+ /**
2
+ * @import { BuildGraphResult, GraphEdge, GraphNode } from './build-graph.types.ts';
3
+ */
4
+ /**
5
+ * @typedef {{
6
+ * document_node_ids?: BuildGraphResult['document_node_ids'],
7
+ * edges?: GraphEdge[],
8
+ * nodes?: GraphNode[] | Record<string, GraphNode>,
9
+ * }} GraphOverlay
10
+ */
11
+ /**
12
+ * Graph overlay composition.
13
+ *
14
+ * Composes transient nodes and edges onto an existing Patram graph while
15
+ * preserving the graph shape expected by query and document resolution
16
+ * helpers.
17
+ *
18
+ * Kind: graph
19
+ * Status: active
20
+ * Uses Term: ../docs/reference/terms/document.md
21
+ * Uses Term: ../docs/reference/terms/graph.md
22
+ * Tracked in: ../docs/plans/v0/package-graph-overlay-helper.md
23
+ * Decided by: ../docs/decisions/package-graph-overlay-helper.md
24
+ * @patram
25
+ * @see {@link ./query-graph.js}
26
+ * @see {@link ../docs/decisions/package-graph-overlay-helper.md}
27
+ */
28
+ /**
29
+ * Compose additional nodes and edges onto a loaded Patram graph.
30
+ *
31
+ * @param {BuildGraphResult} base_graph
32
+ * @param {GraphOverlay} [graph_overlay]
33
+ * @returns {BuildGraphResult}
34
+ */
35
+ export function overlayGraph(base_graph: BuildGraphResult, graph_overlay?: GraphOverlay): BuildGraphResult;
36
+ export type GraphOverlay = {
37
+ document_node_ids?: BuildGraphResult["document_node_ids"];
38
+ edges?: GraphEdge[];
39
+ nodes?: GraphNode[] | Record<string, GraphNode>;
40
+ };
41
+ import type { BuildGraphResult } from './build-graph.types.ts';
42
+ import type { GraphEdge } from './build-graph.types.ts';
43
+ import type { GraphNode } from './build-graph.types.ts';