patram 0.11.0 → 0.12.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 (110) hide show
  1. package/bin/patram.js +4 -4
  2. package/lib/cli/commands/fields.js +0 -4
  3. package/lib/cli/commands/queries.js +10 -20
  4. package/lib/cli/commands/query.js +1 -8
  5. package/lib/cli/commands/refs.js +3 -10
  6. package/lib/cli/commands/show.js +1 -8
  7. package/lib/cli/help-metadata.js +71 -106
  8. package/lib/cli/main.js +10 -10
  9. package/lib/cli/parse-arguments-helpers.js +165 -59
  10. package/lib/cli/parse-arguments.js +4 -4
  11. package/lib/cli/render-help.js +2 -2
  12. package/lib/config/defaults.js +33 -25
  13. package/lib/config/load-patram-config.d.ts +8 -33
  14. package/lib/config/load-patram-config.js +9 -33
  15. package/lib/config/load-patram-config.types.d.ts +3 -40
  16. package/lib/config/manage-stored-queries-helpers.d.ts +4 -4
  17. package/lib/config/manage-stored-queries-helpers.js +91 -33
  18. package/lib/config/manage-stored-queries.d.ts +4 -4
  19. package/lib/config/manage-stored-queries.js +11 -5
  20. package/lib/config/patram-config.d.ts +34 -34
  21. package/lib/config/patram-config.js +3 -3
  22. package/lib/config/patram-config.types.d.ts +5 -11
  23. package/lib/config/resolve-patram-graph-config.d.ts +5 -1
  24. package/lib/config/resolve-patram-graph-config.js +3 -119
  25. package/lib/config/schema.d.ts +158 -269
  26. package/lib/config/schema.js +72 -210
  27. package/lib/config/validate-patram-config-value.js +6 -31
  28. package/lib/config/validation.d.ts +2 -12
  29. package/lib/config/validation.js +125 -483
  30. package/lib/find-close-match.d.ts +4 -1
  31. package/lib/graph/build-graph-identity.d.ts +1 -32
  32. package/lib/graph/build-graph-identity.js +5 -269
  33. package/lib/graph/build-graph.d.ts +13 -4
  34. package/lib/graph/build-graph.js +347 -488
  35. package/lib/graph/build-graph.types.d.ts +8 -9
  36. package/lib/graph/check-directive-metadata-helpers.d.ts +30 -0
  37. package/lib/graph/check-directive-metadata-helpers.js +126 -0
  38. package/lib/graph/check-directive-metadata.d.ts +8 -9
  39. package/lib/graph/check-directive-metadata.js +70 -561
  40. package/lib/graph/check-directive-path-target.d.ts +6 -13
  41. package/lib/graph/check-directive-path-target.js +26 -57
  42. package/lib/graph/check-directive-value.d.ts +1 -5
  43. package/lib/graph/check-directive-value.js +40 -180
  44. package/lib/graph/check-graph.d.ts +5 -5
  45. package/lib/graph/check-graph.js +8 -6
  46. package/lib/graph/document-node-identity.d.ts +23 -7
  47. package/lib/graph/document-node-identity.js +417 -160
  48. package/lib/graph/graph-node.d.ts +42 -0
  49. package/lib/graph/graph-node.js +83 -0
  50. package/lib/graph/inspect-reverse-references.js +16 -11
  51. package/lib/graph/load-project-graph.d.ts +7 -7
  52. package/lib/graph/load-project-graph.js +7 -7
  53. package/lib/graph/parse-where-clause.types.d.ts +3 -2
  54. package/lib/graph/query/cypher-reader.d.ts +59 -0
  55. package/lib/graph/query/cypher-reader.js +151 -0
  56. package/lib/graph/query/cypher-support.d.ts +79 -0
  57. package/lib/graph/query/cypher-support.js +213 -0
  58. package/lib/graph/query/cypher-tokenize.d.ts +13 -0
  59. package/lib/graph/query/cypher-tokenize.js +225 -0
  60. package/lib/graph/query/cypher.types.d.ts +43 -0
  61. package/lib/graph/query/execute.d.ts +7 -7
  62. package/lib/graph/query/execute.js +71 -33
  63. package/lib/graph/query/inspect.js +58 -24
  64. package/lib/graph/query/parse-cypher-patterns.d.ts +27 -0
  65. package/lib/graph/query/parse-cypher-patterns.js +382 -0
  66. package/lib/graph/query/parse-cypher.d.ts +7 -0
  67. package/lib/graph/query/parse-cypher.js +580 -0
  68. package/lib/graph/query/parse-query.d.ts +13 -0
  69. package/lib/graph/query/parse-query.js +97 -0
  70. package/lib/graph/query/resolve.js +77 -23
  71. package/lib/output/command-output.js +12 -5
  72. package/lib/output/compact-layout.js +221 -0
  73. package/lib/output/format-output-item-block.js +31 -1
  74. package/lib/output/format-output-metadata.js +16 -29
  75. package/lib/output/format-stored-query-block.js +95 -0
  76. package/lib/output/layout-incoming-references.js +101 -19
  77. package/lib/output/layout-stored-queries.js +23 -330
  78. package/lib/output/list-queries.js +1 -1
  79. package/lib/output/render-field-discovery.js +11 -2
  80. package/lib/output/render-output-view.js +9 -5
  81. package/lib/output/renderers/json.js +5 -26
  82. package/lib/output/renderers/plain.js +155 -35
  83. package/lib/output/renderers/rich.js +250 -36
  84. package/lib/output/resolved-link-layout.js +43 -0
  85. package/lib/output/rich-source/render.js +193 -35
  86. package/lib/output/show-document.js +25 -18
  87. package/lib/output/view-model/index.js +124 -103
  88. package/lib/parse/jsdoc/parse-jsdoc-blocks.js +1 -1
  89. package/lib/parse/jsdoc/parse-jsdoc-claims.js +12 -6
  90. package/lib/parse/markdown/parse-markdown-claims.js +99 -62
  91. package/lib/parse/markdown/parse-markdown-directives.d.ts +10 -6
  92. package/lib/parse/markdown/parse-markdown-directives.js +104 -18
  93. package/lib/parse/markdown/parse-markdown-prose.d.ts +27 -0
  94. package/lib/parse/markdown/parse-markdown-prose.js +243 -0
  95. package/lib/parse/parse-claims.d.ts +2 -6
  96. package/lib/parse/parse-claims.js +11 -53
  97. package/lib/parse/tagged-fenced/tagged-fenced-blocks.d.ts +4 -4
  98. package/lib/parse/tagged-fenced/tagged-fenced-blocks.js +4 -4
  99. package/lib/parse/yaml/parse-yaml-claims.js +4 -4
  100. package/lib/patram.d.ts +3 -5
  101. package/lib/patram.js +1 -1
  102. package/lib/scan/discover-fields.js +194 -55
  103. package/lib/scan/list-source-files.d.ts +4 -4
  104. package/lib/scan/list-source-files.js +4 -4
  105. package/package.json +1 -1
  106. package/lib/directive-validation-test-helpers.js +0 -87
  107. package/lib/graph/query/parse.d.ts +0 -75
  108. package/lib/graph/query/parse.js +0 -1064
  109. package/lib/output/derived-summary.js +0 -280
  110. package/lib/output/format-derived-summary-row.js +0 -9
@@ -1,87 +0,0 @@
1
- /**
2
- * @import { MappingDefinition } from './config/patram-config.types.ts';
3
- */
4
-
5
- /**
6
- * @returns {Record<string, { prefixes: string[] }>}
7
- */
8
- export function createDirectivePathClasses() {
9
- return {
10
- decision_docs: {
11
- prefixes: ['docs/decisions/'],
12
- },
13
- plan_docs: {
14
- prefixes: ['docs/plans/'],
15
- },
16
- task_docs: {
17
- prefixes: ['docs/tasks/'],
18
- },
19
- };
20
- }
21
-
22
- /**
23
- * @returns {Record<string, { from: string[], to: string[] }>}
24
- */
25
- export function createDirectiveRelations() {
26
- return {
27
- decided_by: {
28
- from: ['document'],
29
- to: ['document'],
30
- },
31
- tracked_in: {
32
- from: ['document'],
33
- to: ['document'],
34
- },
35
- };
36
- }
37
-
38
- /**
39
- * @returns {Record<string, MappingDefinition>}
40
- */
41
- export function createMarkdownDirectiveMappings() {
42
- return {
43
- 'markdown.directive.decided_by': createRelationMapping('decided_by'),
44
- 'markdown.directive.kind': createNodeMapping('$class'),
45
- 'markdown.directive.status': createNodeMapping('status'),
46
- 'markdown.directive.tracked_in': createRelationMapping('tracked_in'),
47
- };
48
- }
49
-
50
- /**
51
- * @returns {Record<string, MappingDefinition>}
52
- */
53
- export function createJsdocDirectiveMappings() {
54
- return {
55
- 'jsdoc.directive.decided_by': createRelationMapping('decided_by'),
56
- 'jsdoc.directive.kind': createNodeMapping('$class'),
57
- 'jsdoc.directive.status': createNodeMapping('status'),
58
- 'jsdoc.directive.tracked_in': createRelationMapping('tracked_in'),
59
- };
60
- }
61
-
62
- /**
63
- * @param {string} field_name
64
- * @returns {MappingDefinition}
65
- */
66
- function createNodeMapping(field_name) {
67
- return {
68
- node: {
69
- class: 'document',
70
- field: field_name,
71
- },
72
- };
73
- }
74
-
75
- /**
76
- * @param {string} relation_name
77
- * @returns {MappingDefinition}
78
- */
79
- function createRelationMapping(relation_name) {
80
- return {
81
- emit: {
82
- relation: relation_name,
83
- target: 'path',
84
- target_class: 'document',
85
- },
86
- };
87
- }
@@ -1,75 +0,0 @@
1
- /**
2
- * @import { PatramDiagnostic } from '../../config/load-patram-config.types.d.ts';
3
- * @import {
4
- * ParseWhereClauseResult,
5
- * ParsedAggregateComparison,
6
- * ParsedAggregateName,
7
- * ParsedAggregateTerm,
8
- * ParsedExpression,
9
- * ParsedFieldName,
10
- * ParsedTerm,
11
- * ParsedTraversalTerm,
12
- * } from '../parse-where-clause.types.d.ts';
13
- */
14
- /**
15
- * @typedef {{ bindings: Record<string, string>, index: number, where_clause: string }} ParserState
16
- */
17
- /**
18
- * @typedef {{
19
- * diagnostic: PatramDiagnostic,
20
- * success: false,
21
- * }} ParseFailureResult
22
- */
23
- /**
24
- * @typedef {{
25
- * expression: ParsedExpression,
26
- * success: true,
27
- * } | ParseFailureResult} ParseExpressionResult
28
- */
29
- /**
30
- * @typedef {{
31
- * success: true,
32
- * term: ParsedTerm,
33
- * } | ParseFailureResult} ParseTermResult
34
- */
35
- /**
36
- * @typedef {{
37
- * success: true,
38
- * value: string,
39
- * } | ParseFailureResult} ParseValueResult
40
- */
41
- /**
42
- * Parse one where clause into a structured boolean expression.
43
- *
44
- * @param {string} where_clause
45
- * @param {{ bindings?: Record<string, string> }=} options
46
- * @returns {ParseWhereClauseResult}
47
- */
48
- export function parseWhereClause(where_clause: string, options?: {
49
- bindings?: Record<string, string>;
50
- } | undefined): ParseWhereClauseResult;
51
- export type ParserState = {
52
- bindings: Record<string, string>;
53
- index: number;
54
- where_clause: string;
55
- };
56
- export type ParseFailureResult = {
57
- diagnostic: PatramDiagnostic;
58
- success: false;
59
- };
60
- export type ParseExpressionResult = {
61
- expression: ParsedExpression;
62
- success: true;
63
- } | ParseFailureResult;
64
- export type ParseTermResult = {
65
- success: true;
66
- term: ParsedTerm;
67
- } | ParseFailureResult;
68
- export type ParseValueResult = {
69
- success: true;
70
- value: string;
71
- } | ParseFailureResult;
72
- import type { ParseWhereClauseResult } from '../parse-where-clause.types.d.ts';
73
- import type { PatramDiagnostic } from '../../config/load-patram-config.types.d.ts';
74
- import type { ParsedExpression } from '../parse-where-clause.types.d.ts';
75
- import type { ParsedTerm } from '../parse-where-clause.types.d.ts';