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
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Search index record type for the deterministic search index.
|
|
3
|
+
*
|
|
4
|
+
* Each record represents a single searchable domain item that can be
|
|
5
|
+
* looked up by keyword, type, or context.
|
|
6
|
+
*/
|
|
7
|
+
import type { AdrRef, DomainRef } from "./domain.js";
|
|
8
|
+
/** The kind of domain item stored in a search index record. */
|
|
9
|
+
export type SearchItemType = "context" | "glossary" | "actor" | "event" | "command" | "policy" | "aggregate" | "read_model" | "adr" | "flow";
|
|
10
|
+
/**
|
|
11
|
+
* A single record in the search index, representing one domain item
|
|
12
|
+
* with enough metadata for keyword look-up and filtering.
|
|
13
|
+
*/
|
|
14
|
+
export interface SearchIndexRecord {
|
|
15
|
+
/** Unique composite key: "<context>.<Name>" for context-scoped items,
|
|
16
|
+
* or the item's own id/name for top-level items (actors, ADRs, flows). */
|
|
17
|
+
id: string;
|
|
18
|
+
/** Kind of domain item. */
|
|
19
|
+
type: SearchItemType;
|
|
20
|
+
/** Human-readable display name. */
|
|
21
|
+
name: string;
|
|
22
|
+
/** Bounded-context name this item belongs to (if applicable). */
|
|
23
|
+
context?: string;
|
|
24
|
+
/** Short description (first sentence or full). */
|
|
25
|
+
description: string;
|
|
26
|
+
/** Searchable keywords extracted from name, aliases, fields, etc. */
|
|
27
|
+
keywords: string[];
|
|
28
|
+
/** Related ADR references. */
|
|
29
|
+
adr_refs?: AdrRef[];
|
|
30
|
+
/** Related domain item references. */
|
|
31
|
+
domain_refs?: DomainRef[];
|
|
32
|
+
}
|
|
33
|
+
export * from "./domain.js";
|
|
34
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/shared/types/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EACV,MAAM,EACN,SAAS,EACV,MAAM,aAAa,CAAC;AAErB,+DAA+D;AAC/D,MAAM,MAAM,cAAc,GACtB,SAAS,GACT,UAAU,GACV,OAAO,GACP,OAAO,GACP,SAAS,GACT,QAAQ,GACR,WAAW,GACX,YAAY,GACZ,KAAK,GACL,MAAM,CAAC;AAEX;;;GAGG;AACH,MAAM,WAAW,iBAAiB;IAChC;+EAC2E;IAC3E,EAAE,EAAE,MAAM,CAAC;IACX,2BAA2B;IAC3B,IAAI,EAAE,cAAc,CAAC;IACrB,mCAAmC;IACnC,IAAI,EAAE,MAAM,CAAC;IACb,iEAAiE;IACjE,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,kDAAkD;IAClD,WAAW,EAAE,MAAM,CAAC;IACpB,qEAAqE;IACrE,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,8BAA8B;IAC9B,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,sCAAsC;IACtC,WAAW,CAAC,EAAE,SAAS,EAAE,CAAC;CAC3B;AAGD,cAAc,aAAa,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Search index record type for the deterministic search index.
|
|
3
|
+
*
|
|
4
|
+
* Each record represents a single searchable domain item that can be
|
|
5
|
+
* looked up by keyword, type, or context.
|
|
6
|
+
*/
|
|
7
|
+
// Re-export all domain types for convenience.
|
|
8
|
+
export * from "./domain.js";
|
|
9
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/shared/types/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AA4CH,8CAA8C;AAC9C,cAAc,aAAa,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Parse a YAML string into a typed object.
|
|
3
|
+
*
|
|
4
|
+
* @throws {yaml.YAMLException} on malformed YAML.
|
|
5
|
+
*/
|
|
6
|
+
export declare function parseYaml<T = Record<string, unknown>>(text: string): T;
|
|
7
|
+
/**
|
|
8
|
+
* Stringify a value to a YAML string.
|
|
9
|
+
*
|
|
10
|
+
* Uses block-style scalars and 2-space indent for readability.
|
|
11
|
+
*/
|
|
12
|
+
export declare function stringifyYaml(value: unknown): string;
|
|
13
|
+
//# sourceMappingURL=yaml.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"yaml.d.ts","sourceRoot":"","sources":["../../src/shared/yaml.ts"],"names":[],"mappings":"AAQA;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,IAAI,EAAE,MAAM,GAAG,CAAC,CAEtE;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAOpD"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* YAML parse / stringify helpers.
|
|
3
|
+
*
|
|
4
|
+
* Thin wrappers around js-yaml that pin options and give
|
|
5
|
+
* narrower return types than the generic `unknown`.
|
|
6
|
+
*/
|
|
7
|
+
import yaml from "js-yaml";
|
|
8
|
+
/**
|
|
9
|
+
* Parse a YAML string into a typed object.
|
|
10
|
+
*
|
|
11
|
+
* @throws {yaml.YAMLException} on malformed YAML.
|
|
12
|
+
*/
|
|
13
|
+
export function parseYaml(text) {
|
|
14
|
+
return yaml.load(text);
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Stringify a value to a YAML string.
|
|
18
|
+
*
|
|
19
|
+
* Uses block-style scalars and 2-space indent for readability.
|
|
20
|
+
*/
|
|
21
|
+
export function stringifyYaml(value) {
|
|
22
|
+
return yaml.dump(value, {
|
|
23
|
+
indent: 2,
|
|
24
|
+
lineWidth: 120,
|
|
25
|
+
noRefs: true,
|
|
26
|
+
sortKeys: false,
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=yaml.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"yaml.js","sourceRoot":"","sources":["../../src/shared/yaml.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,IAAI,MAAM,SAAS,CAAC;AAE3B;;;;GAIG;AACH,MAAM,UAAU,SAAS,CAA8B,IAAY;IACjE,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,CAAM,CAAC;AAC9B,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,aAAa,CAAC,KAAc;IAC1C,OAAO,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE;QACtB,MAAM,EAAE,CAAC;QACT,SAAS,EAAE,GAAG;QACd,MAAM,EAAE,IAAI;QACZ,QAAQ,EAAE,KAAK;KAChB,CAAC,CAAC;AACL,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "domain-knowledge-kit",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Domain Knowledge Pack — YAML + ADR links + deterministic search + generated docs",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"bin": {
|
|
7
|
+
"dkk": "dist/cli.js"
|
|
8
|
+
},
|
|
9
|
+
"files": [
|
|
10
|
+
"dist/",
|
|
11
|
+
"tools/domain-pack/schema/",
|
|
12
|
+
"tools/domain-pack/templates/",
|
|
13
|
+
"LICENSE",
|
|
14
|
+
"README.md"
|
|
15
|
+
],
|
|
16
|
+
"scripts": {
|
|
17
|
+
"build": "tsc",
|
|
18
|
+
"dev": "tsx src/cli.ts",
|
|
19
|
+
"typecheck": "tsc --noEmit",
|
|
20
|
+
"lint": "eslint .",
|
|
21
|
+
"lint:fix": "eslint . --fix",
|
|
22
|
+
"check": "npm run typecheck && npm run lint",
|
|
23
|
+
"prepublishOnly": "npm run build",
|
|
24
|
+
"test": "tsx src/features/pipeline/tests/validate-schemas.test.ts && tsx src/shared/tests/loader.test.ts && tsx src/features/pipeline/tests/validator.test.ts && tsx src/shared/tests/graph.test.ts && tsx src/features/pipeline/tests/indexer.test.ts && tsx src/features/query/tests/searcher.test.ts && tsx src/features/pipeline/tests/renderer.test.ts && tsx src/shared/tests/verify-collision-fix.test.ts && tsx test/cli-integration.ts"
|
|
25
|
+
},
|
|
26
|
+
"engines": {
|
|
27
|
+
"node": ">=21.2.0"
|
|
28
|
+
},
|
|
29
|
+
"keywords": [],
|
|
30
|
+
"license": "Elastic-2.0",
|
|
31
|
+
"devDependencies": {
|
|
32
|
+
"@types/better-sqlite3": "^7.6.13",
|
|
33
|
+
"@types/js-yaml": "^4.0.9",
|
|
34
|
+
"eslint": "^10.0.1",
|
|
35
|
+
"tsx": "^4.7.0",
|
|
36
|
+
"typescript": "^5.4.0",
|
|
37
|
+
"typescript-eslint": "^8.56.0"
|
|
38
|
+
},
|
|
39
|
+
"dependencies": {
|
|
40
|
+
"ajv": "^8.12.0",
|
|
41
|
+
"ajv-formats": "^3.0.1",
|
|
42
|
+
"better-sqlite3": "^11.0.0",
|
|
43
|
+
"commander": "^12.0.0",
|
|
44
|
+
"fast-glob": "^3.3.2",
|
|
45
|
+
"handlebars": "^4.7.8",
|
|
46
|
+
"js-yaml": "^4.1.0"
|
|
47
|
+
}
|
|
48
|
+
}
|
|
File without changes
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
3
|
+
"$id": "actors.schema.json",
|
|
4
|
+
"title": "Actors File",
|
|
5
|
+
"description": "Top-level actors definition file (domain/actors.yml)",
|
|
6
|
+
"type": "object",
|
|
7
|
+
"properties": {
|
|
8
|
+
"actors": {
|
|
9
|
+
"type": "array",
|
|
10
|
+
"items": {
|
|
11
|
+
"type": "object",
|
|
12
|
+
"properties": {
|
|
13
|
+
"name": {
|
|
14
|
+
"type": "string",
|
|
15
|
+
"pattern": "^[A-Za-z][A-Za-z0-9 ]*$",
|
|
16
|
+
"description": "Actor display name (e.g. Customer, Payment Gateway)"
|
|
17
|
+
},
|
|
18
|
+
"type": {
|
|
19
|
+
"type": "string",
|
|
20
|
+
"enum": ["human", "system", "external"],
|
|
21
|
+
"description": "Whether the actor is a person, internal system, or external system"
|
|
22
|
+
},
|
|
23
|
+
"description": {
|
|
24
|
+
"type": "string",
|
|
25
|
+
"minLength": 1,
|
|
26
|
+
"description": "What role this actor plays in the domain"
|
|
27
|
+
},
|
|
28
|
+
"adr_refs": {
|
|
29
|
+
"type": "array",
|
|
30
|
+
"items": { "type": "string", "pattern": "^adr-\\d{4}$" },
|
|
31
|
+
"uniqueItems": true,
|
|
32
|
+
"description": "Related ADR identifiers"
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
"required": ["name", "type", "description"],
|
|
36
|
+
"additionalProperties": false
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
"required": ["actors"],
|
|
41
|
+
"additionalProperties": false
|
|
42
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
3
|
+
"$id": "adr-frontmatter.schema.json",
|
|
4
|
+
"title": "ADR Frontmatter",
|
|
5
|
+
"description": "Frontmatter metadata for an Architecture Decision Record",
|
|
6
|
+
"type": "object",
|
|
7
|
+
"properties": {
|
|
8
|
+
"id": {
|
|
9
|
+
"type": "string",
|
|
10
|
+
"pattern": "^adr-\\d{4}$",
|
|
11
|
+
"description": "Stable ADR identifier (e.g. adr-0001)"
|
|
12
|
+
},
|
|
13
|
+
"title": {
|
|
14
|
+
"type": "string",
|
|
15
|
+
"minLength": 1,
|
|
16
|
+
"description": "Human-readable title of the decision"
|
|
17
|
+
},
|
|
18
|
+
"status": {
|
|
19
|
+
"type": "string",
|
|
20
|
+
"enum": ["proposed", "accepted", "deprecated", "superseded"],
|
|
21
|
+
"description": "Current lifecycle status of the ADR"
|
|
22
|
+
},
|
|
23
|
+
"date": {
|
|
24
|
+
"type": "string",
|
|
25
|
+
"format": "date",
|
|
26
|
+
"description": "ISO-8601 date when the decision was recorded (YYYY-MM-DD)"
|
|
27
|
+
},
|
|
28
|
+
"deciders": {
|
|
29
|
+
"type": "array",
|
|
30
|
+
"items": { "type": "string", "minLength": 1 },
|
|
31
|
+
"description": "People involved in making this decision"
|
|
32
|
+
},
|
|
33
|
+
"domain_refs": {
|
|
34
|
+
"type": "array",
|
|
35
|
+
"items": {
|
|
36
|
+
"type": "string",
|
|
37
|
+
"pattern": "^[a-z][a-z0-9-]*\\.[A-Za-z][A-Za-z0-9]*$",
|
|
38
|
+
"description": "Domain item reference in context.Name format (e.g. ordering.OrderPlaced)"
|
|
39
|
+
},
|
|
40
|
+
"uniqueItems": true,
|
|
41
|
+
"description": "Domain items related to this decision"
|
|
42
|
+
},
|
|
43
|
+
"superseded_by": {
|
|
44
|
+
"type": "string",
|
|
45
|
+
"pattern": "^adr-\\d{4}$",
|
|
46
|
+
"description": "ID of the ADR that supersedes this one"
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
"required": ["id", "title", "status", "date"],
|
|
50
|
+
"additionalProperties": false
|
|
51
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
3
|
+
"$id": "aggregate.schema.json",
|
|
4
|
+
"title": "Aggregate",
|
|
5
|
+
"description": "A domain aggregate that handles commands and emits events",
|
|
6
|
+
"type": "object",
|
|
7
|
+
"properties": {
|
|
8
|
+
"name": {
|
|
9
|
+
"type": "string",
|
|
10
|
+
"pattern": "^[A-Za-z][A-Za-z0-9]*$",
|
|
11
|
+
"description": "PascalCase aggregate name (e.g. Order)"
|
|
12
|
+
},
|
|
13
|
+
"description": {
|
|
14
|
+
"type": "string",
|
|
15
|
+
"minLength": 1,
|
|
16
|
+
"description": "What this aggregate represents in the domain"
|
|
17
|
+
},
|
|
18
|
+
"handles": {
|
|
19
|
+
"type": "object",
|
|
20
|
+
"properties": {
|
|
21
|
+
"commands": {
|
|
22
|
+
"type": "array",
|
|
23
|
+
"items": { "type": "string", "minLength": 1 },
|
|
24
|
+
"uniqueItems": true,
|
|
25
|
+
"description": "Command names handled by this aggregate"
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
"additionalProperties": false,
|
|
29
|
+
"description": "Commands handled by this aggregate"
|
|
30
|
+
},
|
|
31
|
+
"emits": {
|
|
32
|
+
"type": "object",
|
|
33
|
+
"properties": {
|
|
34
|
+
"events": {
|
|
35
|
+
"type": "array",
|
|
36
|
+
"items": { "type": "string", "minLength": 1 },
|
|
37
|
+
"uniqueItems": true,
|
|
38
|
+
"description": "Event names emitted by this aggregate"
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
"additionalProperties": false,
|
|
42
|
+
"description": "Events emitted by this aggregate"
|
|
43
|
+
},
|
|
44
|
+
"invariants": {
|
|
45
|
+
"type": "array",
|
|
46
|
+
"items": { "type": "string", "minLength": 1 },
|
|
47
|
+
"description": "Business invariants / rules enforced by this aggregate"
|
|
48
|
+
},
|
|
49
|
+
"adr_refs": {
|
|
50
|
+
"type": "array",
|
|
51
|
+
"items": { "type": "string", "pattern": "^adr-\\d{4}$" },
|
|
52
|
+
"uniqueItems": true,
|
|
53
|
+
"description": "Related ADR identifiers"
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
"required": ["name", "description"],
|
|
57
|
+
"additionalProperties": false
|
|
58
|
+
}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
3
|
+
"$id": "command.schema.json",
|
|
4
|
+
"title": "Command",
|
|
5
|
+
"description": "A command handled by an aggregate within a bounded context",
|
|
6
|
+
"type": "object",
|
|
7
|
+
"properties": {
|
|
8
|
+
"name": {
|
|
9
|
+
"type": "string",
|
|
10
|
+
"pattern": "^[A-Za-z][A-Za-z0-9]*$",
|
|
11
|
+
"description": "PascalCase command name (e.g. PlaceOrder)"
|
|
12
|
+
},
|
|
13
|
+
"description": {
|
|
14
|
+
"type": "string",
|
|
15
|
+
"minLength": 1,
|
|
16
|
+
"description": "What this command instructs the system to do"
|
|
17
|
+
},
|
|
18
|
+
"fields": {
|
|
19
|
+
"type": "array",
|
|
20
|
+
"items": {
|
|
21
|
+
"type": "object",
|
|
22
|
+
"properties": {
|
|
23
|
+
"name": { "type": "string", "minLength": 1 },
|
|
24
|
+
"type": { "type": "string", "minLength": 1 },
|
|
25
|
+
"description": { "type": "string" }
|
|
26
|
+
},
|
|
27
|
+
"required": ["name", "type"],
|
|
28
|
+
"additionalProperties": false
|
|
29
|
+
},
|
|
30
|
+
"description": "Input fields for this command"
|
|
31
|
+
},
|
|
32
|
+
"actor": {
|
|
33
|
+
"type": "string",
|
|
34
|
+
"minLength": 1,
|
|
35
|
+
"description": "Name of the actor that initiates this command"
|
|
36
|
+
},
|
|
37
|
+
"handled_by": {
|
|
38
|
+
"type": "string",
|
|
39
|
+
"minLength": 1,
|
|
40
|
+
"description": "Name of the aggregate that handles this command"
|
|
41
|
+
},
|
|
42
|
+
"examples": {
|
|
43
|
+
"type": "array",
|
|
44
|
+
"description": "Given/when/then usage scenarios for this command",
|
|
45
|
+
"items": {
|
|
46
|
+
"type": "object",
|
|
47
|
+
"properties": {
|
|
48
|
+
"description": { "type": "string", "minLength": 1 },
|
|
49
|
+
"given": { "type": "array", "items": { "type": "string" } },
|
|
50
|
+
"when": { "type": "array", "items": { "type": "string" } },
|
|
51
|
+
"then": { "type": "array", "items": { "type": "string" } }
|
|
52
|
+
},
|
|
53
|
+
"required": ["description"],
|
|
54
|
+
"additionalProperties": false
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
"preconditions": {
|
|
58
|
+
"type": "array",
|
|
59
|
+
"items": { "type": "string", "minLength": 1 },
|
|
60
|
+
"description": "Conditions that must be true before this command can be accepted"
|
|
61
|
+
},
|
|
62
|
+
"rejections": {
|
|
63
|
+
"type": "array",
|
|
64
|
+
"items": { "type": "string", "minLength": 1 },
|
|
65
|
+
"description": "Reasons this command may be rejected"
|
|
66
|
+
},
|
|
67
|
+
"adr_refs": {
|
|
68
|
+
"type": "array",
|
|
69
|
+
"items": { "type": "string", "pattern": "^adr-\\d{4}$" },
|
|
70
|
+
"uniqueItems": true,
|
|
71
|
+
"description": "Related ADR identifiers"
|
|
72
|
+
}
|
|
73
|
+
},
|
|
74
|
+
"required": ["name", "description"],
|
|
75
|
+
"additionalProperties": false
|
|
76
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
3
|
+
"$id": "context.schema.json",
|
|
4
|
+
"title": "Bounded Context",
|
|
5
|
+
"description": "A bounded context YAML file containing domain items (domain/contexts/<name>.yml)",
|
|
6
|
+
"type": "object",
|
|
7
|
+
"properties": {
|
|
8
|
+
"name": {
|
|
9
|
+
"type": "string",
|
|
10
|
+
"pattern": "^[a-z][a-z0-9-]*$",
|
|
11
|
+
"description": "Kebab-case context identifier used as the first segment of domain item IDs (e.g. ordering)"
|
|
12
|
+
},
|
|
13
|
+
"description": {
|
|
14
|
+
"type": "string",
|
|
15
|
+
"minLength": 1,
|
|
16
|
+
"description": "What this bounded context is responsible for"
|
|
17
|
+
},
|
|
18
|
+
"glossary": {
|
|
19
|
+
"type": "array",
|
|
20
|
+
"items": { "$ref": "glossary.schema.json" },
|
|
21
|
+
"description": "Ubiquitous-language terms scoped to this context"
|
|
22
|
+
},
|
|
23
|
+
"events": {
|
|
24
|
+
"type": "array",
|
|
25
|
+
"items": { "$ref": "event.schema.json" },
|
|
26
|
+
"description": "Domain events raised within this context"
|
|
27
|
+
},
|
|
28
|
+
"commands": {
|
|
29
|
+
"type": "array",
|
|
30
|
+
"items": { "$ref": "command.schema.json" },
|
|
31
|
+
"description": "Commands handled within this context"
|
|
32
|
+
},
|
|
33
|
+
"policies": {
|
|
34
|
+
"type": "array",
|
|
35
|
+
"items": { "$ref": "policy.schema.json" },
|
|
36
|
+
"description": "Reactive policies within this context"
|
|
37
|
+
},
|
|
38
|
+
"aggregates": {
|
|
39
|
+
"type": "array",
|
|
40
|
+
"items": { "$ref": "aggregate.schema.json" },
|
|
41
|
+
"description": "Aggregates within this context"
|
|
42
|
+
},
|
|
43
|
+
"read_models": {
|
|
44
|
+
"type": "array",
|
|
45
|
+
"items": { "$ref": "read-model.schema.json" },
|
|
46
|
+
"description": "Read models (projections) within this context"
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
"required": ["name", "description"],
|
|
50
|
+
"additionalProperties": false
|
|
51
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
3
|
+
"$id": "event.schema.json",
|
|
4
|
+
"title": "Domain Event",
|
|
5
|
+
"description": "A domain event raised within a bounded context",
|
|
6
|
+
"type": "object",
|
|
7
|
+
"properties": {
|
|
8
|
+
"name": {
|
|
9
|
+
"type": "string",
|
|
10
|
+
"pattern": "^[A-Za-z][A-Za-z0-9]*$",
|
|
11
|
+
"description": "PascalCase event name (e.g. OrderPlaced)"
|
|
12
|
+
},
|
|
13
|
+
"description": {
|
|
14
|
+
"type": "string",
|
|
15
|
+
"minLength": 1,
|
|
16
|
+
"description": "What this event signifies in the domain"
|
|
17
|
+
},
|
|
18
|
+
"fields": {
|
|
19
|
+
"type": "array",
|
|
20
|
+
"items": {
|
|
21
|
+
"type": "object",
|
|
22
|
+
"properties": {
|
|
23
|
+
"name": { "type": "string", "minLength": 1 },
|
|
24
|
+
"type": { "type": "string", "minLength": 1 },
|
|
25
|
+
"description": { "type": "string" }
|
|
26
|
+
},
|
|
27
|
+
"required": ["name", "type"],
|
|
28
|
+
"additionalProperties": false
|
|
29
|
+
},
|
|
30
|
+
"description": "Payload fields carried by this event"
|
|
31
|
+
},
|
|
32
|
+
"raised_by": {
|
|
33
|
+
"type": "string",
|
|
34
|
+
"minLength": 1,
|
|
35
|
+
"description": "Name of the aggregate that raises this event"
|
|
36
|
+
},
|
|
37
|
+
"examples": {
|
|
38
|
+
"type": "array",
|
|
39
|
+
"description": "Given/when/then usage scenarios for this event",
|
|
40
|
+
"items": {
|
|
41
|
+
"type": "object",
|
|
42
|
+
"properties": {
|
|
43
|
+
"description": { "type": "string", "minLength": 1 },
|
|
44
|
+
"given": { "type": "array", "items": { "type": "string" } },
|
|
45
|
+
"when": { "type": "array", "items": { "type": "string" } },
|
|
46
|
+
"then": { "type": "array", "items": { "type": "string" } }
|
|
47
|
+
},
|
|
48
|
+
"required": ["description"],
|
|
49
|
+
"additionalProperties": false
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
"invariants": {
|
|
53
|
+
"type": "array",
|
|
54
|
+
"items": { "type": "string", "minLength": 1 },
|
|
55
|
+
"description": "Business invariants / rules that must hold when this event is raised"
|
|
56
|
+
},
|
|
57
|
+
"adr_refs": {
|
|
58
|
+
"type": "array",
|
|
59
|
+
"items": { "type": "string", "pattern": "^adr-\\d{4}$" },
|
|
60
|
+
"uniqueItems": true,
|
|
61
|
+
"description": "Related ADR identifiers"
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
"required": ["name", "description"],
|
|
65
|
+
"additionalProperties": false
|
|
66
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
3
|
+
"$id": "glossary.schema.json",
|
|
4
|
+
"title": "Glossary Entry",
|
|
5
|
+
"description": "A ubiquitous-language term within a bounded context",
|
|
6
|
+
"type": "object",
|
|
7
|
+
"properties": {
|
|
8
|
+
"term": {
|
|
9
|
+
"type": "string",
|
|
10
|
+
"minLength": 1,
|
|
11
|
+
"description": "The canonical term name"
|
|
12
|
+
},
|
|
13
|
+
"definition": {
|
|
14
|
+
"type": "string",
|
|
15
|
+
"minLength": 1,
|
|
16
|
+
"description": "Plain-language definition of the term"
|
|
17
|
+
},
|
|
18
|
+
"aliases": {
|
|
19
|
+
"type": "array",
|
|
20
|
+
"items": { "type": "string", "minLength": 1 },
|
|
21
|
+
"uniqueItems": true,
|
|
22
|
+
"description": "Alternative names for this term"
|
|
23
|
+
},
|
|
24
|
+
"adr_refs": {
|
|
25
|
+
"type": "array",
|
|
26
|
+
"items": { "type": "string", "pattern": "^adr-\\d{4}$" },
|
|
27
|
+
"uniqueItems": true,
|
|
28
|
+
"description": "Related ADR identifiers (e.g. adr-0001)"
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
"required": ["term", "definition"],
|
|
32
|
+
"additionalProperties": false
|
|
33
|
+
}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
3
|
+
"$id": "index.schema.json",
|
|
4
|
+
"title": "Domain Index",
|
|
5
|
+
"description": "Top-level domain index file (domain/index.yml)",
|
|
6
|
+
"type": "object",
|
|
7
|
+
"properties": {
|
|
8
|
+
"contexts": {
|
|
9
|
+
"type": "array",
|
|
10
|
+
"items": {
|
|
11
|
+
"type": "object",
|
|
12
|
+
"properties": {
|
|
13
|
+
"name": {
|
|
14
|
+
"type": "string",
|
|
15
|
+
"pattern": "^[a-z][a-z0-9-]*$",
|
|
16
|
+
"description": "Context identifier matching a file under domain/contexts/"
|
|
17
|
+
},
|
|
18
|
+
"description": {
|
|
19
|
+
"type": "string",
|
|
20
|
+
"description": "Short summary of the bounded context"
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
"required": ["name"],
|
|
24
|
+
"additionalProperties": false
|
|
25
|
+
},
|
|
26
|
+
"description": "Registered bounded contexts"
|
|
27
|
+
},
|
|
28
|
+
"flows": {
|
|
29
|
+
"type": "array",
|
|
30
|
+
"items": {
|
|
31
|
+
"type": "object",
|
|
32
|
+
"properties": {
|
|
33
|
+
"name": {
|
|
34
|
+
"type": "string",
|
|
35
|
+
"minLength": 1,
|
|
36
|
+
"description": "Flow name"
|
|
37
|
+
},
|
|
38
|
+
"description": {
|
|
39
|
+
"type": "string",
|
|
40
|
+
"description": "What this flow accomplishes"
|
|
41
|
+
},
|
|
42
|
+
"steps": {
|
|
43
|
+
"type": "array",
|
|
44
|
+
"items": {
|
|
45
|
+
"type": "object",
|
|
46
|
+
"properties": {
|
|
47
|
+
"ref": {
|
|
48
|
+
"type": "string",
|
|
49
|
+
"pattern": "^[a-z][a-z0-9-]*\\.[A-Za-z][A-Za-z0-9]*$",
|
|
50
|
+
"description": "Domain item reference (context.Name)"
|
|
51
|
+
},
|
|
52
|
+
"type": {
|
|
53
|
+
"type": "string",
|
|
54
|
+
"enum": ["command", "event", "policy", "read_model"],
|
|
55
|
+
"description": "Type of the referenced item"
|
|
56
|
+
},
|
|
57
|
+
"note": {
|
|
58
|
+
"type": "string",
|
|
59
|
+
"description": "Optional annotation for this step"
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
"required": ["ref", "type"],
|
|
63
|
+
"additionalProperties": false
|
|
64
|
+
},
|
|
65
|
+
"description": "Ordered sequence of domain item references forming the flow"
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
"required": ["name", "steps"],
|
|
69
|
+
"additionalProperties": false
|
|
70
|
+
},
|
|
71
|
+
"description": "Cross-context flows linking domain items in sequence"
|
|
72
|
+
}
|
|
73
|
+
},
|
|
74
|
+
"required": ["contexts"],
|
|
75
|
+
"additionalProperties": false
|
|
76
|
+
}
|