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.
- package/LICENSE +94 -0
- package/README.md +266 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +40 -0
- package/dist/cli.js.map +1 -0
- package/dist/features/adr/commands/adr-related.d.ts +14 -0
- package/dist/features/adr/commands/adr-related.d.ts.map +1 -0
- package/dist/features/adr/commands/adr-related.js +146 -0
- package/dist/features/adr/commands/adr-related.js.map +1 -0
- package/dist/features/adr/commands/adr-show.d.ts +10 -0
- package/dist/features/adr/commands/adr-show.d.ts.map +1 -0
- package/dist/features/adr/commands/adr-show.js +30 -0
- package/dist/features/adr/commands/adr-show.js.map +1 -0
- package/dist/features/pipeline/commands/render.d.ts +10 -0
- package/dist/features/pipeline/commands/render.d.ts.map +1 -0
- package/dist/features/pipeline/commands/render.js +71 -0
- package/dist/features/pipeline/commands/render.js.map +1 -0
- package/dist/features/pipeline/commands/validate.d.ts +10 -0
- package/dist/features/pipeline/commands/validate.d.ts.map +1 -0
- package/dist/features/pipeline/commands/validate.js +48 -0
- package/dist/features/pipeline/commands/validate.js.map +1 -0
- package/dist/features/pipeline/indexer.d.ts +36 -0
- package/dist/features/pipeline/indexer.d.ts.map +1 -0
- package/dist/features/pipeline/indexer.js +279 -0
- package/dist/features/pipeline/indexer.js.map +1 -0
- package/dist/features/pipeline/renderer.d.ts +42 -0
- package/dist/features/pipeline/renderer.d.ts.map +1 -0
- package/dist/features/pipeline/renderer.js +239 -0
- package/dist/features/pipeline/renderer.js.map +1 -0
- package/dist/features/pipeline/tests/indexer.test.d.ts +2 -0
- package/dist/features/pipeline/tests/indexer.test.d.ts.map +1 -0
- package/dist/features/pipeline/tests/indexer.test.js +224 -0
- package/dist/features/pipeline/tests/indexer.test.js.map +1 -0
- package/dist/features/pipeline/tests/renderer.test.d.ts +2 -0
- package/dist/features/pipeline/tests/renderer.test.d.ts.map +1 -0
- package/dist/features/pipeline/tests/renderer.test.js +252 -0
- package/dist/features/pipeline/tests/renderer.test.js.map +1 -0
- package/dist/features/pipeline/tests/validate-schemas.test.d.ts +2 -0
- package/dist/features/pipeline/tests/validate-schemas.test.d.ts.map +1 -0
- package/dist/features/pipeline/tests/validate-schemas.test.js +183 -0
- package/dist/features/pipeline/tests/validate-schemas.test.js.map +1 -0
- package/dist/features/pipeline/tests/validator.test.d.ts +2 -0
- package/dist/features/pipeline/tests/validator.test.d.ts.map +1 -0
- package/dist/features/pipeline/tests/validator.test.js +371 -0
- package/dist/features/pipeline/tests/validator.test.js.map +1 -0
- package/dist/features/pipeline/validator.d.ts +44 -0
- package/dist/features/pipeline/validator.d.ts.map +1 -0
- package/dist/features/pipeline/validator.js +289 -0
- package/dist/features/pipeline/validator.js.map +1 -0
- package/dist/features/query/commands/list.d.ts +10 -0
- package/dist/features/query/commands/list.d.ts.map +1 -0
- package/dist/features/query/commands/list.js +123 -0
- package/dist/features/query/commands/list.js.map +1 -0
- package/dist/features/query/commands/related.d.ts +10 -0
- package/dist/features/query/commands/related.d.ts.map +1 -0
- package/dist/features/query/commands/related.js +61 -0
- package/dist/features/query/commands/related.js.map +1 -0
- package/dist/features/query/commands/search.d.ts +10 -0
- package/dist/features/query/commands/search.d.ts.map +1 -0
- package/dist/features/query/commands/search.js +55 -0
- package/dist/features/query/commands/search.js.map +1 -0
- package/dist/features/query/commands/show.d.ts +10 -0
- package/dist/features/query/commands/show.d.ts.map +1 -0
- package/dist/features/query/commands/show.js +96 -0
- package/dist/features/query/commands/show.js.map +1 -0
- package/dist/features/query/searcher.d.ts +58 -0
- package/dist/features/query/searcher.d.ts.map +1 -0
- package/dist/features/query/searcher.js +185 -0
- package/dist/features/query/searcher.js.map +1 -0
- package/dist/features/query/tests/searcher.test.d.ts +2 -0
- package/dist/features/query/tests/searcher.test.d.ts.map +1 -0
- package/dist/features/query/tests/searcher.test.js +320 -0
- package/dist/features/query/tests/searcher.test.js.map +1 -0
- package/dist/shared/adr-parser.d.ts +14 -0
- package/dist/shared/adr-parser.d.ts.map +1 -0
- package/dist/shared/adr-parser.js +72 -0
- package/dist/shared/adr-parser.js.map +1 -0
- package/dist/shared/errors.d.ts +43 -0
- package/dist/shared/errors.d.ts.map +1 -0
- package/dist/shared/errors.js +60 -0
- package/dist/shared/errors.js.map +1 -0
- package/dist/shared/graph.d.ts +71 -0
- package/dist/shared/graph.d.ts.map +1 -0
- package/dist/shared/graph.js +250 -0
- package/dist/shared/graph.js.map +1 -0
- package/dist/shared/index.d.ts +16 -0
- package/dist/shared/index.d.ts.map +1 -0
- package/dist/shared/index.js +24 -0
- package/dist/shared/index.js.map +1 -0
- package/dist/shared/item-visitor.d.ts +62 -0
- package/dist/shared/item-visitor.d.ts.map +1 -0
- package/dist/shared/item-visitor.js +95 -0
- package/dist/shared/item-visitor.js.map +1 -0
- package/dist/shared/loader.d.ts +19 -0
- package/dist/shared/loader.d.ts.map +1 -0
- package/dist/shared/loader.js +166 -0
- package/dist/shared/loader.js.map +1 -0
- package/dist/shared/paths.d.ts +32 -0
- package/dist/shared/paths.d.ts.map +1 -0
- package/dist/shared/paths.js +62 -0
- package/dist/shared/paths.js.map +1 -0
- package/dist/shared/tests/graph.test.d.ts +2 -0
- package/dist/shared/tests/graph.test.d.ts.map +1 -0
- package/dist/shared/tests/graph.test.js +291 -0
- package/dist/shared/tests/graph.test.js.map +1 -0
- package/dist/shared/tests/loader.test.d.ts +2 -0
- package/dist/shared/tests/loader.test.d.ts.map +1 -0
- package/dist/shared/tests/loader.test.js +239 -0
- package/dist/shared/tests/loader.test.js.map +1 -0
- package/dist/shared/tests/verify-collision-fix.test.d.ts +2 -0
- package/dist/shared/tests/verify-collision-fix.test.d.ts.map +1 -0
- package/dist/shared/tests/verify-collision-fix.test.js +114 -0
- package/dist/shared/tests/verify-collision-fix.test.js.map +1 -0
- package/dist/shared/types/domain.d.ts +244 -0
- package/dist/shared/types/domain.d.ts.map +1 -0
- package/dist/shared/types/domain.js +6 -0
- package/dist/shared/types/domain.js.map +1 -0
- package/dist/shared/types/index.d.ts +34 -0
- package/dist/shared/types/index.d.ts.map +1 -0
- package/dist/shared/types/index.js +9 -0
- package/dist/shared/types/index.js.map +1 -0
- package/dist/shared/yaml.d.ts +13 -0
- package/dist/shared/yaml.d.ts.map +1 -0
- package/dist/shared/yaml.js +29 -0
- package/dist/shared/yaml.js.map +1 -0
- package/package.json +48 -0
- package/tools/domain-pack/schema/.gitkeep +0 -0
- package/tools/domain-pack/schema/actors.schema.json +42 -0
- package/tools/domain-pack/schema/adr-frontmatter.schema.json +51 -0
- package/tools/domain-pack/schema/aggregate.schema.json +58 -0
- package/tools/domain-pack/schema/command.schema.json +76 -0
- package/tools/domain-pack/schema/context.schema.json +51 -0
- package/tools/domain-pack/schema/event.schema.json +66 -0
- package/tools/domain-pack/schema/glossary.schema.json +33 -0
- package/tools/domain-pack/schema/index.schema.json +76 -0
- package/tools/domain-pack/schema/policy.schema.json +53 -0
- package/tools/domain-pack/schema/read-model.schema.json +39 -0
- package/tools/domain-pack/templates/.gitkeep +0 -0
- package/tools/domain-pack/templates/context.md.hbs +89 -0
- package/tools/domain-pack/templates/index.md.hbs +60 -0
- package/tools/domain-pack/templates/item.md.hbs +85 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
Elastic License 2.0
|
|
2
|
+
|
|
3
|
+
URL: https://www.elastic.co/licensing/elastic-license
|
|
4
|
+
|
|
5
|
+
## Acceptance
|
|
6
|
+
|
|
7
|
+
By using the software, you agree to all of the terms and conditions below.
|
|
8
|
+
|
|
9
|
+
## Copyright License
|
|
10
|
+
|
|
11
|
+
The licensor grants you a non-exclusive, royalty-free, worldwide,
|
|
12
|
+
non-sublicensable, non-transferable license to use, copy, distribute, make
|
|
13
|
+
available, and prepare derivative works of the software, in each case subject
|
|
14
|
+
to the limitations and conditions below.
|
|
15
|
+
|
|
16
|
+
## Limitations
|
|
17
|
+
|
|
18
|
+
You may not provide the software to third parties as a hosted or managed
|
|
19
|
+
service, where the service provides users with access to any substantial set of
|
|
20
|
+
the features or functionality of the software.
|
|
21
|
+
|
|
22
|
+
You may not move, change, disable, or circumvent the license key functionality
|
|
23
|
+
in the software, and you may not remove or obscure any functionality in the
|
|
24
|
+
software that is protected by the license key.
|
|
25
|
+
|
|
26
|
+
You may not alter, remove, or obscure any licensing, copyright, or other
|
|
27
|
+
notices of the licensor in the software. Any use of the licensor's trademarks
|
|
28
|
+
is subject to applicable law.
|
|
29
|
+
|
|
30
|
+
## Patents
|
|
31
|
+
|
|
32
|
+
The licensor grants you a license, under any patent claims the licensor can
|
|
33
|
+
license, or becomes able to license, to make, have made, use, sell, offer for
|
|
34
|
+
sale, import and have imported the software, in each case subject to the
|
|
35
|
+
limitations and conditions in this license. This license does not cover any
|
|
36
|
+
patent claims that you cause to be infringed by modifications or additions to
|
|
37
|
+
the software. If you or your company make any written claim that the software
|
|
38
|
+
infringes or contributes to infringement of any patent, your patent license for
|
|
39
|
+
the software granted under these terms ends immediately. If your company makes
|
|
40
|
+
such a claim, your patent license ends immediately for work on behalf of your
|
|
41
|
+
company.
|
|
42
|
+
|
|
43
|
+
## Notices
|
|
44
|
+
|
|
45
|
+
You must ensure that anyone who gets a copy of any part of the software from
|
|
46
|
+
you also gets a copy of these terms.
|
|
47
|
+
|
|
48
|
+
If you modify the software, you must include in any modified copies of the
|
|
49
|
+
software prominent notices stating that you have modified the software.
|
|
50
|
+
|
|
51
|
+
## No Other Rights
|
|
52
|
+
|
|
53
|
+
These terms do not imply any licenses other than those expressly granted in
|
|
54
|
+
these terms.
|
|
55
|
+
|
|
56
|
+
## Termination
|
|
57
|
+
|
|
58
|
+
If you use the software in violation of these terms, such use is not licensed,
|
|
59
|
+
and your licenses will automatically terminate. If the licensor provides you
|
|
60
|
+
with a notice of your violation, and you cease all violation of this license no
|
|
61
|
+
later than 30 days after you receive that notice, your licenses will be
|
|
62
|
+
reinstated retroactively. However, if you violate these terms after such
|
|
63
|
+
reinstatement, any additional violation of these terms will cause your licenses
|
|
64
|
+
to terminate automatically and permanently.
|
|
65
|
+
|
|
66
|
+
## No Liability
|
|
67
|
+
|
|
68
|
+
As far as the law allows, the software comes as is, without any warranty or
|
|
69
|
+
condition, and the licensor will not be liable to you for any damages arising
|
|
70
|
+
out of these terms or the use or nature of the software, under any kind of
|
|
71
|
+
legal claim.
|
|
72
|
+
|
|
73
|
+
## Definitions
|
|
74
|
+
|
|
75
|
+
The licensor is the entity offering these terms, and the software is the
|
|
76
|
+
software the licensor makes available under these terms, including any portion
|
|
77
|
+
of it.
|
|
78
|
+
|
|
79
|
+
"you" refers to the individual or entity agreeing to these terms.
|
|
80
|
+
|
|
81
|
+
"your company" is any legal entity, sole proprietorship, or other kind of
|
|
82
|
+
organization that you work for, plus all organizations that have control over,
|
|
83
|
+
are under the control of, or are under common control with that organization.
|
|
84
|
+
|
|
85
|
+
"control" means ownership of substantially all the assets of an entity, or the
|
|
86
|
+
power to direct its management and policies by vote, contract, or otherwise.
|
|
87
|
+
Control can be direct or indirect.
|
|
88
|
+
|
|
89
|
+
"your licenses" are all the licenses granted to you for the software under
|
|
90
|
+
these terms.
|
|
91
|
+
|
|
92
|
+
"use" means anything you do with the software requiring one of your licenses.
|
|
93
|
+
|
|
94
|
+
"trademark" means trademarks, service marks, and similar rights.
|
package/README.md
ADDED
|
@@ -0,0 +1,266 @@
|
|
|
1
|
+
# Domain Knowledge Kit
|
|
2
|
+
|
|
3
|
+
A structured, YAML-based domain model with Architecture Decision Records (ADRs), full-text search, and generated Markdown documentation.
|
|
4
|
+
|
|
5
|
+
Domain Knowledge Kit lets you define bounded contexts, events, commands, policies, aggregates, read models, and glossary terms in YAML — then validate, render, and search them from the CLI.
|
|
6
|
+
|
|
7
|
+
## Quick Start
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
# Install globally from npm
|
|
11
|
+
npm install -g domain-knowledge-kit
|
|
12
|
+
|
|
13
|
+
# Or run without installing
|
|
14
|
+
npx dkk --help
|
|
15
|
+
|
|
16
|
+
# Validate the domain model
|
|
17
|
+
dkk validate
|
|
18
|
+
|
|
19
|
+
# Render generated documentation
|
|
20
|
+
dkk render
|
|
21
|
+
|
|
22
|
+
# Search domain items
|
|
23
|
+
dkk search "order"
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
### Contributing / local development
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
npm install
|
|
30
|
+
|
|
31
|
+
# Run directly via tsx (no build step needed)
|
|
32
|
+
npm run dev -- validate
|
|
33
|
+
npm run dev -- render
|
|
34
|
+
|
|
35
|
+
# Or build first and use the compiled binary
|
|
36
|
+
npm run build
|
|
37
|
+
npx dkk validate
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## Directory Layout
|
|
41
|
+
|
|
42
|
+
```
|
|
43
|
+
domain/
|
|
44
|
+
index.yml # Registered contexts + cross-context flows
|
|
45
|
+
actors.yml # Global actors (human | system | external)
|
|
46
|
+
contexts/
|
|
47
|
+
<name>.yml # Bounded context definition
|
|
48
|
+
|
|
49
|
+
docs/
|
|
50
|
+
adr/ # Architecture Decision Records (Markdown + YAML frontmatter)
|
|
51
|
+
domain/ # Generated documentation (do not edit by hand)
|
|
52
|
+
|
|
53
|
+
src/
|
|
54
|
+
cli.ts # Slim CLI entry point (registers commands)
|
|
55
|
+
features/ # Vertical feature slices
|
|
56
|
+
query/ # List, show, search, related commands
|
|
57
|
+
commands/ # CLI command handlers
|
|
58
|
+
searcher.ts # FTS5 search logic
|
|
59
|
+
tests/ # Co-located unit tests
|
|
60
|
+
adr/ # ADR show & related commands
|
|
61
|
+
commands/ # CLI command handlers
|
|
62
|
+
pipeline/ # Validate, render, index pipeline
|
|
63
|
+
commands/ # CLI command handlers
|
|
64
|
+
validator.ts # Schema + cross-ref validation
|
|
65
|
+
renderer.ts # Handlebars doc generation
|
|
66
|
+
indexer.ts # Search index builder
|
|
67
|
+
tests/ # Co-located unit tests
|
|
68
|
+
shared/ # Cross-cutting infrastructure
|
|
69
|
+
types/ # DomainModel, SearchIndexRecord, etc.
|
|
70
|
+
loader.ts # YAML model loading
|
|
71
|
+
graph.ts # BFS graph traversal
|
|
72
|
+
item-visitor.ts # Generic item iteration utility
|
|
73
|
+
adr-parser.ts # ADR frontmatter parsing
|
|
74
|
+
paths.ts # Path resolution helpers
|
|
75
|
+
errors.ts # Error formatting
|
|
76
|
+
yaml.ts # YAML I/O helpers
|
|
77
|
+
tests/ # Co-located unit tests
|
|
78
|
+
|
|
79
|
+
tools/
|
|
80
|
+
domain-pack/
|
|
81
|
+
schema/ # JSON Schemas for domain YAML validation
|
|
82
|
+
templates/ # Handlebars templates for doc generation
|
|
83
|
+
|
|
84
|
+
test/
|
|
85
|
+
cli-integration.ts # End-to-end CLI integration tests
|
|
86
|
+
|
|
87
|
+
.github/
|
|
88
|
+
copilot-instructions.md # Copilot integration instructions
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
### Architecture: Vertical Feature Slices
|
|
92
|
+
|
|
93
|
+
The source code is organized into **vertical feature slices** rather than horizontal layers. Each feature slice (`query`, `adr`, `pipeline`) owns its commands, core logic, and tests. The `shared/` module contains cross-cutting infrastructure used by all slices (loader, graph traversal, type definitions, etc.).
|
|
94
|
+
|
|
95
|
+
This structure ensures that adding a new domain item type or feature requires changes localized to one slice, reducing coupling and making the codebase easier to navigate.
|
|
96
|
+
|
|
97
|
+
## Adding a Bounded Context
|
|
98
|
+
|
|
99
|
+
1. Create a new file `domain/contexts/<name>.yml`:
|
|
100
|
+
|
|
101
|
+
```yaml
|
|
102
|
+
name: <name>
|
|
103
|
+
description: A short description of this bounded context.
|
|
104
|
+
events: []
|
|
105
|
+
commands: []
|
|
106
|
+
policies: []
|
|
107
|
+
aggregates: []
|
|
108
|
+
read_models: []
|
|
109
|
+
glossary: []
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
2. Register it in `domain/index.yml`:
|
|
113
|
+
|
|
114
|
+
```yaml
|
|
115
|
+
contexts:
|
|
116
|
+
- name: <name>
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
3. Run quality gates:
|
|
120
|
+
|
|
121
|
+
```bash
|
|
122
|
+
dkk validate
|
|
123
|
+
dkk render
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
## Adding an ADR and Linking It
|
|
127
|
+
|
|
128
|
+
1. Create a Markdown file in `docs/adr/` following the naming convention `adr-NNNN.md` (e.g. `adr-0002.md`):
|
|
129
|
+
|
|
130
|
+
```markdown
|
|
131
|
+
---
|
|
132
|
+
id: adr-NNNN
|
|
133
|
+
title: Short Title
|
|
134
|
+
status: proposed
|
|
135
|
+
date: YYYY-MM-DD
|
|
136
|
+
domain_refs:
|
|
137
|
+
- <context>.<ItemName>
|
|
138
|
+
---
|
|
139
|
+
|
|
140
|
+
## Context
|
|
141
|
+
...
|
|
142
|
+
|
|
143
|
+
## Decision
|
|
144
|
+
...
|
|
145
|
+
|
|
146
|
+
## Consequences
|
|
147
|
+
...
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
2. Link back from domain items by adding the ADR id to their `adr_refs`:
|
|
151
|
+
|
|
152
|
+
```yaml
|
|
153
|
+
# In domain/contexts/<name>.yml, on the relevant item:
|
|
154
|
+
adr_refs:
|
|
155
|
+
- adr-NNNN
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
3. Run quality gates:
|
|
159
|
+
|
|
160
|
+
```bash
|
|
161
|
+
dkk validate
|
|
162
|
+
dkk render
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
## CLI Command Reference
|
|
166
|
+
|
|
167
|
+
All commands below use `dkk` (the installed CLI). During local development, substitute `npm run dev --` or `npx tsx src/cli.ts` for `dkk`.
|
|
168
|
+
|
|
169
|
+
### `list`
|
|
170
|
+
|
|
171
|
+
List all domain items.
|
|
172
|
+
|
|
173
|
+
| Flag | Default | Description |
|
|
174
|
+
|------|---------|-------------|
|
|
175
|
+
| `-c, --context <name>` | — | Filter by bounded context |
|
|
176
|
+
| `-t, --type <type>` | — | Filter by item type (`event`, `command`, `policy`, `aggregate`, `read_model`, `glossary`, `actor`, `adr`, `flow`, `context`) |
|
|
177
|
+
| `--json` | — | Output as JSON |
|
|
178
|
+
| `-r, --root <path>` | repo root | Override repository root |
|
|
179
|
+
|
|
180
|
+
### `show <id>`
|
|
181
|
+
|
|
182
|
+
Display the full YAML of a single domain item.
|
|
183
|
+
|
|
184
|
+
| Flag | Default | Description |
|
|
185
|
+
|------|---------|-------------|
|
|
186
|
+
| `--json` | — | Output as JSON |
|
|
187
|
+
| `-r, --root <path>` | repo root | Override repository root |
|
|
188
|
+
|
|
189
|
+
### `search <query>`
|
|
190
|
+
|
|
191
|
+
FTS5 full-text search with ranking. Requires a pre-built index — run `render` first.
|
|
192
|
+
|
|
193
|
+
| Flag | Default | Description |
|
|
194
|
+
|------|---------|-------------|
|
|
195
|
+
| `-c, --context <name>` | — | Filter results to a bounded context |
|
|
196
|
+
| `-t, --type <type>` | — | Filter by item type |
|
|
197
|
+
| `--tag <tag>` | — | Filter by tag/keyword |
|
|
198
|
+
| `--limit <n>` | `20` | Maximum number of results |
|
|
199
|
+
| `--expand` | — | Expand top results with graph neighbours |
|
|
200
|
+
| `--json` | — | Output as JSON |
|
|
201
|
+
| `-r, --root <path>` | repo root | Override repository root |
|
|
202
|
+
|
|
203
|
+
### `related <id>`
|
|
204
|
+
|
|
205
|
+
BFS graph traversal of related items.
|
|
206
|
+
|
|
207
|
+
| Flag | Default | Description |
|
|
208
|
+
|------|---------|-------------|
|
|
209
|
+
| `-d, --depth <n>` | `1` | Maximum BFS traversal depth |
|
|
210
|
+
| `--json` | — | Output as JSON |
|
|
211
|
+
| `-r, --root <path>` | repo root | Override repository root |
|
|
212
|
+
|
|
213
|
+
### `validate`
|
|
214
|
+
|
|
215
|
+
Schema + cross-reference validation.
|
|
216
|
+
|
|
217
|
+
| Flag | Default | Description |
|
|
218
|
+
|------|---------|-------------|
|
|
219
|
+
| `--warn-missing-fields` | — | Warn about events/commands with no `fields` defined |
|
|
220
|
+
| `--json` | — | Output as JSON |
|
|
221
|
+
| `-r, --root <path>` | repo root | Override repository root |
|
|
222
|
+
|
|
223
|
+
### `render`
|
|
224
|
+
|
|
225
|
+
Validate → render Handlebars Markdown docs → rebuild FTS5 SQLite search index.
|
|
226
|
+
|
|
227
|
+
| Flag | Default | Description |
|
|
228
|
+
|------|---------|-------------|
|
|
229
|
+
| `--skip-validation` | — | Skip the schema + cross-ref validation step |
|
|
230
|
+
| `--json` | — | Output as JSON |
|
|
231
|
+
| `-r, --root <path>` | repo root | Override repository root |
|
|
232
|
+
|
|
233
|
+
### `adr show <id>`
|
|
234
|
+
|
|
235
|
+
Display ADR frontmatter as YAML.
|
|
236
|
+
|
|
237
|
+
| Flag | Default | Description |
|
|
238
|
+
|------|---------|-------------|
|
|
239
|
+
| `--json` | — | Output as JSON |
|
|
240
|
+
| `-r, --root <path>` | repo root | Override repository root |
|
|
241
|
+
|
|
242
|
+
### `adr related <id>`
|
|
243
|
+
|
|
244
|
+
Show bidirectional ADR ↔ domain links. Given an ADR id, lists domain items that reference it; given a domain item id, lists ADRs that reference it.
|
|
245
|
+
|
|
246
|
+
| Flag | Default | Description |
|
|
247
|
+
|------|---------|-------------|
|
|
248
|
+
| `-r, --root <path>` | repo root | Override repository root |
|
|
249
|
+
|
|
250
|
+
## ID Conventions
|
|
251
|
+
|
|
252
|
+
| Item Type | Format | Example |
|
|
253
|
+
|--------------|----------------------------|--------------------------|
|
|
254
|
+
| Context item | `<context>.<ItemName>` | `ordering.OrderPlaced` |
|
|
255
|
+
| Actor | `actor.<Name>` | `actor.Customer` |
|
|
256
|
+
| ADR | `adr-NNNN` | `adr-0001` |
|
|
257
|
+
| Flow | `flow.<Name>` | `flow.OrderFulfillment` |
|
|
258
|
+
| Context | `context.<name>` | `context.ordering` |
|
|
259
|
+
|
|
260
|
+
## Copilot Integration
|
|
261
|
+
|
|
262
|
+
[.github/copilot-instructions.md](.github/copilot-instructions.md) configures GitHub Copilot to understand the domain model structure and use domain-first retrieval (search → show → related → adr related).
|
|
263
|
+
|
|
264
|
+
## License
|
|
265
|
+
|
|
266
|
+
Elastic-2.0
|
package/dist/cli.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":""}
|
package/dist/cli.js
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { Command } from "commander";
|
|
3
|
+
import { registerList } from "./features/query/commands/list.js";
|
|
4
|
+
import { registerShow } from "./features/query/commands/show.js";
|
|
5
|
+
import { registerSearch } from "./features/query/commands/search.js";
|
|
6
|
+
import { registerRelated } from "./features/query/commands/related.js";
|
|
7
|
+
import { registerValidate } from "./features/pipeline/commands/validate.js";
|
|
8
|
+
import { registerRender } from "./features/pipeline/commands/render.js";
|
|
9
|
+
import { registerAdrShow } from "./features/adr/commands/adr-show.js";
|
|
10
|
+
import { registerAdrRelated } from "./features/adr/commands/adr-related.js";
|
|
11
|
+
import { formatCliError } from "./shared/errors.js";
|
|
12
|
+
/** Whether to show full stack traces (set DEBUG=1 in env). */
|
|
13
|
+
const DEBUG = Boolean(process.env.DEBUG);
|
|
14
|
+
// ── CLI setup ─────────────────────────────────────────────────────────
|
|
15
|
+
const program = new Command();
|
|
16
|
+
program
|
|
17
|
+
.name("dkk")
|
|
18
|
+
.description("Domain Knowledge Pack CLI")
|
|
19
|
+
.version("0.1.0");
|
|
20
|
+
// Top-level commands
|
|
21
|
+
registerList(program);
|
|
22
|
+
registerShow(program);
|
|
23
|
+
registerSearch(program);
|
|
24
|
+
registerRelated(program);
|
|
25
|
+
registerValidate(program);
|
|
26
|
+
registerRender(program);
|
|
27
|
+
// ADR sub-command group
|
|
28
|
+
const adrCmd = program
|
|
29
|
+
.command("adr")
|
|
30
|
+
.description("ADR-related commands");
|
|
31
|
+
registerAdrShow(adrCmd);
|
|
32
|
+
registerAdrRelated(adrCmd);
|
|
33
|
+
program.parseAsync().catch((err) => {
|
|
34
|
+
console.error(`Error: ${formatCliError(err)}`);
|
|
35
|
+
if (DEBUG && err instanceof Error && err.stack) {
|
|
36
|
+
console.error(`\nStack trace:\n${err.stack}`);
|
|
37
|
+
}
|
|
38
|
+
process.exit(1);
|
|
39
|
+
});
|
|
40
|
+
//# sourceMappingURL=cli.js.map
|
package/dist/cli.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,YAAY,EAAE,MAAM,mCAAmC,CAAC;AACjE,OAAO,EAAE,YAAY,EAAE,MAAM,mCAAmC,CAAC;AACjE,OAAO,EAAE,cAAc,EAAE,MAAM,qCAAqC,CAAC;AACrE,OAAO,EAAE,eAAe,EAAE,MAAM,sCAAsC,CAAC;AACvE,OAAO,EAAE,gBAAgB,EAAE,MAAM,0CAA0C,CAAC;AAC5E,OAAO,EAAE,cAAc,EAAE,MAAM,wCAAwC,CAAC;AACxE,OAAO,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAC;AACtE,OAAO,EAAE,kBAAkB,EAAE,MAAM,wCAAwC,CAAC;AAC5E,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAEpD,8DAA8D;AAC9D,MAAM,KAAK,GAAG,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;AAEzC,yEAAyE;AAEzE,MAAM,OAAO,GAAG,IAAI,OAAO,EAAE,CAAC;AAE9B,OAAO;KACJ,IAAI,CAAC,KAAK,CAAC;KACX,WAAW,CAAC,2BAA2B,CAAC;KACxC,OAAO,CAAC,OAAO,CAAC,CAAC;AAEpB,qBAAqB;AACrB,YAAY,CAAC,OAAO,CAAC,CAAC;AACtB,YAAY,CAAC,OAAO,CAAC,CAAC;AACtB,cAAc,CAAC,OAAO,CAAC,CAAC;AACxB,eAAe,CAAC,OAAO,CAAC,CAAC;AACzB,gBAAgB,CAAC,OAAO,CAAC,CAAC;AAC1B,cAAc,CAAC,OAAO,CAAC,CAAC;AAExB,wBAAwB;AACxB,MAAM,MAAM,GAAG,OAAO;KACnB,OAAO,CAAC,KAAK,CAAC;KACd,WAAW,CAAC,sBAAsB,CAAC,CAAC;AAEvC,eAAe,CAAC,MAAM,CAAC,CAAC;AACxB,kBAAkB,CAAC,MAAM,CAAC,CAAC;AAE3B,OAAO,CAAC,UAAU,EAAE,CAAC,KAAK,CAAC,CAAC,GAAY,EAAE,EAAE;IAC1C,OAAO,CAAC,KAAK,CAAC,UAAU,cAAc,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IAC/C,IAAI,KAAK,IAAI,GAAG,YAAY,KAAK,IAAI,GAAG,CAAC,KAAK,EAAE,CAAC;QAC/C,OAAO,CAAC,KAAK,CAAC,mBAAmB,GAAG,CAAC,KAAK,EAAE,CAAC,CAAC;IAChD,CAAC;IACD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `domain adr related <id>` command — bidirectional domain-ADR links.
|
|
3
|
+
*
|
|
4
|
+
* For a given ADR or domain item, finds all linked items in the
|
|
5
|
+
* opposite direction:
|
|
6
|
+
*
|
|
7
|
+
* - ADR → domain items that reference it (via adr_refs)
|
|
8
|
+
* - Domain item → ADRs that reference it (via domain_refs) + ADRs
|
|
9
|
+
* listed in its own adr_refs
|
|
10
|
+
*/
|
|
11
|
+
import type { Command as Cmd } from "commander";
|
|
12
|
+
/** Register the `adr related` subcommand on an `adr` parent command. */
|
|
13
|
+
export declare function registerAdrRelated(adrCmd: Cmd): void;
|
|
14
|
+
//# sourceMappingURL=adr-related.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"adr-related.d.ts","sourceRoot":"","sources":["../../../../src/features/adr/commands/adr-related.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,KAAK,EAAE,OAAO,IAAI,GAAG,EAAE,MAAM,WAAW,CAAC;AAoEhD,wEAAwE;AACxE,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,GAAG,GAAG,IAAI,CAkGpD"}
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
import { loadDomainModel } from "../../../shared/loader.js";
|
|
2
|
+
import { forEachItem, itemAdrRefs } from "../../../shared/item-visitor.js";
|
|
3
|
+
/** Collect domain item IDs that reference a specific ADR. */
|
|
4
|
+
function domainItemsReferencingAdr(model, adrId) {
|
|
5
|
+
const refs = [];
|
|
6
|
+
// Actors
|
|
7
|
+
for (const actor of model.actors) {
|
|
8
|
+
if (actor.adr_refs?.includes(adrId)) {
|
|
9
|
+
refs.push(`actor.${actor.name}`);
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
// Context items — use shared item visitor
|
|
13
|
+
for (const [ctxName, ctx] of model.contexts) {
|
|
14
|
+
forEachItem(ctx, (_type, name, item) => {
|
|
15
|
+
if (itemAdrRefs(item)?.includes(adrId)) {
|
|
16
|
+
refs.push(`${ctxName}.${name}`);
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
return refs.sort();
|
|
21
|
+
}
|
|
22
|
+
/** Collect ADR IDs that reference a specific domain item via domain_refs. */
|
|
23
|
+
function adrsReferencingItem(model, itemId) {
|
|
24
|
+
const refs = [];
|
|
25
|
+
for (const [adrId, adr] of model.adrs) {
|
|
26
|
+
if (adr.domain_refs?.includes(itemId)) {
|
|
27
|
+
refs.push(adrId);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
return refs.sort();
|
|
31
|
+
}
|
|
32
|
+
/** Collect ADR IDs listed in a domain item's own adr_refs field. */
|
|
33
|
+
function ownAdrRefs(model, itemId) {
|
|
34
|
+
// Actor
|
|
35
|
+
if (itemId.startsWith("actor.")) {
|
|
36
|
+
const name = itemId.slice("actor.".length);
|
|
37
|
+
const actor = model.actors.find((a) => a.name === name);
|
|
38
|
+
return (actor?.adr_refs ?? []);
|
|
39
|
+
}
|
|
40
|
+
// Context-scoped item — use shared item visitor
|
|
41
|
+
const dotIdx = itemId.indexOf(".");
|
|
42
|
+
if (dotIdx > 0) {
|
|
43
|
+
const ctxName = itemId.slice(0, dotIdx);
|
|
44
|
+
const itemNameStr = itemId.slice(dotIdx + 1);
|
|
45
|
+
const ctx = model.contexts.get(ctxName);
|
|
46
|
+
if (!ctx)
|
|
47
|
+
return [];
|
|
48
|
+
let result = [];
|
|
49
|
+
forEachItem(ctx, (_type, name, item) => {
|
|
50
|
+
if (name === itemNameStr) {
|
|
51
|
+
result = (itemAdrRefs(item) ?? []);
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
return result;
|
|
55
|
+
}
|
|
56
|
+
return [];
|
|
57
|
+
}
|
|
58
|
+
/** Register the `adr related` subcommand on an `adr` parent command. */
|
|
59
|
+
export function registerAdrRelated(adrCmd) {
|
|
60
|
+
adrCmd
|
|
61
|
+
.command("related <id>")
|
|
62
|
+
.description("Show bidirectional domain-ADR links for an ADR or domain item")
|
|
63
|
+
.option("--json", "Output as JSON")
|
|
64
|
+
.option("-r, --root <path>", "Override repository root")
|
|
65
|
+
.action((id, opts) => {
|
|
66
|
+
const model = loadDomainModel({ root: opts.root });
|
|
67
|
+
const isAdr = id.startsWith("adr-");
|
|
68
|
+
if (isAdr) {
|
|
69
|
+
// ADR → domain items
|
|
70
|
+
if (!model.adrs.has(id)) {
|
|
71
|
+
if (opts.json) {
|
|
72
|
+
console.log(JSON.stringify({ error: `ADR "${id}" not found` }, null, 2));
|
|
73
|
+
}
|
|
74
|
+
else {
|
|
75
|
+
console.error(`Error: ADR "${id}" not found.`);
|
|
76
|
+
}
|
|
77
|
+
process.exit(1);
|
|
78
|
+
}
|
|
79
|
+
const adr = model.adrs.get(id);
|
|
80
|
+
const domainRefs = (adr.domain_refs ?? []);
|
|
81
|
+
const itemsReferencing = domainItemsReferencingAdr(model, id);
|
|
82
|
+
if (opts.json) {
|
|
83
|
+
console.log(JSON.stringify({
|
|
84
|
+
id,
|
|
85
|
+
title: adr.title,
|
|
86
|
+
domainRefs,
|
|
87
|
+
referencedBy: itemsReferencing,
|
|
88
|
+
}, null, 2));
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
91
|
+
console.log(`\n# Related items for ${id} (${adr.title})\n`);
|
|
92
|
+
if (domainRefs.length > 0) {
|
|
93
|
+
console.log(" ADR → Domain (domain_refs from ADR frontmatter):");
|
|
94
|
+
for (const ref of domainRefs) {
|
|
95
|
+
console.log(` - ${ref}`);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
if (itemsReferencing.length > 0) {
|
|
99
|
+
console.log(" Domain → ADR (items with adr_refs pointing here):");
|
|
100
|
+
for (const ref of itemsReferencing) {
|
|
101
|
+
console.log(` - ${ref}`);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
if (domainRefs.length === 0 && itemsReferencing.length === 0) {
|
|
105
|
+
console.log(" No related items found.");
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
else {
|
|
109
|
+
// Domain item → ADRs
|
|
110
|
+
const own = ownAdrRefs(model, id);
|
|
111
|
+
const referencing = adrsReferencingItem(model, id);
|
|
112
|
+
const allAdrs = [...new Set([...own, ...referencing])].sort();
|
|
113
|
+
if (opts.json) {
|
|
114
|
+
console.log(JSON.stringify({
|
|
115
|
+
id,
|
|
116
|
+
ownAdrRefs: own,
|
|
117
|
+
referencedByAdrs: referencing,
|
|
118
|
+
allAdrs,
|
|
119
|
+
}, null, 2));
|
|
120
|
+
return;
|
|
121
|
+
}
|
|
122
|
+
console.log(`\n# Related ADRs for ${id}\n`);
|
|
123
|
+
if (own.length > 0) {
|
|
124
|
+
console.log(" Item → ADR (adr_refs declared on this item):");
|
|
125
|
+
for (const ref of own) {
|
|
126
|
+
const adr = model.adrs.get(ref);
|
|
127
|
+
const title = adr ? ` — ${adr.title}` : "";
|
|
128
|
+
console.log(` - ${ref}${title}`);
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
if (referencing.length > 0) {
|
|
132
|
+
console.log(" ADR → Item (ADRs with domain_refs pointing here):");
|
|
133
|
+
for (const ref of referencing) {
|
|
134
|
+
const adr = model.adrs.get(ref);
|
|
135
|
+
const title = adr ? ` — ${adr.title}` : "";
|
|
136
|
+
console.log(` - ${ref}${title}`);
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
if (allAdrs.length === 0) {
|
|
140
|
+
console.log(" No related ADRs found.");
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
console.log();
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
//# sourceMappingURL=adr-related.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"adr-related.js","sourceRoot":"","sources":["../../../../src/features/adr/commands/adr-related.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAE5D,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAE3E,6DAA6D;AAC7D,SAAS,yBAAyB,CAAC,KAAkB,EAAE,KAAa;IAClE,MAAM,IAAI,GAAa,EAAE,CAAC;IAE1B,SAAS;IACT,KAAK,MAAM,KAAK,IAAI,KAAK,CAAC,MAAM,EAAE,CAAC;QACjC,IAAI,KAAK,CAAC,QAAQ,EAAE,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC;YACpC,IAAI,CAAC,IAAI,CAAC,SAAS,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC;QACnC,CAAC;IACH,CAAC;IAED,0CAA0C;IAC1C,KAAK,MAAM,CAAC,OAAO,EAAE,GAAG,CAAC,IAAI,KAAK,CA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AK,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;oBAC3C,OAAO,CAAC,GAAG,CAAC,SAAS,GAAG,GAAG,KAAK,EAAE,CAAC,CAAC;gBACtC,CAAC;YACH,CAAC;YAED,IAAI,WAAW,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;gBAC3B,OAAO,CAAC,GAAG,CAAC,qDAAqD,CAAC,CAAC;gBACnE,KAAK,MAAM,GAAG,IAAI,WAAW,EAAE,CAAC;oBAC9B,MAAM,GAAG,GAAG,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;oBAChC,MAAM,KAAK,GAAG,GAAG,CAAC,CAAC,CAAC,MAAM,GAAG,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;oBAC3C,OAAO,CAAC,GAAG,CAAC,SAAS,GAAG,GAAG,KAAK,EAAE,CAAC,CAAC;gBACtC,CAAC;YACH,CAAC;YAED,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;gBACzB,OAAO,CAAC,GAAG,CAAC,0BAA0B,CAAC,CAAC;YAC1C,CAAC;QACH,CAAC;QAED,OAAO,CAAC,GAAG,EAAE,CAAC;IAChB,CAAC,CAAC,CAAC;AACP,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `domain adr show <id>` command — print an ADR's frontmatter.
|
|
3
|
+
*
|
|
4
|
+
* Looks up an ADR by its id (e.g. "adr-0001") and prints
|
|
5
|
+
* its frontmatter metadata as YAML, plus location on disk.
|
|
6
|
+
*/
|
|
7
|
+
import type { Command as Cmd } from "commander";
|
|
8
|
+
/** Register the `adr show` subcommand on an `adr` parent command. */
|
|
9
|
+
export declare function registerAdrShow(adrCmd: Cmd): void;
|
|
10
|
+
//# sourceMappingURL=adr-show.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"adr-show.d.ts","sourceRoot":"","sources":["../../../../src/features/adr/commands/adr-show.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,KAAK,EAAE,OAAO,IAAI,GAAG,EAAE,MAAM,WAAW,CAAC;AAIhD,qEAAqE;AACrE,wBAAgB,eAAe,CAAC,MAAM,EAAE,GAAG,GAAG,IAAI,CA2BjD"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { loadDomainModel } from "../../../shared/loader.js";
|
|
2
|
+
import { stringifyYaml } from "../../../shared/yaml.js";
|
|
3
|
+
/** Register the `adr show` subcommand on an `adr` parent command. */
|
|
4
|
+
export function registerAdrShow(adrCmd) {
|
|
5
|
+
adrCmd
|
|
6
|
+
.command("show <id>")
|
|
7
|
+
.description("Show ADR frontmatter by ID (e.g. adr-0001)")
|
|
8
|
+
.option("--json", "Output as JSON")
|
|
9
|
+
.option("-r, --root <path>", "Override repository root")
|
|
10
|
+
.action((id, opts) => {
|
|
11
|
+
const model = loadDomainModel({ root: opts.root });
|
|
12
|
+
const adr = model.adrs.get(id);
|
|
13
|
+
if (!adr) {
|
|
14
|
+
if (opts.json) {
|
|
15
|
+
console.log(JSON.stringify({ error: `ADR "${id}" not found` }, null, 2));
|
|
16
|
+
}
|
|
17
|
+
else {
|
|
18
|
+
console.error(`Error: ADR "${id}" not found.`);
|
|
19
|
+
}
|
|
20
|
+
process.exit(1);
|
|
21
|
+
}
|
|
22
|
+
if (opts.json) {
|
|
23
|
+
console.log(JSON.stringify(adr, null, 2));
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
console.log(`\n# ${adr.title} (${adr.id})\n`);
|
|
27
|
+
console.log(stringifyYaml(adr));
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=adr-show.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"adr-show.js","sourceRoot":"","sources":["../../../../src/features/adr/commands/adr-show.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,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CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `domain render` command — validate + render + build search index.
|
|
3
|
+
*
|
|
4
|
+
* Validates the domain model, renders Markdown documentation via
|
|
5
|
+
* Handlebars templates, and rebuilds the FTS5 search index.
|
|
6
|
+
*/
|
|
7
|
+
import type { Command as Cmd } from "commander";
|
|
8
|
+
/** Register the `render` subcommand. */
|
|
9
|
+
export declare function registerRender(program: Cmd): void;
|
|
10
|
+
//# sourceMappingURL=render.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"render.d.ts","sourceRoot":"","sources":["../../../../src/features/pipeline/commands/render.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,KAAK,EAAE,OAAO,IAAI,GAAG,EAAE,MAAM,WAAW,CAAC;AAMhD,wCAAwC;AACxC,wBAAgB,cAAc,CAAC,OAAO,EAAE,GAAG,GAAG,IAAI,CA8DjD"}
|