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,71 @@
|
|
|
1
|
+
import { loadDomainModel } from "../../../shared/loader.js";
|
|
2
|
+
import { validateDomainModel } from "../validator.js";
|
|
3
|
+
import { renderDocs } from "../renderer.js";
|
|
4
|
+
import { buildIndex } from "../indexer.js";
|
|
5
|
+
/** Register the `render` subcommand. */
|
|
6
|
+
export function registerRender(program) {
|
|
7
|
+
program
|
|
8
|
+
.command("render")
|
|
9
|
+
.description("Validate, render Markdown docs, and rebuild search index")
|
|
10
|
+
.option("--skip-validation", "Skip schema + cross-ref validation")
|
|
11
|
+
.option("--json", "Output as JSON")
|
|
12
|
+
.option("-r, --root <path>", "Override repository root")
|
|
13
|
+
.action((opts) => {
|
|
14
|
+
const model = loadDomainModel({ root: opts.root });
|
|
15
|
+
// 1. Validate (unless skipped)
|
|
16
|
+
if (!opts.skipValidation) {
|
|
17
|
+
if (!opts.json)
|
|
18
|
+
console.log("Validating domain model…");
|
|
19
|
+
const result = validateDomainModel(model);
|
|
20
|
+
if (!opts.json) {
|
|
21
|
+
for (const w of result.warnings) {
|
|
22
|
+
const loc = w.path ? ` (${w.path})` : "";
|
|
23
|
+
console.warn(`\u26a0 ${w.message}${loc}`);
|
|
24
|
+
}
|
|
25
|
+
for (const e of result.errors) {
|
|
26
|
+
const loc = e.path ? ` (${e.path})` : "";
|
|
27
|
+
console.error(`\u2717 ${e.message}${loc}`);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
if (!result.valid) {
|
|
31
|
+
if (opts.json) {
|
|
32
|
+
console.log(JSON.stringify({
|
|
33
|
+
success: false,
|
|
34
|
+
error: "Validation failed",
|
|
35
|
+
validationErrors: result.errors.map((e) => ({ message: e.message, path: e.path ?? null })),
|
|
36
|
+
}, null, 2));
|
|
37
|
+
}
|
|
38
|
+
else {
|
|
39
|
+
console.error(`\n\u2717 Validation failed with ${result.errors.length} error(s). Fix errors before rendering.\n`);
|
|
40
|
+
}
|
|
41
|
+
process.exit(1);
|
|
42
|
+
}
|
|
43
|
+
if (!opts.json)
|
|
44
|
+
console.log("\u2713 Validation passed.\n");
|
|
45
|
+
}
|
|
46
|
+
// 2. Render docs
|
|
47
|
+
if (!opts.json)
|
|
48
|
+
console.log("Rendering documentation…");
|
|
49
|
+
const renderResult = renderDocs(model, { root: opts.root });
|
|
50
|
+
if (!opts.json)
|
|
51
|
+
console.log(`\u2713 Rendered ${renderResult.fileCount} file(s).\n`);
|
|
52
|
+
// 3. Build search index
|
|
53
|
+
if (!opts.json)
|
|
54
|
+
console.log("Building search index…");
|
|
55
|
+
const dbPath = buildIndex(model, { root: opts.root });
|
|
56
|
+
if (!opts.json)
|
|
57
|
+
console.log(`\u2713 Search index written to ${dbPath}.\n`);
|
|
58
|
+
if (opts.json) {
|
|
59
|
+
console.log(JSON.stringify({
|
|
60
|
+
success: true,
|
|
61
|
+
rendered: renderResult.fileCount,
|
|
62
|
+
files: renderResult.files,
|
|
63
|
+
searchIndex: dbPath,
|
|
64
|
+
}, null, 2));
|
|
65
|
+
}
|
|
66
|
+
else {
|
|
67
|
+
console.log("Done.");
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
//# sourceMappingURL=render.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"render.js","sourceRoot":"","sources":["../../../../src/features/pipeline/commands/render.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAC5D,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AACtD,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAE3C,wCAAwC;AACxC,MAAM,UAAU,cAAc,CAAC,OAAY;IACzC,OAAO;SACJ,OAAO,CAAC,QAAQ,CAAC;SACjB,WAAW,CAAC,0DAA0D,CAAC;SACvE,MAAM,CAAC,mBAAmB,EAAE,oCAAoC,CAAC;SACjE,MAAM,CAAC,QAAQ,EAAE,gBAAgB,CAAC;SAClC,MAAM,CAAC,mBAAmB,EAAE,0BAA0B,CAAC;SACvD,MAAM,CAAC,CAAC,IAAiE,EAAE,EAAE;QAC5E,MAAM,KAAK,GAAG,eAAe,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC;QAEnD,+BAA+B;QAC/B,IAAI,CAAC,IAAI,CAAC,cAAc,EAAE,CAAC;YACzB,IAAI,CAAC,IAAI,CAAC,IAAI;gBAAE,OAAO,CAAC,GAAG,CAAC,0BAA0B,CAAC,CAAC;YACxD,MAAM,MAAM,GAAG,mBAAmB,CAAC,KAAK,CAAC,CAAC;Y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+
* Loads the domain model, validates it against JSON Schemas and
|
|
5
|
+
* cross-reference rules, and exits with code 1 on errors.
|
|
6
|
+
*/
|
|
7
|
+
import type { Command as Cmd } from "commander";
|
|
8
|
+
/** Register the `validate` subcommand. */
|
|
9
|
+
export declare function registerValidate(program: Cmd): void;
|
|
10
|
+
//# sourceMappingURL=validate.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validate.d.ts","sourceRoot":"","sources":["../../../../src/features/pipeline/commands/validate.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,KAAK,EAAE,OAAO,IAAI,GAAG,EAAE,MAAM,WAAW,CAAC;AAIhD,0CAA0C;AAC1C,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,GAAG,GAAG,IAAI,CA8CnD"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { loadDomainModel } from "../../../shared/loader.js";
|
|
2
|
+
import { validateDomainModel } from "../validator.js";
|
|
3
|
+
/** Register the `validate` subcommand. */
|
|
4
|
+
export function registerValidate(program) {
|
|
5
|
+
program
|
|
6
|
+
.command("validate")
|
|
7
|
+
.description("Validate domain YAML against schemas and cross-references")
|
|
8
|
+
.option("--warn-missing-fields", "Warn about events/commands with no fields")
|
|
9
|
+
.option("--json", "Output as JSON")
|
|
10
|
+
.option("-r, --root <path>", "Override repository root")
|
|
11
|
+
.action((opts) => {
|
|
12
|
+
const model = loadDomainModel({ root: opts.root });
|
|
13
|
+
const result = validateDomainModel(model, {
|
|
14
|
+
warnMissingFields: opts.warnMissingFields,
|
|
15
|
+
});
|
|
16
|
+
if (opts.json) {
|
|
17
|
+
console.log(JSON.stringify({
|
|
18
|
+
valid: result.valid,
|
|
19
|
+
errors: result.errors.map((e) => ({ message: e.message, path: e.path ?? null })),
|
|
20
|
+
warnings: result.warnings.map((w) => ({ message: w.message, path: w.path ?? null })),
|
|
21
|
+
}, null, 2));
|
|
22
|
+
if (!result.valid)
|
|
23
|
+
process.exit(1);
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
// Print warnings
|
|
27
|
+
for (const w of result.warnings) {
|
|
28
|
+
const loc = w.path ? ` (${w.path})` : "";
|
|
29
|
+
console.warn(`\u26a0 ${w.message}${loc}`);
|
|
30
|
+
}
|
|
31
|
+
// Print errors
|
|
32
|
+
for (const e of result.errors) {
|
|
33
|
+
const loc = e.path ? ` (${e.path})` : "";
|
|
34
|
+
console.error(`\u2717 ${e.message}${loc}`);
|
|
35
|
+
}
|
|
36
|
+
// Summary
|
|
37
|
+
const warnCount = result.warnings.length;
|
|
38
|
+
const errCount = result.errors.length;
|
|
39
|
+
if (result.valid) {
|
|
40
|
+
console.log(`\n\u2713 Validation passed.${warnCount > 0 ? ` (${warnCount} warning(s))` : ""}\n`);
|
|
41
|
+
}
|
|
42
|
+
else {
|
|
43
|
+
console.error(`\n\u2717 Validation failed: ${errCount} error(s), ${warnCount} warning(s).\n`);
|
|
44
|
+
process.exit(1);
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
//# sourceMappingURL=validate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validate.js","sourceRoot":"","sources":["../../../../src/features/pipeline/commands/validate.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAC5D,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAEtD,0CAA0C;AAC1C,MAAM,UAAU,gBAAgB,CAAC,OAAY;IAC3C,OAAO;SACJ,OAAO,CAAC,UAAU,CAAC;SACnB,WAAW,CAAC,2DAA2D,CAAC;SACxE,MAAM,CAAC,uBAAuB,EAAE,2CAA2C,CAAC;SAC5E,MAAM,CAAC,QAAQ,EAAE,gBAAgB,CAAC;SAClC,MAAM,CAAC,mBAAmB,EAAE,0BAA0B,CAAC;SACvD,MAAM,CAAC,CAAC,IAAoE,EAAE,EAAE;QAC/E,MAAM,KAA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MAAM,GAAG,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,IAAI,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC;YACzC,OAAO,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC,OAAO,GAAG,GAAG,EAAE,CAAC,CAAC;QAC9C,CAAC;QAED,UAAU;QACV,MAAM,SAAS,GAAG,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC;QACzC,MAAM,QAAQ,GAAG,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC;QAEtC,IAAI,MAAM,CAAC,KAAK,EAAE,CAAC;YACjB,OAAO,CAAC,GAAG,CAAC,8BAA8B,SAAS,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,SAAS,cAAc,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC;QACnG,CAAC;aAAM,CAAC;YACN,OAAO,CAAC,KAAK,CAAC,+BAA+B,QAAQ,cAAc,SAAS,gBAAgB,CAAC,CAAC;YAC9F,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;IACH,CAAC,CAAC,CAAC;AACP,CAAC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { DomainModel } from "../../shared/types/domain.js";
|
|
2
|
+
/** Shape of a row in the `domain_fts` virtual table. */
|
|
3
|
+
export interface IndexRow {
|
|
4
|
+
/** Unique composite key (e.g. "ordering.OrderPlaced", "actor.Customer"). */
|
|
5
|
+
id: string;
|
|
6
|
+
/** Item kind: context | glossary | actor | event | command | policy | aggregate | read_model | adr | flow. */
|
|
7
|
+
type: string;
|
|
8
|
+
/** Bounded-context name or empty string for top-level items. */
|
|
9
|
+
context: string;
|
|
10
|
+
/** Human-readable display name. */
|
|
11
|
+
name: string;
|
|
12
|
+
/** Space-separated tags / keywords. */
|
|
13
|
+
tags: string;
|
|
14
|
+
/** Concatenated searchable body text. */
|
|
15
|
+
text: string;
|
|
16
|
+
/** JSON-encoded array of relation ids (neighbours). */
|
|
17
|
+
relations: string;
|
|
18
|
+
/** JSON-encoded array of ADR references. */
|
|
19
|
+
adrRefs: string;
|
|
20
|
+
}
|
|
21
|
+
/** Options for the indexer. */
|
|
22
|
+
export interface IndexerOptions {
|
|
23
|
+
/** Override repository root. */
|
|
24
|
+
root?: string;
|
|
25
|
+
/** Override output path (default: `<root>/.domain-pack/index.db`). */
|
|
26
|
+
dbPath?: string;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Build (or rebuild) the FTS5 search index from a {@link DomainModel}.
|
|
30
|
+
*
|
|
31
|
+
* The operation is idempotent — the index is fully replaced on each call.
|
|
32
|
+
*
|
|
33
|
+
* @returns The absolute path to the created database file.
|
|
34
|
+
*/
|
|
35
|
+
export declare function buildIndex(model: DomainModel, options?: IndexerOptions): string;
|
|
36
|
+
//# sourceMappingURL=indexer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"indexer.d.ts","sourceRoot":"","sources":["../../../src/features/pipeline/indexer.ts"],"names":[],"mappings":"AAiBA,OAAO,KAAK,EAAE,WAAW,EAAqE,MAAM,8BAA8B,CAAC;AAUnI,wDAAwD;AACxD,MAAM,WAAW,QAAQ;IACvB,4EAA4E;IAC5E,EAAE,EAAE,MAAM,CAAC;IACX,8GAA8G;IAC9G,IAAI,EAAE,MAAM,CAAC;IACb,gEAAgE;IAChE,OAAO,EAAE,MAAM,CAAC;IAChB,mCAAmC;IACnC,IAAI,EAAE,MAAM,CAAC;IACb,uCAAuC;IACvC,IAAI,EAAE,MAAM,CAAC;IACb,yCAAyC;IACzC,IAAI,EAAE,MAAM,CAAC;IACb,uDAAuD;IACvD,SAAS,EAAE,MAAM,CAAC;IAClB,4CAA4C;IAC5C,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,+BAA+B;AAC/B,MAAM,WAAW,cAAc;IAC7B,gCAAgC;IAChC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,sEAAsE;IACtE,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAiBD;;;;;;GAMG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,WAAW,EAAE,OAAO,GAAE,cAAmB,GAAG,MAAM,CAgEnF"}
|
|
@@ -0,0 +1,279 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SQLite FTS5 indexer for domain items.
|
|
3
|
+
*
|
|
4
|
+
* Creates / rebuilds an SQLite database at `.domain-pack/index.db`
|
|
5
|
+
* with an FTS5 virtual table `domain_fts` for full-text search across
|
|
6
|
+
* all items in the loaded {@link DomainModel}.
|
|
7
|
+
*
|
|
8
|
+
* The `text` column is a concatenation of description, when/intent,
|
|
9
|
+
* invariants, examples, glossary terms + synonyms — providing a rich
|
|
10
|
+
* body for keyword matching.
|
|
11
|
+
*
|
|
12
|
+
* The rebuild is idempotent: the FTS table is dropped and re-created
|
|
13
|
+
* on every call to {@link buildIndex}.
|
|
14
|
+
*/
|
|
15
|
+
import { mkdirSync, existsSync } from "node:fs";
|
|
16
|
+
import { join, dirname } from "node:path";
|
|
17
|
+
import { createRequire } from "node:module";
|
|
18
|
+
import { forEachItem, itemAdrRefs } from "../../shared/item-visitor.js";
|
|
19
|
+
import { repoRoot } from "../../shared/paths.js";
|
|
20
|
+
// better-sqlite3 is a CJS package; use createRequire for ESM interop.
|
|
21
|
+
const require = createRequire(import.meta.url);
|
|
22
|
+
const Database = require("better-sqlite3");
|
|
23
|
+
// ── Helpers ───────────────────────────────────────────────────────────
|
|
24
|
+
/** Join strings with a space, filtering out falsy values. */
|
|
25
|
+
function joinText(...parts) {
|
|
26
|
+
return parts.filter(Boolean).join(" ");
|
|
27
|
+
}
|
|
28
|
+
/** Turn an array of field objects into searchable text. */
|
|
29
|
+
function fieldsText(fields) {
|
|
30
|
+
if (!fields?.length)
|
|
31
|
+
return "";
|
|
32
|
+
return fields.map((f) => `${f.name} ${f.type}${f.description ? " " + f.description : ""}`).join(" ");
|
|
33
|
+
}
|
|
34
|
+
// ── Public API ────────────────────────────────────────────────────────
|
|
35
|
+
/**
|
|
36
|
+
* Build (or rebuild) the FTS5 search index from a {@link DomainModel}.
|
|
37
|
+
*
|
|
38
|
+
* The operation is idempotent — the index is fully replaced on each call.
|
|
39
|
+
*
|
|
40
|
+
* @returns The absolute path to the created database file.
|
|
41
|
+
*/
|
|
42
|
+
export function buildIndex(model, options = {}) {
|
|
43
|
+
const root = options.root ?? repoRoot();
|
|
44
|
+
const dbPath = options.dbPath ?? join(root, ".domain-pack", "index.db");
|
|
45
|
+
// Ensure the parent directory exists.
|
|
46
|
+
const dir = dirname(dbPath);
|
|
47
|
+
if (!existsSync(dir)) {
|
|
48
|
+
mkdirSync(dir, { recursive: true });
|
|
49
|
+
}
|
|
50
|
+
const db = new Database(dbPath);
|
|
51
|
+
try {
|
|
52
|
+
// Drop previous tables for a clean rebuild.
|
|
53
|
+
db.exec("DROP TABLE IF EXISTS domain_fts;");
|
|
54
|
+
db.exec("DROP TABLE IF EXISTS domain_meta;");
|
|
55
|
+
// Create FTS5 virtual table.
|
|
56
|
+
db.exec(`
|
|
57
|
+
CREATE VIRTUAL TABLE domain_fts USING fts5(
|
|
58
|
+
id,
|
|
59
|
+
type,
|
|
60
|
+
context,
|
|
61
|
+
name,
|
|
62
|
+
tags,
|
|
63
|
+
text,
|
|
64
|
+
relations,
|
|
65
|
+
adrRefs,
|
|
66
|
+
tokenize='porter unicode61'
|
|
67
|
+
);
|
|
68
|
+
`);
|
|
69
|
+
// Metadata table for rebuild timestamps.
|
|
70
|
+
db.exec(`
|
|
71
|
+
CREATE TABLE domain_meta (
|
|
72
|
+
key TEXT PRIMARY KEY,
|
|
73
|
+
value TEXT NOT NULL
|
|
74
|
+
);
|
|
75
|
+
`);
|
|
76
|
+
db.prepare("INSERT INTO domain_meta (key, value) VALUES (?, ?)").run("built_at", new Date().toISOString());
|
|
77
|
+
// Prepare the insert statement.
|
|
78
|
+
const insert = db.prepare(`
|
|
79
|
+
INSERT INTO domain_fts (id, type, context, name, tags, text, relations, adrRefs)
|
|
80
|
+
VALUES (@id, @type, @context, @name, @tags, @text, @relations, @adrRefs)
|
|
81
|
+
`);
|
|
82
|
+
// Wrap all inserts in a single transaction for performance.
|
|
83
|
+
const insertAll = db.transaction((rows) => {
|
|
84
|
+
for (const row of rows) {
|
|
85
|
+
insert.run(row);
|
|
86
|
+
}
|
|
87
|
+
});
|
|
88
|
+
const rows = collectRows(model);
|
|
89
|
+
insertAll(rows);
|
|
90
|
+
return dbPath;
|
|
91
|
+
}
|
|
92
|
+
finally {
|
|
93
|
+
db.close();
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
// ── Row collection ────────────────────────────────────────────────────
|
|
97
|
+
/**
|
|
98
|
+
* Walk the entire domain model and produce one {@link IndexRow} per
|
|
99
|
+
* searchable item.
|
|
100
|
+
*/
|
|
101
|
+
function collectRows(model) {
|
|
102
|
+
const rows = [];
|
|
103
|
+
// ── Actors ────────────────────────────────────────────────────────
|
|
104
|
+
for (const actor of model.actors) {
|
|
105
|
+
rows.push({
|
|
106
|
+
id: `actor.${actor.name}`,
|
|
107
|
+
type: "actor",
|
|
108
|
+
context: "",
|
|
109
|
+
name: actor.name,
|
|
110
|
+
tags: actor.type,
|
|
111
|
+
text: joinText(actor.description),
|
|
112
|
+
relations: "[]",
|
|
113
|
+
adrRefs: JSON.stringify(actor.adr_refs ?? []),
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
// ── Bounded contexts & their items ──────────────────────────────
|
|
117
|
+
for (const [ctxName, ctx] of model.contexts) {
|
|
118
|
+
// Context itself
|
|
119
|
+
rows.push({
|
|
120
|
+
id: `context.${ctxName}`,
|
|
121
|
+
type: "context",
|
|
122
|
+
context: ctxName,
|
|
123
|
+
name: ctxName,
|
|
124
|
+
tags: "",
|
|
125
|
+
text: joinText(ctx.description),
|
|
126
|
+
relations: "[]",
|
|
127
|
+
adrRefs: "[]",
|
|
128
|
+
});
|
|
129
|
+
// Glossary, events, commands, policies, aggregates, read models
|
|
130
|
+
forEachItem(ctx, (type, name, item) => {
|
|
131
|
+
const id = `${ctxName}.${name}`;
|
|
132
|
+
const adrRefs = JSON.stringify(itemAdrRefs(item) ?? []);
|
|
133
|
+
switch (type) {
|
|
134
|
+
case "glossary": {
|
|
135
|
+
const entry = item;
|
|
136
|
+
const aliases = entry.aliases ?? [];
|
|
137
|
+
rows.push({
|
|
138
|
+
id,
|
|
139
|
+
type: "glossary",
|
|
140
|
+
context: ctxName,
|
|
141
|
+
name: entry.term,
|
|
142
|
+
tags: aliases.join(" "),
|
|
143
|
+
text: joinText(entry.definition, ...aliases),
|
|
144
|
+
relations: "[]",
|
|
145
|
+
adrRefs,
|
|
146
|
+
});
|
|
147
|
+
break;
|
|
148
|
+
}
|
|
149
|
+
case "event": {
|
|
150
|
+
const evt = item;
|
|
151
|
+
const relIds = [];
|
|
152
|
+
if (evt.raised_by)
|
|
153
|
+
relIds.push(`${ctxName}.${evt.raised_by}`);
|
|
154
|
+
rows.push({
|
|
155
|
+
id,
|
|
156
|
+
type: "event",
|
|
157
|
+
context: ctxName,
|
|
158
|
+
name: evt.name,
|
|
159
|
+
tags: "",
|
|
160
|
+
text: joinText(evt.description, fieldsText(evt.fields), ...(evt.invariants ?? [])),
|
|
161
|
+
relations: JSON.stringify(relIds),
|
|
162
|
+
adrRefs,
|
|
163
|
+
});
|
|
164
|
+
break;
|
|
165
|
+
}
|
|
166
|
+
case "command": {
|
|
167
|
+
const cmd = item;
|
|
168
|
+
const relIds = [];
|
|
169
|
+
if (cmd.handled_by)
|
|
170
|
+
relIds.push(`${ctxName}.${cmd.handled_by}`);
|
|
171
|
+
if (cmd.actor)
|
|
172
|
+
relIds.push(`actor.${cmd.actor}`);
|
|
173
|
+
rows.push({
|
|
174
|
+
id,
|
|
175
|
+
type: "command",
|
|
176
|
+
context: ctxName,
|
|
177
|
+
name: cmd.name,
|
|
178
|
+
tags: "",
|
|
179
|
+
text: joinText(cmd.description, fieldsText(cmd.fields), ...(cmd.preconditions ?? []), ...(cmd.rejections ?? [])),
|
|
180
|
+
relations: JSON.stringify(relIds),
|
|
181
|
+
adrRefs,
|
|
182
|
+
});
|
|
183
|
+
break;
|
|
184
|
+
}
|
|
185
|
+
case "policy": {
|
|
186
|
+
const pol = item;
|
|
187
|
+
const relIds = [];
|
|
188
|
+
for (const t of pol.when?.events ?? [])
|
|
189
|
+
relIds.push(`${ctxName}.${t}`);
|
|
190
|
+
for (const e of pol.then?.commands ?? [])
|
|
191
|
+
relIds.push(`${ctxName}.${e}`);
|
|
192
|
+
rows.push({
|
|
193
|
+
id,
|
|
194
|
+
type: "policy",
|
|
195
|
+
context: ctxName,
|
|
196
|
+
name: pol.name,
|
|
197
|
+
tags: "",
|
|
198
|
+
text: joinText(pol.description),
|
|
199
|
+
relations: JSON.stringify(relIds),
|
|
200
|
+
adrRefs,
|
|
201
|
+
});
|
|
202
|
+
break;
|
|
203
|
+
}
|
|
204
|
+
case "aggregate": {
|
|
205
|
+
const agg = item;
|
|
206
|
+
const relIds = [];
|
|
207
|
+
for (const h of agg.handles?.commands ?? [])
|
|
208
|
+
relIds.push(`${ctxName}.${h}`);
|
|
209
|
+
for (const e of agg.emits?.events ?? [])
|
|
210
|
+
relIds.push(`${ctxName}.${e}`);
|
|
211
|
+
rows.push({
|
|
212
|
+
id,
|
|
213
|
+
type: "aggregate",
|
|
214
|
+
context: ctxName,
|
|
215
|
+
name: agg.name,
|
|
216
|
+
tags: "",
|
|
217
|
+
text: joinText(agg.description, ...(agg.invariants ?? [])),
|
|
218
|
+
relations: JSON.stringify(relIds),
|
|
219
|
+
adrRefs,
|
|
220
|
+
});
|
|
221
|
+
break;
|
|
222
|
+
}
|
|
223
|
+
case "read_model": {
|
|
224
|
+
const rm = item;
|
|
225
|
+
const relIds = [];
|
|
226
|
+
for (const sub of rm.subscribes_to ?? [])
|
|
227
|
+
relIds.push(`${ctxName}.${sub}`);
|
|
228
|
+
for (const user of rm.used_by ?? [])
|
|
229
|
+
relIds.push(`actor.${user}`);
|
|
230
|
+
rows.push({
|
|
231
|
+
id,
|
|
232
|
+
type: "read_model",
|
|
233
|
+
context: ctxName,
|
|
234
|
+
name: rm.name,
|
|
235
|
+
tags: "",
|
|
236
|
+
text: joinText(rm.description),
|
|
237
|
+
relations: JSON.stringify(relIds),
|
|
238
|
+
adrRefs,
|
|
239
|
+
});
|
|
240
|
+
break;
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
});
|
|
244
|
+
}
|
|
245
|
+
// ── ADRs ──────────────────────────────────────────────────────────
|
|
246
|
+
for (const [adrId, adr] of model.adrs) {
|
|
247
|
+
const relIds = [];
|
|
248
|
+
for (const ref of adr.domain_refs ?? [])
|
|
249
|
+
relIds.push(ref);
|
|
250
|
+
if (adr.superseded_by)
|
|
251
|
+
relIds.push(adr.superseded_by);
|
|
252
|
+
rows.push({
|
|
253
|
+
id: adrId,
|
|
254
|
+
type: "adr",
|
|
255
|
+
context: "",
|
|
256
|
+
name: adr.title,
|
|
257
|
+
tags: adr.status,
|
|
258
|
+
text: joinText(adr.title, adr.status, adr.deciders?.join(" "), adr.body),
|
|
259
|
+
relations: JSON.stringify(relIds),
|
|
260
|
+
adrRefs: "[]",
|
|
261
|
+
});
|
|
262
|
+
}
|
|
263
|
+
// ── Flows ─────────────────────────────────────────────────────────
|
|
264
|
+
for (const flow of model.index.flows ?? []) {
|
|
265
|
+
const stepRefs = flow.steps.map((s) => s.ref);
|
|
266
|
+
rows.push({
|
|
267
|
+
id: `flow.${flow.name}`,
|
|
268
|
+
type: "flow",
|
|
269
|
+
context: "",
|
|
270
|
+
name: flow.name,
|
|
271
|
+
tags: "",
|
|
272
|
+
text: joinText(flow.description, ...flow.steps.map((s) => s.ref)),
|
|
273
|
+
relations: JSON.stringify(stepRefs),
|
|
274
|
+
adrRefs: "[]",
|
|
275
|
+
});
|
|
276
|
+
}
|
|
277
|
+
return rows;
|
|
278
|
+
}
|
|
279
|
+
//# sourceMappingURL=indexer.js.map
|
|
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AAI,CAAC,SAAS,CAAC,MAAM,CAAC;YACjC,OAAO,EAAE,IAAI;SACd,CAAC,CAAC;IACL,CAAC;IAED,qEAAqE;IAErE,KAAK,MAAM,IAAI,IAAI,KAAK,CAAC,KAAK,CAAC,KAAK,IAAI,EAAE,EAAE,CAAC;QAC3C,MAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,GAAa,CAAC,CAAC;QACxD,IAAI,CAAC,IAAI,CAAC;YACR,EAAE,EAAE,QAAQ,IAAI,CAAC,IAAI,EAAE;YACvB,IAAI,EAAE,MAAM;YACZ,OAAO,EAAE,EAAE;YACX,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,IAAI,EAAE,EAAE;YACR,IAAI,EAAE,QAAQ,CAAC,IAAI,CAAC,WAAW,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,GAAa,CAAC,CAAC;YAC3E,SAAS,EAAE,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC;YACnC,OAAO,EAAE,IAAI;SACd,CAAC,CAAC;IACL,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Domain documentation renderer.
|
|
3
|
+
*
|
|
4
|
+
* Compiles Handlebars templates from `tools/domain-pack/templates/`
|
|
5
|
+
* and renders Markdown documentation to `docs/domain/`.
|
|
6
|
+
*
|
|
7
|
+
* Output structure:
|
|
8
|
+
* docs/domain/
|
|
9
|
+
* index.md ← top-level domain overview
|
|
10
|
+
* <context>/
|
|
11
|
+
* index.md ← per-context overview
|
|
12
|
+
* <ItemName>.md ← per-item page
|
|
13
|
+
*/
|
|
14
|
+
import type { DomainModel } from "../../shared/types/domain.js";
|
|
15
|
+
/** Options for the renderer. */
|
|
16
|
+
export interface RendererOptions {
|
|
17
|
+
/** Override repository root (default: auto-detected). */
|
|
18
|
+
root?: string;
|
|
19
|
+
/** Override templates directory. */
|
|
20
|
+
templateDir?: string;
|
|
21
|
+
/** Override output directory. */
|
|
22
|
+
outputDir?: string;
|
|
23
|
+
}
|
|
24
|
+
/** Result returned after rendering completes. */
|
|
25
|
+
export interface RenderResult {
|
|
26
|
+
/** Total number of files written. */
|
|
27
|
+
fileCount: number;
|
|
28
|
+
/** Paths of all written files (absolute). */
|
|
29
|
+
files: string[];
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Render the full domain model as Markdown documentation.
|
|
33
|
+
*
|
|
34
|
+
* 1. Compiles Handlebars templates
|
|
35
|
+
* 2. Renders `docs/domain/index.md`
|
|
36
|
+
* 3. For each bounded context renders `docs/domain/<ctx>/index.md`
|
|
37
|
+
* 4. For each item in a context renders `docs/domain/<ctx>/<Item>.md`
|
|
38
|
+
*
|
|
39
|
+
* @returns A {@link RenderResult} with file count and paths.
|
|
40
|
+
*/
|
|
41
|
+
export declare function renderDocs(model: DomainModel, options?: RendererOptions): RenderResult;
|
|
42
|
+
//# sourceMappingURL=renderer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"renderer.d.ts","sourceRoot":"","sources":["../../../src/features/pipeline/renderer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAKH,OAAO,KAAK,EACV,WAAW,EAKZ,MAAM,8BAA8B,CAAC;AAMtC,gCAAgC;AAChC,MAAM,WAAW,eAAe;IAC9B,yDAAyD;IACzD,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,oCAAoC;IACpC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,iCAAiC;IACjC,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,iDAAiD;AACjD,MAAM,WAAW,YAAY;IAC3B,qCAAqC;IACrC,SAAS,EAAE,MAAM,CAAC;IAClB,6CAA6C;IAC7C,KAAK,EAAE,MAAM,EAAE,CAAC;CACjB;AAkOD;;;;;;;;;GASG;AACH,wBAAgB,UAAU,CACxB,KAAK,EAAE,WAAW,EAClB,OAAO,GAAE,eAAoB,GAC5B,YAAY,CA4Ed"}
|