domain-knowledge-kit 0.2.14 → 0.2.16

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 (180) hide show
  1. package/.github/skills/{flow-implementer → dkk-flow-implementer}/skill.md +17 -8
  2. package/.github/skills/{story-analyst → dkk-story-analyst}/skill.md +23 -13
  3. package/README.md +5 -0
  4. package/dist/cli.js +20 -0
  5. package/dist/cli.js.map +1 -1
  6. package/dist/features/agent/commands/init.d.ts.map +1 -1
  7. package/dist/features/agent/commands/init.js +141 -3
  8. package/dist/features/agent/commands/init.js.map +1 -1
  9. package/dist/features/agent/commands/prime.d.ts +11 -0
  10. package/dist/features/agent/commands/prime.d.ts.map +1 -1
  11. package/dist/features/agent/commands/prime.js +122 -10
  12. package/dist/features/agent/commands/prime.js.map +1 -1
  13. package/dist/features/federation/commands/consumers.d.ts +40 -0
  14. package/dist/features/federation/commands/consumers.d.ts.map +1 -0
  15. package/dist/features/federation/commands/consumers.js +126 -0
  16. package/dist/features/federation/commands/consumers.js.map +1 -0
  17. package/dist/features/federation/commands/peers-add.d.ts +14 -0
  18. package/dist/features/federation/commands/peers-add.d.ts.map +1 -0
  19. package/dist/features/federation/commands/peers-add.js +79 -0
  20. package/dist/features/federation/commands/peers-add.js.map +1 -0
  21. package/dist/features/federation/commands/peers-list.d.ts +8 -0
  22. package/dist/features/federation/commands/peers-list.d.ts.map +1 -0
  23. package/dist/features/federation/commands/peers-list.js +51 -0
  24. package/dist/features/federation/commands/peers-list.js.map +1 -0
  25. package/dist/features/federation/commands/peers-status.d.ts +8 -0
  26. package/dist/features/federation/commands/peers-status.d.ts.map +1 -0
  27. package/dist/features/federation/commands/peers-status.js +78 -0
  28. package/dist/features/federation/commands/peers-status.js.map +1 -0
  29. package/dist/features/federation/commands/pull.d.ts +18 -0
  30. package/dist/features/federation/commands/pull.d.ts.map +1 -0
  31. package/dist/features/federation/commands/pull.js +153 -0
  32. package/dist/features/federation/commands/pull.js.map +1 -0
  33. package/dist/features/federation/git-fetcher.d.ts +45 -0
  34. package/dist/features/federation/git-fetcher.d.ts.map +1 -0
  35. package/dist/features/federation/git-fetcher.js +70 -0
  36. package/dist/features/federation/git-fetcher.js.map +1 -0
  37. package/dist/features/federation/loader.d.ts +60 -0
  38. package/dist/features/federation/loader.d.ts.map +1 -0
  39. package/dist/features/federation/loader.js +193 -0
  40. package/dist/features/federation/loader.js.map +1 -0
  41. package/dist/features/federation/lock.d.ts +12 -0
  42. package/dist/features/federation/lock.d.ts.map +1 -0
  43. package/dist/features/federation/lock.js +48 -0
  44. package/dist/features/federation/lock.js.map +1 -0
  45. package/dist/features/federation/tests/git-fetcher.test.d.ts +2 -0
  46. package/dist/features/federation/tests/git-fetcher.test.d.ts.map +1 -0
  47. package/dist/features/federation/tests/git-fetcher.test.js +167 -0
  48. package/dist/features/federation/tests/git-fetcher.test.js.map +1 -0
  49. package/dist/features/federation/tests/loader.test.d.ts +2 -0
  50. package/dist/features/federation/tests/loader.test.d.ts.map +1 -0
  51. package/dist/features/federation/tests/loader.test.js +144 -0
  52. package/dist/features/federation/tests/loader.test.js.map +1 -0
  53. package/dist/features/federation/tests/phase5.test.d.ts +2 -0
  54. package/dist/features/federation/tests/phase5.test.d.ts.map +1 -0
  55. package/dist/features/federation/tests/phase5.test.js +137 -0
  56. package/dist/features/federation/tests/phase5.test.js.map +1 -0
  57. package/dist/features/federation/tests/schema-load.test.d.ts +2 -0
  58. package/dist/features/federation/tests/schema-load.test.d.ts.map +1 -0
  59. package/dist/features/federation/tests/schema-load.test.js +97 -0
  60. package/dist/features/federation/tests/schema-load.test.js.map +1 -0
  61. package/dist/features/federation/tests/validator.test.d.ts +2 -0
  62. package/dist/features/federation/tests/validator.test.d.ts.map +1 -0
  63. package/dist/features/federation/tests/validator.test.js +319 -0
  64. package/dist/features/federation/tests/validator.test.js.map +1 -0
  65. package/dist/features/mcp/commands/serve.d.ts +10 -0
  66. package/dist/features/mcp/commands/serve.d.ts.map +1 -0
  67. package/dist/features/mcp/commands/serve.js +12 -0
  68. package/dist/features/mcp/commands/serve.js.map +1 -0
  69. package/dist/features/mcp/server.d.ts +15 -0
  70. package/dist/features/mcp/server.d.ts.map +1 -0
  71. package/dist/features/mcp/server.js +438 -0
  72. package/dist/features/mcp/server.js.map +1 -0
  73. package/dist/features/pipeline/commands/validate.d.ts.map +1 -1
  74. package/dist/features/pipeline/commands/validate.js +7 -0
  75. package/dist/features/pipeline/commands/validate.js.map +1 -1
  76. package/dist/features/pipeline/indexer.d.ts +28 -2
  77. package/dist/features/pipeline/indexer.d.ts.map +1 -1
  78. package/dist/features/pipeline/indexer.js +84 -29
  79. package/dist/features/pipeline/indexer.js.map +1 -1
  80. package/dist/features/pipeline/validator.d.ts +10 -0
  81. package/dist/features/pipeline/validator.d.ts.map +1 -1
  82. package/dist/features/pipeline/validator.js +274 -27
  83. package/dist/features/pipeline/validator.js.map +1 -1
  84. package/dist/features/query/commands/list.d.ts +10 -0
  85. package/dist/features/query/commands/list.d.ts.map +1 -1
  86. package/dist/features/query/commands/list.js +1 -1
  87. package/dist/features/query/commands/list.js.map +1 -1
  88. package/dist/features/query/commands/locate.d.ts +1 -0
  89. package/dist/features/query/commands/locate.d.ts.map +1 -1
  90. package/dist/features/query/commands/locate.js +1 -1
  91. package/dist/features/query/commands/locate.js.map +1 -1
  92. package/dist/features/query/commands/search.d.ts.map +1 -1
  93. package/dist/features/query/commands/search.js +2 -0
  94. package/dist/features/query/commands/search.js.map +1 -1
  95. package/dist/features/query/commands/show.d.ts +15 -0
  96. package/dist/features/query/commands/show.d.ts.map +1 -1
  97. package/dist/features/query/commands/show.js +116 -58
  98. package/dist/features/query/commands/show.js.map +1 -1
  99. package/dist/features/query/commands/story.d.ts +70 -0
  100. package/dist/features/query/commands/story.d.ts.map +1 -1
  101. package/dist/features/query/commands/story.js +3 -2
  102. package/dist/features/query/commands/story.js.map +1 -1
  103. package/dist/features/query/commands/summary.d.ts +3 -0
  104. package/dist/features/query/commands/summary.d.ts.map +1 -1
  105. package/dist/features/query/commands/summary.js +1 -1
  106. package/dist/features/query/commands/summary.js.map +1 -1
  107. package/dist/features/query/searcher.d.ts +18 -1
  108. package/dist/features/query/searcher.d.ts.map +1 -1
  109. package/dist/features/query/searcher.js +11 -2
  110. package/dist/features/query/searcher.js.map +1 -1
  111. package/dist/features/scaffold/commands/service-init.d.ts +12 -0
  112. package/dist/features/scaffold/commands/service-init.d.ts.map +1 -0
  113. package/dist/features/scaffold/commands/service-init.js +69 -0
  114. package/dist/features/scaffold/commands/service-init.js.map +1 -0
  115. package/dist/shared/graph.d.ts +8 -0
  116. package/dist/shared/graph.d.ts.map +1 -1
  117. package/dist/shared/graph.js +180 -112
  118. package/dist/shared/graph.js.map +1 -1
  119. package/dist/shared/index.d.ts +4 -1
  120. package/dist/shared/index.d.ts.map +1 -1
  121. package/dist/shared/index.js +6 -1
  122. package/dist/shared/index.js.map +1 -1
  123. package/dist/shared/loader.d.ts +22 -0
  124. package/dist/shared/loader.d.ts.map +1 -1
  125. package/dist/shared/loader.js +31 -1
  126. package/dist/shared/loader.js.map +1 -1
  127. package/dist/shared/paths.d.ts +59 -7
  128. package/dist/shared/paths.d.ts.map +1 -1
  129. package/dist/shared/paths.js +93 -11
  130. package/dist/shared/paths.js.map +1 -1
  131. package/dist/shared/refs.d.ts +96 -0
  132. package/dist/shared/refs.d.ts.map +1 -0
  133. package/dist/shared/refs.js +182 -0
  134. package/dist/shared/refs.js.map +1 -0
  135. package/dist/shared/service-id.d.ts +11 -0
  136. package/dist/shared/service-id.d.ts.map +1 -0
  137. package/dist/shared/service-id.js +64 -0
  138. package/dist/shared/service-id.js.map +1 -0
  139. package/dist/shared/tests/paths.test.d.ts +2 -0
  140. package/dist/shared/tests/paths.test.d.ts.map +1 -0
  141. package/dist/shared/tests/paths.test.js +111 -0
  142. package/dist/shared/tests/paths.test.js.map +1 -0
  143. package/dist/shared/tests/refs.test.d.ts +2 -0
  144. package/dist/shared/tests/refs.test.d.ts.map +1 -0
  145. package/dist/shared/tests/refs.test.js +104 -0
  146. package/dist/shared/tests/refs.test.js.map +1 -0
  147. package/dist/shared/types/domain.d.ts +20 -0
  148. package/dist/shared/types/domain.d.ts.map +1 -1
  149. package/dist/shared/types/federation.d.ts +60 -0
  150. package/dist/shared/types/federation.d.ts.map +1 -0
  151. package/dist/shared/types/federation.js +12 -0
  152. package/dist/shared/types/federation.js.map +1 -0
  153. package/package.json +6 -3
  154. package/tools/dkk/claude/agents/dkk-domain-reviewer.md +69 -0
  155. package/tools/dkk/claude/commands/dkk-adr.md +11 -0
  156. package/tools/dkk/claude/commands/dkk-impact.md +34 -0
  157. package/tools/dkk/claude/commands/dkk-implement.md +12 -0
  158. package/tools/dkk/claude/commands/dkk-prime.md +6 -0
  159. package/tools/dkk/claude/commands/dkk-review.md +12 -0
  160. package/tools/dkk/claude/commands/dkk-story.md +12 -0
  161. package/tools/dkk/claude/hooks/post-edit-validate.mjs +51 -0
  162. package/tools/dkk/claude/hooks/pre-edit-block-generated.mjs +39 -0
  163. package/tools/dkk/claude/hooks/session-start-prime.mjs +33 -0
  164. package/tools/dkk/claude/hooks/stop-validate.mjs +48 -0
  165. package/tools/dkk/claude/settings.json +62 -0
  166. package/tools/dkk/claude/skills/dkk-adr-author/SKILL.md +54 -0
  167. package/tools/dkk/claude/skills/dkk-flow-implementer/SKILL.md +51 -0
  168. package/tools/dkk/claude/skills/dkk-story-analyst/SKILL.md +108 -0
  169. package/tools/dkk/schema/actors.schema.json +11 -1
  170. package/tools/dkk/schema/adr-frontmatter.schema.json +4 -4
  171. package/tools/dkk/schema/aggregate.schema.json +1 -1
  172. package/tools/dkk/schema/command.schema.json +1 -1
  173. package/tools/dkk/schema/event.schema.json +1 -1
  174. package/tools/dkk/schema/federation.schema.json +71 -0
  175. package/tools/dkk/schema/glossary.schema.json +1 -1
  176. package/tools/dkk/schema/index.schema.json +2 -2
  177. package/tools/dkk/schema/policy.schema.json +1 -1
  178. package/tools/dkk/schema/read-model.schema.json +15 -1
  179. package/tools/dkk/schema/service.schema.json +30 -0
  180. package/.github/skills/domain-knowledge/skill.md +0 -93
@@ -23,7 +23,7 @@
23
23
  },
24
24
  "adr_refs": {
25
25
  "type": "array",
26
- "items": { "type": "string", "pattern": "^adr-\\d{4}$" },
26
+ "items": { "type": "string", "pattern": "^([a-z][a-z0-9-]*:)?adr-\\d{4}$" },
27
27
  "uniqueItems": true,
28
28
  "description": "Related ADR identifiers (e.g. adr-0001)"
29
29
  }
@@ -46,8 +46,8 @@
46
46
  "properties": {
47
47
  "ref": {
48
48
  "type": "string",
49
- "pattern": "^[a-z][a-z0-9-]*\\.[A-Za-z][A-Za-z0-9]*$",
50
- "description": "Domain item reference (context.Name)"
49
+ "pattern": "^([a-z][a-z0-9-]*:)?[a-z][a-z0-9-]*\\.[A-Za-z][A-Za-z0-9]*$",
50
+ "description": "Domain item reference (context.Name, or service:context.Name for federated refs)"
51
51
  },
52
52
  "type": {
53
53
  "type": "string",
@@ -43,7 +43,7 @@
43
43
  },
44
44
  "adr_refs": {
45
45
  "type": "array",
46
- "items": { "type": "string", "pattern": "^adr-\\d{4}$" },
46
+ "items": { "type": "string", "pattern": "^([a-z][a-z0-9-]*:)?adr-\\d{4}$" },
47
47
  "uniqueItems": true,
48
48
  "description": "Related ADR identifiers"
49
49
  }
@@ -21,6 +21,20 @@
21
21
  "uniqueItems": true,
22
22
  "description": "Event names this read model subscribes to"
23
23
  },
24
+ "fields": {
25
+ "type": "array",
26
+ "items": {
27
+ "type": "object",
28
+ "properties": {
29
+ "name": { "type": "string", "minLength": 1 },
30
+ "type": { "type": "string", "minLength": 1 },
31
+ "description": { "type": "string" }
32
+ },
33
+ "required": ["name", "type"],
34
+ "additionalProperties": false
35
+ },
36
+ "description": "Data fields exposed by this read model"
37
+ },
24
38
  "used_by": {
25
39
  "type": "array",
26
40
  "items": { "type": "string", "minLength": 1 },
@@ -29,7 +43,7 @@
29
43
  },
30
44
  "adr_refs": {
31
45
  "type": "array",
32
- "items": { "type": "string", "pattern": "^adr-\\d{4}$" },
46
+ "items": { "type": "string", "pattern": "^([a-z][a-z0-9-]*:)?adr-\\d{4}$" },
33
47
  "uniqueItems": true,
34
48
  "description": "Related ADR identifiers"
35
49
  }
@@ -0,0 +1,30 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema#",
3
+ "$id": "service.schema.json",
4
+ "title": "Service Manifest",
5
+ "description": "Service identity for multi-repo federation (.dkk/service.yml). Declares this repo's service name and the bounded contexts it publishes for cross-repo consumption.",
6
+ "type": "object",
7
+ "properties": {
8
+ "name": {
9
+ "type": "string",
10
+ "pattern": "^[a-z][a-z0-9-]*$",
11
+ "description": "Kebab-case service identifier (e.g. \"ordering\"). Globally unique within an org."
12
+ },
13
+ "exports": {
14
+ "type": "array",
15
+ "items": {
16
+ "type": "string",
17
+ "pattern": "^[a-z][a-z0-9-]*$"
18
+ },
19
+ "uniqueItems": true,
20
+ "description": "Bounded-context names this service publishes for federation."
21
+ },
22
+ "description": {
23
+ "type": "string",
24
+ "minLength": 1,
25
+ "description": "Optional human-readable description of the service."
26
+ }
27
+ },
28
+ "required": ["name", "exports"],
29
+ "additionalProperties": false
30
+ }
@@ -1,93 +0,0 @@
1
- ---
2
- name: domain-knowledge
3
- description: Portable Agent Skill for working with a Domain Knowledge Pack.
4
- ---
5
-
6
- # Domain Knowledge Skill
7
-
8
- > Portable Agent Skill for working with a Domain Knowledge Pack.
9
-
10
- ## Description
11
-
12
- This skill enables an AI agent to understand, query, and maintain a structured domain model defined in YAML with linked Architecture Decision Records (ADRs). The domain model follows Domain-Driven Design (DDD) patterns: bounded contexts, events, commands, policies, aggregates, read models, glossary terms, actors, and cross-context flows.
13
-
14
- ## Canonical Model
15
-
16
- The domain model is stored as YAML files on disk:
17
-
18
- | Path | Content |
19
- |------|---------|
20
- | `domain/index.yml` | Registered bounded contexts and cross-context flows |
21
- | `domain/actors.yml` | Global actors (human, system, external) |
22
- | `domain/contexts/<name>.yml` | Bounded context: events, commands, policies, aggregates, read models, glossary |
23
- | `.dkk/adr/adr-NNNN.md` | Architecture Decision Records with YAML frontmatter linking to domain items |
24
-
25
- ### Item Types
26
-
27
- | Type | Description | Key Fields |
28
- |------|-------------|------------|
29
- | **Event** | Something that happened in the domain | `name`, `description`, `fields`, `raised_by`, `adr_refs` |
30
- | **Command** | An instruction to change state | `name`, `description`, `fields`, `actor`, `handled_by`, `adr_refs` |
31
- | **Policy** | Reactive logic triggered by events | `name`, `description`, `when`, `then`, `adr_refs` |
32
- | **Aggregate** | Consistency boundary handling commands | `name`, `description`, `handles`, `emits`, `adr_refs` |
33
- | **Read Model** | Query-optimized projection | `name`, `description`, `subscribes_to`, `used_by`, `adr_refs` |
34
- | **Glossary** | Ubiquitous language term | `term`, `definition`, `aliases`, `adr_refs` |
35
- | **Actor** | Person or system interacting with the domain | `name`, `type`, `description`, `adr_refs` |
36
- | **Flow** | Cross-context sequence of steps | `name`, `description`, `steps[]` |
37
-
38
- ### ID Conventions
39
-
40
- | Scope | Format | Example |
41
- |-------|--------|---------|
42
- | Context item | `<context>.<ItemName>` | `ordering.OrderPlaced` |
43
- | Actor | `actor.<Name>` | `actor.Customer` |
44
- | ADR | `adr-NNNN` | `adr-0001` |
45
- | Flow | `flow.<Name>` | `flow.OrderFulfillment` |
46
- | Context | `context.<name>` | `context.ordering` |
47
-
48
- ## Retrieval Rules
49
-
50
- When answering questions about the domain, always query the model rather than guessing:
51
-
52
- 1. **Search** — `npx tsx src/cli.ts search "<query>"` performs FTS5 full-text search with relevance ranking.
53
- 2. **Show** — `npx tsx src/cli.ts show <id>` returns the full YAML definition of any item.
54
- 3. **Related** — `npx tsx src/cli.ts related <id> --depth <n>` performs BFS graph traversal to find connected items.
55
- 4. **List** — `npx tsx src/cli.ts list [--context <name>] [--type <type>]` enumerates items with optional filtering.
56
- 5. **ADR links** — `npx tsx src/cli.ts adr related <id>` finds bidirectional ADR ↔ domain-item links.
57
-
58
- ## Update Rules
59
-
60
- When modifying the domain model:
61
-
62
- 1. **Edit YAML files directly** — never generate domain items from application code.
63
- 2. **Maintain referential integrity:**
64
- - `adr_refs` must point to existing ADRs in `.dkk/adr/`.
65
- - `domain_refs` in ADR frontmatter must point to existing domain items.
66
- - Cross-references (`handles`, `emits`, `triggers`, `subscribes_to`, `used_by`, `raised_by`, `handled_by`, `actor`) must resolve within the same context or to global actors.
67
- 3. **Follow naming conventions:**
68
- - Items: PascalCase (`OrderPlaced`, `PlaceOrder`).
69
- - Contexts: kebab-case (`ordering`, `inventory-management`).
70
- - ADR ids: `adr-NNNN` (zero-padded).
71
- 4. **Run quality gates after every change:**
72
- ```bash
73
- npx tsx src/cli.ts validate # Schema + cross-reference checks
74
- npx tsx src/cli.ts render # Validate → render docs → rebuild search index
75
- ```
76
- 5. **Update ADRs** when changes affect architectural decisions — add `domain_refs` to the ADR and `adr_refs` to the domain items.
77
-
78
- ## Validation
79
-
80
- The validator checks:
81
- - **Schema conformance** — Each YAML file is validated against its JSON Schema (`tools/dkk/schema/`).
82
- - **Cross-references** — All item-to-item, item-to-ADR, and ADR-to-item references resolve correctly.
83
- - **Context registration** — Every context file in `domain/contexts/` is registered in `domain/index.yml`.
84
-
85
- ## Generated Documentation
86
-
87
- Running `npx tsx src/cli.ts render` produces:
88
- - `.dkk/docs/index.md` — Top-level domain overview.
89
- - `.dkk/docs/<context>/index.md` — Per-context overview.
90
- - `.dkk/docs/<context>/<ItemName>.md` — Per-item detail page.
91
- - SQLite FTS5 search index for the `search` command.
92
-
93
- Do not edit files under `.dkk/docs/` by hand; they are regenerated on each render.