domain-knowledge-kit 0.1.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 (142) hide show
  1. package/LICENSE +94 -0
  2. package/README.md +266 -0
  3. package/dist/cli.d.ts +3 -0
  4. package/dist/cli.d.ts.map +1 -0
  5. package/dist/cli.js +40 -0
  6. package/dist/cli.js.map +1 -0
  7. package/dist/features/adr/commands/adr-related.d.ts +14 -0
  8. package/dist/features/adr/commands/adr-related.d.ts.map +1 -0
  9. package/dist/features/adr/commands/adr-related.js +146 -0
  10. package/dist/features/adr/commands/adr-related.js.map +1 -0
  11. package/dist/features/adr/commands/adr-show.d.ts +10 -0
  12. package/dist/features/adr/commands/adr-show.d.ts.map +1 -0
  13. package/dist/features/adr/commands/adr-show.js +30 -0
  14. package/dist/features/adr/commands/adr-show.js.map +1 -0
  15. package/dist/features/pipeline/commands/render.d.ts +10 -0
  16. package/dist/features/pipeline/commands/render.d.ts.map +1 -0
  17. package/dist/features/pipeline/commands/render.js +71 -0
  18. package/dist/features/pipeline/commands/render.js.map +1 -0
  19. package/dist/features/pipeline/commands/validate.d.ts +10 -0
  20. package/dist/features/pipeline/commands/validate.d.ts.map +1 -0
  21. package/dist/features/pipeline/commands/validate.js +48 -0
  22. package/dist/features/pipeline/commands/validate.js.map +1 -0
  23. package/dist/features/pipeline/indexer.d.ts +36 -0
  24. package/dist/features/pipeline/indexer.d.ts.map +1 -0
  25. package/dist/features/pipeline/indexer.js +279 -0
  26. package/dist/features/pipeline/indexer.js.map +1 -0
  27. package/dist/features/pipeline/renderer.d.ts +42 -0
  28. package/dist/features/pipeline/renderer.d.ts.map +1 -0
  29. package/dist/features/pipeline/renderer.js +239 -0
  30. package/dist/features/pipeline/renderer.js.map +1 -0
  31. package/dist/features/pipeline/tests/indexer.test.d.ts +2 -0
  32. package/dist/features/pipeline/tests/indexer.test.d.ts.map +1 -0
  33. package/dist/features/pipeline/tests/indexer.test.js +224 -0
  34. package/dist/features/pipeline/tests/indexer.test.js.map +1 -0
  35. package/dist/features/pipeline/tests/renderer.test.d.ts +2 -0
  36. package/dist/features/pipeline/tests/renderer.test.d.ts.map +1 -0
  37. package/dist/features/pipeline/tests/renderer.test.js +252 -0
  38. package/dist/features/pipeline/tests/renderer.test.js.map +1 -0
  39. package/dist/features/pipeline/tests/validate-schemas.test.d.ts +2 -0
  40. package/dist/features/pipeline/tests/validate-schemas.test.d.ts.map +1 -0
  41. package/dist/features/pipeline/tests/validate-schemas.test.js +183 -0
  42. package/dist/features/pipeline/tests/validate-schemas.test.js.map +1 -0
  43. package/dist/features/pipeline/tests/validator.test.d.ts +2 -0
  44. package/dist/features/pipeline/tests/validator.test.d.ts.map +1 -0
  45. package/dist/features/pipeline/tests/validator.test.js +371 -0
  46. package/dist/features/pipeline/tests/validator.test.js.map +1 -0
  47. package/dist/features/pipeline/validator.d.ts +44 -0
  48. package/dist/features/pipeline/validator.d.ts.map +1 -0
  49. package/dist/features/pipeline/validator.js +289 -0
  50. package/dist/features/pipeline/validator.js.map +1 -0
  51. package/dist/features/query/commands/list.d.ts +10 -0
  52. package/dist/features/query/commands/list.d.ts.map +1 -0
  53. package/dist/features/query/commands/list.js +123 -0
  54. package/dist/features/query/commands/list.js.map +1 -0
  55. package/dist/features/query/commands/related.d.ts +10 -0
  56. package/dist/features/query/commands/related.d.ts.map +1 -0
  57. package/dist/features/query/commands/related.js +61 -0
  58. package/dist/features/query/commands/related.js.map +1 -0
  59. package/dist/features/query/commands/search.d.ts +10 -0
  60. package/dist/features/query/commands/search.d.ts.map +1 -0
  61. package/dist/features/query/commands/search.js +55 -0
  62. package/dist/features/query/commands/search.js.map +1 -0
  63. package/dist/features/query/commands/show.d.ts +10 -0
  64. package/dist/features/query/commands/show.d.ts.map +1 -0
  65. package/dist/features/query/commands/show.js +96 -0
  66. package/dist/features/query/commands/show.js.map +1 -0
  67. package/dist/features/query/searcher.d.ts +58 -0
  68. package/dist/features/query/searcher.d.ts.map +1 -0
  69. package/dist/features/query/searcher.js +185 -0
  70. package/dist/features/query/searcher.js.map +1 -0
  71. package/dist/features/query/tests/searcher.test.d.ts +2 -0
  72. package/dist/features/query/tests/searcher.test.d.ts.map +1 -0
  73. package/dist/features/query/tests/searcher.test.js +320 -0
  74. package/dist/features/query/tests/searcher.test.js.map +1 -0
  75. package/dist/shared/adr-parser.d.ts +14 -0
  76. package/dist/shared/adr-parser.d.ts.map +1 -0
  77. package/dist/shared/adr-parser.js +72 -0
  78. package/dist/shared/adr-parser.js.map +1 -0
  79. package/dist/shared/errors.d.ts +43 -0
  80. package/dist/shared/errors.d.ts.map +1 -0
  81. package/dist/shared/errors.js +60 -0
  82. package/dist/shared/errors.js.map +1 -0
  83. package/dist/shared/graph.d.ts +71 -0
  84. package/dist/shared/graph.d.ts.map +1 -0
  85. package/dist/shared/graph.js +250 -0
  86. package/dist/shared/graph.js.map +1 -0
  87. package/dist/shared/index.d.ts +16 -0
  88. package/dist/shared/index.d.ts.map +1 -0
  89. package/dist/shared/index.js +24 -0
  90. package/dist/shared/index.js.map +1 -0
  91. package/dist/shared/item-visitor.d.ts +62 -0
  92. package/dist/shared/item-visitor.d.ts.map +1 -0
  93. package/dist/shared/item-visitor.js +95 -0
  94. package/dist/shared/item-visitor.js.map +1 -0
  95. package/dist/shared/loader.d.ts +19 -0
  96. package/dist/shared/loader.d.ts.map +1 -0
  97. package/dist/shared/loader.js +166 -0
  98. package/dist/shared/loader.js.map +1 -0
  99. package/dist/shared/paths.d.ts +32 -0
  100. package/dist/shared/paths.d.ts.map +1 -0
  101. package/dist/shared/paths.js +62 -0
  102. package/dist/shared/paths.js.map +1 -0
  103. package/dist/shared/tests/graph.test.d.ts +2 -0
  104. package/dist/shared/tests/graph.test.d.ts.map +1 -0
  105. package/dist/shared/tests/graph.test.js +291 -0
  106. package/dist/shared/tests/graph.test.js.map +1 -0
  107. package/dist/shared/tests/loader.test.d.ts +2 -0
  108. package/dist/shared/tests/loader.test.d.ts.map +1 -0
  109. package/dist/shared/tests/loader.test.js +239 -0
  110. package/dist/shared/tests/loader.test.js.map +1 -0
  111. package/dist/shared/tests/verify-collision-fix.test.d.ts +2 -0
  112. package/dist/shared/tests/verify-collision-fix.test.d.ts.map +1 -0
  113. package/dist/shared/tests/verify-collision-fix.test.js +114 -0
  114. package/dist/shared/tests/verify-collision-fix.test.js.map +1 -0
  115. package/dist/shared/types/domain.d.ts +244 -0
  116. package/dist/shared/types/domain.d.ts.map +1 -0
  117. package/dist/shared/types/domain.js +6 -0
  118. package/dist/shared/types/domain.js.map +1 -0
  119. package/dist/shared/types/index.d.ts +34 -0
  120. package/dist/shared/types/index.d.ts.map +1 -0
  121. package/dist/shared/types/index.js +9 -0
  122. package/dist/shared/types/index.js.map +1 -0
  123. package/dist/shared/yaml.d.ts +13 -0
  124. package/dist/shared/yaml.d.ts.map +1 -0
  125. package/dist/shared/yaml.js +29 -0
  126. package/dist/shared/yaml.js.map +1 -0
  127. package/package.json +48 -0
  128. package/tools/domain-pack/schema/.gitkeep +0 -0
  129. package/tools/domain-pack/schema/actors.schema.json +42 -0
  130. package/tools/domain-pack/schema/adr-frontmatter.schema.json +51 -0
  131. package/tools/domain-pack/schema/aggregate.schema.json +58 -0
  132. package/tools/domain-pack/schema/command.schema.json +76 -0
  133. package/tools/domain-pack/schema/context.schema.json +51 -0
  134. package/tools/domain-pack/schema/event.schema.json +66 -0
  135. package/tools/domain-pack/schema/glossary.schema.json +33 -0
  136. package/tools/domain-pack/schema/index.schema.json +76 -0
  137. package/tools/domain-pack/schema/policy.schema.json +53 -0
  138. package/tools/domain-pack/schema/read-model.schema.json +39 -0
  139. package/tools/domain-pack/templates/.gitkeep +0 -0
  140. package/tools/domain-pack/templates/context.md.hbs +89 -0
  141. package/tools/domain-pack/templates/index.md.hbs +60 -0
  142. package/tools/domain-pack/templates/item.md.hbs +85 -0
@@ -0,0 +1,53 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema#",
3
+ "$id": "policy.schema.json",
4
+ "title": "Policy",
5
+ "description": "A reactive policy that listens to events and emits commands",
6
+ "type": "object",
7
+ "properties": {
8
+ "name": {
9
+ "type": "string",
10
+ "pattern": "^[A-Za-z][A-Za-z0-9]*$",
11
+ "description": "PascalCase policy name (e.g. SendConfirmationEmail)"
12
+ },
13
+ "description": {
14
+ "type": "string",
15
+ "minLength": 1,
16
+ "description": "What this policy does in response to events"
17
+ },
18
+ "when": {
19
+ "type": "object",
20
+ "description": "Conditions that activate this policy",
21
+ "properties": {
22
+ "events": {
23
+ "type": "array",
24
+ "items": { "type": "string", "minLength": 1 },
25
+ "uniqueItems": true,
26
+ "description": "Event names that trigger this policy"
27
+ }
28
+ },
29
+ "additionalProperties": false
30
+ },
31
+ "then": {
32
+ "type": "object",
33
+ "description": "Actions taken by this policy",
34
+ "properties": {
35
+ "commands": {
36
+ "type": "array",
37
+ "items": { "type": "string", "minLength": 1 },
38
+ "uniqueItems": true,
39
+ "description": "Command names that this policy emits"
40
+ }
41
+ },
42
+ "additionalProperties": false
43
+ },
44
+ "adr_refs": {
45
+ "type": "array",
46
+ "items": { "type": "string", "pattern": "^adr-\\d{4}$" },
47
+ "uniqueItems": true,
48
+ "description": "Related ADR identifiers"
49
+ }
50
+ },
51
+ "required": ["name", "description"],
52
+ "additionalProperties": false
53
+ }
@@ -0,0 +1,39 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema#",
3
+ "$id": "read-model.schema.json",
4
+ "title": "Read Model",
5
+ "description": "A read model (projection) built from domain events",
6
+ "type": "object",
7
+ "properties": {
8
+ "name": {
9
+ "type": "string",
10
+ "pattern": "^[A-Za-z][A-Za-z0-9]*$",
11
+ "description": "PascalCase read model name (e.g. OrderSummary)"
12
+ },
13
+ "description": {
14
+ "type": "string",
15
+ "minLength": 1,
16
+ "description": "What data this read model exposes"
17
+ },
18
+ "subscribes_to": {
19
+ "type": "array",
20
+ "items": { "type": "string", "minLength": 1 },
21
+ "uniqueItems": true,
22
+ "description": "Event names this read model subscribes to"
23
+ },
24
+ "used_by": {
25
+ "type": "array",
26
+ "items": { "type": "string", "minLength": 1 },
27
+ "uniqueItems": true,
28
+ "description": "Actor names that consume this read model"
29
+ },
30
+ "adr_refs": {
31
+ "type": "array",
32
+ "items": { "type": "string", "pattern": "^adr-\\d{4}$" },
33
+ "uniqueItems": true,
34
+ "description": "Related ADR identifiers"
35
+ }
36
+ },
37
+ "required": ["name", "description"],
38
+ "additionalProperties": false
39
+ }
File without changes
@@ -0,0 +1,89 @@
1
+ # {{name}}
2
+
3
+ > Auto-generated — do not edit manually. Run `domain-knowledge-kit render` to regenerate.
4
+
5
+ {{description}}
6
+
7
+ ## Glossary
8
+
9
+ {{#if glossary}}
10
+ | Term | Definition | Aliases |
11
+ |------|------------|---------|
12
+ {{#each glossary}}
13
+ | **{{term}}** | {{definition}} | {{#if aliases}}{{join aliases ", "}}{{else}}—{{/if}} |
14
+ {{/each}}
15
+ {{else}}
16
+ _No glossary entries._
17
+ {{/if}}
18
+
19
+ ## Events
20
+
21
+ {{#if events}}
22
+ | Event | Description | Raised By | Fields |
23
+ |-------|-------------|-----------|--------|
24
+ {{#each events}}
25
+ | [{{name}}]({{name}}.md) | {{description}} | {{#if raised_by}}`{{raised_by}}`{{else}}—{{/if}} | {{#if fields}}{{fieldSummary fields}}{{else}}—{{/if}} |
26
+ {{/each}}
27
+ {{else}}
28
+ _No events._
29
+ {{/if}}
30
+
31
+ ## Commands
32
+
33
+ {{#if commands}}
34
+ | Command | Description | Actor | Handled By | Fields |
35
+ |---------|-------------|-------|------------|--------|
36
+ {{#each commands}}
37
+ | [{{name}}]({{name}}.md) | {{description}} | {{#if actor}}`{{actor}}`{{else}}—{{/if}} | {{#if handled_by}}`{{handled_by}}`{{else}}—{{/if}} | {{#if fields}}{{fieldSummary fields}}{{else}}—{{/if}} |
38
+ {{/each}}
39
+ {{else}}
40
+ _No commands._
41
+ {{/if}}
42
+
43
+ ## Policies
44
+
45
+ {{#if policies}}
46
+ | Policy | Description | Triggers | Emits |
47
+ |--------|-------------|----------|-------|
48
+ {{#each policies}}
49
+ | [{{name}}]({{name}}.md) | {{description}} | {{#if when.events}}{{join when.events ", "}}{{else}}—{{/if}} | {{#if then.commands}}{{join then.commands ", "}}{{else}}—{{/if}} |
50
+ {{/each}}
51
+ {{else}}
52
+ _No policies._
53
+ {{/if}}
54
+
55
+ ## Aggregates
56
+
57
+ {{#if aggregates}}
58
+ | Aggregate | Description | Handles | Emits |
59
+ |-----------|-------------|---------|-------|
60
+ {{#each aggregates}}
61
+ | [{{name}}]({{name}}.md) | {{description}} | {{#if handles.commands}}{{join handles.commands ", "}}{{else}}—{{/if}} | {{#if emits.events}}{{join emits.events ", "}}{{else}}—{{/if}} |
62
+ {{/each}}
63
+ {{else}}
64
+ _No aggregates._
65
+ {{/if}}
66
+
67
+ ## Read Models
68
+
69
+ {{#if read_models}}
70
+ | Read Model | Description | Subscribes To | Used By |
71
+ |------------|-------------|---------------|---------|
72
+ {{#each read_models}}
73
+ | [{{name}}]({{name}}.md) | {{description}} | {{#if subscribes_to}}{{join subscribes_to ", "}}{{else}}—{{/if}} | {{#if used_by}}{{join used_by ", "}}{{else}}—{{/if}} |
74
+ {{/each}}
75
+ {{else}}
76
+ _No read models._
77
+ {{/if}}
78
+
79
+ ## Linked ADRs
80
+
81
+ {{#if adrs}}
82
+ | ADR | Title | Status |
83
+ |-----|-------|--------|
84
+ {{#each adrs}}
85
+ | {{id}} | {{title}} | {{status}} |
86
+ {{/each}}
87
+ {{else}}
88
+ _No linked ADRs._
89
+ {{/if}}
@@ -0,0 +1,60 @@
1
+ # Domain Knowledge Index
2
+
3
+ > Auto-generated — do not edit manually. Run `domain-knowledge-kit render` to regenerate.
4
+
5
+ ## Bounded Contexts
6
+
7
+ {{#if contexts}}
8
+ | Context | Description |
9
+ |---------|-------------|
10
+ {{#each contexts}}
11
+ | [{{name}}]({{name}}/index.md) | {{description}} |
12
+ {{/each}}
13
+ {{else}}
14
+ _No bounded contexts registered._
15
+ {{/if}}
16
+
17
+ ## Actors
18
+
19
+ {{#if actors}}
20
+ | Actor | Type | Description |
21
+ |-------|------|-------------|
22
+ {{#each actors}}
23
+ | {{name}} | {{type}} | {{description}} |
24
+ {{/each}}
25
+ {{else}}
26
+ _No actors defined._
27
+ {{/if}}
28
+
29
+ ## Glossary Index
30
+
31
+ {{#if glossaryEntries}}
32
+ | Term | Context | Definition |
33
+ |------|---------|------------|
34
+ {{#each glossaryEntries}}
35
+ | {{term}} | [{{context}}]({{context}}/index.md) | {{definition}} |
36
+ {{/each}}
37
+ {{else}}
38
+ _No glossary entries._
39
+ {{/if}}
40
+
41
+ ## Key Flows
42
+
43
+ {{#if flows}}
44
+ {{#each flows}}
45
+ ### {{name}}
46
+
47
+ {{#if description}}
48
+ {{description}}
49
+ {{/if}}
50
+
51
+ | # | Step | Type |
52
+ |---|------|------|
53
+ {{#each steps}}
54
+ | {{stepNumber}} | `{{ref}}` | {{type}} |
55
+ {{/each}}
56
+
57
+ {{/each}}
58
+ {{else}}
59
+ _No cross-context flows defined._
60
+ {{/if}}
@@ -0,0 +1,85 @@
1
+ # {{name}}
2
+
3
+ > Auto-generated — do not edit manually. Run `domain-knowledge-kit render` to regenerate.
4
+
5
+ **Type:** {{itemType}} · **Context:** [{{context}}](index.md)
6
+
7
+ ## Summary
8
+
9
+ {{description}}
10
+
11
+ {{#if meaning}}
12
+ ## Meaning
13
+
14
+ {{meaning}}
15
+ {{/if}}
16
+
17
+ {{#if fields}}
18
+ ## Fields
19
+
20
+ | Name | Type | Description |
21
+ |------|------|-------------|
22
+ {{#each fields}}
23
+ | `{{name}}` | `{{type}}` | {{#if description}}{{description}}{{else}}—{{/if}} |
24
+ {{/each}}
25
+ {{/if}}
26
+
27
+ {{#if rules}}
28
+ ## Rules & Invariants
29
+
30
+ {{#each rules}}
31
+ - {{this}}
32
+ {{/each}}
33
+ {{/if}}
34
+
35
+ {{#if examples}}
36
+ ## Examples
37
+
38
+ {{#each examples}}
39
+ ### {{description}}
40
+
41
+ {{#if given}}
42
+ **Given:**
43
+ {{#each given}}
44
+ - {{this}}
45
+ {{/each}}
46
+ {{/if}}
47
+ {{#if when}}
48
+ **When:**
49
+ {{#each when}}
50
+ - {{this}}
51
+ {{/each}}
52
+ {{/if}}
53
+ {{#if then}}
54
+ **Then:**
55
+ {{#each then}}
56
+ - {{this}}
57
+ {{/each}}
58
+ {{/if}}
59
+
60
+ {{/each}}
61
+ {{/if}}
62
+
63
+ ## Relationships
64
+
65
+ {{#if relationships}}
66
+ | Relationship | Target |
67
+ |-------------|--------|
68
+ {{#each relationships}}
69
+ | {{label}} | `{{target}}` |
70
+ {{/each}}
71
+ {{else}}
72
+ _No relationships._
73
+ {{/if}}
74
+
75
+ ## Linked ADRs
76
+
77
+ {{#if adr_refs}}
78
+ | ADR |
79
+ |-----|
80
+ {{#each adr_refs}}
81
+ | {{this}} |
82
+ {{/each}}
83
+ {{else}}
84
+ _No linked ADRs._
85
+ {{/if}}